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