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 { Some(()) } else { None }
2290 }
2291
2292 fn decode(
2294 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2295 ) -> Result<PublicationResponder_Event, fidl::Error> {
2296 let (bytes, _handles) = buf.split_mut();
2297 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2298 debug_assert_eq!(tx_header.tx_id, 0);
2299 match tx_header.ordinal {
2300 0x5593e156370b19df => {
2301 let mut out = fidl::new_empty!(
2302 PublicationResponderSetSubtypesRequest,
2303 fidl::encoding::DefaultFuchsiaResourceDialect
2304 );
2305 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PublicationResponderSetSubtypesRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
2306 Ok((PublicationResponder_Event::SetSubtypes { subtypes: out.subtypes }))
2307 }
2308 0x2550cc2a43aa838b => {
2309 let mut out = fidl::new_empty!(
2310 fidl::encoding::EmptyPayload,
2311 fidl::encoding::DefaultFuchsiaResourceDialect
2312 );
2313 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
2314 Ok((PublicationResponder_Event::Reannounce {}))
2315 }
2316 _ => Err(fidl::Error::UnknownOrdinal {
2317 ordinal: tx_header.ordinal,
2318 protocol_name:
2319 <PublicationResponder_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2320 }),
2321 }
2322 }
2323}
2324
2325pub struct PublicationResponder_RequestStream {
2327 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2328 is_terminated: bool,
2329}
2330
2331impl std::marker::Unpin for PublicationResponder_RequestStream {}
2332
2333impl futures::stream::FusedStream for PublicationResponder_RequestStream {
2334 fn is_terminated(&self) -> bool {
2335 self.is_terminated
2336 }
2337}
2338
2339impl fidl::endpoints::RequestStream for PublicationResponder_RequestStream {
2340 type Protocol = PublicationResponder_Marker;
2341 type ControlHandle = PublicationResponder_ControlHandle;
2342
2343 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2344 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2345 }
2346
2347 fn control_handle(&self) -> Self::ControlHandle {
2348 PublicationResponder_ControlHandle { inner: self.inner.clone() }
2349 }
2350
2351 fn into_inner(
2352 self,
2353 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2354 {
2355 (self.inner, self.is_terminated)
2356 }
2357
2358 fn from_inner(
2359 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2360 is_terminated: bool,
2361 ) -> Self {
2362 Self { inner, is_terminated }
2363 }
2364}
2365
2366impl futures::Stream for PublicationResponder_RequestStream {
2367 type Item = Result<PublicationResponder_Request, fidl::Error>;
2368
2369 fn poll_next(
2370 mut self: std::pin::Pin<&mut Self>,
2371 cx: &mut std::task::Context<'_>,
2372 ) -> std::task::Poll<Option<Self::Item>> {
2373 let this = &mut *self;
2374 if this.inner.check_shutdown(cx) {
2375 this.is_terminated = true;
2376 return std::task::Poll::Ready(None);
2377 }
2378 if this.is_terminated {
2379 panic!("polled PublicationResponder_RequestStream after completion");
2380 }
2381 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2382 |bytes, handles| {
2383 match this.inner.channel().read_etc(cx, bytes, handles) {
2384 std::task::Poll::Ready(Ok(())) => {}
2385 std::task::Poll::Pending => return std::task::Poll::Pending,
2386 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2387 this.is_terminated = true;
2388 return std::task::Poll::Ready(None);
2389 }
2390 std::task::Poll::Ready(Err(e)) => {
2391 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2392 e.into(),
2393 ))));
2394 }
2395 }
2396
2397 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2399
2400 std::task::Poll::Ready(Some(match header.ordinal {
2401 0x71d805aee2907d06 => {
2402 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2403 let mut req = fidl::new_empty!(PublicationResponderOnPublicationRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2404 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PublicationResponderOnPublicationRequest>(&header, _body_bytes, handles, &mut req)?;
2405 let control_handle = PublicationResponder_ControlHandle {
2406 inner: this.inner.clone(),
2407 };
2408 Ok(PublicationResponder_Request::OnPublication {publication_cause: req.publication_cause,
2409subtype: req.subtype,
2410source_addresses: req.source_addresses,
2411
2412 responder: PublicationResponder_OnPublicationResponder {
2413 control_handle: std::mem::ManuallyDrop::new(control_handle),
2414 tx_id: header.tx_id,
2415 },
2416 })
2417 }
2418 _ => Err(fidl::Error::UnknownOrdinal {
2419 ordinal: header.ordinal,
2420 protocol_name: <PublicationResponder_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2421 }),
2422 }))
2423 },
2424 )
2425 }
2426}
2427
2428#[derive(Debug)]
2430pub enum PublicationResponder_Request {
2431 OnPublication {
2438 publication_cause: PublicationCause,
2439 subtype: Option<String>,
2440 source_addresses: Vec<fidl_fuchsia_net::IpAddress>,
2441 responder: PublicationResponder_OnPublicationResponder,
2442 },
2443}
2444
2445impl PublicationResponder_Request {
2446 #[allow(irrefutable_let_patterns)]
2447 pub fn into_on_publication(
2448 self,
2449 ) -> Option<(
2450 PublicationCause,
2451 Option<String>,
2452 Vec<fidl_fuchsia_net::IpAddress>,
2453 PublicationResponder_OnPublicationResponder,
2454 )> {
2455 if let PublicationResponder_Request::OnPublication {
2456 publication_cause,
2457 subtype,
2458 source_addresses,
2459 responder,
2460 } = self
2461 {
2462 Some((publication_cause, subtype, source_addresses, responder))
2463 } else {
2464 None
2465 }
2466 }
2467
2468 pub fn method_name(&self) -> &'static str {
2470 match *self {
2471 PublicationResponder_Request::OnPublication { .. } => "on_publication",
2472 }
2473 }
2474}
2475
2476#[derive(Debug, Clone)]
2477pub struct PublicationResponder_ControlHandle {
2478 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2479}
2480
2481impl fidl::endpoints::ControlHandle for PublicationResponder_ControlHandle {
2482 fn shutdown(&self) {
2483 self.inner.shutdown()
2484 }
2485 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2486 self.inner.shutdown_with_epitaph(status)
2487 }
2488
2489 fn is_closed(&self) -> bool {
2490 self.inner.channel().is_closed()
2491 }
2492 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2493 self.inner.channel().on_closed()
2494 }
2495
2496 #[cfg(target_os = "fuchsia")]
2497 fn signal_peer(
2498 &self,
2499 clear_mask: zx::Signals,
2500 set_mask: zx::Signals,
2501 ) -> Result<(), zx_status::Status> {
2502 use fidl::Peered;
2503 self.inner.channel().signal_peer(clear_mask, set_mask)
2504 }
2505}
2506
2507impl PublicationResponder_ControlHandle {
2508 pub fn send_set_subtypes(&self, mut subtypes: &[String]) -> Result<(), fidl::Error> {
2509 self.inner.send::<PublicationResponderSetSubtypesRequest>(
2510 (subtypes,),
2511 0,
2512 0x5593e156370b19df,
2513 fidl::encoding::DynamicFlags::empty(),
2514 )
2515 }
2516
2517 pub fn send_reannounce(&self) -> Result<(), fidl::Error> {
2518 self.inner.send::<fidl::encoding::EmptyPayload>(
2519 (),
2520 0,
2521 0x2550cc2a43aa838b,
2522 fidl::encoding::DynamicFlags::empty(),
2523 )
2524 }
2525}
2526
2527#[must_use = "FIDL methods require a response to be sent"]
2528#[derive(Debug)]
2529pub struct PublicationResponder_OnPublicationResponder {
2530 control_handle: std::mem::ManuallyDrop<PublicationResponder_ControlHandle>,
2531 tx_id: u32,
2532}
2533
2534impl std::ops::Drop for PublicationResponder_OnPublicationResponder {
2538 fn drop(&mut self) {
2539 self.control_handle.shutdown();
2540 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2542 }
2543}
2544
2545impl fidl::endpoints::Responder for PublicationResponder_OnPublicationResponder {
2546 type ControlHandle = PublicationResponder_ControlHandle;
2547
2548 fn control_handle(&self) -> &PublicationResponder_ControlHandle {
2549 &self.control_handle
2550 }
2551
2552 fn drop_without_shutdown(mut self) {
2553 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2555 std::mem::forget(self);
2557 }
2558}
2559
2560impl PublicationResponder_OnPublicationResponder {
2561 pub fn send(self, mut publication: Option<&Publication>) -> Result<(), fidl::Error> {
2565 let _result = self.send_raw(publication);
2566 if _result.is_err() {
2567 self.control_handle.shutdown();
2568 }
2569 self.drop_without_shutdown();
2570 _result
2571 }
2572
2573 pub fn send_no_shutdown_on_err(
2575 self,
2576 mut publication: Option<&Publication>,
2577 ) -> Result<(), fidl::Error> {
2578 let _result = self.send_raw(publication);
2579 self.drop_without_shutdown();
2580 _result
2581 }
2582
2583 fn send_raw(&self, mut publication: Option<&Publication>) -> Result<(), fidl::Error> {
2584 self.control_handle.inner.send::<PublicationResponderOnPublicationResponse>(
2585 (publication,),
2586 self.tx_id,
2587 0x71d805aee2907d06,
2588 fidl::encoding::DynamicFlags::empty(),
2589 )
2590 }
2591}
2592
2593#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2594pub struct PublisherMarker;
2595
2596impl fidl::endpoints::ProtocolMarker for PublisherMarker {
2597 type Proxy = PublisherProxy;
2598 type RequestStream = PublisherRequestStream;
2599 #[cfg(target_os = "fuchsia")]
2600 type SynchronousProxy = PublisherSynchronousProxy;
2601
2602 const DEBUG_NAME: &'static str = "fuchsia.net.mdns.Publisher";
2603}
2604impl fidl::endpoints::DiscoverableProtocolMarker for PublisherMarker {}
2605pub type PublisherPublishServiceInstanceResult = Result<(), Error>;
2606
2607pub trait PublisherProxyInterface: Send + Sync {
2608 type PublishServiceInstanceResponseFut: std::future::Future<Output = Result<PublisherPublishServiceInstanceResult, fidl::Error>>
2609 + Send;
2610 fn r#publish_service_instance(
2611 &self,
2612 service: &str,
2613 instance: &str,
2614 media: Media,
2615 perform_probe: bool,
2616 publication_responder: fidl::endpoints::ClientEnd<PublicationResponder_Marker>,
2617 ) -> Self::PublishServiceInstanceResponseFut;
2618}
2619#[derive(Debug)]
2620#[cfg(target_os = "fuchsia")]
2621pub struct PublisherSynchronousProxy {
2622 client: fidl::client::sync::Client,
2623}
2624
2625#[cfg(target_os = "fuchsia")]
2626impl fidl::endpoints::SynchronousProxy for PublisherSynchronousProxy {
2627 type Proxy = PublisherProxy;
2628 type Protocol = PublisherMarker;
2629
2630 fn from_channel(inner: fidl::Channel) -> Self {
2631 Self::new(inner)
2632 }
2633
2634 fn into_channel(self) -> fidl::Channel {
2635 self.client.into_channel()
2636 }
2637
2638 fn as_channel(&self) -> &fidl::Channel {
2639 self.client.as_channel()
2640 }
2641}
2642
2643#[cfg(target_os = "fuchsia")]
2644impl PublisherSynchronousProxy {
2645 pub fn new(channel: fidl::Channel) -> Self {
2646 let protocol_name = <PublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2647 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2648 }
2649
2650 pub fn into_channel(self) -> fidl::Channel {
2651 self.client.into_channel()
2652 }
2653
2654 pub fn wait_for_event(
2657 &self,
2658 deadline: zx::MonotonicInstant,
2659 ) -> Result<PublisherEvent, fidl::Error> {
2660 PublisherEvent::decode(self.client.wait_for_event(deadline)?)
2661 }
2662
2663 pub fn r#publish_service_instance(
2676 &self,
2677 mut service: &str,
2678 mut instance: &str,
2679 mut media: Media,
2680 mut perform_probe: bool,
2681 mut publication_responder: fidl::endpoints::ClientEnd<PublicationResponder_Marker>,
2682 ___deadline: zx::MonotonicInstant,
2683 ) -> Result<PublisherPublishServiceInstanceResult, fidl::Error> {
2684 let _response = self.client.send_query::<
2685 PublisherPublishServiceInstanceRequest,
2686 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
2687 >(
2688 (service, instance, media, perform_probe, publication_responder,),
2689 0x3712171c42878797,
2690 fidl::encoding::DynamicFlags::empty(),
2691 ___deadline,
2692 )?;
2693 Ok(_response.map(|x| x))
2694 }
2695}
2696
2697#[cfg(target_os = "fuchsia")]
2698impl From<PublisherSynchronousProxy> for zx::Handle {
2699 fn from(value: PublisherSynchronousProxy) -> Self {
2700 value.into_channel().into()
2701 }
2702}
2703
2704#[cfg(target_os = "fuchsia")]
2705impl From<fidl::Channel> for PublisherSynchronousProxy {
2706 fn from(value: fidl::Channel) -> Self {
2707 Self::new(value)
2708 }
2709}
2710
2711#[cfg(target_os = "fuchsia")]
2712impl fidl::endpoints::FromClient for PublisherSynchronousProxy {
2713 type Protocol = PublisherMarker;
2714
2715 fn from_client(value: fidl::endpoints::ClientEnd<PublisherMarker>) -> Self {
2716 Self::new(value.into_channel())
2717 }
2718}
2719
2720#[derive(Debug, Clone)]
2721pub struct PublisherProxy {
2722 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2723}
2724
2725impl fidl::endpoints::Proxy for PublisherProxy {
2726 type Protocol = PublisherMarker;
2727
2728 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2729 Self::new(inner)
2730 }
2731
2732 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2733 self.client.into_channel().map_err(|client| Self { client })
2734 }
2735
2736 fn as_channel(&self) -> &::fidl::AsyncChannel {
2737 self.client.as_channel()
2738 }
2739}
2740
2741impl PublisherProxy {
2742 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2744 let protocol_name = <PublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2745 Self { client: fidl::client::Client::new(channel, protocol_name) }
2746 }
2747
2748 pub fn take_event_stream(&self) -> PublisherEventStream {
2754 PublisherEventStream { event_receiver: self.client.take_event_receiver() }
2755 }
2756
2757 pub fn r#publish_service_instance(
2770 &self,
2771 mut service: &str,
2772 mut instance: &str,
2773 mut media: Media,
2774 mut perform_probe: bool,
2775 mut publication_responder: fidl::endpoints::ClientEnd<PublicationResponder_Marker>,
2776 ) -> fidl::client::QueryResponseFut<
2777 PublisherPublishServiceInstanceResult,
2778 fidl::encoding::DefaultFuchsiaResourceDialect,
2779 > {
2780 PublisherProxyInterface::r#publish_service_instance(
2781 self,
2782 service,
2783 instance,
2784 media,
2785 perform_probe,
2786 publication_responder,
2787 )
2788 }
2789}
2790
2791impl PublisherProxyInterface for PublisherProxy {
2792 type PublishServiceInstanceResponseFut = fidl::client::QueryResponseFut<
2793 PublisherPublishServiceInstanceResult,
2794 fidl::encoding::DefaultFuchsiaResourceDialect,
2795 >;
2796 fn r#publish_service_instance(
2797 &self,
2798 mut service: &str,
2799 mut instance: &str,
2800 mut media: Media,
2801 mut perform_probe: bool,
2802 mut publication_responder: fidl::endpoints::ClientEnd<PublicationResponder_Marker>,
2803 ) -> Self::PublishServiceInstanceResponseFut {
2804 fn _decode(
2805 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2806 ) -> Result<PublisherPublishServiceInstanceResult, fidl::Error> {
2807 let _response = fidl::client::decode_transaction_body::<
2808 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
2809 fidl::encoding::DefaultFuchsiaResourceDialect,
2810 0x3712171c42878797,
2811 >(_buf?)?;
2812 Ok(_response.map(|x| x))
2813 }
2814 self.client.send_query_and_decode::<
2815 PublisherPublishServiceInstanceRequest,
2816 PublisherPublishServiceInstanceResult,
2817 >(
2818 (service, instance, media, perform_probe, publication_responder,),
2819 0x3712171c42878797,
2820 fidl::encoding::DynamicFlags::empty(),
2821 _decode,
2822 )
2823 }
2824}
2825
2826pub struct PublisherEventStream {
2827 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2828}
2829
2830impl std::marker::Unpin for PublisherEventStream {}
2831
2832impl futures::stream::FusedStream for PublisherEventStream {
2833 fn is_terminated(&self) -> bool {
2834 self.event_receiver.is_terminated()
2835 }
2836}
2837
2838impl futures::Stream for PublisherEventStream {
2839 type Item = Result<PublisherEvent, fidl::Error>;
2840
2841 fn poll_next(
2842 mut self: std::pin::Pin<&mut Self>,
2843 cx: &mut std::task::Context<'_>,
2844 ) -> std::task::Poll<Option<Self::Item>> {
2845 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2846 &mut self.event_receiver,
2847 cx
2848 )?) {
2849 Some(buf) => std::task::Poll::Ready(Some(PublisherEvent::decode(buf))),
2850 None => std::task::Poll::Ready(None),
2851 }
2852 }
2853}
2854
2855#[derive(Debug)]
2856pub enum PublisherEvent {}
2857
2858impl PublisherEvent {
2859 fn decode(
2861 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2862 ) -> Result<PublisherEvent, fidl::Error> {
2863 let (bytes, _handles) = buf.split_mut();
2864 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2865 debug_assert_eq!(tx_header.tx_id, 0);
2866 match tx_header.ordinal {
2867 _ => Err(fidl::Error::UnknownOrdinal {
2868 ordinal: tx_header.ordinal,
2869 protocol_name: <PublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2870 }),
2871 }
2872 }
2873}
2874
2875pub struct PublisherRequestStream {
2877 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2878 is_terminated: bool,
2879}
2880
2881impl std::marker::Unpin for PublisherRequestStream {}
2882
2883impl futures::stream::FusedStream for PublisherRequestStream {
2884 fn is_terminated(&self) -> bool {
2885 self.is_terminated
2886 }
2887}
2888
2889impl fidl::endpoints::RequestStream for PublisherRequestStream {
2890 type Protocol = PublisherMarker;
2891 type ControlHandle = PublisherControlHandle;
2892
2893 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2894 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2895 }
2896
2897 fn control_handle(&self) -> Self::ControlHandle {
2898 PublisherControlHandle { inner: self.inner.clone() }
2899 }
2900
2901 fn into_inner(
2902 self,
2903 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2904 {
2905 (self.inner, self.is_terminated)
2906 }
2907
2908 fn from_inner(
2909 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2910 is_terminated: bool,
2911 ) -> Self {
2912 Self { inner, is_terminated }
2913 }
2914}
2915
2916impl futures::Stream for PublisherRequestStream {
2917 type Item = Result<PublisherRequest, fidl::Error>;
2918
2919 fn poll_next(
2920 mut self: std::pin::Pin<&mut Self>,
2921 cx: &mut std::task::Context<'_>,
2922 ) -> std::task::Poll<Option<Self::Item>> {
2923 let this = &mut *self;
2924 if this.inner.check_shutdown(cx) {
2925 this.is_terminated = true;
2926 return std::task::Poll::Ready(None);
2927 }
2928 if this.is_terminated {
2929 panic!("polled PublisherRequestStream after completion");
2930 }
2931 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2932 |bytes, handles| {
2933 match this.inner.channel().read_etc(cx, bytes, handles) {
2934 std::task::Poll::Ready(Ok(())) => {}
2935 std::task::Poll::Pending => return std::task::Poll::Pending,
2936 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2937 this.is_terminated = true;
2938 return std::task::Poll::Ready(None);
2939 }
2940 std::task::Poll::Ready(Err(e)) => {
2941 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2942 e.into(),
2943 ))));
2944 }
2945 }
2946
2947 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2949
2950 std::task::Poll::Ready(Some(match header.ordinal {
2951 0x3712171c42878797 => {
2952 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2953 let mut req = fidl::new_empty!(
2954 PublisherPublishServiceInstanceRequest,
2955 fidl::encoding::DefaultFuchsiaResourceDialect
2956 );
2957 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PublisherPublishServiceInstanceRequest>(&header, _body_bytes, handles, &mut req)?;
2958 let control_handle = PublisherControlHandle { inner: this.inner.clone() };
2959 Ok(PublisherRequest::PublishServiceInstance {
2960 service: req.service,
2961 instance: req.instance,
2962 media: req.media,
2963 perform_probe: req.perform_probe,
2964 publication_responder: req.publication_responder,
2965
2966 responder: PublisherPublishServiceInstanceResponder {
2967 control_handle: std::mem::ManuallyDrop::new(control_handle),
2968 tx_id: header.tx_id,
2969 },
2970 })
2971 }
2972 _ => Err(fidl::Error::UnknownOrdinal {
2973 ordinal: header.ordinal,
2974 protocol_name:
2975 <PublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2976 }),
2977 }))
2978 },
2979 )
2980 }
2981}
2982
2983#[derive(Debug)]
2986pub enum PublisherRequest {
2987 PublishServiceInstance {
3000 service: String,
3001 instance: String,
3002 media: Media,
3003 perform_probe: bool,
3004 publication_responder: fidl::endpoints::ClientEnd<PublicationResponder_Marker>,
3005 responder: PublisherPublishServiceInstanceResponder,
3006 },
3007}
3008
3009impl PublisherRequest {
3010 #[allow(irrefutable_let_patterns)]
3011 pub fn into_publish_service_instance(
3012 self,
3013 ) -> Option<(
3014 String,
3015 String,
3016 Media,
3017 bool,
3018 fidl::endpoints::ClientEnd<PublicationResponder_Marker>,
3019 PublisherPublishServiceInstanceResponder,
3020 )> {
3021 if let PublisherRequest::PublishServiceInstance {
3022 service,
3023 instance,
3024 media,
3025 perform_probe,
3026 publication_responder,
3027 responder,
3028 } = self
3029 {
3030 Some((service, instance, media, perform_probe, publication_responder, responder))
3031 } else {
3032 None
3033 }
3034 }
3035
3036 pub fn method_name(&self) -> &'static str {
3038 match *self {
3039 PublisherRequest::PublishServiceInstance { .. } => "publish_service_instance",
3040 }
3041 }
3042}
3043
3044#[derive(Debug, Clone)]
3045pub struct PublisherControlHandle {
3046 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3047}
3048
3049impl fidl::endpoints::ControlHandle for PublisherControlHandle {
3050 fn shutdown(&self) {
3051 self.inner.shutdown()
3052 }
3053 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3054 self.inner.shutdown_with_epitaph(status)
3055 }
3056
3057 fn is_closed(&self) -> bool {
3058 self.inner.channel().is_closed()
3059 }
3060 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3061 self.inner.channel().on_closed()
3062 }
3063
3064 #[cfg(target_os = "fuchsia")]
3065 fn signal_peer(
3066 &self,
3067 clear_mask: zx::Signals,
3068 set_mask: zx::Signals,
3069 ) -> Result<(), zx_status::Status> {
3070 use fidl::Peered;
3071 self.inner.channel().signal_peer(clear_mask, set_mask)
3072 }
3073}
3074
3075impl PublisherControlHandle {}
3076
3077#[must_use = "FIDL methods require a response to be sent"]
3078#[derive(Debug)]
3079pub struct PublisherPublishServiceInstanceResponder {
3080 control_handle: std::mem::ManuallyDrop<PublisherControlHandle>,
3081 tx_id: u32,
3082}
3083
3084impl std::ops::Drop for PublisherPublishServiceInstanceResponder {
3088 fn drop(&mut self) {
3089 self.control_handle.shutdown();
3090 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3092 }
3093}
3094
3095impl fidl::endpoints::Responder for PublisherPublishServiceInstanceResponder {
3096 type ControlHandle = PublisherControlHandle;
3097
3098 fn control_handle(&self) -> &PublisherControlHandle {
3099 &self.control_handle
3100 }
3101
3102 fn drop_without_shutdown(mut self) {
3103 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3105 std::mem::forget(self);
3107 }
3108}
3109
3110impl PublisherPublishServiceInstanceResponder {
3111 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
3115 let _result = self.send_raw(result);
3116 if _result.is_err() {
3117 self.control_handle.shutdown();
3118 }
3119 self.drop_without_shutdown();
3120 _result
3121 }
3122
3123 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
3125 let _result = self.send_raw(result);
3126 self.drop_without_shutdown();
3127 _result
3128 }
3129
3130 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
3131 self.control_handle
3132 .inner
3133 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
3134 result,
3135 self.tx_id,
3136 0x3712171c42878797,
3137 fidl::encoding::DynamicFlags::empty(),
3138 )
3139 }
3140}
3141
3142#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3143pub struct ResolverMarker;
3144
3145impl fidl::endpoints::ProtocolMarker for ResolverMarker {
3146 type Proxy = ResolverProxy;
3147 type RequestStream = ResolverRequestStream;
3148 #[cfg(target_os = "fuchsia")]
3149 type SynchronousProxy = ResolverSynchronousProxy;
3150
3151 const DEBUG_NAME: &'static str = "fuchsia.net.mdns.Resolver";
3152}
3153impl fidl::endpoints::DiscoverableProtocolMarker for ResolverMarker {}
3154
3155pub trait ResolverProxyInterface: Send + Sync {
3156 type ResolveHostNameResponseFut: std::future::Future<
3157 Output = Result<
3158 (
3159 Option<Box<fidl_fuchsia_net::Ipv4Address>>,
3160 Option<Box<fidl_fuchsia_net::Ipv6Address>>,
3161 ),
3162 fidl::Error,
3163 >,
3164 > + Send;
3165 fn r#resolve_host_name(&self, host: &str, timeout: i64) -> Self::ResolveHostNameResponseFut;
3166}
3167#[derive(Debug)]
3168#[cfg(target_os = "fuchsia")]
3169pub struct ResolverSynchronousProxy {
3170 client: fidl::client::sync::Client,
3171}
3172
3173#[cfg(target_os = "fuchsia")]
3174impl fidl::endpoints::SynchronousProxy for ResolverSynchronousProxy {
3175 type Proxy = ResolverProxy;
3176 type Protocol = ResolverMarker;
3177
3178 fn from_channel(inner: fidl::Channel) -> Self {
3179 Self::new(inner)
3180 }
3181
3182 fn into_channel(self) -> fidl::Channel {
3183 self.client.into_channel()
3184 }
3185
3186 fn as_channel(&self) -> &fidl::Channel {
3187 self.client.as_channel()
3188 }
3189}
3190
3191#[cfg(target_os = "fuchsia")]
3192impl ResolverSynchronousProxy {
3193 pub fn new(channel: fidl::Channel) -> Self {
3194 let protocol_name = <ResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3195 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3196 }
3197
3198 pub fn into_channel(self) -> fidl::Channel {
3199 self.client.into_channel()
3200 }
3201
3202 pub fn wait_for_event(
3205 &self,
3206 deadline: zx::MonotonicInstant,
3207 ) -> Result<ResolverEvent, fidl::Error> {
3208 ResolverEvent::decode(self.client.wait_for_event(deadline)?)
3209 }
3210
3211 pub fn r#resolve_host_name(
3219 &self,
3220 mut host: &str,
3221 mut timeout: i64,
3222 ___deadline: zx::MonotonicInstant,
3223 ) -> Result<
3224 (Option<Box<fidl_fuchsia_net::Ipv4Address>>, Option<Box<fidl_fuchsia_net::Ipv6Address>>),
3225 fidl::Error,
3226 > {
3227 let _response = self
3228 .client
3229 .send_query::<ResolverResolveHostNameRequest, ResolverResolveHostNameResponse>(
3230 (host, timeout),
3231 0x3c8b2b50aad28e4a,
3232 fidl::encoding::DynamicFlags::empty(),
3233 ___deadline,
3234 )?;
3235 Ok((_response.v4_address, _response.v6_address))
3236 }
3237}
3238
3239#[cfg(target_os = "fuchsia")]
3240impl From<ResolverSynchronousProxy> for zx::Handle {
3241 fn from(value: ResolverSynchronousProxy) -> Self {
3242 value.into_channel().into()
3243 }
3244}
3245
3246#[cfg(target_os = "fuchsia")]
3247impl From<fidl::Channel> for ResolverSynchronousProxy {
3248 fn from(value: fidl::Channel) -> Self {
3249 Self::new(value)
3250 }
3251}
3252
3253#[cfg(target_os = "fuchsia")]
3254impl fidl::endpoints::FromClient for ResolverSynchronousProxy {
3255 type Protocol = ResolverMarker;
3256
3257 fn from_client(value: fidl::endpoints::ClientEnd<ResolverMarker>) -> Self {
3258 Self::new(value.into_channel())
3259 }
3260}
3261
3262#[derive(Debug, Clone)]
3263pub struct ResolverProxy {
3264 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3265}
3266
3267impl fidl::endpoints::Proxy for ResolverProxy {
3268 type Protocol = ResolverMarker;
3269
3270 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3271 Self::new(inner)
3272 }
3273
3274 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3275 self.client.into_channel().map_err(|client| Self { client })
3276 }
3277
3278 fn as_channel(&self) -> &::fidl::AsyncChannel {
3279 self.client.as_channel()
3280 }
3281}
3282
3283impl ResolverProxy {
3284 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3286 let protocol_name = <ResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3287 Self { client: fidl::client::Client::new(channel, protocol_name) }
3288 }
3289
3290 pub fn take_event_stream(&self) -> ResolverEventStream {
3296 ResolverEventStream { event_receiver: self.client.take_event_receiver() }
3297 }
3298
3299 pub fn r#resolve_host_name(
3307 &self,
3308 mut host: &str,
3309 mut timeout: i64,
3310 ) -> fidl::client::QueryResponseFut<
3311 (Option<Box<fidl_fuchsia_net::Ipv4Address>>, Option<Box<fidl_fuchsia_net::Ipv6Address>>),
3312 fidl::encoding::DefaultFuchsiaResourceDialect,
3313 > {
3314 ResolverProxyInterface::r#resolve_host_name(self, host, timeout)
3315 }
3316}
3317
3318impl ResolverProxyInterface for ResolverProxy {
3319 type ResolveHostNameResponseFut = fidl::client::QueryResponseFut<
3320 (Option<Box<fidl_fuchsia_net::Ipv4Address>>, Option<Box<fidl_fuchsia_net::Ipv6Address>>),
3321 fidl::encoding::DefaultFuchsiaResourceDialect,
3322 >;
3323 fn r#resolve_host_name(
3324 &self,
3325 mut host: &str,
3326 mut timeout: i64,
3327 ) -> Self::ResolveHostNameResponseFut {
3328 fn _decode(
3329 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3330 ) -> Result<
3331 (
3332 Option<Box<fidl_fuchsia_net::Ipv4Address>>,
3333 Option<Box<fidl_fuchsia_net::Ipv6Address>>,
3334 ),
3335 fidl::Error,
3336 > {
3337 let _response = fidl::client::decode_transaction_body::<
3338 ResolverResolveHostNameResponse,
3339 fidl::encoding::DefaultFuchsiaResourceDialect,
3340 0x3c8b2b50aad28e4a,
3341 >(_buf?)?;
3342 Ok((_response.v4_address, _response.v6_address))
3343 }
3344 self.client.send_query_and_decode::<ResolverResolveHostNameRequest, (
3345 Option<Box<fidl_fuchsia_net::Ipv4Address>>,
3346 Option<Box<fidl_fuchsia_net::Ipv6Address>>,
3347 )>(
3348 (host, timeout),
3349 0x3c8b2b50aad28e4a,
3350 fidl::encoding::DynamicFlags::empty(),
3351 _decode,
3352 )
3353 }
3354}
3355
3356pub struct ResolverEventStream {
3357 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3358}
3359
3360impl std::marker::Unpin for ResolverEventStream {}
3361
3362impl futures::stream::FusedStream for ResolverEventStream {
3363 fn is_terminated(&self) -> bool {
3364 self.event_receiver.is_terminated()
3365 }
3366}
3367
3368impl futures::Stream for ResolverEventStream {
3369 type Item = Result<ResolverEvent, fidl::Error>;
3370
3371 fn poll_next(
3372 mut self: std::pin::Pin<&mut Self>,
3373 cx: &mut std::task::Context<'_>,
3374 ) -> std::task::Poll<Option<Self::Item>> {
3375 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3376 &mut self.event_receiver,
3377 cx
3378 )?) {
3379 Some(buf) => std::task::Poll::Ready(Some(ResolverEvent::decode(buf))),
3380 None => std::task::Poll::Ready(None),
3381 }
3382 }
3383}
3384
3385#[derive(Debug)]
3386pub enum ResolverEvent {}
3387
3388impl ResolverEvent {
3389 fn decode(
3391 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3392 ) -> Result<ResolverEvent, fidl::Error> {
3393 let (bytes, _handles) = buf.split_mut();
3394 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3395 debug_assert_eq!(tx_header.tx_id, 0);
3396 match tx_header.ordinal {
3397 _ => Err(fidl::Error::UnknownOrdinal {
3398 ordinal: tx_header.ordinal,
3399 protocol_name: <ResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3400 }),
3401 }
3402 }
3403}
3404
3405pub struct ResolverRequestStream {
3407 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3408 is_terminated: bool,
3409}
3410
3411impl std::marker::Unpin for ResolverRequestStream {}
3412
3413impl futures::stream::FusedStream for ResolverRequestStream {
3414 fn is_terminated(&self) -> bool {
3415 self.is_terminated
3416 }
3417}
3418
3419impl fidl::endpoints::RequestStream for ResolverRequestStream {
3420 type Protocol = ResolverMarker;
3421 type ControlHandle = ResolverControlHandle;
3422
3423 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3424 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3425 }
3426
3427 fn control_handle(&self) -> Self::ControlHandle {
3428 ResolverControlHandle { inner: self.inner.clone() }
3429 }
3430
3431 fn into_inner(
3432 self,
3433 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3434 {
3435 (self.inner, self.is_terminated)
3436 }
3437
3438 fn from_inner(
3439 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3440 is_terminated: bool,
3441 ) -> Self {
3442 Self { inner, is_terminated }
3443 }
3444}
3445
3446impl futures::Stream for ResolverRequestStream {
3447 type Item = Result<ResolverRequest, fidl::Error>;
3448
3449 fn poll_next(
3450 mut self: std::pin::Pin<&mut Self>,
3451 cx: &mut std::task::Context<'_>,
3452 ) -> std::task::Poll<Option<Self::Item>> {
3453 let this = &mut *self;
3454 if this.inner.check_shutdown(cx) {
3455 this.is_terminated = true;
3456 return std::task::Poll::Ready(None);
3457 }
3458 if this.is_terminated {
3459 panic!("polled ResolverRequestStream after completion");
3460 }
3461 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3462 |bytes, handles| {
3463 match this.inner.channel().read_etc(cx, bytes, handles) {
3464 std::task::Poll::Ready(Ok(())) => {}
3465 std::task::Poll::Pending => return std::task::Poll::Pending,
3466 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3467 this.is_terminated = true;
3468 return std::task::Poll::Ready(None);
3469 }
3470 std::task::Poll::Ready(Err(e)) => {
3471 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3472 e.into(),
3473 ))));
3474 }
3475 }
3476
3477 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3479
3480 std::task::Poll::Ready(Some(match header.ordinal {
3481 0x3c8b2b50aad28e4a => {
3482 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3483 let mut req = fidl::new_empty!(
3484 ResolverResolveHostNameRequest,
3485 fidl::encoding::DefaultFuchsiaResourceDialect
3486 );
3487 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ResolverResolveHostNameRequest>(&header, _body_bytes, handles, &mut req)?;
3488 let control_handle = ResolverControlHandle { inner: this.inner.clone() };
3489 Ok(ResolverRequest::ResolveHostName {
3490 host: req.host,
3491 timeout: req.timeout,
3492
3493 responder: ResolverResolveHostNameResponder {
3494 control_handle: std::mem::ManuallyDrop::new(control_handle),
3495 tx_id: header.tx_id,
3496 },
3497 })
3498 }
3499 _ => Err(fidl::Error::UnknownOrdinal {
3500 ordinal: header.ordinal,
3501 protocol_name:
3502 <ResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3503 }),
3504 }))
3505 },
3506 )
3507 }
3508}
3509
3510#[derive(Debug)]
3513pub enum ResolverRequest {
3514 ResolveHostName { host: String, timeout: i64, responder: ResolverResolveHostNameResponder },
3522}
3523
3524impl ResolverRequest {
3525 #[allow(irrefutable_let_patterns)]
3526 pub fn into_resolve_host_name(self) -> Option<(String, i64, ResolverResolveHostNameResponder)> {
3527 if let ResolverRequest::ResolveHostName { host, timeout, responder } = self {
3528 Some((host, timeout, responder))
3529 } else {
3530 None
3531 }
3532 }
3533
3534 pub fn method_name(&self) -> &'static str {
3536 match *self {
3537 ResolverRequest::ResolveHostName { .. } => "resolve_host_name",
3538 }
3539 }
3540}
3541
3542#[derive(Debug, Clone)]
3543pub struct ResolverControlHandle {
3544 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3545}
3546
3547impl fidl::endpoints::ControlHandle for ResolverControlHandle {
3548 fn shutdown(&self) {
3549 self.inner.shutdown()
3550 }
3551 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3552 self.inner.shutdown_with_epitaph(status)
3553 }
3554
3555 fn is_closed(&self) -> bool {
3556 self.inner.channel().is_closed()
3557 }
3558 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3559 self.inner.channel().on_closed()
3560 }
3561
3562 #[cfg(target_os = "fuchsia")]
3563 fn signal_peer(
3564 &self,
3565 clear_mask: zx::Signals,
3566 set_mask: zx::Signals,
3567 ) -> Result<(), zx_status::Status> {
3568 use fidl::Peered;
3569 self.inner.channel().signal_peer(clear_mask, set_mask)
3570 }
3571}
3572
3573impl ResolverControlHandle {}
3574
3575#[must_use = "FIDL methods require a response to be sent"]
3576#[derive(Debug)]
3577pub struct ResolverResolveHostNameResponder {
3578 control_handle: std::mem::ManuallyDrop<ResolverControlHandle>,
3579 tx_id: u32,
3580}
3581
3582impl std::ops::Drop for ResolverResolveHostNameResponder {
3586 fn drop(&mut self) {
3587 self.control_handle.shutdown();
3588 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3590 }
3591}
3592
3593impl fidl::endpoints::Responder for ResolverResolveHostNameResponder {
3594 type ControlHandle = ResolverControlHandle;
3595
3596 fn control_handle(&self) -> &ResolverControlHandle {
3597 &self.control_handle
3598 }
3599
3600 fn drop_without_shutdown(mut self) {
3601 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3603 std::mem::forget(self);
3605 }
3606}
3607
3608impl ResolverResolveHostNameResponder {
3609 pub fn send(
3613 self,
3614 mut v4_address: Option<&fidl_fuchsia_net::Ipv4Address>,
3615 mut v6_address: Option<&fidl_fuchsia_net::Ipv6Address>,
3616 ) -> Result<(), fidl::Error> {
3617 let _result = self.send_raw(v4_address, v6_address);
3618 if _result.is_err() {
3619 self.control_handle.shutdown();
3620 }
3621 self.drop_without_shutdown();
3622 _result
3623 }
3624
3625 pub fn send_no_shutdown_on_err(
3627 self,
3628 mut v4_address: Option<&fidl_fuchsia_net::Ipv4Address>,
3629 mut v6_address: Option<&fidl_fuchsia_net::Ipv6Address>,
3630 ) -> Result<(), fidl::Error> {
3631 let _result = self.send_raw(v4_address, v6_address);
3632 self.drop_without_shutdown();
3633 _result
3634 }
3635
3636 fn send_raw(
3637 &self,
3638 mut v4_address: Option<&fidl_fuchsia_net::Ipv4Address>,
3639 mut v6_address: Option<&fidl_fuchsia_net::Ipv6Address>,
3640 ) -> Result<(), fidl::Error> {
3641 self.control_handle.inner.send::<ResolverResolveHostNameResponse>(
3642 (v4_address, v6_address),
3643 self.tx_id,
3644 0x3c8b2b50aad28e4a,
3645 fidl::encoding::DynamicFlags::empty(),
3646 )
3647 }
3648}
3649
3650#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3651pub struct ServiceInstancePublicationResponder_Marker;
3652
3653impl fidl::endpoints::ProtocolMarker for ServiceInstancePublicationResponder_Marker {
3654 type Proxy = ServiceInstancePublicationResponder_Proxy;
3655 type RequestStream = ServiceInstancePublicationResponder_RequestStream;
3656 #[cfg(target_os = "fuchsia")]
3657 type SynchronousProxy = ServiceInstancePublicationResponder_SynchronousProxy;
3658
3659 const DEBUG_NAME: &'static str = "(anonymous) ServiceInstancePublicationResponder_";
3660}
3661pub type ServiceInstancePublicationResponderOnPublicationResult =
3662 Result<ServiceInstancePublication, OnPublicationError>;
3663
3664pub trait ServiceInstancePublicationResponder_ProxyInterface: Send + Sync {
3665 type OnPublicationResponseFut: std::future::Future<
3666 Output = Result<ServiceInstancePublicationResponderOnPublicationResult, fidl::Error>,
3667 > + Send;
3668 fn r#on_publication(
3669 &self,
3670 publication_cause: ServiceInstancePublicationCause,
3671 subtype: Option<&str>,
3672 source_addresses: &[fidl_fuchsia_net::IpAddress],
3673 ) -> Self::OnPublicationResponseFut;
3674}
3675#[derive(Debug)]
3676#[cfg(target_os = "fuchsia")]
3677pub struct ServiceInstancePublicationResponder_SynchronousProxy {
3678 client: fidl::client::sync::Client,
3679}
3680
3681#[cfg(target_os = "fuchsia")]
3682impl fidl::endpoints::SynchronousProxy for ServiceInstancePublicationResponder_SynchronousProxy {
3683 type Proxy = ServiceInstancePublicationResponder_Proxy;
3684 type Protocol = ServiceInstancePublicationResponder_Marker;
3685
3686 fn from_channel(inner: fidl::Channel) -> Self {
3687 Self::new(inner)
3688 }
3689
3690 fn into_channel(self) -> fidl::Channel {
3691 self.client.into_channel()
3692 }
3693
3694 fn as_channel(&self) -> &fidl::Channel {
3695 self.client.as_channel()
3696 }
3697}
3698
3699#[cfg(target_os = "fuchsia")]
3700impl ServiceInstancePublicationResponder_SynchronousProxy {
3701 pub fn new(channel: fidl::Channel) -> Self {
3702 let protocol_name = <ServiceInstancePublicationResponder_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3703 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3704 }
3705
3706 pub fn into_channel(self) -> fidl::Channel {
3707 self.client.into_channel()
3708 }
3709
3710 pub fn wait_for_event(
3713 &self,
3714 deadline: zx::MonotonicInstant,
3715 ) -> Result<ServiceInstancePublicationResponder_Event, fidl::Error> {
3716 ServiceInstancePublicationResponder_Event::decode(self.client.wait_for_event(deadline)?)
3717 }
3718
3719 pub fn r#on_publication(
3733 &self,
3734 mut publication_cause: ServiceInstancePublicationCause,
3735 mut subtype: Option<&str>,
3736 mut source_addresses: &[fidl_fuchsia_net::IpAddress],
3737 ___deadline: zx::MonotonicInstant,
3738 ) -> Result<ServiceInstancePublicationResponderOnPublicationResult, fidl::Error> {
3739 let _response = self.client.send_query::<
3740 ServiceInstancePublicationResponderOnPublicationRequest,
3741 fidl::encoding::ResultType<ServiceInstancePublicationResponderOnPublicationResponse, OnPublicationError>,
3742 >(
3743 (publication_cause, subtype, source_addresses,),
3744 0x71753d79b12571ca,
3745 fidl::encoding::DynamicFlags::empty(),
3746 ___deadline,
3747 )?;
3748 Ok(_response.map(|x| x.publication))
3749 }
3750}
3751
3752#[cfg(target_os = "fuchsia")]
3753impl From<ServiceInstancePublicationResponder_SynchronousProxy> for zx::Handle {
3754 fn from(value: ServiceInstancePublicationResponder_SynchronousProxy) -> Self {
3755 value.into_channel().into()
3756 }
3757}
3758
3759#[cfg(target_os = "fuchsia")]
3760impl From<fidl::Channel> for ServiceInstancePublicationResponder_SynchronousProxy {
3761 fn from(value: fidl::Channel) -> Self {
3762 Self::new(value)
3763 }
3764}
3765
3766#[cfg(target_os = "fuchsia")]
3767impl fidl::endpoints::FromClient for ServiceInstancePublicationResponder_SynchronousProxy {
3768 type Protocol = ServiceInstancePublicationResponder_Marker;
3769
3770 fn from_client(
3771 value: fidl::endpoints::ClientEnd<ServiceInstancePublicationResponder_Marker>,
3772 ) -> Self {
3773 Self::new(value.into_channel())
3774 }
3775}
3776
3777#[derive(Debug, Clone)]
3778pub struct ServiceInstancePublicationResponder_Proxy {
3779 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3780}
3781
3782impl fidl::endpoints::Proxy for ServiceInstancePublicationResponder_Proxy {
3783 type Protocol = ServiceInstancePublicationResponder_Marker;
3784
3785 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3786 Self::new(inner)
3787 }
3788
3789 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3790 self.client.into_channel().map_err(|client| Self { client })
3791 }
3792
3793 fn as_channel(&self) -> &::fidl::AsyncChannel {
3794 self.client.as_channel()
3795 }
3796}
3797
3798impl ServiceInstancePublicationResponder_Proxy {
3799 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3801 let protocol_name = <ServiceInstancePublicationResponder_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3802 Self { client: fidl::client::Client::new(channel, protocol_name) }
3803 }
3804
3805 pub fn take_event_stream(&self) -> ServiceInstancePublicationResponder_EventStream {
3811 ServiceInstancePublicationResponder_EventStream {
3812 event_receiver: self.client.take_event_receiver(),
3813 }
3814 }
3815
3816 pub fn r#on_publication(
3830 &self,
3831 mut publication_cause: ServiceInstancePublicationCause,
3832 mut subtype: Option<&str>,
3833 mut source_addresses: &[fidl_fuchsia_net::IpAddress],
3834 ) -> fidl::client::QueryResponseFut<
3835 ServiceInstancePublicationResponderOnPublicationResult,
3836 fidl::encoding::DefaultFuchsiaResourceDialect,
3837 > {
3838 ServiceInstancePublicationResponder_ProxyInterface::r#on_publication(
3839 self,
3840 publication_cause,
3841 subtype,
3842 source_addresses,
3843 )
3844 }
3845}
3846
3847impl ServiceInstancePublicationResponder_ProxyInterface
3848 for ServiceInstancePublicationResponder_Proxy
3849{
3850 type OnPublicationResponseFut = fidl::client::QueryResponseFut<
3851 ServiceInstancePublicationResponderOnPublicationResult,
3852 fidl::encoding::DefaultFuchsiaResourceDialect,
3853 >;
3854 fn r#on_publication(
3855 &self,
3856 mut publication_cause: ServiceInstancePublicationCause,
3857 mut subtype: Option<&str>,
3858 mut source_addresses: &[fidl_fuchsia_net::IpAddress],
3859 ) -> Self::OnPublicationResponseFut {
3860 fn _decode(
3861 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3862 ) -> Result<ServiceInstancePublicationResponderOnPublicationResult, fidl::Error> {
3863 let _response = fidl::client::decode_transaction_body::<
3864 fidl::encoding::ResultType<
3865 ServiceInstancePublicationResponderOnPublicationResponse,
3866 OnPublicationError,
3867 >,
3868 fidl::encoding::DefaultFuchsiaResourceDialect,
3869 0x71753d79b12571ca,
3870 >(_buf?)?;
3871 Ok(_response.map(|x| x.publication))
3872 }
3873 self.client.send_query_and_decode::<
3874 ServiceInstancePublicationResponderOnPublicationRequest,
3875 ServiceInstancePublicationResponderOnPublicationResult,
3876 >(
3877 (publication_cause, subtype, source_addresses,),
3878 0x71753d79b12571ca,
3879 fidl::encoding::DynamicFlags::empty(),
3880 _decode,
3881 )
3882 }
3883}
3884
3885pub struct ServiceInstancePublicationResponder_EventStream {
3886 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3887}
3888
3889impl std::marker::Unpin for ServiceInstancePublicationResponder_EventStream {}
3890
3891impl futures::stream::FusedStream for ServiceInstancePublicationResponder_EventStream {
3892 fn is_terminated(&self) -> bool {
3893 self.event_receiver.is_terminated()
3894 }
3895}
3896
3897impl futures::Stream for ServiceInstancePublicationResponder_EventStream {
3898 type Item = Result<ServiceInstancePublicationResponder_Event, fidl::Error>;
3899
3900 fn poll_next(
3901 mut self: std::pin::Pin<&mut Self>,
3902 cx: &mut std::task::Context<'_>,
3903 ) -> std::task::Poll<Option<Self::Item>> {
3904 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3905 &mut self.event_receiver,
3906 cx
3907 )?) {
3908 Some(buf) => {
3909 std::task::Poll::Ready(Some(ServiceInstancePublicationResponder_Event::decode(buf)))
3910 }
3911 None => std::task::Poll::Ready(None),
3912 }
3913 }
3914}
3915
3916#[derive(Debug)]
3917pub enum ServiceInstancePublicationResponder_Event {
3918 SetSubtypes { subtypes: Vec<String> },
3919 Reannounce {},
3920}
3921
3922impl ServiceInstancePublicationResponder_Event {
3923 #[allow(irrefutable_let_patterns)]
3924 pub fn into_set_subtypes(self) -> Option<Vec<String>> {
3925 if let ServiceInstancePublicationResponder_Event::SetSubtypes { subtypes } = self {
3926 Some((subtypes))
3927 } else {
3928 None
3929 }
3930 }
3931 #[allow(irrefutable_let_patterns)]
3932 pub fn into_reannounce(self) -> Option<()> {
3933 if let ServiceInstancePublicationResponder_Event::Reannounce {} = self {
3934 Some(())
3935 } else {
3936 None
3937 }
3938 }
3939
3940 fn decode(
3942 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3943 ) -> Result<ServiceInstancePublicationResponder_Event, fidl::Error> {
3944 let (bytes, _handles) = buf.split_mut();
3945 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3946 debug_assert_eq!(tx_header.tx_id, 0);
3947 match tx_header.ordinal {
3948 0x217fed6e404312a9 => {
3949 let mut out = fidl::new_empty!(ServiceInstancePublicationResponderSetSubtypesRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3950 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceInstancePublicationResponderSetSubtypesRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
3951 Ok((
3952 ServiceInstancePublicationResponder_Event::SetSubtypes {subtypes: out.subtypes,
3953
3954 }
3955 ))
3956 }
3957 0x1b48d9ed30dce1a8 => {
3958 let mut out = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
3959 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
3960 Ok((
3961 ServiceInstancePublicationResponder_Event::Reannounce {
3962 }
3963 ))
3964 }
3965 _ => Err(fidl::Error::UnknownOrdinal {
3966 ordinal: tx_header.ordinal,
3967 protocol_name: <ServiceInstancePublicationResponder_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3968 })
3969 }
3970 }
3971}
3972
3973pub struct ServiceInstancePublicationResponder_RequestStream {
3975 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3976 is_terminated: bool,
3977}
3978
3979impl std::marker::Unpin for ServiceInstancePublicationResponder_RequestStream {}
3980
3981impl futures::stream::FusedStream for ServiceInstancePublicationResponder_RequestStream {
3982 fn is_terminated(&self) -> bool {
3983 self.is_terminated
3984 }
3985}
3986
3987impl fidl::endpoints::RequestStream for ServiceInstancePublicationResponder_RequestStream {
3988 type Protocol = ServiceInstancePublicationResponder_Marker;
3989 type ControlHandle = ServiceInstancePublicationResponder_ControlHandle;
3990
3991 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3992 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3993 }
3994
3995 fn control_handle(&self) -> Self::ControlHandle {
3996 ServiceInstancePublicationResponder_ControlHandle { inner: self.inner.clone() }
3997 }
3998
3999 fn into_inner(
4000 self,
4001 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4002 {
4003 (self.inner, self.is_terminated)
4004 }
4005
4006 fn from_inner(
4007 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4008 is_terminated: bool,
4009 ) -> Self {
4010 Self { inner, is_terminated }
4011 }
4012}
4013
4014impl futures::Stream for ServiceInstancePublicationResponder_RequestStream {
4015 type Item = Result<ServiceInstancePublicationResponder_Request, fidl::Error>;
4016
4017 fn poll_next(
4018 mut self: std::pin::Pin<&mut Self>,
4019 cx: &mut std::task::Context<'_>,
4020 ) -> std::task::Poll<Option<Self::Item>> {
4021 let this = &mut *self;
4022 if this.inner.check_shutdown(cx) {
4023 this.is_terminated = true;
4024 return std::task::Poll::Ready(None);
4025 }
4026 if this.is_terminated {
4027 panic!("polled ServiceInstancePublicationResponder_RequestStream after completion");
4028 }
4029 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4030 |bytes, handles| {
4031 match this.inner.channel().read_etc(cx, bytes, handles) {
4032 std::task::Poll::Ready(Ok(())) => {}
4033 std::task::Poll::Pending => return std::task::Poll::Pending,
4034 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4035 this.is_terminated = true;
4036 return std::task::Poll::Ready(None);
4037 }
4038 std::task::Poll::Ready(Err(e)) => {
4039 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4040 e.into(),
4041 ))));
4042 }
4043 }
4044
4045 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4047
4048 std::task::Poll::Ready(Some(match header.ordinal {
4049 0x71753d79b12571ca => {
4050 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4051 let mut req = fidl::new_empty!(ServiceInstancePublicationResponderOnPublicationRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4052 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceInstancePublicationResponderOnPublicationRequest>(&header, _body_bytes, handles, &mut req)?;
4053 let control_handle = ServiceInstancePublicationResponder_ControlHandle {
4054 inner: this.inner.clone(),
4055 };
4056 Ok(ServiceInstancePublicationResponder_Request::OnPublication {publication_cause: req.publication_cause,
4057subtype: req.subtype,
4058source_addresses: req.source_addresses,
4059
4060 responder: ServiceInstancePublicationResponder_OnPublicationResponder {
4061 control_handle: std::mem::ManuallyDrop::new(control_handle),
4062 tx_id: header.tx_id,
4063 },
4064 })
4065 }
4066 _ => Err(fidl::Error::UnknownOrdinal {
4067 ordinal: header.ordinal,
4068 protocol_name: <ServiceInstancePublicationResponder_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4069 }),
4070 }))
4071 },
4072 )
4073 }
4074}
4075
4076#[derive(Debug)]
4078pub enum ServiceInstancePublicationResponder_Request {
4079 OnPublication {
4093 publication_cause: ServiceInstancePublicationCause,
4094 subtype: Option<String>,
4095 source_addresses: Vec<fidl_fuchsia_net::IpAddress>,
4096 responder: ServiceInstancePublicationResponder_OnPublicationResponder,
4097 },
4098}
4099
4100impl ServiceInstancePublicationResponder_Request {
4101 #[allow(irrefutable_let_patterns)]
4102 pub fn into_on_publication(
4103 self,
4104 ) -> Option<(
4105 ServiceInstancePublicationCause,
4106 Option<String>,
4107 Vec<fidl_fuchsia_net::IpAddress>,
4108 ServiceInstancePublicationResponder_OnPublicationResponder,
4109 )> {
4110 if let ServiceInstancePublicationResponder_Request::OnPublication {
4111 publication_cause,
4112 subtype,
4113 source_addresses,
4114 responder,
4115 } = self
4116 {
4117 Some((publication_cause, subtype, source_addresses, responder))
4118 } else {
4119 None
4120 }
4121 }
4122
4123 pub fn method_name(&self) -> &'static str {
4125 match *self {
4126 ServiceInstancePublicationResponder_Request::OnPublication { .. } => "on_publication",
4127 }
4128 }
4129}
4130
4131#[derive(Debug, Clone)]
4132pub struct ServiceInstancePublicationResponder_ControlHandle {
4133 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4134}
4135
4136impl fidl::endpoints::ControlHandle for ServiceInstancePublicationResponder_ControlHandle {
4137 fn shutdown(&self) {
4138 self.inner.shutdown()
4139 }
4140 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4141 self.inner.shutdown_with_epitaph(status)
4142 }
4143
4144 fn is_closed(&self) -> bool {
4145 self.inner.channel().is_closed()
4146 }
4147 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4148 self.inner.channel().on_closed()
4149 }
4150
4151 #[cfg(target_os = "fuchsia")]
4152 fn signal_peer(
4153 &self,
4154 clear_mask: zx::Signals,
4155 set_mask: zx::Signals,
4156 ) -> Result<(), zx_status::Status> {
4157 use fidl::Peered;
4158 self.inner.channel().signal_peer(clear_mask, set_mask)
4159 }
4160}
4161
4162impl ServiceInstancePublicationResponder_ControlHandle {
4163 pub fn send_set_subtypes(&self, mut subtypes: &[String]) -> Result<(), fidl::Error> {
4164 self.inner.send::<ServiceInstancePublicationResponderSetSubtypesRequest>(
4165 (subtypes,),
4166 0,
4167 0x217fed6e404312a9,
4168 fidl::encoding::DynamicFlags::empty(),
4169 )
4170 }
4171
4172 pub fn send_reannounce(&self) -> Result<(), fidl::Error> {
4173 self.inner.send::<fidl::encoding::EmptyPayload>(
4174 (),
4175 0,
4176 0x1b48d9ed30dce1a8,
4177 fidl::encoding::DynamicFlags::empty(),
4178 )
4179 }
4180}
4181
4182#[must_use = "FIDL methods require a response to be sent"]
4183#[derive(Debug)]
4184pub struct ServiceInstancePublicationResponder_OnPublicationResponder {
4185 control_handle: std::mem::ManuallyDrop<ServiceInstancePublicationResponder_ControlHandle>,
4186 tx_id: u32,
4187}
4188
4189impl std::ops::Drop for ServiceInstancePublicationResponder_OnPublicationResponder {
4193 fn drop(&mut self) {
4194 self.control_handle.shutdown();
4195 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4197 }
4198}
4199
4200impl fidl::endpoints::Responder for ServiceInstancePublicationResponder_OnPublicationResponder {
4201 type ControlHandle = ServiceInstancePublicationResponder_ControlHandle;
4202
4203 fn control_handle(&self) -> &ServiceInstancePublicationResponder_ControlHandle {
4204 &self.control_handle
4205 }
4206
4207 fn drop_without_shutdown(mut self) {
4208 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4210 std::mem::forget(self);
4212 }
4213}
4214
4215impl ServiceInstancePublicationResponder_OnPublicationResponder {
4216 pub fn send(
4220 self,
4221 mut result: Result<&ServiceInstancePublication, OnPublicationError>,
4222 ) -> Result<(), fidl::Error> {
4223 let _result = self.send_raw(result);
4224 if _result.is_err() {
4225 self.control_handle.shutdown();
4226 }
4227 self.drop_without_shutdown();
4228 _result
4229 }
4230
4231 pub fn send_no_shutdown_on_err(
4233 self,
4234 mut result: Result<&ServiceInstancePublication, OnPublicationError>,
4235 ) -> Result<(), fidl::Error> {
4236 let _result = self.send_raw(result);
4237 self.drop_without_shutdown();
4238 _result
4239 }
4240
4241 fn send_raw(
4242 &self,
4243 mut result: Result<&ServiceInstancePublication, OnPublicationError>,
4244 ) -> Result<(), fidl::Error> {
4245 self.control_handle.inner.send::<fidl::encoding::ResultType<
4246 ServiceInstancePublicationResponderOnPublicationResponse,
4247 OnPublicationError,
4248 >>(
4249 result.map(|publication| (publication,)),
4250 self.tx_id,
4251 0x71753d79b12571ca,
4252 fidl::encoding::DynamicFlags::empty(),
4253 )
4254 }
4255}
4256
4257#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4258pub struct ServiceInstancePublisherMarker;
4259
4260impl fidl::endpoints::ProtocolMarker for ServiceInstancePublisherMarker {
4261 type Proxy = ServiceInstancePublisherProxy;
4262 type RequestStream = ServiceInstancePublisherRequestStream;
4263 #[cfg(target_os = "fuchsia")]
4264 type SynchronousProxy = ServiceInstancePublisherSynchronousProxy;
4265
4266 const DEBUG_NAME: &'static str = "fuchsia.net.mdns.ServiceInstancePublisher";
4267}
4268impl fidl::endpoints::DiscoverableProtocolMarker for ServiceInstancePublisherMarker {}
4269pub type ServiceInstancePublisherPublishServiceInstanceResult =
4270 Result<(), PublishServiceInstanceError>;
4271
4272pub trait ServiceInstancePublisherProxyInterface: Send + Sync {
4273 type PublishServiceInstanceResponseFut: std::future::Future<
4274 Output = Result<ServiceInstancePublisherPublishServiceInstanceResult, fidl::Error>,
4275 > + Send;
4276 fn r#publish_service_instance(
4277 &self,
4278 service: &str,
4279 instance: &str,
4280 options: &ServiceInstancePublicationOptions,
4281 publication_responder: fidl::endpoints::ClientEnd<
4282 ServiceInstancePublicationResponder_Marker,
4283 >,
4284 ) -> Self::PublishServiceInstanceResponseFut;
4285}
4286#[derive(Debug)]
4287#[cfg(target_os = "fuchsia")]
4288pub struct ServiceInstancePublisherSynchronousProxy {
4289 client: fidl::client::sync::Client,
4290}
4291
4292#[cfg(target_os = "fuchsia")]
4293impl fidl::endpoints::SynchronousProxy for ServiceInstancePublisherSynchronousProxy {
4294 type Proxy = ServiceInstancePublisherProxy;
4295 type Protocol = ServiceInstancePublisherMarker;
4296
4297 fn from_channel(inner: fidl::Channel) -> Self {
4298 Self::new(inner)
4299 }
4300
4301 fn into_channel(self) -> fidl::Channel {
4302 self.client.into_channel()
4303 }
4304
4305 fn as_channel(&self) -> &fidl::Channel {
4306 self.client.as_channel()
4307 }
4308}
4309
4310#[cfg(target_os = "fuchsia")]
4311impl ServiceInstancePublisherSynchronousProxy {
4312 pub fn new(channel: fidl::Channel) -> Self {
4313 let protocol_name =
4314 <ServiceInstancePublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4315 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4316 }
4317
4318 pub fn into_channel(self) -> fidl::Channel {
4319 self.client.into_channel()
4320 }
4321
4322 pub fn wait_for_event(
4325 &self,
4326 deadline: zx::MonotonicInstant,
4327 ) -> Result<ServiceInstancePublisherEvent, fidl::Error> {
4328 ServiceInstancePublisherEvent::decode(self.client.wait_for_event(deadline)?)
4329 }
4330
4331 pub fn r#publish_service_instance(
4350 &self,
4351 mut service: &str,
4352 mut instance: &str,
4353 mut options: &ServiceInstancePublicationOptions,
4354 mut publication_responder: fidl::endpoints::ClientEnd<
4355 ServiceInstancePublicationResponder_Marker,
4356 >,
4357 ___deadline: zx::MonotonicInstant,
4358 ) -> Result<ServiceInstancePublisherPublishServiceInstanceResult, fidl::Error> {
4359 let _response = self.client.send_query::<
4360 ServiceInstancePublisherPublishServiceInstanceRequest,
4361 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, PublishServiceInstanceError>,
4362 >(
4363 (service, instance, options, publication_responder,),
4364 0x25d5fd0912cb5a9e,
4365 fidl::encoding::DynamicFlags::empty(),
4366 ___deadline,
4367 )?;
4368 Ok(_response.map(|x| x))
4369 }
4370}
4371
4372#[cfg(target_os = "fuchsia")]
4373impl From<ServiceInstancePublisherSynchronousProxy> for zx::Handle {
4374 fn from(value: ServiceInstancePublisherSynchronousProxy) -> Self {
4375 value.into_channel().into()
4376 }
4377}
4378
4379#[cfg(target_os = "fuchsia")]
4380impl From<fidl::Channel> for ServiceInstancePublisherSynchronousProxy {
4381 fn from(value: fidl::Channel) -> Self {
4382 Self::new(value)
4383 }
4384}
4385
4386#[cfg(target_os = "fuchsia")]
4387impl fidl::endpoints::FromClient for ServiceInstancePublisherSynchronousProxy {
4388 type Protocol = ServiceInstancePublisherMarker;
4389
4390 fn from_client(value: fidl::endpoints::ClientEnd<ServiceInstancePublisherMarker>) -> Self {
4391 Self::new(value.into_channel())
4392 }
4393}
4394
4395#[derive(Debug, Clone)]
4396pub struct ServiceInstancePublisherProxy {
4397 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4398}
4399
4400impl fidl::endpoints::Proxy for ServiceInstancePublisherProxy {
4401 type Protocol = ServiceInstancePublisherMarker;
4402
4403 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4404 Self::new(inner)
4405 }
4406
4407 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4408 self.client.into_channel().map_err(|client| Self { client })
4409 }
4410
4411 fn as_channel(&self) -> &::fidl::AsyncChannel {
4412 self.client.as_channel()
4413 }
4414}
4415
4416impl ServiceInstancePublisherProxy {
4417 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4419 let protocol_name =
4420 <ServiceInstancePublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4421 Self { client: fidl::client::Client::new(channel, protocol_name) }
4422 }
4423
4424 pub fn take_event_stream(&self) -> ServiceInstancePublisherEventStream {
4430 ServiceInstancePublisherEventStream { event_receiver: self.client.take_event_receiver() }
4431 }
4432
4433 pub fn r#publish_service_instance(
4452 &self,
4453 mut service: &str,
4454 mut instance: &str,
4455 mut options: &ServiceInstancePublicationOptions,
4456 mut publication_responder: fidl::endpoints::ClientEnd<
4457 ServiceInstancePublicationResponder_Marker,
4458 >,
4459 ) -> fidl::client::QueryResponseFut<
4460 ServiceInstancePublisherPublishServiceInstanceResult,
4461 fidl::encoding::DefaultFuchsiaResourceDialect,
4462 > {
4463 ServiceInstancePublisherProxyInterface::r#publish_service_instance(
4464 self,
4465 service,
4466 instance,
4467 options,
4468 publication_responder,
4469 )
4470 }
4471}
4472
4473impl ServiceInstancePublisherProxyInterface for ServiceInstancePublisherProxy {
4474 type PublishServiceInstanceResponseFut = fidl::client::QueryResponseFut<
4475 ServiceInstancePublisherPublishServiceInstanceResult,
4476 fidl::encoding::DefaultFuchsiaResourceDialect,
4477 >;
4478 fn r#publish_service_instance(
4479 &self,
4480 mut service: &str,
4481 mut instance: &str,
4482 mut options: &ServiceInstancePublicationOptions,
4483 mut publication_responder: fidl::endpoints::ClientEnd<
4484 ServiceInstancePublicationResponder_Marker,
4485 >,
4486 ) -> Self::PublishServiceInstanceResponseFut {
4487 fn _decode(
4488 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4489 ) -> Result<ServiceInstancePublisherPublishServiceInstanceResult, fidl::Error> {
4490 let _response = fidl::client::decode_transaction_body::<
4491 fidl::encoding::ResultType<
4492 fidl::encoding::EmptyStruct,
4493 PublishServiceInstanceError,
4494 >,
4495 fidl::encoding::DefaultFuchsiaResourceDialect,
4496 0x25d5fd0912cb5a9e,
4497 >(_buf?)?;
4498 Ok(_response.map(|x| x))
4499 }
4500 self.client.send_query_and_decode::<
4501 ServiceInstancePublisherPublishServiceInstanceRequest,
4502 ServiceInstancePublisherPublishServiceInstanceResult,
4503 >(
4504 (service, instance, options, publication_responder,),
4505 0x25d5fd0912cb5a9e,
4506 fidl::encoding::DynamicFlags::empty(),
4507 _decode,
4508 )
4509 }
4510}
4511
4512pub struct ServiceInstancePublisherEventStream {
4513 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4514}
4515
4516impl std::marker::Unpin for ServiceInstancePublisherEventStream {}
4517
4518impl futures::stream::FusedStream for ServiceInstancePublisherEventStream {
4519 fn is_terminated(&self) -> bool {
4520 self.event_receiver.is_terminated()
4521 }
4522}
4523
4524impl futures::Stream for ServiceInstancePublisherEventStream {
4525 type Item = Result<ServiceInstancePublisherEvent, fidl::Error>;
4526
4527 fn poll_next(
4528 mut self: std::pin::Pin<&mut Self>,
4529 cx: &mut std::task::Context<'_>,
4530 ) -> std::task::Poll<Option<Self::Item>> {
4531 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4532 &mut self.event_receiver,
4533 cx
4534 )?) {
4535 Some(buf) => std::task::Poll::Ready(Some(ServiceInstancePublisherEvent::decode(buf))),
4536 None => std::task::Poll::Ready(None),
4537 }
4538 }
4539}
4540
4541#[derive(Debug)]
4542pub enum ServiceInstancePublisherEvent {}
4543
4544impl ServiceInstancePublisherEvent {
4545 fn decode(
4547 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4548 ) -> Result<ServiceInstancePublisherEvent, fidl::Error> {
4549 let (bytes, _handles) = buf.split_mut();
4550 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4551 debug_assert_eq!(tx_header.tx_id, 0);
4552 match tx_header.ordinal {
4553 _ => Err(fidl::Error::UnknownOrdinal {
4554 ordinal: tx_header.ordinal,
4555 protocol_name:
4556 <ServiceInstancePublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4557 }),
4558 }
4559 }
4560}
4561
4562pub struct ServiceInstancePublisherRequestStream {
4564 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4565 is_terminated: bool,
4566}
4567
4568impl std::marker::Unpin for ServiceInstancePublisherRequestStream {}
4569
4570impl futures::stream::FusedStream for ServiceInstancePublisherRequestStream {
4571 fn is_terminated(&self) -> bool {
4572 self.is_terminated
4573 }
4574}
4575
4576impl fidl::endpoints::RequestStream for ServiceInstancePublisherRequestStream {
4577 type Protocol = ServiceInstancePublisherMarker;
4578 type ControlHandle = ServiceInstancePublisherControlHandle;
4579
4580 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4581 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4582 }
4583
4584 fn control_handle(&self) -> Self::ControlHandle {
4585 ServiceInstancePublisherControlHandle { inner: self.inner.clone() }
4586 }
4587
4588 fn into_inner(
4589 self,
4590 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4591 {
4592 (self.inner, self.is_terminated)
4593 }
4594
4595 fn from_inner(
4596 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4597 is_terminated: bool,
4598 ) -> Self {
4599 Self { inner, is_terminated }
4600 }
4601}
4602
4603impl futures::Stream for ServiceInstancePublisherRequestStream {
4604 type Item = Result<ServiceInstancePublisherRequest, fidl::Error>;
4605
4606 fn poll_next(
4607 mut self: std::pin::Pin<&mut Self>,
4608 cx: &mut std::task::Context<'_>,
4609 ) -> std::task::Poll<Option<Self::Item>> {
4610 let this = &mut *self;
4611 if this.inner.check_shutdown(cx) {
4612 this.is_terminated = true;
4613 return std::task::Poll::Ready(None);
4614 }
4615 if this.is_terminated {
4616 panic!("polled ServiceInstancePublisherRequestStream after completion");
4617 }
4618 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4619 |bytes, handles| {
4620 match this.inner.channel().read_etc(cx, bytes, handles) {
4621 std::task::Poll::Ready(Ok(())) => {}
4622 std::task::Poll::Pending => return std::task::Poll::Pending,
4623 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4624 this.is_terminated = true;
4625 return std::task::Poll::Ready(None);
4626 }
4627 std::task::Poll::Ready(Err(e)) => {
4628 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4629 e.into(),
4630 ))));
4631 }
4632 }
4633
4634 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4636
4637 std::task::Poll::Ready(Some(match header.ordinal {
4638 0x25d5fd0912cb5a9e => {
4639 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4640 let mut req = fidl::new_empty!(ServiceInstancePublisherPublishServiceInstanceRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4641 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceInstancePublisherPublishServiceInstanceRequest>(&header, _body_bytes, handles, &mut req)?;
4642 let control_handle = ServiceInstancePublisherControlHandle {
4643 inner: this.inner.clone(),
4644 };
4645 Ok(ServiceInstancePublisherRequest::PublishServiceInstance {service: req.service,
4646instance: req.instance,
4647options: req.options,
4648publication_responder: req.publication_responder,
4649
4650 responder: ServiceInstancePublisherPublishServiceInstanceResponder {
4651 control_handle: std::mem::ManuallyDrop::new(control_handle),
4652 tx_id: header.tx_id,
4653 },
4654 })
4655 }
4656 _ => Err(fidl::Error::UnknownOrdinal {
4657 ordinal: header.ordinal,
4658 protocol_name: <ServiceInstancePublisherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4659 }),
4660 }))
4661 },
4662 )
4663 }
4664}
4665
4666#[derive(Debug)]
4668pub enum ServiceInstancePublisherRequest {
4669 PublishServiceInstance {
4688 service: String,
4689 instance: String,
4690 options: ServiceInstancePublicationOptions,
4691 publication_responder:
4692 fidl::endpoints::ClientEnd<ServiceInstancePublicationResponder_Marker>,
4693 responder: ServiceInstancePublisherPublishServiceInstanceResponder,
4694 },
4695}
4696
4697impl ServiceInstancePublisherRequest {
4698 #[allow(irrefutable_let_patterns)]
4699 pub fn into_publish_service_instance(
4700 self,
4701 ) -> Option<(
4702 String,
4703 String,
4704 ServiceInstancePublicationOptions,
4705 fidl::endpoints::ClientEnd<ServiceInstancePublicationResponder_Marker>,
4706 ServiceInstancePublisherPublishServiceInstanceResponder,
4707 )> {
4708 if let ServiceInstancePublisherRequest::PublishServiceInstance {
4709 service,
4710 instance,
4711 options,
4712 publication_responder,
4713 responder,
4714 } = self
4715 {
4716 Some((service, instance, options, publication_responder, responder))
4717 } else {
4718 None
4719 }
4720 }
4721
4722 pub fn method_name(&self) -> &'static str {
4724 match *self {
4725 ServiceInstancePublisherRequest::PublishServiceInstance { .. } => {
4726 "publish_service_instance"
4727 }
4728 }
4729 }
4730}
4731
4732#[derive(Debug, Clone)]
4733pub struct ServiceInstancePublisherControlHandle {
4734 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4735}
4736
4737impl fidl::endpoints::ControlHandle for ServiceInstancePublisherControlHandle {
4738 fn shutdown(&self) {
4739 self.inner.shutdown()
4740 }
4741 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4742 self.inner.shutdown_with_epitaph(status)
4743 }
4744
4745 fn is_closed(&self) -> bool {
4746 self.inner.channel().is_closed()
4747 }
4748 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4749 self.inner.channel().on_closed()
4750 }
4751
4752 #[cfg(target_os = "fuchsia")]
4753 fn signal_peer(
4754 &self,
4755 clear_mask: zx::Signals,
4756 set_mask: zx::Signals,
4757 ) -> Result<(), zx_status::Status> {
4758 use fidl::Peered;
4759 self.inner.channel().signal_peer(clear_mask, set_mask)
4760 }
4761}
4762
4763impl ServiceInstancePublisherControlHandle {}
4764
4765#[must_use = "FIDL methods require a response to be sent"]
4766#[derive(Debug)]
4767pub struct ServiceInstancePublisherPublishServiceInstanceResponder {
4768 control_handle: std::mem::ManuallyDrop<ServiceInstancePublisherControlHandle>,
4769 tx_id: u32,
4770}
4771
4772impl std::ops::Drop for ServiceInstancePublisherPublishServiceInstanceResponder {
4776 fn drop(&mut self) {
4777 self.control_handle.shutdown();
4778 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4780 }
4781}
4782
4783impl fidl::endpoints::Responder for ServiceInstancePublisherPublishServiceInstanceResponder {
4784 type ControlHandle = ServiceInstancePublisherControlHandle;
4785
4786 fn control_handle(&self) -> &ServiceInstancePublisherControlHandle {
4787 &self.control_handle
4788 }
4789
4790 fn drop_without_shutdown(mut self) {
4791 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4793 std::mem::forget(self);
4795 }
4796}
4797
4798impl ServiceInstancePublisherPublishServiceInstanceResponder {
4799 pub fn send(
4803 self,
4804 mut result: Result<(), PublishServiceInstanceError>,
4805 ) -> Result<(), fidl::Error> {
4806 let _result = self.send_raw(result);
4807 if _result.is_err() {
4808 self.control_handle.shutdown();
4809 }
4810 self.drop_without_shutdown();
4811 _result
4812 }
4813
4814 pub fn send_no_shutdown_on_err(
4816 self,
4817 mut result: Result<(), PublishServiceInstanceError>,
4818 ) -> Result<(), fidl::Error> {
4819 let _result = self.send_raw(result);
4820 self.drop_without_shutdown();
4821 _result
4822 }
4823
4824 fn send_raw(
4825 &self,
4826 mut result: Result<(), PublishServiceInstanceError>,
4827 ) -> Result<(), fidl::Error> {
4828 self.control_handle.inner.send::<fidl::encoding::ResultType<
4829 fidl::encoding::EmptyStruct,
4830 PublishServiceInstanceError,
4831 >>(
4832 result,
4833 self.tx_id,
4834 0x25d5fd0912cb5a9e,
4835 fidl::encoding::DynamicFlags::empty(),
4836 )
4837 }
4838}
4839
4840#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4841pub struct ServiceInstanceResolverMarker;
4842
4843impl fidl::endpoints::ProtocolMarker for ServiceInstanceResolverMarker {
4844 type Proxy = ServiceInstanceResolverProxy;
4845 type RequestStream = ServiceInstanceResolverRequestStream;
4846 #[cfg(target_os = "fuchsia")]
4847 type SynchronousProxy = ServiceInstanceResolverSynchronousProxy;
4848
4849 const DEBUG_NAME: &'static str = "fuchsia.net.mdns.ServiceInstanceResolver";
4850}
4851impl fidl::endpoints::DiscoverableProtocolMarker for ServiceInstanceResolverMarker {}
4852
4853pub trait ServiceInstanceResolverProxyInterface: Send + Sync {
4854 type ResolveServiceInstanceResponseFut: std::future::Future<Output = Result<ServiceInstance, fidl::Error>>
4855 + Send;
4856 fn r#resolve_service_instance(
4857 &self,
4858 service: &str,
4859 instance: &str,
4860 timeout: i64,
4861 options: &ServiceInstanceResolutionOptions,
4862 ) -> Self::ResolveServiceInstanceResponseFut;
4863}
4864#[derive(Debug)]
4865#[cfg(target_os = "fuchsia")]
4866pub struct ServiceInstanceResolverSynchronousProxy {
4867 client: fidl::client::sync::Client,
4868}
4869
4870#[cfg(target_os = "fuchsia")]
4871impl fidl::endpoints::SynchronousProxy for ServiceInstanceResolverSynchronousProxy {
4872 type Proxy = ServiceInstanceResolverProxy;
4873 type Protocol = ServiceInstanceResolverMarker;
4874
4875 fn from_channel(inner: fidl::Channel) -> Self {
4876 Self::new(inner)
4877 }
4878
4879 fn into_channel(self) -> fidl::Channel {
4880 self.client.into_channel()
4881 }
4882
4883 fn as_channel(&self) -> &fidl::Channel {
4884 self.client.as_channel()
4885 }
4886}
4887
4888#[cfg(target_os = "fuchsia")]
4889impl ServiceInstanceResolverSynchronousProxy {
4890 pub fn new(channel: fidl::Channel) -> Self {
4891 let protocol_name =
4892 <ServiceInstanceResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4893 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4894 }
4895
4896 pub fn into_channel(self) -> fidl::Channel {
4897 self.client.into_channel()
4898 }
4899
4900 pub fn wait_for_event(
4903 &self,
4904 deadline: zx::MonotonicInstant,
4905 ) -> Result<ServiceInstanceResolverEvent, fidl::Error> {
4906 ServiceInstanceResolverEvent::decode(self.client.wait_for_event(deadline)?)
4907 }
4908
4909 pub fn r#resolve_service_instance(
4924 &self,
4925 mut service: &str,
4926 mut instance: &str,
4927 mut timeout: i64,
4928 mut options: &ServiceInstanceResolutionOptions,
4929 ___deadline: zx::MonotonicInstant,
4930 ) -> Result<ServiceInstance, fidl::Error> {
4931 let _response = self.client.send_query::<
4932 ServiceInstanceResolverResolveServiceInstanceRequest,
4933 ServiceInstanceResolverResolveServiceInstanceResponse,
4934 >(
4935 (service, instance, timeout, options,),
4936 0x1a0d0c9fc6f2fd7,
4937 fidl::encoding::DynamicFlags::empty(),
4938 ___deadline,
4939 )?;
4940 Ok(_response.instance)
4941 }
4942}
4943
4944#[cfg(target_os = "fuchsia")]
4945impl From<ServiceInstanceResolverSynchronousProxy> for zx::Handle {
4946 fn from(value: ServiceInstanceResolverSynchronousProxy) -> Self {
4947 value.into_channel().into()
4948 }
4949}
4950
4951#[cfg(target_os = "fuchsia")]
4952impl From<fidl::Channel> for ServiceInstanceResolverSynchronousProxy {
4953 fn from(value: fidl::Channel) -> Self {
4954 Self::new(value)
4955 }
4956}
4957
4958#[cfg(target_os = "fuchsia")]
4959impl fidl::endpoints::FromClient for ServiceInstanceResolverSynchronousProxy {
4960 type Protocol = ServiceInstanceResolverMarker;
4961
4962 fn from_client(value: fidl::endpoints::ClientEnd<ServiceInstanceResolverMarker>) -> Self {
4963 Self::new(value.into_channel())
4964 }
4965}
4966
4967#[derive(Debug, Clone)]
4968pub struct ServiceInstanceResolverProxy {
4969 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4970}
4971
4972impl fidl::endpoints::Proxy for ServiceInstanceResolverProxy {
4973 type Protocol = ServiceInstanceResolverMarker;
4974
4975 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4976 Self::new(inner)
4977 }
4978
4979 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4980 self.client.into_channel().map_err(|client| Self { client })
4981 }
4982
4983 fn as_channel(&self) -> &::fidl::AsyncChannel {
4984 self.client.as_channel()
4985 }
4986}
4987
4988impl ServiceInstanceResolverProxy {
4989 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4991 let protocol_name =
4992 <ServiceInstanceResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4993 Self { client: fidl::client::Client::new(channel, protocol_name) }
4994 }
4995
4996 pub fn take_event_stream(&self) -> ServiceInstanceResolverEventStream {
5002 ServiceInstanceResolverEventStream { event_receiver: self.client.take_event_receiver() }
5003 }
5004
5005 pub fn r#resolve_service_instance(
5020 &self,
5021 mut service: &str,
5022 mut instance: &str,
5023 mut timeout: i64,
5024 mut options: &ServiceInstanceResolutionOptions,
5025 ) -> fidl::client::QueryResponseFut<
5026 ServiceInstance,
5027 fidl::encoding::DefaultFuchsiaResourceDialect,
5028 > {
5029 ServiceInstanceResolverProxyInterface::r#resolve_service_instance(
5030 self, service, instance, timeout, options,
5031 )
5032 }
5033}
5034
5035impl ServiceInstanceResolverProxyInterface for ServiceInstanceResolverProxy {
5036 type ResolveServiceInstanceResponseFut = fidl::client::QueryResponseFut<
5037 ServiceInstance,
5038 fidl::encoding::DefaultFuchsiaResourceDialect,
5039 >;
5040 fn r#resolve_service_instance(
5041 &self,
5042 mut service: &str,
5043 mut instance: &str,
5044 mut timeout: i64,
5045 mut options: &ServiceInstanceResolutionOptions,
5046 ) -> Self::ResolveServiceInstanceResponseFut {
5047 fn _decode(
5048 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5049 ) -> Result<ServiceInstance, fidl::Error> {
5050 let _response = fidl::client::decode_transaction_body::<
5051 ServiceInstanceResolverResolveServiceInstanceResponse,
5052 fidl::encoding::DefaultFuchsiaResourceDialect,
5053 0x1a0d0c9fc6f2fd7,
5054 >(_buf?)?;
5055 Ok(_response.instance)
5056 }
5057 self.client.send_query_and_decode::<
5058 ServiceInstanceResolverResolveServiceInstanceRequest,
5059 ServiceInstance,
5060 >(
5061 (service, instance, timeout, options,),
5062 0x1a0d0c9fc6f2fd7,
5063 fidl::encoding::DynamicFlags::empty(),
5064 _decode,
5065 )
5066 }
5067}
5068
5069pub struct ServiceInstanceResolverEventStream {
5070 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5071}
5072
5073impl std::marker::Unpin for ServiceInstanceResolverEventStream {}
5074
5075impl futures::stream::FusedStream for ServiceInstanceResolverEventStream {
5076 fn is_terminated(&self) -> bool {
5077 self.event_receiver.is_terminated()
5078 }
5079}
5080
5081impl futures::Stream for ServiceInstanceResolverEventStream {
5082 type Item = Result<ServiceInstanceResolverEvent, fidl::Error>;
5083
5084 fn poll_next(
5085 mut self: std::pin::Pin<&mut Self>,
5086 cx: &mut std::task::Context<'_>,
5087 ) -> std::task::Poll<Option<Self::Item>> {
5088 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5089 &mut self.event_receiver,
5090 cx
5091 )?) {
5092 Some(buf) => std::task::Poll::Ready(Some(ServiceInstanceResolverEvent::decode(buf))),
5093 None => std::task::Poll::Ready(None),
5094 }
5095 }
5096}
5097
5098#[derive(Debug)]
5099pub enum ServiceInstanceResolverEvent {}
5100
5101impl ServiceInstanceResolverEvent {
5102 fn decode(
5104 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5105 ) -> Result<ServiceInstanceResolverEvent, fidl::Error> {
5106 let (bytes, _handles) = buf.split_mut();
5107 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5108 debug_assert_eq!(tx_header.tx_id, 0);
5109 match tx_header.ordinal {
5110 _ => Err(fidl::Error::UnknownOrdinal {
5111 ordinal: tx_header.ordinal,
5112 protocol_name:
5113 <ServiceInstanceResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5114 }),
5115 }
5116 }
5117}
5118
5119pub struct ServiceInstanceResolverRequestStream {
5121 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5122 is_terminated: bool,
5123}
5124
5125impl std::marker::Unpin for ServiceInstanceResolverRequestStream {}
5126
5127impl futures::stream::FusedStream for ServiceInstanceResolverRequestStream {
5128 fn is_terminated(&self) -> bool {
5129 self.is_terminated
5130 }
5131}
5132
5133impl fidl::endpoints::RequestStream for ServiceInstanceResolverRequestStream {
5134 type Protocol = ServiceInstanceResolverMarker;
5135 type ControlHandle = ServiceInstanceResolverControlHandle;
5136
5137 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5138 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5139 }
5140
5141 fn control_handle(&self) -> Self::ControlHandle {
5142 ServiceInstanceResolverControlHandle { inner: self.inner.clone() }
5143 }
5144
5145 fn into_inner(
5146 self,
5147 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5148 {
5149 (self.inner, self.is_terminated)
5150 }
5151
5152 fn from_inner(
5153 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5154 is_terminated: bool,
5155 ) -> Self {
5156 Self { inner, is_terminated }
5157 }
5158}
5159
5160impl futures::Stream for ServiceInstanceResolverRequestStream {
5161 type Item = Result<ServiceInstanceResolverRequest, fidl::Error>;
5162
5163 fn poll_next(
5164 mut self: std::pin::Pin<&mut Self>,
5165 cx: &mut std::task::Context<'_>,
5166 ) -> std::task::Poll<Option<Self::Item>> {
5167 let this = &mut *self;
5168 if this.inner.check_shutdown(cx) {
5169 this.is_terminated = true;
5170 return std::task::Poll::Ready(None);
5171 }
5172 if this.is_terminated {
5173 panic!("polled ServiceInstanceResolverRequestStream after completion");
5174 }
5175 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5176 |bytes, handles| {
5177 match this.inner.channel().read_etc(cx, bytes, handles) {
5178 std::task::Poll::Ready(Ok(())) => {}
5179 std::task::Poll::Pending => return std::task::Poll::Pending,
5180 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5181 this.is_terminated = true;
5182 return std::task::Poll::Ready(None);
5183 }
5184 std::task::Poll::Ready(Err(e)) => {
5185 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5186 e.into(),
5187 ))));
5188 }
5189 }
5190
5191 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5193
5194 std::task::Poll::Ready(Some(match header.ordinal {
5195 0x1a0d0c9fc6f2fd7 => {
5196 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5197 let mut req = fidl::new_empty!(ServiceInstanceResolverResolveServiceInstanceRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
5198 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceInstanceResolverResolveServiceInstanceRequest>(&header, _body_bytes, handles, &mut req)?;
5199 let control_handle = ServiceInstanceResolverControlHandle {
5200 inner: this.inner.clone(),
5201 };
5202 Ok(ServiceInstanceResolverRequest::ResolveServiceInstance {service: req.service,
5203instance: req.instance,
5204timeout: req.timeout,
5205options: req.options,
5206
5207 responder: ServiceInstanceResolverResolveServiceInstanceResponder {
5208 control_handle: std::mem::ManuallyDrop::new(control_handle),
5209 tx_id: header.tx_id,
5210 },
5211 })
5212 }
5213 _ => Err(fidl::Error::UnknownOrdinal {
5214 ordinal: header.ordinal,
5215 protocol_name: <ServiceInstanceResolverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5216 }),
5217 }))
5218 },
5219 )
5220 }
5221}
5222
5223#[derive(Debug)]
5225pub enum ServiceInstanceResolverRequest {
5226 ResolveServiceInstance {
5241 service: String,
5242 instance: String,
5243 timeout: i64,
5244 options: ServiceInstanceResolutionOptions,
5245 responder: ServiceInstanceResolverResolveServiceInstanceResponder,
5246 },
5247}
5248
5249impl ServiceInstanceResolverRequest {
5250 #[allow(irrefutable_let_patterns)]
5251 pub fn into_resolve_service_instance(
5252 self,
5253 ) -> Option<(
5254 String,
5255 String,
5256 i64,
5257 ServiceInstanceResolutionOptions,
5258 ServiceInstanceResolverResolveServiceInstanceResponder,
5259 )> {
5260 if let ServiceInstanceResolverRequest::ResolveServiceInstance {
5261 service,
5262 instance,
5263 timeout,
5264 options,
5265 responder,
5266 } = self
5267 {
5268 Some((service, instance, timeout, options, responder))
5269 } else {
5270 None
5271 }
5272 }
5273
5274 pub fn method_name(&self) -> &'static str {
5276 match *self {
5277 ServiceInstanceResolverRequest::ResolveServiceInstance { .. } => {
5278 "resolve_service_instance"
5279 }
5280 }
5281 }
5282}
5283
5284#[derive(Debug, Clone)]
5285pub struct ServiceInstanceResolverControlHandle {
5286 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5287}
5288
5289impl fidl::endpoints::ControlHandle for ServiceInstanceResolverControlHandle {
5290 fn shutdown(&self) {
5291 self.inner.shutdown()
5292 }
5293 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5294 self.inner.shutdown_with_epitaph(status)
5295 }
5296
5297 fn is_closed(&self) -> bool {
5298 self.inner.channel().is_closed()
5299 }
5300 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5301 self.inner.channel().on_closed()
5302 }
5303
5304 #[cfg(target_os = "fuchsia")]
5305 fn signal_peer(
5306 &self,
5307 clear_mask: zx::Signals,
5308 set_mask: zx::Signals,
5309 ) -> Result<(), zx_status::Status> {
5310 use fidl::Peered;
5311 self.inner.channel().signal_peer(clear_mask, set_mask)
5312 }
5313}
5314
5315impl ServiceInstanceResolverControlHandle {}
5316
5317#[must_use = "FIDL methods require a response to be sent"]
5318#[derive(Debug)]
5319pub struct ServiceInstanceResolverResolveServiceInstanceResponder {
5320 control_handle: std::mem::ManuallyDrop<ServiceInstanceResolverControlHandle>,
5321 tx_id: u32,
5322}
5323
5324impl std::ops::Drop for ServiceInstanceResolverResolveServiceInstanceResponder {
5328 fn drop(&mut self) {
5329 self.control_handle.shutdown();
5330 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5332 }
5333}
5334
5335impl fidl::endpoints::Responder for ServiceInstanceResolverResolveServiceInstanceResponder {
5336 type ControlHandle = ServiceInstanceResolverControlHandle;
5337
5338 fn control_handle(&self) -> &ServiceInstanceResolverControlHandle {
5339 &self.control_handle
5340 }
5341
5342 fn drop_without_shutdown(mut self) {
5343 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5345 std::mem::forget(self);
5347 }
5348}
5349
5350impl ServiceInstanceResolverResolveServiceInstanceResponder {
5351 pub fn send(self, mut instance: &ServiceInstance) -> Result<(), fidl::Error> {
5355 let _result = self.send_raw(instance);
5356 if _result.is_err() {
5357 self.control_handle.shutdown();
5358 }
5359 self.drop_without_shutdown();
5360 _result
5361 }
5362
5363 pub fn send_no_shutdown_on_err(
5365 self,
5366 mut instance: &ServiceInstance,
5367 ) -> Result<(), fidl::Error> {
5368 let _result = self.send_raw(instance);
5369 self.drop_without_shutdown();
5370 _result
5371 }
5372
5373 fn send_raw(&self, mut instance: &ServiceInstance) -> Result<(), fidl::Error> {
5374 self.control_handle.inner.send::<ServiceInstanceResolverResolveServiceInstanceResponse>(
5375 (instance,),
5376 self.tx_id,
5377 0x1a0d0c9fc6f2fd7,
5378 fidl::encoding::DynamicFlags::empty(),
5379 )
5380 }
5381}
5382
5383#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5384pub struct ServiceSubscriberMarker;
5385
5386impl fidl::endpoints::ProtocolMarker for ServiceSubscriberMarker {
5387 type Proxy = ServiceSubscriberProxy;
5388 type RequestStream = ServiceSubscriberRequestStream;
5389 #[cfg(target_os = "fuchsia")]
5390 type SynchronousProxy = ServiceSubscriberSynchronousProxy;
5391
5392 const DEBUG_NAME: &'static str = "(anonymous) ServiceSubscriber";
5393}
5394
5395pub trait ServiceSubscriberProxyInterface: Send + Sync {
5396 type OnInstanceDiscoveredResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
5397 + Send;
5398 fn r#on_instance_discovered(
5399 &self,
5400 instance: &ServiceInstance,
5401 ) -> Self::OnInstanceDiscoveredResponseFut;
5402 type OnInstanceChangedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
5403 fn r#on_instance_changed(
5404 &self,
5405 instance: &ServiceInstance,
5406 ) -> Self::OnInstanceChangedResponseFut;
5407 type OnInstanceLostResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
5408 fn r#on_instance_lost(&self, service: &str, instance: &str) -> Self::OnInstanceLostResponseFut;
5409 type OnQueryResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
5410 fn r#on_query(&self, resource_type: ResourceType) -> Self::OnQueryResponseFut;
5411}
5412#[derive(Debug)]
5413#[cfg(target_os = "fuchsia")]
5414pub struct ServiceSubscriberSynchronousProxy {
5415 client: fidl::client::sync::Client,
5416}
5417
5418#[cfg(target_os = "fuchsia")]
5419impl fidl::endpoints::SynchronousProxy for ServiceSubscriberSynchronousProxy {
5420 type Proxy = ServiceSubscriberProxy;
5421 type Protocol = ServiceSubscriberMarker;
5422
5423 fn from_channel(inner: fidl::Channel) -> Self {
5424 Self::new(inner)
5425 }
5426
5427 fn into_channel(self) -> fidl::Channel {
5428 self.client.into_channel()
5429 }
5430
5431 fn as_channel(&self) -> &fidl::Channel {
5432 self.client.as_channel()
5433 }
5434}
5435
5436#[cfg(target_os = "fuchsia")]
5437impl ServiceSubscriberSynchronousProxy {
5438 pub fn new(channel: fidl::Channel) -> Self {
5439 let protocol_name =
5440 <ServiceSubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5441 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5442 }
5443
5444 pub fn into_channel(self) -> fidl::Channel {
5445 self.client.into_channel()
5446 }
5447
5448 pub fn wait_for_event(
5451 &self,
5452 deadline: zx::MonotonicInstant,
5453 ) -> Result<ServiceSubscriberEvent, fidl::Error> {
5454 ServiceSubscriberEvent::decode(self.client.wait_for_event(deadline)?)
5455 }
5456
5457 pub fn r#on_instance_discovered(
5459 &self,
5460 mut instance: &ServiceInstance,
5461 ___deadline: zx::MonotonicInstant,
5462 ) -> Result<(), fidl::Error> {
5463 let _response = self.client.send_query::<
5464 ServiceSubscriberOnInstanceDiscoveredRequest,
5465 fidl::encoding::EmptyPayload,
5466 >(
5467 (instance,),
5468 0x74aa039fd81dcab2,
5469 fidl::encoding::DynamicFlags::empty(),
5470 ___deadline,
5471 )?;
5472 Ok(_response)
5473 }
5474
5475 pub fn r#on_instance_changed(
5478 &self,
5479 mut instance: &ServiceInstance,
5480 ___deadline: zx::MonotonicInstant,
5481 ) -> Result<(), fidl::Error> {
5482 let _response = self
5483 .client
5484 .send_query::<ServiceSubscriberOnInstanceChangedRequest, fidl::encoding::EmptyPayload>(
5485 (instance,),
5486 0x24da258aad929434,
5487 fidl::encoding::DynamicFlags::empty(),
5488 ___deadline,
5489 )?;
5490 Ok(_response)
5491 }
5492
5493 pub fn r#on_instance_lost(
5495 &self,
5496 mut service: &str,
5497 mut instance: &str,
5498 ___deadline: zx::MonotonicInstant,
5499 ) -> Result<(), fidl::Error> {
5500 let _response = self
5501 .client
5502 .send_query::<ServiceSubscriberOnInstanceLostRequest, fidl::encoding::EmptyPayload>(
5503 (service, instance),
5504 0x5beddb781791773f,
5505 fidl::encoding::DynamicFlags::empty(),
5506 ___deadline,
5507 )?;
5508 Ok(_response)
5509 }
5510
5511 pub fn r#on_query(
5513 &self,
5514 mut resource_type: ResourceType,
5515 ___deadline: zx::MonotonicInstant,
5516 ) -> Result<(), fidl::Error> {
5517 let _response = self
5518 .client
5519 .send_query::<ServiceSubscriberOnQueryRequest, fidl::encoding::EmptyPayload>(
5520 (resource_type,),
5521 0x1d0496189fdb23f5,
5522 fidl::encoding::DynamicFlags::empty(),
5523 ___deadline,
5524 )?;
5525 Ok(_response)
5526 }
5527}
5528
5529#[cfg(target_os = "fuchsia")]
5530impl From<ServiceSubscriberSynchronousProxy> for zx::Handle {
5531 fn from(value: ServiceSubscriberSynchronousProxy) -> Self {
5532 value.into_channel().into()
5533 }
5534}
5535
5536#[cfg(target_os = "fuchsia")]
5537impl From<fidl::Channel> for ServiceSubscriberSynchronousProxy {
5538 fn from(value: fidl::Channel) -> Self {
5539 Self::new(value)
5540 }
5541}
5542
5543#[cfg(target_os = "fuchsia")]
5544impl fidl::endpoints::FromClient for ServiceSubscriberSynchronousProxy {
5545 type Protocol = ServiceSubscriberMarker;
5546
5547 fn from_client(value: fidl::endpoints::ClientEnd<ServiceSubscriberMarker>) -> Self {
5548 Self::new(value.into_channel())
5549 }
5550}
5551
5552#[derive(Debug, Clone)]
5553pub struct ServiceSubscriberProxy {
5554 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5555}
5556
5557impl fidl::endpoints::Proxy for ServiceSubscriberProxy {
5558 type Protocol = ServiceSubscriberMarker;
5559
5560 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5561 Self::new(inner)
5562 }
5563
5564 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5565 self.client.into_channel().map_err(|client| Self { client })
5566 }
5567
5568 fn as_channel(&self) -> &::fidl::AsyncChannel {
5569 self.client.as_channel()
5570 }
5571}
5572
5573impl ServiceSubscriberProxy {
5574 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5576 let protocol_name =
5577 <ServiceSubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5578 Self { client: fidl::client::Client::new(channel, protocol_name) }
5579 }
5580
5581 pub fn take_event_stream(&self) -> ServiceSubscriberEventStream {
5587 ServiceSubscriberEventStream { event_receiver: self.client.take_event_receiver() }
5588 }
5589
5590 pub fn r#on_instance_discovered(
5592 &self,
5593 mut instance: &ServiceInstance,
5594 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5595 ServiceSubscriberProxyInterface::r#on_instance_discovered(self, instance)
5596 }
5597
5598 pub fn r#on_instance_changed(
5601 &self,
5602 mut instance: &ServiceInstance,
5603 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5604 ServiceSubscriberProxyInterface::r#on_instance_changed(self, instance)
5605 }
5606
5607 pub fn r#on_instance_lost(
5609 &self,
5610 mut service: &str,
5611 mut instance: &str,
5612 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5613 ServiceSubscriberProxyInterface::r#on_instance_lost(self, service, instance)
5614 }
5615
5616 pub fn r#on_query(
5618 &self,
5619 mut resource_type: ResourceType,
5620 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5621 ServiceSubscriberProxyInterface::r#on_query(self, resource_type)
5622 }
5623}
5624
5625impl ServiceSubscriberProxyInterface for ServiceSubscriberProxy {
5626 type OnInstanceDiscoveredResponseFut =
5627 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5628 fn r#on_instance_discovered(
5629 &self,
5630 mut instance: &ServiceInstance,
5631 ) -> Self::OnInstanceDiscoveredResponseFut {
5632 fn _decode(
5633 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5634 ) -> Result<(), fidl::Error> {
5635 let _response = fidl::client::decode_transaction_body::<
5636 fidl::encoding::EmptyPayload,
5637 fidl::encoding::DefaultFuchsiaResourceDialect,
5638 0x74aa039fd81dcab2,
5639 >(_buf?)?;
5640 Ok(_response)
5641 }
5642 self.client.send_query_and_decode::<ServiceSubscriberOnInstanceDiscoveredRequest, ()>(
5643 (instance,),
5644 0x74aa039fd81dcab2,
5645 fidl::encoding::DynamicFlags::empty(),
5646 _decode,
5647 )
5648 }
5649
5650 type OnInstanceChangedResponseFut =
5651 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5652 fn r#on_instance_changed(
5653 &self,
5654 mut instance: &ServiceInstance,
5655 ) -> Self::OnInstanceChangedResponseFut {
5656 fn _decode(
5657 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5658 ) -> Result<(), fidl::Error> {
5659 let _response = fidl::client::decode_transaction_body::<
5660 fidl::encoding::EmptyPayload,
5661 fidl::encoding::DefaultFuchsiaResourceDialect,
5662 0x24da258aad929434,
5663 >(_buf?)?;
5664 Ok(_response)
5665 }
5666 self.client.send_query_and_decode::<ServiceSubscriberOnInstanceChangedRequest, ()>(
5667 (instance,),
5668 0x24da258aad929434,
5669 fidl::encoding::DynamicFlags::empty(),
5670 _decode,
5671 )
5672 }
5673
5674 type OnInstanceLostResponseFut =
5675 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5676 fn r#on_instance_lost(
5677 &self,
5678 mut service: &str,
5679 mut instance: &str,
5680 ) -> Self::OnInstanceLostResponseFut {
5681 fn _decode(
5682 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5683 ) -> Result<(), fidl::Error> {
5684 let _response = fidl::client::decode_transaction_body::<
5685 fidl::encoding::EmptyPayload,
5686 fidl::encoding::DefaultFuchsiaResourceDialect,
5687 0x5beddb781791773f,
5688 >(_buf?)?;
5689 Ok(_response)
5690 }
5691 self.client.send_query_and_decode::<ServiceSubscriberOnInstanceLostRequest, ()>(
5692 (service, instance),
5693 0x5beddb781791773f,
5694 fidl::encoding::DynamicFlags::empty(),
5695 _decode,
5696 )
5697 }
5698
5699 type OnQueryResponseFut =
5700 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5701 fn r#on_query(&self, mut resource_type: ResourceType) -> Self::OnQueryResponseFut {
5702 fn _decode(
5703 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5704 ) -> Result<(), fidl::Error> {
5705 let _response = fidl::client::decode_transaction_body::<
5706 fidl::encoding::EmptyPayload,
5707 fidl::encoding::DefaultFuchsiaResourceDialect,
5708 0x1d0496189fdb23f5,
5709 >(_buf?)?;
5710 Ok(_response)
5711 }
5712 self.client.send_query_and_decode::<ServiceSubscriberOnQueryRequest, ()>(
5713 (resource_type,),
5714 0x1d0496189fdb23f5,
5715 fidl::encoding::DynamicFlags::empty(),
5716 _decode,
5717 )
5718 }
5719}
5720
5721pub struct ServiceSubscriberEventStream {
5722 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5723}
5724
5725impl std::marker::Unpin for ServiceSubscriberEventStream {}
5726
5727impl futures::stream::FusedStream for ServiceSubscriberEventStream {
5728 fn is_terminated(&self) -> bool {
5729 self.event_receiver.is_terminated()
5730 }
5731}
5732
5733impl futures::Stream for ServiceSubscriberEventStream {
5734 type Item = Result<ServiceSubscriberEvent, fidl::Error>;
5735
5736 fn poll_next(
5737 mut self: std::pin::Pin<&mut Self>,
5738 cx: &mut std::task::Context<'_>,
5739 ) -> std::task::Poll<Option<Self::Item>> {
5740 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5741 &mut self.event_receiver,
5742 cx
5743 )?) {
5744 Some(buf) => std::task::Poll::Ready(Some(ServiceSubscriberEvent::decode(buf))),
5745 None => std::task::Poll::Ready(None),
5746 }
5747 }
5748}
5749
5750#[derive(Debug)]
5751pub enum ServiceSubscriberEvent {}
5752
5753impl ServiceSubscriberEvent {
5754 fn decode(
5756 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5757 ) -> Result<ServiceSubscriberEvent, fidl::Error> {
5758 let (bytes, _handles) = buf.split_mut();
5759 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5760 debug_assert_eq!(tx_header.tx_id, 0);
5761 match tx_header.ordinal {
5762 _ => Err(fidl::Error::UnknownOrdinal {
5763 ordinal: tx_header.ordinal,
5764 protocol_name:
5765 <ServiceSubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5766 }),
5767 }
5768 }
5769}
5770
5771pub struct ServiceSubscriberRequestStream {
5773 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5774 is_terminated: bool,
5775}
5776
5777impl std::marker::Unpin for ServiceSubscriberRequestStream {}
5778
5779impl futures::stream::FusedStream for ServiceSubscriberRequestStream {
5780 fn is_terminated(&self) -> bool {
5781 self.is_terminated
5782 }
5783}
5784
5785impl fidl::endpoints::RequestStream for ServiceSubscriberRequestStream {
5786 type Protocol = ServiceSubscriberMarker;
5787 type ControlHandle = ServiceSubscriberControlHandle;
5788
5789 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5790 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5791 }
5792
5793 fn control_handle(&self) -> Self::ControlHandle {
5794 ServiceSubscriberControlHandle { inner: self.inner.clone() }
5795 }
5796
5797 fn into_inner(
5798 self,
5799 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5800 {
5801 (self.inner, self.is_terminated)
5802 }
5803
5804 fn from_inner(
5805 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5806 is_terminated: bool,
5807 ) -> Self {
5808 Self { inner, is_terminated }
5809 }
5810}
5811
5812impl futures::Stream for ServiceSubscriberRequestStream {
5813 type Item = Result<ServiceSubscriberRequest, fidl::Error>;
5814
5815 fn poll_next(
5816 mut self: std::pin::Pin<&mut Self>,
5817 cx: &mut std::task::Context<'_>,
5818 ) -> std::task::Poll<Option<Self::Item>> {
5819 let this = &mut *self;
5820 if this.inner.check_shutdown(cx) {
5821 this.is_terminated = true;
5822 return std::task::Poll::Ready(None);
5823 }
5824 if this.is_terminated {
5825 panic!("polled ServiceSubscriberRequestStream after completion");
5826 }
5827 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5828 |bytes, handles| {
5829 match this.inner.channel().read_etc(cx, bytes, handles) {
5830 std::task::Poll::Ready(Ok(())) => {}
5831 std::task::Poll::Pending => return std::task::Poll::Pending,
5832 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5833 this.is_terminated = true;
5834 return std::task::Poll::Ready(None);
5835 }
5836 std::task::Poll::Ready(Err(e)) => {
5837 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5838 e.into(),
5839 ))));
5840 }
5841 }
5842
5843 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5845
5846 std::task::Poll::Ready(Some(match header.ordinal {
5847 0x74aa039fd81dcab2 => {
5848 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5849 let mut req = fidl::new_empty!(
5850 ServiceSubscriberOnInstanceDiscoveredRequest,
5851 fidl::encoding::DefaultFuchsiaResourceDialect
5852 );
5853 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriberOnInstanceDiscoveredRequest>(&header, _body_bytes, handles, &mut req)?;
5854 let control_handle =
5855 ServiceSubscriberControlHandle { inner: this.inner.clone() };
5856 Ok(ServiceSubscriberRequest::OnInstanceDiscovered {
5857 instance: req.instance,
5858
5859 responder: ServiceSubscriberOnInstanceDiscoveredResponder {
5860 control_handle: std::mem::ManuallyDrop::new(control_handle),
5861 tx_id: header.tx_id,
5862 },
5863 })
5864 }
5865 0x24da258aad929434 => {
5866 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5867 let mut req = fidl::new_empty!(
5868 ServiceSubscriberOnInstanceChangedRequest,
5869 fidl::encoding::DefaultFuchsiaResourceDialect
5870 );
5871 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriberOnInstanceChangedRequest>(&header, _body_bytes, handles, &mut req)?;
5872 let control_handle =
5873 ServiceSubscriberControlHandle { inner: this.inner.clone() };
5874 Ok(ServiceSubscriberRequest::OnInstanceChanged {
5875 instance: req.instance,
5876
5877 responder: ServiceSubscriberOnInstanceChangedResponder {
5878 control_handle: std::mem::ManuallyDrop::new(control_handle),
5879 tx_id: header.tx_id,
5880 },
5881 })
5882 }
5883 0x5beddb781791773f => {
5884 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5885 let mut req = fidl::new_empty!(
5886 ServiceSubscriberOnInstanceLostRequest,
5887 fidl::encoding::DefaultFuchsiaResourceDialect
5888 );
5889 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriberOnInstanceLostRequest>(&header, _body_bytes, handles, &mut req)?;
5890 let control_handle =
5891 ServiceSubscriberControlHandle { inner: this.inner.clone() };
5892 Ok(ServiceSubscriberRequest::OnInstanceLost {
5893 service: req.service,
5894 instance: req.instance,
5895
5896 responder: ServiceSubscriberOnInstanceLostResponder {
5897 control_handle: std::mem::ManuallyDrop::new(control_handle),
5898 tx_id: header.tx_id,
5899 },
5900 })
5901 }
5902 0x1d0496189fdb23f5 => {
5903 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5904 let mut req = fidl::new_empty!(
5905 ServiceSubscriberOnQueryRequest,
5906 fidl::encoding::DefaultFuchsiaResourceDialect
5907 );
5908 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriberOnQueryRequest>(&header, _body_bytes, handles, &mut req)?;
5909 let control_handle =
5910 ServiceSubscriberControlHandle { inner: this.inner.clone() };
5911 Ok(ServiceSubscriberRequest::OnQuery {
5912 resource_type: req.resource_type,
5913
5914 responder: ServiceSubscriberOnQueryResponder {
5915 control_handle: std::mem::ManuallyDrop::new(control_handle),
5916 tx_id: header.tx_id,
5917 },
5918 })
5919 }
5920 _ => Err(fidl::Error::UnknownOrdinal {
5921 ordinal: header.ordinal,
5922 protocol_name:
5923 <ServiceSubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5924 }),
5925 }))
5926 },
5927 )
5928 }
5929}
5930
5931#[derive(Debug)]
5935pub enum ServiceSubscriberRequest {
5936 OnInstanceDiscovered {
5938 instance: ServiceInstance,
5939 responder: ServiceSubscriberOnInstanceDiscoveredResponder,
5940 },
5941 OnInstanceChanged {
5944 instance: ServiceInstance,
5945 responder: ServiceSubscriberOnInstanceChangedResponder,
5946 },
5947 OnInstanceLost {
5949 service: String,
5950 instance: String,
5951 responder: ServiceSubscriberOnInstanceLostResponder,
5952 },
5953 OnQuery { resource_type: ResourceType, responder: ServiceSubscriberOnQueryResponder },
5955}
5956
5957impl ServiceSubscriberRequest {
5958 #[allow(irrefutable_let_patterns)]
5959 pub fn into_on_instance_discovered(
5960 self,
5961 ) -> Option<(ServiceInstance, ServiceSubscriberOnInstanceDiscoveredResponder)> {
5962 if let ServiceSubscriberRequest::OnInstanceDiscovered { instance, responder } = self {
5963 Some((instance, responder))
5964 } else {
5965 None
5966 }
5967 }
5968
5969 #[allow(irrefutable_let_patterns)]
5970 pub fn into_on_instance_changed(
5971 self,
5972 ) -> Option<(ServiceInstance, ServiceSubscriberOnInstanceChangedResponder)> {
5973 if let ServiceSubscriberRequest::OnInstanceChanged { instance, responder } = self {
5974 Some((instance, responder))
5975 } else {
5976 None
5977 }
5978 }
5979
5980 #[allow(irrefutable_let_patterns)]
5981 pub fn into_on_instance_lost(
5982 self,
5983 ) -> Option<(String, String, ServiceSubscriberOnInstanceLostResponder)> {
5984 if let ServiceSubscriberRequest::OnInstanceLost { service, instance, responder } = self {
5985 Some((service, instance, responder))
5986 } else {
5987 None
5988 }
5989 }
5990
5991 #[allow(irrefutable_let_patterns)]
5992 pub fn into_on_query(self) -> Option<(ResourceType, ServiceSubscriberOnQueryResponder)> {
5993 if let ServiceSubscriberRequest::OnQuery { resource_type, responder } = self {
5994 Some((resource_type, responder))
5995 } else {
5996 None
5997 }
5998 }
5999
6000 pub fn method_name(&self) -> &'static str {
6002 match *self {
6003 ServiceSubscriberRequest::OnInstanceDiscovered { .. } => "on_instance_discovered",
6004 ServiceSubscriberRequest::OnInstanceChanged { .. } => "on_instance_changed",
6005 ServiceSubscriberRequest::OnInstanceLost { .. } => "on_instance_lost",
6006 ServiceSubscriberRequest::OnQuery { .. } => "on_query",
6007 }
6008 }
6009}
6010
6011#[derive(Debug, Clone)]
6012pub struct ServiceSubscriberControlHandle {
6013 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6014}
6015
6016impl fidl::endpoints::ControlHandle for ServiceSubscriberControlHandle {
6017 fn shutdown(&self) {
6018 self.inner.shutdown()
6019 }
6020 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6021 self.inner.shutdown_with_epitaph(status)
6022 }
6023
6024 fn is_closed(&self) -> bool {
6025 self.inner.channel().is_closed()
6026 }
6027 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6028 self.inner.channel().on_closed()
6029 }
6030
6031 #[cfg(target_os = "fuchsia")]
6032 fn signal_peer(
6033 &self,
6034 clear_mask: zx::Signals,
6035 set_mask: zx::Signals,
6036 ) -> Result<(), zx_status::Status> {
6037 use fidl::Peered;
6038 self.inner.channel().signal_peer(clear_mask, set_mask)
6039 }
6040}
6041
6042impl ServiceSubscriberControlHandle {}
6043
6044#[must_use = "FIDL methods require a response to be sent"]
6045#[derive(Debug)]
6046pub struct ServiceSubscriberOnInstanceDiscoveredResponder {
6047 control_handle: std::mem::ManuallyDrop<ServiceSubscriberControlHandle>,
6048 tx_id: u32,
6049}
6050
6051impl std::ops::Drop for ServiceSubscriberOnInstanceDiscoveredResponder {
6055 fn drop(&mut self) {
6056 self.control_handle.shutdown();
6057 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6059 }
6060}
6061
6062impl fidl::endpoints::Responder for ServiceSubscriberOnInstanceDiscoveredResponder {
6063 type ControlHandle = ServiceSubscriberControlHandle;
6064
6065 fn control_handle(&self) -> &ServiceSubscriberControlHandle {
6066 &self.control_handle
6067 }
6068
6069 fn drop_without_shutdown(mut self) {
6070 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6072 std::mem::forget(self);
6074 }
6075}
6076
6077impl ServiceSubscriberOnInstanceDiscoveredResponder {
6078 pub fn send(self) -> Result<(), fidl::Error> {
6082 let _result = self.send_raw();
6083 if _result.is_err() {
6084 self.control_handle.shutdown();
6085 }
6086 self.drop_without_shutdown();
6087 _result
6088 }
6089
6090 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
6092 let _result = self.send_raw();
6093 self.drop_without_shutdown();
6094 _result
6095 }
6096
6097 fn send_raw(&self) -> Result<(), fidl::Error> {
6098 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
6099 (),
6100 self.tx_id,
6101 0x74aa039fd81dcab2,
6102 fidl::encoding::DynamicFlags::empty(),
6103 )
6104 }
6105}
6106
6107#[must_use = "FIDL methods require a response to be sent"]
6108#[derive(Debug)]
6109pub struct ServiceSubscriberOnInstanceChangedResponder {
6110 control_handle: std::mem::ManuallyDrop<ServiceSubscriberControlHandle>,
6111 tx_id: u32,
6112}
6113
6114impl std::ops::Drop for ServiceSubscriberOnInstanceChangedResponder {
6118 fn drop(&mut self) {
6119 self.control_handle.shutdown();
6120 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6122 }
6123}
6124
6125impl fidl::endpoints::Responder for ServiceSubscriberOnInstanceChangedResponder {
6126 type ControlHandle = ServiceSubscriberControlHandle;
6127
6128 fn control_handle(&self) -> &ServiceSubscriberControlHandle {
6129 &self.control_handle
6130 }
6131
6132 fn drop_without_shutdown(mut self) {
6133 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6135 std::mem::forget(self);
6137 }
6138}
6139
6140impl ServiceSubscriberOnInstanceChangedResponder {
6141 pub fn send(self) -> Result<(), fidl::Error> {
6145 let _result = self.send_raw();
6146 if _result.is_err() {
6147 self.control_handle.shutdown();
6148 }
6149 self.drop_without_shutdown();
6150 _result
6151 }
6152
6153 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
6155 let _result = self.send_raw();
6156 self.drop_without_shutdown();
6157 _result
6158 }
6159
6160 fn send_raw(&self) -> Result<(), fidl::Error> {
6161 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
6162 (),
6163 self.tx_id,
6164 0x24da258aad929434,
6165 fidl::encoding::DynamicFlags::empty(),
6166 )
6167 }
6168}
6169
6170#[must_use = "FIDL methods require a response to be sent"]
6171#[derive(Debug)]
6172pub struct ServiceSubscriberOnInstanceLostResponder {
6173 control_handle: std::mem::ManuallyDrop<ServiceSubscriberControlHandle>,
6174 tx_id: u32,
6175}
6176
6177impl std::ops::Drop for ServiceSubscriberOnInstanceLostResponder {
6181 fn drop(&mut self) {
6182 self.control_handle.shutdown();
6183 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6185 }
6186}
6187
6188impl fidl::endpoints::Responder for ServiceSubscriberOnInstanceLostResponder {
6189 type ControlHandle = ServiceSubscriberControlHandle;
6190
6191 fn control_handle(&self) -> &ServiceSubscriberControlHandle {
6192 &self.control_handle
6193 }
6194
6195 fn drop_without_shutdown(mut self) {
6196 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6198 std::mem::forget(self);
6200 }
6201}
6202
6203impl ServiceSubscriberOnInstanceLostResponder {
6204 pub fn send(self) -> Result<(), fidl::Error> {
6208 let _result = self.send_raw();
6209 if _result.is_err() {
6210 self.control_handle.shutdown();
6211 }
6212 self.drop_without_shutdown();
6213 _result
6214 }
6215
6216 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
6218 let _result = self.send_raw();
6219 self.drop_without_shutdown();
6220 _result
6221 }
6222
6223 fn send_raw(&self) -> Result<(), fidl::Error> {
6224 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
6225 (),
6226 self.tx_id,
6227 0x5beddb781791773f,
6228 fidl::encoding::DynamicFlags::empty(),
6229 )
6230 }
6231}
6232
6233#[must_use = "FIDL methods require a response to be sent"]
6234#[derive(Debug)]
6235pub struct ServiceSubscriberOnQueryResponder {
6236 control_handle: std::mem::ManuallyDrop<ServiceSubscriberControlHandle>,
6237 tx_id: u32,
6238}
6239
6240impl std::ops::Drop for ServiceSubscriberOnQueryResponder {
6244 fn drop(&mut self) {
6245 self.control_handle.shutdown();
6246 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6248 }
6249}
6250
6251impl fidl::endpoints::Responder for ServiceSubscriberOnQueryResponder {
6252 type ControlHandle = ServiceSubscriberControlHandle;
6253
6254 fn control_handle(&self) -> &ServiceSubscriberControlHandle {
6255 &self.control_handle
6256 }
6257
6258 fn drop_without_shutdown(mut self) {
6259 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6261 std::mem::forget(self);
6263 }
6264}
6265
6266impl ServiceSubscriberOnQueryResponder {
6267 pub fn send(self) -> Result<(), fidl::Error> {
6271 let _result = self.send_raw();
6272 if _result.is_err() {
6273 self.control_handle.shutdown();
6274 }
6275 self.drop_without_shutdown();
6276 _result
6277 }
6278
6279 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
6281 let _result = self.send_raw();
6282 self.drop_without_shutdown();
6283 _result
6284 }
6285
6286 fn send_raw(&self) -> Result<(), fidl::Error> {
6287 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
6288 (),
6289 self.tx_id,
6290 0x1d0496189fdb23f5,
6291 fidl::encoding::DynamicFlags::empty(),
6292 )
6293 }
6294}
6295
6296#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6297pub struct ServiceSubscriber2Marker;
6298
6299impl fidl::endpoints::ProtocolMarker for ServiceSubscriber2Marker {
6300 type Proxy = ServiceSubscriber2Proxy;
6301 type RequestStream = ServiceSubscriber2RequestStream;
6302 #[cfg(target_os = "fuchsia")]
6303 type SynchronousProxy = ServiceSubscriber2SynchronousProxy;
6304
6305 const DEBUG_NAME: &'static str = "fuchsia.net.mdns.ServiceSubscriber2";
6306}
6307impl fidl::endpoints::DiscoverableProtocolMarker for ServiceSubscriber2Marker {}
6308
6309pub trait ServiceSubscriber2ProxyInterface: Send + Sync {
6310 fn r#subscribe_to_service(
6311 &self,
6312 service: &str,
6313 options: &ServiceSubscriptionOptions,
6314 listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
6315 ) -> Result<(), fidl::Error>;
6316 fn r#subscribe_to_all_services(
6317 &self,
6318 options: &ServiceSubscriptionOptions,
6319 listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
6320 ) -> Result<(), fidl::Error>;
6321}
6322#[derive(Debug)]
6323#[cfg(target_os = "fuchsia")]
6324pub struct ServiceSubscriber2SynchronousProxy {
6325 client: fidl::client::sync::Client,
6326}
6327
6328#[cfg(target_os = "fuchsia")]
6329impl fidl::endpoints::SynchronousProxy for ServiceSubscriber2SynchronousProxy {
6330 type Proxy = ServiceSubscriber2Proxy;
6331 type Protocol = ServiceSubscriber2Marker;
6332
6333 fn from_channel(inner: fidl::Channel) -> Self {
6334 Self::new(inner)
6335 }
6336
6337 fn into_channel(self) -> fidl::Channel {
6338 self.client.into_channel()
6339 }
6340
6341 fn as_channel(&self) -> &fidl::Channel {
6342 self.client.as_channel()
6343 }
6344}
6345
6346#[cfg(target_os = "fuchsia")]
6347impl ServiceSubscriber2SynchronousProxy {
6348 pub fn new(channel: fidl::Channel) -> Self {
6349 let protocol_name =
6350 <ServiceSubscriber2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6351 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6352 }
6353
6354 pub fn into_channel(self) -> fidl::Channel {
6355 self.client.into_channel()
6356 }
6357
6358 pub fn wait_for_event(
6361 &self,
6362 deadline: zx::MonotonicInstant,
6363 ) -> Result<ServiceSubscriber2Event, fidl::Error> {
6364 ServiceSubscriber2Event::decode(self.client.wait_for_event(deadline)?)
6365 }
6366
6367 pub fn r#subscribe_to_service(
6375 &self,
6376 mut service: &str,
6377 mut options: &ServiceSubscriptionOptions,
6378 mut listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
6379 ) -> Result<(), fidl::Error> {
6380 self.client.send::<ServiceSubscriber2SubscribeToServiceRequest>(
6381 (service, options, listener),
6382 0x78f713d88dcf34aa,
6383 fidl::encoding::DynamicFlags::empty(),
6384 )
6385 }
6386
6387 pub fn r#subscribe_to_all_services(
6392 &self,
6393 mut options: &ServiceSubscriptionOptions,
6394 mut listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
6395 ) -> Result<(), fidl::Error> {
6396 self.client.send::<ServiceSubscriber2SubscribeToAllServicesRequest>(
6397 (options, listener),
6398 0x7c5192d46e380468,
6399 fidl::encoding::DynamicFlags::empty(),
6400 )
6401 }
6402}
6403
6404#[cfg(target_os = "fuchsia")]
6405impl From<ServiceSubscriber2SynchronousProxy> for zx::Handle {
6406 fn from(value: ServiceSubscriber2SynchronousProxy) -> Self {
6407 value.into_channel().into()
6408 }
6409}
6410
6411#[cfg(target_os = "fuchsia")]
6412impl From<fidl::Channel> for ServiceSubscriber2SynchronousProxy {
6413 fn from(value: fidl::Channel) -> Self {
6414 Self::new(value)
6415 }
6416}
6417
6418#[cfg(target_os = "fuchsia")]
6419impl fidl::endpoints::FromClient for ServiceSubscriber2SynchronousProxy {
6420 type Protocol = ServiceSubscriber2Marker;
6421
6422 fn from_client(value: fidl::endpoints::ClientEnd<ServiceSubscriber2Marker>) -> Self {
6423 Self::new(value.into_channel())
6424 }
6425}
6426
6427#[derive(Debug, Clone)]
6428pub struct ServiceSubscriber2Proxy {
6429 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6430}
6431
6432impl fidl::endpoints::Proxy for ServiceSubscriber2Proxy {
6433 type Protocol = ServiceSubscriber2Marker;
6434
6435 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6436 Self::new(inner)
6437 }
6438
6439 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6440 self.client.into_channel().map_err(|client| Self { client })
6441 }
6442
6443 fn as_channel(&self) -> &::fidl::AsyncChannel {
6444 self.client.as_channel()
6445 }
6446}
6447
6448impl ServiceSubscriber2Proxy {
6449 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6451 let protocol_name =
6452 <ServiceSubscriber2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6453 Self { client: fidl::client::Client::new(channel, protocol_name) }
6454 }
6455
6456 pub fn take_event_stream(&self) -> ServiceSubscriber2EventStream {
6462 ServiceSubscriber2EventStream { event_receiver: self.client.take_event_receiver() }
6463 }
6464
6465 pub fn r#subscribe_to_service(
6473 &self,
6474 mut service: &str,
6475 mut options: &ServiceSubscriptionOptions,
6476 mut listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
6477 ) -> Result<(), fidl::Error> {
6478 ServiceSubscriber2ProxyInterface::r#subscribe_to_service(self, service, options, listener)
6479 }
6480
6481 pub fn r#subscribe_to_all_services(
6486 &self,
6487 mut options: &ServiceSubscriptionOptions,
6488 mut listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
6489 ) -> Result<(), fidl::Error> {
6490 ServiceSubscriber2ProxyInterface::r#subscribe_to_all_services(self, options, listener)
6491 }
6492}
6493
6494impl ServiceSubscriber2ProxyInterface for ServiceSubscriber2Proxy {
6495 fn r#subscribe_to_service(
6496 &self,
6497 mut service: &str,
6498 mut options: &ServiceSubscriptionOptions,
6499 mut listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
6500 ) -> Result<(), fidl::Error> {
6501 self.client.send::<ServiceSubscriber2SubscribeToServiceRequest>(
6502 (service, options, listener),
6503 0x78f713d88dcf34aa,
6504 fidl::encoding::DynamicFlags::empty(),
6505 )
6506 }
6507
6508 fn r#subscribe_to_all_services(
6509 &self,
6510 mut options: &ServiceSubscriptionOptions,
6511 mut listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
6512 ) -> Result<(), fidl::Error> {
6513 self.client.send::<ServiceSubscriber2SubscribeToAllServicesRequest>(
6514 (options, listener),
6515 0x7c5192d46e380468,
6516 fidl::encoding::DynamicFlags::empty(),
6517 )
6518 }
6519}
6520
6521pub struct ServiceSubscriber2EventStream {
6522 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6523}
6524
6525impl std::marker::Unpin for ServiceSubscriber2EventStream {}
6526
6527impl futures::stream::FusedStream for ServiceSubscriber2EventStream {
6528 fn is_terminated(&self) -> bool {
6529 self.event_receiver.is_terminated()
6530 }
6531}
6532
6533impl futures::Stream for ServiceSubscriber2EventStream {
6534 type Item = Result<ServiceSubscriber2Event, fidl::Error>;
6535
6536 fn poll_next(
6537 mut self: std::pin::Pin<&mut Self>,
6538 cx: &mut std::task::Context<'_>,
6539 ) -> std::task::Poll<Option<Self::Item>> {
6540 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6541 &mut self.event_receiver,
6542 cx
6543 )?) {
6544 Some(buf) => std::task::Poll::Ready(Some(ServiceSubscriber2Event::decode(buf))),
6545 None => std::task::Poll::Ready(None),
6546 }
6547 }
6548}
6549
6550#[derive(Debug)]
6551pub enum ServiceSubscriber2Event {}
6552
6553impl ServiceSubscriber2Event {
6554 fn decode(
6556 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6557 ) -> Result<ServiceSubscriber2Event, fidl::Error> {
6558 let (bytes, _handles) = buf.split_mut();
6559 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6560 debug_assert_eq!(tx_header.tx_id, 0);
6561 match tx_header.ordinal {
6562 _ => Err(fidl::Error::UnknownOrdinal {
6563 ordinal: tx_header.ordinal,
6564 protocol_name:
6565 <ServiceSubscriber2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6566 }),
6567 }
6568 }
6569}
6570
6571pub struct ServiceSubscriber2RequestStream {
6573 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6574 is_terminated: bool,
6575}
6576
6577impl std::marker::Unpin for ServiceSubscriber2RequestStream {}
6578
6579impl futures::stream::FusedStream for ServiceSubscriber2RequestStream {
6580 fn is_terminated(&self) -> bool {
6581 self.is_terminated
6582 }
6583}
6584
6585impl fidl::endpoints::RequestStream for ServiceSubscriber2RequestStream {
6586 type Protocol = ServiceSubscriber2Marker;
6587 type ControlHandle = ServiceSubscriber2ControlHandle;
6588
6589 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6590 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6591 }
6592
6593 fn control_handle(&self) -> Self::ControlHandle {
6594 ServiceSubscriber2ControlHandle { inner: self.inner.clone() }
6595 }
6596
6597 fn into_inner(
6598 self,
6599 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6600 {
6601 (self.inner, self.is_terminated)
6602 }
6603
6604 fn from_inner(
6605 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6606 is_terminated: bool,
6607 ) -> Self {
6608 Self { inner, is_terminated }
6609 }
6610}
6611
6612impl futures::Stream for ServiceSubscriber2RequestStream {
6613 type Item = Result<ServiceSubscriber2Request, fidl::Error>;
6614
6615 fn poll_next(
6616 mut self: std::pin::Pin<&mut Self>,
6617 cx: &mut std::task::Context<'_>,
6618 ) -> std::task::Poll<Option<Self::Item>> {
6619 let this = &mut *self;
6620 if this.inner.check_shutdown(cx) {
6621 this.is_terminated = true;
6622 return std::task::Poll::Ready(None);
6623 }
6624 if this.is_terminated {
6625 panic!("polled ServiceSubscriber2RequestStream after completion");
6626 }
6627 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6628 |bytes, handles| {
6629 match this.inner.channel().read_etc(cx, bytes, handles) {
6630 std::task::Poll::Ready(Ok(())) => {}
6631 std::task::Poll::Pending => return std::task::Poll::Pending,
6632 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6633 this.is_terminated = true;
6634 return std::task::Poll::Ready(None);
6635 }
6636 std::task::Poll::Ready(Err(e)) => {
6637 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6638 e.into(),
6639 ))));
6640 }
6641 }
6642
6643 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6645
6646 std::task::Poll::Ready(Some(match header.ordinal {
6647 0x78f713d88dcf34aa => {
6648 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6649 let mut req = fidl::new_empty!(ServiceSubscriber2SubscribeToServiceRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
6650 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriber2SubscribeToServiceRequest>(&header, _body_bytes, handles, &mut req)?;
6651 let control_handle = ServiceSubscriber2ControlHandle {
6652 inner: this.inner.clone(),
6653 };
6654 Ok(ServiceSubscriber2Request::SubscribeToService {service: req.service,
6655options: req.options,
6656listener: req.listener,
6657
6658 control_handle,
6659 })
6660 }
6661 0x7c5192d46e380468 => {
6662 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6663 let mut req = fidl::new_empty!(ServiceSubscriber2SubscribeToAllServicesRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
6664 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriber2SubscribeToAllServicesRequest>(&header, _body_bytes, handles, &mut req)?;
6665 let control_handle = ServiceSubscriber2ControlHandle {
6666 inner: this.inner.clone(),
6667 };
6668 Ok(ServiceSubscriber2Request::SubscribeToAllServices {options: req.options,
6669listener: req.listener,
6670
6671 control_handle,
6672 })
6673 }
6674 _ => Err(fidl::Error::UnknownOrdinal {
6675 ordinal: header.ordinal,
6676 protocol_name: <ServiceSubscriber2Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6677 }),
6678 }))
6679 },
6680 )
6681 }
6682}
6683
6684#[derive(Debug)]
6686pub enum ServiceSubscriber2Request {
6687 SubscribeToService {
6695 service: String,
6696 options: ServiceSubscriptionOptions,
6697 listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
6698 control_handle: ServiceSubscriber2ControlHandle,
6699 },
6700 SubscribeToAllServices {
6705 options: ServiceSubscriptionOptions,
6706 listener: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
6707 control_handle: ServiceSubscriber2ControlHandle,
6708 },
6709}
6710
6711impl ServiceSubscriber2Request {
6712 #[allow(irrefutable_let_patterns)]
6713 pub fn into_subscribe_to_service(
6714 self,
6715 ) -> Option<(
6716 String,
6717 ServiceSubscriptionOptions,
6718 fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
6719 ServiceSubscriber2ControlHandle,
6720 )> {
6721 if let ServiceSubscriber2Request::SubscribeToService {
6722 service,
6723 options,
6724 listener,
6725 control_handle,
6726 } = self
6727 {
6728 Some((service, options, listener, control_handle))
6729 } else {
6730 None
6731 }
6732 }
6733
6734 #[allow(irrefutable_let_patterns)]
6735 pub fn into_subscribe_to_all_services(
6736 self,
6737 ) -> Option<(
6738 ServiceSubscriptionOptions,
6739 fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
6740 ServiceSubscriber2ControlHandle,
6741 )> {
6742 if let ServiceSubscriber2Request::SubscribeToAllServices {
6743 options,
6744 listener,
6745 control_handle,
6746 } = self
6747 {
6748 Some((options, listener, control_handle))
6749 } else {
6750 None
6751 }
6752 }
6753
6754 pub fn method_name(&self) -> &'static str {
6756 match *self {
6757 ServiceSubscriber2Request::SubscribeToService { .. } => "subscribe_to_service",
6758 ServiceSubscriber2Request::SubscribeToAllServices { .. } => "subscribe_to_all_services",
6759 }
6760 }
6761}
6762
6763#[derive(Debug, Clone)]
6764pub struct ServiceSubscriber2ControlHandle {
6765 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6766}
6767
6768impl fidl::endpoints::ControlHandle for ServiceSubscriber2ControlHandle {
6769 fn shutdown(&self) {
6770 self.inner.shutdown()
6771 }
6772 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6773 self.inner.shutdown_with_epitaph(status)
6774 }
6775
6776 fn is_closed(&self) -> bool {
6777 self.inner.channel().is_closed()
6778 }
6779 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6780 self.inner.channel().on_closed()
6781 }
6782
6783 #[cfg(target_os = "fuchsia")]
6784 fn signal_peer(
6785 &self,
6786 clear_mask: zx::Signals,
6787 set_mask: zx::Signals,
6788 ) -> Result<(), zx_status::Status> {
6789 use fidl::Peered;
6790 self.inner.channel().signal_peer(clear_mask, set_mask)
6791 }
6792}
6793
6794impl ServiceSubscriber2ControlHandle {}
6795
6796#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6797pub struct ServiceSubscriptionListenerMarker;
6798
6799impl fidl::endpoints::ProtocolMarker for ServiceSubscriptionListenerMarker {
6800 type Proxy = ServiceSubscriptionListenerProxy;
6801 type RequestStream = ServiceSubscriptionListenerRequestStream;
6802 #[cfg(target_os = "fuchsia")]
6803 type SynchronousProxy = ServiceSubscriptionListenerSynchronousProxy;
6804
6805 const DEBUG_NAME: &'static str = "(anonymous) ServiceSubscriptionListener";
6806}
6807
6808pub trait ServiceSubscriptionListenerProxyInterface: Send + Sync {
6809 type OnInstanceDiscoveredResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
6810 + Send;
6811 fn r#on_instance_discovered(
6812 &self,
6813 instance: &ServiceInstance,
6814 ) -> Self::OnInstanceDiscoveredResponseFut;
6815 type OnInstanceChangedResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
6816 fn r#on_instance_changed(
6817 &self,
6818 instance: &ServiceInstance,
6819 ) -> Self::OnInstanceChangedResponseFut;
6820 type OnInstanceLostResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
6821 fn r#on_instance_lost(&self, service: &str, instance: &str) -> Self::OnInstanceLostResponseFut;
6822 type OnQueryResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
6823 fn r#on_query(&self, resource_type: ResourceType) -> Self::OnQueryResponseFut;
6824}
6825#[derive(Debug)]
6826#[cfg(target_os = "fuchsia")]
6827pub struct ServiceSubscriptionListenerSynchronousProxy {
6828 client: fidl::client::sync::Client,
6829}
6830
6831#[cfg(target_os = "fuchsia")]
6832impl fidl::endpoints::SynchronousProxy for ServiceSubscriptionListenerSynchronousProxy {
6833 type Proxy = ServiceSubscriptionListenerProxy;
6834 type Protocol = ServiceSubscriptionListenerMarker;
6835
6836 fn from_channel(inner: fidl::Channel) -> Self {
6837 Self::new(inner)
6838 }
6839
6840 fn into_channel(self) -> fidl::Channel {
6841 self.client.into_channel()
6842 }
6843
6844 fn as_channel(&self) -> &fidl::Channel {
6845 self.client.as_channel()
6846 }
6847}
6848
6849#[cfg(target_os = "fuchsia")]
6850impl ServiceSubscriptionListenerSynchronousProxy {
6851 pub fn new(channel: fidl::Channel) -> Self {
6852 let protocol_name =
6853 <ServiceSubscriptionListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6854 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6855 }
6856
6857 pub fn into_channel(self) -> fidl::Channel {
6858 self.client.into_channel()
6859 }
6860
6861 pub fn wait_for_event(
6864 &self,
6865 deadline: zx::MonotonicInstant,
6866 ) -> Result<ServiceSubscriptionListenerEvent, fidl::Error> {
6867 ServiceSubscriptionListenerEvent::decode(self.client.wait_for_event(deadline)?)
6868 }
6869
6870 pub fn r#on_instance_discovered(
6872 &self,
6873 mut instance: &ServiceInstance,
6874 ___deadline: zx::MonotonicInstant,
6875 ) -> Result<(), fidl::Error> {
6876 let _response = self.client.send_query::<
6877 ServiceSubscriptionListenerOnInstanceDiscoveredRequest,
6878 fidl::encoding::EmptyPayload,
6879 >(
6880 (instance,),
6881 0x82f861e0b26a186,
6882 fidl::encoding::DynamicFlags::empty(),
6883 ___deadline,
6884 )?;
6885 Ok(_response)
6886 }
6887
6888 pub fn r#on_instance_changed(
6891 &self,
6892 mut instance: &ServiceInstance,
6893 ___deadline: zx::MonotonicInstant,
6894 ) -> Result<(), fidl::Error> {
6895 let _response = self.client.send_query::<
6896 ServiceSubscriptionListenerOnInstanceChangedRequest,
6897 fidl::encoding::EmptyPayload,
6898 >(
6899 (instance,),
6900 0x7da325aa758d8929,
6901 fidl::encoding::DynamicFlags::empty(),
6902 ___deadline,
6903 )?;
6904 Ok(_response)
6905 }
6906
6907 pub fn r#on_instance_lost(
6909 &self,
6910 mut service: &str,
6911 mut instance: &str,
6912 ___deadline: zx::MonotonicInstant,
6913 ) -> Result<(), fidl::Error> {
6914 let _response = self.client.send_query::<
6915 ServiceSubscriptionListenerOnInstanceLostRequest,
6916 fidl::encoding::EmptyPayload,
6917 >(
6918 (service, instance,),
6919 0x2ecb2f1600c5c6dc,
6920 fidl::encoding::DynamicFlags::empty(),
6921 ___deadline,
6922 )?;
6923 Ok(_response)
6924 }
6925
6926 pub fn r#on_query(
6928 &self,
6929 mut resource_type: ResourceType,
6930 ___deadline: zx::MonotonicInstant,
6931 ) -> Result<(), fidl::Error> {
6932 let _response = self
6933 .client
6934 .send_query::<ServiceSubscriptionListenerOnQueryRequest, fidl::encoding::EmptyPayload>(
6935 (resource_type,),
6936 0x4f4eb8e3d10db611,
6937 fidl::encoding::DynamicFlags::empty(),
6938 ___deadline,
6939 )?;
6940 Ok(_response)
6941 }
6942}
6943
6944#[cfg(target_os = "fuchsia")]
6945impl From<ServiceSubscriptionListenerSynchronousProxy> for zx::Handle {
6946 fn from(value: ServiceSubscriptionListenerSynchronousProxy) -> Self {
6947 value.into_channel().into()
6948 }
6949}
6950
6951#[cfg(target_os = "fuchsia")]
6952impl From<fidl::Channel> for ServiceSubscriptionListenerSynchronousProxy {
6953 fn from(value: fidl::Channel) -> Self {
6954 Self::new(value)
6955 }
6956}
6957
6958#[cfg(target_os = "fuchsia")]
6959impl fidl::endpoints::FromClient for ServiceSubscriptionListenerSynchronousProxy {
6960 type Protocol = ServiceSubscriptionListenerMarker;
6961
6962 fn from_client(value: fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>) -> Self {
6963 Self::new(value.into_channel())
6964 }
6965}
6966
6967#[derive(Debug, Clone)]
6968pub struct ServiceSubscriptionListenerProxy {
6969 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6970}
6971
6972impl fidl::endpoints::Proxy for ServiceSubscriptionListenerProxy {
6973 type Protocol = ServiceSubscriptionListenerMarker;
6974
6975 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6976 Self::new(inner)
6977 }
6978
6979 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6980 self.client.into_channel().map_err(|client| Self { client })
6981 }
6982
6983 fn as_channel(&self) -> &::fidl::AsyncChannel {
6984 self.client.as_channel()
6985 }
6986}
6987
6988impl ServiceSubscriptionListenerProxy {
6989 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6991 let protocol_name =
6992 <ServiceSubscriptionListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6993 Self { client: fidl::client::Client::new(channel, protocol_name) }
6994 }
6995
6996 pub fn take_event_stream(&self) -> ServiceSubscriptionListenerEventStream {
7002 ServiceSubscriptionListenerEventStream { event_receiver: self.client.take_event_receiver() }
7003 }
7004
7005 pub fn r#on_instance_discovered(
7007 &self,
7008 mut instance: &ServiceInstance,
7009 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
7010 ServiceSubscriptionListenerProxyInterface::r#on_instance_discovered(self, instance)
7011 }
7012
7013 pub fn r#on_instance_changed(
7016 &self,
7017 mut instance: &ServiceInstance,
7018 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
7019 ServiceSubscriptionListenerProxyInterface::r#on_instance_changed(self, instance)
7020 }
7021
7022 pub fn r#on_instance_lost(
7024 &self,
7025 mut service: &str,
7026 mut instance: &str,
7027 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
7028 ServiceSubscriptionListenerProxyInterface::r#on_instance_lost(self, service, instance)
7029 }
7030
7031 pub fn r#on_query(
7033 &self,
7034 mut resource_type: ResourceType,
7035 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
7036 ServiceSubscriptionListenerProxyInterface::r#on_query(self, resource_type)
7037 }
7038}
7039
7040impl ServiceSubscriptionListenerProxyInterface for ServiceSubscriptionListenerProxy {
7041 type OnInstanceDiscoveredResponseFut =
7042 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
7043 fn r#on_instance_discovered(
7044 &self,
7045 mut instance: &ServiceInstance,
7046 ) -> Self::OnInstanceDiscoveredResponseFut {
7047 fn _decode(
7048 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7049 ) -> Result<(), fidl::Error> {
7050 let _response = fidl::client::decode_transaction_body::<
7051 fidl::encoding::EmptyPayload,
7052 fidl::encoding::DefaultFuchsiaResourceDialect,
7053 0x82f861e0b26a186,
7054 >(_buf?)?;
7055 Ok(_response)
7056 }
7057 self.client
7058 .send_query_and_decode::<ServiceSubscriptionListenerOnInstanceDiscoveredRequest, ()>(
7059 (instance,),
7060 0x82f861e0b26a186,
7061 fidl::encoding::DynamicFlags::empty(),
7062 _decode,
7063 )
7064 }
7065
7066 type OnInstanceChangedResponseFut =
7067 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
7068 fn r#on_instance_changed(
7069 &self,
7070 mut instance: &ServiceInstance,
7071 ) -> Self::OnInstanceChangedResponseFut {
7072 fn _decode(
7073 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7074 ) -> Result<(), fidl::Error> {
7075 let _response = fidl::client::decode_transaction_body::<
7076 fidl::encoding::EmptyPayload,
7077 fidl::encoding::DefaultFuchsiaResourceDialect,
7078 0x7da325aa758d8929,
7079 >(_buf?)?;
7080 Ok(_response)
7081 }
7082 self.client
7083 .send_query_and_decode::<ServiceSubscriptionListenerOnInstanceChangedRequest, ()>(
7084 (instance,),
7085 0x7da325aa758d8929,
7086 fidl::encoding::DynamicFlags::empty(),
7087 _decode,
7088 )
7089 }
7090
7091 type OnInstanceLostResponseFut =
7092 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
7093 fn r#on_instance_lost(
7094 &self,
7095 mut service: &str,
7096 mut instance: &str,
7097 ) -> Self::OnInstanceLostResponseFut {
7098 fn _decode(
7099 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7100 ) -> Result<(), fidl::Error> {
7101 let _response = fidl::client::decode_transaction_body::<
7102 fidl::encoding::EmptyPayload,
7103 fidl::encoding::DefaultFuchsiaResourceDialect,
7104 0x2ecb2f1600c5c6dc,
7105 >(_buf?)?;
7106 Ok(_response)
7107 }
7108 self.client.send_query_and_decode::<ServiceSubscriptionListenerOnInstanceLostRequest, ()>(
7109 (service, instance),
7110 0x2ecb2f1600c5c6dc,
7111 fidl::encoding::DynamicFlags::empty(),
7112 _decode,
7113 )
7114 }
7115
7116 type OnQueryResponseFut =
7117 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
7118 fn r#on_query(&self, mut resource_type: ResourceType) -> Self::OnQueryResponseFut {
7119 fn _decode(
7120 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7121 ) -> Result<(), fidl::Error> {
7122 let _response = fidl::client::decode_transaction_body::<
7123 fidl::encoding::EmptyPayload,
7124 fidl::encoding::DefaultFuchsiaResourceDialect,
7125 0x4f4eb8e3d10db611,
7126 >(_buf?)?;
7127 Ok(_response)
7128 }
7129 self.client.send_query_and_decode::<ServiceSubscriptionListenerOnQueryRequest, ()>(
7130 (resource_type,),
7131 0x4f4eb8e3d10db611,
7132 fidl::encoding::DynamicFlags::empty(),
7133 _decode,
7134 )
7135 }
7136}
7137
7138pub struct ServiceSubscriptionListenerEventStream {
7139 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7140}
7141
7142impl std::marker::Unpin for ServiceSubscriptionListenerEventStream {}
7143
7144impl futures::stream::FusedStream for ServiceSubscriptionListenerEventStream {
7145 fn is_terminated(&self) -> bool {
7146 self.event_receiver.is_terminated()
7147 }
7148}
7149
7150impl futures::Stream for ServiceSubscriptionListenerEventStream {
7151 type Item = Result<ServiceSubscriptionListenerEvent, fidl::Error>;
7152
7153 fn poll_next(
7154 mut self: std::pin::Pin<&mut Self>,
7155 cx: &mut std::task::Context<'_>,
7156 ) -> std::task::Poll<Option<Self::Item>> {
7157 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7158 &mut self.event_receiver,
7159 cx
7160 )?) {
7161 Some(buf) => {
7162 std::task::Poll::Ready(Some(ServiceSubscriptionListenerEvent::decode(buf)))
7163 }
7164 None => std::task::Poll::Ready(None),
7165 }
7166 }
7167}
7168
7169#[derive(Debug)]
7170pub enum ServiceSubscriptionListenerEvent {}
7171
7172impl ServiceSubscriptionListenerEvent {
7173 fn decode(
7175 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7176 ) -> Result<ServiceSubscriptionListenerEvent, fidl::Error> {
7177 let (bytes, _handles) = buf.split_mut();
7178 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7179 debug_assert_eq!(tx_header.tx_id, 0);
7180 match tx_header.ordinal {
7181 _ => Err(fidl::Error::UnknownOrdinal {
7182 ordinal: tx_header.ordinal,
7183 protocol_name: <ServiceSubscriptionListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7184 })
7185 }
7186 }
7187}
7188
7189pub struct ServiceSubscriptionListenerRequestStream {
7191 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7192 is_terminated: bool,
7193}
7194
7195impl std::marker::Unpin for ServiceSubscriptionListenerRequestStream {}
7196
7197impl futures::stream::FusedStream for ServiceSubscriptionListenerRequestStream {
7198 fn is_terminated(&self) -> bool {
7199 self.is_terminated
7200 }
7201}
7202
7203impl fidl::endpoints::RequestStream for ServiceSubscriptionListenerRequestStream {
7204 type Protocol = ServiceSubscriptionListenerMarker;
7205 type ControlHandle = ServiceSubscriptionListenerControlHandle;
7206
7207 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7208 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7209 }
7210
7211 fn control_handle(&self) -> Self::ControlHandle {
7212 ServiceSubscriptionListenerControlHandle { inner: self.inner.clone() }
7213 }
7214
7215 fn into_inner(
7216 self,
7217 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7218 {
7219 (self.inner, self.is_terminated)
7220 }
7221
7222 fn from_inner(
7223 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7224 is_terminated: bool,
7225 ) -> Self {
7226 Self { inner, is_terminated }
7227 }
7228}
7229
7230impl futures::Stream for ServiceSubscriptionListenerRequestStream {
7231 type Item = Result<ServiceSubscriptionListenerRequest, fidl::Error>;
7232
7233 fn poll_next(
7234 mut self: std::pin::Pin<&mut Self>,
7235 cx: &mut std::task::Context<'_>,
7236 ) -> std::task::Poll<Option<Self::Item>> {
7237 let this = &mut *self;
7238 if this.inner.check_shutdown(cx) {
7239 this.is_terminated = true;
7240 return std::task::Poll::Ready(None);
7241 }
7242 if this.is_terminated {
7243 panic!("polled ServiceSubscriptionListenerRequestStream after completion");
7244 }
7245 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7246 |bytes, handles| {
7247 match this.inner.channel().read_etc(cx, bytes, handles) {
7248 std::task::Poll::Ready(Ok(())) => {}
7249 std::task::Poll::Pending => return std::task::Poll::Pending,
7250 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7251 this.is_terminated = true;
7252 return std::task::Poll::Ready(None);
7253 }
7254 std::task::Poll::Ready(Err(e)) => {
7255 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7256 e.into(),
7257 ))));
7258 }
7259 }
7260
7261 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7263
7264 std::task::Poll::Ready(Some(match header.ordinal {
7265 0x82f861e0b26a186 => {
7266 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7267 let mut req = fidl::new_empty!(ServiceSubscriptionListenerOnInstanceDiscoveredRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
7268 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriptionListenerOnInstanceDiscoveredRequest>(&header, _body_bytes, handles, &mut req)?;
7269 let control_handle = ServiceSubscriptionListenerControlHandle {
7270 inner: this.inner.clone(),
7271 };
7272 Ok(ServiceSubscriptionListenerRequest::OnInstanceDiscovered {instance: req.instance,
7273
7274 responder: ServiceSubscriptionListenerOnInstanceDiscoveredResponder {
7275 control_handle: std::mem::ManuallyDrop::new(control_handle),
7276 tx_id: header.tx_id,
7277 },
7278 })
7279 }
7280 0x7da325aa758d8929 => {
7281 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7282 let mut req = fidl::new_empty!(ServiceSubscriptionListenerOnInstanceChangedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
7283 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriptionListenerOnInstanceChangedRequest>(&header, _body_bytes, handles, &mut req)?;
7284 let control_handle = ServiceSubscriptionListenerControlHandle {
7285 inner: this.inner.clone(),
7286 };
7287 Ok(ServiceSubscriptionListenerRequest::OnInstanceChanged {instance: req.instance,
7288
7289 responder: ServiceSubscriptionListenerOnInstanceChangedResponder {
7290 control_handle: std::mem::ManuallyDrop::new(control_handle),
7291 tx_id: header.tx_id,
7292 },
7293 })
7294 }
7295 0x2ecb2f1600c5c6dc => {
7296 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7297 let mut req = fidl::new_empty!(ServiceSubscriptionListenerOnInstanceLostRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
7298 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriptionListenerOnInstanceLostRequest>(&header, _body_bytes, handles, &mut req)?;
7299 let control_handle = ServiceSubscriptionListenerControlHandle {
7300 inner: this.inner.clone(),
7301 };
7302 Ok(ServiceSubscriptionListenerRequest::OnInstanceLost {service: req.service,
7303instance: req.instance,
7304
7305 responder: ServiceSubscriptionListenerOnInstanceLostResponder {
7306 control_handle: std::mem::ManuallyDrop::new(control_handle),
7307 tx_id: header.tx_id,
7308 },
7309 })
7310 }
7311 0x4f4eb8e3d10db611 => {
7312 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7313 let mut req = fidl::new_empty!(ServiceSubscriptionListenerOnQueryRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
7314 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServiceSubscriptionListenerOnQueryRequest>(&header, _body_bytes, handles, &mut req)?;
7315 let control_handle = ServiceSubscriptionListenerControlHandle {
7316 inner: this.inner.clone(),
7317 };
7318 Ok(ServiceSubscriptionListenerRequest::OnQuery {resource_type: req.resource_type,
7319
7320 responder: ServiceSubscriptionListenerOnQueryResponder {
7321 control_handle: std::mem::ManuallyDrop::new(control_handle),
7322 tx_id: header.tx_id,
7323 },
7324 })
7325 }
7326 _ => Err(fidl::Error::UnknownOrdinal {
7327 ordinal: header.ordinal,
7328 protocol_name: <ServiceSubscriptionListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7329 }),
7330 }))
7331 },
7332 )
7333 }
7334}
7335
7336#[derive(Debug)]
7340pub enum ServiceSubscriptionListenerRequest {
7341 OnInstanceDiscovered {
7343 instance: ServiceInstance,
7344 responder: ServiceSubscriptionListenerOnInstanceDiscoveredResponder,
7345 },
7346 OnInstanceChanged {
7349 instance: ServiceInstance,
7350 responder: ServiceSubscriptionListenerOnInstanceChangedResponder,
7351 },
7352 OnInstanceLost {
7354 service: String,
7355 instance: String,
7356 responder: ServiceSubscriptionListenerOnInstanceLostResponder,
7357 },
7358 OnQuery { resource_type: ResourceType, responder: ServiceSubscriptionListenerOnQueryResponder },
7360}
7361
7362impl ServiceSubscriptionListenerRequest {
7363 #[allow(irrefutable_let_patterns)]
7364 pub fn into_on_instance_discovered(
7365 self,
7366 ) -> Option<(ServiceInstance, ServiceSubscriptionListenerOnInstanceDiscoveredResponder)> {
7367 if let ServiceSubscriptionListenerRequest::OnInstanceDiscovered { instance, responder } =
7368 self
7369 {
7370 Some((instance, responder))
7371 } else {
7372 None
7373 }
7374 }
7375
7376 #[allow(irrefutable_let_patterns)]
7377 pub fn into_on_instance_changed(
7378 self,
7379 ) -> Option<(ServiceInstance, ServiceSubscriptionListenerOnInstanceChangedResponder)> {
7380 if let ServiceSubscriptionListenerRequest::OnInstanceChanged { instance, responder } = self
7381 {
7382 Some((instance, responder))
7383 } else {
7384 None
7385 }
7386 }
7387
7388 #[allow(irrefutable_let_patterns)]
7389 pub fn into_on_instance_lost(
7390 self,
7391 ) -> Option<(String, String, ServiceSubscriptionListenerOnInstanceLostResponder)> {
7392 if let ServiceSubscriptionListenerRequest::OnInstanceLost { service, instance, responder } =
7393 self
7394 {
7395 Some((service, instance, responder))
7396 } else {
7397 None
7398 }
7399 }
7400
7401 #[allow(irrefutable_let_patterns)]
7402 pub fn into_on_query(
7403 self,
7404 ) -> Option<(ResourceType, ServiceSubscriptionListenerOnQueryResponder)> {
7405 if let ServiceSubscriptionListenerRequest::OnQuery { resource_type, responder } = self {
7406 Some((resource_type, responder))
7407 } else {
7408 None
7409 }
7410 }
7411
7412 pub fn method_name(&self) -> &'static str {
7414 match *self {
7415 ServiceSubscriptionListenerRequest::OnInstanceDiscovered { .. } => {
7416 "on_instance_discovered"
7417 }
7418 ServiceSubscriptionListenerRequest::OnInstanceChanged { .. } => "on_instance_changed",
7419 ServiceSubscriptionListenerRequest::OnInstanceLost { .. } => "on_instance_lost",
7420 ServiceSubscriptionListenerRequest::OnQuery { .. } => "on_query",
7421 }
7422 }
7423}
7424
7425#[derive(Debug, Clone)]
7426pub struct ServiceSubscriptionListenerControlHandle {
7427 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7428}
7429
7430impl fidl::endpoints::ControlHandle for ServiceSubscriptionListenerControlHandle {
7431 fn shutdown(&self) {
7432 self.inner.shutdown()
7433 }
7434 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7435 self.inner.shutdown_with_epitaph(status)
7436 }
7437
7438 fn is_closed(&self) -> bool {
7439 self.inner.channel().is_closed()
7440 }
7441 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7442 self.inner.channel().on_closed()
7443 }
7444
7445 #[cfg(target_os = "fuchsia")]
7446 fn signal_peer(
7447 &self,
7448 clear_mask: zx::Signals,
7449 set_mask: zx::Signals,
7450 ) -> Result<(), zx_status::Status> {
7451 use fidl::Peered;
7452 self.inner.channel().signal_peer(clear_mask, set_mask)
7453 }
7454}
7455
7456impl ServiceSubscriptionListenerControlHandle {}
7457
7458#[must_use = "FIDL methods require a response to be sent"]
7459#[derive(Debug)]
7460pub struct ServiceSubscriptionListenerOnInstanceDiscoveredResponder {
7461 control_handle: std::mem::ManuallyDrop<ServiceSubscriptionListenerControlHandle>,
7462 tx_id: u32,
7463}
7464
7465impl std::ops::Drop for ServiceSubscriptionListenerOnInstanceDiscoveredResponder {
7469 fn drop(&mut self) {
7470 self.control_handle.shutdown();
7471 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7473 }
7474}
7475
7476impl fidl::endpoints::Responder for ServiceSubscriptionListenerOnInstanceDiscoveredResponder {
7477 type ControlHandle = ServiceSubscriptionListenerControlHandle;
7478
7479 fn control_handle(&self) -> &ServiceSubscriptionListenerControlHandle {
7480 &self.control_handle
7481 }
7482
7483 fn drop_without_shutdown(mut self) {
7484 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7486 std::mem::forget(self);
7488 }
7489}
7490
7491impl ServiceSubscriptionListenerOnInstanceDiscoveredResponder {
7492 pub fn send(self) -> Result<(), fidl::Error> {
7496 let _result = self.send_raw();
7497 if _result.is_err() {
7498 self.control_handle.shutdown();
7499 }
7500 self.drop_without_shutdown();
7501 _result
7502 }
7503
7504 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
7506 let _result = self.send_raw();
7507 self.drop_without_shutdown();
7508 _result
7509 }
7510
7511 fn send_raw(&self) -> Result<(), fidl::Error> {
7512 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
7513 (),
7514 self.tx_id,
7515 0x82f861e0b26a186,
7516 fidl::encoding::DynamicFlags::empty(),
7517 )
7518 }
7519}
7520
7521#[must_use = "FIDL methods require a response to be sent"]
7522#[derive(Debug)]
7523pub struct ServiceSubscriptionListenerOnInstanceChangedResponder {
7524 control_handle: std::mem::ManuallyDrop<ServiceSubscriptionListenerControlHandle>,
7525 tx_id: u32,
7526}
7527
7528impl std::ops::Drop for ServiceSubscriptionListenerOnInstanceChangedResponder {
7532 fn drop(&mut self) {
7533 self.control_handle.shutdown();
7534 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7536 }
7537}
7538
7539impl fidl::endpoints::Responder for ServiceSubscriptionListenerOnInstanceChangedResponder {
7540 type ControlHandle = ServiceSubscriptionListenerControlHandle;
7541
7542 fn control_handle(&self) -> &ServiceSubscriptionListenerControlHandle {
7543 &self.control_handle
7544 }
7545
7546 fn drop_without_shutdown(mut self) {
7547 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7549 std::mem::forget(self);
7551 }
7552}
7553
7554impl ServiceSubscriptionListenerOnInstanceChangedResponder {
7555 pub fn send(self) -> Result<(), fidl::Error> {
7559 let _result = self.send_raw();
7560 if _result.is_err() {
7561 self.control_handle.shutdown();
7562 }
7563 self.drop_without_shutdown();
7564 _result
7565 }
7566
7567 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
7569 let _result = self.send_raw();
7570 self.drop_without_shutdown();
7571 _result
7572 }
7573
7574 fn send_raw(&self) -> Result<(), fidl::Error> {
7575 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
7576 (),
7577 self.tx_id,
7578 0x7da325aa758d8929,
7579 fidl::encoding::DynamicFlags::empty(),
7580 )
7581 }
7582}
7583
7584#[must_use = "FIDL methods require a response to be sent"]
7585#[derive(Debug)]
7586pub struct ServiceSubscriptionListenerOnInstanceLostResponder {
7587 control_handle: std::mem::ManuallyDrop<ServiceSubscriptionListenerControlHandle>,
7588 tx_id: u32,
7589}
7590
7591impl std::ops::Drop for ServiceSubscriptionListenerOnInstanceLostResponder {
7595 fn drop(&mut self) {
7596 self.control_handle.shutdown();
7597 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7599 }
7600}
7601
7602impl fidl::endpoints::Responder for ServiceSubscriptionListenerOnInstanceLostResponder {
7603 type ControlHandle = ServiceSubscriptionListenerControlHandle;
7604
7605 fn control_handle(&self) -> &ServiceSubscriptionListenerControlHandle {
7606 &self.control_handle
7607 }
7608
7609 fn drop_without_shutdown(mut self) {
7610 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7612 std::mem::forget(self);
7614 }
7615}
7616
7617impl ServiceSubscriptionListenerOnInstanceLostResponder {
7618 pub fn send(self) -> Result<(), fidl::Error> {
7622 let _result = self.send_raw();
7623 if _result.is_err() {
7624 self.control_handle.shutdown();
7625 }
7626 self.drop_without_shutdown();
7627 _result
7628 }
7629
7630 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
7632 let _result = self.send_raw();
7633 self.drop_without_shutdown();
7634 _result
7635 }
7636
7637 fn send_raw(&self) -> Result<(), fidl::Error> {
7638 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
7639 (),
7640 self.tx_id,
7641 0x2ecb2f1600c5c6dc,
7642 fidl::encoding::DynamicFlags::empty(),
7643 )
7644 }
7645}
7646
7647#[must_use = "FIDL methods require a response to be sent"]
7648#[derive(Debug)]
7649pub struct ServiceSubscriptionListenerOnQueryResponder {
7650 control_handle: std::mem::ManuallyDrop<ServiceSubscriptionListenerControlHandle>,
7651 tx_id: u32,
7652}
7653
7654impl std::ops::Drop for ServiceSubscriptionListenerOnQueryResponder {
7658 fn drop(&mut self) {
7659 self.control_handle.shutdown();
7660 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7662 }
7663}
7664
7665impl fidl::endpoints::Responder for ServiceSubscriptionListenerOnQueryResponder {
7666 type ControlHandle = ServiceSubscriptionListenerControlHandle;
7667
7668 fn control_handle(&self) -> &ServiceSubscriptionListenerControlHandle {
7669 &self.control_handle
7670 }
7671
7672 fn drop_without_shutdown(mut self) {
7673 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7675 std::mem::forget(self);
7677 }
7678}
7679
7680impl ServiceSubscriptionListenerOnQueryResponder {
7681 pub fn send(self) -> Result<(), fidl::Error> {
7685 let _result = self.send_raw();
7686 if _result.is_err() {
7687 self.control_handle.shutdown();
7688 }
7689 self.drop_without_shutdown();
7690 _result
7691 }
7692
7693 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
7695 let _result = self.send_raw();
7696 self.drop_without_shutdown();
7697 _result
7698 }
7699
7700 fn send_raw(&self) -> Result<(), fidl::Error> {
7701 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
7702 (),
7703 self.tx_id,
7704 0x4f4eb8e3d10db611,
7705 fidl::encoding::DynamicFlags::empty(),
7706 )
7707 }
7708}
7709
7710#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7711pub struct SubscriberMarker;
7712
7713impl fidl::endpoints::ProtocolMarker for SubscriberMarker {
7714 type Proxy = SubscriberProxy;
7715 type RequestStream = SubscriberRequestStream;
7716 #[cfg(target_os = "fuchsia")]
7717 type SynchronousProxy = SubscriberSynchronousProxy;
7718
7719 const DEBUG_NAME: &'static str = "fuchsia.net.mdns.Subscriber";
7720}
7721impl fidl::endpoints::DiscoverableProtocolMarker for SubscriberMarker {}
7722
7723pub trait SubscriberProxyInterface: Send + Sync {
7724 fn r#subscribe_to_service(
7725 &self,
7726 service: &str,
7727 subscriber: fidl::endpoints::ClientEnd<ServiceSubscriberMarker>,
7728 ) -> Result<(), fidl::Error>;
7729}
7730#[derive(Debug)]
7731#[cfg(target_os = "fuchsia")]
7732pub struct SubscriberSynchronousProxy {
7733 client: fidl::client::sync::Client,
7734}
7735
7736#[cfg(target_os = "fuchsia")]
7737impl fidl::endpoints::SynchronousProxy for SubscriberSynchronousProxy {
7738 type Proxy = SubscriberProxy;
7739 type Protocol = SubscriberMarker;
7740
7741 fn from_channel(inner: fidl::Channel) -> Self {
7742 Self::new(inner)
7743 }
7744
7745 fn into_channel(self) -> fidl::Channel {
7746 self.client.into_channel()
7747 }
7748
7749 fn as_channel(&self) -> &fidl::Channel {
7750 self.client.as_channel()
7751 }
7752}
7753
7754#[cfg(target_os = "fuchsia")]
7755impl SubscriberSynchronousProxy {
7756 pub fn new(channel: fidl::Channel) -> Self {
7757 let protocol_name = <SubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7758 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7759 }
7760
7761 pub fn into_channel(self) -> fidl::Channel {
7762 self.client.into_channel()
7763 }
7764
7765 pub fn wait_for_event(
7768 &self,
7769 deadline: zx::MonotonicInstant,
7770 ) -> Result<SubscriberEvent, fidl::Error> {
7771 SubscriberEvent::decode(self.client.wait_for_event(deadline)?)
7772 }
7773
7774 pub fn r#subscribe_to_service(
7777 &self,
7778 mut service: &str,
7779 mut subscriber: fidl::endpoints::ClientEnd<ServiceSubscriberMarker>,
7780 ) -> Result<(), fidl::Error> {
7781 self.client.send::<SubscriberSubscribeToServiceRequest>(
7782 (service, subscriber),
7783 0x3a1a3b02c1809e3f,
7784 fidl::encoding::DynamicFlags::empty(),
7785 )
7786 }
7787}
7788
7789#[cfg(target_os = "fuchsia")]
7790impl From<SubscriberSynchronousProxy> for zx::Handle {
7791 fn from(value: SubscriberSynchronousProxy) -> Self {
7792 value.into_channel().into()
7793 }
7794}
7795
7796#[cfg(target_os = "fuchsia")]
7797impl From<fidl::Channel> for SubscriberSynchronousProxy {
7798 fn from(value: fidl::Channel) -> Self {
7799 Self::new(value)
7800 }
7801}
7802
7803#[cfg(target_os = "fuchsia")]
7804impl fidl::endpoints::FromClient for SubscriberSynchronousProxy {
7805 type Protocol = SubscriberMarker;
7806
7807 fn from_client(value: fidl::endpoints::ClientEnd<SubscriberMarker>) -> Self {
7808 Self::new(value.into_channel())
7809 }
7810}
7811
7812#[derive(Debug, Clone)]
7813pub struct SubscriberProxy {
7814 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7815}
7816
7817impl fidl::endpoints::Proxy for SubscriberProxy {
7818 type Protocol = SubscriberMarker;
7819
7820 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7821 Self::new(inner)
7822 }
7823
7824 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7825 self.client.into_channel().map_err(|client| Self { client })
7826 }
7827
7828 fn as_channel(&self) -> &::fidl::AsyncChannel {
7829 self.client.as_channel()
7830 }
7831}
7832
7833impl SubscriberProxy {
7834 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7836 let protocol_name = <SubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7837 Self { client: fidl::client::Client::new(channel, protocol_name) }
7838 }
7839
7840 pub fn take_event_stream(&self) -> SubscriberEventStream {
7846 SubscriberEventStream { event_receiver: self.client.take_event_receiver() }
7847 }
7848
7849 pub fn r#subscribe_to_service(
7852 &self,
7853 mut service: &str,
7854 mut subscriber: fidl::endpoints::ClientEnd<ServiceSubscriberMarker>,
7855 ) -> Result<(), fidl::Error> {
7856 SubscriberProxyInterface::r#subscribe_to_service(self, service, subscriber)
7857 }
7858}
7859
7860impl SubscriberProxyInterface for SubscriberProxy {
7861 fn r#subscribe_to_service(
7862 &self,
7863 mut service: &str,
7864 mut subscriber: fidl::endpoints::ClientEnd<ServiceSubscriberMarker>,
7865 ) -> Result<(), fidl::Error> {
7866 self.client.send::<SubscriberSubscribeToServiceRequest>(
7867 (service, subscriber),
7868 0x3a1a3b02c1809e3f,
7869 fidl::encoding::DynamicFlags::empty(),
7870 )
7871 }
7872}
7873
7874pub struct SubscriberEventStream {
7875 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7876}
7877
7878impl std::marker::Unpin for SubscriberEventStream {}
7879
7880impl futures::stream::FusedStream for SubscriberEventStream {
7881 fn is_terminated(&self) -> bool {
7882 self.event_receiver.is_terminated()
7883 }
7884}
7885
7886impl futures::Stream for SubscriberEventStream {
7887 type Item = Result<SubscriberEvent, fidl::Error>;
7888
7889 fn poll_next(
7890 mut self: std::pin::Pin<&mut Self>,
7891 cx: &mut std::task::Context<'_>,
7892 ) -> std::task::Poll<Option<Self::Item>> {
7893 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7894 &mut self.event_receiver,
7895 cx
7896 )?) {
7897 Some(buf) => std::task::Poll::Ready(Some(SubscriberEvent::decode(buf))),
7898 None => std::task::Poll::Ready(None),
7899 }
7900 }
7901}
7902
7903#[derive(Debug)]
7904pub enum SubscriberEvent {}
7905
7906impl SubscriberEvent {
7907 fn decode(
7909 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7910 ) -> Result<SubscriberEvent, fidl::Error> {
7911 let (bytes, _handles) = buf.split_mut();
7912 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7913 debug_assert_eq!(tx_header.tx_id, 0);
7914 match tx_header.ordinal {
7915 _ => Err(fidl::Error::UnknownOrdinal {
7916 ordinal: tx_header.ordinal,
7917 protocol_name: <SubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7918 }),
7919 }
7920 }
7921}
7922
7923pub struct SubscriberRequestStream {
7925 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7926 is_terminated: bool,
7927}
7928
7929impl std::marker::Unpin for SubscriberRequestStream {}
7930
7931impl futures::stream::FusedStream for SubscriberRequestStream {
7932 fn is_terminated(&self) -> bool {
7933 self.is_terminated
7934 }
7935}
7936
7937impl fidl::endpoints::RequestStream for SubscriberRequestStream {
7938 type Protocol = SubscriberMarker;
7939 type ControlHandle = SubscriberControlHandle;
7940
7941 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7942 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7943 }
7944
7945 fn control_handle(&self) -> Self::ControlHandle {
7946 SubscriberControlHandle { inner: self.inner.clone() }
7947 }
7948
7949 fn into_inner(
7950 self,
7951 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7952 {
7953 (self.inner, self.is_terminated)
7954 }
7955
7956 fn from_inner(
7957 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7958 is_terminated: bool,
7959 ) -> Self {
7960 Self { inner, is_terminated }
7961 }
7962}
7963
7964impl futures::Stream for SubscriberRequestStream {
7965 type Item = Result<SubscriberRequest, fidl::Error>;
7966
7967 fn poll_next(
7968 mut self: std::pin::Pin<&mut Self>,
7969 cx: &mut std::task::Context<'_>,
7970 ) -> std::task::Poll<Option<Self::Item>> {
7971 let this = &mut *self;
7972 if this.inner.check_shutdown(cx) {
7973 this.is_terminated = true;
7974 return std::task::Poll::Ready(None);
7975 }
7976 if this.is_terminated {
7977 panic!("polled SubscriberRequestStream after completion");
7978 }
7979 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7980 |bytes, handles| {
7981 match this.inner.channel().read_etc(cx, bytes, handles) {
7982 std::task::Poll::Ready(Ok(())) => {}
7983 std::task::Poll::Pending => return std::task::Poll::Pending,
7984 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7985 this.is_terminated = true;
7986 return std::task::Poll::Ready(None);
7987 }
7988 std::task::Poll::Ready(Err(e)) => {
7989 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7990 e.into(),
7991 ))));
7992 }
7993 }
7994
7995 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7997
7998 std::task::Poll::Ready(Some(match header.ordinal {
7999 0x3a1a3b02c1809e3f => {
8000 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8001 let mut req = fidl::new_empty!(
8002 SubscriberSubscribeToServiceRequest,
8003 fidl::encoding::DefaultFuchsiaResourceDialect
8004 );
8005 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SubscriberSubscribeToServiceRequest>(&header, _body_bytes, handles, &mut req)?;
8006 let control_handle = SubscriberControlHandle { inner: this.inner.clone() };
8007 Ok(SubscriberRequest::SubscribeToService {
8008 service: req.service,
8009 subscriber: req.subscriber,
8010
8011 control_handle,
8012 })
8013 }
8014 _ => Err(fidl::Error::UnknownOrdinal {
8015 ordinal: header.ordinal,
8016 protocol_name:
8017 <SubscriberMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8018 }),
8019 }))
8020 },
8021 )
8022 }
8023}
8024
8025#[derive(Debug)]
8028pub enum SubscriberRequest {
8029 SubscribeToService {
8032 service: String,
8033 subscriber: fidl::endpoints::ClientEnd<ServiceSubscriberMarker>,
8034 control_handle: SubscriberControlHandle,
8035 },
8036}
8037
8038impl SubscriberRequest {
8039 #[allow(irrefutable_let_patterns)]
8040 pub fn into_subscribe_to_service(
8041 self,
8042 ) -> Option<(
8043 String,
8044 fidl::endpoints::ClientEnd<ServiceSubscriberMarker>,
8045 SubscriberControlHandle,
8046 )> {
8047 if let SubscriberRequest::SubscribeToService { service, subscriber, control_handle } = self
8048 {
8049 Some((service, subscriber, control_handle))
8050 } else {
8051 None
8052 }
8053 }
8054
8055 pub fn method_name(&self) -> &'static str {
8057 match *self {
8058 SubscriberRequest::SubscribeToService { .. } => "subscribe_to_service",
8059 }
8060 }
8061}
8062
8063#[derive(Debug, Clone)]
8064pub struct SubscriberControlHandle {
8065 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8066}
8067
8068impl fidl::endpoints::ControlHandle for SubscriberControlHandle {
8069 fn shutdown(&self) {
8070 self.inner.shutdown()
8071 }
8072 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8073 self.inner.shutdown_with_epitaph(status)
8074 }
8075
8076 fn is_closed(&self) -> bool {
8077 self.inner.channel().is_closed()
8078 }
8079 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8080 self.inner.channel().on_closed()
8081 }
8082
8083 #[cfg(target_os = "fuchsia")]
8084 fn signal_peer(
8085 &self,
8086 clear_mask: zx::Signals,
8087 set_mask: zx::Signals,
8088 ) -> Result<(), zx_status::Status> {
8089 use fidl::Peered;
8090 self.inner.channel().signal_peer(clear_mask, set_mask)
8091 }
8092}
8093
8094impl SubscriberControlHandle {}
8095
8096mod internal {
8097 use super::*;
8098
8099 impl fidl::encoding::ResourceTypeMarker for HostNameSubscriberSubscribeToHostNameRequest {
8100 type Borrowed<'a> = &'a mut Self;
8101 fn take_or_borrow<'a>(
8102 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8103 ) -> Self::Borrowed<'a> {
8104 value
8105 }
8106 }
8107
8108 unsafe impl fidl::encoding::TypeMarker for HostNameSubscriberSubscribeToHostNameRequest {
8109 type Owned = Self;
8110
8111 #[inline(always)]
8112 fn inline_align(_context: fidl::encoding::Context) -> usize {
8113 8
8114 }
8115
8116 #[inline(always)]
8117 fn inline_size(_context: fidl::encoding::Context) -> usize {
8118 40
8119 }
8120 }
8121
8122 unsafe impl
8123 fidl::encoding::Encode<
8124 HostNameSubscriberSubscribeToHostNameRequest,
8125 fidl::encoding::DefaultFuchsiaResourceDialect,
8126 > for &mut HostNameSubscriberSubscribeToHostNameRequest
8127 {
8128 #[inline]
8129 unsafe fn encode(
8130 self,
8131 encoder: &mut fidl::encoding::Encoder<
8132 '_,
8133 fidl::encoding::DefaultFuchsiaResourceDialect,
8134 >,
8135 offset: usize,
8136 _depth: fidl::encoding::Depth,
8137 ) -> fidl::Result<()> {
8138 encoder.debug_check_bounds::<HostNameSubscriberSubscribeToHostNameRequest>(offset);
8139 fidl::encoding::Encode::<
8141 HostNameSubscriberSubscribeToHostNameRequest,
8142 fidl::encoding::DefaultFuchsiaResourceDialect,
8143 >::encode(
8144 (
8145 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
8146 &self.host,
8147 ),
8148 <HostNameSubscriptionOptions as fidl::encoding::ValueTypeMarker>::borrow(
8149 &self.options,
8150 ),
8151 <fidl::encoding::Endpoint<
8152 fidl::endpoints::ClientEnd<HostNameSubscriptionListenerMarker>,
8153 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8154 &mut self.listener
8155 ),
8156 ),
8157 encoder,
8158 offset,
8159 _depth,
8160 )
8161 }
8162 }
8163 unsafe impl<
8164 T0: fidl::encoding::Encode<
8165 fidl::encoding::BoundedString<255>,
8166 fidl::encoding::DefaultFuchsiaResourceDialect,
8167 >,
8168 T1: fidl::encoding::Encode<
8169 HostNameSubscriptionOptions,
8170 fidl::encoding::DefaultFuchsiaResourceDialect,
8171 >,
8172 T2: fidl::encoding::Encode<
8173 fidl::encoding::Endpoint<
8174 fidl::endpoints::ClientEnd<HostNameSubscriptionListenerMarker>,
8175 >,
8176 fidl::encoding::DefaultFuchsiaResourceDialect,
8177 >,
8178 >
8179 fidl::encoding::Encode<
8180 HostNameSubscriberSubscribeToHostNameRequest,
8181 fidl::encoding::DefaultFuchsiaResourceDialect,
8182 > for (T0, T1, T2)
8183 {
8184 #[inline]
8185 unsafe fn encode(
8186 self,
8187 encoder: &mut fidl::encoding::Encoder<
8188 '_,
8189 fidl::encoding::DefaultFuchsiaResourceDialect,
8190 >,
8191 offset: usize,
8192 depth: fidl::encoding::Depth,
8193 ) -> fidl::Result<()> {
8194 encoder.debug_check_bounds::<HostNameSubscriberSubscribeToHostNameRequest>(offset);
8195 unsafe {
8198 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
8199 (ptr as *mut u64).write_unaligned(0);
8200 }
8201 self.0.encode(encoder, offset + 0, depth)?;
8203 self.1.encode(encoder, offset + 16, depth)?;
8204 self.2.encode(encoder, offset + 32, depth)?;
8205 Ok(())
8206 }
8207 }
8208
8209 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8210 for HostNameSubscriberSubscribeToHostNameRequest
8211 {
8212 #[inline(always)]
8213 fn new_empty() -> Self {
8214 Self {
8215 host: fidl::new_empty!(
8216 fidl::encoding::BoundedString<255>,
8217 fidl::encoding::DefaultFuchsiaResourceDialect
8218 ),
8219 options: fidl::new_empty!(
8220 HostNameSubscriptionOptions,
8221 fidl::encoding::DefaultFuchsiaResourceDialect
8222 ),
8223 listener: fidl::new_empty!(
8224 fidl::encoding::Endpoint<
8225 fidl::endpoints::ClientEnd<HostNameSubscriptionListenerMarker>,
8226 >,
8227 fidl::encoding::DefaultFuchsiaResourceDialect
8228 ),
8229 }
8230 }
8231
8232 #[inline]
8233 unsafe fn decode(
8234 &mut self,
8235 decoder: &mut fidl::encoding::Decoder<
8236 '_,
8237 fidl::encoding::DefaultFuchsiaResourceDialect,
8238 >,
8239 offset: usize,
8240 _depth: fidl::encoding::Depth,
8241 ) -> fidl::Result<()> {
8242 decoder.debug_check_bounds::<Self>(offset);
8243 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
8245 let padval = unsafe { (ptr as *const u64).read_unaligned() };
8246 let mask = 0xffffffff00000000u64;
8247 let maskedval = padval & mask;
8248 if maskedval != 0 {
8249 return Err(fidl::Error::NonZeroPadding {
8250 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
8251 });
8252 }
8253 fidl::decode!(
8254 fidl::encoding::BoundedString<255>,
8255 fidl::encoding::DefaultFuchsiaResourceDialect,
8256 &mut self.host,
8257 decoder,
8258 offset + 0,
8259 _depth
8260 )?;
8261 fidl::decode!(
8262 HostNameSubscriptionOptions,
8263 fidl::encoding::DefaultFuchsiaResourceDialect,
8264 &mut self.options,
8265 decoder,
8266 offset + 16,
8267 _depth
8268 )?;
8269 fidl::decode!(
8270 fidl::encoding::Endpoint<
8271 fidl::endpoints::ClientEnd<HostNameSubscriptionListenerMarker>,
8272 >,
8273 fidl::encoding::DefaultFuchsiaResourceDialect,
8274 &mut self.listener,
8275 decoder,
8276 offset + 32,
8277 _depth
8278 )?;
8279 Ok(())
8280 }
8281 }
8282
8283 impl fidl::encoding::ResourceTypeMarker for ProxyHostPublisherPublishProxyHostRequest {
8284 type Borrowed<'a> = &'a mut Self;
8285 fn take_or_borrow<'a>(
8286 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8287 ) -> Self::Borrowed<'a> {
8288 value
8289 }
8290 }
8291
8292 unsafe impl fidl::encoding::TypeMarker for ProxyHostPublisherPublishProxyHostRequest {
8293 type Owned = Self;
8294
8295 #[inline(always)]
8296 fn inline_align(_context: fidl::encoding::Context) -> usize {
8297 8
8298 }
8299
8300 #[inline(always)]
8301 fn inline_size(_context: fidl::encoding::Context) -> usize {
8302 56
8303 }
8304 }
8305
8306 unsafe impl
8307 fidl::encoding::Encode<
8308 ProxyHostPublisherPublishProxyHostRequest,
8309 fidl::encoding::DefaultFuchsiaResourceDialect,
8310 > for &mut ProxyHostPublisherPublishProxyHostRequest
8311 {
8312 #[inline]
8313 unsafe fn encode(
8314 self,
8315 encoder: &mut fidl::encoding::Encoder<
8316 '_,
8317 fidl::encoding::DefaultFuchsiaResourceDialect,
8318 >,
8319 offset: usize,
8320 _depth: fidl::encoding::Depth,
8321 ) -> fidl::Result<()> {
8322 encoder.debug_check_bounds::<ProxyHostPublisherPublishProxyHostRequest>(offset);
8323 fidl::encoding::Encode::<ProxyHostPublisherPublishProxyHostRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8325 (
8326 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.host),
8327 <fidl::encoding::Vector<fidl_fuchsia_net::IpAddress, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
8328 <ProxyHostPublicationOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
8329 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ServiceInstancePublisherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.service_instance_publisher),
8330 ),
8331 encoder, offset, _depth
8332 )
8333 }
8334 }
8335 unsafe impl<
8336 T0: fidl::encoding::Encode<
8337 fidl::encoding::BoundedString<255>,
8338 fidl::encoding::DefaultFuchsiaResourceDialect,
8339 >,
8340 T1: fidl::encoding::Encode<
8341 fidl::encoding::Vector<fidl_fuchsia_net::IpAddress, 64>,
8342 fidl::encoding::DefaultFuchsiaResourceDialect,
8343 >,
8344 T2: fidl::encoding::Encode<
8345 ProxyHostPublicationOptions,
8346 fidl::encoding::DefaultFuchsiaResourceDialect,
8347 >,
8348 T3: fidl::encoding::Encode<
8349 fidl::encoding::Endpoint<
8350 fidl::endpoints::ServerEnd<ServiceInstancePublisherMarker>,
8351 >,
8352 fidl::encoding::DefaultFuchsiaResourceDialect,
8353 >,
8354 >
8355 fidl::encoding::Encode<
8356 ProxyHostPublisherPublishProxyHostRequest,
8357 fidl::encoding::DefaultFuchsiaResourceDialect,
8358 > for (T0, T1, T2, T3)
8359 {
8360 #[inline]
8361 unsafe fn encode(
8362 self,
8363 encoder: &mut fidl::encoding::Encoder<
8364 '_,
8365 fidl::encoding::DefaultFuchsiaResourceDialect,
8366 >,
8367 offset: usize,
8368 depth: fidl::encoding::Depth,
8369 ) -> fidl::Result<()> {
8370 encoder.debug_check_bounds::<ProxyHostPublisherPublishProxyHostRequest>(offset);
8371 unsafe {
8374 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
8375 (ptr as *mut u64).write_unaligned(0);
8376 }
8377 self.0.encode(encoder, offset + 0, depth)?;
8379 self.1.encode(encoder, offset + 16, depth)?;
8380 self.2.encode(encoder, offset + 32, depth)?;
8381 self.3.encode(encoder, offset + 48, depth)?;
8382 Ok(())
8383 }
8384 }
8385
8386 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8387 for ProxyHostPublisherPublishProxyHostRequest
8388 {
8389 #[inline(always)]
8390 fn new_empty() -> Self {
8391 Self {
8392 host: fidl::new_empty!(
8393 fidl::encoding::BoundedString<255>,
8394 fidl::encoding::DefaultFuchsiaResourceDialect
8395 ),
8396 addresses: fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_net::IpAddress, 64>, fidl::encoding::DefaultFuchsiaResourceDialect),
8397 options: fidl::new_empty!(
8398 ProxyHostPublicationOptions,
8399 fidl::encoding::DefaultFuchsiaResourceDialect
8400 ),
8401 service_instance_publisher: fidl::new_empty!(
8402 fidl::encoding::Endpoint<
8403 fidl::endpoints::ServerEnd<ServiceInstancePublisherMarker>,
8404 >,
8405 fidl::encoding::DefaultFuchsiaResourceDialect
8406 ),
8407 }
8408 }
8409
8410 #[inline]
8411 unsafe fn decode(
8412 &mut self,
8413 decoder: &mut fidl::encoding::Decoder<
8414 '_,
8415 fidl::encoding::DefaultFuchsiaResourceDialect,
8416 >,
8417 offset: usize,
8418 _depth: fidl::encoding::Depth,
8419 ) -> fidl::Result<()> {
8420 decoder.debug_check_bounds::<Self>(offset);
8421 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
8423 let padval = unsafe { (ptr as *const u64).read_unaligned() };
8424 let mask = 0xffffffff00000000u64;
8425 let maskedval = padval & mask;
8426 if maskedval != 0 {
8427 return Err(fidl::Error::NonZeroPadding {
8428 padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
8429 });
8430 }
8431 fidl::decode!(
8432 fidl::encoding::BoundedString<255>,
8433 fidl::encoding::DefaultFuchsiaResourceDialect,
8434 &mut self.host,
8435 decoder,
8436 offset + 0,
8437 _depth
8438 )?;
8439 fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_net::IpAddress, 64>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.addresses, decoder, offset + 16, _depth)?;
8440 fidl::decode!(
8441 ProxyHostPublicationOptions,
8442 fidl::encoding::DefaultFuchsiaResourceDialect,
8443 &mut self.options,
8444 decoder,
8445 offset + 32,
8446 _depth
8447 )?;
8448 fidl::decode!(
8449 fidl::encoding::Endpoint<
8450 fidl::endpoints::ServerEnd<ServiceInstancePublisherMarker>,
8451 >,
8452 fidl::encoding::DefaultFuchsiaResourceDialect,
8453 &mut self.service_instance_publisher,
8454 decoder,
8455 offset + 48,
8456 _depth
8457 )?;
8458 Ok(())
8459 }
8460 }
8461
8462 impl fidl::encoding::ResourceTypeMarker for PublisherPublishServiceInstanceRequest {
8463 type Borrowed<'a> = &'a mut Self;
8464 fn take_or_borrow<'a>(
8465 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8466 ) -> Self::Borrowed<'a> {
8467 value
8468 }
8469 }
8470
8471 unsafe impl fidl::encoding::TypeMarker for PublisherPublishServiceInstanceRequest {
8472 type Owned = Self;
8473
8474 #[inline(always)]
8475 fn inline_align(_context: fidl::encoding::Context) -> usize {
8476 8
8477 }
8478
8479 #[inline(always)]
8480 fn inline_size(_context: fidl::encoding::Context) -> usize {
8481 48
8482 }
8483 }
8484
8485 unsafe impl
8486 fidl::encoding::Encode<
8487 PublisherPublishServiceInstanceRequest,
8488 fidl::encoding::DefaultFuchsiaResourceDialect,
8489 > for &mut PublisherPublishServiceInstanceRequest
8490 {
8491 #[inline]
8492 unsafe fn encode(
8493 self,
8494 encoder: &mut fidl::encoding::Encoder<
8495 '_,
8496 fidl::encoding::DefaultFuchsiaResourceDialect,
8497 >,
8498 offset: usize,
8499 _depth: fidl::encoding::Depth,
8500 ) -> fidl::Result<()> {
8501 encoder.debug_check_bounds::<PublisherPublishServiceInstanceRequest>(offset);
8502 fidl::encoding::Encode::<
8504 PublisherPublishServiceInstanceRequest,
8505 fidl::encoding::DefaultFuchsiaResourceDialect,
8506 >::encode(
8507 (
8508 <fidl::encoding::BoundedString<22> as fidl::encoding::ValueTypeMarker>::borrow(
8509 &self.service,
8510 ),
8511 <fidl::encoding::BoundedString<63> as fidl::encoding::ValueTypeMarker>::borrow(
8512 &self.instance,
8513 ),
8514 <Media as fidl::encoding::ValueTypeMarker>::borrow(&self.media),
8515 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.perform_probe),
8516 <fidl::encoding::Endpoint<
8517 fidl::endpoints::ClientEnd<PublicationResponder_Marker>,
8518 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8519 &mut self.publication_responder,
8520 ),
8521 ),
8522 encoder,
8523 offset,
8524 _depth,
8525 )
8526 }
8527 }
8528 unsafe impl<
8529 T0: fidl::encoding::Encode<
8530 fidl::encoding::BoundedString<22>,
8531 fidl::encoding::DefaultFuchsiaResourceDialect,
8532 >,
8533 T1: fidl::encoding::Encode<
8534 fidl::encoding::BoundedString<63>,
8535 fidl::encoding::DefaultFuchsiaResourceDialect,
8536 >,
8537 T2: fidl::encoding::Encode<Media, fidl::encoding::DefaultFuchsiaResourceDialect>,
8538 T3: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>,
8539 T4: fidl::encoding::Encode<
8540 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PublicationResponder_Marker>>,
8541 fidl::encoding::DefaultFuchsiaResourceDialect,
8542 >,
8543 >
8544 fidl::encoding::Encode<
8545 PublisherPublishServiceInstanceRequest,
8546 fidl::encoding::DefaultFuchsiaResourceDialect,
8547 > for (T0, T1, T2, T3, T4)
8548 {
8549 #[inline]
8550 unsafe fn encode(
8551 self,
8552 encoder: &mut fidl::encoding::Encoder<
8553 '_,
8554 fidl::encoding::DefaultFuchsiaResourceDialect,
8555 >,
8556 offset: usize,
8557 depth: fidl::encoding::Depth,
8558 ) -> fidl::Result<()> {
8559 encoder.debug_check_bounds::<PublisherPublishServiceInstanceRequest>(offset);
8560 unsafe {
8563 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
8564 (ptr as *mut u64).write_unaligned(0);
8565 }
8566 unsafe {
8567 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
8568 (ptr as *mut u64).write_unaligned(0);
8569 }
8570 self.0.encode(encoder, offset + 0, depth)?;
8572 self.1.encode(encoder, offset + 16, depth)?;
8573 self.2.encode(encoder, offset + 32, depth)?;
8574 self.3.encode(encoder, offset + 36, depth)?;
8575 self.4.encode(encoder, offset + 40, depth)?;
8576 Ok(())
8577 }
8578 }
8579
8580 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8581 for PublisherPublishServiceInstanceRequest
8582 {
8583 #[inline(always)]
8584 fn new_empty() -> Self {
8585 Self {
8586 service: fidl::new_empty!(
8587 fidl::encoding::BoundedString<22>,
8588 fidl::encoding::DefaultFuchsiaResourceDialect
8589 ),
8590 instance: fidl::new_empty!(
8591 fidl::encoding::BoundedString<63>,
8592 fidl::encoding::DefaultFuchsiaResourceDialect
8593 ),
8594 media: fidl::new_empty!(Media, fidl::encoding::DefaultFuchsiaResourceDialect),
8595 perform_probe: fidl::new_empty!(
8596 bool,
8597 fidl::encoding::DefaultFuchsiaResourceDialect
8598 ),
8599 publication_responder: fidl::new_empty!(
8600 fidl::encoding::Endpoint<
8601 fidl::endpoints::ClientEnd<PublicationResponder_Marker>,
8602 >,
8603 fidl::encoding::DefaultFuchsiaResourceDialect
8604 ),
8605 }
8606 }
8607
8608 #[inline]
8609 unsafe fn decode(
8610 &mut self,
8611 decoder: &mut fidl::encoding::Decoder<
8612 '_,
8613 fidl::encoding::DefaultFuchsiaResourceDialect,
8614 >,
8615 offset: usize,
8616 _depth: fidl::encoding::Depth,
8617 ) -> fidl::Result<()> {
8618 decoder.debug_check_bounds::<Self>(offset);
8619 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
8621 let padval = unsafe { (ptr as *const u64).read_unaligned() };
8622 let mask = 0xffffff0000000000u64;
8623 let maskedval = padval & mask;
8624 if maskedval != 0 {
8625 return Err(fidl::Error::NonZeroPadding {
8626 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
8627 });
8628 }
8629 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
8630 let padval = unsafe { (ptr as *const u64).read_unaligned() };
8631 let mask = 0xffffffff00000000u64;
8632 let maskedval = padval & mask;
8633 if maskedval != 0 {
8634 return Err(fidl::Error::NonZeroPadding {
8635 padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
8636 });
8637 }
8638 fidl::decode!(
8639 fidl::encoding::BoundedString<22>,
8640 fidl::encoding::DefaultFuchsiaResourceDialect,
8641 &mut self.service,
8642 decoder,
8643 offset + 0,
8644 _depth
8645 )?;
8646 fidl::decode!(
8647 fidl::encoding::BoundedString<63>,
8648 fidl::encoding::DefaultFuchsiaResourceDialect,
8649 &mut self.instance,
8650 decoder,
8651 offset + 16,
8652 _depth
8653 )?;
8654 fidl::decode!(
8655 Media,
8656 fidl::encoding::DefaultFuchsiaResourceDialect,
8657 &mut self.media,
8658 decoder,
8659 offset + 32,
8660 _depth
8661 )?;
8662 fidl::decode!(
8663 bool,
8664 fidl::encoding::DefaultFuchsiaResourceDialect,
8665 &mut self.perform_probe,
8666 decoder,
8667 offset + 36,
8668 _depth
8669 )?;
8670 fidl::decode!(
8671 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<PublicationResponder_Marker>>,
8672 fidl::encoding::DefaultFuchsiaResourceDialect,
8673 &mut self.publication_responder,
8674 decoder,
8675 offset + 40,
8676 _depth
8677 )?;
8678 Ok(())
8679 }
8680 }
8681
8682 impl fidl::encoding::ResourceTypeMarker for ServiceInstancePublisherPublishServiceInstanceRequest {
8683 type Borrowed<'a> = &'a mut Self;
8684 fn take_or_borrow<'a>(
8685 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8686 ) -> Self::Borrowed<'a> {
8687 value
8688 }
8689 }
8690
8691 unsafe impl fidl::encoding::TypeMarker for ServiceInstancePublisherPublishServiceInstanceRequest {
8692 type Owned = Self;
8693
8694 #[inline(always)]
8695 fn inline_align(_context: fidl::encoding::Context) -> usize {
8696 8
8697 }
8698
8699 #[inline(always)]
8700 fn inline_size(_context: fidl::encoding::Context) -> usize {
8701 56
8702 }
8703 }
8704
8705 unsafe impl
8706 fidl::encoding::Encode<
8707 ServiceInstancePublisherPublishServiceInstanceRequest,
8708 fidl::encoding::DefaultFuchsiaResourceDialect,
8709 > for &mut ServiceInstancePublisherPublishServiceInstanceRequest
8710 {
8711 #[inline]
8712 unsafe fn encode(
8713 self,
8714 encoder: &mut fidl::encoding::Encoder<
8715 '_,
8716 fidl::encoding::DefaultFuchsiaResourceDialect,
8717 >,
8718 offset: usize,
8719 _depth: fidl::encoding::Depth,
8720 ) -> fidl::Result<()> {
8721 encoder.debug_check_bounds::<ServiceInstancePublisherPublishServiceInstanceRequest>(
8722 offset,
8723 );
8724 fidl::encoding::Encode::<
8726 ServiceInstancePublisherPublishServiceInstanceRequest,
8727 fidl::encoding::DefaultFuchsiaResourceDialect,
8728 >::encode(
8729 (
8730 <fidl::encoding::BoundedString<22> as fidl::encoding::ValueTypeMarker>::borrow(
8731 &self.service,
8732 ),
8733 <fidl::encoding::BoundedString<63> as fidl::encoding::ValueTypeMarker>::borrow(
8734 &self.instance,
8735 ),
8736 <ServiceInstancePublicationOptions as fidl::encoding::ValueTypeMarker>::borrow(
8737 &self.options,
8738 ),
8739 <fidl::encoding::Endpoint<
8740 fidl::endpoints::ClientEnd<ServiceInstancePublicationResponder_Marker>,
8741 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8742 &mut self.publication_responder,
8743 ),
8744 ),
8745 encoder,
8746 offset,
8747 _depth,
8748 )
8749 }
8750 }
8751 unsafe impl<
8752 T0: fidl::encoding::Encode<
8753 fidl::encoding::BoundedString<22>,
8754 fidl::encoding::DefaultFuchsiaResourceDialect,
8755 >,
8756 T1: fidl::encoding::Encode<
8757 fidl::encoding::BoundedString<63>,
8758 fidl::encoding::DefaultFuchsiaResourceDialect,
8759 >,
8760 T2: fidl::encoding::Encode<
8761 ServiceInstancePublicationOptions,
8762 fidl::encoding::DefaultFuchsiaResourceDialect,
8763 >,
8764 T3: fidl::encoding::Encode<
8765 fidl::encoding::Endpoint<
8766 fidl::endpoints::ClientEnd<ServiceInstancePublicationResponder_Marker>,
8767 >,
8768 fidl::encoding::DefaultFuchsiaResourceDialect,
8769 >,
8770 >
8771 fidl::encoding::Encode<
8772 ServiceInstancePublisherPublishServiceInstanceRequest,
8773 fidl::encoding::DefaultFuchsiaResourceDialect,
8774 > for (T0, T1, T2, T3)
8775 {
8776 #[inline]
8777 unsafe fn encode(
8778 self,
8779 encoder: &mut fidl::encoding::Encoder<
8780 '_,
8781 fidl::encoding::DefaultFuchsiaResourceDialect,
8782 >,
8783 offset: usize,
8784 depth: fidl::encoding::Depth,
8785 ) -> fidl::Result<()> {
8786 encoder.debug_check_bounds::<ServiceInstancePublisherPublishServiceInstanceRequest>(
8787 offset,
8788 );
8789 unsafe {
8792 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
8793 (ptr as *mut u64).write_unaligned(0);
8794 }
8795 self.0.encode(encoder, offset + 0, depth)?;
8797 self.1.encode(encoder, offset + 16, depth)?;
8798 self.2.encode(encoder, offset + 32, depth)?;
8799 self.3.encode(encoder, offset + 48, depth)?;
8800 Ok(())
8801 }
8802 }
8803
8804 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8805 for ServiceInstancePublisherPublishServiceInstanceRequest
8806 {
8807 #[inline(always)]
8808 fn new_empty() -> Self {
8809 Self {
8810 service: fidl::new_empty!(
8811 fidl::encoding::BoundedString<22>,
8812 fidl::encoding::DefaultFuchsiaResourceDialect
8813 ),
8814 instance: fidl::new_empty!(
8815 fidl::encoding::BoundedString<63>,
8816 fidl::encoding::DefaultFuchsiaResourceDialect
8817 ),
8818 options: fidl::new_empty!(
8819 ServiceInstancePublicationOptions,
8820 fidl::encoding::DefaultFuchsiaResourceDialect
8821 ),
8822 publication_responder: fidl::new_empty!(
8823 fidl::encoding::Endpoint<
8824 fidl::endpoints::ClientEnd<ServiceInstancePublicationResponder_Marker>,
8825 >,
8826 fidl::encoding::DefaultFuchsiaResourceDialect
8827 ),
8828 }
8829 }
8830
8831 #[inline]
8832 unsafe fn decode(
8833 &mut self,
8834 decoder: &mut fidl::encoding::Decoder<
8835 '_,
8836 fidl::encoding::DefaultFuchsiaResourceDialect,
8837 >,
8838 offset: usize,
8839 _depth: fidl::encoding::Depth,
8840 ) -> fidl::Result<()> {
8841 decoder.debug_check_bounds::<Self>(offset);
8842 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
8844 let padval = unsafe { (ptr as *const u64).read_unaligned() };
8845 let mask = 0xffffffff00000000u64;
8846 let maskedval = padval & mask;
8847 if maskedval != 0 {
8848 return Err(fidl::Error::NonZeroPadding {
8849 padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
8850 });
8851 }
8852 fidl::decode!(
8853 fidl::encoding::BoundedString<22>,
8854 fidl::encoding::DefaultFuchsiaResourceDialect,
8855 &mut self.service,
8856 decoder,
8857 offset + 0,
8858 _depth
8859 )?;
8860 fidl::decode!(
8861 fidl::encoding::BoundedString<63>,
8862 fidl::encoding::DefaultFuchsiaResourceDialect,
8863 &mut self.instance,
8864 decoder,
8865 offset + 16,
8866 _depth
8867 )?;
8868 fidl::decode!(
8869 ServiceInstancePublicationOptions,
8870 fidl::encoding::DefaultFuchsiaResourceDialect,
8871 &mut self.options,
8872 decoder,
8873 offset + 32,
8874 _depth
8875 )?;
8876 fidl::decode!(
8877 fidl::encoding::Endpoint<
8878 fidl::endpoints::ClientEnd<ServiceInstancePublicationResponder_Marker>,
8879 >,
8880 fidl::encoding::DefaultFuchsiaResourceDialect,
8881 &mut self.publication_responder,
8882 decoder,
8883 offset + 48,
8884 _depth
8885 )?;
8886 Ok(())
8887 }
8888 }
8889
8890 impl fidl::encoding::ResourceTypeMarker for ServiceSubscriber2SubscribeToAllServicesRequest {
8891 type Borrowed<'a> = &'a mut Self;
8892 fn take_or_borrow<'a>(
8893 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8894 ) -> Self::Borrowed<'a> {
8895 value
8896 }
8897 }
8898
8899 unsafe impl fidl::encoding::TypeMarker for ServiceSubscriber2SubscribeToAllServicesRequest {
8900 type Owned = Self;
8901
8902 #[inline(always)]
8903 fn inline_align(_context: fidl::encoding::Context) -> usize {
8904 8
8905 }
8906
8907 #[inline(always)]
8908 fn inline_size(_context: fidl::encoding::Context) -> usize {
8909 24
8910 }
8911 }
8912
8913 unsafe impl
8914 fidl::encoding::Encode<
8915 ServiceSubscriber2SubscribeToAllServicesRequest,
8916 fidl::encoding::DefaultFuchsiaResourceDialect,
8917 > for &mut ServiceSubscriber2SubscribeToAllServicesRequest
8918 {
8919 #[inline]
8920 unsafe fn encode(
8921 self,
8922 encoder: &mut fidl::encoding::Encoder<
8923 '_,
8924 fidl::encoding::DefaultFuchsiaResourceDialect,
8925 >,
8926 offset: usize,
8927 _depth: fidl::encoding::Depth,
8928 ) -> fidl::Result<()> {
8929 encoder.debug_check_bounds::<ServiceSubscriber2SubscribeToAllServicesRequest>(offset);
8930 fidl::encoding::Encode::<
8932 ServiceSubscriber2SubscribeToAllServicesRequest,
8933 fidl::encoding::DefaultFuchsiaResourceDialect,
8934 >::encode(
8935 (
8936 <ServiceSubscriptionOptions as fidl::encoding::ValueTypeMarker>::borrow(
8937 &self.options,
8938 ),
8939 <fidl::encoding::Endpoint<
8940 fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
8941 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
8942 &mut self.listener
8943 ),
8944 ),
8945 encoder,
8946 offset,
8947 _depth,
8948 )
8949 }
8950 }
8951 unsafe impl<
8952 T0: fidl::encoding::Encode<
8953 ServiceSubscriptionOptions,
8954 fidl::encoding::DefaultFuchsiaResourceDialect,
8955 >,
8956 T1: fidl::encoding::Encode<
8957 fidl::encoding::Endpoint<
8958 fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
8959 >,
8960 fidl::encoding::DefaultFuchsiaResourceDialect,
8961 >,
8962 >
8963 fidl::encoding::Encode<
8964 ServiceSubscriber2SubscribeToAllServicesRequest,
8965 fidl::encoding::DefaultFuchsiaResourceDialect,
8966 > for (T0, T1)
8967 {
8968 #[inline]
8969 unsafe fn encode(
8970 self,
8971 encoder: &mut fidl::encoding::Encoder<
8972 '_,
8973 fidl::encoding::DefaultFuchsiaResourceDialect,
8974 >,
8975 offset: usize,
8976 depth: fidl::encoding::Depth,
8977 ) -> fidl::Result<()> {
8978 encoder.debug_check_bounds::<ServiceSubscriber2SubscribeToAllServicesRequest>(offset);
8979 unsafe {
8982 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
8983 (ptr as *mut u64).write_unaligned(0);
8984 }
8985 self.0.encode(encoder, offset + 0, depth)?;
8987 self.1.encode(encoder, offset + 16, depth)?;
8988 Ok(())
8989 }
8990 }
8991
8992 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8993 for ServiceSubscriber2SubscribeToAllServicesRequest
8994 {
8995 #[inline(always)]
8996 fn new_empty() -> Self {
8997 Self {
8998 options: fidl::new_empty!(
8999 ServiceSubscriptionOptions,
9000 fidl::encoding::DefaultFuchsiaResourceDialect
9001 ),
9002 listener: fidl::new_empty!(
9003 fidl::encoding::Endpoint<
9004 fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
9005 >,
9006 fidl::encoding::DefaultFuchsiaResourceDialect
9007 ),
9008 }
9009 }
9010
9011 #[inline]
9012 unsafe fn decode(
9013 &mut self,
9014 decoder: &mut fidl::encoding::Decoder<
9015 '_,
9016 fidl::encoding::DefaultFuchsiaResourceDialect,
9017 >,
9018 offset: usize,
9019 _depth: fidl::encoding::Depth,
9020 ) -> fidl::Result<()> {
9021 decoder.debug_check_bounds::<Self>(offset);
9022 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
9024 let padval = unsafe { (ptr as *const u64).read_unaligned() };
9025 let mask = 0xffffffff00000000u64;
9026 let maskedval = padval & mask;
9027 if maskedval != 0 {
9028 return Err(fidl::Error::NonZeroPadding {
9029 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
9030 });
9031 }
9032 fidl::decode!(
9033 ServiceSubscriptionOptions,
9034 fidl::encoding::DefaultFuchsiaResourceDialect,
9035 &mut self.options,
9036 decoder,
9037 offset + 0,
9038 _depth
9039 )?;
9040 fidl::decode!(
9041 fidl::encoding::Endpoint<
9042 fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
9043 >,
9044 fidl::encoding::DefaultFuchsiaResourceDialect,
9045 &mut self.listener,
9046 decoder,
9047 offset + 16,
9048 _depth
9049 )?;
9050 Ok(())
9051 }
9052 }
9053
9054 impl fidl::encoding::ResourceTypeMarker for ServiceSubscriber2SubscribeToServiceRequest {
9055 type Borrowed<'a> = &'a mut Self;
9056 fn take_or_borrow<'a>(
9057 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9058 ) -> Self::Borrowed<'a> {
9059 value
9060 }
9061 }
9062
9063 unsafe impl fidl::encoding::TypeMarker for ServiceSubscriber2SubscribeToServiceRequest {
9064 type Owned = Self;
9065
9066 #[inline(always)]
9067 fn inline_align(_context: fidl::encoding::Context) -> usize {
9068 8
9069 }
9070
9071 #[inline(always)]
9072 fn inline_size(_context: fidl::encoding::Context) -> usize {
9073 40
9074 }
9075 }
9076
9077 unsafe impl
9078 fidl::encoding::Encode<
9079 ServiceSubscriber2SubscribeToServiceRequest,
9080 fidl::encoding::DefaultFuchsiaResourceDialect,
9081 > for &mut ServiceSubscriber2SubscribeToServiceRequest
9082 {
9083 #[inline]
9084 unsafe fn encode(
9085 self,
9086 encoder: &mut fidl::encoding::Encoder<
9087 '_,
9088 fidl::encoding::DefaultFuchsiaResourceDialect,
9089 >,
9090 offset: usize,
9091 _depth: fidl::encoding::Depth,
9092 ) -> fidl::Result<()> {
9093 encoder.debug_check_bounds::<ServiceSubscriber2SubscribeToServiceRequest>(offset);
9094 fidl::encoding::Encode::<
9096 ServiceSubscriber2SubscribeToServiceRequest,
9097 fidl::encoding::DefaultFuchsiaResourceDialect,
9098 >::encode(
9099 (
9100 <fidl::encoding::BoundedString<22> as fidl::encoding::ValueTypeMarker>::borrow(
9101 &self.service,
9102 ),
9103 <ServiceSubscriptionOptions as fidl::encoding::ValueTypeMarker>::borrow(
9104 &self.options,
9105 ),
9106 <fidl::encoding::Endpoint<
9107 fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
9108 > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9109 &mut self.listener
9110 ),
9111 ),
9112 encoder,
9113 offset,
9114 _depth,
9115 )
9116 }
9117 }
9118 unsafe impl<
9119 T0: fidl::encoding::Encode<
9120 fidl::encoding::BoundedString<22>,
9121 fidl::encoding::DefaultFuchsiaResourceDialect,
9122 >,
9123 T1: fidl::encoding::Encode<
9124 ServiceSubscriptionOptions,
9125 fidl::encoding::DefaultFuchsiaResourceDialect,
9126 >,
9127 T2: fidl::encoding::Encode<
9128 fidl::encoding::Endpoint<
9129 fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
9130 >,
9131 fidl::encoding::DefaultFuchsiaResourceDialect,
9132 >,
9133 >
9134 fidl::encoding::Encode<
9135 ServiceSubscriber2SubscribeToServiceRequest,
9136 fidl::encoding::DefaultFuchsiaResourceDialect,
9137 > for (T0, T1, T2)
9138 {
9139 #[inline]
9140 unsafe fn encode(
9141 self,
9142 encoder: &mut fidl::encoding::Encoder<
9143 '_,
9144 fidl::encoding::DefaultFuchsiaResourceDialect,
9145 >,
9146 offset: usize,
9147 depth: fidl::encoding::Depth,
9148 ) -> fidl::Result<()> {
9149 encoder.debug_check_bounds::<ServiceSubscriber2SubscribeToServiceRequest>(offset);
9150 unsafe {
9153 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
9154 (ptr as *mut u64).write_unaligned(0);
9155 }
9156 self.0.encode(encoder, offset + 0, depth)?;
9158 self.1.encode(encoder, offset + 16, depth)?;
9159 self.2.encode(encoder, offset + 32, depth)?;
9160 Ok(())
9161 }
9162 }
9163
9164 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9165 for ServiceSubscriber2SubscribeToServiceRequest
9166 {
9167 #[inline(always)]
9168 fn new_empty() -> Self {
9169 Self {
9170 service: fidl::new_empty!(
9171 fidl::encoding::BoundedString<22>,
9172 fidl::encoding::DefaultFuchsiaResourceDialect
9173 ),
9174 options: fidl::new_empty!(
9175 ServiceSubscriptionOptions,
9176 fidl::encoding::DefaultFuchsiaResourceDialect
9177 ),
9178 listener: fidl::new_empty!(
9179 fidl::encoding::Endpoint<
9180 fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
9181 >,
9182 fidl::encoding::DefaultFuchsiaResourceDialect
9183 ),
9184 }
9185 }
9186
9187 #[inline]
9188 unsafe fn decode(
9189 &mut self,
9190 decoder: &mut fidl::encoding::Decoder<
9191 '_,
9192 fidl::encoding::DefaultFuchsiaResourceDialect,
9193 >,
9194 offset: usize,
9195 _depth: fidl::encoding::Depth,
9196 ) -> fidl::Result<()> {
9197 decoder.debug_check_bounds::<Self>(offset);
9198 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
9200 let padval = unsafe { (ptr as *const u64).read_unaligned() };
9201 let mask = 0xffffffff00000000u64;
9202 let maskedval = padval & mask;
9203 if maskedval != 0 {
9204 return Err(fidl::Error::NonZeroPadding {
9205 padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
9206 });
9207 }
9208 fidl::decode!(
9209 fidl::encoding::BoundedString<22>,
9210 fidl::encoding::DefaultFuchsiaResourceDialect,
9211 &mut self.service,
9212 decoder,
9213 offset + 0,
9214 _depth
9215 )?;
9216 fidl::decode!(
9217 ServiceSubscriptionOptions,
9218 fidl::encoding::DefaultFuchsiaResourceDialect,
9219 &mut self.options,
9220 decoder,
9221 offset + 16,
9222 _depth
9223 )?;
9224 fidl::decode!(
9225 fidl::encoding::Endpoint<
9226 fidl::endpoints::ClientEnd<ServiceSubscriptionListenerMarker>,
9227 >,
9228 fidl::encoding::DefaultFuchsiaResourceDialect,
9229 &mut self.listener,
9230 decoder,
9231 offset + 32,
9232 _depth
9233 )?;
9234 Ok(())
9235 }
9236 }
9237
9238 impl fidl::encoding::ResourceTypeMarker for SubscriberSubscribeToServiceRequest {
9239 type Borrowed<'a> = &'a mut Self;
9240 fn take_or_borrow<'a>(
9241 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9242 ) -> Self::Borrowed<'a> {
9243 value
9244 }
9245 }
9246
9247 unsafe impl fidl::encoding::TypeMarker for SubscriberSubscribeToServiceRequest {
9248 type Owned = Self;
9249
9250 #[inline(always)]
9251 fn inline_align(_context: fidl::encoding::Context) -> usize {
9252 8
9253 }
9254
9255 #[inline(always)]
9256 fn inline_size(_context: fidl::encoding::Context) -> usize {
9257 24
9258 }
9259 }
9260
9261 unsafe impl
9262 fidl::encoding::Encode<
9263 SubscriberSubscribeToServiceRequest,
9264 fidl::encoding::DefaultFuchsiaResourceDialect,
9265 > for &mut SubscriberSubscribeToServiceRequest
9266 {
9267 #[inline]
9268 unsafe fn encode(
9269 self,
9270 encoder: &mut fidl::encoding::Encoder<
9271 '_,
9272 fidl::encoding::DefaultFuchsiaResourceDialect,
9273 >,
9274 offset: usize,
9275 _depth: fidl::encoding::Depth,
9276 ) -> fidl::Result<()> {
9277 encoder.debug_check_bounds::<SubscriberSubscribeToServiceRequest>(offset);
9278 fidl::encoding::Encode::<SubscriberSubscribeToServiceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9280 (
9281 <fidl::encoding::BoundedString<22> as fidl::encoding::ValueTypeMarker>::borrow(&self.service),
9282 <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ServiceSubscriberMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.subscriber),
9283 ),
9284 encoder, offset, _depth
9285 )
9286 }
9287 }
9288 unsafe impl<
9289 T0: fidl::encoding::Encode<
9290 fidl::encoding::BoundedString<22>,
9291 fidl::encoding::DefaultFuchsiaResourceDialect,
9292 >,
9293 T1: fidl::encoding::Encode<
9294 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ServiceSubscriberMarker>>,
9295 fidl::encoding::DefaultFuchsiaResourceDialect,
9296 >,
9297 >
9298 fidl::encoding::Encode<
9299 SubscriberSubscribeToServiceRequest,
9300 fidl::encoding::DefaultFuchsiaResourceDialect,
9301 > for (T0, T1)
9302 {
9303 #[inline]
9304 unsafe fn encode(
9305 self,
9306 encoder: &mut fidl::encoding::Encoder<
9307 '_,
9308 fidl::encoding::DefaultFuchsiaResourceDialect,
9309 >,
9310 offset: usize,
9311 depth: fidl::encoding::Depth,
9312 ) -> fidl::Result<()> {
9313 encoder.debug_check_bounds::<SubscriberSubscribeToServiceRequest>(offset);
9314 unsafe {
9317 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
9318 (ptr as *mut u64).write_unaligned(0);
9319 }
9320 self.0.encode(encoder, offset + 0, depth)?;
9322 self.1.encode(encoder, offset + 16, depth)?;
9323 Ok(())
9324 }
9325 }
9326
9327 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9328 for SubscriberSubscribeToServiceRequest
9329 {
9330 #[inline(always)]
9331 fn new_empty() -> Self {
9332 Self {
9333 service: fidl::new_empty!(
9334 fidl::encoding::BoundedString<22>,
9335 fidl::encoding::DefaultFuchsiaResourceDialect
9336 ),
9337 subscriber: fidl::new_empty!(
9338 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ServiceSubscriberMarker>>,
9339 fidl::encoding::DefaultFuchsiaResourceDialect
9340 ),
9341 }
9342 }
9343
9344 #[inline]
9345 unsafe fn decode(
9346 &mut self,
9347 decoder: &mut fidl::encoding::Decoder<
9348 '_,
9349 fidl::encoding::DefaultFuchsiaResourceDialect,
9350 >,
9351 offset: usize,
9352 _depth: fidl::encoding::Depth,
9353 ) -> fidl::Result<()> {
9354 decoder.debug_check_bounds::<Self>(offset);
9355 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
9357 let padval = unsafe { (ptr as *const u64).read_unaligned() };
9358 let mask = 0xffffffff00000000u64;
9359 let maskedval = padval & mask;
9360 if maskedval != 0 {
9361 return Err(fidl::Error::NonZeroPadding {
9362 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
9363 });
9364 }
9365 fidl::decode!(
9366 fidl::encoding::BoundedString<22>,
9367 fidl::encoding::DefaultFuchsiaResourceDialect,
9368 &mut self.service,
9369 decoder,
9370 offset + 0,
9371 _depth
9372 )?;
9373 fidl::decode!(
9374 fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ServiceSubscriberMarker>>,
9375 fidl::encoding::DefaultFuchsiaResourceDialect,
9376 &mut self.subscriber,
9377 decoder,
9378 offset + 16,
9379 _depth
9380 )?;
9381 Ok(())
9382 }
9383 }
9384}