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 fidl::endpoints::ControlHandle for ControlControlHandle {
985    fn shutdown(&self) {
986        self.inner.shutdown()
987    }
988
989    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
990        self.inner.shutdown_with_epitaph(status)
991    }
992
993    fn is_closed(&self) -> bool {
994        self.inner.channel().is_closed()
995    }
996    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
997        self.inner.channel().on_closed()
998    }
999
1000    #[cfg(target_os = "fuchsia")]
1001    fn signal_peer(
1002        &self,
1003        clear_mask: zx::Signals,
1004        set_mask: zx::Signals,
1005    ) -> Result<(), zx_status::Status> {
1006        use fidl::Peered;
1007        self.inner.channel().signal_peer(clear_mask, set_mask)
1008    }
1009}
1010
1011impl ControlControlHandle {}
1012
1013#[must_use = "FIDL methods require a response to be sent"]
1014#[derive(Debug)]
1015pub struct ControlUpdateInterfaceDefaultsResponder {
1016    control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
1017    tx_id: u32,
1018}
1019
1020/// Set the the channel to be shutdown (see [`ControlControlHandle::shutdown`])
1021/// if the responder is dropped without sending a response, so that the client
1022/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1023impl std::ops::Drop for ControlUpdateInterfaceDefaultsResponder {
1024    fn drop(&mut self) {
1025        self.control_handle.shutdown();
1026        // Safety: drops once, never accessed again
1027        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1028    }
1029}
1030
1031impl fidl::endpoints::Responder for ControlUpdateInterfaceDefaultsResponder {
1032    type ControlHandle = ControlControlHandle;
1033
1034    fn control_handle(&self) -> &ControlControlHandle {
1035        &self.control_handle
1036    }
1037
1038    fn drop_without_shutdown(mut self) {
1039        // Safety: drops once, never accessed again due to mem::forget
1040        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1041        // Prevent Drop from running (which would shut down the channel)
1042        std::mem::forget(self);
1043    }
1044}
1045
1046impl ControlUpdateInterfaceDefaultsResponder {
1047    /// Sends a response to the FIDL transaction.
1048    ///
1049    /// Sets the channel to shutdown if an error occurs.
1050    pub fn send(
1051        self,
1052        mut result: Result<&fidl_fuchsia_net_interfaces_admin::Configuration, UpdateError>,
1053    ) -> Result<(), fidl::Error> {
1054        let _result = self.send_raw(result);
1055        if _result.is_err() {
1056            self.control_handle.shutdown();
1057        }
1058        self.drop_without_shutdown();
1059        _result
1060    }
1061
1062    /// Similar to "send" but does not shutdown the channel if an error occurs.
1063    pub fn send_no_shutdown_on_err(
1064        self,
1065        mut result: Result<&fidl_fuchsia_net_interfaces_admin::Configuration, UpdateError>,
1066    ) -> Result<(), fidl::Error> {
1067        let _result = self.send_raw(result);
1068        self.drop_without_shutdown();
1069        _result
1070    }
1071
1072    fn send_raw(
1073        &self,
1074        mut result: Result<&fidl_fuchsia_net_interfaces_admin::Configuration, UpdateError>,
1075    ) -> Result<(), fidl::Error> {
1076        self.control_handle.inner.send::<fidl::encoding::ResultType<
1077            fidl_fuchsia_net_interfaces_admin::Configuration,
1078            UpdateError,
1079        >>(
1080            result,
1081            self.tx_id,
1082            0x46ea2036390abecc,
1083            fidl::encoding::DynamicFlags::empty(),
1084        )
1085    }
1086}
1087
1088#[must_use = "FIDL methods require a response to be sent"]
1089#[derive(Debug)]
1090pub struct ControlUpdateTcpResponder {
1091    control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
1092    tx_id: u32,
1093}
1094
1095/// Set the the channel to be shutdown (see [`ControlControlHandle::shutdown`])
1096/// if the responder is dropped without sending a response, so that the client
1097/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1098impl std::ops::Drop for ControlUpdateTcpResponder {
1099    fn drop(&mut self) {
1100        self.control_handle.shutdown();
1101        // Safety: drops once, never accessed again
1102        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1103    }
1104}
1105
1106impl fidl::endpoints::Responder for ControlUpdateTcpResponder {
1107    type ControlHandle = ControlControlHandle;
1108
1109    fn control_handle(&self) -> &ControlControlHandle {
1110        &self.control_handle
1111    }
1112
1113    fn drop_without_shutdown(mut self) {
1114        // Safety: drops once, never accessed again due to mem::forget
1115        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1116        // Prevent Drop from running (which would shut down the channel)
1117        std::mem::forget(self);
1118    }
1119}
1120
1121impl ControlUpdateTcpResponder {
1122    /// Sends a response to the FIDL transaction.
1123    ///
1124    /// Sets the channel to shutdown if an error occurs.
1125    pub fn send(self, mut result: Result<&Tcp, UpdateError>) -> Result<(), fidl::Error> {
1126        let _result = self.send_raw(result);
1127        if _result.is_err() {
1128            self.control_handle.shutdown();
1129        }
1130        self.drop_without_shutdown();
1131        _result
1132    }
1133
1134    /// Similar to "send" but does not shutdown the channel if an error occurs.
1135    pub fn send_no_shutdown_on_err(
1136        self,
1137        mut result: Result<&Tcp, UpdateError>,
1138    ) -> Result<(), fidl::Error> {
1139        let _result = self.send_raw(result);
1140        self.drop_without_shutdown();
1141        _result
1142    }
1143
1144    fn send_raw(&self, mut result: Result<&Tcp, UpdateError>) -> Result<(), fidl::Error> {
1145        self.control_handle.inner.send::<fidl::encoding::ResultType<Tcp, UpdateError>>(
1146            result,
1147            self.tx_id,
1148            0x4e768d74ec55450f,
1149            fidl::encoding::DynamicFlags::empty(),
1150        )
1151    }
1152}
1153
1154#[must_use = "FIDL methods require a response to be sent"]
1155#[derive(Debug)]
1156pub struct ControlUpdateUdpResponder {
1157    control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
1158    tx_id: u32,
1159}
1160
1161/// Set the the channel to be shutdown (see [`ControlControlHandle::shutdown`])
1162/// if the responder is dropped without sending a response, so that the client
1163/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1164impl std::ops::Drop for ControlUpdateUdpResponder {
1165    fn drop(&mut self) {
1166        self.control_handle.shutdown();
1167        // Safety: drops once, never accessed again
1168        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1169    }
1170}
1171
1172impl fidl::endpoints::Responder for ControlUpdateUdpResponder {
1173    type ControlHandle = ControlControlHandle;
1174
1175    fn control_handle(&self) -> &ControlControlHandle {
1176        &self.control_handle
1177    }
1178
1179    fn drop_without_shutdown(mut self) {
1180        // Safety: drops once, never accessed again due to mem::forget
1181        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1182        // Prevent Drop from running (which would shut down the channel)
1183        std::mem::forget(self);
1184    }
1185}
1186
1187impl ControlUpdateUdpResponder {
1188    /// Sends a response to the FIDL transaction.
1189    ///
1190    /// Sets the channel to shutdown if an error occurs.
1191    pub fn send(self, mut result: Result<&Udp, UpdateError>) -> Result<(), fidl::Error> {
1192        let _result = self.send_raw(result);
1193        if _result.is_err() {
1194            self.control_handle.shutdown();
1195        }
1196        self.drop_without_shutdown();
1197        _result
1198    }
1199
1200    /// Similar to "send" but does not shutdown the channel if an error occurs.
1201    pub fn send_no_shutdown_on_err(
1202        self,
1203        mut result: Result<&Udp, UpdateError>,
1204    ) -> Result<(), fidl::Error> {
1205        let _result = self.send_raw(result);
1206        self.drop_without_shutdown();
1207        _result
1208    }
1209
1210    fn send_raw(&self, mut result: Result<&Udp, UpdateError>) -> Result<(), fidl::Error> {
1211        self.control_handle.inner.send::<fidl::encoding::ResultType<Udp, UpdateError>>(
1212            result,
1213            self.tx_id,
1214            0x6fb82be32e7338b4,
1215            fidl::encoding::DynamicFlags::empty(),
1216        )
1217    }
1218}
1219
1220#[must_use = "FIDL methods require a response to be sent"]
1221#[derive(Debug)]
1222pub struct ControlUpdateIcmpResponder {
1223    control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
1224    tx_id: u32,
1225}
1226
1227/// Set the the channel to be shutdown (see [`ControlControlHandle::shutdown`])
1228/// if the responder is dropped without sending a response, so that the client
1229/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1230impl std::ops::Drop for ControlUpdateIcmpResponder {
1231    fn drop(&mut self) {
1232        self.control_handle.shutdown();
1233        // Safety: drops once, never accessed again
1234        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1235    }
1236}
1237
1238impl fidl::endpoints::Responder for ControlUpdateIcmpResponder {
1239    type ControlHandle = ControlControlHandle;
1240
1241    fn control_handle(&self) -> &ControlControlHandle {
1242        &self.control_handle
1243    }
1244
1245    fn drop_without_shutdown(mut self) {
1246        // Safety: drops once, never accessed again due to mem::forget
1247        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1248        // Prevent Drop from running (which would shut down the channel)
1249        std::mem::forget(self);
1250    }
1251}
1252
1253impl ControlUpdateIcmpResponder {
1254    /// Sends a response to the FIDL transaction.
1255    ///
1256    /// Sets the channel to shutdown if an error occurs.
1257    pub fn send(self, mut result: Result<&Icmp, UpdateError>) -> Result<(), fidl::Error> {
1258        let _result = self.send_raw(result);
1259        if _result.is_err() {
1260            self.control_handle.shutdown();
1261        }
1262        self.drop_without_shutdown();
1263        _result
1264    }
1265
1266    /// Similar to "send" but does not shutdown the channel if an error occurs.
1267    pub fn send_no_shutdown_on_err(
1268        self,
1269        mut result: Result<&Icmp, UpdateError>,
1270    ) -> Result<(), fidl::Error> {
1271        let _result = self.send_raw(result);
1272        self.drop_without_shutdown();
1273        _result
1274    }
1275
1276    fn send_raw(&self, mut result: Result<&Icmp, UpdateError>) -> Result<(), fidl::Error> {
1277        self.control_handle.inner.send::<fidl::encoding::ResultType<Icmp, UpdateError>>(
1278            result,
1279            self.tx_id,
1280            0x42f130ff9cc3a8d5,
1281            fidl::encoding::DynamicFlags::empty(),
1282        )
1283    }
1284}
1285
1286#[must_use = "FIDL methods require a response to be sent"]
1287#[derive(Debug)]
1288pub struct ControlUpdateIpResponder {
1289    control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
1290    tx_id: u32,
1291}
1292
1293/// Set the the channel to be shutdown (see [`ControlControlHandle::shutdown`])
1294/// if the responder is dropped without sending a response, so that the client
1295/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1296impl std::ops::Drop for ControlUpdateIpResponder {
1297    fn drop(&mut self) {
1298        self.control_handle.shutdown();
1299        // Safety: drops once, never accessed again
1300        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1301    }
1302}
1303
1304impl fidl::endpoints::Responder for ControlUpdateIpResponder {
1305    type ControlHandle = ControlControlHandle;
1306
1307    fn control_handle(&self) -> &ControlControlHandle {
1308        &self.control_handle
1309    }
1310
1311    fn drop_without_shutdown(mut self) {
1312        // Safety: drops once, never accessed again due to mem::forget
1313        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1314        // Prevent Drop from running (which would shut down the channel)
1315        std::mem::forget(self);
1316    }
1317}
1318
1319impl ControlUpdateIpResponder {
1320    /// Sends a response to the FIDL transaction.
1321    ///
1322    /// Sets the channel to shutdown if an error occurs.
1323    pub fn send(self, mut result: Result<&Ip, UpdateError>) -> Result<(), fidl::Error> {
1324        let _result = self.send_raw(result);
1325        if _result.is_err() {
1326            self.control_handle.shutdown();
1327        }
1328        self.drop_without_shutdown();
1329        _result
1330    }
1331
1332    /// Similar to "send" but does not shutdown the channel if an error occurs.
1333    pub fn send_no_shutdown_on_err(
1334        self,
1335        mut result: Result<&Ip, UpdateError>,
1336    ) -> Result<(), fidl::Error> {
1337        let _result = self.send_raw(result);
1338        self.drop_without_shutdown();
1339        _result
1340    }
1341
1342    fn send_raw(&self, mut result: Result<&Ip, UpdateError>) -> Result<(), fidl::Error> {
1343        self.control_handle.inner.send::<fidl::encoding::ResultType<Ip, UpdateError>>(
1344            result,
1345            self.tx_id,
1346            0x75d1074407e4d1c4,
1347            fidl::encoding::DynamicFlags::empty(),
1348        )
1349    }
1350}
1351
1352#[must_use = "FIDL methods require a response to be sent"]
1353#[derive(Debug)]
1354pub struct ControlUpdateDeviceResponder {
1355    control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
1356    tx_id: u32,
1357}
1358
1359/// Set the the channel to be shutdown (see [`ControlControlHandle::shutdown`])
1360/// if the responder is dropped without sending a response, so that the client
1361/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1362impl std::ops::Drop for ControlUpdateDeviceResponder {
1363    fn drop(&mut self) {
1364        self.control_handle.shutdown();
1365        // Safety: drops once, never accessed again
1366        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1367    }
1368}
1369
1370impl fidl::endpoints::Responder for ControlUpdateDeviceResponder {
1371    type ControlHandle = ControlControlHandle;
1372
1373    fn control_handle(&self) -> &ControlControlHandle {
1374        &self.control_handle
1375    }
1376
1377    fn drop_without_shutdown(mut self) {
1378        // Safety: drops once, never accessed again due to mem::forget
1379        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1380        // Prevent Drop from running (which would shut down the channel)
1381        std::mem::forget(self);
1382    }
1383}
1384
1385impl ControlUpdateDeviceResponder {
1386    /// Sends a response to the FIDL transaction.
1387    ///
1388    /// Sets the channel to shutdown if an error occurs.
1389    pub fn send(self, mut result: Result<&Device, UpdateError>) -> Result<(), fidl::Error> {
1390        let _result = self.send_raw(result);
1391        if _result.is_err() {
1392            self.control_handle.shutdown();
1393        }
1394        self.drop_without_shutdown();
1395        _result
1396    }
1397
1398    /// Similar to "send" but does not shutdown the channel if an error occurs.
1399    pub fn send_no_shutdown_on_err(
1400        self,
1401        mut result: Result<&Device, UpdateError>,
1402    ) -> Result<(), fidl::Error> {
1403        let _result = self.send_raw(result);
1404        self.drop_without_shutdown();
1405        _result
1406    }
1407
1408    fn send_raw(&self, mut result: Result<&Device, UpdateError>) -> Result<(), fidl::Error> {
1409        self.control_handle.inner.send::<fidl::encoding::ResultType<Device, UpdateError>>(
1410            result,
1411            self.tx_id,
1412            0x6080a91e617e9430,
1413            fidl::encoding::DynamicFlags::empty(),
1414        )
1415    }
1416}
1417
1418#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1419pub struct StateMarker;
1420
1421impl fidl::endpoints::ProtocolMarker for StateMarker {
1422    type Proxy = StateProxy;
1423    type RequestStream = StateRequestStream;
1424    #[cfg(target_os = "fuchsia")]
1425    type SynchronousProxy = StateSynchronousProxy;
1426
1427    const DEBUG_NAME: &'static str = "fuchsia.net.settings.State";
1428}
1429impl fidl::endpoints::DiscoverableProtocolMarker for StateMarker {}
1430
1431pub trait StateProxyInterface: Send + Sync {
1432    type GetInterfaceDefaultsResponseFut: std::future::Future<
1433            Output = Result<fidl_fuchsia_net_interfaces_admin::Configuration, fidl::Error>,
1434        > + Send;
1435    fn r#get_interface_defaults(&self) -> Self::GetInterfaceDefaultsResponseFut;
1436    type GetTcpResponseFut: std::future::Future<Output = Result<Tcp, fidl::Error>> + Send;
1437    fn r#get_tcp(&self) -> Self::GetTcpResponseFut;
1438    type GetUdpResponseFut: std::future::Future<Output = Result<Udp, fidl::Error>> + Send;
1439    fn r#get_udp(&self) -> Self::GetUdpResponseFut;
1440    type GetIcmpResponseFut: std::future::Future<Output = Result<Icmp, fidl::Error>> + Send;
1441    fn r#get_icmp(&self) -> Self::GetIcmpResponseFut;
1442    type GetIpResponseFut: std::future::Future<Output = Result<Ip, fidl::Error>> + Send;
1443    fn r#get_ip(&self) -> Self::GetIpResponseFut;
1444    type GetDeviceResponseFut: std::future::Future<Output = Result<Device, fidl::Error>> + Send;
1445    fn r#get_device(&self) -> Self::GetDeviceResponseFut;
1446}
1447#[derive(Debug)]
1448#[cfg(target_os = "fuchsia")]
1449pub struct StateSynchronousProxy {
1450    client: fidl::client::sync::Client,
1451}
1452
1453#[cfg(target_os = "fuchsia")]
1454impl fidl::endpoints::SynchronousProxy for StateSynchronousProxy {
1455    type Proxy = StateProxy;
1456    type Protocol = StateMarker;
1457
1458    fn from_channel(inner: fidl::Channel) -> Self {
1459        Self::new(inner)
1460    }
1461
1462    fn into_channel(self) -> fidl::Channel {
1463        self.client.into_channel()
1464    }
1465
1466    fn as_channel(&self) -> &fidl::Channel {
1467        self.client.as_channel()
1468    }
1469}
1470
1471#[cfg(target_os = "fuchsia")]
1472impl StateSynchronousProxy {
1473    pub fn new(channel: fidl::Channel) -> Self {
1474        Self { client: fidl::client::sync::Client::new(channel) }
1475    }
1476
1477    pub fn into_channel(self) -> fidl::Channel {
1478        self.client.into_channel()
1479    }
1480
1481    /// Waits until an event arrives and returns it. It is safe for other
1482    /// threads to make concurrent requests while waiting for an event.
1483    pub fn wait_for_event(
1484        &self,
1485        deadline: zx::MonotonicInstant,
1486    ) -> Result<StateEvent, fidl::Error> {
1487        StateEvent::decode(self.client.wait_for_event::<StateMarker>(deadline)?)
1488    }
1489
1490    /// Returns the current default settings for interfaces.
1491    pub fn r#get_interface_defaults(
1492        &self,
1493        ___deadline: zx::MonotonicInstant,
1494    ) -> Result<fidl_fuchsia_net_interfaces_admin::Configuration, fidl::Error> {
1495        let _response = self.client.send_query::<
1496            fidl::encoding::EmptyPayload,
1497            fidl_fuchsia_net_interfaces_admin::Configuration,
1498            StateMarker,
1499        >(
1500            (),
1501            0x4c4824a322a705e3,
1502            fidl::encoding::DynamicFlags::empty(),
1503            ___deadline,
1504        )?;
1505        Ok(_response)
1506    }
1507
1508    /// Returns the current TCP settings values.
1509    pub fn r#get_tcp(&self, ___deadline: zx::MonotonicInstant) -> Result<Tcp, fidl::Error> {
1510        let _response = self.client.send_query::<fidl::encoding::EmptyPayload, Tcp, StateMarker>(
1511            (),
1512            0x4e818d8a89985b70,
1513            fidl::encoding::DynamicFlags::empty(),
1514            ___deadline,
1515        )?;
1516        Ok(_response)
1517    }
1518
1519    /// Returns the current UDP settings values.
1520    pub fn r#get_udp(&self, ___deadline: zx::MonotonicInstant) -> Result<Udp, fidl::Error> {
1521        let _response = self.client.send_query::<fidl::encoding::EmptyPayload, Udp, StateMarker>(
1522            (),
1523            0x1af3bc1507b7a196,
1524            fidl::encoding::DynamicFlags::empty(),
1525            ___deadline,
1526        )?;
1527        Ok(_response)
1528    }
1529
1530    /// Returns the current ICMP settings values.
1531    pub fn r#get_icmp(&self, ___deadline: zx::MonotonicInstant) -> Result<Icmp, fidl::Error> {
1532        let _response = self.client.send_query::<fidl::encoding::EmptyPayload, Icmp, StateMarker>(
1533            (),
1534            0x4079fd71ca65e33f,
1535            fidl::encoding::DynamicFlags::empty(),
1536            ___deadline,
1537        )?;
1538        Ok(_response)
1539    }
1540
1541    /// Returns the current IP settings values.
1542    pub fn r#get_ip(&self, ___deadline: zx::MonotonicInstant) -> Result<Ip, fidl::Error> {
1543        let _response = self.client.send_query::<fidl::encoding::EmptyPayload, Ip, StateMarker>(
1544            (),
1545            0x2c1cc13f4874956,
1546            fidl::encoding::DynamicFlags::empty(),
1547            ___deadline,
1548        )?;
1549        Ok(_response)
1550    }
1551
1552    /// Returns the current device layer settings values.
1553    pub fn r#get_device(&self, ___deadline: zx::MonotonicInstant) -> Result<Device, fidl::Error> {
1554        let _response =
1555            self.client.send_query::<fidl::encoding::EmptyPayload, Device, StateMarker>(
1556                (),
1557                0x5713a85352e43887,
1558                fidl::encoding::DynamicFlags::empty(),
1559                ___deadline,
1560            )?;
1561        Ok(_response)
1562    }
1563}
1564
1565#[cfg(target_os = "fuchsia")]
1566impl From<StateSynchronousProxy> for zx::NullableHandle {
1567    fn from(value: StateSynchronousProxy) -> Self {
1568        value.into_channel().into()
1569    }
1570}
1571
1572#[cfg(target_os = "fuchsia")]
1573impl From<fidl::Channel> for StateSynchronousProxy {
1574    fn from(value: fidl::Channel) -> Self {
1575        Self::new(value)
1576    }
1577}
1578
1579#[cfg(target_os = "fuchsia")]
1580impl fidl::endpoints::FromClient for StateSynchronousProxy {
1581    type Protocol = StateMarker;
1582
1583    fn from_client(value: fidl::endpoints::ClientEnd<StateMarker>) -> Self {
1584        Self::new(value.into_channel())
1585    }
1586}
1587
1588#[derive(Debug, Clone)]
1589pub struct StateProxy {
1590    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1591}
1592
1593impl fidl::endpoints::Proxy for StateProxy {
1594    type Protocol = StateMarker;
1595
1596    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1597        Self::new(inner)
1598    }
1599
1600    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1601        self.client.into_channel().map_err(|client| Self { client })
1602    }
1603
1604    fn as_channel(&self) -> &::fidl::AsyncChannel {
1605        self.client.as_channel()
1606    }
1607}
1608
1609impl StateProxy {
1610    /// Create a new Proxy for fuchsia.net.settings/State.
1611    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1612        let protocol_name = <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1613        Self { client: fidl::client::Client::new(channel, protocol_name) }
1614    }
1615
1616    /// Get a Stream of events from the remote end of the protocol.
1617    ///
1618    /// # Panics
1619    ///
1620    /// Panics if the event stream was already taken.
1621    pub fn take_event_stream(&self) -> StateEventStream {
1622        StateEventStream { event_receiver: self.client.take_event_receiver() }
1623    }
1624
1625    /// Returns the current default settings for interfaces.
1626    pub fn r#get_interface_defaults(
1627        &self,
1628    ) -> fidl::client::QueryResponseFut<
1629        fidl_fuchsia_net_interfaces_admin::Configuration,
1630        fidl::encoding::DefaultFuchsiaResourceDialect,
1631    > {
1632        StateProxyInterface::r#get_interface_defaults(self)
1633    }
1634
1635    /// Returns the current TCP settings values.
1636    pub fn r#get_tcp(
1637        &self,
1638    ) -> fidl::client::QueryResponseFut<Tcp, fidl::encoding::DefaultFuchsiaResourceDialect> {
1639        StateProxyInterface::r#get_tcp(self)
1640    }
1641
1642    /// Returns the current UDP settings values.
1643    pub fn r#get_udp(
1644        &self,
1645    ) -> fidl::client::QueryResponseFut<Udp, fidl::encoding::DefaultFuchsiaResourceDialect> {
1646        StateProxyInterface::r#get_udp(self)
1647    }
1648
1649    /// Returns the current ICMP settings values.
1650    pub fn r#get_icmp(
1651        &self,
1652    ) -> fidl::client::QueryResponseFut<Icmp, fidl::encoding::DefaultFuchsiaResourceDialect> {
1653        StateProxyInterface::r#get_icmp(self)
1654    }
1655
1656    /// Returns the current IP settings values.
1657    pub fn r#get_ip(
1658        &self,
1659    ) -> fidl::client::QueryResponseFut<Ip, fidl::encoding::DefaultFuchsiaResourceDialect> {
1660        StateProxyInterface::r#get_ip(self)
1661    }
1662
1663    /// Returns the current device layer settings values.
1664    pub fn r#get_device(
1665        &self,
1666    ) -> fidl::client::QueryResponseFut<Device, fidl::encoding::DefaultFuchsiaResourceDialect> {
1667        StateProxyInterface::r#get_device(self)
1668    }
1669}
1670
1671impl StateProxyInterface for StateProxy {
1672    type GetInterfaceDefaultsResponseFut = fidl::client::QueryResponseFut<
1673        fidl_fuchsia_net_interfaces_admin::Configuration,
1674        fidl::encoding::DefaultFuchsiaResourceDialect,
1675    >;
1676    fn r#get_interface_defaults(&self) -> Self::GetInterfaceDefaultsResponseFut {
1677        fn _decode(
1678            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1679        ) -> Result<fidl_fuchsia_net_interfaces_admin::Configuration, fidl::Error> {
1680            let _response = fidl::client::decode_transaction_body::<
1681                fidl_fuchsia_net_interfaces_admin::Configuration,
1682                fidl::encoding::DefaultFuchsiaResourceDialect,
1683                0x4c4824a322a705e3,
1684            >(_buf?)?;
1685            Ok(_response)
1686        }
1687        self.client.send_query_and_decode::<
1688            fidl::encoding::EmptyPayload,
1689            fidl_fuchsia_net_interfaces_admin::Configuration,
1690        >(
1691            (),
1692            0x4c4824a322a705e3,
1693            fidl::encoding::DynamicFlags::empty(),
1694            _decode,
1695        )
1696    }
1697
1698    type GetTcpResponseFut =
1699        fidl::client::QueryResponseFut<Tcp, fidl::encoding::DefaultFuchsiaResourceDialect>;
1700    fn r#get_tcp(&self) -> Self::GetTcpResponseFut {
1701        fn _decode(
1702            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1703        ) -> Result<Tcp, fidl::Error> {
1704            let _response = fidl::client::decode_transaction_body::<
1705                Tcp,
1706                fidl::encoding::DefaultFuchsiaResourceDialect,
1707                0x4e818d8a89985b70,
1708            >(_buf?)?;
1709            Ok(_response)
1710        }
1711        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Tcp>(
1712            (),
1713            0x4e818d8a89985b70,
1714            fidl::encoding::DynamicFlags::empty(),
1715            _decode,
1716        )
1717    }
1718
1719    type GetUdpResponseFut =
1720        fidl::client::QueryResponseFut<Udp, fidl::encoding::DefaultFuchsiaResourceDialect>;
1721    fn r#get_udp(&self) -> Self::GetUdpResponseFut {
1722        fn _decode(
1723            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1724        ) -> Result<Udp, fidl::Error> {
1725            let _response = fidl::client::decode_transaction_body::<
1726                Udp,
1727                fidl::encoding::DefaultFuchsiaResourceDialect,
1728                0x1af3bc1507b7a196,
1729            >(_buf?)?;
1730            Ok(_response)
1731        }
1732        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Udp>(
1733            (),
1734            0x1af3bc1507b7a196,
1735            fidl::encoding::DynamicFlags::empty(),
1736            _decode,
1737        )
1738    }
1739
1740    type GetIcmpResponseFut =
1741        fidl::client::QueryResponseFut<Icmp, fidl::encoding::DefaultFuchsiaResourceDialect>;
1742    fn r#get_icmp(&self) -> Self::GetIcmpResponseFut {
1743        fn _decode(
1744            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1745        ) -> Result<Icmp, fidl::Error> {
1746            let _response = fidl::client::decode_transaction_body::<
1747                Icmp,
1748                fidl::encoding::DefaultFuchsiaResourceDialect,
1749                0x4079fd71ca65e33f,
1750            >(_buf?)?;
1751            Ok(_response)
1752        }
1753        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Icmp>(
1754            (),
1755            0x4079fd71ca65e33f,
1756            fidl::encoding::DynamicFlags::empty(),
1757            _decode,
1758        )
1759    }
1760
1761    type GetIpResponseFut =
1762        fidl::client::QueryResponseFut<Ip, fidl::encoding::DefaultFuchsiaResourceDialect>;
1763    fn r#get_ip(&self) -> Self::GetIpResponseFut {
1764        fn _decode(
1765            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1766        ) -> Result<Ip, fidl::Error> {
1767            let _response = fidl::client::decode_transaction_body::<
1768                Ip,
1769                fidl::encoding::DefaultFuchsiaResourceDialect,
1770                0x2c1cc13f4874956,
1771            >(_buf?)?;
1772            Ok(_response)
1773        }
1774        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Ip>(
1775            (),
1776            0x2c1cc13f4874956,
1777            fidl::encoding::DynamicFlags::empty(),
1778            _decode,
1779        )
1780    }
1781
1782    type GetDeviceResponseFut =
1783        fidl::client::QueryResponseFut<Device, fidl::encoding::DefaultFuchsiaResourceDialect>;
1784    fn r#get_device(&self) -> Self::GetDeviceResponseFut {
1785        fn _decode(
1786            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1787        ) -> Result<Device, fidl::Error> {
1788            let _response = fidl::client::decode_transaction_body::<
1789                Device,
1790                fidl::encoding::DefaultFuchsiaResourceDialect,
1791                0x5713a85352e43887,
1792            >(_buf?)?;
1793            Ok(_response)
1794        }
1795        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Device>(
1796            (),
1797            0x5713a85352e43887,
1798            fidl::encoding::DynamicFlags::empty(),
1799            _decode,
1800        )
1801    }
1802}
1803
1804pub struct StateEventStream {
1805    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1806}
1807
1808impl std::marker::Unpin for StateEventStream {}
1809
1810impl futures::stream::FusedStream for StateEventStream {
1811    fn is_terminated(&self) -> bool {
1812        self.event_receiver.is_terminated()
1813    }
1814}
1815
1816impl futures::Stream for StateEventStream {
1817    type Item = Result<StateEvent, fidl::Error>;
1818
1819    fn poll_next(
1820        mut self: std::pin::Pin<&mut Self>,
1821        cx: &mut std::task::Context<'_>,
1822    ) -> std::task::Poll<Option<Self::Item>> {
1823        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1824            &mut self.event_receiver,
1825            cx
1826        )?) {
1827            Some(buf) => std::task::Poll::Ready(Some(StateEvent::decode(buf))),
1828            None => std::task::Poll::Ready(None),
1829        }
1830    }
1831}
1832
1833#[derive(Debug)]
1834pub enum StateEvent {}
1835
1836impl StateEvent {
1837    /// Decodes a message buffer as a [`StateEvent`].
1838    fn decode(
1839        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1840    ) -> Result<StateEvent, fidl::Error> {
1841        let (bytes, _handles) = buf.split_mut();
1842        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1843        debug_assert_eq!(tx_header.tx_id, 0);
1844        match tx_header.ordinal {
1845            _ => Err(fidl::Error::UnknownOrdinal {
1846                ordinal: tx_header.ordinal,
1847                protocol_name: <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1848            }),
1849        }
1850    }
1851}
1852
1853/// A Stream of incoming requests for fuchsia.net.settings/State.
1854pub struct StateRequestStream {
1855    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1856    is_terminated: bool,
1857}
1858
1859impl std::marker::Unpin for StateRequestStream {}
1860
1861impl futures::stream::FusedStream for StateRequestStream {
1862    fn is_terminated(&self) -> bool {
1863        self.is_terminated
1864    }
1865}
1866
1867impl fidl::endpoints::RequestStream for StateRequestStream {
1868    type Protocol = StateMarker;
1869    type ControlHandle = StateControlHandle;
1870
1871    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1872        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1873    }
1874
1875    fn control_handle(&self) -> Self::ControlHandle {
1876        StateControlHandle { inner: self.inner.clone() }
1877    }
1878
1879    fn into_inner(
1880        self,
1881    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1882    {
1883        (self.inner, self.is_terminated)
1884    }
1885
1886    fn from_inner(
1887        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1888        is_terminated: bool,
1889    ) -> Self {
1890        Self { inner, is_terminated }
1891    }
1892}
1893
1894impl futures::Stream for StateRequestStream {
1895    type Item = Result<StateRequest, fidl::Error>;
1896
1897    fn poll_next(
1898        mut self: std::pin::Pin<&mut Self>,
1899        cx: &mut std::task::Context<'_>,
1900    ) -> std::task::Poll<Option<Self::Item>> {
1901        let this = &mut *self;
1902        if this.inner.check_shutdown(cx) {
1903            this.is_terminated = true;
1904            return std::task::Poll::Ready(None);
1905        }
1906        if this.is_terminated {
1907            panic!("polled StateRequestStream after completion");
1908        }
1909        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1910            |bytes, handles| {
1911                match this.inner.channel().read_etc(cx, bytes, handles) {
1912                    std::task::Poll::Ready(Ok(())) => {}
1913                    std::task::Poll::Pending => return std::task::Poll::Pending,
1914                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1915                        this.is_terminated = true;
1916                        return std::task::Poll::Ready(None);
1917                    }
1918                    std::task::Poll::Ready(Err(e)) => {
1919                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1920                            e.into(),
1921                        ))));
1922                    }
1923                }
1924
1925                // A message has been received from the channel
1926                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1927
1928                std::task::Poll::Ready(Some(match header.ordinal {
1929                    0x4c4824a322a705e3 => {
1930                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1931                        let mut req = fidl::new_empty!(
1932                            fidl::encoding::EmptyPayload,
1933                            fidl::encoding::DefaultFuchsiaResourceDialect
1934                        );
1935                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1936                        let control_handle = StateControlHandle { inner: this.inner.clone() };
1937                        Ok(StateRequest::GetInterfaceDefaults {
1938                            responder: StateGetInterfaceDefaultsResponder {
1939                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1940                                tx_id: header.tx_id,
1941                            },
1942                        })
1943                    }
1944                    0x4e818d8a89985b70 => {
1945                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1946                        let mut req = fidl::new_empty!(
1947                            fidl::encoding::EmptyPayload,
1948                            fidl::encoding::DefaultFuchsiaResourceDialect
1949                        );
1950                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1951                        let control_handle = StateControlHandle { inner: this.inner.clone() };
1952                        Ok(StateRequest::GetTcp {
1953                            responder: StateGetTcpResponder {
1954                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1955                                tx_id: header.tx_id,
1956                            },
1957                        })
1958                    }
1959                    0x1af3bc1507b7a196 => {
1960                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1961                        let mut req = fidl::new_empty!(
1962                            fidl::encoding::EmptyPayload,
1963                            fidl::encoding::DefaultFuchsiaResourceDialect
1964                        );
1965                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1966                        let control_handle = StateControlHandle { inner: this.inner.clone() };
1967                        Ok(StateRequest::GetUdp {
1968                            responder: StateGetUdpResponder {
1969                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1970                                tx_id: header.tx_id,
1971                            },
1972                        })
1973                    }
1974                    0x4079fd71ca65e33f => {
1975                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1976                        let mut req = fidl::new_empty!(
1977                            fidl::encoding::EmptyPayload,
1978                            fidl::encoding::DefaultFuchsiaResourceDialect
1979                        );
1980                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1981                        let control_handle = StateControlHandle { inner: this.inner.clone() };
1982                        Ok(StateRequest::GetIcmp {
1983                            responder: StateGetIcmpResponder {
1984                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1985                                tx_id: header.tx_id,
1986                            },
1987                        })
1988                    }
1989                    0x2c1cc13f4874956 => {
1990                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1991                        let mut req = fidl::new_empty!(
1992                            fidl::encoding::EmptyPayload,
1993                            fidl::encoding::DefaultFuchsiaResourceDialect
1994                        );
1995                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1996                        let control_handle = StateControlHandle { inner: this.inner.clone() };
1997                        Ok(StateRequest::GetIp {
1998                            responder: StateGetIpResponder {
1999                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2000                                tx_id: header.tx_id,
2001                            },
2002                        })
2003                    }
2004                    0x5713a85352e43887 => {
2005                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2006                        let mut req = fidl::new_empty!(
2007                            fidl::encoding::EmptyPayload,
2008                            fidl::encoding::DefaultFuchsiaResourceDialect
2009                        );
2010                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2011                        let control_handle = StateControlHandle { inner: this.inner.clone() };
2012                        Ok(StateRequest::GetDevice {
2013                            responder: StateGetDeviceResponder {
2014                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2015                                tx_id: header.tx_id,
2016                            },
2017                        })
2018                    }
2019                    _ => Err(fidl::Error::UnknownOrdinal {
2020                        ordinal: header.ordinal,
2021                        protocol_name: <StateMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2022                    }),
2023                }))
2024            },
2025        )
2026    }
2027}
2028
2029/// Provides read access to the network stack namespace-wide settings.
2030#[derive(Debug)]
2031pub enum StateRequest {
2032    /// Returns the current default settings for interfaces.
2033    GetInterfaceDefaults { responder: StateGetInterfaceDefaultsResponder },
2034    /// Returns the current TCP settings values.
2035    GetTcp { responder: StateGetTcpResponder },
2036    /// Returns the current UDP settings values.
2037    GetUdp { responder: StateGetUdpResponder },
2038    /// Returns the current ICMP settings values.
2039    GetIcmp { responder: StateGetIcmpResponder },
2040    /// Returns the current IP settings values.
2041    GetIp { responder: StateGetIpResponder },
2042    /// Returns the current device layer settings values.
2043    GetDevice { responder: StateGetDeviceResponder },
2044}
2045
2046impl StateRequest {
2047    #[allow(irrefutable_let_patterns)]
2048    pub fn into_get_interface_defaults(self) -> Option<(StateGetInterfaceDefaultsResponder)> {
2049        if let StateRequest::GetInterfaceDefaults { responder } = self {
2050            Some((responder))
2051        } else {
2052            None
2053        }
2054    }
2055
2056    #[allow(irrefutable_let_patterns)]
2057    pub fn into_get_tcp(self) -> Option<(StateGetTcpResponder)> {
2058        if let StateRequest::GetTcp { responder } = self { Some((responder)) } else { None }
2059    }
2060
2061    #[allow(irrefutable_let_patterns)]
2062    pub fn into_get_udp(self) -> Option<(StateGetUdpResponder)> {
2063        if let StateRequest::GetUdp { responder } = self { Some((responder)) } else { None }
2064    }
2065
2066    #[allow(irrefutable_let_patterns)]
2067    pub fn into_get_icmp(self) -> Option<(StateGetIcmpResponder)> {
2068        if let StateRequest::GetIcmp { responder } = self { Some((responder)) } else { None }
2069    }
2070
2071    #[allow(irrefutable_let_patterns)]
2072    pub fn into_get_ip(self) -> Option<(StateGetIpResponder)> {
2073        if let StateRequest::GetIp { responder } = self { Some((responder)) } else { None }
2074    }
2075
2076    #[allow(irrefutable_let_patterns)]
2077    pub fn into_get_device(self) -> Option<(StateGetDeviceResponder)> {
2078        if let StateRequest::GetDevice { responder } = self { Some((responder)) } else { None }
2079    }
2080
2081    /// Name of the method defined in FIDL
2082    pub fn method_name(&self) -> &'static str {
2083        match *self {
2084            StateRequest::GetInterfaceDefaults { .. } => "get_interface_defaults",
2085            StateRequest::GetTcp { .. } => "get_tcp",
2086            StateRequest::GetUdp { .. } => "get_udp",
2087            StateRequest::GetIcmp { .. } => "get_icmp",
2088            StateRequest::GetIp { .. } => "get_ip",
2089            StateRequest::GetDevice { .. } => "get_device",
2090        }
2091    }
2092}
2093
2094#[derive(Debug, Clone)]
2095pub struct StateControlHandle {
2096    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2097}
2098
2099impl fidl::endpoints::ControlHandle for StateControlHandle {
2100    fn shutdown(&self) {
2101        self.inner.shutdown()
2102    }
2103
2104    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2105        self.inner.shutdown_with_epitaph(status)
2106    }
2107
2108    fn is_closed(&self) -> bool {
2109        self.inner.channel().is_closed()
2110    }
2111    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2112        self.inner.channel().on_closed()
2113    }
2114
2115    #[cfg(target_os = "fuchsia")]
2116    fn signal_peer(
2117        &self,
2118        clear_mask: zx::Signals,
2119        set_mask: zx::Signals,
2120    ) -> Result<(), zx_status::Status> {
2121        use fidl::Peered;
2122        self.inner.channel().signal_peer(clear_mask, set_mask)
2123    }
2124}
2125
2126impl StateControlHandle {}
2127
2128#[must_use = "FIDL methods require a response to be sent"]
2129#[derive(Debug)]
2130pub struct StateGetInterfaceDefaultsResponder {
2131    control_handle: std::mem::ManuallyDrop<StateControlHandle>,
2132    tx_id: u32,
2133}
2134
2135/// Set the the channel to be shutdown (see [`StateControlHandle::shutdown`])
2136/// if the responder is dropped without sending a response, so that the client
2137/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2138impl std::ops::Drop for StateGetInterfaceDefaultsResponder {
2139    fn drop(&mut self) {
2140        self.control_handle.shutdown();
2141        // Safety: drops once, never accessed again
2142        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2143    }
2144}
2145
2146impl fidl::endpoints::Responder for StateGetInterfaceDefaultsResponder {
2147    type ControlHandle = StateControlHandle;
2148
2149    fn control_handle(&self) -> &StateControlHandle {
2150        &self.control_handle
2151    }
2152
2153    fn drop_without_shutdown(mut self) {
2154        // Safety: drops once, never accessed again due to mem::forget
2155        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2156        // Prevent Drop from running (which would shut down the channel)
2157        std::mem::forget(self);
2158    }
2159}
2160
2161impl StateGetInterfaceDefaultsResponder {
2162    /// Sends a response to the FIDL transaction.
2163    ///
2164    /// Sets the channel to shutdown if an error occurs.
2165    pub fn send(
2166        self,
2167        mut payload: &fidl_fuchsia_net_interfaces_admin::Configuration,
2168    ) -> Result<(), fidl::Error> {
2169        let _result = self.send_raw(payload);
2170        if _result.is_err() {
2171            self.control_handle.shutdown();
2172        }
2173        self.drop_without_shutdown();
2174        _result
2175    }
2176
2177    /// Similar to "send" but does not shutdown the channel if an error occurs.
2178    pub fn send_no_shutdown_on_err(
2179        self,
2180        mut payload: &fidl_fuchsia_net_interfaces_admin::Configuration,
2181    ) -> Result<(), fidl::Error> {
2182        let _result = self.send_raw(payload);
2183        self.drop_without_shutdown();
2184        _result
2185    }
2186
2187    fn send_raw(
2188        &self,
2189        mut payload: &fidl_fuchsia_net_interfaces_admin::Configuration,
2190    ) -> Result<(), fidl::Error> {
2191        self.control_handle.inner.send::<fidl_fuchsia_net_interfaces_admin::Configuration>(
2192            payload,
2193            self.tx_id,
2194            0x4c4824a322a705e3,
2195            fidl::encoding::DynamicFlags::empty(),
2196        )
2197    }
2198}
2199
2200#[must_use = "FIDL methods require a response to be sent"]
2201#[derive(Debug)]
2202pub struct StateGetTcpResponder {
2203    control_handle: std::mem::ManuallyDrop<StateControlHandle>,
2204    tx_id: u32,
2205}
2206
2207/// Set the the channel to be shutdown (see [`StateControlHandle::shutdown`])
2208/// if the responder is dropped without sending a response, so that the client
2209/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2210impl std::ops::Drop for StateGetTcpResponder {
2211    fn drop(&mut self) {
2212        self.control_handle.shutdown();
2213        // Safety: drops once, never accessed again
2214        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2215    }
2216}
2217
2218impl fidl::endpoints::Responder for StateGetTcpResponder {
2219    type ControlHandle = StateControlHandle;
2220
2221    fn control_handle(&self) -> &StateControlHandle {
2222        &self.control_handle
2223    }
2224
2225    fn drop_without_shutdown(mut self) {
2226        // Safety: drops once, never accessed again due to mem::forget
2227        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2228        // Prevent Drop from running (which would shut down the channel)
2229        std::mem::forget(self);
2230    }
2231}
2232
2233impl StateGetTcpResponder {
2234    /// Sends a response to the FIDL transaction.
2235    ///
2236    /// Sets the channel to shutdown if an error occurs.
2237    pub fn send(self, mut payload: &Tcp) -> Result<(), fidl::Error> {
2238        let _result = self.send_raw(payload);
2239        if _result.is_err() {
2240            self.control_handle.shutdown();
2241        }
2242        self.drop_without_shutdown();
2243        _result
2244    }
2245
2246    /// Similar to "send" but does not shutdown the channel if an error occurs.
2247    pub fn send_no_shutdown_on_err(self, mut payload: &Tcp) -> Result<(), fidl::Error> {
2248        let _result = self.send_raw(payload);
2249        self.drop_without_shutdown();
2250        _result
2251    }
2252
2253    fn send_raw(&self, mut payload: &Tcp) -> Result<(), fidl::Error> {
2254        self.control_handle.inner.send::<Tcp>(
2255            payload,
2256            self.tx_id,
2257            0x4e818d8a89985b70,
2258            fidl::encoding::DynamicFlags::empty(),
2259        )
2260    }
2261}
2262
2263#[must_use = "FIDL methods require a response to be sent"]
2264#[derive(Debug)]
2265pub struct StateGetUdpResponder {
2266    control_handle: std::mem::ManuallyDrop<StateControlHandle>,
2267    tx_id: u32,
2268}
2269
2270/// Set the the channel to be shutdown (see [`StateControlHandle::shutdown`])
2271/// if the responder is dropped without sending a response, so that the client
2272/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2273impl std::ops::Drop for StateGetUdpResponder {
2274    fn drop(&mut self) {
2275        self.control_handle.shutdown();
2276        // Safety: drops once, never accessed again
2277        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2278    }
2279}
2280
2281impl fidl::endpoints::Responder for StateGetUdpResponder {
2282    type ControlHandle = StateControlHandle;
2283
2284    fn control_handle(&self) -> &StateControlHandle {
2285        &self.control_handle
2286    }
2287
2288    fn drop_without_shutdown(mut self) {
2289        // Safety: drops once, never accessed again due to mem::forget
2290        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2291        // Prevent Drop from running (which would shut down the channel)
2292        std::mem::forget(self);
2293    }
2294}
2295
2296impl StateGetUdpResponder {
2297    /// Sends a response to the FIDL transaction.
2298    ///
2299    /// Sets the channel to shutdown if an error occurs.
2300    pub fn send(self, mut payload: &Udp) -> Result<(), fidl::Error> {
2301        let _result = self.send_raw(payload);
2302        if _result.is_err() {
2303            self.control_handle.shutdown();
2304        }
2305        self.drop_without_shutdown();
2306        _result
2307    }
2308
2309    /// Similar to "send" but does not shutdown the channel if an error occurs.
2310    pub fn send_no_shutdown_on_err(self, mut payload: &Udp) -> Result<(), fidl::Error> {
2311        let _result = self.send_raw(payload);
2312        self.drop_without_shutdown();
2313        _result
2314    }
2315
2316    fn send_raw(&self, mut payload: &Udp) -> Result<(), fidl::Error> {
2317        self.control_handle.inner.send::<Udp>(
2318            payload,
2319            self.tx_id,
2320            0x1af3bc1507b7a196,
2321            fidl::encoding::DynamicFlags::empty(),
2322        )
2323    }
2324}
2325
2326#[must_use = "FIDL methods require a response to be sent"]
2327#[derive(Debug)]
2328pub struct StateGetIcmpResponder {
2329    control_handle: std::mem::ManuallyDrop<StateControlHandle>,
2330    tx_id: u32,
2331}
2332
2333/// Set the the channel to be shutdown (see [`StateControlHandle::shutdown`])
2334/// if the responder is dropped without sending a response, so that the client
2335/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2336impl std::ops::Drop for StateGetIcmpResponder {
2337    fn drop(&mut self) {
2338        self.control_handle.shutdown();
2339        // Safety: drops once, never accessed again
2340        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2341    }
2342}
2343
2344impl fidl::endpoints::Responder for StateGetIcmpResponder {
2345    type ControlHandle = StateControlHandle;
2346
2347    fn control_handle(&self) -> &StateControlHandle {
2348        &self.control_handle
2349    }
2350
2351    fn drop_without_shutdown(mut self) {
2352        // Safety: drops once, never accessed again due to mem::forget
2353        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2354        // Prevent Drop from running (which would shut down the channel)
2355        std::mem::forget(self);
2356    }
2357}
2358
2359impl StateGetIcmpResponder {
2360    /// Sends a response to the FIDL transaction.
2361    ///
2362    /// Sets the channel to shutdown if an error occurs.
2363    pub fn send(self, mut payload: &Icmp) -> Result<(), fidl::Error> {
2364        let _result = self.send_raw(payload);
2365        if _result.is_err() {
2366            self.control_handle.shutdown();
2367        }
2368        self.drop_without_shutdown();
2369        _result
2370    }
2371
2372    /// Similar to "send" but does not shutdown the channel if an error occurs.
2373    pub fn send_no_shutdown_on_err(self, mut payload: &Icmp) -> Result<(), fidl::Error> {
2374        let _result = self.send_raw(payload);
2375        self.drop_without_shutdown();
2376        _result
2377    }
2378
2379    fn send_raw(&self, mut payload: &Icmp) -> Result<(), fidl::Error> {
2380        self.control_handle.inner.send::<Icmp>(
2381            payload,
2382            self.tx_id,
2383            0x4079fd71ca65e33f,
2384            fidl::encoding::DynamicFlags::empty(),
2385        )
2386    }
2387}
2388
2389#[must_use = "FIDL methods require a response to be sent"]
2390#[derive(Debug)]
2391pub struct StateGetIpResponder {
2392    control_handle: std::mem::ManuallyDrop<StateControlHandle>,
2393    tx_id: u32,
2394}
2395
2396/// Set the the channel to be shutdown (see [`StateControlHandle::shutdown`])
2397/// if the responder is dropped without sending a response, so that the client
2398/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2399impl std::ops::Drop for StateGetIpResponder {
2400    fn drop(&mut self) {
2401        self.control_handle.shutdown();
2402        // Safety: drops once, never accessed again
2403        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2404    }
2405}
2406
2407impl fidl::endpoints::Responder for StateGetIpResponder {
2408    type ControlHandle = StateControlHandle;
2409
2410    fn control_handle(&self) -> &StateControlHandle {
2411        &self.control_handle
2412    }
2413
2414    fn drop_without_shutdown(mut self) {
2415        // Safety: drops once, never accessed again due to mem::forget
2416        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2417        // Prevent Drop from running (which would shut down the channel)
2418        std::mem::forget(self);
2419    }
2420}
2421
2422impl StateGetIpResponder {
2423    /// Sends a response to the FIDL transaction.
2424    ///
2425    /// Sets the channel to shutdown if an error occurs.
2426    pub fn send(self, mut payload: &Ip) -> Result<(), fidl::Error> {
2427        let _result = self.send_raw(payload);
2428        if _result.is_err() {
2429            self.control_handle.shutdown();
2430        }
2431        self.drop_without_shutdown();
2432        _result
2433    }
2434
2435    /// Similar to "send" but does not shutdown the channel if an error occurs.
2436    pub fn send_no_shutdown_on_err(self, mut payload: &Ip) -> Result<(), fidl::Error> {
2437        let _result = self.send_raw(payload);
2438        self.drop_without_shutdown();
2439        _result
2440    }
2441
2442    fn send_raw(&self, mut payload: &Ip) -> Result<(), fidl::Error> {
2443        self.control_handle.inner.send::<Ip>(
2444            payload,
2445            self.tx_id,
2446            0x2c1cc13f4874956,
2447            fidl::encoding::DynamicFlags::empty(),
2448        )
2449    }
2450}
2451
2452#[must_use = "FIDL methods require a response to be sent"]
2453#[derive(Debug)]
2454pub struct StateGetDeviceResponder {
2455    control_handle: std::mem::ManuallyDrop<StateControlHandle>,
2456    tx_id: u32,
2457}
2458
2459/// Set the the channel to be shutdown (see [`StateControlHandle::shutdown`])
2460/// if the responder is dropped without sending a response, so that the client
2461/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2462impl std::ops::Drop for StateGetDeviceResponder {
2463    fn drop(&mut self) {
2464        self.control_handle.shutdown();
2465        // Safety: drops once, never accessed again
2466        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2467    }
2468}
2469
2470impl fidl::endpoints::Responder for StateGetDeviceResponder {
2471    type ControlHandle = StateControlHandle;
2472
2473    fn control_handle(&self) -> &StateControlHandle {
2474        &self.control_handle
2475    }
2476
2477    fn drop_without_shutdown(mut self) {
2478        // Safety: drops once, never accessed again due to mem::forget
2479        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2480        // Prevent Drop from running (which would shut down the channel)
2481        std::mem::forget(self);
2482    }
2483}
2484
2485impl StateGetDeviceResponder {
2486    /// Sends a response to the FIDL transaction.
2487    ///
2488    /// Sets the channel to shutdown if an error occurs.
2489    pub fn send(self, mut payload: &Device) -> Result<(), fidl::Error> {
2490        let _result = self.send_raw(payload);
2491        if _result.is_err() {
2492            self.control_handle.shutdown();
2493        }
2494        self.drop_without_shutdown();
2495        _result
2496    }
2497
2498    /// Similar to "send" but does not shutdown the channel if an error occurs.
2499    pub fn send_no_shutdown_on_err(self, mut payload: &Device) -> Result<(), fidl::Error> {
2500        let _result = self.send_raw(payload);
2501        self.drop_without_shutdown();
2502        _result
2503    }
2504
2505    fn send_raw(&self, mut payload: &Device) -> Result<(), fidl::Error> {
2506        self.control_handle.inner.send::<Device>(
2507            payload,
2508            self.tx_id,
2509            0x5713a85352e43887,
2510            fidl::encoding::DynamicFlags::empty(),
2511        )
2512    }
2513}
2514
2515mod internal {
2516    use super::*;
2517}