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