Skip to main content

fidl_fuchsia_net_settings/
fidl_fuchsia_net_settings.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_net_settings_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct ControlMarker;
16
17impl fidl::endpoints::ProtocolMarker for ControlMarker {
18    type Proxy = ControlProxy;
19    type RequestStream = ControlRequestStream;
20    #[cfg(target_os = "fuchsia")]
21    type SynchronousProxy = ControlSynchronousProxy;
22
23    const DEBUG_NAME: &'static str = "fuchsia.net.settings.Control";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for ControlMarker {}
26pub type ControlUpdateInterfaceDefaultsResult =
27    Result<fidl_fuchsia_net_interfaces_admin::Configuration, UpdateError>;
28pub type ControlUpdateTcpResult = Result<Tcp, UpdateError>;
29pub type ControlUpdateUdpResult = Result<Udp, UpdateError>;
30pub type ControlUpdateIcmpResult = Result<Icmp, UpdateError>;
31pub type ControlUpdateIpResult = Result<Ip, UpdateError>;
32pub type ControlUpdateDeviceResult = Result<Device, UpdateError>;
33
34pub trait ControlProxyInterface: Send + Sync {
35    type UpdateInterfaceDefaultsResponseFut: std::future::Future<Output = Result<ControlUpdateInterfaceDefaultsResult, fidl::Error>>
36        + Send;
37    fn r#update_interface_defaults(
38        &self,
39        payload: &fidl_fuchsia_net_interfaces_admin::Configuration,
40    ) -> Self::UpdateInterfaceDefaultsResponseFut;
41    type UpdateTcpResponseFut: std::future::Future<Output = Result<ControlUpdateTcpResult, fidl::Error>>
42        + Send;
43    fn r#update_tcp(&self, payload: &Tcp) -> Self::UpdateTcpResponseFut;
44    type UpdateUdpResponseFut: std::future::Future<Output = Result<ControlUpdateUdpResult, fidl::Error>>
45        + Send;
46    fn r#update_udp(&self, payload: &Udp) -> Self::UpdateUdpResponseFut;
47    type UpdateIcmpResponseFut: std::future::Future<Output = Result<ControlUpdateIcmpResult, fidl::Error>>
48        + Send;
49    fn r#update_icmp(&self, payload: &Icmp) -> Self::UpdateIcmpResponseFut;
50    type UpdateIpResponseFut: std::future::Future<Output = Result<ControlUpdateIpResult, fidl::Error>>
51        + Send;
52    fn r#update_ip(&self, payload: &Ip) -> Self::UpdateIpResponseFut;
53    type UpdateDeviceResponseFut: std::future::Future<Output = Result<ControlUpdateDeviceResult, fidl::Error>>
54        + Send;
55    fn r#update_device(&self, payload: &Device) -> Self::UpdateDeviceResponseFut;
56}
57#[derive(Debug)]
58#[cfg(target_os = "fuchsia")]
59pub struct ControlSynchronousProxy {
60    client: fidl::client::sync::Client,
61}
62
63#[cfg(target_os = "fuchsia")]
64impl fidl::endpoints::SynchronousProxy for ControlSynchronousProxy {
65    type Proxy = ControlProxy;
66    type Protocol = ControlMarker;
67
68    fn from_channel(inner: fidl::Channel) -> Self {
69        Self::new(inner)
70    }
71
72    fn into_channel(self) -> fidl::Channel {
73        self.client.into_channel()
74    }
75
76    fn as_channel(&self) -> &fidl::Channel {
77        self.client.as_channel()
78    }
79}
80
81#[cfg(target_os = "fuchsia")]
82impl ControlSynchronousProxy {
83    pub fn new(channel: fidl::Channel) -> Self {
84        Self { client: fidl::client::sync::Client::new(channel) }
85    }
86
87    pub fn into_channel(self) -> fidl::Channel {
88        self.client.into_channel()
89    }
90
91    /// Waits until an event arrives and returns it. It is safe for other
92    /// threads to make concurrent requests while waiting for an event.
93    pub fn wait_for_event(
94        &self,
95        deadline: zx::MonotonicInstant,
96    ) -> Result<ControlEvent, fidl::Error> {
97        ControlEvent::decode(self.client.wait_for_event::<ControlMarker>(deadline)?)
98    }
99
100    /// Updates the default configurations for interfaces.
101    ///
102    /// New interfaces created take default values from this configuration.
103    ///
104    /// Note that some interface types may not support specific configurations,
105    /// in which case the value is either ignored or the network stack assigns a
106    /// server-assigned value.
107    ///
108    /// Only fields present in the provided [`Interface`] are set; unset fields
109    /// are left unmodified. The server returns a `Interface` which holds the
110    /// previous configuration for fields that were set in the request.
111    ///
112    /// No values are changed if an error is returned.
113    ///
114    /// + request configuration fields to update on the interface defaults.
115    /// - response a partial snapshot of the previous default configuration.
116    pub fn r#update_interface_defaults(
117        &self,
118        mut payload: &fidl_fuchsia_net_interfaces_admin::Configuration,
119        ___deadline: zx::MonotonicInstant,
120    ) -> Result<ControlUpdateInterfaceDefaultsResult, fidl::Error> {
121        let _response = self.client.send_query::<
122            fidl_fuchsia_net_interfaces_admin::Configuration,
123            fidl::encoding::ResultType<fidl_fuchsia_net_interfaces_admin::Configuration, UpdateError>,
124            ControlMarker,
125        >(
126            payload,
127            0x46ea2036390abecc,
128            fidl::encoding::DynamicFlags::empty(),
129            ___deadline,
130        )?;
131        Ok(_response.map(|x| x))
132    }
133
134    /// Updates TCP settings.
135    ///
136    /// Only fields present in the provided [`Tcp`] are set; unset fields are
137    /// left unmodified. The server returns a `Tcp` which holds the previous
138    /// settings for fields that were set in the request.
139    ///
140    /// No values are changed if an error is returned.
141    ///
142    /// + request TCP settings fields to update.
143    /// - response a partial snapshot of the previous TCP settings.
144    pub fn r#update_tcp(
145        &self,
146        mut payload: &Tcp,
147        ___deadline: zx::MonotonicInstant,
148    ) -> Result<ControlUpdateTcpResult, fidl::Error> {
149        let _response = self
150            .client
151            .send_query::<Tcp, fidl::encoding::ResultType<Tcp, UpdateError>, ControlMarker>(
152                payload,
153                0x4e768d74ec55450f,
154                fidl::encoding::DynamicFlags::empty(),
155                ___deadline,
156            )?;
157        Ok(_response.map(|x| x))
158    }
159
160    /// Updates UDP settings.
161    ///
162    /// Only fields present in the provided [`Udp`] are set; unset fields are
163    /// left unmodified. The server returns a `Udp` which holds the previous
164    /// settings for fields that were set in the request.
165    ///
166    /// No values are changed if an error is returned.
167    ///
168    /// + request UDP settings fields to update.
169    /// - response a partial snapshot of the previous UDP settings.
170    pub fn r#update_udp(
171        &self,
172        mut payload: &Udp,
173        ___deadline: zx::MonotonicInstant,
174    ) -> Result<ControlUpdateUdpResult, fidl::Error> {
175        let _response = self
176            .client
177            .send_query::<Udp, fidl::encoding::ResultType<Udp, UpdateError>, ControlMarker>(
178                payload,
179                0x6fb82be32e7338b4,
180                fidl::encoding::DynamicFlags::empty(),
181                ___deadline,
182            )?;
183        Ok(_response.map(|x| x))
184    }
185
186    /// Updates ICMP settings.
187    ///
188    /// Only fields present in the provided [`Icmp`] are set; unset fields are
189    /// left unmodified. The server returns a `Icmp` which holds the previous
190    /// settings for fields that were set in the request.
191    ///
192    /// No values are changed if an error is returned.
193    ///
194    /// + request ICMP settings fields to update.
195    /// - response a partial snapshot of the previous ICMP settings.
196    pub fn r#update_icmp(
197        &self,
198        mut payload: &Icmp,
199        ___deadline: zx::MonotonicInstant,
200    ) -> Result<ControlUpdateIcmpResult, fidl::Error> {
201        let _response = self
202            .client
203            .send_query::<Icmp, fidl::encoding::ResultType<Icmp, UpdateError>, ControlMarker>(
204                payload,
205                0x42f130ff9cc3a8d5,
206                fidl::encoding::DynamicFlags::empty(),
207                ___deadline,
208            )?;
209        Ok(_response.map(|x| x))
210    }
211
212    /// Updates IP settings.
213    ///
214    /// Only fields present in the provided [`Ip`] are set; unset fields are
215    /// left unmodified. The server returns a `Ip` which holds the previous
216    /// settings for fields that were set in the request.
217    ///
218    /// No values are changed if an error is returned.
219    ///
220    /// + request IP settings fields to update.
221    /// - response a partial snapshot of the previous IP settings.
222    pub fn r#update_ip(
223        &self,
224        mut payload: &Ip,
225        ___deadline: zx::MonotonicInstant,
226    ) -> Result<ControlUpdateIpResult, fidl::Error> {
227        let _response = self
228            .client
229            .send_query::<Ip, fidl::encoding::ResultType<Ip, UpdateError>, ControlMarker>(
230                payload,
231                0x75d1074407e4d1c4,
232                fidl::encoding::DynamicFlags::empty(),
233                ___deadline,
234            )?;
235        Ok(_response.map(|x| x))
236    }
237
238    /// Updates device layer settings.
239    ///
240    /// Only fields present in the provided [`Device`] are set; unset
241    /// fields are left unmodified. The server returns a `Device` which
242    /// holds the previous settings for fields that were set in the
243    /// request.
244    ///
245    /// No values are changed if an error is returned.
246    ///
247    /// + request device layer settings fields to update.
248    /// - response a partial snapshot of the previous device layer.
249    pub fn r#update_device(
250        &self,
251        mut payload: &Device,
252        ___deadline: zx::MonotonicInstant,
253    ) -> Result<ControlUpdateDeviceResult, fidl::Error> {
254        let _response = self
255            .client
256            .send_query::<Device, fidl::encoding::ResultType<Device, UpdateError>, ControlMarker>(
257                payload,
258                0x6080a91e617e9430,
259                fidl::encoding::DynamicFlags::empty(),
260                ___deadline,
261            )?;
262        Ok(_response.map(|x| x))
263    }
264}
265
266#[cfg(target_os = "fuchsia")]
267impl From<ControlSynchronousProxy> for zx::NullableHandle {
268    fn from(value: ControlSynchronousProxy) -> Self {
269        value.into_channel().into()
270    }
271}
272
273#[cfg(target_os = "fuchsia")]
274impl From<fidl::Channel> for ControlSynchronousProxy {
275    fn from(value: fidl::Channel) -> Self {
276        Self::new(value)
277    }
278}
279
280#[cfg(target_os = "fuchsia")]
281impl fidl::endpoints::FromClient for ControlSynchronousProxy {
282    type Protocol = ControlMarker;
283
284    fn from_client(value: fidl::endpoints::ClientEnd<ControlMarker>) -> Self {
285        Self::new(value.into_channel())
286    }
287}
288
289#[derive(Debug, Clone)]
290pub struct ControlProxy {
291    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
292}
293
294impl fidl::endpoints::Proxy for ControlProxy {
295    type Protocol = ControlMarker;
296
297    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
298        Self::new(inner)
299    }
300
301    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
302        self.client.into_channel().map_err(|client| Self { client })
303    }
304
305    fn as_channel(&self) -> &::fidl::AsyncChannel {
306        self.client.as_channel()
307    }
308}
309
310impl ControlProxy {
311    /// Create a new Proxy for fuchsia.net.settings/Control.
312    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
313        let protocol_name = <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
314        Self { client: fidl::client::Client::new(channel, protocol_name) }
315    }
316
317    /// Get a Stream of events from the remote end of the protocol.
318    ///
319    /// # Panics
320    ///
321    /// Panics if the event stream was already taken.
322    pub fn take_event_stream(&self) -> ControlEventStream {
323        ControlEventStream { event_receiver: self.client.take_event_receiver() }
324    }
325
326    /// Updates the default configurations for interfaces.
327    ///
328    /// New interfaces created take default values from this configuration.
329    ///
330    /// Note that some interface types may not support specific configurations,
331    /// in which case the value is either ignored or the network stack assigns a
332    /// server-assigned value.
333    ///
334    /// Only fields present in the provided [`Interface`] are set; unset fields
335    /// are left unmodified. The server returns a `Interface` which holds the
336    /// previous configuration for fields that were set in the request.
337    ///
338    /// No values are changed if an error is returned.
339    ///
340    /// + request configuration fields to update on the interface defaults.
341    /// - response a partial snapshot of the previous default configuration.
342    pub fn r#update_interface_defaults(
343        &self,
344        mut payload: &fidl_fuchsia_net_interfaces_admin::Configuration,
345    ) -> fidl::client::QueryResponseFut<
346        ControlUpdateInterfaceDefaultsResult,
347        fidl::encoding::DefaultFuchsiaResourceDialect,
348    > {
349        ControlProxyInterface::r#update_interface_defaults(self, payload)
350    }
351
352    /// Updates TCP settings.
353    ///
354    /// Only fields present in the provided [`Tcp`] are set; unset fields are
355    /// left unmodified. The server returns a `Tcp` which holds the previous
356    /// settings for fields that were set in the request.
357    ///
358    /// No values are changed if an error is returned.
359    ///
360    /// + request TCP settings fields to update.
361    /// - response a partial snapshot of the previous TCP settings.
362    pub fn r#update_tcp(
363        &self,
364        mut payload: &Tcp,
365    ) -> fidl::client::QueryResponseFut<
366        ControlUpdateTcpResult,
367        fidl::encoding::DefaultFuchsiaResourceDialect,
368    > {
369        ControlProxyInterface::r#update_tcp(self, payload)
370    }
371
372    /// Updates UDP settings.
373    ///
374    /// Only fields present in the provided [`Udp`] are set; unset fields are
375    /// left unmodified. The server returns a `Udp` which holds the previous
376    /// settings for fields that were set in the request.
377    ///
378    /// No values are changed if an error is returned.
379    ///
380    /// + request UDP settings fields to update.
381    /// - response a partial snapshot of the previous UDP settings.
382    pub fn r#update_udp(
383        &self,
384        mut payload: &Udp,
385    ) -> fidl::client::QueryResponseFut<
386        ControlUpdateUdpResult,
387        fidl::encoding::DefaultFuchsiaResourceDialect,
388    > {
389        ControlProxyInterface::r#update_udp(self, payload)
390    }
391
392    /// Updates ICMP settings.
393    ///
394    /// Only fields present in the provided [`Icmp`] are set; unset fields are
395    /// left unmodified. The server returns a `Icmp` which holds the previous
396    /// settings for fields that were set in the request.
397    ///
398    /// No values are changed if an error is returned.
399    ///
400    /// + request ICMP settings fields to update.
401    /// - response a partial snapshot of the previous ICMP settings.
402    pub fn r#update_icmp(
403        &self,
404        mut payload: &Icmp,
405    ) -> fidl::client::QueryResponseFut<
406        ControlUpdateIcmpResult,
407        fidl::encoding::DefaultFuchsiaResourceDialect,
408    > {
409        ControlProxyInterface::r#update_icmp(self, payload)
410    }
411
412    /// Updates IP settings.
413    ///
414    /// Only fields present in the provided [`Ip`] are set; unset fields are
415    /// left unmodified. The server returns a `Ip` which holds the previous
416    /// settings for fields that were set in the request.
417    ///
418    /// No values are changed if an error is returned.
419    ///
420    /// + request IP settings fields to update.
421    /// - response a partial snapshot of the previous IP settings.
422    pub fn r#update_ip(
423        &self,
424        mut payload: &Ip,
425    ) -> fidl::client::QueryResponseFut<
426        ControlUpdateIpResult,
427        fidl::encoding::DefaultFuchsiaResourceDialect,
428    > {
429        ControlProxyInterface::r#update_ip(self, payload)
430    }
431
432    /// Updates device layer settings.
433    ///
434    /// Only fields present in the provided [`Device`] are set; unset
435    /// fields are left unmodified. The server returns a `Device` which
436    /// holds the previous settings for fields that were set in the
437    /// request.
438    ///
439    /// No values are changed if an error is returned.
440    ///
441    /// + request device layer settings fields to update.
442    /// - response a partial snapshot of the previous device layer.
443    pub fn r#update_device(
444        &self,
445        mut payload: &Device,
446    ) -> fidl::client::QueryResponseFut<
447        ControlUpdateDeviceResult,
448        fidl::encoding::DefaultFuchsiaResourceDialect,
449    > {
450        ControlProxyInterface::r#update_device(self, payload)
451    }
452}
453
454impl ControlProxyInterface for ControlProxy {
455    type UpdateInterfaceDefaultsResponseFut = fidl::client::QueryResponseFut<
456        ControlUpdateInterfaceDefaultsResult,
457        fidl::encoding::DefaultFuchsiaResourceDialect,
458    >;
459    fn r#update_interface_defaults(
460        &self,
461        mut payload: &fidl_fuchsia_net_interfaces_admin::Configuration,
462    ) -> Self::UpdateInterfaceDefaultsResponseFut {
463        fn _decode(
464            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
465        ) -> Result<ControlUpdateInterfaceDefaultsResult, fidl::Error> {
466            let _response = fidl::client::decode_transaction_body::<
467                fidl::encoding::ResultType<
468                    fidl_fuchsia_net_interfaces_admin::Configuration,
469                    UpdateError,
470                >,
471                fidl::encoding::DefaultFuchsiaResourceDialect,
472                0x46ea2036390abecc,
473            >(_buf?)?;
474            Ok(_response.map(|x| x))
475        }
476        self.client.send_query_and_decode::<
477            fidl_fuchsia_net_interfaces_admin::Configuration,
478            ControlUpdateInterfaceDefaultsResult,
479        >(
480            payload,
481            0x46ea2036390abecc,
482            fidl::encoding::DynamicFlags::empty(),
483            _decode,
484        )
485    }
486
487    type UpdateTcpResponseFut = fidl::client::QueryResponseFut<
488        ControlUpdateTcpResult,
489        fidl::encoding::DefaultFuchsiaResourceDialect,
490    >;
491    fn r#update_tcp(&self, mut payload: &Tcp) -> Self::UpdateTcpResponseFut {
492        fn _decode(
493            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
494        ) -> Result<ControlUpdateTcpResult, fidl::Error> {
495            let _response = fidl::client::decode_transaction_body::<
496                fidl::encoding::ResultType<Tcp, UpdateError>,
497                fidl::encoding::DefaultFuchsiaResourceDialect,
498                0x4e768d74ec55450f,
499            >(_buf?)?;
500            Ok(_response.map(|x| x))
501        }
502        self.client.send_query_and_decode::<Tcp, ControlUpdateTcpResult>(
503            payload,
504            0x4e768d74ec55450f,
505            fidl::encoding::DynamicFlags::empty(),
506            _decode,
507        )
508    }
509
510    type UpdateUdpResponseFut = fidl::client::QueryResponseFut<
511        ControlUpdateUdpResult,
512        fidl::encoding::DefaultFuchsiaResourceDialect,
513    >;
514    fn r#update_udp(&self, mut payload: &Udp) -> Self::UpdateUdpResponseFut {
515        fn _decode(
516            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
517        ) -> Result<ControlUpdateUdpResult, fidl::Error> {
518            let _response = fidl::client::decode_transaction_body::<
519                fidl::encoding::ResultType<Udp, UpdateError>,
520                fidl::encoding::DefaultFuchsiaResourceDialect,
521                0x6fb82be32e7338b4,
522            >(_buf?)?;
523            Ok(_response.map(|x| x))
524        }
525        self.client.send_query_and_decode::<Udp, ControlUpdateUdpResult>(
526            payload,
527            0x6fb82be32e7338b4,
528            fidl::encoding::DynamicFlags::empty(),
529            _decode,
530        )
531    }
532
533    type UpdateIcmpResponseFut = fidl::client::QueryResponseFut<
534        ControlUpdateIcmpResult,
535        fidl::encoding::DefaultFuchsiaResourceDialect,
536    >;
537    fn r#update_icmp(&self, mut payload: &Icmp) -> Self::UpdateIcmpResponseFut {
538        fn _decode(
539            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
540        ) -> Result<ControlUpdateIcmpResult, fidl::Error> {
541            let _response = fidl::client::decode_transaction_body::<
542                fidl::encoding::ResultType<Icmp, UpdateError>,
543                fidl::encoding::DefaultFuchsiaResourceDialect,
544                0x42f130ff9cc3a8d5,
545            >(_buf?)?;
546            Ok(_response.map(|x| x))
547        }
548        self.client.send_query_and_decode::<Icmp, ControlUpdateIcmpResult>(
549            payload,
550            0x42f130ff9cc3a8d5,
551            fidl::encoding::DynamicFlags::empty(),
552            _decode,
553        )
554    }
555
556    type UpdateIpResponseFut = fidl::client::QueryResponseFut<
557        ControlUpdateIpResult,
558        fidl::encoding::DefaultFuchsiaResourceDialect,
559    >;
560    fn r#update_ip(&self, mut payload: &Ip) -> Self::UpdateIpResponseFut {
561        fn _decode(
562            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
563        ) -> Result<ControlUpdateIpResult, fidl::Error> {
564            let _response = fidl::client::decode_transaction_body::<
565                fidl::encoding::ResultType<Ip, UpdateError>,
566                fidl::encoding::DefaultFuchsiaResourceDialect,
567                0x75d1074407e4d1c4,
568            >(_buf?)?;
569            Ok(_response.map(|x| x))
570        }
571        self.client.send_query_and_decode::<Ip, ControlUpdateIpResult>(
572            payload,
573            0x75d1074407e4d1c4,
574            fidl::encoding::DynamicFlags::empty(),
575            _decode,
576        )
577    }
578
579    type UpdateDeviceResponseFut = fidl::client::QueryResponseFut<
580        ControlUpdateDeviceResult,
581        fidl::encoding::DefaultFuchsiaResourceDialect,
582    >;
583    fn r#update_device(&self, mut payload: &Device) -> Self::UpdateDeviceResponseFut {
584        fn _decode(
585            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
586        ) -> Result<ControlUpdateDeviceResult, fidl::Error> {
587            let _response = fidl::client::decode_transaction_body::<
588                fidl::encoding::ResultType<Device, UpdateError>,
589                fidl::encoding::DefaultFuchsiaResourceDialect,
590                0x6080a91e617e9430,
591            >(_buf?)?;
592            Ok(_response.map(|x| x))
593        }
594        self.client.send_query_and_decode::<Device, ControlUpdateDeviceResult>(
595            payload,
596            0x6080a91e617e9430,
597            fidl::encoding::DynamicFlags::empty(),
598            _decode,
599        )
600    }
601}
602
603pub struct ControlEventStream {
604    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
605}
606
607impl std::marker::Unpin for ControlEventStream {}
608
609impl futures::stream::FusedStream for ControlEventStream {
610    fn is_terminated(&self) -> bool {
611        self.event_receiver.is_terminated()
612    }
613}
614
615impl futures::Stream for ControlEventStream {
616    type Item = Result<ControlEvent, fidl::Error>;
617
618    fn poll_next(
619        mut self: std::pin::Pin<&mut Self>,
620        cx: &mut std::task::Context<'_>,
621    ) -> std::task::Poll<Option<Self::Item>> {
622        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
623            &mut self.event_receiver,
624            cx
625        )?) {
626            Some(buf) => std::task::Poll::Ready(Some(ControlEvent::decode(buf))),
627            None => std::task::Poll::Ready(None),
628        }
629    }
630}
631
632#[derive(Debug)]
633pub enum ControlEvent {}
634
635impl ControlEvent {
636    /// Decodes a message buffer as a [`ControlEvent`].
637    fn decode(
638        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
639    ) -> Result<ControlEvent, fidl::Error> {
640        let (bytes, _handles) = buf.split_mut();
641        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
642        debug_assert_eq!(tx_header.tx_id, 0);
643        match tx_header.ordinal {
644            _ => Err(fidl::Error::UnknownOrdinal {
645                ordinal: tx_header.ordinal,
646                protocol_name: <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
647            }),
648        }
649    }
650}
651
652/// A Stream of incoming requests for fuchsia.net.settings/Control.
653pub struct ControlRequestStream {
654    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
655    is_terminated: bool,
656}
657
658impl std::marker::Unpin for ControlRequestStream {}
659
660impl futures::stream::FusedStream for ControlRequestStream {
661    fn is_terminated(&self) -> bool {
662        self.is_terminated
663    }
664}
665
666impl fidl::endpoints::RequestStream for ControlRequestStream {
667    type Protocol = ControlMarker;
668    type ControlHandle = ControlControlHandle;
669
670    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
671        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
672    }
673
674    fn control_handle(&self) -> Self::ControlHandle {
675        ControlControlHandle { inner: self.inner.clone() }
676    }
677
678    fn into_inner(
679        self,
680    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
681    {
682        (self.inner, self.is_terminated)
683    }
684
685    fn from_inner(
686        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
687        is_terminated: bool,
688    ) -> Self {
689        Self { inner, is_terminated }
690    }
691}
692
693impl futures::Stream for ControlRequestStream {
694    type Item = Result<ControlRequest, fidl::Error>;
695
696    fn poll_next(
697        mut self: std::pin::Pin<&mut Self>,
698        cx: &mut std::task::Context<'_>,
699    ) -> std::task::Poll<Option<Self::Item>> {
700        let this = &mut *self;
701        if this.inner.check_shutdown(cx) {
702            this.is_terminated = true;
703            return std::task::Poll::Ready(None);
704        }
705        if this.is_terminated {
706            panic!("polled ControlRequestStream after completion");
707        }
708        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
709            |bytes, handles| {
710                match this.inner.channel().read_etc(cx, bytes, handles) {
711                    std::task::Poll::Ready(Ok(())) => {}
712                    std::task::Poll::Pending => return std::task::Poll::Pending,
713                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
714                        this.is_terminated = true;
715                        return std::task::Poll::Ready(None);
716                    }
717                    std::task::Poll::Ready(Err(e)) => {
718                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
719                            e.into(),
720                        ))));
721                    }
722                }
723
724                // A message has been received from the channel
725                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
726
727                std::task::Poll::Ready(Some(match header.ordinal {
728                    0x46ea2036390abecc => {
729                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
730                        let mut req = fidl::new_empty!(
731                            fidl_fuchsia_net_interfaces_admin::Configuration,
732                            fidl::encoding::DefaultFuchsiaResourceDialect
733                        );
734                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl_fuchsia_net_interfaces_admin::Configuration>(&header, _body_bytes, handles, &mut req)?;
735                        let control_handle = ControlControlHandle { inner: this.inner.clone() };
736                        Ok(ControlRequest::UpdateInterfaceDefaults {
737                            payload: req,
738                            responder: ControlUpdateInterfaceDefaultsResponder {
739                                control_handle: std::mem::ManuallyDrop::new(control_handle),
740                                tx_id: header.tx_id,
741                            },
742                        })
743                    }
744                    0x4e768d74ec55450f => {
745                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
746                        let mut req =
747                            fidl::new_empty!(Tcp, fidl::encoding::DefaultFuchsiaResourceDialect);
748                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Tcp>(&header, _body_bytes, handles, &mut req)?;
749                        let control_handle = ControlControlHandle { inner: this.inner.clone() };
750                        Ok(ControlRequest::UpdateTcp {
751                            payload: req,
752                            responder: ControlUpdateTcpResponder {
753                                control_handle: std::mem::ManuallyDrop::new(control_handle),
754                                tx_id: header.tx_id,
755                            },
756                        })
757                    }
758                    0x6fb82be32e7338b4 => {
759                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
760                        let mut req =
761                            fidl::new_empty!(Udp, fidl::encoding::DefaultFuchsiaResourceDialect);
762                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Udp>(&header, _body_bytes, handles, &mut req)?;
763                        let control_handle = ControlControlHandle { inner: this.inner.clone() };
764                        Ok(ControlRequest::UpdateUdp {
765                            payload: req,
766                            responder: ControlUpdateUdpResponder {
767                                control_handle: std::mem::ManuallyDrop::new(control_handle),
768                                tx_id: header.tx_id,
769                            },
770                        })
771                    }
772                    0x42f130ff9cc3a8d5 => {
773                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
774                        let mut req =
775                            fidl::new_empty!(Icmp, fidl::encoding::DefaultFuchsiaResourceDialect);
776                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Icmp>(&header, _body_bytes, handles, &mut req)?;
777                        let control_handle = ControlControlHandle { inner: this.inner.clone() };
778                        Ok(ControlRequest::UpdateIcmp {
779                            payload: req,
780                            responder: ControlUpdateIcmpResponder {
781                                control_handle: std::mem::ManuallyDrop::new(control_handle),
782                                tx_id: header.tx_id,
783                            },
784                        })
785                    }
786                    0x75d1074407e4d1c4 => {
787                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
788                        let mut req =
789                            fidl::new_empty!(Ip, fidl::encoding::DefaultFuchsiaResourceDialect);
790                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ip>(&header, _body_bytes, handles, &mut req)?;
791                        let control_handle = ControlControlHandle { inner: this.inner.clone() };
792                        Ok(ControlRequest::UpdateIp {
793                            payload: req,
794                            responder: ControlUpdateIpResponder {
795                                control_handle: std::mem::ManuallyDrop::new(control_handle),
796                                tx_id: header.tx_id,
797                            },
798                        })
799                    }
800                    0x6080a91e617e9430 => {
801                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
802                        let mut req =
803                            fidl::new_empty!(Device, fidl::encoding::DefaultFuchsiaResourceDialect);
804                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Device>(&header, _body_bytes, handles, &mut req)?;
805                        let control_handle = ControlControlHandle { inner: this.inner.clone() };
806                        Ok(ControlRequest::UpdateDevice {
807                            payload: req,
808                            responder: ControlUpdateDeviceResponder {
809                                control_handle: std::mem::ManuallyDrop::new(control_handle),
810                                tx_id: header.tx_id,
811                            },
812                        })
813                    }
814                    _ => Err(fidl::Error::UnknownOrdinal {
815                        ordinal: header.ordinal,
816                        protocol_name:
817                            <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
818                    }),
819                }))
820            },
821        )
822    }
823}
824
825/// Provides control over the network stack namespace-wide configuration.
826#[derive(Debug)]
827pub enum ControlRequest {
828    /// Updates the default configurations for interfaces.
829    ///
830    /// New interfaces created take default values from this configuration.
831    ///
832    /// Note that some interface types may not support specific configurations,
833    /// in which case the value is either ignored or the network stack assigns a
834    /// server-assigned value.
835    ///
836    /// Only fields present in the provided [`Interface`] are set; unset fields
837    /// are left unmodified. The server returns a `Interface` which holds the
838    /// previous configuration for fields that were set in the request.
839    ///
840    /// No values are changed if an error is returned.
841    ///
842    /// + request configuration fields to update on the interface defaults.
843    /// - response a partial snapshot of the previous default configuration.
844    UpdateInterfaceDefaults {
845        payload: fidl_fuchsia_net_interfaces_admin::Configuration,
846        responder: ControlUpdateInterfaceDefaultsResponder,
847    },
848    /// Updates TCP settings.
849    ///
850    /// Only fields present in the provided [`Tcp`] are set; unset fields are
851    /// left unmodified. The server returns a `Tcp` which holds the previous
852    /// settings for fields that were set in the request.
853    ///
854    /// No values are changed if an error is returned.
855    ///
856    /// + request TCP settings fields to update.
857    /// - response a partial snapshot of the previous TCP settings.
858    UpdateTcp { payload: Tcp, responder: ControlUpdateTcpResponder },
859    /// Updates UDP settings.
860    ///
861    /// Only fields present in the provided [`Udp`] are set; unset fields are
862    /// left unmodified. The server returns a `Udp` which holds the previous
863    /// settings for fields that were set in the request.
864    ///
865    /// No values are changed if an error is returned.
866    ///
867    /// + request UDP settings fields to update.
868    /// - response a partial snapshot of the previous UDP settings.
869    UpdateUdp { payload: Udp, responder: ControlUpdateUdpResponder },
870    /// Updates ICMP settings.
871    ///
872    /// Only fields present in the provided [`Icmp`] are set; unset fields are
873    /// left unmodified. The server returns a `Icmp` which holds the previous
874    /// settings for fields that were set in the request.
875    ///
876    /// No values are changed if an error is returned.
877    ///
878    /// + request ICMP settings fields to update.
879    /// - response a partial snapshot of the previous ICMP settings.
880    UpdateIcmp { payload: Icmp, responder: ControlUpdateIcmpResponder },
881    /// Updates IP settings.
882    ///
883    /// Only fields present in the provided [`Ip`] are set; unset fields are
884    /// left unmodified. The server returns a `Ip` which holds the previous
885    /// settings for fields that were set in the request.
886    ///
887    /// No values are changed if an error is returned.
888    ///
889    /// + request IP settings fields to update.
890    /// - response a partial snapshot of the previous IP settings.
891    UpdateIp { payload: Ip, responder: ControlUpdateIpResponder },
892    /// Updates device layer settings.
893    ///
894    /// Only fields present in the provided [`Device`] are set; unset
895    /// fields are left unmodified. The server returns a `Device` which
896    /// holds the previous settings for fields that were set in the
897    /// request.
898    ///
899    /// No values are changed if an error is returned.
900    ///
901    /// + request device layer settings fields to update.
902    /// - response a partial snapshot of the previous device layer.
903    UpdateDevice { payload: Device, responder: ControlUpdateDeviceResponder },
904}
905
906impl ControlRequest {
907    #[allow(irrefutable_let_patterns)]
908    pub fn into_update_interface_defaults(
909        self,
910    ) -> Option<(
911        fidl_fuchsia_net_interfaces_admin::Configuration,
912        ControlUpdateInterfaceDefaultsResponder,
913    )> {
914        if let ControlRequest::UpdateInterfaceDefaults { payload, responder } = self {
915            Some((payload, responder))
916        } else {
917            None
918        }
919    }
920
921    #[allow(irrefutable_let_patterns)]
922    pub fn into_update_tcp(self) -> Option<(Tcp, ControlUpdateTcpResponder)> {
923        if let ControlRequest::UpdateTcp { payload, responder } = self {
924            Some((payload, responder))
925        } else {
926            None
927        }
928    }
929
930    #[allow(irrefutable_let_patterns)]
931    pub fn into_update_udp(self) -> Option<(Udp, ControlUpdateUdpResponder)> {
932        if let ControlRequest::UpdateUdp { payload, responder } = self {
933            Some((payload, responder))
934        } else {
935            None
936        }
937    }
938
939    #[allow(irrefutable_let_patterns)]
940    pub fn into_update_icmp(self) -> Option<(Icmp, ControlUpdateIcmpResponder)> {
941        if let ControlRequest::UpdateIcmp { payload, responder } = self {
942            Some((payload, responder))
943        } else {
944            None
945        }
946    }
947
948    #[allow(irrefutable_let_patterns)]
949    pub fn into_update_ip(self) -> Option<(Ip, ControlUpdateIpResponder)> {
950        if let ControlRequest::UpdateIp { payload, responder } = self {
951            Some((payload, responder))
952        } else {
953            None
954        }
955    }
956
957    #[allow(irrefutable_let_patterns)]
958    pub fn into_update_device(self) -> Option<(Device, ControlUpdateDeviceResponder)> {
959        if let ControlRequest::UpdateDevice { payload, responder } = self {
960            Some((payload, responder))
961        } else {
962            None
963        }
964    }
965
966    /// Name of the method defined in FIDL
967    pub fn method_name(&self) -> &'static str {
968        match *self {
969            ControlRequest::UpdateInterfaceDefaults { .. } => "update_interface_defaults",
970            ControlRequest::UpdateTcp { .. } => "update_tcp",
971            ControlRequest::UpdateUdp { .. } => "update_udp",
972            ControlRequest::UpdateIcmp { .. } => "update_icmp",
973            ControlRequest::UpdateIp { .. } => "update_ip",
974            ControlRequest::UpdateDevice { .. } => "update_device",
975        }
976    }
977}
978
979#[derive(Debug, Clone)]
980pub struct ControlControlHandle {
981    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
982}
983
984impl ControlControlHandle {
985    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
986        self.inner.shutdown_with_epitaph(status.into())
987    }
988}
989
990impl fidl::endpoints::ControlHandle for ControlControlHandle {
991    fn shutdown(&self) {
992        self.inner.shutdown()
993    }
994
995    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
996        self.inner.shutdown_with_epitaph(status)
997    }
998
999    fn is_closed(&self) -> bool {
1000        self.inner.channel().is_closed()
1001    }
1002    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1003        self.inner.channel().on_closed()
1004    }
1005
1006    #[cfg(target_os = "fuchsia")]
1007    fn signal_peer(
1008        &self,
1009        clear_mask: zx::Signals,
1010        set_mask: zx::Signals,
1011    ) -> Result<(), zx_status::Status> {
1012        use fidl::Peered;
1013        self.inner.channel().signal_peer(clear_mask, set_mask)
1014    }
1015}
1016
1017impl ControlControlHandle {}
1018
1019#[must_use = "FIDL methods require a response to be sent"]
1020#[derive(Debug)]
1021pub struct ControlUpdateInterfaceDefaultsResponder {
1022    control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
1023    tx_id: u32,
1024}
1025
1026/// Set the the channel to be shutdown (see [`ControlControlHandle::shutdown`])
1027/// if the responder is dropped without sending a response, so that the client
1028/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1029impl std::ops::Drop for ControlUpdateInterfaceDefaultsResponder {
1030    fn drop(&mut self) {
1031        self.control_handle.shutdown();
1032        // Safety: drops once, never accessed again
1033        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1034    }
1035}
1036
1037impl fidl::endpoints::Responder for ControlUpdateInterfaceDefaultsResponder {
1038    type ControlHandle = ControlControlHandle;
1039
1040    fn control_handle(&self) -> &ControlControlHandle {
1041        &self.control_handle
1042    }
1043
1044    fn drop_without_shutdown(mut self) {
1045        // Safety: drops once, never accessed again due to mem::forget
1046        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1047        // Prevent Drop from running (which would shut down the channel)
1048        std::mem::forget(self);
1049    }
1050}
1051
1052impl ControlUpdateInterfaceDefaultsResponder {
1053    /// Sends a response to the FIDL transaction.
1054    ///
1055    /// Sets the channel to shutdown if an error occurs.
1056    pub fn send(
1057        self,
1058        mut result: Result<&fidl_fuchsia_net_interfaces_admin::Configuration, UpdateError>,
1059    ) -> Result<(), fidl::Error> {
1060        let _result = self.send_raw(result);
1061        if _result.is_err() {
1062            self.control_handle.shutdown();
1063        }
1064        self.drop_without_shutdown();
1065        _result
1066    }
1067
1068    /// Similar to "send" but does not shutdown the channel if an error occurs.
1069    pub fn send_no_shutdown_on_err(
1070        self,
1071        mut result: Result<&fidl_fuchsia_net_interfaces_admin::Configuration, UpdateError>,
1072    ) -> Result<(), fidl::Error> {
1073        let _result = self.send_raw(result);
1074        self.drop_without_shutdown();
1075        _result
1076    }
1077
1078    fn send_raw(
1079        &self,
1080        mut result: Result<&fidl_fuchsia_net_interfaces_admin::Configuration, UpdateError>,
1081    ) -> Result<(), fidl::Error> {
1082        self.control_handle.inner.send::<fidl::encoding::ResultType<
1083            fidl_fuchsia_net_interfaces_admin::Configuration,
1084            UpdateError,
1085        >>(
1086            result,
1087            self.tx_id,
1088            0x46ea2036390abecc,
1089            fidl::encoding::DynamicFlags::empty(),
1090        )
1091    }
1092}
1093
1094#[must_use = "FIDL methods require a response to be sent"]
1095#[derive(Debug)]
1096pub struct ControlUpdateTcpResponder {
1097    control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
1098    tx_id: u32,
1099}
1100
1101/// Set the the channel to be shutdown (see [`ControlControlHandle::shutdown`])
1102/// if the responder is dropped without sending a response, so that the client
1103/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1104impl std::ops::Drop for ControlUpdateTcpResponder {
1105    fn drop(&mut self) {
1106        self.control_handle.shutdown();
1107        // Safety: drops once, never accessed again
1108        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1109    }
1110}
1111
1112impl fidl::endpoints::Responder for ControlUpdateTcpResponder {
1113    type ControlHandle = ControlControlHandle;
1114
1115    fn control_handle(&self) -> &ControlControlHandle {
1116        &self.control_handle
1117    }
1118
1119    fn drop_without_shutdown(mut self) {
1120        // Safety: drops once, never accessed again due to mem::forget
1121        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1122        // Prevent Drop from running (which would shut down the channel)
1123        std::mem::forget(self);
1124    }
1125}
1126
1127impl ControlUpdateTcpResponder {
1128    /// Sends a response to the FIDL transaction.
1129    ///
1130    /// Sets the channel to shutdown if an error occurs.
1131    pub fn send(self, mut result: Result<&Tcp, UpdateError>) -> Result<(), fidl::Error> {
1132        let _result = self.send_raw(result);
1133        if _result.is_err() {
1134            self.control_handle.shutdown();
1135        }
1136        self.drop_without_shutdown();
1137        _result
1138    }
1139
1140    /// Similar to "send" but does not shutdown the channel if an error occurs.
1141    pub fn send_no_shutdown_on_err(
1142        self,
1143        mut result: Result<&Tcp, UpdateError>,
1144    ) -> Result<(), fidl::Error> {
1145        let _result = self.send_raw(result);
1146        self.drop_without_shutdown();
1147        _result
1148    }
1149
1150    fn send_raw(&self, mut result: Result<&Tcp, UpdateError>) -> Result<(), fidl::Error> {
1151        self.control_handle.inner.send::<fidl::encoding::ResultType<Tcp, UpdateError>>(
1152            result,
1153            self.tx_id,
1154            0x4e768d74ec55450f,
1155            fidl::encoding::DynamicFlags::empty(),
1156        )
1157    }
1158}
1159
1160#[must_use = "FIDL methods require a response to be sent"]
1161#[derive(Debug)]
1162pub struct ControlUpdateUdpResponder {
1163    control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
1164    tx_id: u32,
1165}
1166
1167/// Set the the channel to be shutdown (see [`ControlControlHandle::shutdown`])
1168/// if the responder is dropped without sending a response, so that the client
1169/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1170impl std::ops::Drop for ControlUpdateUdpResponder {
1171    fn drop(&mut self) {
1172        self.control_handle.shutdown();
1173        // Safety: drops once, never accessed again
1174        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1175    }
1176}
1177
1178impl fidl::endpoints::Responder for ControlUpdateUdpResponder {
1179    type ControlHandle = ControlControlHandle;
1180
1181    fn control_handle(&self) -> &ControlControlHandle {
1182        &self.control_handle
1183    }
1184
1185    fn drop_without_shutdown(mut self) {
1186        // Safety: drops once, never accessed again due to mem::forget
1187        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1188        // Prevent Drop from running (which would shut down the channel)
1189        std::mem::forget(self);
1190    }
1191}
1192
1193impl ControlUpdateUdpResponder {
1194    /// Sends a response to the FIDL transaction.
1195    ///
1196    /// Sets the channel to shutdown if an error occurs.
1197    pub fn send(self, mut result: Result<&Udp, UpdateError>) -> Result<(), fidl::Error> {
1198        let _result = self.send_raw(result);
1199        if _result.is_err() {
1200            self.control_handle.shutdown();
1201        }
1202        self.drop_without_shutdown();
1203        _result
1204    }
1205
1206    /// Similar to "send" but does not shutdown the channel if an error occurs.
1207    pub fn send_no_shutdown_on_err(
1208        self,
1209        mut result: Result<&Udp, UpdateError>,
1210    ) -> Result<(), fidl::Error> {
1211        let _result = self.send_raw(result);
1212        self.drop_without_shutdown();
1213        _result
1214    }
1215
1216    fn send_raw(&self, mut result: Result<&Udp, UpdateError>) -> Result<(), fidl::Error> {
1217        self.control_handle.inner.send::<fidl::encoding::ResultType<Udp, UpdateError>>(
1218            result,
1219            self.tx_id,
1220            0x6fb82be32e7338b4,
1221            fidl::encoding::DynamicFlags::empty(),
1222        )
1223    }
1224}
1225
1226#[must_use = "FIDL methods require a response to be sent"]
1227#[derive(Debug)]
1228pub struct ControlUpdateIcmpResponder {
1229    control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
1230    tx_id: u32,
1231}
1232
1233/// Set the the channel to be shutdown (see [`ControlControlHandle::shutdown`])
1234/// if the responder is dropped without sending a response, so that the client
1235/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1236impl std::ops::Drop for ControlUpdateIcmpResponder {
1237    fn drop(&mut self) {
1238        self.control_handle.shutdown();
1239        // Safety: drops once, never accessed again
1240        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1241    }
1242}
1243
1244impl fidl::endpoints::Responder for ControlUpdateIcmpResponder {
1245    type ControlHandle = ControlControlHandle;
1246
1247    fn control_handle(&self) -> &ControlControlHandle {
1248        &self.control_handle
1249    }
1250
1251    fn drop_without_shutdown(mut self) {
1252        // Safety: drops once, never accessed again due to mem::forget
1253        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1254        // Prevent Drop from running (which would shut down the channel)
1255        std::mem::forget(self);
1256    }
1257}
1258
1259impl ControlUpdateIcmpResponder {
1260    /// Sends a response to the FIDL transaction.
1261    ///
1262    /// Sets the channel to shutdown if an error occurs.
1263    pub fn send(self, mut result: Result<&Icmp, UpdateError>) -> Result<(), fidl::Error> {
1264        let _result = self.send_raw(result);
1265        if _result.is_err() {
1266            self.control_handle.shutdown();
1267        }
1268        self.drop_without_shutdown();
1269        _result
1270    }
1271
1272    /// Similar to "send" but does not shutdown the channel if an error occurs.
1273    pub fn send_no_shutdown_on_err(
1274        self,
1275        mut result: Result<&Icmp, UpdateError>,
1276    ) -> Result<(), fidl::Error> {
1277        let _result = self.send_raw(result);
1278        self.drop_without_shutdown();
1279        _result
1280    }
1281
1282    fn send_raw(&self, mut result: Result<&Icmp, UpdateError>) -> Result<(), fidl::Error> {
1283        self.control_handle.inner.send::<fidl::encoding::ResultType<Icmp, UpdateError>>(
1284            result,
1285            self.tx_id,
1286            0x42f130ff9cc3a8d5,
1287            fidl::encoding::DynamicFlags::empty(),
1288        )
1289    }
1290}
1291
1292#[must_use = "FIDL methods require a response to be sent"]
1293#[derive(Debug)]
1294pub struct ControlUpdateIpResponder {
1295    control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
1296    tx_id: u32,
1297}
1298
1299/// Set the the channel to be shutdown (see [`ControlControlHandle::shutdown`])
1300/// if the responder is dropped without sending a response, so that the client
1301/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1302impl std::ops::Drop for ControlUpdateIpResponder {
1303    fn drop(&mut self) {
1304        self.control_handle.shutdown();
1305        // Safety: drops once, never accessed again
1306        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1307    }
1308}
1309
1310impl fidl::endpoints::Responder for ControlUpdateIpResponder {
1311    type ControlHandle = ControlControlHandle;
1312
1313    fn control_handle(&self) -> &ControlControlHandle {
1314        &self.control_handle
1315    }
1316
1317    fn drop_without_shutdown(mut self) {
1318        // Safety: drops once, never accessed again due to mem::forget
1319        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1320        // Prevent Drop from running (which would shut down the channel)
1321        std::mem::forget(self);
1322    }
1323}
1324
1325impl ControlUpdateIpResponder {
1326    /// Sends a response to the FIDL transaction.
1327    ///
1328    /// Sets the channel to shutdown if an error occurs.
1329    pub fn send(self, mut result: Result<&Ip, UpdateError>) -> Result<(), fidl::Error> {
1330        let _result = self.send_raw(result);
1331        if _result.is_err() {
1332            self.control_handle.shutdown();
1333        }
1334        self.drop_without_shutdown();
1335        _result
1336    }
1337
1338    /// Similar to "send" but does not shutdown the channel if an error occurs.
1339    pub fn send_no_shutdown_on_err(
1340        self,
1341        mut result: Result<&Ip, UpdateError>,
1342    ) -> Result<(), fidl::Error> {
1343        let _result = self.send_raw(result);
1344        self.drop_without_shutdown();
1345        _result
1346    }
1347
1348    fn send_raw(&self, mut result: Result<&Ip, UpdateError>) -> Result<(), fidl::Error> {
1349        self.control_handle.inner.send::<fidl::encoding::ResultType<Ip, UpdateError>>(
1350            result,
1351            self.tx_id,
1352            0x75d1074407e4d1c4,
1353            fidl::encoding::DynamicFlags::empty(),
1354        )
1355    }
1356}
1357
1358#[must_use = "FIDL methods require a response to be sent"]
1359#[derive(Debug)]
1360pub struct ControlUpdateDeviceResponder {
1361    control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
1362    tx_id: u32,
1363}
1364
1365/// Set the the channel to be shutdown (see [`ControlControlHandle::shutdown`])
1366/// if the responder is dropped without sending a response, so that the client
1367/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1368impl std::ops::Drop for ControlUpdateDeviceResponder {
1369    fn drop(&mut self) {
1370        self.control_handle.shutdown();
1371        // Safety: drops once, never accessed again
1372        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1373    }
1374}
1375
1376impl fidl::endpoints::Responder for ControlUpdateDeviceResponder {
1377    type ControlHandle = ControlControlHandle;
1378
1379    fn control_handle(&self) -> &ControlControlHandle {
1380        &self.control_handle
1381    }
1382
1383    fn drop_without_shutdown(mut self) {
1384        // Safety: drops once, never accessed again due to mem::forget
1385        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1386        // Prevent Drop from running (which would shut down the channel)
1387        std::mem::forget(self);
1388    }
1389}
1390
1391impl ControlUpdateDeviceResponder {
1392    /// Sends a response to the FIDL transaction.
1393    ///
1394    /// Sets the channel to shutdown if an error occurs.
1395    pub fn send(self, mut result: Result<&Device, UpdateError>) -> Result<(), fidl::Error> {
1396        let _result = self.send_raw(result);
1397        if _result.is_err() {
1398            self.control_handle.shutdown();
1399        }
1400        self.drop_without_shutdown();
1401        _result
1402    }
1403
1404    /// Similar to "send" but does not shutdown the channel if an error occurs.
1405    pub fn send_no_shutdown_on_err(
1406        self,
1407        mut result: Result<&Device, UpdateError>,
1408    ) -> Result<(), fidl::Error> {
1409        let _result = self.send_raw(result);
1410        self.drop_without_shutdown();
1411        _result
1412    }
1413
1414    fn send_raw(&self, mut result: Result<&Device, UpdateError>) -> Result<(), fidl::Error> {
1415        self.control_handle.inner.send::<fidl::encoding::ResultType<Device, UpdateError>>(
1416            result,
1417            self.tx_id,
1418            0x6080a91e617e9430,
1419            fidl::encoding::DynamicFlags::empty(),
1420        )
1421    }
1422}
1423
1424#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1425pub struct StateMarker;
1426
1427impl fidl::endpoints::ProtocolMarker for StateMarker {
1428    type Proxy = StateProxy;
1429    type RequestStream = StateRequestStream;
1430    #[cfg(target_os = "fuchsia")]
1431    type SynchronousProxy = StateSynchronousProxy;
1432
1433    const DEBUG_NAME: &'static str = "fuchsia.net.settings.State";
1434}
1435impl fidl::endpoints::DiscoverableProtocolMarker for StateMarker {}
1436
1437pub trait StateProxyInterface: Send + Sync {
1438    type GetInterfaceDefaultsResponseFut: std::future::Future<
1439            Output = Result<fidl_fuchsia_net_interfaces_admin::Configuration, fidl::Error>,
1440        > + Send;
1441    fn r#get_interface_defaults(&self) -> Self::GetInterfaceDefaultsResponseFut;
1442    type GetTcpResponseFut: std::future::Future<Output = Result<Tcp, fidl::Error>> + Send;
1443    fn r#get_tcp(&self) -> Self::GetTcpResponseFut;
1444    type GetUdpResponseFut: std::future::Future<Output = Result<Udp, fidl::Error>> + Send;
1445    fn r#get_udp(&self) -> Self::GetUdpResponseFut;
1446    type GetIcmpResponseFut: std::future::Future<Output = Result<Icmp, fidl::Error>> + Send;
1447    fn r#get_icmp(&self) -> Self::GetIcmpResponseFut;
1448    type GetIpResponseFut: std::future::Future<Output = Result<Ip, fidl::Error>> + Send;
1449    fn r#get_ip(&self) -> Self::GetIpResponseFut;
1450    type GetDeviceResponseFut: std::future::Future<Output = Result<Device, fidl::Error>> + Send;
1451    fn r#get_device(&self) -> Self::GetDeviceResponseFut;
1452}
1453#[derive(Debug)]
1454#[cfg(target_os = "fuchsia")]
1455pub struct StateSynchronousProxy {
1456    client: fidl::client::sync::Client,
1457}
1458
1459#[cfg(target_os = "fuchsia")]
1460impl fidl::endpoints::SynchronousProxy for StateSynchronousProxy {
1461    type Proxy = StateProxy;
1462    type Protocol = StateMarker;
1463
1464    fn from_channel(inner: fidl::Channel) -> Self {
1465        Self::new(inner)
1466    }
1467
1468    fn into_channel(self) -> fidl::Channel {
1469        self.client.into_channel()
1470    }
1471
1472    fn as_channel(&self) -> &fidl::Channel {
1473        self.client.as_channel()
1474    }
1475}
1476
1477#[cfg(target_os = "fuchsia")]
1478impl StateSynchronousProxy {
1479    pub fn new(channel: fidl::Channel) -> Self {
1480        Self { client: fidl::client::sync::Client::new(channel) }
1481    }
1482
1483    pub fn into_channel(self) -> fidl::Channel {
1484        self.client.into_channel()
1485    }
1486
1487    /// Waits until an event arrives and returns it. It is safe for other
1488    /// threads to make concurrent requests while waiting for an event.
1489    pub fn wait_for_event(
1490        &self,
1491        deadline: zx::MonotonicInstant,
1492    ) -> Result<StateEvent, fidl::Error> {
1493        StateEvent::decode(self.client.wait_for_event::<StateMarker>(deadline)?)
1494    }
1495
1496    /// Returns the current default settings for interfaces.
1497    pub fn r#get_interface_defaults(
1498        &self,
1499        ___deadline: zx::MonotonicInstant,
1500    ) -> Result<fidl_fuchsia_net_interfaces_admin::Configuration, fidl::Error> {
1501        let _response = self.client.send_query::<
1502            fidl::encoding::EmptyPayload,
1503            fidl_fuchsia_net_interfaces_admin::Configuration,
1504            StateMarker,
1505        >(
1506            (),
1507            0x4c4824a322a705e3,
1508            fidl::encoding::DynamicFlags::empty(),
1509            ___deadline,
1510        )?;
1511        Ok(_response)
1512    }
1513
1514    /// Returns the current TCP settings values.
1515    pub fn r#get_tcp(&self, ___deadline: zx::MonotonicInstant) -> Result<Tcp, fidl::Error> {
1516        let _response = self.client.send_query::<fidl::encoding::EmptyPayload, Tcp, StateMarker>(
1517            (),
1518            0x4e818d8a89985b70,
1519            fidl::encoding::DynamicFlags::empty(),
1520            ___deadline,
1521        )?;
1522        Ok(_response)
1523    }
1524
1525    /// Returns the current UDP settings values.
1526    pub fn r#get_udp(&self, ___deadline: zx::MonotonicInstant) -> Result<Udp, fidl::Error> {
1527        let _response = self.client.send_query::<fidl::encoding::EmptyPayload, Udp, StateMarker>(
1528            (),
1529            0x1af3bc1507b7a196,
1530            fidl::encoding::DynamicFlags::empty(),
1531            ___deadline,
1532        )?;
1533        Ok(_response)
1534    }
1535
1536    /// Returns the current ICMP settings values.
1537    pub fn r#get_icmp(&self, ___deadline: zx::MonotonicInstant) -> Result<Icmp, fidl::Error> {
1538        let _response = self.client.send_query::<fidl::encoding::EmptyPayload, Icmp, StateMarker>(
1539            (),
1540            0x4079fd71ca65e33f,
1541            fidl::encoding::DynamicFlags::empty(),
1542            ___deadline,
1543        )?;
1544        Ok(_response)
1545    }
1546
1547    /// Returns the current IP settings values.
1548    pub fn r#get_ip(&self, ___deadline: zx::MonotonicInstant) -> Result<Ip, fidl::Error> {
1549        let _response = self.client.send_query::<fidl::encoding::EmptyPayload, Ip, StateMarker>(
1550            (),
1551            0x2c1cc13f4874956,
1552            fidl::encoding::DynamicFlags::empty(),
1553            ___deadline,
1554        )?;
1555        Ok(_response)
1556    }
1557
1558    /// Returns the current device layer settings values.
1559    pub fn r#get_device(&self, ___deadline: zx::MonotonicInstant) -> Result<Device, fidl::Error> {
1560        let _response =
1561            self.client.send_query::<fidl::encoding::EmptyPayload, Device, StateMarker>(
1562                (),
1563                0x5713a85352e43887,
1564                fidl::encoding::DynamicFlags::empty(),
1565                ___deadline,
1566            )?;
1567        Ok(_response)
1568    }
1569}
1570
1571#[cfg(target_os = "fuchsia")]
1572impl From<StateSynchronousProxy> for zx::NullableHandle {
1573    fn from(value: StateSynchronousProxy) -> Self {
1574        value.into_channel().into()
1575    }
1576}
1577
1578#[cfg(target_os = "fuchsia")]
1579impl From<fidl::Channel> for StateSynchronousProxy {
1580    fn from(value: fidl::Channel) -> Self {
1581        Self::new(value)
1582    }
1583}
1584
1585#[cfg(target_os = "fuchsia")]
1586impl fidl::endpoints::FromClient for StateSynchronousProxy {
1587    type Protocol = StateMarker;
1588
1589    fn from_client(value: fidl::endpoints::ClientEnd<StateMarker>) -> Self {
1590        Self::new(value.into_channel())
1591    }
1592}
1593
1594#[derive(Debug, Clone)]
1595pub struct StateProxy {
1596    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1597}
1598
1599impl fidl::endpoints::Proxy for StateProxy {
1600    type Protocol = StateMarker;
1601
1602    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1603        Self::new(inner)
1604    }
1605
1606    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1607        self.client.into_channel().map_err(|client| Self { client })
1608    }
1609
1610    fn as_channel(&self) -> &::fidl::AsyncChannel {
1611        self.client.as_channel()
1612    }
1613}
1614
1615impl StateProxy {
1616    /// Create a new Proxy for fuchsia.net.settings/State.
1617    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1618        let protocol_name = <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1619        Self { client: fidl::client::Client::new(channel, protocol_name) }
1620    }
1621
1622    /// Get a Stream of events from the remote end of the protocol.
1623    ///
1624    /// # Panics
1625    ///
1626    /// Panics if the event stream was already taken.
1627    pub fn take_event_stream(&self) -> StateEventStream {
1628        StateEventStream { event_receiver: self.client.take_event_receiver() }
1629    }
1630
1631    /// Returns the current default settings for interfaces.
1632    pub fn r#get_interface_defaults(
1633        &self,
1634    ) -> fidl::client::QueryResponseFut<
1635        fidl_fuchsia_net_interfaces_admin::Configuration,
1636        fidl::encoding::DefaultFuchsiaResourceDialect,
1637    > {
1638        StateProxyInterface::r#get_interface_defaults(self)
1639    }
1640
1641    /// Returns the current TCP settings values.
1642    pub fn r#get_tcp(
1643        &self,
1644    ) -> fidl::client::QueryResponseFut<Tcp, fidl::encoding::DefaultFuchsiaResourceDialect> {
1645        StateProxyInterface::r#get_tcp(self)
1646    }
1647
1648    /// Returns the current UDP settings values.
1649    pub fn r#get_udp(
1650        &self,
1651    ) -> fidl::client::QueryResponseFut<Udp, fidl::encoding::DefaultFuchsiaResourceDialect> {
1652        StateProxyInterface::r#get_udp(self)
1653    }
1654
1655    /// Returns the current ICMP settings values.
1656    pub fn r#get_icmp(
1657        &self,
1658    ) -> fidl::client::QueryResponseFut<Icmp, fidl::encoding::DefaultFuchsiaResourceDialect> {
1659        StateProxyInterface::r#get_icmp(self)
1660    }
1661
1662    /// Returns the current IP settings values.
1663    pub fn r#get_ip(
1664        &self,
1665    ) -> fidl::client::QueryResponseFut<Ip, fidl::encoding::DefaultFuchsiaResourceDialect> {
1666        StateProxyInterface::r#get_ip(self)
1667    }
1668
1669    /// Returns the current device layer settings values.
1670    pub fn r#get_device(
1671        &self,
1672    ) -> fidl::client::QueryResponseFut<Device, fidl::encoding::DefaultFuchsiaResourceDialect> {
1673        StateProxyInterface::r#get_device(self)
1674    }
1675}
1676
1677impl StateProxyInterface for StateProxy {
1678    type GetInterfaceDefaultsResponseFut = fidl::client::QueryResponseFut<
1679        fidl_fuchsia_net_interfaces_admin::Configuration,
1680        fidl::encoding::DefaultFuchsiaResourceDialect,
1681    >;
1682    fn r#get_interface_defaults(&self) -> Self::GetInterfaceDefaultsResponseFut {
1683        fn _decode(
1684            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1685        ) -> Result<fidl_fuchsia_net_interfaces_admin::Configuration, fidl::Error> {
1686            let _response = fidl::client::decode_transaction_body::<
1687                fidl_fuchsia_net_interfaces_admin::Configuration,
1688                fidl::encoding::DefaultFuchsiaResourceDialect,
1689                0x4c4824a322a705e3,
1690            >(_buf?)?;
1691            Ok(_response)
1692        }
1693        self.client.send_query_and_decode::<
1694            fidl::encoding::EmptyPayload,
1695            fidl_fuchsia_net_interfaces_admin::Configuration,
1696        >(
1697            (),
1698            0x4c4824a322a705e3,
1699            fidl::encoding::DynamicFlags::empty(),
1700            _decode,
1701        )
1702    }
1703
1704    type GetTcpResponseFut =
1705        fidl::client::QueryResponseFut<Tcp, fidl::encoding::DefaultFuchsiaResourceDialect>;
1706    fn r#get_tcp(&self) -> Self::GetTcpResponseFut {
1707        fn _decode(
1708            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1709        ) -> Result<Tcp, fidl::Error> {
1710            let _response = fidl::client::decode_transaction_body::<
1711                Tcp,
1712                fidl::encoding::DefaultFuchsiaResourceDialect,
1713                0x4e818d8a89985b70,
1714            >(_buf?)?;
1715            Ok(_response)
1716        }
1717        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Tcp>(
1718            (),
1719            0x4e818d8a89985b70,
1720            fidl::encoding::DynamicFlags::empty(),
1721            _decode,
1722        )
1723    }
1724
1725    type GetUdpResponseFut =
1726        fidl::client::QueryResponseFut<Udp, fidl::encoding::DefaultFuchsiaResourceDialect>;
1727    fn r#get_udp(&self) -> Self::GetUdpResponseFut {
1728        fn _decode(
1729            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1730        ) -> Result<Udp, fidl::Error> {
1731            let _response = fidl::client::decode_transaction_body::<
1732                Udp,
1733                fidl::encoding::DefaultFuchsiaResourceDialect,
1734                0x1af3bc1507b7a196,
1735            >(_buf?)?;
1736            Ok(_response)
1737        }
1738        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Udp>(
1739            (),
1740            0x1af3bc1507b7a196,
1741            fidl::encoding::DynamicFlags::empty(),
1742            _decode,
1743        )
1744    }
1745
1746    type GetIcmpResponseFut =
1747        fidl::client::QueryResponseFut<Icmp, fidl::encoding::DefaultFuchsiaResourceDialect>;
1748    fn r#get_icmp(&self) -> Self::GetIcmpResponseFut {
1749        fn _decode(
1750            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1751        ) -> Result<Icmp, fidl::Error> {
1752            let _response = fidl::client::decode_transaction_body::<
1753                Icmp,
1754                fidl::encoding::DefaultFuchsiaResourceDialect,
1755                0x4079fd71ca65e33f,
1756            >(_buf?)?;
1757            Ok(_response)
1758        }
1759        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Icmp>(
1760            (),
1761            0x4079fd71ca65e33f,
1762            fidl::encoding::DynamicFlags::empty(),
1763            _decode,
1764        )
1765    }
1766
1767    type GetIpResponseFut =
1768        fidl::client::QueryResponseFut<Ip, fidl::encoding::DefaultFuchsiaResourceDialect>;
1769    fn r#get_ip(&self) -> Self::GetIpResponseFut {
1770        fn _decode(
1771            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1772        ) -> Result<Ip, fidl::Error> {
1773            let _response = fidl::client::decode_transaction_body::<
1774                Ip,
1775                fidl::encoding::DefaultFuchsiaResourceDialect,
1776                0x2c1cc13f4874956,
1777            >(_buf?)?;
1778            Ok(_response)
1779        }
1780        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Ip>(
1781            (),
1782            0x2c1cc13f4874956,
1783            fidl::encoding::DynamicFlags::empty(),
1784            _decode,
1785        )
1786    }
1787
1788    type GetDeviceResponseFut =
1789        fidl::client::QueryResponseFut<Device, fidl::encoding::DefaultFuchsiaResourceDialect>;
1790    fn r#get_device(&self) -> Self::GetDeviceResponseFut {
1791        fn _decode(
1792            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1793        ) -> Result<Device, fidl::Error> {
1794            let _response = fidl::client::decode_transaction_body::<
1795                Device,
1796                fidl::encoding::DefaultFuchsiaResourceDialect,
1797                0x5713a85352e43887,
1798            >(_buf?)?;
1799            Ok(_response)
1800        }
1801        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Device>(
1802            (),
1803            0x5713a85352e43887,
1804            fidl::encoding::DynamicFlags::empty(),
1805            _decode,
1806        )
1807    }
1808}
1809
1810pub struct StateEventStream {
1811    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1812}
1813
1814impl std::marker::Unpin for StateEventStream {}
1815
1816impl futures::stream::FusedStream for StateEventStream {
1817    fn is_terminated(&self) -> bool {
1818        self.event_receiver.is_terminated()
1819    }
1820}
1821
1822impl futures::Stream for StateEventStream {
1823    type Item = Result<StateEvent, fidl::Error>;
1824
1825    fn poll_next(
1826        mut self: std::pin::Pin<&mut Self>,
1827        cx: &mut std::task::Context<'_>,
1828    ) -> std::task::Poll<Option<Self::Item>> {
1829        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1830            &mut self.event_receiver,
1831            cx
1832        )?) {
1833            Some(buf) => std::task::Poll::Ready(Some(StateEvent::decode(buf))),
1834            None => std::task::Poll::Ready(None),
1835        }
1836    }
1837}
1838
1839#[derive(Debug)]
1840pub enum StateEvent {}
1841
1842impl StateEvent {
1843    /// Decodes a message buffer as a [`StateEvent`].
1844    fn decode(
1845        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1846    ) -> Result<StateEvent, fidl::Error> {
1847        let (bytes, _handles) = buf.split_mut();
1848        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1849        debug_assert_eq!(tx_header.tx_id, 0);
1850        match tx_header.ordinal {
1851            _ => Err(fidl::Error::UnknownOrdinal {
1852                ordinal: tx_header.ordinal,
1853                protocol_name: <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1854            }),
1855        }
1856    }
1857}
1858
1859/// A Stream of incoming requests for fuchsia.net.settings/State.
1860pub struct StateRequestStream {
1861    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1862    is_terminated: bool,
1863}
1864
1865impl std::marker::Unpin for StateRequestStream {}
1866
1867impl futures::stream::FusedStream for StateRequestStream {
1868    fn is_terminated(&self) -> bool {
1869        self.is_terminated
1870    }
1871}
1872
1873impl fidl::endpoints::RequestStream for StateRequestStream {
1874    type Protocol = StateMarker;
1875    type ControlHandle = StateControlHandle;
1876
1877    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1878        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1879    }
1880
1881    fn control_handle(&self) -> Self::ControlHandle {
1882        StateControlHandle { inner: self.inner.clone() }
1883    }
1884
1885    fn into_inner(
1886        self,
1887    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1888    {
1889        (self.inner, self.is_terminated)
1890    }
1891
1892    fn from_inner(
1893        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1894        is_terminated: bool,
1895    ) -> Self {
1896        Self { inner, is_terminated }
1897    }
1898}
1899
1900impl futures::Stream for StateRequestStream {
1901    type Item = Result<StateRequest, fidl::Error>;
1902
1903    fn poll_next(
1904        mut self: std::pin::Pin<&mut Self>,
1905        cx: &mut std::task::Context<'_>,
1906    ) -> std::task::Poll<Option<Self::Item>> {
1907        let this = &mut *self;
1908        if this.inner.check_shutdown(cx) {
1909            this.is_terminated = true;
1910            return std::task::Poll::Ready(None);
1911        }
1912        if this.is_terminated {
1913            panic!("polled StateRequestStream after completion");
1914        }
1915        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1916            |bytes, handles| {
1917                match this.inner.channel().read_etc(cx, bytes, handles) {
1918                    std::task::Poll::Ready(Ok(())) => {}
1919                    std::task::Poll::Pending => return std::task::Poll::Pending,
1920                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1921                        this.is_terminated = true;
1922                        return std::task::Poll::Ready(None);
1923                    }
1924                    std::task::Poll::Ready(Err(e)) => {
1925                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1926                            e.into(),
1927                        ))));
1928                    }
1929                }
1930
1931                // A message has been received from the channel
1932                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1933
1934                std::task::Poll::Ready(Some(match header.ordinal {
1935                    0x4c4824a322a705e3 => {
1936                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1937                        let mut req = fidl::new_empty!(
1938                            fidl::encoding::EmptyPayload,
1939                            fidl::encoding::DefaultFuchsiaResourceDialect
1940                        );
1941                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1942                        let control_handle = StateControlHandle { inner: this.inner.clone() };
1943                        Ok(StateRequest::GetInterfaceDefaults {
1944                            responder: StateGetInterfaceDefaultsResponder {
1945                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1946                                tx_id: header.tx_id,
1947                            },
1948                        })
1949                    }
1950                    0x4e818d8a89985b70 => {
1951                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1952                        let mut req = fidl::new_empty!(
1953                            fidl::encoding::EmptyPayload,
1954                            fidl::encoding::DefaultFuchsiaResourceDialect
1955                        );
1956                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1957                        let control_handle = StateControlHandle { inner: this.inner.clone() };
1958                        Ok(StateRequest::GetTcp {
1959                            responder: StateGetTcpResponder {
1960                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1961                                tx_id: header.tx_id,
1962                            },
1963                        })
1964                    }
1965                    0x1af3bc1507b7a196 => {
1966                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1967                        let mut req = fidl::new_empty!(
1968                            fidl::encoding::EmptyPayload,
1969                            fidl::encoding::DefaultFuchsiaResourceDialect
1970                        );
1971                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1972                        let control_handle = StateControlHandle { inner: this.inner.clone() };
1973                        Ok(StateRequest::GetUdp {
1974                            responder: StateGetUdpResponder {
1975                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1976                                tx_id: header.tx_id,
1977                            },
1978                        })
1979                    }
1980                    0x4079fd71ca65e33f => {
1981                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1982                        let mut req = fidl::new_empty!(
1983                            fidl::encoding::EmptyPayload,
1984                            fidl::encoding::DefaultFuchsiaResourceDialect
1985                        );
1986                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1987                        let control_handle = StateControlHandle { inner: this.inner.clone() };
1988                        Ok(StateRequest::GetIcmp {
1989                            responder: StateGetIcmpResponder {
1990                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1991                                tx_id: header.tx_id,
1992                            },
1993                        })
1994                    }
1995                    0x2c1cc13f4874956 => {
1996                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1997                        let mut req = fidl::new_empty!(
1998                            fidl::encoding::EmptyPayload,
1999                            fidl::encoding::DefaultFuchsiaResourceDialect
2000                        );
2001                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2002                        let control_handle = StateControlHandle { inner: this.inner.clone() };
2003                        Ok(StateRequest::GetIp {
2004                            responder: StateGetIpResponder {
2005                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2006                                tx_id: header.tx_id,
2007                            },
2008                        })
2009                    }
2010                    0x5713a85352e43887 => {
2011                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2012                        let mut req = fidl::new_empty!(
2013                            fidl::encoding::EmptyPayload,
2014                            fidl::encoding::DefaultFuchsiaResourceDialect
2015                        );
2016                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2017                        let control_handle = StateControlHandle { inner: this.inner.clone() };
2018                        Ok(StateRequest::GetDevice {
2019                            responder: StateGetDeviceResponder {
2020                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2021                                tx_id: header.tx_id,
2022                            },
2023                        })
2024                    }
2025                    _ => Err(fidl::Error::UnknownOrdinal {
2026                        ordinal: header.ordinal,
2027                        protocol_name: <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2028                    }),
2029                }))
2030            },
2031        )
2032    }
2033}
2034
2035/// Provides read access to the network stack namespace-wide settings.
2036#[derive(Debug)]
2037pub enum StateRequest {
2038    /// Returns the current default settings for interfaces.
2039    GetInterfaceDefaults { responder: StateGetInterfaceDefaultsResponder },
2040    /// Returns the current TCP settings values.
2041    GetTcp { responder: StateGetTcpResponder },
2042    /// Returns the current UDP settings values.
2043    GetUdp { responder: StateGetUdpResponder },
2044    /// Returns the current ICMP settings values.
2045    GetIcmp { responder: StateGetIcmpResponder },
2046    /// Returns the current IP settings values.
2047    GetIp { responder: StateGetIpResponder },
2048    /// Returns the current device layer settings values.
2049    GetDevice { responder: StateGetDeviceResponder },
2050}
2051
2052impl StateRequest {
2053    #[allow(irrefutable_let_patterns)]
2054    pub fn into_get_interface_defaults(self) -> Option<(StateGetInterfaceDefaultsResponder)> {
2055        if let StateRequest::GetInterfaceDefaults { responder } = self {
2056            Some((responder))
2057        } else {
2058            None
2059        }
2060    }
2061
2062    #[allow(irrefutable_let_patterns)]
2063    pub fn into_get_tcp(self) -> Option<(StateGetTcpResponder)> {
2064        if let StateRequest::GetTcp { responder } = self { Some((responder)) } else { None }
2065    }
2066
2067    #[allow(irrefutable_let_patterns)]
2068    pub fn into_get_udp(self) -> Option<(StateGetUdpResponder)> {
2069        if let StateRequest::GetUdp { responder } = self { Some((responder)) } else { None }
2070    }
2071
2072    #[allow(irrefutable_let_patterns)]
2073    pub fn into_get_icmp(self) -> Option<(StateGetIcmpResponder)> {
2074        if let StateRequest::GetIcmp { responder } = self { Some((responder)) } else { None }
2075    }
2076
2077    #[allow(irrefutable_let_patterns)]
2078    pub fn into_get_ip(self) -> Option<(StateGetIpResponder)> {
2079        if let StateRequest::GetIp { responder } = self { Some((responder)) } else { None }
2080    }
2081
2082    #[allow(irrefutable_let_patterns)]
2083    pub fn into_get_device(self) -> Option<(StateGetDeviceResponder)> {
2084        if let StateRequest::GetDevice { responder } = self { Some((responder)) } else { None }
2085    }
2086
2087    /// Name of the method defined in FIDL
2088    pub fn method_name(&self) -> &'static str {
2089        match *self {
2090            StateRequest::GetInterfaceDefaults { .. } => "get_interface_defaults",
2091            StateRequest::GetTcp { .. } => "get_tcp",
2092            StateRequest::GetUdp { .. } => "get_udp",
2093            StateRequest::GetIcmp { .. } => "get_icmp",
2094            StateRequest::GetIp { .. } => "get_ip",
2095            StateRequest::GetDevice { .. } => "get_device",
2096        }
2097    }
2098}
2099
2100#[derive(Debug, Clone)]
2101pub struct StateControlHandle {
2102    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2103}
2104
2105impl StateControlHandle {
2106    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2107        self.inner.shutdown_with_epitaph(status.into())
2108    }
2109}
2110
2111impl fidl::endpoints::ControlHandle for StateControlHandle {
2112    fn shutdown(&self) {
2113        self.inner.shutdown()
2114    }
2115
2116    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2117        self.inner.shutdown_with_epitaph(status)
2118    }
2119
2120    fn is_closed(&self) -> bool {
2121        self.inner.channel().is_closed()
2122    }
2123    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2124        self.inner.channel().on_closed()
2125    }
2126
2127    #[cfg(target_os = "fuchsia")]
2128    fn signal_peer(
2129        &self,
2130        clear_mask: zx::Signals,
2131        set_mask: zx::Signals,
2132    ) -> Result<(), zx_status::Status> {
2133        use fidl::Peered;
2134        self.inner.channel().signal_peer(clear_mask, set_mask)
2135    }
2136}
2137
2138impl StateControlHandle {}
2139
2140#[must_use = "FIDL methods require a response to be sent"]
2141#[derive(Debug)]
2142pub struct StateGetInterfaceDefaultsResponder {
2143    control_handle: std::mem::ManuallyDrop<StateControlHandle>,
2144    tx_id: u32,
2145}
2146
2147/// Set the the channel to be shutdown (see [`StateControlHandle::shutdown`])
2148/// if the responder is dropped without sending a response, so that the client
2149/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2150impl std::ops::Drop for StateGetInterfaceDefaultsResponder {
2151    fn drop(&mut self) {
2152        self.control_handle.shutdown();
2153        // Safety: drops once, never accessed again
2154        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2155    }
2156}
2157
2158impl fidl::endpoints::Responder for StateGetInterfaceDefaultsResponder {
2159    type ControlHandle = StateControlHandle;
2160
2161    fn control_handle(&self) -> &StateControlHandle {
2162        &self.control_handle
2163    }
2164
2165    fn drop_without_shutdown(mut self) {
2166        // Safety: drops once, never accessed again due to mem::forget
2167        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2168        // Prevent Drop from running (which would shut down the channel)
2169        std::mem::forget(self);
2170    }
2171}
2172
2173impl StateGetInterfaceDefaultsResponder {
2174    /// Sends a response to the FIDL transaction.
2175    ///
2176    /// Sets the channel to shutdown if an error occurs.
2177    pub fn send(
2178        self,
2179        mut payload: &fidl_fuchsia_net_interfaces_admin::Configuration,
2180    ) -> Result<(), fidl::Error> {
2181        let _result = self.send_raw(payload);
2182        if _result.is_err() {
2183            self.control_handle.shutdown();
2184        }
2185        self.drop_without_shutdown();
2186        _result
2187    }
2188
2189    /// Similar to "send" but does not shutdown the channel if an error occurs.
2190    pub fn send_no_shutdown_on_err(
2191        self,
2192        mut payload: &fidl_fuchsia_net_interfaces_admin::Configuration,
2193    ) -> Result<(), fidl::Error> {
2194        let _result = self.send_raw(payload);
2195        self.drop_without_shutdown();
2196        _result
2197    }
2198
2199    fn send_raw(
2200        &self,
2201        mut payload: &fidl_fuchsia_net_interfaces_admin::Configuration,
2202    ) -> Result<(), fidl::Error> {
2203        self.control_handle.inner.send::<fidl_fuchsia_net_interfaces_admin::Configuration>(
2204            payload,
2205            self.tx_id,
2206            0x4c4824a322a705e3,
2207            fidl::encoding::DynamicFlags::empty(),
2208        )
2209    }
2210}
2211
2212#[must_use = "FIDL methods require a response to be sent"]
2213#[derive(Debug)]
2214pub struct StateGetTcpResponder {
2215    control_handle: std::mem::ManuallyDrop<StateControlHandle>,
2216    tx_id: u32,
2217}
2218
2219/// Set the the channel to be shutdown (see [`StateControlHandle::shutdown`])
2220/// if the responder is dropped without sending a response, so that the client
2221/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2222impl std::ops::Drop for StateGetTcpResponder {
2223    fn drop(&mut self) {
2224        self.control_handle.shutdown();
2225        // Safety: drops once, never accessed again
2226        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2227    }
2228}
2229
2230impl fidl::endpoints::Responder for StateGetTcpResponder {
2231    type ControlHandle = StateControlHandle;
2232
2233    fn control_handle(&self) -> &StateControlHandle {
2234        &self.control_handle
2235    }
2236
2237    fn drop_without_shutdown(mut self) {
2238        // Safety: drops once, never accessed again due to mem::forget
2239        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2240        // Prevent Drop from running (which would shut down the channel)
2241        std::mem::forget(self);
2242    }
2243}
2244
2245impl StateGetTcpResponder {
2246    /// Sends a response to the FIDL transaction.
2247    ///
2248    /// Sets the channel to shutdown if an error occurs.
2249    pub fn send(self, mut payload: &Tcp) -> Result<(), fidl::Error> {
2250        let _result = self.send_raw(payload);
2251        if _result.is_err() {
2252            self.control_handle.shutdown();
2253        }
2254        self.drop_without_shutdown();
2255        _result
2256    }
2257
2258    /// Similar to "send" but does not shutdown the channel if an error occurs.
2259    pub fn send_no_shutdown_on_err(self, mut payload: &Tcp) -> Result<(), fidl::Error> {
2260        let _result = self.send_raw(payload);
2261        self.drop_without_shutdown();
2262        _result
2263    }
2264
2265    fn send_raw(&self, mut payload: &Tcp) -> Result<(), fidl::Error> {
2266        self.control_handle.inner.send::<Tcp>(
2267            payload,
2268            self.tx_id,
2269            0x4e818d8a89985b70,
2270            fidl::encoding::DynamicFlags::empty(),
2271        )
2272    }
2273}
2274
2275#[must_use = "FIDL methods require a response to be sent"]
2276#[derive(Debug)]
2277pub struct StateGetUdpResponder {
2278    control_handle: std::mem::ManuallyDrop<StateControlHandle>,
2279    tx_id: u32,
2280}
2281
2282/// Set the the channel to be shutdown (see [`StateControlHandle::shutdown`])
2283/// if the responder is dropped without sending a response, so that the client
2284/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2285impl std::ops::Drop for StateGetUdpResponder {
2286    fn drop(&mut self) {
2287        self.control_handle.shutdown();
2288        // Safety: drops once, never accessed again
2289        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2290    }
2291}
2292
2293impl fidl::endpoints::Responder for StateGetUdpResponder {
2294    type ControlHandle = StateControlHandle;
2295
2296    fn control_handle(&self) -> &StateControlHandle {
2297        &self.control_handle
2298    }
2299
2300    fn drop_without_shutdown(mut self) {
2301        // Safety: drops once, never accessed again due to mem::forget
2302        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2303        // Prevent Drop from running (which would shut down the channel)
2304        std::mem::forget(self);
2305    }
2306}
2307
2308impl StateGetUdpResponder {
2309    /// Sends a response to the FIDL transaction.
2310    ///
2311    /// Sets the channel to shutdown if an error occurs.
2312    pub fn send(self, mut payload: &Udp) -> Result<(), fidl::Error> {
2313        let _result = self.send_raw(payload);
2314        if _result.is_err() {
2315            self.control_handle.shutdown();
2316        }
2317        self.drop_without_shutdown();
2318        _result
2319    }
2320
2321    /// Similar to "send" but does not shutdown the channel if an error occurs.
2322    pub fn send_no_shutdown_on_err(self, mut payload: &Udp) -> Result<(), fidl::Error> {
2323        let _result = self.send_raw(payload);
2324        self.drop_without_shutdown();
2325        _result
2326    }
2327
2328    fn send_raw(&self, mut payload: &Udp) -> Result<(), fidl::Error> {
2329        self.control_handle.inner.send::<Udp>(
2330            payload,
2331            self.tx_id,
2332            0x1af3bc1507b7a196,
2333            fidl::encoding::DynamicFlags::empty(),
2334        )
2335    }
2336}
2337
2338#[must_use = "FIDL methods require a response to be sent"]
2339#[derive(Debug)]
2340pub struct StateGetIcmpResponder {
2341    control_handle: std::mem::ManuallyDrop<StateControlHandle>,
2342    tx_id: u32,
2343}
2344
2345/// Set the the channel to be shutdown (see [`StateControlHandle::shutdown`])
2346/// if the responder is dropped without sending a response, so that the client
2347/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2348impl std::ops::Drop for StateGetIcmpResponder {
2349    fn drop(&mut self) {
2350        self.control_handle.shutdown();
2351        // Safety: drops once, never accessed again
2352        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2353    }
2354}
2355
2356impl fidl::endpoints::Responder for StateGetIcmpResponder {
2357    type ControlHandle = StateControlHandle;
2358
2359    fn control_handle(&self) -> &StateControlHandle {
2360        &self.control_handle
2361    }
2362
2363    fn drop_without_shutdown(mut self) {
2364        // Safety: drops once, never accessed again due to mem::forget
2365        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2366        // Prevent Drop from running (which would shut down the channel)
2367        std::mem::forget(self);
2368    }
2369}
2370
2371impl StateGetIcmpResponder {
2372    /// Sends a response to the FIDL transaction.
2373    ///
2374    /// Sets the channel to shutdown if an error occurs.
2375    pub fn send(self, mut payload: &Icmp) -> Result<(), fidl::Error> {
2376        let _result = self.send_raw(payload);
2377        if _result.is_err() {
2378            self.control_handle.shutdown();
2379        }
2380        self.drop_without_shutdown();
2381        _result
2382    }
2383
2384    /// Similar to "send" but does not shutdown the channel if an error occurs.
2385    pub fn send_no_shutdown_on_err(self, mut payload: &Icmp) -> Result<(), fidl::Error> {
2386        let _result = self.send_raw(payload);
2387        self.drop_without_shutdown();
2388        _result
2389    }
2390
2391    fn send_raw(&self, mut payload: &Icmp) -> Result<(), fidl::Error> {
2392        self.control_handle.inner.send::<Icmp>(
2393            payload,
2394            self.tx_id,
2395            0x4079fd71ca65e33f,
2396            fidl::encoding::DynamicFlags::empty(),
2397        )
2398    }
2399}
2400
2401#[must_use = "FIDL methods require a response to be sent"]
2402#[derive(Debug)]
2403pub struct StateGetIpResponder {
2404    control_handle: std::mem::ManuallyDrop<StateControlHandle>,
2405    tx_id: u32,
2406}
2407
2408/// Set the the channel to be shutdown (see [`StateControlHandle::shutdown`])
2409/// if the responder is dropped without sending a response, so that the client
2410/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2411impl std::ops::Drop for StateGetIpResponder {
2412    fn drop(&mut self) {
2413        self.control_handle.shutdown();
2414        // Safety: drops once, never accessed again
2415        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2416    }
2417}
2418
2419impl fidl::endpoints::Responder for StateGetIpResponder {
2420    type ControlHandle = StateControlHandle;
2421
2422    fn control_handle(&self) -> &StateControlHandle {
2423        &self.control_handle
2424    }
2425
2426    fn drop_without_shutdown(mut self) {
2427        // Safety: drops once, never accessed again due to mem::forget
2428        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2429        // Prevent Drop from running (which would shut down the channel)
2430        std::mem::forget(self);
2431    }
2432}
2433
2434impl StateGetIpResponder {
2435    /// Sends a response to the FIDL transaction.
2436    ///
2437    /// Sets the channel to shutdown if an error occurs.
2438    pub fn send(self, mut payload: &Ip) -> Result<(), fidl::Error> {
2439        let _result = self.send_raw(payload);
2440        if _result.is_err() {
2441            self.control_handle.shutdown();
2442        }
2443        self.drop_without_shutdown();
2444        _result
2445    }
2446
2447    /// Similar to "send" but does not shutdown the channel if an error occurs.
2448    pub fn send_no_shutdown_on_err(self, mut payload: &Ip) -> Result<(), fidl::Error> {
2449        let _result = self.send_raw(payload);
2450        self.drop_without_shutdown();
2451        _result
2452    }
2453
2454    fn send_raw(&self, mut payload: &Ip) -> Result<(), fidl::Error> {
2455        self.control_handle.inner.send::<Ip>(
2456            payload,
2457            self.tx_id,
2458            0x2c1cc13f4874956,
2459            fidl::encoding::DynamicFlags::empty(),
2460        )
2461    }
2462}
2463
2464#[must_use = "FIDL methods require a response to be sent"]
2465#[derive(Debug)]
2466pub struct StateGetDeviceResponder {
2467    control_handle: std::mem::ManuallyDrop<StateControlHandle>,
2468    tx_id: u32,
2469}
2470
2471/// Set the the channel to be shutdown (see [`StateControlHandle::shutdown`])
2472/// if the responder is dropped without sending a response, so that the client
2473/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2474impl std::ops::Drop for StateGetDeviceResponder {
2475    fn drop(&mut self) {
2476        self.control_handle.shutdown();
2477        // Safety: drops once, never accessed again
2478        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2479    }
2480}
2481
2482impl fidl::endpoints::Responder for StateGetDeviceResponder {
2483    type ControlHandle = StateControlHandle;
2484
2485    fn control_handle(&self) -> &StateControlHandle {
2486        &self.control_handle
2487    }
2488
2489    fn drop_without_shutdown(mut self) {
2490        // Safety: drops once, never accessed again due to mem::forget
2491        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2492        // Prevent Drop from running (which would shut down the channel)
2493        std::mem::forget(self);
2494    }
2495}
2496
2497impl StateGetDeviceResponder {
2498    /// Sends a response to the FIDL transaction.
2499    ///
2500    /// Sets the channel to shutdown if an error occurs.
2501    pub fn send(self, mut payload: &Device) -> Result<(), fidl::Error> {
2502        let _result = self.send_raw(payload);
2503        if _result.is_err() {
2504            self.control_handle.shutdown();
2505        }
2506        self.drop_without_shutdown();
2507        _result
2508    }
2509
2510    /// Similar to "send" but does not shutdown the channel if an error occurs.
2511    pub fn send_no_shutdown_on_err(self, mut payload: &Device) -> Result<(), fidl::Error> {
2512        let _result = self.send_raw(payload);
2513        self.drop_without_shutdown();
2514        _result
2515    }
2516
2517    fn send_raw(&self, mut payload: &Device) -> Result<(), fidl::Error> {
2518        self.control_handle.inner.send::<Device>(
2519            payload,
2520            self.tx_id,
2521            0x5713a85352e43887,
2522            fidl::encoding::DynamicFlags::empty(),
2523        )
2524    }
2525}
2526
2527mod internal {
2528    use super::*;
2529}