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_netpol_socketproxy_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct DnsServerWatcherMarker;
16
17impl fidl::endpoints::ProtocolMarker for DnsServerWatcherMarker {
18 type Proxy = DnsServerWatcherProxy;
19 type RequestStream = DnsServerWatcherRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = DnsServerWatcherSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "fuchsia.netpol.socketproxy.DnsServerWatcher";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for DnsServerWatcherMarker {}
26
27pub trait DnsServerWatcherProxyInterface: Send + Sync {
28 type WatchServersResponseFut: std::future::Future<Output = Result<Vec<DnsServerList>, fidl::Error>>
29 + Send;
30 fn r#watch_servers(&self) -> Self::WatchServersResponseFut;
31 type CheckPresenceResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
32 fn r#check_presence(&self) -> Self::CheckPresenceResponseFut;
33}
34#[derive(Debug)]
35#[cfg(target_os = "fuchsia")]
36pub struct DnsServerWatcherSynchronousProxy {
37 client: fidl::client::sync::Client,
38}
39
40#[cfg(target_os = "fuchsia")]
41impl fidl::endpoints::SynchronousProxy for DnsServerWatcherSynchronousProxy {
42 type Proxy = DnsServerWatcherProxy;
43 type Protocol = DnsServerWatcherMarker;
44
45 fn from_channel(inner: fidl::Channel) -> Self {
46 Self::new(inner)
47 }
48
49 fn into_channel(self) -> fidl::Channel {
50 self.client.into_channel()
51 }
52
53 fn as_channel(&self) -> &fidl::Channel {
54 self.client.as_channel()
55 }
56}
57
58#[cfg(target_os = "fuchsia")]
59impl DnsServerWatcherSynchronousProxy {
60 pub fn new(channel: fidl::Channel) -> Self {
61 let protocol_name = <DnsServerWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
62 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
63 }
64
65 pub fn into_channel(self) -> fidl::Channel {
66 self.client.into_channel()
67 }
68
69 pub fn wait_for_event(
72 &self,
73 deadline: zx::MonotonicInstant,
74 ) -> Result<DnsServerWatcherEvent, fidl::Error> {
75 DnsServerWatcherEvent::decode(self.client.wait_for_event(deadline)?)
76 }
77
78 pub fn r#watch_servers(
92 &self,
93 ___deadline: zx::MonotonicInstant,
94 ) -> Result<Vec<DnsServerList>, fidl::Error> {
95 let _response = self
96 .client
97 .send_query::<fidl::encoding::EmptyPayload, DnsServerWatcherWatchServersResponse>(
98 (),
99 0x6dce6139f108b7ac,
100 fidl::encoding::DynamicFlags::empty(),
101 ___deadline,
102 )?;
103 Ok(_response.servers)
104 }
105
106 pub fn r#check_presence(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
114 let _response =
115 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
116 (),
117 0x7724a047148704eb,
118 fidl::encoding::DynamicFlags::empty(),
119 ___deadline,
120 )?;
121 Ok(_response)
122 }
123}
124
125#[cfg(target_os = "fuchsia")]
126impl From<DnsServerWatcherSynchronousProxy> for zx::Handle {
127 fn from(value: DnsServerWatcherSynchronousProxy) -> Self {
128 value.into_channel().into()
129 }
130}
131
132#[cfg(target_os = "fuchsia")]
133impl From<fidl::Channel> for DnsServerWatcherSynchronousProxy {
134 fn from(value: fidl::Channel) -> Self {
135 Self::new(value)
136 }
137}
138
139#[derive(Debug, Clone)]
140pub struct DnsServerWatcherProxy {
141 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
142}
143
144impl fidl::endpoints::Proxy for DnsServerWatcherProxy {
145 type Protocol = DnsServerWatcherMarker;
146
147 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
148 Self::new(inner)
149 }
150
151 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
152 self.client.into_channel().map_err(|client| Self { client })
153 }
154
155 fn as_channel(&self) -> &::fidl::AsyncChannel {
156 self.client.as_channel()
157 }
158}
159
160impl DnsServerWatcherProxy {
161 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
163 let protocol_name = <DnsServerWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
164 Self { client: fidl::client::Client::new(channel, protocol_name) }
165 }
166
167 pub fn take_event_stream(&self) -> DnsServerWatcherEventStream {
173 DnsServerWatcherEventStream { event_receiver: self.client.take_event_receiver() }
174 }
175
176 pub fn r#watch_servers(
190 &self,
191 ) -> fidl::client::QueryResponseFut<
192 Vec<DnsServerList>,
193 fidl::encoding::DefaultFuchsiaResourceDialect,
194 > {
195 DnsServerWatcherProxyInterface::r#watch_servers(self)
196 }
197
198 pub fn r#check_presence(
206 &self,
207 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
208 DnsServerWatcherProxyInterface::r#check_presence(self)
209 }
210}
211
212impl DnsServerWatcherProxyInterface for DnsServerWatcherProxy {
213 type WatchServersResponseFut = fidl::client::QueryResponseFut<
214 Vec<DnsServerList>,
215 fidl::encoding::DefaultFuchsiaResourceDialect,
216 >;
217 fn r#watch_servers(&self) -> Self::WatchServersResponseFut {
218 fn _decode(
219 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
220 ) -> Result<Vec<DnsServerList>, fidl::Error> {
221 let _response = fidl::client::decode_transaction_body::<
222 DnsServerWatcherWatchServersResponse,
223 fidl::encoding::DefaultFuchsiaResourceDialect,
224 0x6dce6139f108b7ac,
225 >(_buf?)?;
226 Ok(_response.servers)
227 }
228 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<DnsServerList>>(
229 (),
230 0x6dce6139f108b7ac,
231 fidl::encoding::DynamicFlags::empty(),
232 _decode,
233 )
234 }
235
236 type CheckPresenceResponseFut =
237 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
238 fn r#check_presence(&self) -> Self::CheckPresenceResponseFut {
239 fn _decode(
240 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
241 ) -> Result<(), fidl::Error> {
242 let _response = fidl::client::decode_transaction_body::<
243 fidl::encoding::EmptyPayload,
244 fidl::encoding::DefaultFuchsiaResourceDialect,
245 0x7724a047148704eb,
246 >(_buf?)?;
247 Ok(_response)
248 }
249 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
250 (),
251 0x7724a047148704eb,
252 fidl::encoding::DynamicFlags::empty(),
253 _decode,
254 )
255 }
256}
257
258pub struct DnsServerWatcherEventStream {
259 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
260}
261
262impl std::marker::Unpin for DnsServerWatcherEventStream {}
263
264impl futures::stream::FusedStream for DnsServerWatcherEventStream {
265 fn is_terminated(&self) -> bool {
266 self.event_receiver.is_terminated()
267 }
268}
269
270impl futures::Stream for DnsServerWatcherEventStream {
271 type Item = Result<DnsServerWatcherEvent, fidl::Error>;
272
273 fn poll_next(
274 mut self: std::pin::Pin<&mut Self>,
275 cx: &mut std::task::Context<'_>,
276 ) -> std::task::Poll<Option<Self::Item>> {
277 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
278 &mut self.event_receiver,
279 cx
280 )?) {
281 Some(buf) => std::task::Poll::Ready(Some(DnsServerWatcherEvent::decode(buf))),
282 None => std::task::Poll::Ready(None),
283 }
284 }
285}
286
287#[derive(Debug)]
288pub enum DnsServerWatcherEvent {}
289
290impl DnsServerWatcherEvent {
291 fn decode(
293 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
294 ) -> Result<DnsServerWatcherEvent, fidl::Error> {
295 let (bytes, _handles) = buf.split_mut();
296 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
297 debug_assert_eq!(tx_header.tx_id, 0);
298 match tx_header.ordinal {
299 _ => Err(fidl::Error::UnknownOrdinal {
300 ordinal: tx_header.ordinal,
301 protocol_name:
302 <DnsServerWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
303 }),
304 }
305 }
306}
307
308pub struct DnsServerWatcherRequestStream {
310 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
311 is_terminated: bool,
312}
313
314impl std::marker::Unpin for DnsServerWatcherRequestStream {}
315
316impl futures::stream::FusedStream for DnsServerWatcherRequestStream {
317 fn is_terminated(&self) -> bool {
318 self.is_terminated
319 }
320}
321
322impl fidl::endpoints::RequestStream for DnsServerWatcherRequestStream {
323 type Protocol = DnsServerWatcherMarker;
324 type ControlHandle = DnsServerWatcherControlHandle;
325
326 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
327 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
328 }
329
330 fn control_handle(&self) -> Self::ControlHandle {
331 DnsServerWatcherControlHandle { inner: self.inner.clone() }
332 }
333
334 fn into_inner(
335 self,
336 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
337 {
338 (self.inner, self.is_terminated)
339 }
340
341 fn from_inner(
342 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
343 is_terminated: bool,
344 ) -> Self {
345 Self { inner, is_terminated }
346 }
347}
348
349impl futures::Stream for DnsServerWatcherRequestStream {
350 type Item = Result<DnsServerWatcherRequest, fidl::Error>;
351
352 fn poll_next(
353 mut self: std::pin::Pin<&mut Self>,
354 cx: &mut std::task::Context<'_>,
355 ) -> std::task::Poll<Option<Self::Item>> {
356 let this = &mut *self;
357 if this.inner.check_shutdown(cx) {
358 this.is_terminated = true;
359 return std::task::Poll::Ready(None);
360 }
361 if this.is_terminated {
362 panic!("polled DnsServerWatcherRequestStream after completion");
363 }
364 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
365 |bytes, handles| {
366 match this.inner.channel().read_etc(cx, bytes, handles) {
367 std::task::Poll::Ready(Ok(())) => {}
368 std::task::Poll::Pending => return std::task::Poll::Pending,
369 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
370 this.is_terminated = true;
371 return std::task::Poll::Ready(None);
372 }
373 std::task::Poll::Ready(Err(e)) => {
374 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
375 e.into(),
376 ))))
377 }
378 }
379
380 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
382
383 std::task::Poll::Ready(Some(match header.ordinal {
384 0x6dce6139f108b7ac => {
385 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
386 let mut req = fidl::new_empty!(
387 fidl::encoding::EmptyPayload,
388 fidl::encoding::DefaultFuchsiaResourceDialect
389 );
390 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
391 let control_handle =
392 DnsServerWatcherControlHandle { inner: this.inner.clone() };
393 Ok(DnsServerWatcherRequest::WatchServers {
394 responder: DnsServerWatcherWatchServersResponder {
395 control_handle: std::mem::ManuallyDrop::new(control_handle),
396 tx_id: header.tx_id,
397 },
398 })
399 }
400 0x7724a047148704eb => {
401 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
402 let mut req = fidl::new_empty!(
403 fidl::encoding::EmptyPayload,
404 fidl::encoding::DefaultFuchsiaResourceDialect
405 );
406 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
407 let control_handle =
408 DnsServerWatcherControlHandle { inner: this.inner.clone() };
409 Ok(DnsServerWatcherRequest::CheckPresence {
410 responder: DnsServerWatcherCheckPresenceResponder {
411 control_handle: std::mem::ManuallyDrop::new(control_handle),
412 tx_id: header.tx_id,
413 },
414 })
415 }
416 _ => Err(fidl::Error::UnknownOrdinal {
417 ordinal: header.ordinal,
418 protocol_name:
419 <DnsServerWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
420 }),
421 }))
422 },
423 )
424 }
425}
426
427#[derive(Debug)]
430pub enum DnsServerWatcherRequest {
431 WatchServers { responder: DnsServerWatcherWatchServersResponder },
445 CheckPresence { responder: DnsServerWatcherCheckPresenceResponder },
453}
454
455impl DnsServerWatcherRequest {
456 #[allow(irrefutable_let_patterns)]
457 pub fn into_watch_servers(self) -> Option<(DnsServerWatcherWatchServersResponder)> {
458 if let DnsServerWatcherRequest::WatchServers { responder } = self {
459 Some((responder))
460 } else {
461 None
462 }
463 }
464
465 #[allow(irrefutable_let_patterns)]
466 pub fn into_check_presence(self) -> Option<(DnsServerWatcherCheckPresenceResponder)> {
467 if let DnsServerWatcherRequest::CheckPresence { responder } = self {
468 Some((responder))
469 } else {
470 None
471 }
472 }
473
474 pub fn method_name(&self) -> &'static str {
476 match *self {
477 DnsServerWatcherRequest::WatchServers { .. } => "watch_servers",
478 DnsServerWatcherRequest::CheckPresence { .. } => "check_presence",
479 }
480 }
481}
482
483#[derive(Debug, Clone)]
484pub struct DnsServerWatcherControlHandle {
485 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
486}
487
488impl fidl::endpoints::ControlHandle for DnsServerWatcherControlHandle {
489 fn shutdown(&self) {
490 self.inner.shutdown()
491 }
492 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
493 self.inner.shutdown_with_epitaph(status)
494 }
495
496 fn is_closed(&self) -> bool {
497 self.inner.channel().is_closed()
498 }
499 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
500 self.inner.channel().on_closed()
501 }
502
503 #[cfg(target_os = "fuchsia")]
504 fn signal_peer(
505 &self,
506 clear_mask: zx::Signals,
507 set_mask: zx::Signals,
508 ) -> Result<(), zx_status::Status> {
509 use fidl::Peered;
510 self.inner.channel().signal_peer(clear_mask, set_mask)
511 }
512}
513
514impl DnsServerWatcherControlHandle {}
515
516#[must_use = "FIDL methods require a response to be sent"]
517#[derive(Debug)]
518pub struct DnsServerWatcherWatchServersResponder {
519 control_handle: std::mem::ManuallyDrop<DnsServerWatcherControlHandle>,
520 tx_id: u32,
521}
522
523impl std::ops::Drop for DnsServerWatcherWatchServersResponder {
527 fn drop(&mut self) {
528 self.control_handle.shutdown();
529 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
531 }
532}
533
534impl fidl::endpoints::Responder for DnsServerWatcherWatchServersResponder {
535 type ControlHandle = DnsServerWatcherControlHandle;
536
537 fn control_handle(&self) -> &DnsServerWatcherControlHandle {
538 &self.control_handle
539 }
540
541 fn drop_without_shutdown(mut self) {
542 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
544 std::mem::forget(self);
546 }
547}
548
549impl DnsServerWatcherWatchServersResponder {
550 pub fn send(self, mut servers: &[DnsServerList]) -> Result<(), fidl::Error> {
554 let _result = self.send_raw(servers);
555 if _result.is_err() {
556 self.control_handle.shutdown();
557 }
558 self.drop_without_shutdown();
559 _result
560 }
561
562 pub fn send_no_shutdown_on_err(self, mut servers: &[DnsServerList]) -> Result<(), fidl::Error> {
564 let _result = self.send_raw(servers);
565 self.drop_without_shutdown();
566 _result
567 }
568
569 fn send_raw(&self, mut servers: &[DnsServerList]) -> Result<(), fidl::Error> {
570 self.control_handle.inner.send::<DnsServerWatcherWatchServersResponse>(
571 (servers,),
572 self.tx_id,
573 0x6dce6139f108b7ac,
574 fidl::encoding::DynamicFlags::empty(),
575 )
576 }
577}
578
579#[must_use = "FIDL methods require a response to be sent"]
580#[derive(Debug)]
581pub struct DnsServerWatcherCheckPresenceResponder {
582 control_handle: std::mem::ManuallyDrop<DnsServerWatcherControlHandle>,
583 tx_id: u32,
584}
585
586impl std::ops::Drop for DnsServerWatcherCheckPresenceResponder {
590 fn drop(&mut self) {
591 self.control_handle.shutdown();
592 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
594 }
595}
596
597impl fidl::endpoints::Responder for DnsServerWatcherCheckPresenceResponder {
598 type ControlHandle = DnsServerWatcherControlHandle;
599
600 fn control_handle(&self) -> &DnsServerWatcherControlHandle {
601 &self.control_handle
602 }
603
604 fn drop_without_shutdown(mut self) {
605 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
607 std::mem::forget(self);
609 }
610}
611
612impl DnsServerWatcherCheckPresenceResponder {
613 pub fn send(self) -> Result<(), fidl::Error> {
617 let _result = self.send_raw();
618 if _result.is_err() {
619 self.control_handle.shutdown();
620 }
621 self.drop_without_shutdown();
622 _result
623 }
624
625 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
627 let _result = self.send_raw();
628 self.drop_without_shutdown();
629 _result
630 }
631
632 fn send_raw(&self) -> Result<(), fidl::Error> {
633 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
634 (),
635 self.tx_id,
636 0x7724a047148704eb,
637 fidl::encoding::DynamicFlags::empty(),
638 )
639 }
640}
641
642#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
643pub struct FuchsiaNetworksMarker;
644
645impl fidl::endpoints::ProtocolMarker for FuchsiaNetworksMarker {
646 type Proxy = FuchsiaNetworksProxy;
647 type RequestStream = FuchsiaNetworksRequestStream;
648 #[cfg(target_os = "fuchsia")]
649 type SynchronousProxy = FuchsiaNetworksSynchronousProxy;
650
651 const DEBUG_NAME: &'static str = "fuchsia.netpol.socketproxy.FuchsiaNetworks";
652}
653impl fidl::endpoints::DiscoverableProtocolMarker for FuchsiaNetworksMarker {}
654
655pub trait FuchsiaNetworksProxyInterface: Send + Sync {
656 type SetDefaultResponseFut: std::future::Future<Output = Result<NetworkRegistrySetDefaultResult, fidl::Error>>
657 + Send;
658 fn r#set_default(
659 &self,
660 network_id: &fidl_fuchsia_posix_socket::OptionalUint32,
661 ) -> Self::SetDefaultResponseFut;
662 type AddResponseFut: std::future::Future<Output = Result<NetworkRegistryAddResult, fidl::Error>>
663 + Send;
664 fn r#add(&self, network: &Network) -> Self::AddResponseFut;
665 type UpdateResponseFut: std::future::Future<Output = Result<NetworkRegistryUpdateResult, fidl::Error>>
666 + Send;
667 fn r#update(&self, network: &Network) -> Self::UpdateResponseFut;
668 type RemoveResponseFut: std::future::Future<Output = Result<NetworkRegistryRemoveResult, fidl::Error>>
669 + Send;
670 fn r#remove(&self, network_id: u32) -> Self::RemoveResponseFut;
671 type CheckPresenceResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
672 fn r#check_presence(&self) -> Self::CheckPresenceResponseFut;
673}
674#[derive(Debug)]
675#[cfg(target_os = "fuchsia")]
676pub struct FuchsiaNetworksSynchronousProxy {
677 client: fidl::client::sync::Client,
678}
679
680#[cfg(target_os = "fuchsia")]
681impl fidl::endpoints::SynchronousProxy for FuchsiaNetworksSynchronousProxy {
682 type Proxy = FuchsiaNetworksProxy;
683 type Protocol = FuchsiaNetworksMarker;
684
685 fn from_channel(inner: fidl::Channel) -> Self {
686 Self::new(inner)
687 }
688
689 fn into_channel(self) -> fidl::Channel {
690 self.client.into_channel()
691 }
692
693 fn as_channel(&self) -> &fidl::Channel {
694 self.client.as_channel()
695 }
696}
697
698#[cfg(target_os = "fuchsia")]
699impl FuchsiaNetworksSynchronousProxy {
700 pub fn new(channel: fidl::Channel) -> Self {
701 let protocol_name = <FuchsiaNetworksMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
702 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
703 }
704
705 pub fn into_channel(self) -> fidl::Channel {
706 self.client.into_channel()
707 }
708
709 pub fn wait_for_event(
712 &self,
713 deadline: zx::MonotonicInstant,
714 ) -> Result<FuchsiaNetworksEvent, fidl::Error> {
715 FuchsiaNetworksEvent::decode(self.client.wait_for_event(deadline)?)
716 }
717
718 pub fn r#set_default(
722 &self,
723 mut network_id: &fidl_fuchsia_posix_socket::OptionalUint32,
724 ___deadline: zx::MonotonicInstant,
725 ) -> Result<NetworkRegistrySetDefaultResult, fidl::Error> {
726 let _response =
727 self.client.send_query::<NetworkRegistrySetDefaultRequest, fidl::encoding::ResultType<
728 fidl::encoding::EmptyStruct,
729 NetworkRegistrySetDefaultError,
730 >>(
731 (network_id,),
732 0x59a90d7826a7f342,
733 fidl::encoding::DynamicFlags::empty(),
734 ___deadline,
735 )?;
736 Ok(_response.map(|x| x))
737 }
738
739 pub fn r#add(
744 &self,
745 mut network: &Network,
746 ___deadline: zx::MonotonicInstant,
747 ) -> Result<NetworkRegistryAddResult, fidl::Error> {
748 let _response =
749 self.client.send_query::<NetworkRegistryAddRequest, fidl::encoding::ResultType<
750 fidl::encoding::EmptyStruct,
751 NetworkRegistryAddError,
752 >>(
753 (network,),
754 0x4a988855b0fa4f7b,
755 fidl::encoding::DynamicFlags::empty(),
756 ___deadline,
757 )?;
758 Ok(_response.map(|x| x))
759 }
760
761 pub fn r#update(
765 &self,
766 mut network: &Network,
767 ___deadline: zx::MonotonicInstant,
768 ) -> Result<NetworkRegistryUpdateResult, fidl::Error> {
769 let _response =
770 self.client.send_query::<NetworkRegistryUpdateRequest, fidl::encoding::ResultType<
771 fidl::encoding::EmptyStruct,
772 NetworkRegistryUpdateError,
773 >>(
774 (network,),
775 0x460479796e3eadfe,
776 fidl::encoding::DynamicFlags::empty(),
777 ___deadline,
778 )?;
779 Ok(_response.map(|x| x))
780 }
781
782 pub fn r#remove(
786 &self,
787 mut network_id: u32,
788 ___deadline: zx::MonotonicInstant,
789 ) -> Result<NetworkRegistryRemoveResult, fidl::Error> {
790 let _response =
791 self.client.send_query::<NetworkRegistryRemoveRequest, fidl::encoding::ResultType<
792 fidl::encoding::EmptyStruct,
793 NetworkRegistryRemoveError,
794 >>(
795 (network_id,),
796 0xe62f98532295a85,
797 fidl::encoding::DynamicFlags::empty(),
798 ___deadline,
799 )?;
800 Ok(_response.map(|x| x))
801 }
802
803 pub fn r#check_presence(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
811 let _response =
812 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
813 (),
814 0x27f51e2401662255,
815 fidl::encoding::DynamicFlags::empty(),
816 ___deadline,
817 )?;
818 Ok(_response)
819 }
820}
821
822#[cfg(target_os = "fuchsia")]
823impl From<FuchsiaNetworksSynchronousProxy> for zx::Handle {
824 fn from(value: FuchsiaNetworksSynchronousProxy) -> Self {
825 value.into_channel().into()
826 }
827}
828
829#[cfg(target_os = "fuchsia")]
830impl From<fidl::Channel> for FuchsiaNetworksSynchronousProxy {
831 fn from(value: fidl::Channel) -> Self {
832 Self::new(value)
833 }
834}
835
836#[derive(Debug, Clone)]
837pub struct FuchsiaNetworksProxy {
838 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
839}
840
841impl fidl::endpoints::Proxy for FuchsiaNetworksProxy {
842 type Protocol = FuchsiaNetworksMarker;
843
844 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
845 Self::new(inner)
846 }
847
848 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
849 self.client.into_channel().map_err(|client| Self { client })
850 }
851
852 fn as_channel(&self) -> &::fidl::AsyncChannel {
853 self.client.as_channel()
854 }
855}
856
857impl FuchsiaNetworksProxy {
858 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
860 let protocol_name = <FuchsiaNetworksMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
861 Self { client: fidl::client::Client::new(channel, protocol_name) }
862 }
863
864 pub fn take_event_stream(&self) -> FuchsiaNetworksEventStream {
870 FuchsiaNetworksEventStream { event_receiver: self.client.take_event_receiver() }
871 }
872
873 pub fn r#set_default(
877 &self,
878 mut network_id: &fidl_fuchsia_posix_socket::OptionalUint32,
879 ) -> fidl::client::QueryResponseFut<
880 NetworkRegistrySetDefaultResult,
881 fidl::encoding::DefaultFuchsiaResourceDialect,
882 > {
883 FuchsiaNetworksProxyInterface::r#set_default(self, network_id)
884 }
885
886 pub fn r#add(
891 &self,
892 mut network: &Network,
893 ) -> fidl::client::QueryResponseFut<
894 NetworkRegistryAddResult,
895 fidl::encoding::DefaultFuchsiaResourceDialect,
896 > {
897 FuchsiaNetworksProxyInterface::r#add(self, network)
898 }
899
900 pub fn r#update(
904 &self,
905 mut network: &Network,
906 ) -> fidl::client::QueryResponseFut<
907 NetworkRegistryUpdateResult,
908 fidl::encoding::DefaultFuchsiaResourceDialect,
909 > {
910 FuchsiaNetworksProxyInterface::r#update(self, network)
911 }
912
913 pub fn r#remove(
917 &self,
918 mut network_id: u32,
919 ) -> fidl::client::QueryResponseFut<
920 NetworkRegistryRemoveResult,
921 fidl::encoding::DefaultFuchsiaResourceDialect,
922 > {
923 FuchsiaNetworksProxyInterface::r#remove(self, network_id)
924 }
925
926 pub fn r#check_presence(
934 &self,
935 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
936 FuchsiaNetworksProxyInterface::r#check_presence(self)
937 }
938}
939
940impl FuchsiaNetworksProxyInterface for FuchsiaNetworksProxy {
941 type SetDefaultResponseFut = fidl::client::QueryResponseFut<
942 NetworkRegistrySetDefaultResult,
943 fidl::encoding::DefaultFuchsiaResourceDialect,
944 >;
945 fn r#set_default(
946 &self,
947 mut network_id: &fidl_fuchsia_posix_socket::OptionalUint32,
948 ) -> Self::SetDefaultResponseFut {
949 fn _decode(
950 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
951 ) -> Result<NetworkRegistrySetDefaultResult, fidl::Error> {
952 let _response = fidl::client::decode_transaction_body::<
953 fidl::encoding::ResultType<
954 fidl::encoding::EmptyStruct,
955 NetworkRegistrySetDefaultError,
956 >,
957 fidl::encoding::DefaultFuchsiaResourceDialect,
958 0x59a90d7826a7f342,
959 >(_buf?)?;
960 Ok(_response.map(|x| x))
961 }
962 self.client.send_query_and_decode::<
963 NetworkRegistrySetDefaultRequest,
964 NetworkRegistrySetDefaultResult,
965 >(
966 (network_id,),
967 0x59a90d7826a7f342,
968 fidl::encoding::DynamicFlags::empty(),
969 _decode,
970 )
971 }
972
973 type AddResponseFut = fidl::client::QueryResponseFut<
974 NetworkRegistryAddResult,
975 fidl::encoding::DefaultFuchsiaResourceDialect,
976 >;
977 fn r#add(&self, mut network: &Network) -> Self::AddResponseFut {
978 fn _decode(
979 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
980 ) -> Result<NetworkRegistryAddResult, fidl::Error> {
981 let _response = fidl::client::decode_transaction_body::<
982 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, NetworkRegistryAddError>,
983 fidl::encoding::DefaultFuchsiaResourceDialect,
984 0x4a988855b0fa4f7b,
985 >(_buf?)?;
986 Ok(_response.map(|x| x))
987 }
988 self.client.send_query_and_decode::<NetworkRegistryAddRequest, NetworkRegistryAddResult>(
989 (network,),
990 0x4a988855b0fa4f7b,
991 fidl::encoding::DynamicFlags::empty(),
992 _decode,
993 )
994 }
995
996 type UpdateResponseFut = fidl::client::QueryResponseFut<
997 NetworkRegistryUpdateResult,
998 fidl::encoding::DefaultFuchsiaResourceDialect,
999 >;
1000 fn r#update(&self, mut network: &Network) -> Self::UpdateResponseFut {
1001 fn _decode(
1002 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1003 ) -> Result<NetworkRegistryUpdateResult, fidl::Error> {
1004 let _response = fidl::client::decode_transaction_body::<
1005 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, NetworkRegistryUpdateError>,
1006 fidl::encoding::DefaultFuchsiaResourceDialect,
1007 0x460479796e3eadfe,
1008 >(_buf?)?;
1009 Ok(_response.map(|x| x))
1010 }
1011 self.client
1012 .send_query_and_decode::<NetworkRegistryUpdateRequest, NetworkRegistryUpdateResult>(
1013 (network,),
1014 0x460479796e3eadfe,
1015 fidl::encoding::DynamicFlags::empty(),
1016 _decode,
1017 )
1018 }
1019
1020 type RemoveResponseFut = fidl::client::QueryResponseFut<
1021 NetworkRegistryRemoveResult,
1022 fidl::encoding::DefaultFuchsiaResourceDialect,
1023 >;
1024 fn r#remove(&self, mut network_id: u32) -> Self::RemoveResponseFut {
1025 fn _decode(
1026 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1027 ) -> Result<NetworkRegistryRemoveResult, fidl::Error> {
1028 let _response = fidl::client::decode_transaction_body::<
1029 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, NetworkRegistryRemoveError>,
1030 fidl::encoding::DefaultFuchsiaResourceDialect,
1031 0xe62f98532295a85,
1032 >(_buf?)?;
1033 Ok(_response.map(|x| x))
1034 }
1035 self.client
1036 .send_query_and_decode::<NetworkRegistryRemoveRequest, NetworkRegistryRemoveResult>(
1037 (network_id,),
1038 0xe62f98532295a85,
1039 fidl::encoding::DynamicFlags::empty(),
1040 _decode,
1041 )
1042 }
1043
1044 type CheckPresenceResponseFut =
1045 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1046 fn r#check_presence(&self) -> Self::CheckPresenceResponseFut {
1047 fn _decode(
1048 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1049 ) -> Result<(), fidl::Error> {
1050 let _response = fidl::client::decode_transaction_body::<
1051 fidl::encoding::EmptyPayload,
1052 fidl::encoding::DefaultFuchsiaResourceDialect,
1053 0x27f51e2401662255,
1054 >(_buf?)?;
1055 Ok(_response)
1056 }
1057 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
1058 (),
1059 0x27f51e2401662255,
1060 fidl::encoding::DynamicFlags::empty(),
1061 _decode,
1062 )
1063 }
1064}
1065
1066pub struct FuchsiaNetworksEventStream {
1067 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1068}
1069
1070impl std::marker::Unpin for FuchsiaNetworksEventStream {}
1071
1072impl futures::stream::FusedStream for FuchsiaNetworksEventStream {
1073 fn is_terminated(&self) -> bool {
1074 self.event_receiver.is_terminated()
1075 }
1076}
1077
1078impl futures::Stream for FuchsiaNetworksEventStream {
1079 type Item = Result<FuchsiaNetworksEvent, fidl::Error>;
1080
1081 fn poll_next(
1082 mut self: std::pin::Pin<&mut Self>,
1083 cx: &mut std::task::Context<'_>,
1084 ) -> std::task::Poll<Option<Self::Item>> {
1085 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1086 &mut self.event_receiver,
1087 cx
1088 )?) {
1089 Some(buf) => std::task::Poll::Ready(Some(FuchsiaNetworksEvent::decode(buf))),
1090 None => std::task::Poll::Ready(None),
1091 }
1092 }
1093}
1094
1095#[derive(Debug)]
1096pub enum FuchsiaNetworksEvent {}
1097
1098impl FuchsiaNetworksEvent {
1099 fn decode(
1101 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1102 ) -> Result<FuchsiaNetworksEvent, fidl::Error> {
1103 let (bytes, _handles) = buf.split_mut();
1104 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1105 debug_assert_eq!(tx_header.tx_id, 0);
1106 match tx_header.ordinal {
1107 _ => Err(fidl::Error::UnknownOrdinal {
1108 ordinal: tx_header.ordinal,
1109 protocol_name:
1110 <FuchsiaNetworksMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1111 }),
1112 }
1113 }
1114}
1115
1116pub struct FuchsiaNetworksRequestStream {
1118 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1119 is_terminated: bool,
1120}
1121
1122impl std::marker::Unpin for FuchsiaNetworksRequestStream {}
1123
1124impl futures::stream::FusedStream for FuchsiaNetworksRequestStream {
1125 fn is_terminated(&self) -> bool {
1126 self.is_terminated
1127 }
1128}
1129
1130impl fidl::endpoints::RequestStream for FuchsiaNetworksRequestStream {
1131 type Protocol = FuchsiaNetworksMarker;
1132 type ControlHandle = FuchsiaNetworksControlHandle;
1133
1134 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1135 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1136 }
1137
1138 fn control_handle(&self) -> Self::ControlHandle {
1139 FuchsiaNetworksControlHandle { inner: self.inner.clone() }
1140 }
1141
1142 fn into_inner(
1143 self,
1144 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1145 {
1146 (self.inner, self.is_terminated)
1147 }
1148
1149 fn from_inner(
1150 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1151 is_terminated: bool,
1152 ) -> Self {
1153 Self { inner, is_terminated }
1154 }
1155}
1156
1157impl futures::Stream for FuchsiaNetworksRequestStream {
1158 type Item = Result<FuchsiaNetworksRequest, fidl::Error>;
1159
1160 fn poll_next(
1161 mut self: std::pin::Pin<&mut Self>,
1162 cx: &mut std::task::Context<'_>,
1163 ) -> std::task::Poll<Option<Self::Item>> {
1164 let this = &mut *self;
1165 if this.inner.check_shutdown(cx) {
1166 this.is_terminated = true;
1167 return std::task::Poll::Ready(None);
1168 }
1169 if this.is_terminated {
1170 panic!("polled FuchsiaNetworksRequestStream after completion");
1171 }
1172 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1173 |bytes, handles| {
1174 match this.inner.channel().read_etc(cx, bytes, handles) {
1175 std::task::Poll::Ready(Ok(())) => {}
1176 std::task::Poll::Pending => return std::task::Poll::Pending,
1177 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1178 this.is_terminated = true;
1179 return std::task::Poll::Ready(None);
1180 }
1181 std::task::Poll::Ready(Err(e)) => {
1182 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1183 e.into(),
1184 ))))
1185 }
1186 }
1187
1188 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1190
1191 std::task::Poll::Ready(Some(match header.ordinal {
1192 0x59a90d7826a7f342 => {
1193 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1194 let mut req = fidl::new_empty!(
1195 NetworkRegistrySetDefaultRequest,
1196 fidl::encoding::DefaultFuchsiaResourceDialect
1197 );
1198 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkRegistrySetDefaultRequest>(&header, _body_bytes, handles, &mut req)?;
1199 let control_handle =
1200 FuchsiaNetworksControlHandle { inner: this.inner.clone() };
1201 Ok(FuchsiaNetworksRequest::SetDefault {
1202 network_id: req.network_id,
1203
1204 responder: FuchsiaNetworksSetDefaultResponder {
1205 control_handle: std::mem::ManuallyDrop::new(control_handle),
1206 tx_id: header.tx_id,
1207 },
1208 })
1209 }
1210 0x4a988855b0fa4f7b => {
1211 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1212 let mut req = fidl::new_empty!(
1213 NetworkRegistryAddRequest,
1214 fidl::encoding::DefaultFuchsiaResourceDialect
1215 );
1216 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkRegistryAddRequest>(&header, _body_bytes, handles, &mut req)?;
1217 let control_handle =
1218 FuchsiaNetworksControlHandle { inner: this.inner.clone() };
1219 Ok(FuchsiaNetworksRequest::Add {
1220 network: req.network,
1221
1222 responder: FuchsiaNetworksAddResponder {
1223 control_handle: std::mem::ManuallyDrop::new(control_handle),
1224 tx_id: header.tx_id,
1225 },
1226 })
1227 }
1228 0x460479796e3eadfe => {
1229 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1230 let mut req = fidl::new_empty!(
1231 NetworkRegistryUpdateRequest,
1232 fidl::encoding::DefaultFuchsiaResourceDialect
1233 );
1234 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkRegistryUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
1235 let control_handle =
1236 FuchsiaNetworksControlHandle { inner: this.inner.clone() };
1237 Ok(FuchsiaNetworksRequest::Update {
1238 network: req.network,
1239
1240 responder: FuchsiaNetworksUpdateResponder {
1241 control_handle: std::mem::ManuallyDrop::new(control_handle),
1242 tx_id: header.tx_id,
1243 },
1244 })
1245 }
1246 0xe62f98532295a85 => {
1247 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1248 let mut req = fidl::new_empty!(
1249 NetworkRegistryRemoveRequest,
1250 fidl::encoding::DefaultFuchsiaResourceDialect
1251 );
1252 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkRegistryRemoveRequest>(&header, _body_bytes, handles, &mut req)?;
1253 let control_handle =
1254 FuchsiaNetworksControlHandle { inner: this.inner.clone() };
1255 Ok(FuchsiaNetworksRequest::Remove {
1256 network_id: req.network_id,
1257
1258 responder: FuchsiaNetworksRemoveResponder {
1259 control_handle: std::mem::ManuallyDrop::new(control_handle),
1260 tx_id: header.tx_id,
1261 },
1262 })
1263 }
1264 0x27f51e2401662255 => {
1265 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1266 let mut req = fidl::new_empty!(
1267 fidl::encoding::EmptyPayload,
1268 fidl::encoding::DefaultFuchsiaResourceDialect
1269 );
1270 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1271 let control_handle =
1272 FuchsiaNetworksControlHandle { inner: this.inner.clone() };
1273 Ok(FuchsiaNetworksRequest::CheckPresence {
1274 responder: FuchsiaNetworksCheckPresenceResponder {
1275 control_handle: std::mem::ManuallyDrop::new(control_handle),
1276 tx_id: header.tx_id,
1277 },
1278 })
1279 }
1280 _ => Err(fidl::Error::UnknownOrdinal {
1281 ordinal: header.ordinal,
1282 protocol_name:
1283 <FuchsiaNetworksMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1284 }),
1285 }))
1286 },
1287 )
1288 }
1289}
1290
1291#[derive(Debug)]
1296pub enum FuchsiaNetworksRequest {
1297 SetDefault {
1301 network_id: fidl_fuchsia_posix_socket::OptionalUint32,
1302 responder: FuchsiaNetworksSetDefaultResponder,
1303 },
1304 Add { network: Network, responder: FuchsiaNetworksAddResponder },
1309 Update { network: Network, responder: FuchsiaNetworksUpdateResponder },
1313 Remove { network_id: u32, responder: FuchsiaNetworksRemoveResponder },
1317 CheckPresence { responder: FuchsiaNetworksCheckPresenceResponder },
1325}
1326
1327impl FuchsiaNetworksRequest {
1328 #[allow(irrefutable_let_patterns)]
1329 pub fn into_set_default(
1330 self,
1331 ) -> Option<(fidl_fuchsia_posix_socket::OptionalUint32, FuchsiaNetworksSetDefaultResponder)>
1332 {
1333 if let FuchsiaNetworksRequest::SetDefault { network_id, responder } = self {
1334 Some((network_id, responder))
1335 } else {
1336 None
1337 }
1338 }
1339
1340 #[allow(irrefutable_let_patterns)]
1341 pub fn into_add(self) -> Option<(Network, FuchsiaNetworksAddResponder)> {
1342 if let FuchsiaNetworksRequest::Add { network, responder } = self {
1343 Some((network, responder))
1344 } else {
1345 None
1346 }
1347 }
1348
1349 #[allow(irrefutable_let_patterns)]
1350 pub fn into_update(self) -> Option<(Network, FuchsiaNetworksUpdateResponder)> {
1351 if let FuchsiaNetworksRequest::Update { network, responder } = self {
1352 Some((network, responder))
1353 } else {
1354 None
1355 }
1356 }
1357
1358 #[allow(irrefutable_let_patterns)]
1359 pub fn into_remove(self) -> Option<(u32, FuchsiaNetworksRemoveResponder)> {
1360 if let FuchsiaNetworksRequest::Remove { network_id, responder } = self {
1361 Some((network_id, responder))
1362 } else {
1363 None
1364 }
1365 }
1366
1367 #[allow(irrefutable_let_patterns)]
1368 pub fn into_check_presence(self) -> Option<(FuchsiaNetworksCheckPresenceResponder)> {
1369 if let FuchsiaNetworksRequest::CheckPresence { responder } = self {
1370 Some((responder))
1371 } else {
1372 None
1373 }
1374 }
1375
1376 pub fn method_name(&self) -> &'static str {
1378 match *self {
1379 FuchsiaNetworksRequest::SetDefault { .. } => "set_default",
1380 FuchsiaNetworksRequest::Add { .. } => "add",
1381 FuchsiaNetworksRequest::Update { .. } => "update",
1382 FuchsiaNetworksRequest::Remove { .. } => "remove",
1383 FuchsiaNetworksRequest::CheckPresence { .. } => "check_presence",
1384 }
1385 }
1386}
1387
1388#[derive(Debug, Clone)]
1389pub struct FuchsiaNetworksControlHandle {
1390 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1391}
1392
1393impl fidl::endpoints::ControlHandle for FuchsiaNetworksControlHandle {
1394 fn shutdown(&self) {
1395 self.inner.shutdown()
1396 }
1397 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1398 self.inner.shutdown_with_epitaph(status)
1399 }
1400
1401 fn is_closed(&self) -> bool {
1402 self.inner.channel().is_closed()
1403 }
1404 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1405 self.inner.channel().on_closed()
1406 }
1407
1408 #[cfg(target_os = "fuchsia")]
1409 fn signal_peer(
1410 &self,
1411 clear_mask: zx::Signals,
1412 set_mask: zx::Signals,
1413 ) -> Result<(), zx_status::Status> {
1414 use fidl::Peered;
1415 self.inner.channel().signal_peer(clear_mask, set_mask)
1416 }
1417}
1418
1419impl FuchsiaNetworksControlHandle {}
1420
1421#[must_use = "FIDL methods require a response to be sent"]
1422#[derive(Debug)]
1423pub struct FuchsiaNetworksSetDefaultResponder {
1424 control_handle: std::mem::ManuallyDrop<FuchsiaNetworksControlHandle>,
1425 tx_id: u32,
1426}
1427
1428impl std::ops::Drop for FuchsiaNetworksSetDefaultResponder {
1432 fn drop(&mut self) {
1433 self.control_handle.shutdown();
1434 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1436 }
1437}
1438
1439impl fidl::endpoints::Responder for FuchsiaNetworksSetDefaultResponder {
1440 type ControlHandle = FuchsiaNetworksControlHandle;
1441
1442 fn control_handle(&self) -> &FuchsiaNetworksControlHandle {
1443 &self.control_handle
1444 }
1445
1446 fn drop_without_shutdown(mut self) {
1447 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1449 std::mem::forget(self);
1451 }
1452}
1453
1454impl FuchsiaNetworksSetDefaultResponder {
1455 pub fn send(
1459 self,
1460 mut result: Result<(), NetworkRegistrySetDefaultError>,
1461 ) -> Result<(), fidl::Error> {
1462 let _result = self.send_raw(result);
1463 if _result.is_err() {
1464 self.control_handle.shutdown();
1465 }
1466 self.drop_without_shutdown();
1467 _result
1468 }
1469
1470 pub fn send_no_shutdown_on_err(
1472 self,
1473 mut result: Result<(), NetworkRegistrySetDefaultError>,
1474 ) -> Result<(), fidl::Error> {
1475 let _result = self.send_raw(result);
1476 self.drop_without_shutdown();
1477 _result
1478 }
1479
1480 fn send_raw(
1481 &self,
1482 mut result: Result<(), NetworkRegistrySetDefaultError>,
1483 ) -> Result<(), fidl::Error> {
1484 self.control_handle.inner.send::<fidl::encoding::ResultType<
1485 fidl::encoding::EmptyStruct,
1486 NetworkRegistrySetDefaultError,
1487 >>(
1488 result,
1489 self.tx_id,
1490 0x59a90d7826a7f342,
1491 fidl::encoding::DynamicFlags::empty(),
1492 )
1493 }
1494}
1495
1496#[must_use = "FIDL methods require a response to be sent"]
1497#[derive(Debug)]
1498pub struct FuchsiaNetworksAddResponder {
1499 control_handle: std::mem::ManuallyDrop<FuchsiaNetworksControlHandle>,
1500 tx_id: u32,
1501}
1502
1503impl std::ops::Drop for FuchsiaNetworksAddResponder {
1507 fn drop(&mut self) {
1508 self.control_handle.shutdown();
1509 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1511 }
1512}
1513
1514impl fidl::endpoints::Responder for FuchsiaNetworksAddResponder {
1515 type ControlHandle = FuchsiaNetworksControlHandle;
1516
1517 fn control_handle(&self) -> &FuchsiaNetworksControlHandle {
1518 &self.control_handle
1519 }
1520
1521 fn drop_without_shutdown(mut self) {
1522 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1524 std::mem::forget(self);
1526 }
1527}
1528
1529impl FuchsiaNetworksAddResponder {
1530 pub fn send(self, mut result: Result<(), NetworkRegistryAddError>) -> Result<(), fidl::Error> {
1534 let _result = self.send_raw(result);
1535 if _result.is_err() {
1536 self.control_handle.shutdown();
1537 }
1538 self.drop_without_shutdown();
1539 _result
1540 }
1541
1542 pub fn send_no_shutdown_on_err(
1544 self,
1545 mut result: Result<(), NetworkRegistryAddError>,
1546 ) -> Result<(), fidl::Error> {
1547 let _result = self.send_raw(result);
1548 self.drop_without_shutdown();
1549 _result
1550 }
1551
1552 fn send_raw(&self, mut result: Result<(), NetworkRegistryAddError>) -> Result<(), fidl::Error> {
1553 self.control_handle.inner.send::<fidl::encoding::ResultType<
1554 fidl::encoding::EmptyStruct,
1555 NetworkRegistryAddError,
1556 >>(
1557 result,
1558 self.tx_id,
1559 0x4a988855b0fa4f7b,
1560 fidl::encoding::DynamicFlags::empty(),
1561 )
1562 }
1563}
1564
1565#[must_use = "FIDL methods require a response to be sent"]
1566#[derive(Debug)]
1567pub struct FuchsiaNetworksUpdateResponder {
1568 control_handle: std::mem::ManuallyDrop<FuchsiaNetworksControlHandle>,
1569 tx_id: u32,
1570}
1571
1572impl std::ops::Drop for FuchsiaNetworksUpdateResponder {
1576 fn drop(&mut self) {
1577 self.control_handle.shutdown();
1578 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1580 }
1581}
1582
1583impl fidl::endpoints::Responder for FuchsiaNetworksUpdateResponder {
1584 type ControlHandle = FuchsiaNetworksControlHandle;
1585
1586 fn control_handle(&self) -> &FuchsiaNetworksControlHandle {
1587 &self.control_handle
1588 }
1589
1590 fn drop_without_shutdown(mut self) {
1591 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1593 std::mem::forget(self);
1595 }
1596}
1597
1598impl FuchsiaNetworksUpdateResponder {
1599 pub fn send(
1603 self,
1604 mut result: Result<(), NetworkRegistryUpdateError>,
1605 ) -> Result<(), fidl::Error> {
1606 let _result = self.send_raw(result);
1607 if _result.is_err() {
1608 self.control_handle.shutdown();
1609 }
1610 self.drop_without_shutdown();
1611 _result
1612 }
1613
1614 pub fn send_no_shutdown_on_err(
1616 self,
1617 mut result: Result<(), NetworkRegistryUpdateError>,
1618 ) -> Result<(), fidl::Error> {
1619 let _result = self.send_raw(result);
1620 self.drop_without_shutdown();
1621 _result
1622 }
1623
1624 fn send_raw(
1625 &self,
1626 mut result: Result<(), NetworkRegistryUpdateError>,
1627 ) -> Result<(), fidl::Error> {
1628 self.control_handle.inner.send::<fidl::encoding::ResultType<
1629 fidl::encoding::EmptyStruct,
1630 NetworkRegistryUpdateError,
1631 >>(
1632 result,
1633 self.tx_id,
1634 0x460479796e3eadfe,
1635 fidl::encoding::DynamicFlags::empty(),
1636 )
1637 }
1638}
1639
1640#[must_use = "FIDL methods require a response to be sent"]
1641#[derive(Debug)]
1642pub struct FuchsiaNetworksRemoveResponder {
1643 control_handle: std::mem::ManuallyDrop<FuchsiaNetworksControlHandle>,
1644 tx_id: u32,
1645}
1646
1647impl std::ops::Drop for FuchsiaNetworksRemoveResponder {
1651 fn drop(&mut self) {
1652 self.control_handle.shutdown();
1653 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1655 }
1656}
1657
1658impl fidl::endpoints::Responder for FuchsiaNetworksRemoveResponder {
1659 type ControlHandle = FuchsiaNetworksControlHandle;
1660
1661 fn control_handle(&self) -> &FuchsiaNetworksControlHandle {
1662 &self.control_handle
1663 }
1664
1665 fn drop_without_shutdown(mut self) {
1666 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1668 std::mem::forget(self);
1670 }
1671}
1672
1673impl FuchsiaNetworksRemoveResponder {
1674 pub fn send(
1678 self,
1679 mut result: Result<(), NetworkRegistryRemoveError>,
1680 ) -> Result<(), fidl::Error> {
1681 let _result = self.send_raw(result);
1682 if _result.is_err() {
1683 self.control_handle.shutdown();
1684 }
1685 self.drop_without_shutdown();
1686 _result
1687 }
1688
1689 pub fn send_no_shutdown_on_err(
1691 self,
1692 mut result: Result<(), NetworkRegistryRemoveError>,
1693 ) -> Result<(), fidl::Error> {
1694 let _result = self.send_raw(result);
1695 self.drop_without_shutdown();
1696 _result
1697 }
1698
1699 fn send_raw(
1700 &self,
1701 mut result: Result<(), NetworkRegistryRemoveError>,
1702 ) -> Result<(), fidl::Error> {
1703 self.control_handle.inner.send::<fidl::encoding::ResultType<
1704 fidl::encoding::EmptyStruct,
1705 NetworkRegistryRemoveError,
1706 >>(
1707 result,
1708 self.tx_id,
1709 0xe62f98532295a85,
1710 fidl::encoding::DynamicFlags::empty(),
1711 )
1712 }
1713}
1714
1715#[must_use = "FIDL methods require a response to be sent"]
1716#[derive(Debug)]
1717pub struct FuchsiaNetworksCheckPresenceResponder {
1718 control_handle: std::mem::ManuallyDrop<FuchsiaNetworksControlHandle>,
1719 tx_id: u32,
1720}
1721
1722impl std::ops::Drop for FuchsiaNetworksCheckPresenceResponder {
1726 fn drop(&mut self) {
1727 self.control_handle.shutdown();
1728 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1730 }
1731}
1732
1733impl fidl::endpoints::Responder for FuchsiaNetworksCheckPresenceResponder {
1734 type ControlHandle = FuchsiaNetworksControlHandle;
1735
1736 fn control_handle(&self) -> &FuchsiaNetworksControlHandle {
1737 &self.control_handle
1738 }
1739
1740 fn drop_without_shutdown(mut self) {
1741 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1743 std::mem::forget(self);
1745 }
1746}
1747
1748impl FuchsiaNetworksCheckPresenceResponder {
1749 pub fn send(self) -> Result<(), fidl::Error> {
1753 let _result = self.send_raw();
1754 if _result.is_err() {
1755 self.control_handle.shutdown();
1756 }
1757 self.drop_without_shutdown();
1758 _result
1759 }
1760
1761 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1763 let _result = self.send_raw();
1764 self.drop_without_shutdown();
1765 _result
1766 }
1767
1768 fn send_raw(&self) -> Result<(), fidl::Error> {
1769 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1770 (),
1771 self.tx_id,
1772 0x27f51e2401662255,
1773 fidl::encoding::DynamicFlags::empty(),
1774 )
1775 }
1776}
1777
1778#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1779pub struct NetworkRegistryMarker;
1780
1781impl fidl::endpoints::ProtocolMarker for NetworkRegistryMarker {
1782 type Proxy = NetworkRegistryProxy;
1783 type RequestStream = NetworkRegistryRequestStream;
1784 #[cfg(target_os = "fuchsia")]
1785 type SynchronousProxy = NetworkRegistrySynchronousProxy;
1786
1787 const DEBUG_NAME: &'static str = "(anonymous) NetworkRegistry";
1788}
1789pub type NetworkRegistrySetDefaultResult = Result<(), NetworkRegistrySetDefaultError>;
1790pub type NetworkRegistryAddResult = Result<(), NetworkRegistryAddError>;
1791pub type NetworkRegistryUpdateResult = Result<(), NetworkRegistryUpdateError>;
1792pub type NetworkRegistryRemoveResult = Result<(), NetworkRegistryRemoveError>;
1793
1794pub trait NetworkRegistryProxyInterface: Send + Sync {
1795 type SetDefaultResponseFut: std::future::Future<Output = Result<NetworkRegistrySetDefaultResult, fidl::Error>>
1796 + Send;
1797 fn r#set_default(
1798 &self,
1799 network_id: &fidl_fuchsia_posix_socket::OptionalUint32,
1800 ) -> Self::SetDefaultResponseFut;
1801 type AddResponseFut: std::future::Future<Output = Result<NetworkRegistryAddResult, fidl::Error>>
1802 + Send;
1803 fn r#add(&self, network: &Network) -> Self::AddResponseFut;
1804 type UpdateResponseFut: std::future::Future<Output = Result<NetworkRegistryUpdateResult, fidl::Error>>
1805 + Send;
1806 fn r#update(&self, network: &Network) -> Self::UpdateResponseFut;
1807 type RemoveResponseFut: std::future::Future<Output = Result<NetworkRegistryRemoveResult, fidl::Error>>
1808 + Send;
1809 fn r#remove(&self, network_id: u32) -> Self::RemoveResponseFut;
1810 type CheckPresenceResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1811 fn r#check_presence(&self) -> Self::CheckPresenceResponseFut;
1812}
1813#[derive(Debug)]
1814#[cfg(target_os = "fuchsia")]
1815pub struct NetworkRegistrySynchronousProxy {
1816 client: fidl::client::sync::Client,
1817}
1818
1819#[cfg(target_os = "fuchsia")]
1820impl fidl::endpoints::SynchronousProxy for NetworkRegistrySynchronousProxy {
1821 type Proxy = NetworkRegistryProxy;
1822 type Protocol = NetworkRegistryMarker;
1823
1824 fn from_channel(inner: fidl::Channel) -> Self {
1825 Self::new(inner)
1826 }
1827
1828 fn into_channel(self) -> fidl::Channel {
1829 self.client.into_channel()
1830 }
1831
1832 fn as_channel(&self) -> &fidl::Channel {
1833 self.client.as_channel()
1834 }
1835}
1836
1837#[cfg(target_os = "fuchsia")]
1838impl NetworkRegistrySynchronousProxy {
1839 pub fn new(channel: fidl::Channel) -> Self {
1840 let protocol_name = <NetworkRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1841 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1842 }
1843
1844 pub fn into_channel(self) -> fidl::Channel {
1845 self.client.into_channel()
1846 }
1847
1848 pub fn wait_for_event(
1851 &self,
1852 deadline: zx::MonotonicInstant,
1853 ) -> Result<NetworkRegistryEvent, fidl::Error> {
1854 NetworkRegistryEvent::decode(self.client.wait_for_event(deadline)?)
1855 }
1856
1857 pub fn r#set_default(
1861 &self,
1862 mut network_id: &fidl_fuchsia_posix_socket::OptionalUint32,
1863 ___deadline: zx::MonotonicInstant,
1864 ) -> Result<NetworkRegistrySetDefaultResult, fidl::Error> {
1865 let _response =
1866 self.client.send_query::<NetworkRegistrySetDefaultRequest, fidl::encoding::ResultType<
1867 fidl::encoding::EmptyStruct,
1868 NetworkRegistrySetDefaultError,
1869 >>(
1870 (network_id,),
1871 0x59a90d7826a7f342,
1872 fidl::encoding::DynamicFlags::empty(),
1873 ___deadline,
1874 )?;
1875 Ok(_response.map(|x| x))
1876 }
1877
1878 pub fn r#add(
1883 &self,
1884 mut network: &Network,
1885 ___deadline: zx::MonotonicInstant,
1886 ) -> Result<NetworkRegistryAddResult, fidl::Error> {
1887 let _response =
1888 self.client.send_query::<NetworkRegistryAddRequest, fidl::encoding::ResultType<
1889 fidl::encoding::EmptyStruct,
1890 NetworkRegistryAddError,
1891 >>(
1892 (network,),
1893 0x4a988855b0fa4f7b,
1894 fidl::encoding::DynamicFlags::empty(),
1895 ___deadline,
1896 )?;
1897 Ok(_response.map(|x| x))
1898 }
1899
1900 pub fn r#update(
1904 &self,
1905 mut network: &Network,
1906 ___deadline: zx::MonotonicInstant,
1907 ) -> Result<NetworkRegistryUpdateResult, fidl::Error> {
1908 let _response =
1909 self.client.send_query::<NetworkRegistryUpdateRequest, fidl::encoding::ResultType<
1910 fidl::encoding::EmptyStruct,
1911 NetworkRegistryUpdateError,
1912 >>(
1913 (network,),
1914 0x460479796e3eadfe,
1915 fidl::encoding::DynamicFlags::empty(),
1916 ___deadline,
1917 )?;
1918 Ok(_response.map(|x| x))
1919 }
1920
1921 pub fn r#remove(
1925 &self,
1926 mut network_id: u32,
1927 ___deadline: zx::MonotonicInstant,
1928 ) -> Result<NetworkRegistryRemoveResult, fidl::Error> {
1929 let _response =
1930 self.client.send_query::<NetworkRegistryRemoveRequest, fidl::encoding::ResultType<
1931 fidl::encoding::EmptyStruct,
1932 NetworkRegistryRemoveError,
1933 >>(
1934 (network_id,),
1935 0xe62f98532295a85,
1936 fidl::encoding::DynamicFlags::empty(),
1937 ___deadline,
1938 )?;
1939 Ok(_response.map(|x| x))
1940 }
1941
1942 pub fn r#check_presence(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
1950 let _response =
1951 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
1952 (),
1953 0x27f51e2401662255,
1954 fidl::encoding::DynamicFlags::empty(),
1955 ___deadline,
1956 )?;
1957 Ok(_response)
1958 }
1959}
1960
1961#[cfg(target_os = "fuchsia")]
1962impl From<NetworkRegistrySynchronousProxy> for zx::Handle {
1963 fn from(value: NetworkRegistrySynchronousProxy) -> Self {
1964 value.into_channel().into()
1965 }
1966}
1967
1968#[cfg(target_os = "fuchsia")]
1969impl From<fidl::Channel> for NetworkRegistrySynchronousProxy {
1970 fn from(value: fidl::Channel) -> Self {
1971 Self::new(value)
1972 }
1973}
1974
1975#[derive(Debug, Clone)]
1976pub struct NetworkRegistryProxy {
1977 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1978}
1979
1980impl fidl::endpoints::Proxy for NetworkRegistryProxy {
1981 type Protocol = NetworkRegistryMarker;
1982
1983 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1984 Self::new(inner)
1985 }
1986
1987 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1988 self.client.into_channel().map_err(|client| Self { client })
1989 }
1990
1991 fn as_channel(&self) -> &::fidl::AsyncChannel {
1992 self.client.as_channel()
1993 }
1994}
1995
1996impl NetworkRegistryProxy {
1997 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1999 let protocol_name = <NetworkRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2000 Self { client: fidl::client::Client::new(channel, protocol_name) }
2001 }
2002
2003 pub fn take_event_stream(&self) -> NetworkRegistryEventStream {
2009 NetworkRegistryEventStream { event_receiver: self.client.take_event_receiver() }
2010 }
2011
2012 pub fn r#set_default(
2016 &self,
2017 mut network_id: &fidl_fuchsia_posix_socket::OptionalUint32,
2018 ) -> fidl::client::QueryResponseFut<
2019 NetworkRegistrySetDefaultResult,
2020 fidl::encoding::DefaultFuchsiaResourceDialect,
2021 > {
2022 NetworkRegistryProxyInterface::r#set_default(self, network_id)
2023 }
2024
2025 pub fn r#add(
2030 &self,
2031 mut network: &Network,
2032 ) -> fidl::client::QueryResponseFut<
2033 NetworkRegistryAddResult,
2034 fidl::encoding::DefaultFuchsiaResourceDialect,
2035 > {
2036 NetworkRegistryProxyInterface::r#add(self, network)
2037 }
2038
2039 pub fn r#update(
2043 &self,
2044 mut network: &Network,
2045 ) -> fidl::client::QueryResponseFut<
2046 NetworkRegistryUpdateResult,
2047 fidl::encoding::DefaultFuchsiaResourceDialect,
2048 > {
2049 NetworkRegistryProxyInterface::r#update(self, network)
2050 }
2051
2052 pub fn r#remove(
2056 &self,
2057 mut network_id: u32,
2058 ) -> fidl::client::QueryResponseFut<
2059 NetworkRegistryRemoveResult,
2060 fidl::encoding::DefaultFuchsiaResourceDialect,
2061 > {
2062 NetworkRegistryProxyInterface::r#remove(self, network_id)
2063 }
2064
2065 pub fn r#check_presence(
2073 &self,
2074 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2075 NetworkRegistryProxyInterface::r#check_presence(self)
2076 }
2077}
2078
2079impl NetworkRegistryProxyInterface for NetworkRegistryProxy {
2080 type SetDefaultResponseFut = fidl::client::QueryResponseFut<
2081 NetworkRegistrySetDefaultResult,
2082 fidl::encoding::DefaultFuchsiaResourceDialect,
2083 >;
2084 fn r#set_default(
2085 &self,
2086 mut network_id: &fidl_fuchsia_posix_socket::OptionalUint32,
2087 ) -> Self::SetDefaultResponseFut {
2088 fn _decode(
2089 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2090 ) -> Result<NetworkRegistrySetDefaultResult, fidl::Error> {
2091 let _response = fidl::client::decode_transaction_body::<
2092 fidl::encoding::ResultType<
2093 fidl::encoding::EmptyStruct,
2094 NetworkRegistrySetDefaultError,
2095 >,
2096 fidl::encoding::DefaultFuchsiaResourceDialect,
2097 0x59a90d7826a7f342,
2098 >(_buf?)?;
2099 Ok(_response.map(|x| x))
2100 }
2101 self.client.send_query_and_decode::<
2102 NetworkRegistrySetDefaultRequest,
2103 NetworkRegistrySetDefaultResult,
2104 >(
2105 (network_id,),
2106 0x59a90d7826a7f342,
2107 fidl::encoding::DynamicFlags::empty(),
2108 _decode,
2109 )
2110 }
2111
2112 type AddResponseFut = fidl::client::QueryResponseFut<
2113 NetworkRegistryAddResult,
2114 fidl::encoding::DefaultFuchsiaResourceDialect,
2115 >;
2116 fn r#add(&self, mut network: &Network) -> Self::AddResponseFut {
2117 fn _decode(
2118 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2119 ) -> Result<NetworkRegistryAddResult, fidl::Error> {
2120 let _response = fidl::client::decode_transaction_body::<
2121 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, NetworkRegistryAddError>,
2122 fidl::encoding::DefaultFuchsiaResourceDialect,
2123 0x4a988855b0fa4f7b,
2124 >(_buf?)?;
2125 Ok(_response.map(|x| x))
2126 }
2127 self.client.send_query_and_decode::<NetworkRegistryAddRequest, NetworkRegistryAddResult>(
2128 (network,),
2129 0x4a988855b0fa4f7b,
2130 fidl::encoding::DynamicFlags::empty(),
2131 _decode,
2132 )
2133 }
2134
2135 type UpdateResponseFut = fidl::client::QueryResponseFut<
2136 NetworkRegistryUpdateResult,
2137 fidl::encoding::DefaultFuchsiaResourceDialect,
2138 >;
2139 fn r#update(&self, mut network: &Network) -> Self::UpdateResponseFut {
2140 fn _decode(
2141 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2142 ) -> Result<NetworkRegistryUpdateResult, fidl::Error> {
2143 let _response = fidl::client::decode_transaction_body::<
2144 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, NetworkRegistryUpdateError>,
2145 fidl::encoding::DefaultFuchsiaResourceDialect,
2146 0x460479796e3eadfe,
2147 >(_buf?)?;
2148 Ok(_response.map(|x| x))
2149 }
2150 self.client
2151 .send_query_and_decode::<NetworkRegistryUpdateRequest, NetworkRegistryUpdateResult>(
2152 (network,),
2153 0x460479796e3eadfe,
2154 fidl::encoding::DynamicFlags::empty(),
2155 _decode,
2156 )
2157 }
2158
2159 type RemoveResponseFut = fidl::client::QueryResponseFut<
2160 NetworkRegistryRemoveResult,
2161 fidl::encoding::DefaultFuchsiaResourceDialect,
2162 >;
2163 fn r#remove(&self, mut network_id: u32) -> Self::RemoveResponseFut {
2164 fn _decode(
2165 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2166 ) -> Result<NetworkRegistryRemoveResult, fidl::Error> {
2167 let _response = fidl::client::decode_transaction_body::<
2168 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, NetworkRegistryRemoveError>,
2169 fidl::encoding::DefaultFuchsiaResourceDialect,
2170 0xe62f98532295a85,
2171 >(_buf?)?;
2172 Ok(_response.map(|x| x))
2173 }
2174 self.client
2175 .send_query_and_decode::<NetworkRegistryRemoveRequest, NetworkRegistryRemoveResult>(
2176 (network_id,),
2177 0xe62f98532295a85,
2178 fidl::encoding::DynamicFlags::empty(),
2179 _decode,
2180 )
2181 }
2182
2183 type CheckPresenceResponseFut =
2184 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2185 fn r#check_presence(&self) -> Self::CheckPresenceResponseFut {
2186 fn _decode(
2187 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2188 ) -> Result<(), fidl::Error> {
2189 let _response = fidl::client::decode_transaction_body::<
2190 fidl::encoding::EmptyPayload,
2191 fidl::encoding::DefaultFuchsiaResourceDialect,
2192 0x27f51e2401662255,
2193 >(_buf?)?;
2194 Ok(_response)
2195 }
2196 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
2197 (),
2198 0x27f51e2401662255,
2199 fidl::encoding::DynamicFlags::empty(),
2200 _decode,
2201 )
2202 }
2203}
2204
2205pub struct NetworkRegistryEventStream {
2206 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2207}
2208
2209impl std::marker::Unpin for NetworkRegistryEventStream {}
2210
2211impl futures::stream::FusedStream for NetworkRegistryEventStream {
2212 fn is_terminated(&self) -> bool {
2213 self.event_receiver.is_terminated()
2214 }
2215}
2216
2217impl futures::Stream for NetworkRegistryEventStream {
2218 type Item = Result<NetworkRegistryEvent, fidl::Error>;
2219
2220 fn poll_next(
2221 mut self: std::pin::Pin<&mut Self>,
2222 cx: &mut std::task::Context<'_>,
2223 ) -> std::task::Poll<Option<Self::Item>> {
2224 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2225 &mut self.event_receiver,
2226 cx
2227 )?) {
2228 Some(buf) => std::task::Poll::Ready(Some(NetworkRegistryEvent::decode(buf))),
2229 None => std::task::Poll::Ready(None),
2230 }
2231 }
2232}
2233
2234#[derive(Debug)]
2235pub enum NetworkRegistryEvent {}
2236
2237impl NetworkRegistryEvent {
2238 fn decode(
2240 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2241 ) -> Result<NetworkRegistryEvent, fidl::Error> {
2242 let (bytes, _handles) = buf.split_mut();
2243 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2244 debug_assert_eq!(tx_header.tx_id, 0);
2245 match tx_header.ordinal {
2246 _ => Err(fidl::Error::UnknownOrdinal {
2247 ordinal: tx_header.ordinal,
2248 protocol_name:
2249 <NetworkRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2250 }),
2251 }
2252 }
2253}
2254
2255pub struct NetworkRegistryRequestStream {
2257 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2258 is_terminated: bool,
2259}
2260
2261impl std::marker::Unpin for NetworkRegistryRequestStream {}
2262
2263impl futures::stream::FusedStream for NetworkRegistryRequestStream {
2264 fn is_terminated(&self) -> bool {
2265 self.is_terminated
2266 }
2267}
2268
2269impl fidl::endpoints::RequestStream for NetworkRegistryRequestStream {
2270 type Protocol = NetworkRegistryMarker;
2271 type ControlHandle = NetworkRegistryControlHandle;
2272
2273 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2274 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2275 }
2276
2277 fn control_handle(&self) -> Self::ControlHandle {
2278 NetworkRegistryControlHandle { inner: self.inner.clone() }
2279 }
2280
2281 fn into_inner(
2282 self,
2283 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2284 {
2285 (self.inner, self.is_terminated)
2286 }
2287
2288 fn from_inner(
2289 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2290 is_terminated: bool,
2291 ) -> Self {
2292 Self { inner, is_terminated }
2293 }
2294}
2295
2296impl futures::Stream for NetworkRegistryRequestStream {
2297 type Item = Result<NetworkRegistryRequest, fidl::Error>;
2298
2299 fn poll_next(
2300 mut self: std::pin::Pin<&mut Self>,
2301 cx: &mut std::task::Context<'_>,
2302 ) -> std::task::Poll<Option<Self::Item>> {
2303 let this = &mut *self;
2304 if this.inner.check_shutdown(cx) {
2305 this.is_terminated = true;
2306 return std::task::Poll::Ready(None);
2307 }
2308 if this.is_terminated {
2309 panic!("polled NetworkRegistryRequestStream after completion");
2310 }
2311 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2312 |bytes, handles| {
2313 match this.inner.channel().read_etc(cx, bytes, handles) {
2314 std::task::Poll::Ready(Ok(())) => {}
2315 std::task::Poll::Pending => return std::task::Poll::Pending,
2316 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2317 this.is_terminated = true;
2318 return std::task::Poll::Ready(None);
2319 }
2320 std::task::Poll::Ready(Err(e)) => {
2321 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2322 e.into(),
2323 ))))
2324 }
2325 }
2326
2327 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2329
2330 std::task::Poll::Ready(Some(match header.ordinal {
2331 0x59a90d7826a7f342 => {
2332 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2333 let mut req = fidl::new_empty!(
2334 NetworkRegistrySetDefaultRequest,
2335 fidl::encoding::DefaultFuchsiaResourceDialect
2336 );
2337 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkRegistrySetDefaultRequest>(&header, _body_bytes, handles, &mut req)?;
2338 let control_handle =
2339 NetworkRegistryControlHandle { inner: this.inner.clone() };
2340 Ok(NetworkRegistryRequest::SetDefault {
2341 network_id: req.network_id,
2342
2343 responder: NetworkRegistrySetDefaultResponder {
2344 control_handle: std::mem::ManuallyDrop::new(control_handle),
2345 tx_id: header.tx_id,
2346 },
2347 })
2348 }
2349 0x4a988855b0fa4f7b => {
2350 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2351 let mut req = fidl::new_empty!(
2352 NetworkRegistryAddRequest,
2353 fidl::encoding::DefaultFuchsiaResourceDialect
2354 );
2355 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkRegistryAddRequest>(&header, _body_bytes, handles, &mut req)?;
2356 let control_handle =
2357 NetworkRegistryControlHandle { inner: this.inner.clone() };
2358 Ok(NetworkRegistryRequest::Add {
2359 network: req.network,
2360
2361 responder: NetworkRegistryAddResponder {
2362 control_handle: std::mem::ManuallyDrop::new(control_handle),
2363 tx_id: header.tx_id,
2364 },
2365 })
2366 }
2367 0x460479796e3eadfe => {
2368 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2369 let mut req = fidl::new_empty!(
2370 NetworkRegistryUpdateRequest,
2371 fidl::encoding::DefaultFuchsiaResourceDialect
2372 );
2373 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkRegistryUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
2374 let control_handle =
2375 NetworkRegistryControlHandle { inner: this.inner.clone() };
2376 Ok(NetworkRegistryRequest::Update {
2377 network: req.network,
2378
2379 responder: NetworkRegistryUpdateResponder {
2380 control_handle: std::mem::ManuallyDrop::new(control_handle),
2381 tx_id: header.tx_id,
2382 },
2383 })
2384 }
2385 0xe62f98532295a85 => {
2386 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2387 let mut req = fidl::new_empty!(
2388 NetworkRegistryRemoveRequest,
2389 fidl::encoding::DefaultFuchsiaResourceDialect
2390 );
2391 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkRegistryRemoveRequest>(&header, _body_bytes, handles, &mut req)?;
2392 let control_handle =
2393 NetworkRegistryControlHandle { inner: this.inner.clone() };
2394 Ok(NetworkRegistryRequest::Remove {
2395 network_id: req.network_id,
2396
2397 responder: NetworkRegistryRemoveResponder {
2398 control_handle: std::mem::ManuallyDrop::new(control_handle),
2399 tx_id: header.tx_id,
2400 },
2401 })
2402 }
2403 0x27f51e2401662255 => {
2404 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2405 let mut req = fidl::new_empty!(
2406 fidl::encoding::EmptyPayload,
2407 fidl::encoding::DefaultFuchsiaResourceDialect
2408 );
2409 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2410 let control_handle =
2411 NetworkRegistryControlHandle { inner: this.inner.clone() };
2412 Ok(NetworkRegistryRequest::CheckPresence {
2413 responder: NetworkRegistryCheckPresenceResponder {
2414 control_handle: std::mem::ManuallyDrop::new(control_handle),
2415 tx_id: header.tx_id,
2416 },
2417 })
2418 }
2419 _ => Err(fidl::Error::UnknownOrdinal {
2420 ordinal: header.ordinal,
2421 protocol_name:
2422 <NetworkRegistryMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2423 }),
2424 }))
2425 },
2426 )
2427 }
2428}
2429
2430#[derive(Debug)]
2431pub enum NetworkRegistryRequest {
2432 SetDefault {
2436 network_id: fidl_fuchsia_posix_socket::OptionalUint32,
2437 responder: NetworkRegistrySetDefaultResponder,
2438 },
2439 Add { network: Network, responder: NetworkRegistryAddResponder },
2444 Update { network: Network, responder: NetworkRegistryUpdateResponder },
2448 Remove { network_id: u32, responder: NetworkRegistryRemoveResponder },
2452 CheckPresence { responder: NetworkRegistryCheckPresenceResponder },
2460}
2461
2462impl NetworkRegistryRequest {
2463 #[allow(irrefutable_let_patterns)]
2464 pub fn into_set_default(
2465 self,
2466 ) -> Option<(fidl_fuchsia_posix_socket::OptionalUint32, NetworkRegistrySetDefaultResponder)>
2467 {
2468 if let NetworkRegistryRequest::SetDefault { network_id, responder } = self {
2469 Some((network_id, responder))
2470 } else {
2471 None
2472 }
2473 }
2474
2475 #[allow(irrefutable_let_patterns)]
2476 pub fn into_add(self) -> Option<(Network, NetworkRegistryAddResponder)> {
2477 if let NetworkRegistryRequest::Add { network, responder } = self {
2478 Some((network, responder))
2479 } else {
2480 None
2481 }
2482 }
2483
2484 #[allow(irrefutable_let_patterns)]
2485 pub fn into_update(self) -> Option<(Network, NetworkRegistryUpdateResponder)> {
2486 if let NetworkRegistryRequest::Update { network, responder } = self {
2487 Some((network, responder))
2488 } else {
2489 None
2490 }
2491 }
2492
2493 #[allow(irrefutable_let_patterns)]
2494 pub fn into_remove(self) -> Option<(u32, NetworkRegistryRemoveResponder)> {
2495 if let NetworkRegistryRequest::Remove { network_id, responder } = self {
2496 Some((network_id, responder))
2497 } else {
2498 None
2499 }
2500 }
2501
2502 #[allow(irrefutable_let_patterns)]
2503 pub fn into_check_presence(self) -> Option<(NetworkRegistryCheckPresenceResponder)> {
2504 if let NetworkRegistryRequest::CheckPresence { responder } = self {
2505 Some((responder))
2506 } else {
2507 None
2508 }
2509 }
2510
2511 pub fn method_name(&self) -> &'static str {
2513 match *self {
2514 NetworkRegistryRequest::SetDefault { .. } => "set_default",
2515 NetworkRegistryRequest::Add { .. } => "add",
2516 NetworkRegistryRequest::Update { .. } => "update",
2517 NetworkRegistryRequest::Remove { .. } => "remove",
2518 NetworkRegistryRequest::CheckPresence { .. } => "check_presence",
2519 }
2520 }
2521}
2522
2523#[derive(Debug, Clone)]
2524pub struct NetworkRegistryControlHandle {
2525 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2526}
2527
2528impl fidl::endpoints::ControlHandle for NetworkRegistryControlHandle {
2529 fn shutdown(&self) {
2530 self.inner.shutdown()
2531 }
2532 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2533 self.inner.shutdown_with_epitaph(status)
2534 }
2535
2536 fn is_closed(&self) -> bool {
2537 self.inner.channel().is_closed()
2538 }
2539 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2540 self.inner.channel().on_closed()
2541 }
2542
2543 #[cfg(target_os = "fuchsia")]
2544 fn signal_peer(
2545 &self,
2546 clear_mask: zx::Signals,
2547 set_mask: zx::Signals,
2548 ) -> Result<(), zx_status::Status> {
2549 use fidl::Peered;
2550 self.inner.channel().signal_peer(clear_mask, set_mask)
2551 }
2552}
2553
2554impl NetworkRegistryControlHandle {}
2555
2556#[must_use = "FIDL methods require a response to be sent"]
2557#[derive(Debug)]
2558pub struct NetworkRegistrySetDefaultResponder {
2559 control_handle: std::mem::ManuallyDrop<NetworkRegistryControlHandle>,
2560 tx_id: u32,
2561}
2562
2563impl std::ops::Drop for NetworkRegistrySetDefaultResponder {
2567 fn drop(&mut self) {
2568 self.control_handle.shutdown();
2569 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2571 }
2572}
2573
2574impl fidl::endpoints::Responder for NetworkRegistrySetDefaultResponder {
2575 type ControlHandle = NetworkRegistryControlHandle;
2576
2577 fn control_handle(&self) -> &NetworkRegistryControlHandle {
2578 &self.control_handle
2579 }
2580
2581 fn drop_without_shutdown(mut self) {
2582 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2584 std::mem::forget(self);
2586 }
2587}
2588
2589impl NetworkRegistrySetDefaultResponder {
2590 pub fn send(
2594 self,
2595 mut result: Result<(), NetworkRegistrySetDefaultError>,
2596 ) -> Result<(), fidl::Error> {
2597 let _result = self.send_raw(result);
2598 if _result.is_err() {
2599 self.control_handle.shutdown();
2600 }
2601 self.drop_without_shutdown();
2602 _result
2603 }
2604
2605 pub fn send_no_shutdown_on_err(
2607 self,
2608 mut result: Result<(), NetworkRegistrySetDefaultError>,
2609 ) -> Result<(), fidl::Error> {
2610 let _result = self.send_raw(result);
2611 self.drop_without_shutdown();
2612 _result
2613 }
2614
2615 fn send_raw(
2616 &self,
2617 mut result: Result<(), NetworkRegistrySetDefaultError>,
2618 ) -> Result<(), fidl::Error> {
2619 self.control_handle.inner.send::<fidl::encoding::ResultType<
2620 fidl::encoding::EmptyStruct,
2621 NetworkRegistrySetDefaultError,
2622 >>(
2623 result,
2624 self.tx_id,
2625 0x59a90d7826a7f342,
2626 fidl::encoding::DynamicFlags::empty(),
2627 )
2628 }
2629}
2630
2631#[must_use = "FIDL methods require a response to be sent"]
2632#[derive(Debug)]
2633pub struct NetworkRegistryAddResponder {
2634 control_handle: std::mem::ManuallyDrop<NetworkRegistryControlHandle>,
2635 tx_id: u32,
2636}
2637
2638impl std::ops::Drop for NetworkRegistryAddResponder {
2642 fn drop(&mut self) {
2643 self.control_handle.shutdown();
2644 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2646 }
2647}
2648
2649impl fidl::endpoints::Responder for NetworkRegistryAddResponder {
2650 type ControlHandle = NetworkRegistryControlHandle;
2651
2652 fn control_handle(&self) -> &NetworkRegistryControlHandle {
2653 &self.control_handle
2654 }
2655
2656 fn drop_without_shutdown(mut self) {
2657 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2659 std::mem::forget(self);
2661 }
2662}
2663
2664impl NetworkRegistryAddResponder {
2665 pub fn send(self, mut result: Result<(), NetworkRegistryAddError>) -> Result<(), fidl::Error> {
2669 let _result = self.send_raw(result);
2670 if _result.is_err() {
2671 self.control_handle.shutdown();
2672 }
2673 self.drop_without_shutdown();
2674 _result
2675 }
2676
2677 pub fn send_no_shutdown_on_err(
2679 self,
2680 mut result: Result<(), NetworkRegistryAddError>,
2681 ) -> Result<(), fidl::Error> {
2682 let _result = self.send_raw(result);
2683 self.drop_without_shutdown();
2684 _result
2685 }
2686
2687 fn send_raw(&self, mut result: Result<(), NetworkRegistryAddError>) -> Result<(), fidl::Error> {
2688 self.control_handle.inner.send::<fidl::encoding::ResultType<
2689 fidl::encoding::EmptyStruct,
2690 NetworkRegistryAddError,
2691 >>(
2692 result,
2693 self.tx_id,
2694 0x4a988855b0fa4f7b,
2695 fidl::encoding::DynamicFlags::empty(),
2696 )
2697 }
2698}
2699
2700#[must_use = "FIDL methods require a response to be sent"]
2701#[derive(Debug)]
2702pub struct NetworkRegistryUpdateResponder {
2703 control_handle: std::mem::ManuallyDrop<NetworkRegistryControlHandle>,
2704 tx_id: u32,
2705}
2706
2707impl std::ops::Drop for NetworkRegistryUpdateResponder {
2711 fn drop(&mut self) {
2712 self.control_handle.shutdown();
2713 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2715 }
2716}
2717
2718impl fidl::endpoints::Responder for NetworkRegistryUpdateResponder {
2719 type ControlHandle = NetworkRegistryControlHandle;
2720
2721 fn control_handle(&self) -> &NetworkRegistryControlHandle {
2722 &self.control_handle
2723 }
2724
2725 fn drop_without_shutdown(mut self) {
2726 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2728 std::mem::forget(self);
2730 }
2731}
2732
2733impl NetworkRegistryUpdateResponder {
2734 pub fn send(
2738 self,
2739 mut result: Result<(), NetworkRegistryUpdateError>,
2740 ) -> Result<(), fidl::Error> {
2741 let _result = self.send_raw(result);
2742 if _result.is_err() {
2743 self.control_handle.shutdown();
2744 }
2745 self.drop_without_shutdown();
2746 _result
2747 }
2748
2749 pub fn send_no_shutdown_on_err(
2751 self,
2752 mut result: Result<(), NetworkRegistryUpdateError>,
2753 ) -> Result<(), fidl::Error> {
2754 let _result = self.send_raw(result);
2755 self.drop_without_shutdown();
2756 _result
2757 }
2758
2759 fn send_raw(
2760 &self,
2761 mut result: Result<(), NetworkRegistryUpdateError>,
2762 ) -> Result<(), fidl::Error> {
2763 self.control_handle.inner.send::<fidl::encoding::ResultType<
2764 fidl::encoding::EmptyStruct,
2765 NetworkRegistryUpdateError,
2766 >>(
2767 result,
2768 self.tx_id,
2769 0x460479796e3eadfe,
2770 fidl::encoding::DynamicFlags::empty(),
2771 )
2772 }
2773}
2774
2775#[must_use = "FIDL methods require a response to be sent"]
2776#[derive(Debug)]
2777pub struct NetworkRegistryRemoveResponder {
2778 control_handle: std::mem::ManuallyDrop<NetworkRegistryControlHandle>,
2779 tx_id: u32,
2780}
2781
2782impl std::ops::Drop for NetworkRegistryRemoveResponder {
2786 fn drop(&mut self) {
2787 self.control_handle.shutdown();
2788 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2790 }
2791}
2792
2793impl fidl::endpoints::Responder for NetworkRegistryRemoveResponder {
2794 type ControlHandle = NetworkRegistryControlHandle;
2795
2796 fn control_handle(&self) -> &NetworkRegistryControlHandle {
2797 &self.control_handle
2798 }
2799
2800 fn drop_without_shutdown(mut self) {
2801 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2803 std::mem::forget(self);
2805 }
2806}
2807
2808impl NetworkRegistryRemoveResponder {
2809 pub fn send(
2813 self,
2814 mut result: Result<(), NetworkRegistryRemoveError>,
2815 ) -> Result<(), fidl::Error> {
2816 let _result = self.send_raw(result);
2817 if _result.is_err() {
2818 self.control_handle.shutdown();
2819 }
2820 self.drop_without_shutdown();
2821 _result
2822 }
2823
2824 pub fn send_no_shutdown_on_err(
2826 self,
2827 mut result: Result<(), NetworkRegistryRemoveError>,
2828 ) -> Result<(), fidl::Error> {
2829 let _result = self.send_raw(result);
2830 self.drop_without_shutdown();
2831 _result
2832 }
2833
2834 fn send_raw(
2835 &self,
2836 mut result: Result<(), NetworkRegistryRemoveError>,
2837 ) -> Result<(), fidl::Error> {
2838 self.control_handle.inner.send::<fidl::encoding::ResultType<
2839 fidl::encoding::EmptyStruct,
2840 NetworkRegistryRemoveError,
2841 >>(
2842 result,
2843 self.tx_id,
2844 0xe62f98532295a85,
2845 fidl::encoding::DynamicFlags::empty(),
2846 )
2847 }
2848}
2849
2850#[must_use = "FIDL methods require a response to be sent"]
2851#[derive(Debug)]
2852pub struct NetworkRegistryCheckPresenceResponder {
2853 control_handle: std::mem::ManuallyDrop<NetworkRegistryControlHandle>,
2854 tx_id: u32,
2855}
2856
2857impl std::ops::Drop for NetworkRegistryCheckPresenceResponder {
2861 fn drop(&mut self) {
2862 self.control_handle.shutdown();
2863 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2865 }
2866}
2867
2868impl fidl::endpoints::Responder for NetworkRegistryCheckPresenceResponder {
2869 type ControlHandle = NetworkRegistryControlHandle;
2870
2871 fn control_handle(&self) -> &NetworkRegistryControlHandle {
2872 &self.control_handle
2873 }
2874
2875 fn drop_without_shutdown(mut self) {
2876 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2878 std::mem::forget(self);
2880 }
2881}
2882
2883impl NetworkRegistryCheckPresenceResponder {
2884 pub fn send(self) -> Result<(), fidl::Error> {
2888 let _result = self.send_raw();
2889 if _result.is_err() {
2890 self.control_handle.shutdown();
2891 }
2892 self.drop_without_shutdown();
2893 _result
2894 }
2895
2896 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2898 let _result = self.send_raw();
2899 self.drop_without_shutdown();
2900 _result
2901 }
2902
2903 fn send_raw(&self) -> Result<(), fidl::Error> {
2904 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2905 (),
2906 self.tx_id,
2907 0x27f51e2401662255,
2908 fidl::encoding::DynamicFlags::empty(),
2909 )
2910 }
2911}
2912
2913#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2914pub struct StarnixNetworksMarker;
2915
2916impl fidl::endpoints::ProtocolMarker for StarnixNetworksMarker {
2917 type Proxy = StarnixNetworksProxy;
2918 type RequestStream = StarnixNetworksRequestStream;
2919 #[cfg(target_os = "fuchsia")]
2920 type SynchronousProxy = StarnixNetworksSynchronousProxy;
2921
2922 const DEBUG_NAME: &'static str = "fuchsia.netpol.socketproxy.StarnixNetworks";
2923}
2924impl fidl::endpoints::DiscoverableProtocolMarker for StarnixNetworksMarker {}
2925
2926pub trait StarnixNetworksProxyInterface: Send + Sync {
2927 type SetDefaultResponseFut: std::future::Future<Output = Result<NetworkRegistrySetDefaultResult, fidl::Error>>
2928 + Send;
2929 fn r#set_default(
2930 &self,
2931 network_id: &fidl_fuchsia_posix_socket::OptionalUint32,
2932 ) -> Self::SetDefaultResponseFut;
2933 type AddResponseFut: std::future::Future<Output = Result<NetworkRegistryAddResult, fidl::Error>>
2934 + Send;
2935 fn r#add(&self, network: &Network) -> Self::AddResponseFut;
2936 type UpdateResponseFut: std::future::Future<Output = Result<NetworkRegistryUpdateResult, fidl::Error>>
2937 + Send;
2938 fn r#update(&self, network: &Network) -> Self::UpdateResponseFut;
2939 type RemoveResponseFut: std::future::Future<Output = Result<NetworkRegistryRemoveResult, fidl::Error>>
2940 + Send;
2941 fn r#remove(&self, network_id: u32) -> Self::RemoveResponseFut;
2942 type CheckPresenceResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2943 fn r#check_presence(&self) -> Self::CheckPresenceResponseFut;
2944}
2945#[derive(Debug)]
2946#[cfg(target_os = "fuchsia")]
2947pub struct StarnixNetworksSynchronousProxy {
2948 client: fidl::client::sync::Client,
2949}
2950
2951#[cfg(target_os = "fuchsia")]
2952impl fidl::endpoints::SynchronousProxy for StarnixNetworksSynchronousProxy {
2953 type Proxy = StarnixNetworksProxy;
2954 type Protocol = StarnixNetworksMarker;
2955
2956 fn from_channel(inner: fidl::Channel) -> Self {
2957 Self::new(inner)
2958 }
2959
2960 fn into_channel(self) -> fidl::Channel {
2961 self.client.into_channel()
2962 }
2963
2964 fn as_channel(&self) -> &fidl::Channel {
2965 self.client.as_channel()
2966 }
2967}
2968
2969#[cfg(target_os = "fuchsia")]
2970impl StarnixNetworksSynchronousProxy {
2971 pub fn new(channel: fidl::Channel) -> Self {
2972 let protocol_name = <StarnixNetworksMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2973 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2974 }
2975
2976 pub fn into_channel(self) -> fidl::Channel {
2977 self.client.into_channel()
2978 }
2979
2980 pub fn wait_for_event(
2983 &self,
2984 deadline: zx::MonotonicInstant,
2985 ) -> Result<StarnixNetworksEvent, fidl::Error> {
2986 StarnixNetworksEvent::decode(self.client.wait_for_event(deadline)?)
2987 }
2988
2989 pub fn r#set_default(
2993 &self,
2994 mut network_id: &fidl_fuchsia_posix_socket::OptionalUint32,
2995 ___deadline: zx::MonotonicInstant,
2996 ) -> Result<NetworkRegistrySetDefaultResult, fidl::Error> {
2997 let _response =
2998 self.client.send_query::<NetworkRegistrySetDefaultRequest, fidl::encoding::ResultType<
2999 fidl::encoding::EmptyStruct,
3000 NetworkRegistrySetDefaultError,
3001 >>(
3002 (network_id,),
3003 0x59a90d7826a7f342,
3004 fidl::encoding::DynamicFlags::empty(),
3005 ___deadline,
3006 )?;
3007 Ok(_response.map(|x| x))
3008 }
3009
3010 pub fn r#add(
3015 &self,
3016 mut network: &Network,
3017 ___deadline: zx::MonotonicInstant,
3018 ) -> Result<NetworkRegistryAddResult, fidl::Error> {
3019 let _response =
3020 self.client.send_query::<NetworkRegistryAddRequest, fidl::encoding::ResultType<
3021 fidl::encoding::EmptyStruct,
3022 NetworkRegistryAddError,
3023 >>(
3024 (network,),
3025 0x4a988855b0fa4f7b,
3026 fidl::encoding::DynamicFlags::empty(),
3027 ___deadline,
3028 )?;
3029 Ok(_response.map(|x| x))
3030 }
3031
3032 pub fn r#update(
3036 &self,
3037 mut network: &Network,
3038 ___deadline: zx::MonotonicInstant,
3039 ) -> Result<NetworkRegistryUpdateResult, fidl::Error> {
3040 let _response =
3041 self.client.send_query::<NetworkRegistryUpdateRequest, fidl::encoding::ResultType<
3042 fidl::encoding::EmptyStruct,
3043 NetworkRegistryUpdateError,
3044 >>(
3045 (network,),
3046 0x460479796e3eadfe,
3047 fidl::encoding::DynamicFlags::empty(),
3048 ___deadline,
3049 )?;
3050 Ok(_response.map(|x| x))
3051 }
3052
3053 pub fn r#remove(
3057 &self,
3058 mut network_id: u32,
3059 ___deadline: zx::MonotonicInstant,
3060 ) -> Result<NetworkRegistryRemoveResult, fidl::Error> {
3061 let _response =
3062 self.client.send_query::<NetworkRegistryRemoveRequest, fidl::encoding::ResultType<
3063 fidl::encoding::EmptyStruct,
3064 NetworkRegistryRemoveError,
3065 >>(
3066 (network_id,),
3067 0xe62f98532295a85,
3068 fidl::encoding::DynamicFlags::empty(),
3069 ___deadline,
3070 )?;
3071 Ok(_response.map(|x| x))
3072 }
3073
3074 pub fn r#check_presence(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
3082 let _response =
3083 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
3084 (),
3085 0x27f51e2401662255,
3086 fidl::encoding::DynamicFlags::empty(),
3087 ___deadline,
3088 )?;
3089 Ok(_response)
3090 }
3091}
3092
3093#[cfg(target_os = "fuchsia")]
3094impl From<StarnixNetworksSynchronousProxy> for zx::Handle {
3095 fn from(value: StarnixNetworksSynchronousProxy) -> Self {
3096 value.into_channel().into()
3097 }
3098}
3099
3100#[cfg(target_os = "fuchsia")]
3101impl From<fidl::Channel> for StarnixNetworksSynchronousProxy {
3102 fn from(value: fidl::Channel) -> Self {
3103 Self::new(value)
3104 }
3105}
3106
3107#[derive(Debug, Clone)]
3108pub struct StarnixNetworksProxy {
3109 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3110}
3111
3112impl fidl::endpoints::Proxy for StarnixNetworksProxy {
3113 type Protocol = StarnixNetworksMarker;
3114
3115 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3116 Self::new(inner)
3117 }
3118
3119 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3120 self.client.into_channel().map_err(|client| Self { client })
3121 }
3122
3123 fn as_channel(&self) -> &::fidl::AsyncChannel {
3124 self.client.as_channel()
3125 }
3126}
3127
3128impl StarnixNetworksProxy {
3129 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3131 let protocol_name = <StarnixNetworksMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3132 Self { client: fidl::client::Client::new(channel, protocol_name) }
3133 }
3134
3135 pub fn take_event_stream(&self) -> StarnixNetworksEventStream {
3141 StarnixNetworksEventStream { event_receiver: self.client.take_event_receiver() }
3142 }
3143
3144 pub fn r#set_default(
3148 &self,
3149 mut network_id: &fidl_fuchsia_posix_socket::OptionalUint32,
3150 ) -> fidl::client::QueryResponseFut<
3151 NetworkRegistrySetDefaultResult,
3152 fidl::encoding::DefaultFuchsiaResourceDialect,
3153 > {
3154 StarnixNetworksProxyInterface::r#set_default(self, network_id)
3155 }
3156
3157 pub fn r#add(
3162 &self,
3163 mut network: &Network,
3164 ) -> fidl::client::QueryResponseFut<
3165 NetworkRegistryAddResult,
3166 fidl::encoding::DefaultFuchsiaResourceDialect,
3167 > {
3168 StarnixNetworksProxyInterface::r#add(self, network)
3169 }
3170
3171 pub fn r#update(
3175 &self,
3176 mut network: &Network,
3177 ) -> fidl::client::QueryResponseFut<
3178 NetworkRegistryUpdateResult,
3179 fidl::encoding::DefaultFuchsiaResourceDialect,
3180 > {
3181 StarnixNetworksProxyInterface::r#update(self, network)
3182 }
3183
3184 pub fn r#remove(
3188 &self,
3189 mut network_id: u32,
3190 ) -> fidl::client::QueryResponseFut<
3191 NetworkRegistryRemoveResult,
3192 fidl::encoding::DefaultFuchsiaResourceDialect,
3193 > {
3194 StarnixNetworksProxyInterface::r#remove(self, network_id)
3195 }
3196
3197 pub fn r#check_presence(
3205 &self,
3206 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3207 StarnixNetworksProxyInterface::r#check_presence(self)
3208 }
3209}
3210
3211impl StarnixNetworksProxyInterface for StarnixNetworksProxy {
3212 type SetDefaultResponseFut = fidl::client::QueryResponseFut<
3213 NetworkRegistrySetDefaultResult,
3214 fidl::encoding::DefaultFuchsiaResourceDialect,
3215 >;
3216 fn r#set_default(
3217 &self,
3218 mut network_id: &fidl_fuchsia_posix_socket::OptionalUint32,
3219 ) -> Self::SetDefaultResponseFut {
3220 fn _decode(
3221 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3222 ) -> Result<NetworkRegistrySetDefaultResult, fidl::Error> {
3223 let _response = fidl::client::decode_transaction_body::<
3224 fidl::encoding::ResultType<
3225 fidl::encoding::EmptyStruct,
3226 NetworkRegistrySetDefaultError,
3227 >,
3228 fidl::encoding::DefaultFuchsiaResourceDialect,
3229 0x59a90d7826a7f342,
3230 >(_buf?)?;
3231 Ok(_response.map(|x| x))
3232 }
3233 self.client.send_query_and_decode::<
3234 NetworkRegistrySetDefaultRequest,
3235 NetworkRegistrySetDefaultResult,
3236 >(
3237 (network_id,),
3238 0x59a90d7826a7f342,
3239 fidl::encoding::DynamicFlags::empty(),
3240 _decode,
3241 )
3242 }
3243
3244 type AddResponseFut = fidl::client::QueryResponseFut<
3245 NetworkRegistryAddResult,
3246 fidl::encoding::DefaultFuchsiaResourceDialect,
3247 >;
3248 fn r#add(&self, mut network: &Network) -> Self::AddResponseFut {
3249 fn _decode(
3250 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3251 ) -> Result<NetworkRegistryAddResult, fidl::Error> {
3252 let _response = fidl::client::decode_transaction_body::<
3253 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, NetworkRegistryAddError>,
3254 fidl::encoding::DefaultFuchsiaResourceDialect,
3255 0x4a988855b0fa4f7b,
3256 >(_buf?)?;
3257 Ok(_response.map(|x| x))
3258 }
3259 self.client.send_query_and_decode::<NetworkRegistryAddRequest, NetworkRegistryAddResult>(
3260 (network,),
3261 0x4a988855b0fa4f7b,
3262 fidl::encoding::DynamicFlags::empty(),
3263 _decode,
3264 )
3265 }
3266
3267 type UpdateResponseFut = fidl::client::QueryResponseFut<
3268 NetworkRegistryUpdateResult,
3269 fidl::encoding::DefaultFuchsiaResourceDialect,
3270 >;
3271 fn r#update(&self, mut network: &Network) -> Self::UpdateResponseFut {
3272 fn _decode(
3273 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3274 ) -> Result<NetworkRegistryUpdateResult, fidl::Error> {
3275 let _response = fidl::client::decode_transaction_body::<
3276 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, NetworkRegistryUpdateError>,
3277 fidl::encoding::DefaultFuchsiaResourceDialect,
3278 0x460479796e3eadfe,
3279 >(_buf?)?;
3280 Ok(_response.map(|x| x))
3281 }
3282 self.client
3283 .send_query_and_decode::<NetworkRegistryUpdateRequest, NetworkRegistryUpdateResult>(
3284 (network,),
3285 0x460479796e3eadfe,
3286 fidl::encoding::DynamicFlags::empty(),
3287 _decode,
3288 )
3289 }
3290
3291 type RemoveResponseFut = fidl::client::QueryResponseFut<
3292 NetworkRegistryRemoveResult,
3293 fidl::encoding::DefaultFuchsiaResourceDialect,
3294 >;
3295 fn r#remove(&self, mut network_id: u32) -> Self::RemoveResponseFut {
3296 fn _decode(
3297 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3298 ) -> Result<NetworkRegistryRemoveResult, fidl::Error> {
3299 let _response = fidl::client::decode_transaction_body::<
3300 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, NetworkRegistryRemoveError>,
3301 fidl::encoding::DefaultFuchsiaResourceDialect,
3302 0xe62f98532295a85,
3303 >(_buf?)?;
3304 Ok(_response.map(|x| x))
3305 }
3306 self.client
3307 .send_query_and_decode::<NetworkRegistryRemoveRequest, NetworkRegistryRemoveResult>(
3308 (network_id,),
3309 0xe62f98532295a85,
3310 fidl::encoding::DynamicFlags::empty(),
3311 _decode,
3312 )
3313 }
3314
3315 type CheckPresenceResponseFut =
3316 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3317 fn r#check_presence(&self) -> Self::CheckPresenceResponseFut {
3318 fn _decode(
3319 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3320 ) -> Result<(), fidl::Error> {
3321 let _response = fidl::client::decode_transaction_body::<
3322 fidl::encoding::EmptyPayload,
3323 fidl::encoding::DefaultFuchsiaResourceDialect,
3324 0x27f51e2401662255,
3325 >(_buf?)?;
3326 Ok(_response)
3327 }
3328 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
3329 (),
3330 0x27f51e2401662255,
3331 fidl::encoding::DynamicFlags::empty(),
3332 _decode,
3333 )
3334 }
3335}
3336
3337pub struct StarnixNetworksEventStream {
3338 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3339}
3340
3341impl std::marker::Unpin for StarnixNetworksEventStream {}
3342
3343impl futures::stream::FusedStream for StarnixNetworksEventStream {
3344 fn is_terminated(&self) -> bool {
3345 self.event_receiver.is_terminated()
3346 }
3347}
3348
3349impl futures::Stream for StarnixNetworksEventStream {
3350 type Item = Result<StarnixNetworksEvent, fidl::Error>;
3351
3352 fn poll_next(
3353 mut self: std::pin::Pin<&mut Self>,
3354 cx: &mut std::task::Context<'_>,
3355 ) -> std::task::Poll<Option<Self::Item>> {
3356 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3357 &mut self.event_receiver,
3358 cx
3359 )?) {
3360 Some(buf) => std::task::Poll::Ready(Some(StarnixNetworksEvent::decode(buf))),
3361 None => std::task::Poll::Ready(None),
3362 }
3363 }
3364}
3365
3366#[derive(Debug)]
3367pub enum StarnixNetworksEvent {}
3368
3369impl StarnixNetworksEvent {
3370 fn decode(
3372 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3373 ) -> Result<StarnixNetworksEvent, fidl::Error> {
3374 let (bytes, _handles) = buf.split_mut();
3375 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3376 debug_assert_eq!(tx_header.tx_id, 0);
3377 match tx_header.ordinal {
3378 _ => Err(fidl::Error::UnknownOrdinal {
3379 ordinal: tx_header.ordinal,
3380 protocol_name:
3381 <StarnixNetworksMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3382 }),
3383 }
3384 }
3385}
3386
3387pub struct StarnixNetworksRequestStream {
3389 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3390 is_terminated: bool,
3391}
3392
3393impl std::marker::Unpin for StarnixNetworksRequestStream {}
3394
3395impl futures::stream::FusedStream for StarnixNetworksRequestStream {
3396 fn is_terminated(&self) -> bool {
3397 self.is_terminated
3398 }
3399}
3400
3401impl fidl::endpoints::RequestStream for StarnixNetworksRequestStream {
3402 type Protocol = StarnixNetworksMarker;
3403 type ControlHandle = StarnixNetworksControlHandle;
3404
3405 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3406 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3407 }
3408
3409 fn control_handle(&self) -> Self::ControlHandle {
3410 StarnixNetworksControlHandle { inner: self.inner.clone() }
3411 }
3412
3413 fn into_inner(
3414 self,
3415 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3416 {
3417 (self.inner, self.is_terminated)
3418 }
3419
3420 fn from_inner(
3421 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3422 is_terminated: bool,
3423 ) -> Self {
3424 Self { inner, is_terminated }
3425 }
3426}
3427
3428impl futures::Stream for StarnixNetworksRequestStream {
3429 type Item = Result<StarnixNetworksRequest, fidl::Error>;
3430
3431 fn poll_next(
3432 mut self: std::pin::Pin<&mut Self>,
3433 cx: &mut std::task::Context<'_>,
3434 ) -> std::task::Poll<Option<Self::Item>> {
3435 let this = &mut *self;
3436 if this.inner.check_shutdown(cx) {
3437 this.is_terminated = true;
3438 return std::task::Poll::Ready(None);
3439 }
3440 if this.is_terminated {
3441 panic!("polled StarnixNetworksRequestStream after completion");
3442 }
3443 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3444 |bytes, handles| {
3445 match this.inner.channel().read_etc(cx, bytes, handles) {
3446 std::task::Poll::Ready(Ok(())) => {}
3447 std::task::Poll::Pending => return std::task::Poll::Pending,
3448 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3449 this.is_terminated = true;
3450 return std::task::Poll::Ready(None);
3451 }
3452 std::task::Poll::Ready(Err(e)) => {
3453 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3454 e.into(),
3455 ))))
3456 }
3457 }
3458
3459 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3461
3462 std::task::Poll::Ready(Some(match header.ordinal {
3463 0x59a90d7826a7f342 => {
3464 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3465 let mut req = fidl::new_empty!(
3466 NetworkRegistrySetDefaultRequest,
3467 fidl::encoding::DefaultFuchsiaResourceDialect
3468 );
3469 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkRegistrySetDefaultRequest>(&header, _body_bytes, handles, &mut req)?;
3470 let control_handle =
3471 StarnixNetworksControlHandle { inner: this.inner.clone() };
3472 Ok(StarnixNetworksRequest::SetDefault {
3473 network_id: req.network_id,
3474
3475 responder: StarnixNetworksSetDefaultResponder {
3476 control_handle: std::mem::ManuallyDrop::new(control_handle),
3477 tx_id: header.tx_id,
3478 },
3479 })
3480 }
3481 0x4a988855b0fa4f7b => {
3482 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3483 let mut req = fidl::new_empty!(
3484 NetworkRegistryAddRequest,
3485 fidl::encoding::DefaultFuchsiaResourceDialect
3486 );
3487 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkRegistryAddRequest>(&header, _body_bytes, handles, &mut req)?;
3488 let control_handle =
3489 StarnixNetworksControlHandle { inner: this.inner.clone() };
3490 Ok(StarnixNetworksRequest::Add {
3491 network: req.network,
3492
3493 responder: StarnixNetworksAddResponder {
3494 control_handle: std::mem::ManuallyDrop::new(control_handle),
3495 tx_id: header.tx_id,
3496 },
3497 })
3498 }
3499 0x460479796e3eadfe => {
3500 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3501 let mut req = fidl::new_empty!(
3502 NetworkRegistryUpdateRequest,
3503 fidl::encoding::DefaultFuchsiaResourceDialect
3504 );
3505 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkRegistryUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
3506 let control_handle =
3507 StarnixNetworksControlHandle { inner: this.inner.clone() };
3508 Ok(StarnixNetworksRequest::Update {
3509 network: req.network,
3510
3511 responder: StarnixNetworksUpdateResponder {
3512 control_handle: std::mem::ManuallyDrop::new(control_handle),
3513 tx_id: header.tx_id,
3514 },
3515 })
3516 }
3517 0xe62f98532295a85 => {
3518 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3519 let mut req = fidl::new_empty!(
3520 NetworkRegistryRemoveRequest,
3521 fidl::encoding::DefaultFuchsiaResourceDialect
3522 );
3523 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<NetworkRegistryRemoveRequest>(&header, _body_bytes, handles, &mut req)?;
3524 let control_handle =
3525 StarnixNetworksControlHandle { inner: this.inner.clone() };
3526 Ok(StarnixNetworksRequest::Remove {
3527 network_id: req.network_id,
3528
3529 responder: StarnixNetworksRemoveResponder {
3530 control_handle: std::mem::ManuallyDrop::new(control_handle),
3531 tx_id: header.tx_id,
3532 },
3533 })
3534 }
3535 0x27f51e2401662255 => {
3536 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3537 let mut req = fidl::new_empty!(
3538 fidl::encoding::EmptyPayload,
3539 fidl::encoding::DefaultFuchsiaResourceDialect
3540 );
3541 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3542 let control_handle =
3543 StarnixNetworksControlHandle { inner: this.inner.clone() };
3544 Ok(StarnixNetworksRequest::CheckPresence {
3545 responder: StarnixNetworksCheckPresenceResponder {
3546 control_handle: std::mem::ManuallyDrop::new(control_handle),
3547 tx_id: header.tx_id,
3548 },
3549 })
3550 }
3551 _ => Err(fidl::Error::UnknownOrdinal {
3552 ordinal: header.ordinal,
3553 protocol_name:
3554 <StarnixNetworksMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3555 }),
3556 }))
3557 },
3558 )
3559 }
3560}
3561
3562#[derive(Debug)]
3567pub enum StarnixNetworksRequest {
3568 SetDefault {
3572 network_id: fidl_fuchsia_posix_socket::OptionalUint32,
3573 responder: StarnixNetworksSetDefaultResponder,
3574 },
3575 Add { network: Network, responder: StarnixNetworksAddResponder },
3580 Update { network: Network, responder: StarnixNetworksUpdateResponder },
3584 Remove { network_id: u32, responder: StarnixNetworksRemoveResponder },
3588 CheckPresence { responder: StarnixNetworksCheckPresenceResponder },
3596}
3597
3598impl StarnixNetworksRequest {
3599 #[allow(irrefutable_let_patterns)]
3600 pub fn into_set_default(
3601 self,
3602 ) -> Option<(fidl_fuchsia_posix_socket::OptionalUint32, StarnixNetworksSetDefaultResponder)>
3603 {
3604 if let StarnixNetworksRequest::SetDefault { network_id, responder } = self {
3605 Some((network_id, responder))
3606 } else {
3607 None
3608 }
3609 }
3610
3611 #[allow(irrefutable_let_patterns)]
3612 pub fn into_add(self) -> Option<(Network, StarnixNetworksAddResponder)> {
3613 if let StarnixNetworksRequest::Add { network, responder } = self {
3614 Some((network, responder))
3615 } else {
3616 None
3617 }
3618 }
3619
3620 #[allow(irrefutable_let_patterns)]
3621 pub fn into_update(self) -> Option<(Network, StarnixNetworksUpdateResponder)> {
3622 if let StarnixNetworksRequest::Update { network, responder } = self {
3623 Some((network, responder))
3624 } else {
3625 None
3626 }
3627 }
3628
3629 #[allow(irrefutable_let_patterns)]
3630 pub fn into_remove(self) -> Option<(u32, StarnixNetworksRemoveResponder)> {
3631 if let StarnixNetworksRequest::Remove { network_id, responder } = self {
3632 Some((network_id, responder))
3633 } else {
3634 None
3635 }
3636 }
3637
3638 #[allow(irrefutable_let_patterns)]
3639 pub fn into_check_presence(self) -> Option<(StarnixNetworksCheckPresenceResponder)> {
3640 if let StarnixNetworksRequest::CheckPresence { responder } = self {
3641 Some((responder))
3642 } else {
3643 None
3644 }
3645 }
3646
3647 pub fn method_name(&self) -> &'static str {
3649 match *self {
3650 StarnixNetworksRequest::SetDefault { .. } => "set_default",
3651 StarnixNetworksRequest::Add { .. } => "add",
3652 StarnixNetworksRequest::Update { .. } => "update",
3653 StarnixNetworksRequest::Remove { .. } => "remove",
3654 StarnixNetworksRequest::CheckPresence { .. } => "check_presence",
3655 }
3656 }
3657}
3658
3659#[derive(Debug, Clone)]
3660pub struct StarnixNetworksControlHandle {
3661 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3662}
3663
3664impl fidl::endpoints::ControlHandle for StarnixNetworksControlHandle {
3665 fn shutdown(&self) {
3666 self.inner.shutdown()
3667 }
3668 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3669 self.inner.shutdown_with_epitaph(status)
3670 }
3671
3672 fn is_closed(&self) -> bool {
3673 self.inner.channel().is_closed()
3674 }
3675 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3676 self.inner.channel().on_closed()
3677 }
3678
3679 #[cfg(target_os = "fuchsia")]
3680 fn signal_peer(
3681 &self,
3682 clear_mask: zx::Signals,
3683 set_mask: zx::Signals,
3684 ) -> Result<(), zx_status::Status> {
3685 use fidl::Peered;
3686 self.inner.channel().signal_peer(clear_mask, set_mask)
3687 }
3688}
3689
3690impl StarnixNetworksControlHandle {}
3691
3692#[must_use = "FIDL methods require a response to be sent"]
3693#[derive(Debug)]
3694pub struct StarnixNetworksSetDefaultResponder {
3695 control_handle: std::mem::ManuallyDrop<StarnixNetworksControlHandle>,
3696 tx_id: u32,
3697}
3698
3699impl std::ops::Drop for StarnixNetworksSetDefaultResponder {
3703 fn drop(&mut self) {
3704 self.control_handle.shutdown();
3705 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3707 }
3708}
3709
3710impl fidl::endpoints::Responder for StarnixNetworksSetDefaultResponder {
3711 type ControlHandle = StarnixNetworksControlHandle;
3712
3713 fn control_handle(&self) -> &StarnixNetworksControlHandle {
3714 &self.control_handle
3715 }
3716
3717 fn drop_without_shutdown(mut self) {
3718 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3720 std::mem::forget(self);
3722 }
3723}
3724
3725impl StarnixNetworksSetDefaultResponder {
3726 pub fn send(
3730 self,
3731 mut result: Result<(), NetworkRegistrySetDefaultError>,
3732 ) -> Result<(), fidl::Error> {
3733 let _result = self.send_raw(result);
3734 if _result.is_err() {
3735 self.control_handle.shutdown();
3736 }
3737 self.drop_without_shutdown();
3738 _result
3739 }
3740
3741 pub fn send_no_shutdown_on_err(
3743 self,
3744 mut result: Result<(), NetworkRegistrySetDefaultError>,
3745 ) -> Result<(), fidl::Error> {
3746 let _result = self.send_raw(result);
3747 self.drop_without_shutdown();
3748 _result
3749 }
3750
3751 fn send_raw(
3752 &self,
3753 mut result: Result<(), NetworkRegistrySetDefaultError>,
3754 ) -> Result<(), fidl::Error> {
3755 self.control_handle.inner.send::<fidl::encoding::ResultType<
3756 fidl::encoding::EmptyStruct,
3757 NetworkRegistrySetDefaultError,
3758 >>(
3759 result,
3760 self.tx_id,
3761 0x59a90d7826a7f342,
3762 fidl::encoding::DynamicFlags::empty(),
3763 )
3764 }
3765}
3766
3767#[must_use = "FIDL methods require a response to be sent"]
3768#[derive(Debug)]
3769pub struct StarnixNetworksAddResponder {
3770 control_handle: std::mem::ManuallyDrop<StarnixNetworksControlHandle>,
3771 tx_id: u32,
3772}
3773
3774impl std::ops::Drop for StarnixNetworksAddResponder {
3778 fn drop(&mut self) {
3779 self.control_handle.shutdown();
3780 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3782 }
3783}
3784
3785impl fidl::endpoints::Responder for StarnixNetworksAddResponder {
3786 type ControlHandle = StarnixNetworksControlHandle;
3787
3788 fn control_handle(&self) -> &StarnixNetworksControlHandle {
3789 &self.control_handle
3790 }
3791
3792 fn drop_without_shutdown(mut self) {
3793 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3795 std::mem::forget(self);
3797 }
3798}
3799
3800impl StarnixNetworksAddResponder {
3801 pub fn send(self, mut result: Result<(), NetworkRegistryAddError>) -> Result<(), fidl::Error> {
3805 let _result = self.send_raw(result);
3806 if _result.is_err() {
3807 self.control_handle.shutdown();
3808 }
3809 self.drop_without_shutdown();
3810 _result
3811 }
3812
3813 pub fn send_no_shutdown_on_err(
3815 self,
3816 mut result: Result<(), NetworkRegistryAddError>,
3817 ) -> Result<(), fidl::Error> {
3818 let _result = self.send_raw(result);
3819 self.drop_without_shutdown();
3820 _result
3821 }
3822
3823 fn send_raw(&self, mut result: Result<(), NetworkRegistryAddError>) -> Result<(), fidl::Error> {
3824 self.control_handle.inner.send::<fidl::encoding::ResultType<
3825 fidl::encoding::EmptyStruct,
3826 NetworkRegistryAddError,
3827 >>(
3828 result,
3829 self.tx_id,
3830 0x4a988855b0fa4f7b,
3831 fidl::encoding::DynamicFlags::empty(),
3832 )
3833 }
3834}
3835
3836#[must_use = "FIDL methods require a response to be sent"]
3837#[derive(Debug)]
3838pub struct StarnixNetworksUpdateResponder {
3839 control_handle: std::mem::ManuallyDrop<StarnixNetworksControlHandle>,
3840 tx_id: u32,
3841}
3842
3843impl std::ops::Drop for StarnixNetworksUpdateResponder {
3847 fn drop(&mut self) {
3848 self.control_handle.shutdown();
3849 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3851 }
3852}
3853
3854impl fidl::endpoints::Responder for StarnixNetworksUpdateResponder {
3855 type ControlHandle = StarnixNetworksControlHandle;
3856
3857 fn control_handle(&self) -> &StarnixNetworksControlHandle {
3858 &self.control_handle
3859 }
3860
3861 fn drop_without_shutdown(mut self) {
3862 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3864 std::mem::forget(self);
3866 }
3867}
3868
3869impl StarnixNetworksUpdateResponder {
3870 pub fn send(
3874 self,
3875 mut result: Result<(), NetworkRegistryUpdateError>,
3876 ) -> Result<(), fidl::Error> {
3877 let _result = self.send_raw(result);
3878 if _result.is_err() {
3879 self.control_handle.shutdown();
3880 }
3881 self.drop_without_shutdown();
3882 _result
3883 }
3884
3885 pub fn send_no_shutdown_on_err(
3887 self,
3888 mut result: Result<(), NetworkRegistryUpdateError>,
3889 ) -> Result<(), fidl::Error> {
3890 let _result = self.send_raw(result);
3891 self.drop_without_shutdown();
3892 _result
3893 }
3894
3895 fn send_raw(
3896 &self,
3897 mut result: Result<(), NetworkRegistryUpdateError>,
3898 ) -> Result<(), fidl::Error> {
3899 self.control_handle.inner.send::<fidl::encoding::ResultType<
3900 fidl::encoding::EmptyStruct,
3901 NetworkRegistryUpdateError,
3902 >>(
3903 result,
3904 self.tx_id,
3905 0x460479796e3eadfe,
3906 fidl::encoding::DynamicFlags::empty(),
3907 )
3908 }
3909}
3910
3911#[must_use = "FIDL methods require a response to be sent"]
3912#[derive(Debug)]
3913pub struct StarnixNetworksRemoveResponder {
3914 control_handle: std::mem::ManuallyDrop<StarnixNetworksControlHandle>,
3915 tx_id: u32,
3916}
3917
3918impl std::ops::Drop for StarnixNetworksRemoveResponder {
3922 fn drop(&mut self) {
3923 self.control_handle.shutdown();
3924 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3926 }
3927}
3928
3929impl fidl::endpoints::Responder for StarnixNetworksRemoveResponder {
3930 type ControlHandle = StarnixNetworksControlHandle;
3931
3932 fn control_handle(&self) -> &StarnixNetworksControlHandle {
3933 &self.control_handle
3934 }
3935
3936 fn drop_without_shutdown(mut self) {
3937 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3939 std::mem::forget(self);
3941 }
3942}
3943
3944impl StarnixNetworksRemoveResponder {
3945 pub fn send(
3949 self,
3950 mut result: Result<(), NetworkRegistryRemoveError>,
3951 ) -> Result<(), fidl::Error> {
3952 let _result = self.send_raw(result);
3953 if _result.is_err() {
3954 self.control_handle.shutdown();
3955 }
3956 self.drop_without_shutdown();
3957 _result
3958 }
3959
3960 pub fn send_no_shutdown_on_err(
3962 self,
3963 mut result: Result<(), NetworkRegistryRemoveError>,
3964 ) -> Result<(), fidl::Error> {
3965 let _result = self.send_raw(result);
3966 self.drop_without_shutdown();
3967 _result
3968 }
3969
3970 fn send_raw(
3971 &self,
3972 mut result: Result<(), NetworkRegistryRemoveError>,
3973 ) -> Result<(), fidl::Error> {
3974 self.control_handle.inner.send::<fidl::encoding::ResultType<
3975 fidl::encoding::EmptyStruct,
3976 NetworkRegistryRemoveError,
3977 >>(
3978 result,
3979 self.tx_id,
3980 0xe62f98532295a85,
3981 fidl::encoding::DynamicFlags::empty(),
3982 )
3983 }
3984}
3985
3986#[must_use = "FIDL methods require a response to be sent"]
3987#[derive(Debug)]
3988pub struct StarnixNetworksCheckPresenceResponder {
3989 control_handle: std::mem::ManuallyDrop<StarnixNetworksControlHandle>,
3990 tx_id: u32,
3991}
3992
3993impl std::ops::Drop for StarnixNetworksCheckPresenceResponder {
3997 fn drop(&mut self) {
3998 self.control_handle.shutdown();
3999 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4001 }
4002}
4003
4004impl fidl::endpoints::Responder for StarnixNetworksCheckPresenceResponder {
4005 type ControlHandle = StarnixNetworksControlHandle;
4006
4007 fn control_handle(&self) -> &StarnixNetworksControlHandle {
4008 &self.control_handle
4009 }
4010
4011 fn drop_without_shutdown(mut self) {
4012 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4014 std::mem::forget(self);
4016 }
4017}
4018
4019impl StarnixNetworksCheckPresenceResponder {
4020 pub fn send(self) -> Result<(), fidl::Error> {
4024 let _result = self.send_raw();
4025 if _result.is_err() {
4026 self.control_handle.shutdown();
4027 }
4028 self.drop_without_shutdown();
4029 _result
4030 }
4031
4032 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4034 let _result = self.send_raw();
4035 self.drop_without_shutdown();
4036 _result
4037 }
4038
4039 fn send_raw(&self) -> Result<(), fidl::Error> {
4040 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
4041 (),
4042 self.tx_id,
4043 0x27f51e2401662255,
4044 fidl::encoding::DynamicFlags::empty(),
4045 )
4046 }
4047}
4048
4049mod internal {
4050 use super::*;
4051}