fidl_fuchsia_wlan_wlanix/
fidl_fuchsia_wlan_wlanix.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_wlan_wlanix__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct Nl80211MessageV2Request {
16    pub message: Nl80211Message,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Nl80211MessageV2Request {}
20
21#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
22pub struct Nl80211MessageV2Response {
23    pub response: fidl::Vmo,
24}
25
26impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Nl80211MessageV2Response {}
27
28#[derive(Debug, Default, PartialEq)]
29pub struct Nl80211GetMulticastRequest {
30    pub group: Option<String>,
31    pub multicast: Option<fidl::endpoints::ClientEnd<Nl80211MulticastMarker>>,
32    #[doc(hidden)]
33    pub __source_breaking: fidl::marker::SourceBreaking,
34}
35
36impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
37    for Nl80211GetMulticastRequest
38{
39}
40
41#[derive(Debug, Default, PartialEq)]
42pub struct Nl80211MessageRequest {
43    pub message: Option<Nl80211Message>,
44    #[doc(hidden)]
45    pub __source_breaking: fidl::marker::SourceBreaking,
46}
47
48impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Nl80211MessageRequest {}
49
50#[derive(Debug, Default, PartialEq)]
51pub struct Nl80211MulticastMessageRequest {
52    pub message: Option<Nl80211Message>,
53    #[doc(hidden)]
54    pub __source_breaking: fidl::marker::SourceBreaking,
55}
56
57impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
58    for Nl80211MulticastMessageRequest
59{
60}
61
62#[derive(Debug, Default, PartialEq)]
63pub struct Nl80211MessageResponse {
64    pub responses: Option<Vec<Nl80211Message>>,
65    #[doc(hidden)]
66    pub __source_breaking: fidl::marker::SourceBreaking,
67}
68
69impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Nl80211MessageResponse {}
70
71#[derive(Debug, Default, PartialEq)]
72pub struct SupplicantAddStaInterfaceRequest {
73    pub iface: Option<fidl::endpoints::ServerEnd<SupplicantStaIfaceMarker>>,
74    pub iface_name: Option<String>,
75    #[doc(hidden)]
76    pub __source_breaking: fidl::marker::SourceBreaking,
77}
78
79impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
80    for SupplicantAddStaInterfaceRequest
81{
82}
83
84#[derive(Debug, Default, PartialEq)]
85pub struct SupplicantRemoveInterfaceRequest {
86    pub iface_name: Option<String>,
87    #[doc(hidden)]
88    pub __source_breaking: fidl::marker::SourceBreaking,
89}
90
91impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
92    for SupplicantRemoveInterfaceRequest
93{
94}
95
96#[derive(Debug, Default, PartialEq)]
97pub struct SupplicantStaIfaceAddNetworkRequest {
98    pub network: Option<fidl::endpoints::ServerEnd<SupplicantStaNetworkMarker>>,
99    #[doc(hidden)]
100    pub __source_breaking: fidl::marker::SourceBreaking,
101}
102
103impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
104    for SupplicantStaIfaceAddNetworkRequest
105{
106}
107
108#[derive(Debug, Default, PartialEq)]
109pub struct SupplicantStaIfaceRegisterCallbackRequest {
110    pub callback: Option<fidl::endpoints::ClientEnd<SupplicantStaIfaceCallbackMarker>>,
111    #[doc(hidden)]
112    pub __source_breaking: fidl::marker::SourceBreaking,
113}
114
115impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
116    for SupplicantStaIfaceRegisterCallbackRequest
117{
118}
119
120#[derive(Debug, Default, PartialEq)]
121pub struct SupplicantStaIfaceSetPowerSaveRequest {
122    pub enable: Option<bool>,
123    #[doc(hidden)]
124    pub __source_breaking: fidl::marker::SourceBreaking,
125}
126
127impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
128    for SupplicantStaIfaceSetPowerSaveRequest
129{
130}
131
132#[derive(Debug, Default, PartialEq)]
133pub struct SupplicantStaIfaceSetStaCountryCodeRequest {
134    pub code: Option<[u8; 2]>,
135    #[doc(hidden)]
136    pub __source_breaking: fidl::marker::SourceBreaking,
137}
138
139impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
140    for SupplicantStaIfaceSetStaCountryCodeRequest
141{
142}
143
144#[derive(Debug, Default, PartialEq)]
145pub struct SupplicantStaIfaceSetSuspendModeEnabledRequest {
146    pub enable: Option<bool>,
147    #[doc(hidden)]
148    pub __source_breaking: fidl::marker::SourceBreaking,
149}
150
151impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
152    for SupplicantStaIfaceSetSuspendModeEnabledRequest
153{
154}
155
156#[derive(Debug, Default, PartialEq)]
157pub struct WifiChipCreateStaIfaceRequest {
158    pub iface: Option<fidl::endpoints::ServerEnd<WifiStaIfaceMarker>>,
159    #[doc(hidden)]
160    pub __source_breaking: fidl::marker::SourceBreaking,
161}
162
163impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
164    for WifiChipCreateStaIfaceRequest
165{
166}
167
168#[derive(Debug, Default, PartialEq)]
169pub struct WifiChipGetStaIfaceRequest {
170    pub iface_name: Option<String>,
171    pub iface: Option<fidl::endpoints::ServerEnd<WifiStaIfaceMarker>>,
172    #[doc(hidden)]
173    pub __source_breaking: fidl::marker::SourceBreaking,
174}
175
176impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
177    for WifiChipGetStaIfaceRequest
178{
179}
180
181#[derive(Debug, Default, PartialEq)]
182pub struct WifiChipRemoveStaIfaceRequest {
183    pub iface_name: Option<String>,
184    #[doc(hidden)]
185    pub __source_breaking: fidl::marker::SourceBreaking,
186}
187
188impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
189    for WifiChipRemoveStaIfaceRequest
190{
191}
192
193#[derive(Debug, Default, PartialEq)]
194pub struct WifiChipSetCountryCodeRequest {
195    pub code: Option<[u8; 2]>,
196    #[doc(hidden)]
197    pub __source_breaking: fidl::marker::SourceBreaking,
198}
199
200impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
201    for WifiChipSetCountryCodeRequest
202{
203}
204
205#[derive(Debug, Default, PartialEq)]
206pub struct WifiGetChipRequest {
207    pub chip_id: Option<u32>,
208    pub chip: Option<fidl::endpoints::ServerEnd<WifiChipMarker>>,
209    #[doc(hidden)]
210    pub __source_breaking: fidl::marker::SourceBreaking,
211}
212
213impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for WifiGetChipRequest {}
214
215#[derive(Debug, Default, PartialEq)]
216pub struct WifiLegacyHalSelectTxPowerScenarioRequest {
217    pub scenario: Option<WifiLegacyHalTxPowerScenario>,
218    #[doc(hidden)]
219    pub __source_breaking: fidl::marker::SourceBreaking,
220}
221
222impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
223    for WifiLegacyHalSelectTxPowerScenarioRequest
224{
225}
226
227#[derive(Debug, Default, PartialEq)]
228pub struct WifiRegisterEventCallbackRequest {
229    pub callback: Option<fidl::endpoints::ClientEnd<WifiEventCallbackMarker>>,
230    #[doc(hidden)]
231    pub __source_breaking: fidl::marker::SourceBreaking,
232}
233
234impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
235    for WifiRegisterEventCallbackRequest
236{
237}
238
239#[derive(Debug, Default, PartialEq)]
240pub struct WifiStaIfaceSetScanOnlyModeRequest {
241    pub enable: Option<bool>,
242    #[doc(hidden)]
243    pub __source_breaking: fidl::marker::SourceBreaking,
244}
245
246impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
247    for WifiStaIfaceSetScanOnlyModeRequest
248{
249}
250
251#[derive(Debug, Default, PartialEq)]
252pub struct WlanixGetNl80211Request {
253    pub nl80211: Option<fidl::endpoints::ServerEnd<Nl80211Marker>>,
254    #[doc(hidden)]
255    pub __source_breaking: fidl::marker::SourceBreaking,
256}
257
258impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for WlanixGetNl80211Request {}
259
260#[derive(Debug, Default, PartialEq)]
261pub struct WlanixGetSupplicantRequest {
262    pub supplicant: Option<fidl::endpoints::ServerEnd<SupplicantMarker>>,
263    #[doc(hidden)]
264    pub __source_breaking: fidl::marker::SourceBreaking,
265}
266
267impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
268    for WlanixGetSupplicantRequest
269{
270}
271
272#[derive(Debug, Default, PartialEq)]
273pub struct WlanixGetWifiLegacyHalRequest {
274    pub legacy_hal: Option<fidl::endpoints::ServerEnd<WifiLegacyHalMarker>>,
275    #[doc(hidden)]
276    pub __source_breaking: fidl::marker::SourceBreaking,
277}
278
279impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
280    for WlanixGetWifiLegacyHalRequest
281{
282}
283
284#[derive(Debug, Default, PartialEq)]
285pub struct WlanixGetWifiRequest {
286    pub wifi: Option<fidl::endpoints::ServerEnd<WifiMarker>>,
287    #[doc(hidden)]
288    pub __source_breaking: fidl::marker::SourceBreaking,
289}
290
291impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for WlanixGetWifiRequest {}
292
293#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
294pub struct Nl80211Marker;
295
296impl fidl::endpoints::ProtocolMarker for Nl80211Marker {
297    type Proxy = Nl80211Proxy;
298    type RequestStream = Nl80211RequestStream;
299    #[cfg(target_os = "fuchsia")]
300    type SynchronousProxy = Nl80211SynchronousProxy;
301
302    const DEBUG_NAME: &'static str = "(anonymous) Nl80211";
303}
304pub type Nl80211MessageResult = Result<Nl80211MessageResponse, i32>;
305pub type Nl80211MessageV2Result = Result<fidl::Vmo, i32>;
306
307pub trait Nl80211ProxyInterface: Send + Sync {
308    fn r#get_multicast(&self, payload: Nl80211GetMulticastRequest) -> Result<(), fidl::Error>;
309    type MessageResponseFut: std::future::Future<Output = Result<Nl80211MessageResult, fidl::Error>>
310        + Send;
311    fn r#message(&self, payload: Nl80211MessageRequest) -> Self::MessageResponseFut;
312    type MessageV2ResponseFut: std::future::Future<Output = Result<Nl80211MessageV2Result, fidl::Error>>
313        + Send;
314    fn r#message_v2(&self, message: &Nl80211Message) -> Self::MessageV2ResponseFut;
315}
316#[derive(Debug)]
317#[cfg(target_os = "fuchsia")]
318pub struct Nl80211SynchronousProxy {
319    client: fidl::client::sync::Client,
320}
321
322#[cfg(target_os = "fuchsia")]
323impl fidl::endpoints::SynchronousProxy for Nl80211SynchronousProxy {
324    type Proxy = Nl80211Proxy;
325    type Protocol = Nl80211Marker;
326
327    fn from_channel(inner: fidl::Channel) -> Self {
328        Self::new(inner)
329    }
330
331    fn into_channel(self) -> fidl::Channel {
332        self.client.into_channel()
333    }
334
335    fn as_channel(&self) -> &fidl::Channel {
336        self.client.as_channel()
337    }
338}
339
340#[cfg(target_os = "fuchsia")]
341impl Nl80211SynchronousProxy {
342    pub fn new(channel: fidl::Channel) -> Self {
343        let protocol_name = <Nl80211Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
344        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
345    }
346
347    pub fn into_channel(self) -> fidl::Channel {
348        self.client.into_channel()
349    }
350
351    /// Waits until an event arrives and returns it. It is safe for other
352    /// threads to make concurrent requests while waiting for an event.
353    pub fn wait_for_event(
354        &self,
355        deadline: zx::MonotonicInstant,
356    ) -> Result<Nl80211Event, fidl::Error> {
357        Nl80211Event::decode(self.client.wait_for_event(deadline)?)
358    }
359
360    pub fn r#get_multicast(
361        &self,
362        mut payload: Nl80211GetMulticastRequest,
363    ) -> Result<(), fidl::Error> {
364        self.client.send::<Nl80211GetMulticastRequest>(
365            &mut payload,
366            0x58b73dd089681dc2,
367            fidl::encoding::DynamicFlags::FLEXIBLE,
368        )
369    }
370
371    pub fn r#message(
372        &self,
373        mut payload: Nl80211MessageRequest,
374        ___deadline: zx::MonotonicInstant,
375    ) -> Result<Nl80211MessageResult, fidl::Error> {
376        let _response = self.client.send_query::<
377            Nl80211MessageRequest,
378            fidl::encoding::FlexibleResultType<Nl80211MessageResponse, i32>,
379        >(
380            &mut payload,
381            0x6336259e15bb3795,
382            fidl::encoding::DynamicFlags::FLEXIBLE,
383            ___deadline,
384        )?
385        .into_result::<Nl80211Marker>("message")?;
386        Ok(_response.map(|x| x))
387    }
388
389    pub fn r#message_v2(
390        &self,
391        mut message: &Nl80211Message,
392        ___deadline: zx::MonotonicInstant,
393    ) -> Result<Nl80211MessageV2Result, fidl::Error> {
394        let _response = self.client.send_query::<
395            Nl80211MessageV2Request,
396            fidl::encoding::FlexibleResultType<Nl80211MessageV2Response, i32>,
397        >(
398            (message,),
399            0x4626796aba1e2987,
400            fidl::encoding::DynamicFlags::FLEXIBLE,
401            ___deadline,
402        )?
403        .into_result::<Nl80211Marker>("message_v2")?;
404        Ok(_response.map(|x| x.response))
405    }
406}
407
408#[cfg(target_os = "fuchsia")]
409impl From<Nl80211SynchronousProxy> for zx::Handle {
410    fn from(value: Nl80211SynchronousProxy) -> Self {
411        value.into_channel().into()
412    }
413}
414
415#[cfg(target_os = "fuchsia")]
416impl From<fidl::Channel> for Nl80211SynchronousProxy {
417    fn from(value: fidl::Channel) -> Self {
418        Self::new(value)
419    }
420}
421
422#[cfg(target_os = "fuchsia")]
423impl fidl::endpoints::FromClient for Nl80211SynchronousProxy {
424    type Protocol = Nl80211Marker;
425
426    fn from_client(value: fidl::endpoints::ClientEnd<Nl80211Marker>) -> Self {
427        Self::new(value.into_channel())
428    }
429}
430
431#[derive(Debug, Clone)]
432pub struct Nl80211Proxy {
433    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
434}
435
436impl fidl::endpoints::Proxy for Nl80211Proxy {
437    type Protocol = Nl80211Marker;
438
439    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
440        Self::new(inner)
441    }
442
443    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
444        self.client.into_channel().map_err(|client| Self { client })
445    }
446
447    fn as_channel(&self) -> &::fidl::AsyncChannel {
448        self.client.as_channel()
449    }
450}
451
452impl Nl80211Proxy {
453    /// Create a new Proxy for fuchsia.wlan.wlanix/Nl80211.
454    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
455        let protocol_name = <Nl80211Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
456        Self { client: fidl::client::Client::new(channel, protocol_name) }
457    }
458
459    /// Get a Stream of events from the remote end of the protocol.
460    ///
461    /// # Panics
462    ///
463    /// Panics if the event stream was already taken.
464    pub fn take_event_stream(&self) -> Nl80211EventStream {
465        Nl80211EventStream { event_receiver: self.client.take_event_receiver() }
466    }
467
468    pub fn r#get_multicast(
469        &self,
470        mut payload: Nl80211GetMulticastRequest,
471    ) -> Result<(), fidl::Error> {
472        Nl80211ProxyInterface::r#get_multicast(self, payload)
473    }
474
475    pub fn r#message(
476        &self,
477        mut payload: Nl80211MessageRequest,
478    ) -> fidl::client::QueryResponseFut<
479        Nl80211MessageResult,
480        fidl::encoding::DefaultFuchsiaResourceDialect,
481    > {
482        Nl80211ProxyInterface::r#message(self, payload)
483    }
484
485    pub fn r#message_v2(
486        &self,
487        mut message: &Nl80211Message,
488    ) -> fidl::client::QueryResponseFut<
489        Nl80211MessageV2Result,
490        fidl::encoding::DefaultFuchsiaResourceDialect,
491    > {
492        Nl80211ProxyInterface::r#message_v2(self, message)
493    }
494}
495
496impl Nl80211ProxyInterface for Nl80211Proxy {
497    fn r#get_multicast(&self, mut payload: Nl80211GetMulticastRequest) -> Result<(), fidl::Error> {
498        self.client.send::<Nl80211GetMulticastRequest>(
499            &mut payload,
500            0x58b73dd089681dc2,
501            fidl::encoding::DynamicFlags::FLEXIBLE,
502        )
503    }
504
505    type MessageResponseFut = fidl::client::QueryResponseFut<
506        Nl80211MessageResult,
507        fidl::encoding::DefaultFuchsiaResourceDialect,
508    >;
509    fn r#message(&self, mut payload: Nl80211MessageRequest) -> Self::MessageResponseFut {
510        fn _decode(
511            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
512        ) -> Result<Nl80211MessageResult, fidl::Error> {
513            let _response = fidl::client::decode_transaction_body::<
514                fidl::encoding::FlexibleResultType<Nl80211MessageResponse, i32>,
515                fidl::encoding::DefaultFuchsiaResourceDialect,
516                0x6336259e15bb3795,
517            >(_buf?)?
518            .into_result::<Nl80211Marker>("message")?;
519            Ok(_response.map(|x| x))
520        }
521        self.client.send_query_and_decode::<Nl80211MessageRequest, Nl80211MessageResult>(
522            &mut payload,
523            0x6336259e15bb3795,
524            fidl::encoding::DynamicFlags::FLEXIBLE,
525            _decode,
526        )
527    }
528
529    type MessageV2ResponseFut = fidl::client::QueryResponseFut<
530        Nl80211MessageV2Result,
531        fidl::encoding::DefaultFuchsiaResourceDialect,
532    >;
533    fn r#message_v2(&self, mut message: &Nl80211Message) -> Self::MessageV2ResponseFut {
534        fn _decode(
535            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
536        ) -> Result<Nl80211MessageV2Result, fidl::Error> {
537            let _response = fidl::client::decode_transaction_body::<
538                fidl::encoding::FlexibleResultType<Nl80211MessageV2Response, i32>,
539                fidl::encoding::DefaultFuchsiaResourceDialect,
540                0x4626796aba1e2987,
541            >(_buf?)?
542            .into_result::<Nl80211Marker>("message_v2")?;
543            Ok(_response.map(|x| x.response))
544        }
545        self.client.send_query_and_decode::<Nl80211MessageV2Request, Nl80211MessageV2Result>(
546            (message,),
547            0x4626796aba1e2987,
548            fidl::encoding::DynamicFlags::FLEXIBLE,
549            _decode,
550        )
551    }
552}
553
554pub struct Nl80211EventStream {
555    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
556}
557
558impl std::marker::Unpin for Nl80211EventStream {}
559
560impl futures::stream::FusedStream for Nl80211EventStream {
561    fn is_terminated(&self) -> bool {
562        self.event_receiver.is_terminated()
563    }
564}
565
566impl futures::Stream for Nl80211EventStream {
567    type Item = Result<Nl80211Event, fidl::Error>;
568
569    fn poll_next(
570        mut self: std::pin::Pin<&mut Self>,
571        cx: &mut std::task::Context<'_>,
572    ) -> std::task::Poll<Option<Self::Item>> {
573        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
574            &mut self.event_receiver,
575            cx
576        )?) {
577            Some(buf) => std::task::Poll::Ready(Some(Nl80211Event::decode(buf))),
578            None => std::task::Poll::Ready(None),
579        }
580    }
581}
582
583#[derive(Debug)]
584pub enum Nl80211Event {
585    #[non_exhaustive]
586    _UnknownEvent {
587        /// Ordinal of the event that was sent.
588        ordinal: u64,
589    },
590}
591
592impl Nl80211Event {
593    /// Decodes a message buffer as a [`Nl80211Event`].
594    fn decode(
595        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
596    ) -> Result<Nl80211Event, fidl::Error> {
597        let (bytes, _handles) = buf.split_mut();
598        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
599        debug_assert_eq!(tx_header.tx_id, 0);
600        match tx_header.ordinal {
601            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
602                Ok(Nl80211Event::_UnknownEvent { ordinal: tx_header.ordinal })
603            }
604            _ => Err(fidl::Error::UnknownOrdinal {
605                ordinal: tx_header.ordinal,
606                protocol_name: <Nl80211Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
607            }),
608        }
609    }
610}
611
612/// A Stream of incoming requests for fuchsia.wlan.wlanix/Nl80211.
613pub struct Nl80211RequestStream {
614    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
615    is_terminated: bool,
616}
617
618impl std::marker::Unpin for Nl80211RequestStream {}
619
620impl futures::stream::FusedStream for Nl80211RequestStream {
621    fn is_terminated(&self) -> bool {
622        self.is_terminated
623    }
624}
625
626impl fidl::endpoints::RequestStream for Nl80211RequestStream {
627    type Protocol = Nl80211Marker;
628    type ControlHandle = Nl80211ControlHandle;
629
630    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
631        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
632    }
633
634    fn control_handle(&self) -> Self::ControlHandle {
635        Nl80211ControlHandle { inner: self.inner.clone() }
636    }
637
638    fn into_inner(
639        self,
640    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
641    {
642        (self.inner, self.is_terminated)
643    }
644
645    fn from_inner(
646        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
647        is_terminated: bool,
648    ) -> Self {
649        Self { inner, is_terminated }
650    }
651}
652
653impl futures::Stream for Nl80211RequestStream {
654    type Item = Result<Nl80211Request, fidl::Error>;
655
656    fn poll_next(
657        mut self: std::pin::Pin<&mut Self>,
658        cx: &mut std::task::Context<'_>,
659    ) -> std::task::Poll<Option<Self::Item>> {
660        let this = &mut *self;
661        if this.inner.check_shutdown(cx) {
662            this.is_terminated = true;
663            return std::task::Poll::Ready(None);
664        }
665        if this.is_terminated {
666            panic!("polled Nl80211RequestStream after completion");
667        }
668        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
669            |bytes, handles| {
670                match this.inner.channel().read_etc(cx, bytes, handles) {
671                    std::task::Poll::Ready(Ok(())) => {}
672                    std::task::Poll::Pending => return std::task::Poll::Pending,
673                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
674                        this.is_terminated = true;
675                        return std::task::Poll::Ready(None);
676                    }
677                    std::task::Poll::Ready(Err(e)) => {
678                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
679                            e.into(),
680                        ))));
681                    }
682                }
683
684                // A message has been received from the channel
685                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
686
687                std::task::Poll::Ready(Some(match header.ordinal {
688                    0x58b73dd089681dc2 => {
689                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
690                        let mut req = fidl::new_empty!(
691                            Nl80211GetMulticastRequest,
692                            fidl::encoding::DefaultFuchsiaResourceDialect
693                        );
694                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Nl80211GetMulticastRequest>(&header, _body_bytes, handles, &mut req)?;
695                        let control_handle = Nl80211ControlHandle { inner: this.inner.clone() };
696                        Ok(Nl80211Request::GetMulticast { payload: req, control_handle })
697                    }
698                    0x6336259e15bb3795 => {
699                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
700                        let mut req = fidl::new_empty!(
701                            Nl80211MessageRequest,
702                            fidl::encoding::DefaultFuchsiaResourceDialect
703                        );
704                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Nl80211MessageRequest>(&header, _body_bytes, handles, &mut req)?;
705                        let control_handle = Nl80211ControlHandle { inner: this.inner.clone() };
706                        Ok(Nl80211Request::Message {
707                            payload: req,
708                            responder: Nl80211MessageResponder {
709                                control_handle: std::mem::ManuallyDrop::new(control_handle),
710                                tx_id: header.tx_id,
711                            },
712                        })
713                    }
714                    0x4626796aba1e2987 => {
715                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
716                        let mut req = fidl::new_empty!(
717                            Nl80211MessageV2Request,
718                            fidl::encoding::DefaultFuchsiaResourceDialect
719                        );
720                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Nl80211MessageV2Request>(&header, _body_bytes, handles, &mut req)?;
721                        let control_handle = Nl80211ControlHandle { inner: this.inner.clone() };
722                        Ok(Nl80211Request::MessageV2 {
723                            message: req.message,
724
725                            responder: Nl80211MessageV2Responder {
726                                control_handle: std::mem::ManuallyDrop::new(control_handle),
727                                tx_id: header.tx_id,
728                            },
729                        })
730                    }
731                    _ if header.tx_id == 0
732                        && header
733                            .dynamic_flags()
734                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
735                    {
736                        Ok(Nl80211Request::_UnknownMethod {
737                            ordinal: header.ordinal,
738                            control_handle: Nl80211ControlHandle { inner: this.inner.clone() },
739                            method_type: fidl::MethodType::OneWay,
740                        })
741                    }
742                    _ if header
743                        .dynamic_flags()
744                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
745                    {
746                        this.inner.send_framework_err(
747                            fidl::encoding::FrameworkErr::UnknownMethod,
748                            header.tx_id,
749                            header.ordinal,
750                            header.dynamic_flags(),
751                            (bytes, handles),
752                        )?;
753                        Ok(Nl80211Request::_UnknownMethod {
754                            ordinal: header.ordinal,
755                            control_handle: Nl80211ControlHandle { inner: this.inner.clone() },
756                            method_type: fidl::MethodType::TwoWay,
757                        })
758                    }
759                    _ => Err(fidl::Error::UnknownOrdinal {
760                        ordinal: header.ordinal,
761                        protocol_name:
762                            <Nl80211Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
763                    }),
764                }))
765            },
766        )
767    }
768}
769
770#[derive(Debug)]
771pub enum Nl80211Request {
772    GetMulticast {
773        payload: Nl80211GetMulticastRequest,
774        control_handle: Nl80211ControlHandle,
775    },
776    Message {
777        payload: Nl80211MessageRequest,
778        responder: Nl80211MessageResponder,
779    },
780    MessageV2 {
781        message: Nl80211Message,
782        responder: Nl80211MessageV2Responder,
783    },
784    /// An interaction was received which does not match any known method.
785    #[non_exhaustive]
786    _UnknownMethod {
787        /// Ordinal of the method that was called.
788        ordinal: u64,
789        control_handle: Nl80211ControlHandle,
790        method_type: fidl::MethodType,
791    },
792}
793
794impl Nl80211Request {
795    #[allow(irrefutable_let_patterns)]
796    pub fn into_get_multicast(self) -> Option<(Nl80211GetMulticastRequest, Nl80211ControlHandle)> {
797        if let Nl80211Request::GetMulticast { payload, control_handle } = self {
798            Some((payload, control_handle))
799        } else {
800            None
801        }
802    }
803
804    #[allow(irrefutable_let_patterns)]
805    pub fn into_message(self) -> Option<(Nl80211MessageRequest, Nl80211MessageResponder)> {
806        if let Nl80211Request::Message { payload, responder } = self {
807            Some((payload, responder))
808        } else {
809            None
810        }
811    }
812
813    #[allow(irrefutable_let_patterns)]
814    pub fn into_message_v2(self) -> Option<(Nl80211Message, Nl80211MessageV2Responder)> {
815        if let Nl80211Request::MessageV2 { message, responder } = self {
816            Some((message, responder))
817        } else {
818            None
819        }
820    }
821
822    /// Name of the method defined in FIDL
823    pub fn method_name(&self) -> &'static str {
824        match *self {
825            Nl80211Request::GetMulticast { .. } => "get_multicast",
826            Nl80211Request::Message { .. } => "message",
827            Nl80211Request::MessageV2 { .. } => "message_v2",
828            Nl80211Request::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
829                "unknown one-way method"
830            }
831            Nl80211Request::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
832                "unknown two-way method"
833            }
834        }
835    }
836}
837
838#[derive(Debug, Clone)]
839pub struct Nl80211ControlHandle {
840    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
841}
842
843impl fidl::endpoints::ControlHandle for Nl80211ControlHandle {
844    fn shutdown(&self) {
845        self.inner.shutdown()
846    }
847    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
848        self.inner.shutdown_with_epitaph(status)
849    }
850
851    fn is_closed(&self) -> bool {
852        self.inner.channel().is_closed()
853    }
854    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
855        self.inner.channel().on_closed()
856    }
857
858    #[cfg(target_os = "fuchsia")]
859    fn signal_peer(
860        &self,
861        clear_mask: zx::Signals,
862        set_mask: zx::Signals,
863    ) -> Result<(), zx_status::Status> {
864        use fidl::Peered;
865        self.inner.channel().signal_peer(clear_mask, set_mask)
866    }
867}
868
869impl Nl80211ControlHandle {}
870
871#[must_use = "FIDL methods require a response to be sent"]
872#[derive(Debug)]
873pub struct Nl80211MessageResponder {
874    control_handle: std::mem::ManuallyDrop<Nl80211ControlHandle>,
875    tx_id: u32,
876}
877
878/// Set the the channel to be shutdown (see [`Nl80211ControlHandle::shutdown`])
879/// if the responder is dropped without sending a response, so that the client
880/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
881impl std::ops::Drop for Nl80211MessageResponder {
882    fn drop(&mut self) {
883        self.control_handle.shutdown();
884        // Safety: drops once, never accessed again
885        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
886    }
887}
888
889impl fidl::endpoints::Responder for Nl80211MessageResponder {
890    type ControlHandle = Nl80211ControlHandle;
891
892    fn control_handle(&self) -> &Nl80211ControlHandle {
893        &self.control_handle
894    }
895
896    fn drop_without_shutdown(mut self) {
897        // Safety: drops once, never accessed again due to mem::forget
898        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
899        // Prevent Drop from running (which would shut down the channel)
900        std::mem::forget(self);
901    }
902}
903
904impl Nl80211MessageResponder {
905    /// Sends a response to the FIDL transaction.
906    ///
907    /// Sets the channel to shutdown if an error occurs.
908    pub fn send(self, mut result: Result<Nl80211MessageResponse, i32>) -> Result<(), fidl::Error> {
909        let _result = self.send_raw(result);
910        if _result.is_err() {
911            self.control_handle.shutdown();
912        }
913        self.drop_without_shutdown();
914        _result
915    }
916
917    /// Similar to "send" but does not shutdown the channel if an error occurs.
918    pub fn send_no_shutdown_on_err(
919        self,
920        mut result: Result<Nl80211MessageResponse, i32>,
921    ) -> Result<(), fidl::Error> {
922        let _result = self.send_raw(result);
923        self.drop_without_shutdown();
924        _result
925    }
926
927    fn send_raw(&self, mut result: Result<Nl80211MessageResponse, i32>) -> Result<(), fidl::Error> {
928        self.control_handle
929            .inner
930            .send::<fidl::encoding::FlexibleResultType<Nl80211MessageResponse, i32>>(
931                fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
932                self.tx_id,
933                0x6336259e15bb3795,
934                fidl::encoding::DynamicFlags::FLEXIBLE,
935            )
936    }
937}
938
939#[must_use = "FIDL methods require a response to be sent"]
940#[derive(Debug)]
941pub struct Nl80211MessageV2Responder {
942    control_handle: std::mem::ManuallyDrop<Nl80211ControlHandle>,
943    tx_id: u32,
944}
945
946/// Set the the channel to be shutdown (see [`Nl80211ControlHandle::shutdown`])
947/// if the responder is dropped without sending a response, so that the client
948/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
949impl std::ops::Drop for Nl80211MessageV2Responder {
950    fn drop(&mut self) {
951        self.control_handle.shutdown();
952        // Safety: drops once, never accessed again
953        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
954    }
955}
956
957impl fidl::endpoints::Responder for Nl80211MessageV2Responder {
958    type ControlHandle = Nl80211ControlHandle;
959
960    fn control_handle(&self) -> &Nl80211ControlHandle {
961        &self.control_handle
962    }
963
964    fn drop_without_shutdown(mut self) {
965        // Safety: drops once, never accessed again due to mem::forget
966        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
967        // Prevent Drop from running (which would shut down the channel)
968        std::mem::forget(self);
969    }
970}
971
972impl Nl80211MessageV2Responder {
973    /// Sends a response to the FIDL transaction.
974    ///
975    /// Sets the channel to shutdown if an error occurs.
976    pub fn send(self, mut result: Result<fidl::Vmo, i32>) -> Result<(), fidl::Error> {
977        let _result = self.send_raw(result);
978        if _result.is_err() {
979            self.control_handle.shutdown();
980        }
981        self.drop_without_shutdown();
982        _result
983    }
984
985    /// Similar to "send" but does not shutdown the channel if an error occurs.
986    pub fn send_no_shutdown_on_err(
987        self,
988        mut result: Result<fidl::Vmo, i32>,
989    ) -> Result<(), fidl::Error> {
990        let _result = self.send_raw(result);
991        self.drop_without_shutdown();
992        _result
993    }
994
995    fn send_raw(&self, mut result: Result<fidl::Vmo, i32>) -> Result<(), fidl::Error> {
996        self.control_handle
997            .inner
998            .send::<fidl::encoding::FlexibleResultType<Nl80211MessageV2Response, i32>>(
999                fidl::encoding::FlexibleResult::new(result.map(|response| (response,))),
1000                self.tx_id,
1001                0x4626796aba1e2987,
1002                fidl::encoding::DynamicFlags::FLEXIBLE,
1003            )
1004    }
1005}
1006
1007#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1008pub struct Nl80211MulticastMarker;
1009
1010impl fidl::endpoints::ProtocolMarker for Nl80211MulticastMarker {
1011    type Proxy = Nl80211MulticastProxy;
1012    type RequestStream = Nl80211MulticastRequestStream;
1013    #[cfg(target_os = "fuchsia")]
1014    type SynchronousProxy = Nl80211MulticastSynchronousProxy;
1015
1016    const DEBUG_NAME: &'static str = "(anonymous) Nl80211Multicast";
1017}
1018
1019pub trait Nl80211MulticastProxyInterface: Send + Sync {
1020    fn r#message(&self, payload: Nl80211MulticastMessageRequest) -> Result<(), fidl::Error>;
1021}
1022#[derive(Debug)]
1023#[cfg(target_os = "fuchsia")]
1024pub struct Nl80211MulticastSynchronousProxy {
1025    client: fidl::client::sync::Client,
1026}
1027
1028#[cfg(target_os = "fuchsia")]
1029impl fidl::endpoints::SynchronousProxy for Nl80211MulticastSynchronousProxy {
1030    type Proxy = Nl80211MulticastProxy;
1031    type Protocol = Nl80211MulticastMarker;
1032
1033    fn from_channel(inner: fidl::Channel) -> Self {
1034        Self::new(inner)
1035    }
1036
1037    fn into_channel(self) -> fidl::Channel {
1038        self.client.into_channel()
1039    }
1040
1041    fn as_channel(&self) -> &fidl::Channel {
1042        self.client.as_channel()
1043    }
1044}
1045
1046#[cfg(target_os = "fuchsia")]
1047impl Nl80211MulticastSynchronousProxy {
1048    pub fn new(channel: fidl::Channel) -> Self {
1049        let protocol_name = <Nl80211MulticastMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1050        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1051    }
1052
1053    pub fn into_channel(self) -> fidl::Channel {
1054        self.client.into_channel()
1055    }
1056
1057    /// Waits until an event arrives and returns it. It is safe for other
1058    /// threads to make concurrent requests while waiting for an event.
1059    pub fn wait_for_event(
1060        &self,
1061        deadline: zx::MonotonicInstant,
1062    ) -> Result<Nl80211MulticastEvent, fidl::Error> {
1063        Nl80211MulticastEvent::decode(self.client.wait_for_event(deadline)?)
1064    }
1065
1066    pub fn r#message(
1067        &self,
1068        mut payload: Nl80211MulticastMessageRequest,
1069    ) -> Result<(), fidl::Error> {
1070        self.client.send::<Nl80211MulticastMessageRequest>(
1071            &mut payload,
1072            0x4cc9241f302f16c0,
1073            fidl::encoding::DynamicFlags::FLEXIBLE,
1074        )
1075    }
1076}
1077
1078#[cfg(target_os = "fuchsia")]
1079impl From<Nl80211MulticastSynchronousProxy> for zx::Handle {
1080    fn from(value: Nl80211MulticastSynchronousProxy) -> Self {
1081        value.into_channel().into()
1082    }
1083}
1084
1085#[cfg(target_os = "fuchsia")]
1086impl From<fidl::Channel> for Nl80211MulticastSynchronousProxy {
1087    fn from(value: fidl::Channel) -> Self {
1088        Self::new(value)
1089    }
1090}
1091
1092#[cfg(target_os = "fuchsia")]
1093impl fidl::endpoints::FromClient for Nl80211MulticastSynchronousProxy {
1094    type Protocol = Nl80211MulticastMarker;
1095
1096    fn from_client(value: fidl::endpoints::ClientEnd<Nl80211MulticastMarker>) -> Self {
1097        Self::new(value.into_channel())
1098    }
1099}
1100
1101#[derive(Debug, Clone)]
1102pub struct Nl80211MulticastProxy {
1103    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1104}
1105
1106impl fidl::endpoints::Proxy for Nl80211MulticastProxy {
1107    type Protocol = Nl80211MulticastMarker;
1108
1109    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1110        Self::new(inner)
1111    }
1112
1113    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1114        self.client.into_channel().map_err(|client| Self { client })
1115    }
1116
1117    fn as_channel(&self) -> &::fidl::AsyncChannel {
1118        self.client.as_channel()
1119    }
1120}
1121
1122impl Nl80211MulticastProxy {
1123    /// Create a new Proxy for fuchsia.wlan.wlanix/Nl80211Multicast.
1124    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1125        let protocol_name = <Nl80211MulticastMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1126        Self { client: fidl::client::Client::new(channel, protocol_name) }
1127    }
1128
1129    /// Get a Stream of events from the remote end of the protocol.
1130    ///
1131    /// # Panics
1132    ///
1133    /// Panics if the event stream was already taken.
1134    pub fn take_event_stream(&self) -> Nl80211MulticastEventStream {
1135        Nl80211MulticastEventStream { event_receiver: self.client.take_event_receiver() }
1136    }
1137
1138    pub fn r#message(
1139        &self,
1140        mut payload: Nl80211MulticastMessageRequest,
1141    ) -> Result<(), fidl::Error> {
1142        Nl80211MulticastProxyInterface::r#message(self, payload)
1143    }
1144}
1145
1146impl Nl80211MulticastProxyInterface for Nl80211MulticastProxy {
1147    fn r#message(&self, mut payload: Nl80211MulticastMessageRequest) -> Result<(), fidl::Error> {
1148        self.client.send::<Nl80211MulticastMessageRequest>(
1149            &mut payload,
1150            0x4cc9241f302f16c0,
1151            fidl::encoding::DynamicFlags::FLEXIBLE,
1152        )
1153    }
1154}
1155
1156pub struct Nl80211MulticastEventStream {
1157    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1158}
1159
1160impl std::marker::Unpin for Nl80211MulticastEventStream {}
1161
1162impl futures::stream::FusedStream for Nl80211MulticastEventStream {
1163    fn is_terminated(&self) -> bool {
1164        self.event_receiver.is_terminated()
1165    }
1166}
1167
1168impl futures::Stream for Nl80211MulticastEventStream {
1169    type Item = Result<Nl80211MulticastEvent, fidl::Error>;
1170
1171    fn poll_next(
1172        mut self: std::pin::Pin<&mut Self>,
1173        cx: &mut std::task::Context<'_>,
1174    ) -> std::task::Poll<Option<Self::Item>> {
1175        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1176            &mut self.event_receiver,
1177            cx
1178        )?) {
1179            Some(buf) => std::task::Poll::Ready(Some(Nl80211MulticastEvent::decode(buf))),
1180            None => std::task::Poll::Ready(None),
1181        }
1182    }
1183}
1184
1185#[derive(Debug)]
1186pub enum Nl80211MulticastEvent {
1187    #[non_exhaustive]
1188    _UnknownEvent {
1189        /// Ordinal of the event that was sent.
1190        ordinal: u64,
1191    },
1192}
1193
1194impl Nl80211MulticastEvent {
1195    /// Decodes a message buffer as a [`Nl80211MulticastEvent`].
1196    fn decode(
1197        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1198    ) -> Result<Nl80211MulticastEvent, fidl::Error> {
1199        let (bytes, _handles) = buf.split_mut();
1200        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1201        debug_assert_eq!(tx_header.tx_id, 0);
1202        match tx_header.ordinal {
1203            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1204                Ok(Nl80211MulticastEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1205            }
1206            _ => Err(fidl::Error::UnknownOrdinal {
1207                ordinal: tx_header.ordinal,
1208                protocol_name:
1209                    <Nl80211MulticastMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1210            }),
1211        }
1212    }
1213}
1214
1215/// A Stream of incoming requests for fuchsia.wlan.wlanix/Nl80211Multicast.
1216pub struct Nl80211MulticastRequestStream {
1217    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1218    is_terminated: bool,
1219}
1220
1221impl std::marker::Unpin for Nl80211MulticastRequestStream {}
1222
1223impl futures::stream::FusedStream for Nl80211MulticastRequestStream {
1224    fn is_terminated(&self) -> bool {
1225        self.is_terminated
1226    }
1227}
1228
1229impl fidl::endpoints::RequestStream for Nl80211MulticastRequestStream {
1230    type Protocol = Nl80211MulticastMarker;
1231    type ControlHandle = Nl80211MulticastControlHandle;
1232
1233    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1234        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1235    }
1236
1237    fn control_handle(&self) -> Self::ControlHandle {
1238        Nl80211MulticastControlHandle { inner: self.inner.clone() }
1239    }
1240
1241    fn into_inner(
1242        self,
1243    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1244    {
1245        (self.inner, self.is_terminated)
1246    }
1247
1248    fn from_inner(
1249        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1250        is_terminated: bool,
1251    ) -> Self {
1252        Self { inner, is_terminated }
1253    }
1254}
1255
1256impl futures::Stream for Nl80211MulticastRequestStream {
1257    type Item = Result<Nl80211MulticastRequest, fidl::Error>;
1258
1259    fn poll_next(
1260        mut self: std::pin::Pin<&mut Self>,
1261        cx: &mut std::task::Context<'_>,
1262    ) -> std::task::Poll<Option<Self::Item>> {
1263        let this = &mut *self;
1264        if this.inner.check_shutdown(cx) {
1265            this.is_terminated = true;
1266            return std::task::Poll::Ready(None);
1267        }
1268        if this.is_terminated {
1269            panic!("polled Nl80211MulticastRequestStream after completion");
1270        }
1271        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1272            |bytes, handles| {
1273                match this.inner.channel().read_etc(cx, bytes, handles) {
1274                    std::task::Poll::Ready(Ok(())) => {}
1275                    std::task::Poll::Pending => return std::task::Poll::Pending,
1276                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1277                        this.is_terminated = true;
1278                        return std::task::Poll::Ready(None);
1279                    }
1280                    std::task::Poll::Ready(Err(e)) => {
1281                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1282                            e.into(),
1283                        ))));
1284                    }
1285                }
1286
1287                // A message has been received from the channel
1288                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1289
1290                std::task::Poll::Ready(Some(match header.ordinal {
1291                    0x4cc9241f302f16c0 => {
1292                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1293                        let mut req = fidl::new_empty!(
1294                            Nl80211MulticastMessageRequest,
1295                            fidl::encoding::DefaultFuchsiaResourceDialect
1296                        );
1297                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Nl80211MulticastMessageRequest>(&header, _body_bytes, handles, &mut req)?;
1298                        let control_handle =
1299                            Nl80211MulticastControlHandle { inner: this.inner.clone() };
1300                        Ok(Nl80211MulticastRequest::Message { payload: req, control_handle })
1301                    }
1302                    _ if header.tx_id == 0
1303                        && header
1304                            .dynamic_flags()
1305                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1306                    {
1307                        Ok(Nl80211MulticastRequest::_UnknownMethod {
1308                            ordinal: header.ordinal,
1309                            control_handle: Nl80211MulticastControlHandle {
1310                                inner: this.inner.clone(),
1311                            },
1312                            method_type: fidl::MethodType::OneWay,
1313                        })
1314                    }
1315                    _ if header
1316                        .dynamic_flags()
1317                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1318                    {
1319                        this.inner.send_framework_err(
1320                            fidl::encoding::FrameworkErr::UnknownMethod,
1321                            header.tx_id,
1322                            header.ordinal,
1323                            header.dynamic_flags(),
1324                            (bytes, handles),
1325                        )?;
1326                        Ok(Nl80211MulticastRequest::_UnknownMethod {
1327                            ordinal: header.ordinal,
1328                            control_handle: Nl80211MulticastControlHandle {
1329                                inner: this.inner.clone(),
1330                            },
1331                            method_type: fidl::MethodType::TwoWay,
1332                        })
1333                    }
1334                    _ => Err(fidl::Error::UnknownOrdinal {
1335                        ordinal: header.ordinal,
1336                        protocol_name:
1337                            <Nl80211MulticastMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1338                    }),
1339                }))
1340            },
1341        )
1342    }
1343}
1344
1345#[derive(Debug)]
1346pub enum Nl80211MulticastRequest {
1347    Message {
1348        payload: Nl80211MulticastMessageRequest,
1349        control_handle: Nl80211MulticastControlHandle,
1350    },
1351    /// An interaction was received which does not match any known method.
1352    #[non_exhaustive]
1353    _UnknownMethod {
1354        /// Ordinal of the method that was called.
1355        ordinal: u64,
1356        control_handle: Nl80211MulticastControlHandle,
1357        method_type: fidl::MethodType,
1358    },
1359}
1360
1361impl Nl80211MulticastRequest {
1362    #[allow(irrefutable_let_patterns)]
1363    pub fn into_message(
1364        self,
1365    ) -> Option<(Nl80211MulticastMessageRequest, Nl80211MulticastControlHandle)> {
1366        if let Nl80211MulticastRequest::Message { payload, control_handle } = self {
1367            Some((payload, control_handle))
1368        } else {
1369            None
1370        }
1371    }
1372
1373    /// Name of the method defined in FIDL
1374    pub fn method_name(&self) -> &'static str {
1375        match *self {
1376            Nl80211MulticastRequest::Message { .. } => "message",
1377            Nl80211MulticastRequest::_UnknownMethod {
1378                method_type: fidl::MethodType::OneWay,
1379                ..
1380            } => "unknown one-way method",
1381            Nl80211MulticastRequest::_UnknownMethod {
1382                method_type: fidl::MethodType::TwoWay,
1383                ..
1384            } => "unknown two-way method",
1385        }
1386    }
1387}
1388
1389#[derive(Debug, Clone)]
1390pub struct Nl80211MulticastControlHandle {
1391    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1392}
1393
1394impl fidl::endpoints::ControlHandle for Nl80211MulticastControlHandle {
1395    fn shutdown(&self) {
1396        self.inner.shutdown()
1397    }
1398    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1399        self.inner.shutdown_with_epitaph(status)
1400    }
1401
1402    fn is_closed(&self) -> bool {
1403        self.inner.channel().is_closed()
1404    }
1405    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1406        self.inner.channel().on_closed()
1407    }
1408
1409    #[cfg(target_os = "fuchsia")]
1410    fn signal_peer(
1411        &self,
1412        clear_mask: zx::Signals,
1413        set_mask: zx::Signals,
1414    ) -> Result<(), zx_status::Status> {
1415        use fidl::Peered;
1416        self.inner.channel().signal_peer(clear_mask, set_mask)
1417    }
1418}
1419
1420impl Nl80211MulticastControlHandle {}
1421
1422#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1423pub struct SupplicantMarker;
1424
1425impl fidl::endpoints::ProtocolMarker for SupplicantMarker {
1426    type Proxy = SupplicantProxy;
1427    type RequestStream = SupplicantRequestStream;
1428    #[cfg(target_os = "fuchsia")]
1429    type SynchronousProxy = SupplicantSynchronousProxy;
1430
1431    const DEBUG_NAME: &'static str = "(anonymous) Supplicant";
1432}
1433
1434pub trait SupplicantProxyInterface: Send + Sync {
1435    fn r#add_sta_interface(
1436        &self,
1437        payload: SupplicantAddStaInterfaceRequest,
1438    ) -> Result<(), fidl::Error>;
1439    fn r#remove_interface(
1440        &self,
1441        payload: SupplicantRemoveInterfaceRequest,
1442    ) -> Result<(), fidl::Error>;
1443}
1444#[derive(Debug)]
1445#[cfg(target_os = "fuchsia")]
1446pub struct SupplicantSynchronousProxy {
1447    client: fidl::client::sync::Client,
1448}
1449
1450#[cfg(target_os = "fuchsia")]
1451impl fidl::endpoints::SynchronousProxy for SupplicantSynchronousProxy {
1452    type Proxy = SupplicantProxy;
1453    type Protocol = SupplicantMarker;
1454
1455    fn from_channel(inner: fidl::Channel) -> Self {
1456        Self::new(inner)
1457    }
1458
1459    fn into_channel(self) -> fidl::Channel {
1460        self.client.into_channel()
1461    }
1462
1463    fn as_channel(&self) -> &fidl::Channel {
1464        self.client.as_channel()
1465    }
1466}
1467
1468#[cfg(target_os = "fuchsia")]
1469impl SupplicantSynchronousProxy {
1470    pub fn new(channel: fidl::Channel) -> Self {
1471        let protocol_name = <SupplicantMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1472        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1473    }
1474
1475    pub fn into_channel(self) -> fidl::Channel {
1476        self.client.into_channel()
1477    }
1478
1479    /// Waits until an event arrives and returns it. It is safe for other
1480    /// threads to make concurrent requests while waiting for an event.
1481    pub fn wait_for_event(
1482        &self,
1483        deadline: zx::MonotonicInstant,
1484    ) -> Result<SupplicantEvent, fidl::Error> {
1485        SupplicantEvent::decode(self.client.wait_for_event(deadline)?)
1486    }
1487
1488    pub fn r#add_sta_interface(
1489        &self,
1490        mut payload: SupplicantAddStaInterfaceRequest,
1491    ) -> Result<(), fidl::Error> {
1492        self.client.send::<SupplicantAddStaInterfaceRequest>(
1493            &mut payload,
1494            0x73194b2afe9b367e,
1495            fidl::encoding::DynamicFlags::FLEXIBLE,
1496        )
1497    }
1498
1499    pub fn r#remove_interface(
1500        &self,
1501        mut payload: SupplicantRemoveInterfaceRequest,
1502    ) -> Result<(), fidl::Error> {
1503        self.client.send::<SupplicantRemoveInterfaceRequest>(
1504            &mut payload,
1505            0x7f83e5b75b27d242,
1506            fidl::encoding::DynamicFlags::FLEXIBLE,
1507        )
1508    }
1509}
1510
1511#[cfg(target_os = "fuchsia")]
1512impl From<SupplicantSynchronousProxy> for zx::Handle {
1513    fn from(value: SupplicantSynchronousProxy) -> Self {
1514        value.into_channel().into()
1515    }
1516}
1517
1518#[cfg(target_os = "fuchsia")]
1519impl From<fidl::Channel> for SupplicantSynchronousProxy {
1520    fn from(value: fidl::Channel) -> Self {
1521        Self::new(value)
1522    }
1523}
1524
1525#[cfg(target_os = "fuchsia")]
1526impl fidl::endpoints::FromClient for SupplicantSynchronousProxy {
1527    type Protocol = SupplicantMarker;
1528
1529    fn from_client(value: fidl::endpoints::ClientEnd<SupplicantMarker>) -> Self {
1530        Self::new(value.into_channel())
1531    }
1532}
1533
1534#[derive(Debug, Clone)]
1535pub struct SupplicantProxy {
1536    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1537}
1538
1539impl fidl::endpoints::Proxy for SupplicantProxy {
1540    type Protocol = SupplicantMarker;
1541
1542    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1543        Self::new(inner)
1544    }
1545
1546    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1547        self.client.into_channel().map_err(|client| Self { client })
1548    }
1549
1550    fn as_channel(&self) -> &::fidl::AsyncChannel {
1551        self.client.as_channel()
1552    }
1553}
1554
1555impl SupplicantProxy {
1556    /// Create a new Proxy for fuchsia.wlan.wlanix/Supplicant.
1557    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1558        let protocol_name = <SupplicantMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1559        Self { client: fidl::client::Client::new(channel, protocol_name) }
1560    }
1561
1562    /// Get a Stream of events from the remote end of the protocol.
1563    ///
1564    /// # Panics
1565    ///
1566    /// Panics if the event stream was already taken.
1567    pub fn take_event_stream(&self) -> SupplicantEventStream {
1568        SupplicantEventStream { event_receiver: self.client.take_event_receiver() }
1569    }
1570
1571    pub fn r#add_sta_interface(
1572        &self,
1573        mut payload: SupplicantAddStaInterfaceRequest,
1574    ) -> Result<(), fidl::Error> {
1575        SupplicantProxyInterface::r#add_sta_interface(self, payload)
1576    }
1577
1578    pub fn r#remove_interface(
1579        &self,
1580        mut payload: SupplicantRemoveInterfaceRequest,
1581    ) -> Result<(), fidl::Error> {
1582        SupplicantProxyInterface::r#remove_interface(self, payload)
1583    }
1584}
1585
1586impl SupplicantProxyInterface for SupplicantProxy {
1587    fn r#add_sta_interface(
1588        &self,
1589        mut payload: SupplicantAddStaInterfaceRequest,
1590    ) -> Result<(), fidl::Error> {
1591        self.client.send::<SupplicantAddStaInterfaceRequest>(
1592            &mut payload,
1593            0x73194b2afe9b367e,
1594            fidl::encoding::DynamicFlags::FLEXIBLE,
1595        )
1596    }
1597
1598    fn r#remove_interface(
1599        &self,
1600        mut payload: SupplicantRemoveInterfaceRequest,
1601    ) -> Result<(), fidl::Error> {
1602        self.client.send::<SupplicantRemoveInterfaceRequest>(
1603            &mut payload,
1604            0x7f83e5b75b27d242,
1605            fidl::encoding::DynamicFlags::FLEXIBLE,
1606        )
1607    }
1608}
1609
1610pub struct SupplicantEventStream {
1611    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1612}
1613
1614impl std::marker::Unpin for SupplicantEventStream {}
1615
1616impl futures::stream::FusedStream for SupplicantEventStream {
1617    fn is_terminated(&self) -> bool {
1618        self.event_receiver.is_terminated()
1619    }
1620}
1621
1622impl futures::Stream for SupplicantEventStream {
1623    type Item = Result<SupplicantEvent, fidl::Error>;
1624
1625    fn poll_next(
1626        mut self: std::pin::Pin<&mut Self>,
1627        cx: &mut std::task::Context<'_>,
1628    ) -> std::task::Poll<Option<Self::Item>> {
1629        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1630            &mut self.event_receiver,
1631            cx
1632        )?) {
1633            Some(buf) => std::task::Poll::Ready(Some(SupplicantEvent::decode(buf))),
1634            None => std::task::Poll::Ready(None),
1635        }
1636    }
1637}
1638
1639#[derive(Debug)]
1640pub enum SupplicantEvent {
1641    #[non_exhaustive]
1642    _UnknownEvent {
1643        /// Ordinal of the event that was sent.
1644        ordinal: u64,
1645    },
1646}
1647
1648impl SupplicantEvent {
1649    /// Decodes a message buffer as a [`SupplicantEvent`].
1650    fn decode(
1651        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1652    ) -> Result<SupplicantEvent, fidl::Error> {
1653        let (bytes, _handles) = buf.split_mut();
1654        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1655        debug_assert_eq!(tx_header.tx_id, 0);
1656        match tx_header.ordinal {
1657            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1658                Ok(SupplicantEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1659            }
1660            _ => Err(fidl::Error::UnknownOrdinal {
1661                ordinal: tx_header.ordinal,
1662                protocol_name: <SupplicantMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1663            }),
1664        }
1665    }
1666}
1667
1668/// A Stream of incoming requests for fuchsia.wlan.wlanix/Supplicant.
1669pub struct SupplicantRequestStream {
1670    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1671    is_terminated: bool,
1672}
1673
1674impl std::marker::Unpin for SupplicantRequestStream {}
1675
1676impl futures::stream::FusedStream for SupplicantRequestStream {
1677    fn is_terminated(&self) -> bool {
1678        self.is_terminated
1679    }
1680}
1681
1682impl fidl::endpoints::RequestStream for SupplicantRequestStream {
1683    type Protocol = SupplicantMarker;
1684    type ControlHandle = SupplicantControlHandle;
1685
1686    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1687        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1688    }
1689
1690    fn control_handle(&self) -> Self::ControlHandle {
1691        SupplicantControlHandle { inner: self.inner.clone() }
1692    }
1693
1694    fn into_inner(
1695        self,
1696    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1697    {
1698        (self.inner, self.is_terminated)
1699    }
1700
1701    fn from_inner(
1702        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1703        is_terminated: bool,
1704    ) -> Self {
1705        Self { inner, is_terminated }
1706    }
1707}
1708
1709impl futures::Stream for SupplicantRequestStream {
1710    type Item = Result<SupplicantRequest, fidl::Error>;
1711
1712    fn poll_next(
1713        mut self: std::pin::Pin<&mut Self>,
1714        cx: &mut std::task::Context<'_>,
1715    ) -> std::task::Poll<Option<Self::Item>> {
1716        let this = &mut *self;
1717        if this.inner.check_shutdown(cx) {
1718            this.is_terminated = true;
1719            return std::task::Poll::Ready(None);
1720        }
1721        if this.is_terminated {
1722            panic!("polled SupplicantRequestStream after completion");
1723        }
1724        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1725            |bytes, handles| {
1726                match this.inner.channel().read_etc(cx, bytes, handles) {
1727                    std::task::Poll::Ready(Ok(())) => {}
1728                    std::task::Poll::Pending => return std::task::Poll::Pending,
1729                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1730                        this.is_terminated = true;
1731                        return std::task::Poll::Ready(None);
1732                    }
1733                    std::task::Poll::Ready(Err(e)) => {
1734                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1735                            e.into(),
1736                        ))));
1737                    }
1738                }
1739
1740                // A message has been received from the channel
1741                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1742
1743                std::task::Poll::Ready(Some(match header.ordinal {
1744                    0x73194b2afe9b367e => {
1745                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1746                        let mut req = fidl::new_empty!(
1747                            SupplicantAddStaInterfaceRequest,
1748                            fidl::encoding::DefaultFuchsiaResourceDialect
1749                        );
1750                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantAddStaInterfaceRequest>(&header, _body_bytes, handles, &mut req)?;
1751                        let control_handle = SupplicantControlHandle { inner: this.inner.clone() };
1752                        Ok(SupplicantRequest::AddStaInterface { payload: req, control_handle })
1753                    }
1754                    0x7f83e5b75b27d242 => {
1755                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1756                        let mut req = fidl::new_empty!(
1757                            SupplicantRemoveInterfaceRequest,
1758                            fidl::encoding::DefaultFuchsiaResourceDialect
1759                        );
1760                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantRemoveInterfaceRequest>(&header, _body_bytes, handles, &mut req)?;
1761                        let control_handle = SupplicantControlHandle { inner: this.inner.clone() };
1762                        Ok(SupplicantRequest::RemoveInterface { payload: req, control_handle })
1763                    }
1764                    _ if header.tx_id == 0
1765                        && header
1766                            .dynamic_flags()
1767                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1768                    {
1769                        Ok(SupplicantRequest::_UnknownMethod {
1770                            ordinal: header.ordinal,
1771                            control_handle: SupplicantControlHandle { inner: this.inner.clone() },
1772                            method_type: fidl::MethodType::OneWay,
1773                        })
1774                    }
1775                    _ if header
1776                        .dynamic_flags()
1777                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1778                    {
1779                        this.inner.send_framework_err(
1780                            fidl::encoding::FrameworkErr::UnknownMethod,
1781                            header.tx_id,
1782                            header.ordinal,
1783                            header.dynamic_flags(),
1784                            (bytes, handles),
1785                        )?;
1786                        Ok(SupplicantRequest::_UnknownMethod {
1787                            ordinal: header.ordinal,
1788                            control_handle: SupplicantControlHandle { inner: this.inner.clone() },
1789                            method_type: fidl::MethodType::TwoWay,
1790                        })
1791                    }
1792                    _ => Err(fidl::Error::UnknownOrdinal {
1793                        ordinal: header.ordinal,
1794                        protocol_name:
1795                            <SupplicantMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1796                    }),
1797                }))
1798            },
1799        )
1800    }
1801}
1802
1803#[derive(Debug)]
1804pub enum SupplicantRequest {
1805    AddStaInterface {
1806        payload: SupplicantAddStaInterfaceRequest,
1807        control_handle: SupplicantControlHandle,
1808    },
1809    RemoveInterface {
1810        payload: SupplicantRemoveInterfaceRequest,
1811        control_handle: SupplicantControlHandle,
1812    },
1813    /// An interaction was received which does not match any known method.
1814    #[non_exhaustive]
1815    _UnknownMethod {
1816        /// Ordinal of the method that was called.
1817        ordinal: u64,
1818        control_handle: SupplicantControlHandle,
1819        method_type: fidl::MethodType,
1820    },
1821}
1822
1823impl SupplicantRequest {
1824    #[allow(irrefutable_let_patterns)]
1825    pub fn into_add_sta_interface(
1826        self,
1827    ) -> Option<(SupplicantAddStaInterfaceRequest, SupplicantControlHandle)> {
1828        if let SupplicantRequest::AddStaInterface { payload, control_handle } = self {
1829            Some((payload, control_handle))
1830        } else {
1831            None
1832        }
1833    }
1834
1835    #[allow(irrefutable_let_patterns)]
1836    pub fn into_remove_interface(
1837        self,
1838    ) -> Option<(SupplicantRemoveInterfaceRequest, SupplicantControlHandle)> {
1839        if let SupplicantRequest::RemoveInterface { payload, control_handle } = self {
1840            Some((payload, control_handle))
1841        } else {
1842            None
1843        }
1844    }
1845
1846    /// Name of the method defined in FIDL
1847    pub fn method_name(&self) -> &'static str {
1848        match *self {
1849            SupplicantRequest::AddStaInterface { .. } => "add_sta_interface",
1850            SupplicantRequest::RemoveInterface { .. } => "remove_interface",
1851            SupplicantRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1852                "unknown one-way method"
1853            }
1854            SupplicantRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1855                "unknown two-way method"
1856            }
1857        }
1858    }
1859}
1860
1861#[derive(Debug, Clone)]
1862pub struct SupplicantControlHandle {
1863    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1864}
1865
1866impl fidl::endpoints::ControlHandle for SupplicantControlHandle {
1867    fn shutdown(&self) {
1868        self.inner.shutdown()
1869    }
1870    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1871        self.inner.shutdown_with_epitaph(status)
1872    }
1873
1874    fn is_closed(&self) -> bool {
1875        self.inner.channel().is_closed()
1876    }
1877    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1878        self.inner.channel().on_closed()
1879    }
1880
1881    #[cfg(target_os = "fuchsia")]
1882    fn signal_peer(
1883        &self,
1884        clear_mask: zx::Signals,
1885        set_mask: zx::Signals,
1886    ) -> Result<(), zx_status::Status> {
1887        use fidl::Peered;
1888        self.inner.channel().signal_peer(clear_mask, set_mask)
1889    }
1890}
1891
1892impl SupplicantControlHandle {}
1893
1894#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1895pub struct SupplicantStaIfaceMarker;
1896
1897impl fidl::endpoints::ProtocolMarker for SupplicantStaIfaceMarker {
1898    type Proxy = SupplicantStaIfaceProxy;
1899    type RequestStream = SupplicantStaIfaceRequestStream;
1900    #[cfg(target_os = "fuchsia")]
1901    type SynchronousProxy = SupplicantStaIfaceSynchronousProxy;
1902
1903    const DEBUG_NAME: &'static str = "(anonymous) SupplicantStaIface";
1904}
1905pub type SupplicantStaIfaceGetMacAddressResult =
1906    Result<SupplicantStaIfaceGetMacAddressResponse, i32>;
1907pub type SupplicantStaIfaceSetBtCoexistenceModeResult = Result<(), WlanixError>;
1908pub type SupplicantStaIfaceSetStaCountryCodeResult = Result<(), i32>;
1909
1910pub trait SupplicantStaIfaceProxyInterface: Send + Sync {
1911    fn r#register_callback(
1912        &self,
1913        payload: SupplicantStaIfaceRegisterCallbackRequest,
1914    ) -> Result<(), fidl::Error>;
1915    fn r#add_network(
1916        &self,
1917        payload: SupplicantStaIfaceAddNetworkRequest,
1918    ) -> Result<(), fidl::Error>;
1919    type DisconnectResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1920    fn r#disconnect(&self) -> Self::DisconnectResponseFut;
1921    type GetMacAddressResponseFut: std::future::Future<Output = Result<SupplicantStaIfaceGetMacAddressResult, fidl::Error>>
1922        + Send;
1923    fn r#get_mac_address(&self) -> Self::GetMacAddressResponseFut;
1924    type SetBtCoexistenceModeResponseFut: std::future::Future<
1925            Output = Result<SupplicantStaIfaceSetBtCoexistenceModeResult, fidl::Error>,
1926        > + Send;
1927    fn r#set_bt_coexistence_mode(
1928        &self,
1929        payload: &SupplicantStaIfaceSetBtCoexistenceModeRequest,
1930    ) -> Self::SetBtCoexistenceModeResponseFut;
1931    type SetPowerSaveResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1932    fn r#set_power_save(
1933        &self,
1934        payload: SupplicantStaIfaceSetPowerSaveRequest,
1935    ) -> Self::SetPowerSaveResponseFut;
1936    type SetSuspendModeEnabledResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
1937        + Send;
1938    fn r#set_suspend_mode_enabled(
1939        &self,
1940        payload: SupplicantStaIfaceSetSuspendModeEnabledRequest,
1941    ) -> Self::SetSuspendModeEnabledResponseFut;
1942    type SetStaCountryCodeResponseFut: std::future::Future<Output = Result<SupplicantStaIfaceSetStaCountryCodeResult, fidl::Error>>
1943        + Send;
1944    fn r#set_sta_country_code(
1945        &self,
1946        payload: SupplicantStaIfaceSetStaCountryCodeRequest,
1947    ) -> Self::SetStaCountryCodeResponseFut;
1948}
1949#[derive(Debug)]
1950#[cfg(target_os = "fuchsia")]
1951pub struct SupplicantStaIfaceSynchronousProxy {
1952    client: fidl::client::sync::Client,
1953}
1954
1955#[cfg(target_os = "fuchsia")]
1956impl fidl::endpoints::SynchronousProxy for SupplicantStaIfaceSynchronousProxy {
1957    type Proxy = SupplicantStaIfaceProxy;
1958    type Protocol = SupplicantStaIfaceMarker;
1959
1960    fn from_channel(inner: fidl::Channel) -> Self {
1961        Self::new(inner)
1962    }
1963
1964    fn into_channel(self) -> fidl::Channel {
1965        self.client.into_channel()
1966    }
1967
1968    fn as_channel(&self) -> &fidl::Channel {
1969        self.client.as_channel()
1970    }
1971}
1972
1973#[cfg(target_os = "fuchsia")]
1974impl SupplicantStaIfaceSynchronousProxy {
1975    pub fn new(channel: fidl::Channel) -> Self {
1976        let protocol_name =
1977            <SupplicantStaIfaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1978        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1979    }
1980
1981    pub fn into_channel(self) -> fidl::Channel {
1982        self.client.into_channel()
1983    }
1984
1985    /// Waits until an event arrives and returns it. It is safe for other
1986    /// threads to make concurrent requests while waiting for an event.
1987    pub fn wait_for_event(
1988        &self,
1989        deadline: zx::MonotonicInstant,
1990    ) -> Result<SupplicantStaIfaceEvent, fidl::Error> {
1991        SupplicantStaIfaceEvent::decode(self.client.wait_for_event(deadline)?)
1992    }
1993
1994    pub fn r#register_callback(
1995        &self,
1996        mut payload: SupplicantStaIfaceRegisterCallbackRequest,
1997    ) -> Result<(), fidl::Error> {
1998        self.client.send::<SupplicantStaIfaceRegisterCallbackRequest>(
1999            &mut payload,
2000            0x1be680e863a8e71,
2001            fidl::encoding::DynamicFlags::FLEXIBLE,
2002        )
2003    }
2004
2005    pub fn r#add_network(
2006        &self,
2007        mut payload: SupplicantStaIfaceAddNetworkRequest,
2008    ) -> Result<(), fidl::Error> {
2009        self.client.send::<SupplicantStaIfaceAddNetworkRequest>(
2010            &mut payload,
2011            0xa77cf60628766dc,
2012            fidl::encoding::DynamicFlags::FLEXIBLE,
2013        )
2014    }
2015
2016    pub fn r#disconnect(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
2017        let _response = self.client.send_query::<
2018            fidl::encoding::EmptyPayload,
2019            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2020        >(
2021            (),
2022            0x52a1d38e0b4871fa,
2023            fidl::encoding::DynamicFlags::FLEXIBLE,
2024            ___deadline,
2025        )?
2026        .into_result::<SupplicantStaIfaceMarker>("disconnect")?;
2027        Ok(_response)
2028    }
2029
2030    pub fn r#get_mac_address(
2031        &self,
2032        ___deadline: zx::MonotonicInstant,
2033    ) -> Result<SupplicantStaIfaceGetMacAddressResult, fidl::Error> {
2034        let _response = self.client.send_query::<
2035            fidl::encoding::EmptyPayload,
2036            fidl::encoding::FlexibleResultType<SupplicantStaIfaceGetMacAddressResponse, i32>,
2037        >(
2038            (),
2039            0x60591d204a3f537f,
2040            fidl::encoding::DynamicFlags::FLEXIBLE,
2041            ___deadline,
2042        )?
2043        .into_result::<SupplicantStaIfaceMarker>("get_mac_address")?;
2044        Ok(_response.map(|x| x))
2045    }
2046
2047    pub fn r#set_bt_coexistence_mode(
2048        &self,
2049        mut payload: &SupplicantStaIfaceSetBtCoexistenceModeRequest,
2050        ___deadline: zx::MonotonicInstant,
2051    ) -> Result<SupplicantStaIfaceSetBtCoexistenceModeResult, fidl::Error> {
2052        let _response = self.client.send_query::<
2053            SupplicantStaIfaceSetBtCoexistenceModeRequest,
2054            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WlanixError>,
2055        >(
2056            payload,
2057            0x14567ff593a9b154,
2058            fidl::encoding::DynamicFlags::FLEXIBLE,
2059            ___deadline,
2060        )?
2061        .into_result::<SupplicantStaIfaceMarker>("set_bt_coexistence_mode")?;
2062        Ok(_response.map(|x| x))
2063    }
2064
2065    pub fn r#set_power_save(
2066        &self,
2067        mut payload: SupplicantStaIfaceSetPowerSaveRequest,
2068        ___deadline: zx::MonotonicInstant,
2069    ) -> Result<(), fidl::Error> {
2070        let _response = self.client.send_query::<
2071            SupplicantStaIfaceSetPowerSaveRequest,
2072            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2073        >(
2074            &mut payload,
2075            0x5a04c29320085298,
2076            fidl::encoding::DynamicFlags::FLEXIBLE,
2077            ___deadline,
2078        )?
2079        .into_result::<SupplicantStaIfaceMarker>("set_power_save")?;
2080        Ok(_response)
2081    }
2082
2083    pub fn r#set_suspend_mode_enabled(
2084        &self,
2085        mut payload: SupplicantStaIfaceSetSuspendModeEnabledRequest,
2086        ___deadline: zx::MonotonicInstant,
2087    ) -> Result<(), fidl::Error> {
2088        let _response = self.client.send_query::<
2089            SupplicantStaIfaceSetSuspendModeEnabledRequest,
2090            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2091        >(
2092            &mut payload,
2093            0xaf10de85bb7023a,
2094            fidl::encoding::DynamicFlags::FLEXIBLE,
2095            ___deadline,
2096        )?
2097        .into_result::<SupplicantStaIfaceMarker>("set_suspend_mode_enabled")?;
2098        Ok(_response)
2099    }
2100
2101    pub fn r#set_sta_country_code(
2102        &self,
2103        mut payload: SupplicantStaIfaceSetStaCountryCodeRequest,
2104        ___deadline: zx::MonotonicInstant,
2105    ) -> Result<SupplicantStaIfaceSetStaCountryCodeResult, fidl::Error> {
2106        let _response = self.client.send_query::<
2107            SupplicantStaIfaceSetStaCountryCodeRequest,
2108            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
2109        >(
2110            &mut payload,
2111            0x977e22f9b79b26e,
2112            fidl::encoding::DynamicFlags::FLEXIBLE,
2113            ___deadline,
2114        )?
2115        .into_result::<SupplicantStaIfaceMarker>("set_sta_country_code")?;
2116        Ok(_response.map(|x| x))
2117    }
2118}
2119
2120#[cfg(target_os = "fuchsia")]
2121impl From<SupplicantStaIfaceSynchronousProxy> for zx::Handle {
2122    fn from(value: SupplicantStaIfaceSynchronousProxy) -> Self {
2123        value.into_channel().into()
2124    }
2125}
2126
2127#[cfg(target_os = "fuchsia")]
2128impl From<fidl::Channel> for SupplicantStaIfaceSynchronousProxy {
2129    fn from(value: fidl::Channel) -> Self {
2130        Self::new(value)
2131    }
2132}
2133
2134#[cfg(target_os = "fuchsia")]
2135impl fidl::endpoints::FromClient for SupplicantStaIfaceSynchronousProxy {
2136    type Protocol = SupplicantStaIfaceMarker;
2137
2138    fn from_client(value: fidl::endpoints::ClientEnd<SupplicantStaIfaceMarker>) -> Self {
2139        Self::new(value.into_channel())
2140    }
2141}
2142
2143#[derive(Debug, Clone)]
2144pub struct SupplicantStaIfaceProxy {
2145    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2146}
2147
2148impl fidl::endpoints::Proxy for SupplicantStaIfaceProxy {
2149    type Protocol = SupplicantStaIfaceMarker;
2150
2151    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2152        Self::new(inner)
2153    }
2154
2155    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2156        self.client.into_channel().map_err(|client| Self { client })
2157    }
2158
2159    fn as_channel(&self) -> &::fidl::AsyncChannel {
2160        self.client.as_channel()
2161    }
2162}
2163
2164impl SupplicantStaIfaceProxy {
2165    /// Create a new Proxy for fuchsia.wlan.wlanix/SupplicantStaIface.
2166    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2167        let protocol_name =
2168            <SupplicantStaIfaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2169        Self { client: fidl::client::Client::new(channel, protocol_name) }
2170    }
2171
2172    /// Get a Stream of events from the remote end of the protocol.
2173    ///
2174    /// # Panics
2175    ///
2176    /// Panics if the event stream was already taken.
2177    pub fn take_event_stream(&self) -> SupplicantStaIfaceEventStream {
2178        SupplicantStaIfaceEventStream { event_receiver: self.client.take_event_receiver() }
2179    }
2180
2181    pub fn r#register_callback(
2182        &self,
2183        mut payload: SupplicantStaIfaceRegisterCallbackRequest,
2184    ) -> Result<(), fidl::Error> {
2185        SupplicantStaIfaceProxyInterface::r#register_callback(self, payload)
2186    }
2187
2188    pub fn r#add_network(
2189        &self,
2190        mut payload: SupplicantStaIfaceAddNetworkRequest,
2191    ) -> Result<(), fidl::Error> {
2192        SupplicantStaIfaceProxyInterface::r#add_network(self, payload)
2193    }
2194
2195    pub fn r#disconnect(
2196        &self,
2197    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2198        SupplicantStaIfaceProxyInterface::r#disconnect(self)
2199    }
2200
2201    pub fn r#get_mac_address(
2202        &self,
2203    ) -> fidl::client::QueryResponseFut<
2204        SupplicantStaIfaceGetMacAddressResult,
2205        fidl::encoding::DefaultFuchsiaResourceDialect,
2206    > {
2207        SupplicantStaIfaceProxyInterface::r#get_mac_address(self)
2208    }
2209
2210    pub fn r#set_bt_coexistence_mode(
2211        &self,
2212        mut payload: &SupplicantStaIfaceSetBtCoexistenceModeRequest,
2213    ) -> fidl::client::QueryResponseFut<
2214        SupplicantStaIfaceSetBtCoexistenceModeResult,
2215        fidl::encoding::DefaultFuchsiaResourceDialect,
2216    > {
2217        SupplicantStaIfaceProxyInterface::r#set_bt_coexistence_mode(self, payload)
2218    }
2219
2220    pub fn r#set_power_save(
2221        &self,
2222        mut payload: SupplicantStaIfaceSetPowerSaveRequest,
2223    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2224        SupplicantStaIfaceProxyInterface::r#set_power_save(self, payload)
2225    }
2226
2227    pub fn r#set_suspend_mode_enabled(
2228        &self,
2229        mut payload: SupplicantStaIfaceSetSuspendModeEnabledRequest,
2230    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2231        SupplicantStaIfaceProxyInterface::r#set_suspend_mode_enabled(self, payload)
2232    }
2233
2234    pub fn r#set_sta_country_code(
2235        &self,
2236        mut payload: SupplicantStaIfaceSetStaCountryCodeRequest,
2237    ) -> fidl::client::QueryResponseFut<
2238        SupplicantStaIfaceSetStaCountryCodeResult,
2239        fidl::encoding::DefaultFuchsiaResourceDialect,
2240    > {
2241        SupplicantStaIfaceProxyInterface::r#set_sta_country_code(self, payload)
2242    }
2243}
2244
2245impl SupplicantStaIfaceProxyInterface for SupplicantStaIfaceProxy {
2246    fn r#register_callback(
2247        &self,
2248        mut payload: SupplicantStaIfaceRegisterCallbackRequest,
2249    ) -> Result<(), fidl::Error> {
2250        self.client.send::<SupplicantStaIfaceRegisterCallbackRequest>(
2251            &mut payload,
2252            0x1be680e863a8e71,
2253            fidl::encoding::DynamicFlags::FLEXIBLE,
2254        )
2255    }
2256
2257    fn r#add_network(
2258        &self,
2259        mut payload: SupplicantStaIfaceAddNetworkRequest,
2260    ) -> Result<(), fidl::Error> {
2261        self.client.send::<SupplicantStaIfaceAddNetworkRequest>(
2262            &mut payload,
2263            0xa77cf60628766dc,
2264            fidl::encoding::DynamicFlags::FLEXIBLE,
2265        )
2266    }
2267
2268    type DisconnectResponseFut =
2269        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2270    fn r#disconnect(&self) -> Self::DisconnectResponseFut {
2271        fn _decode(
2272            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2273        ) -> Result<(), fidl::Error> {
2274            let _response = fidl::client::decode_transaction_body::<
2275                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2276                fidl::encoding::DefaultFuchsiaResourceDialect,
2277                0x52a1d38e0b4871fa,
2278            >(_buf?)?
2279            .into_result::<SupplicantStaIfaceMarker>("disconnect")?;
2280            Ok(_response)
2281        }
2282        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
2283            (),
2284            0x52a1d38e0b4871fa,
2285            fidl::encoding::DynamicFlags::FLEXIBLE,
2286            _decode,
2287        )
2288    }
2289
2290    type GetMacAddressResponseFut = fidl::client::QueryResponseFut<
2291        SupplicantStaIfaceGetMacAddressResult,
2292        fidl::encoding::DefaultFuchsiaResourceDialect,
2293    >;
2294    fn r#get_mac_address(&self) -> Self::GetMacAddressResponseFut {
2295        fn _decode(
2296            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2297        ) -> Result<SupplicantStaIfaceGetMacAddressResult, fidl::Error> {
2298            let _response = fidl::client::decode_transaction_body::<
2299                fidl::encoding::FlexibleResultType<SupplicantStaIfaceGetMacAddressResponse, i32>,
2300                fidl::encoding::DefaultFuchsiaResourceDialect,
2301                0x60591d204a3f537f,
2302            >(_buf?)?
2303            .into_result::<SupplicantStaIfaceMarker>("get_mac_address")?;
2304            Ok(_response.map(|x| x))
2305        }
2306        self.client.send_query_and_decode::<
2307            fidl::encoding::EmptyPayload,
2308            SupplicantStaIfaceGetMacAddressResult,
2309        >(
2310            (),
2311            0x60591d204a3f537f,
2312            fidl::encoding::DynamicFlags::FLEXIBLE,
2313            _decode,
2314        )
2315    }
2316
2317    type SetBtCoexistenceModeResponseFut = fidl::client::QueryResponseFut<
2318        SupplicantStaIfaceSetBtCoexistenceModeResult,
2319        fidl::encoding::DefaultFuchsiaResourceDialect,
2320    >;
2321    fn r#set_bt_coexistence_mode(
2322        &self,
2323        mut payload: &SupplicantStaIfaceSetBtCoexistenceModeRequest,
2324    ) -> Self::SetBtCoexistenceModeResponseFut {
2325        fn _decode(
2326            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2327        ) -> Result<SupplicantStaIfaceSetBtCoexistenceModeResult, fidl::Error> {
2328            let _response = fidl::client::decode_transaction_body::<
2329                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WlanixError>,
2330                fidl::encoding::DefaultFuchsiaResourceDialect,
2331                0x14567ff593a9b154,
2332            >(_buf?)?
2333            .into_result::<SupplicantStaIfaceMarker>("set_bt_coexistence_mode")?;
2334            Ok(_response.map(|x| x))
2335        }
2336        self.client.send_query_and_decode::<
2337            SupplicantStaIfaceSetBtCoexistenceModeRequest,
2338            SupplicantStaIfaceSetBtCoexistenceModeResult,
2339        >(
2340            payload,
2341            0x14567ff593a9b154,
2342            fidl::encoding::DynamicFlags::FLEXIBLE,
2343            _decode,
2344        )
2345    }
2346
2347    type SetPowerSaveResponseFut =
2348        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2349    fn r#set_power_save(
2350        &self,
2351        mut payload: SupplicantStaIfaceSetPowerSaveRequest,
2352    ) -> Self::SetPowerSaveResponseFut {
2353        fn _decode(
2354            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2355        ) -> Result<(), fidl::Error> {
2356            let _response = fidl::client::decode_transaction_body::<
2357                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2358                fidl::encoding::DefaultFuchsiaResourceDialect,
2359                0x5a04c29320085298,
2360            >(_buf?)?
2361            .into_result::<SupplicantStaIfaceMarker>("set_power_save")?;
2362            Ok(_response)
2363        }
2364        self.client.send_query_and_decode::<SupplicantStaIfaceSetPowerSaveRequest, ()>(
2365            &mut payload,
2366            0x5a04c29320085298,
2367            fidl::encoding::DynamicFlags::FLEXIBLE,
2368            _decode,
2369        )
2370    }
2371
2372    type SetSuspendModeEnabledResponseFut =
2373        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2374    fn r#set_suspend_mode_enabled(
2375        &self,
2376        mut payload: SupplicantStaIfaceSetSuspendModeEnabledRequest,
2377    ) -> Self::SetSuspendModeEnabledResponseFut {
2378        fn _decode(
2379            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2380        ) -> Result<(), fidl::Error> {
2381            let _response = fidl::client::decode_transaction_body::<
2382                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2383                fidl::encoding::DefaultFuchsiaResourceDialect,
2384                0xaf10de85bb7023a,
2385            >(_buf?)?
2386            .into_result::<SupplicantStaIfaceMarker>("set_suspend_mode_enabled")?;
2387            Ok(_response)
2388        }
2389        self.client.send_query_and_decode::<SupplicantStaIfaceSetSuspendModeEnabledRequest, ()>(
2390            &mut payload,
2391            0xaf10de85bb7023a,
2392            fidl::encoding::DynamicFlags::FLEXIBLE,
2393            _decode,
2394        )
2395    }
2396
2397    type SetStaCountryCodeResponseFut = fidl::client::QueryResponseFut<
2398        SupplicantStaIfaceSetStaCountryCodeResult,
2399        fidl::encoding::DefaultFuchsiaResourceDialect,
2400    >;
2401    fn r#set_sta_country_code(
2402        &self,
2403        mut payload: SupplicantStaIfaceSetStaCountryCodeRequest,
2404    ) -> Self::SetStaCountryCodeResponseFut {
2405        fn _decode(
2406            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2407        ) -> Result<SupplicantStaIfaceSetStaCountryCodeResult, fidl::Error> {
2408            let _response = fidl::client::decode_transaction_body::<
2409                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
2410                fidl::encoding::DefaultFuchsiaResourceDialect,
2411                0x977e22f9b79b26e,
2412            >(_buf?)?
2413            .into_result::<SupplicantStaIfaceMarker>("set_sta_country_code")?;
2414            Ok(_response.map(|x| x))
2415        }
2416        self.client.send_query_and_decode::<
2417            SupplicantStaIfaceSetStaCountryCodeRequest,
2418            SupplicantStaIfaceSetStaCountryCodeResult,
2419        >(
2420            &mut payload,
2421            0x977e22f9b79b26e,
2422            fidl::encoding::DynamicFlags::FLEXIBLE,
2423            _decode,
2424        )
2425    }
2426}
2427
2428pub struct SupplicantStaIfaceEventStream {
2429    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2430}
2431
2432impl std::marker::Unpin for SupplicantStaIfaceEventStream {}
2433
2434impl futures::stream::FusedStream for SupplicantStaIfaceEventStream {
2435    fn is_terminated(&self) -> bool {
2436        self.event_receiver.is_terminated()
2437    }
2438}
2439
2440impl futures::Stream for SupplicantStaIfaceEventStream {
2441    type Item = Result<SupplicantStaIfaceEvent, fidl::Error>;
2442
2443    fn poll_next(
2444        mut self: std::pin::Pin<&mut Self>,
2445        cx: &mut std::task::Context<'_>,
2446    ) -> std::task::Poll<Option<Self::Item>> {
2447        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2448            &mut self.event_receiver,
2449            cx
2450        )?) {
2451            Some(buf) => std::task::Poll::Ready(Some(SupplicantStaIfaceEvent::decode(buf))),
2452            None => std::task::Poll::Ready(None),
2453        }
2454    }
2455}
2456
2457#[derive(Debug)]
2458pub enum SupplicantStaIfaceEvent {
2459    #[non_exhaustive]
2460    _UnknownEvent {
2461        /// Ordinal of the event that was sent.
2462        ordinal: u64,
2463    },
2464}
2465
2466impl SupplicantStaIfaceEvent {
2467    /// Decodes a message buffer as a [`SupplicantStaIfaceEvent`].
2468    fn decode(
2469        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2470    ) -> Result<SupplicantStaIfaceEvent, fidl::Error> {
2471        let (bytes, _handles) = buf.split_mut();
2472        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2473        debug_assert_eq!(tx_header.tx_id, 0);
2474        match tx_header.ordinal {
2475            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2476                Ok(SupplicantStaIfaceEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2477            }
2478            _ => Err(fidl::Error::UnknownOrdinal {
2479                ordinal: tx_header.ordinal,
2480                protocol_name:
2481                    <SupplicantStaIfaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2482            }),
2483        }
2484    }
2485}
2486
2487/// A Stream of incoming requests for fuchsia.wlan.wlanix/SupplicantStaIface.
2488pub struct SupplicantStaIfaceRequestStream {
2489    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2490    is_terminated: bool,
2491}
2492
2493impl std::marker::Unpin for SupplicantStaIfaceRequestStream {}
2494
2495impl futures::stream::FusedStream for SupplicantStaIfaceRequestStream {
2496    fn is_terminated(&self) -> bool {
2497        self.is_terminated
2498    }
2499}
2500
2501impl fidl::endpoints::RequestStream for SupplicantStaIfaceRequestStream {
2502    type Protocol = SupplicantStaIfaceMarker;
2503    type ControlHandle = SupplicantStaIfaceControlHandle;
2504
2505    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2506        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2507    }
2508
2509    fn control_handle(&self) -> Self::ControlHandle {
2510        SupplicantStaIfaceControlHandle { inner: self.inner.clone() }
2511    }
2512
2513    fn into_inner(
2514        self,
2515    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2516    {
2517        (self.inner, self.is_terminated)
2518    }
2519
2520    fn from_inner(
2521        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2522        is_terminated: bool,
2523    ) -> Self {
2524        Self { inner, is_terminated }
2525    }
2526}
2527
2528impl futures::Stream for SupplicantStaIfaceRequestStream {
2529    type Item = Result<SupplicantStaIfaceRequest, fidl::Error>;
2530
2531    fn poll_next(
2532        mut self: std::pin::Pin<&mut Self>,
2533        cx: &mut std::task::Context<'_>,
2534    ) -> std::task::Poll<Option<Self::Item>> {
2535        let this = &mut *self;
2536        if this.inner.check_shutdown(cx) {
2537            this.is_terminated = true;
2538            return std::task::Poll::Ready(None);
2539        }
2540        if this.is_terminated {
2541            panic!("polled SupplicantStaIfaceRequestStream after completion");
2542        }
2543        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2544            |bytes, handles| {
2545                match this.inner.channel().read_etc(cx, bytes, handles) {
2546                    std::task::Poll::Ready(Ok(())) => {}
2547                    std::task::Poll::Pending => return std::task::Poll::Pending,
2548                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2549                        this.is_terminated = true;
2550                        return std::task::Poll::Ready(None);
2551                    }
2552                    std::task::Poll::Ready(Err(e)) => {
2553                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2554                            e.into(),
2555                        ))));
2556                    }
2557                }
2558
2559                // A message has been received from the channel
2560                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2561
2562                std::task::Poll::Ready(Some(match header.ordinal {
2563                0x1be680e863a8e71 => {
2564                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2565                    let mut req = fidl::new_empty!(SupplicantStaIfaceRegisterCallbackRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2566                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantStaIfaceRegisterCallbackRequest>(&header, _body_bytes, handles, &mut req)?;
2567                    let control_handle = SupplicantStaIfaceControlHandle {
2568                        inner: this.inner.clone(),
2569                    };
2570                    Ok(SupplicantStaIfaceRequest::RegisterCallback {payload: req,
2571                        control_handle,
2572                    })
2573                }
2574                0xa77cf60628766dc => {
2575                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2576                    let mut req = fidl::new_empty!(SupplicantStaIfaceAddNetworkRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2577                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantStaIfaceAddNetworkRequest>(&header, _body_bytes, handles, &mut req)?;
2578                    let control_handle = SupplicantStaIfaceControlHandle {
2579                        inner: this.inner.clone(),
2580                    };
2581                    Ok(SupplicantStaIfaceRequest::AddNetwork {payload: req,
2582                        control_handle,
2583                    })
2584                }
2585                0x52a1d38e0b4871fa => {
2586                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2587                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
2588                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2589                    let control_handle = SupplicantStaIfaceControlHandle {
2590                        inner: this.inner.clone(),
2591                    };
2592                    Ok(SupplicantStaIfaceRequest::Disconnect {
2593                        responder: SupplicantStaIfaceDisconnectResponder {
2594                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2595                            tx_id: header.tx_id,
2596                        },
2597                    })
2598                }
2599                0x60591d204a3f537f => {
2600                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2601                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
2602                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2603                    let control_handle = SupplicantStaIfaceControlHandle {
2604                        inner: this.inner.clone(),
2605                    };
2606                    Ok(SupplicantStaIfaceRequest::GetMacAddress {
2607                        responder: SupplicantStaIfaceGetMacAddressResponder {
2608                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2609                            tx_id: header.tx_id,
2610                        },
2611                    })
2612                }
2613                0x14567ff593a9b154 => {
2614                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2615                    let mut req = fidl::new_empty!(SupplicantStaIfaceSetBtCoexistenceModeRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2616                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantStaIfaceSetBtCoexistenceModeRequest>(&header, _body_bytes, handles, &mut req)?;
2617                    let control_handle = SupplicantStaIfaceControlHandle {
2618                        inner: this.inner.clone(),
2619                    };
2620                    Ok(SupplicantStaIfaceRequest::SetBtCoexistenceMode {payload: req,
2621                        responder: SupplicantStaIfaceSetBtCoexistenceModeResponder {
2622                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2623                            tx_id: header.tx_id,
2624                        },
2625                    })
2626                }
2627                0x5a04c29320085298 => {
2628                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2629                    let mut req = fidl::new_empty!(SupplicantStaIfaceSetPowerSaveRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2630                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantStaIfaceSetPowerSaveRequest>(&header, _body_bytes, handles, &mut req)?;
2631                    let control_handle = SupplicantStaIfaceControlHandle {
2632                        inner: this.inner.clone(),
2633                    };
2634                    Ok(SupplicantStaIfaceRequest::SetPowerSave {payload: req,
2635                        responder: SupplicantStaIfaceSetPowerSaveResponder {
2636                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2637                            tx_id: header.tx_id,
2638                        },
2639                    })
2640                }
2641                0xaf10de85bb7023a => {
2642                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2643                    let mut req = fidl::new_empty!(SupplicantStaIfaceSetSuspendModeEnabledRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2644                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantStaIfaceSetSuspendModeEnabledRequest>(&header, _body_bytes, handles, &mut req)?;
2645                    let control_handle = SupplicantStaIfaceControlHandle {
2646                        inner: this.inner.clone(),
2647                    };
2648                    Ok(SupplicantStaIfaceRequest::SetSuspendModeEnabled {payload: req,
2649                        responder: SupplicantStaIfaceSetSuspendModeEnabledResponder {
2650                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2651                            tx_id: header.tx_id,
2652                        },
2653                    })
2654                }
2655                0x977e22f9b79b26e => {
2656                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2657                    let mut req = fidl::new_empty!(SupplicantStaIfaceSetStaCountryCodeRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2658                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantStaIfaceSetStaCountryCodeRequest>(&header, _body_bytes, handles, &mut req)?;
2659                    let control_handle = SupplicantStaIfaceControlHandle {
2660                        inner: this.inner.clone(),
2661                    };
2662                    Ok(SupplicantStaIfaceRequest::SetStaCountryCode {payload: req,
2663                        responder: SupplicantStaIfaceSetStaCountryCodeResponder {
2664                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2665                            tx_id: header.tx_id,
2666                        },
2667                    })
2668                }
2669                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2670                    Ok(SupplicantStaIfaceRequest::_UnknownMethod {
2671                        ordinal: header.ordinal,
2672                        control_handle: SupplicantStaIfaceControlHandle { inner: this.inner.clone() },
2673                        method_type: fidl::MethodType::OneWay,
2674                    })
2675                }
2676                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2677                    this.inner.send_framework_err(
2678                        fidl::encoding::FrameworkErr::UnknownMethod,
2679                        header.tx_id,
2680                        header.ordinal,
2681                        header.dynamic_flags(),
2682                        (bytes, handles),
2683                    )?;
2684                    Ok(SupplicantStaIfaceRequest::_UnknownMethod {
2685                        ordinal: header.ordinal,
2686                        control_handle: SupplicantStaIfaceControlHandle { inner: this.inner.clone() },
2687                        method_type: fidl::MethodType::TwoWay,
2688                    })
2689                }
2690                _ => Err(fidl::Error::UnknownOrdinal {
2691                    ordinal: header.ordinal,
2692                    protocol_name: <SupplicantStaIfaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2693                }),
2694            }))
2695            },
2696        )
2697    }
2698}
2699
2700#[derive(Debug)]
2701pub enum SupplicantStaIfaceRequest {
2702    RegisterCallback {
2703        payload: SupplicantStaIfaceRegisterCallbackRequest,
2704        control_handle: SupplicantStaIfaceControlHandle,
2705    },
2706    AddNetwork {
2707        payload: SupplicantStaIfaceAddNetworkRequest,
2708        control_handle: SupplicantStaIfaceControlHandle,
2709    },
2710    Disconnect {
2711        responder: SupplicantStaIfaceDisconnectResponder,
2712    },
2713    GetMacAddress {
2714        responder: SupplicantStaIfaceGetMacAddressResponder,
2715    },
2716    SetBtCoexistenceMode {
2717        payload: SupplicantStaIfaceSetBtCoexistenceModeRequest,
2718        responder: SupplicantStaIfaceSetBtCoexistenceModeResponder,
2719    },
2720    SetPowerSave {
2721        payload: SupplicantStaIfaceSetPowerSaveRequest,
2722        responder: SupplicantStaIfaceSetPowerSaveResponder,
2723    },
2724    SetSuspendModeEnabled {
2725        payload: SupplicantStaIfaceSetSuspendModeEnabledRequest,
2726        responder: SupplicantStaIfaceSetSuspendModeEnabledResponder,
2727    },
2728    SetStaCountryCode {
2729        payload: SupplicantStaIfaceSetStaCountryCodeRequest,
2730        responder: SupplicantStaIfaceSetStaCountryCodeResponder,
2731    },
2732    /// An interaction was received which does not match any known method.
2733    #[non_exhaustive]
2734    _UnknownMethod {
2735        /// Ordinal of the method that was called.
2736        ordinal: u64,
2737        control_handle: SupplicantStaIfaceControlHandle,
2738        method_type: fidl::MethodType,
2739    },
2740}
2741
2742impl SupplicantStaIfaceRequest {
2743    #[allow(irrefutable_let_patterns)]
2744    pub fn into_register_callback(
2745        self,
2746    ) -> Option<(SupplicantStaIfaceRegisterCallbackRequest, SupplicantStaIfaceControlHandle)> {
2747        if let SupplicantStaIfaceRequest::RegisterCallback { payload, control_handle } = self {
2748            Some((payload, control_handle))
2749        } else {
2750            None
2751        }
2752    }
2753
2754    #[allow(irrefutable_let_patterns)]
2755    pub fn into_add_network(
2756        self,
2757    ) -> Option<(SupplicantStaIfaceAddNetworkRequest, SupplicantStaIfaceControlHandle)> {
2758        if let SupplicantStaIfaceRequest::AddNetwork { payload, control_handle } = self {
2759            Some((payload, control_handle))
2760        } else {
2761            None
2762        }
2763    }
2764
2765    #[allow(irrefutable_let_patterns)]
2766    pub fn into_disconnect(self) -> Option<(SupplicantStaIfaceDisconnectResponder)> {
2767        if let SupplicantStaIfaceRequest::Disconnect { responder } = self {
2768            Some((responder))
2769        } else {
2770            None
2771        }
2772    }
2773
2774    #[allow(irrefutable_let_patterns)]
2775    pub fn into_get_mac_address(self) -> Option<(SupplicantStaIfaceGetMacAddressResponder)> {
2776        if let SupplicantStaIfaceRequest::GetMacAddress { responder } = self {
2777            Some((responder))
2778        } else {
2779            None
2780        }
2781    }
2782
2783    #[allow(irrefutable_let_patterns)]
2784    pub fn into_set_bt_coexistence_mode(
2785        self,
2786    ) -> Option<(
2787        SupplicantStaIfaceSetBtCoexistenceModeRequest,
2788        SupplicantStaIfaceSetBtCoexistenceModeResponder,
2789    )> {
2790        if let SupplicantStaIfaceRequest::SetBtCoexistenceMode { payload, responder } = self {
2791            Some((payload, responder))
2792        } else {
2793            None
2794        }
2795    }
2796
2797    #[allow(irrefutable_let_patterns)]
2798    pub fn into_set_power_save(
2799        self,
2800    ) -> Option<(SupplicantStaIfaceSetPowerSaveRequest, SupplicantStaIfaceSetPowerSaveResponder)>
2801    {
2802        if let SupplicantStaIfaceRequest::SetPowerSave { payload, responder } = self {
2803            Some((payload, responder))
2804        } else {
2805            None
2806        }
2807    }
2808
2809    #[allow(irrefutable_let_patterns)]
2810    pub fn into_set_suspend_mode_enabled(
2811        self,
2812    ) -> Option<(
2813        SupplicantStaIfaceSetSuspendModeEnabledRequest,
2814        SupplicantStaIfaceSetSuspendModeEnabledResponder,
2815    )> {
2816        if let SupplicantStaIfaceRequest::SetSuspendModeEnabled { payload, responder } = self {
2817            Some((payload, responder))
2818        } else {
2819            None
2820        }
2821    }
2822
2823    #[allow(irrefutable_let_patterns)]
2824    pub fn into_set_sta_country_code(
2825        self,
2826    ) -> Option<(
2827        SupplicantStaIfaceSetStaCountryCodeRequest,
2828        SupplicantStaIfaceSetStaCountryCodeResponder,
2829    )> {
2830        if let SupplicantStaIfaceRequest::SetStaCountryCode { payload, responder } = self {
2831            Some((payload, responder))
2832        } else {
2833            None
2834        }
2835    }
2836
2837    /// Name of the method defined in FIDL
2838    pub fn method_name(&self) -> &'static str {
2839        match *self {
2840            SupplicantStaIfaceRequest::RegisterCallback { .. } => "register_callback",
2841            SupplicantStaIfaceRequest::AddNetwork { .. } => "add_network",
2842            SupplicantStaIfaceRequest::Disconnect { .. } => "disconnect",
2843            SupplicantStaIfaceRequest::GetMacAddress { .. } => "get_mac_address",
2844            SupplicantStaIfaceRequest::SetBtCoexistenceMode { .. } => "set_bt_coexistence_mode",
2845            SupplicantStaIfaceRequest::SetPowerSave { .. } => "set_power_save",
2846            SupplicantStaIfaceRequest::SetSuspendModeEnabled { .. } => "set_suspend_mode_enabled",
2847            SupplicantStaIfaceRequest::SetStaCountryCode { .. } => "set_sta_country_code",
2848            SupplicantStaIfaceRequest::_UnknownMethod {
2849                method_type: fidl::MethodType::OneWay,
2850                ..
2851            } => "unknown one-way method",
2852            SupplicantStaIfaceRequest::_UnknownMethod {
2853                method_type: fidl::MethodType::TwoWay,
2854                ..
2855            } => "unknown two-way method",
2856        }
2857    }
2858}
2859
2860#[derive(Debug, Clone)]
2861pub struct SupplicantStaIfaceControlHandle {
2862    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2863}
2864
2865impl fidl::endpoints::ControlHandle for SupplicantStaIfaceControlHandle {
2866    fn shutdown(&self) {
2867        self.inner.shutdown()
2868    }
2869    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2870        self.inner.shutdown_with_epitaph(status)
2871    }
2872
2873    fn is_closed(&self) -> bool {
2874        self.inner.channel().is_closed()
2875    }
2876    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2877        self.inner.channel().on_closed()
2878    }
2879
2880    #[cfg(target_os = "fuchsia")]
2881    fn signal_peer(
2882        &self,
2883        clear_mask: zx::Signals,
2884        set_mask: zx::Signals,
2885    ) -> Result<(), zx_status::Status> {
2886        use fidl::Peered;
2887        self.inner.channel().signal_peer(clear_mask, set_mask)
2888    }
2889}
2890
2891impl SupplicantStaIfaceControlHandle {}
2892
2893#[must_use = "FIDL methods require a response to be sent"]
2894#[derive(Debug)]
2895pub struct SupplicantStaIfaceDisconnectResponder {
2896    control_handle: std::mem::ManuallyDrop<SupplicantStaIfaceControlHandle>,
2897    tx_id: u32,
2898}
2899
2900/// Set the the channel to be shutdown (see [`SupplicantStaIfaceControlHandle::shutdown`])
2901/// if the responder is dropped without sending a response, so that the client
2902/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2903impl std::ops::Drop for SupplicantStaIfaceDisconnectResponder {
2904    fn drop(&mut self) {
2905        self.control_handle.shutdown();
2906        // Safety: drops once, never accessed again
2907        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2908    }
2909}
2910
2911impl fidl::endpoints::Responder for SupplicantStaIfaceDisconnectResponder {
2912    type ControlHandle = SupplicantStaIfaceControlHandle;
2913
2914    fn control_handle(&self) -> &SupplicantStaIfaceControlHandle {
2915        &self.control_handle
2916    }
2917
2918    fn drop_without_shutdown(mut self) {
2919        // Safety: drops once, never accessed again due to mem::forget
2920        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2921        // Prevent Drop from running (which would shut down the channel)
2922        std::mem::forget(self);
2923    }
2924}
2925
2926impl SupplicantStaIfaceDisconnectResponder {
2927    /// Sends a response to the FIDL transaction.
2928    ///
2929    /// Sets the channel to shutdown if an error occurs.
2930    pub fn send(self) -> Result<(), fidl::Error> {
2931        let _result = self.send_raw();
2932        if _result.is_err() {
2933            self.control_handle.shutdown();
2934        }
2935        self.drop_without_shutdown();
2936        _result
2937    }
2938
2939    /// Similar to "send" but does not shutdown the channel if an error occurs.
2940    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2941        let _result = self.send_raw();
2942        self.drop_without_shutdown();
2943        _result
2944    }
2945
2946    fn send_raw(&self) -> Result<(), fidl::Error> {
2947        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
2948            fidl::encoding::Flexible::new(()),
2949            self.tx_id,
2950            0x52a1d38e0b4871fa,
2951            fidl::encoding::DynamicFlags::FLEXIBLE,
2952        )
2953    }
2954}
2955
2956#[must_use = "FIDL methods require a response to be sent"]
2957#[derive(Debug)]
2958pub struct SupplicantStaIfaceGetMacAddressResponder {
2959    control_handle: std::mem::ManuallyDrop<SupplicantStaIfaceControlHandle>,
2960    tx_id: u32,
2961}
2962
2963/// Set the the channel to be shutdown (see [`SupplicantStaIfaceControlHandle::shutdown`])
2964/// if the responder is dropped without sending a response, so that the client
2965/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2966impl std::ops::Drop for SupplicantStaIfaceGetMacAddressResponder {
2967    fn drop(&mut self) {
2968        self.control_handle.shutdown();
2969        // Safety: drops once, never accessed again
2970        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2971    }
2972}
2973
2974impl fidl::endpoints::Responder for SupplicantStaIfaceGetMacAddressResponder {
2975    type ControlHandle = SupplicantStaIfaceControlHandle;
2976
2977    fn control_handle(&self) -> &SupplicantStaIfaceControlHandle {
2978        &self.control_handle
2979    }
2980
2981    fn drop_without_shutdown(mut self) {
2982        // Safety: drops once, never accessed again due to mem::forget
2983        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2984        // Prevent Drop from running (which would shut down the channel)
2985        std::mem::forget(self);
2986    }
2987}
2988
2989impl SupplicantStaIfaceGetMacAddressResponder {
2990    /// Sends a response to the FIDL transaction.
2991    ///
2992    /// Sets the channel to shutdown if an error occurs.
2993    pub fn send(
2994        self,
2995        mut result: Result<&SupplicantStaIfaceGetMacAddressResponse, i32>,
2996    ) -> Result<(), fidl::Error> {
2997        let _result = self.send_raw(result);
2998        if _result.is_err() {
2999            self.control_handle.shutdown();
3000        }
3001        self.drop_without_shutdown();
3002        _result
3003    }
3004
3005    /// Similar to "send" but does not shutdown the channel if an error occurs.
3006    pub fn send_no_shutdown_on_err(
3007        self,
3008        mut result: Result<&SupplicantStaIfaceGetMacAddressResponse, i32>,
3009    ) -> Result<(), fidl::Error> {
3010        let _result = self.send_raw(result);
3011        self.drop_without_shutdown();
3012        _result
3013    }
3014
3015    fn send_raw(
3016        &self,
3017        mut result: Result<&SupplicantStaIfaceGetMacAddressResponse, i32>,
3018    ) -> Result<(), fidl::Error> {
3019        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3020            SupplicantStaIfaceGetMacAddressResponse,
3021            i32,
3022        >>(
3023            fidl::encoding::FlexibleResult::new(result),
3024            self.tx_id,
3025            0x60591d204a3f537f,
3026            fidl::encoding::DynamicFlags::FLEXIBLE,
3027        )
3028    }
3029}
3030
3031#[must_use = "FIDL methods require a response to be sent"]
3032#[derive(Debug)]
3033pub struct SupplicantStaIfaceSetBtCoexistenceModeResponder {
3034    control_handle: std::mem::ManuallyDrop<SupplicantStaIfaceControlHandle>,
3035    tx_id: u32,
3036}
3037
3038/// Set the the channel to be shutdown (see [`SupplicantStaIfaceControlHandle::shutdown`])
3039/// if the responder is dropped without sending a response, so that the client
3040/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3041impl std::ops::Drop for SupplicantStaIfaceSetBtCoexistenceModeResponder {
3042    fn drop(&mut self) {
3043        self.control_handle.shutdown();
3044        // Safety: drops once, never accessed again
3045        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3046    }
3047}
3048
3049impl fidl::endpoints::Responder for SupplicantStaIfaceSetBtCoexistenceModeResponder {
3050    type ControlHandle = SupplicantStaIfaceControlHandle;
3051
3052    fn control_handle(&self) -> &SupplicantStaIfaceControlHandle {
3053        &self.control_handle
3054    }
3055
3056    fn drop_without_shutdown(mut self) {
3057        // Safety: drops once, never accessed again due to mem::forget
3058        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3059        // Prevent Drop from running (which would shut down the channel)
3060        std::mem::forget(self);
3061    }
3062}
3063
3064impl SupplicantStaIfaceSetBtCoexistenceModeResponder {
3065    /// Sends a response to the FIDL transaction.
3066    ///
3067    /// Sets the channel to shutdown if an error occurs.
3068    pub fn send(self, mut result: Result<(), WlanixError>) -> Result<(), fidl::Error> {
3069        let _result = self.send_raw(result);
3070        if _result.is_err() {
3071            self.control_handle.shutdown();
3072        }
3073        self.drop_without_shutdown();
3074        _result
3075    }
3076
3077    /// Similar to "send" but does not shutdown the channel if an error occurs.
3078    pub fn send_no_shutdown_on_err(
3079        self,
3080        mut result: Result<(), WlanixError>,
3081    ) -> Result<(), fidl::Error> {
3082        let _result = self.send_raw(result);
3083        self.drop_without_shutdown();
3084        _result
3085    }
3086
3087    fn send_raw(&self, mut result: Result<(), WlanixError>) -> Result<(), fidl::Error> {
3088        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3089            fidl::encoding::EmptyStruct,
3090            WlanixError,
3091        >>(
3092            fidl::encoding::FlexibleResult::new(result),
3093            self.tx_id,
3094            0x14567ff593a9b154,
3095            fidl::encoding::DynamicFlags::FLEXIBLE,
3096        )
3097    }
3098}
3099
3100#[must_use = "FIDL methods require a response to be sent"]
3101#[derive(Debug)]
3102pub struct SupplicantStaIfaceSetPowerSaveResponder {
3103    control_handle: std::mem::ManuallyDrop<SupplicantStaIfaceControlHandle>,
3104    tx_id: u32,
3105}
3106
3107/// Set the the channel to be shutdown (see [`SupplicantStaIfaceControlHandle::shutdown`])
3108/// if the responder is dropped without sending a response, so that the client
3109/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3110impl std::ops::Drop for SupplicantStaIfaceSetPowerSaveResponder {
3111    fn drop(&mut self) {
3112        self.control_handle.shutdown();
3113        // Safety: drops once, never accessed again
3114        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3115    }
3116}
3117
3118impl fidl::endpoints::Responder for SupplicantStaIfaceSetPowerSaveResponder {
3119    type ControlHandle = SupplicantStaIfaceControlHandle;
3120
3121    fn control_handle(&self) -> &SupplicantStaIfaceControlHandle {
3122        &self.control_handle
3123    }
3124
3125    fn drop_without_shutdown(mut self) {
3126        // Safety: drops once, never accessed again due to mem::forget
3127        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3128        // Prevent Drop from running (which would shut down the channel)
3129        std::mem::forget(self);
3130    }
3131}
3132
3133impl SupplicantStaIfaceSetPowerSaveResponder {
3134    /// Sends a response to the FIDL transaction.
3135    ///
3136    /// Sets the channel to shutdown if an error occurs.
3137    pub fn send(self) -> Result<(), fidl::Error> {
3138        let _result = self.send_raw();
3139        if _result.is_err() {
3140            self.control_handle.shutdown();
3141        }
3142        self.drop_without_shutdown();
3143        _result
3144    }
3145
3146    /// Similar to "send" but does not shutdown the channel if an error occurs.
3147    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3148        let _result = self.send_raw();
3149        self.drop_without_shutdown();
3150        _result
3151    }
3152
3153    fn send_raw(&self) -> Result<(), fidl::Error> {
3154        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
3155            fidl::encoding::Flexible::new(()),
3156            self.tx_id,
3157            0x5a04c29320085298,
3158            fidl::encoding::DynamicFlags::FLEXIBLE,
3159        )
3160    }
3161}
3162
3163#[must_use = "FIDL methods require a response to be sent"]
3164#[derive(Debug)]
3165pub struct SupplicantStaIfaceSetSuspendModeEnabledResponder {
3166    control_handle: std::mem::ManuallyDrop<SupplicantStaIfaceControlHandle>,
3167    tx_id: u32,
3168}
3169
3170/// Set the the channel to be shutdown (see [`SupplicantStaIfaceControlHandle::shutdown`])
3171/// if the responder is dropped without sending a response, so that the client
3172/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3173impl std::ops::Drop for SupplicantStaIfaceSetSuspendModeEnabledResponder {
3174    fn drop(&mut self) {
3175        self.control_handle.shutdown();
3176        // Safety: drops once, never accessed again
3177        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3178    }
3179}
3180
3181impl fidl::endpoints::Responder for SupplicantStaIfaceSetSuspendModeEnabledResponder {
3182    type ControlHandle = SupplicantStaIfaceControlHandle;
3183
3184    fn control_handle(&self) -> &SupplicantStaIfaceControlHandle {
3185        &self.control_handle
3186    }
3187
3188    fn drop_without_shutdown(mut self) {
3189        // Safety: drops once, never accessed again due to mem::forget
3190        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3191        // Prevent Drop from running (which would shut down the channel)
3192        std::mem::forget(self);
3193    }
3194}
3195
3196impl SupplicantStaIfaceSetSuspendModeEnabledResponder {
3197    /// Sends a response to the FIDL transaction.
3198    ///
3199    /// Sets the channel to shutdown if an error occurs.
3200    pub fn send(self) -> Result<(), fidl::Error> {
3201        let _result = self.send_raw();
3202        if _result.is_err() {
3203            self.control_handle.shutdown();
3204        }
3205        self.drop_without_shutdown();
3206        _result
3207    }
3208
3209    /// Similar to "send" but does not shutdown the channel if an error occurs.
3210    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3211        let _result = self.send_raw();
3212        self.drop_without_shutdown();
3213        _result
3214    }
3215
3216    fn send_raw(&self) -> Result<(), fidl::Error> {
3217        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
3218            fidl::encoding::Flexible::new(()),
3219            self.tx_id,
3220            0xaf10de85bb7023a,
3221            fidl::encoding::DynamicFlags::FLEXIBLE,
3222        )
3223    }
3224}
3225
3226#[must_use = "FIDL methods require a response to be sent"]
3227#[derive(Debug)]
3228pub struct SupplicantStaIfaceSetStaCountryCodeResponder {
3229    control_handle: std::mem::ManuallyDrop<SupplicantStaIfaceControlHandle>,
3230    tx_id: u32,
3231}
3232
3233/// Set the the channel to be shutdown (see [`SupplicantStaIfaceControlHandle::shutdown`])
3234/// if the responder is dropped without sending a response, so that the client
3235/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3236impl std::ops::Drop for SupplicantStaIfaceSetStaCountryCodeResponder {
3237    fn drop(&mut self) {
3238        self.control_handle.shutdown();
3239        // Safety: drops once, never accessed again
3240        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3241    }
3242}
3243
3244impl fidl::endpoints::Responder for SupplicantStaIfaceSetStaCountryCodeResponder {
3245    type ControlHandle = SupplicantStaIfaceControlHandle;
3246
3247    fn control_handle(&self) -> &SupplicantStaIfaceControlHandle {
3248        &self.control_handle
3249    }
3250
3251    fn drop_without_shutdown(mut self) {
3252        // Safety: drops once, never accessed again due to mem::forget
3253        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3254        // Prevent Drop from running (which would shut down the channel)
3255        std::mem::forget(self);
3256    }
3257}
3258
3259impl SupplicantStaIfaceSetStaCountryCodeResponder {
3260    /// Sends a response to the FIDL transaction.
3261    ///
3262    /// Sets the channel to shutdown if an error occurs.
3263    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3264        let _result = self.send_raw(result);
3265        if _result.is_err() {
3266            self.control_handle.shutdown();
3267        }
3268        self.drop_without_shutdown();
3269        _result
3270    }
3271
3272    /// Similar to "send" but does not shutdown the channel if an error occurs.
3273    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3274        let _result = self.send_raw(result);
3275        self.drop_without_shutdown();
3276        _result
3277    }
3278
3279    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3280        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
3281            fidl::encoding::EmptyStruct,
3282            i32,
3283        >>(
3284            fidl::encoding::FlexibleResult::new(result),
3285            self.tx_id,
3286            0x977e22f9b79b26e,
3287            fidl::encoding::DynamicFlags::FLEXIBLE,
3288        )
3289    }
3290}
3291
3292#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3293pub struct SupplicantStaIfaceCallbackMarker;
3294
3295impl fidl::endpoints::ProtocolMarker for SupplicantStaIfaceCallbackMarker {
3296    type Proxy = SupplicantStaIfaceCallbackProxy;
3297    type RequestStream = SupplicantStaIfaceCallbackRequestStream;
3298    #[cfg(target_os = "fuchsia")]
3299    type SynchronousProxy = SupplicantStaIfaceCallbackSynchronousProxy;
3300
3301    const DEBUG_NAME: &'static str = "(anonymous) SupplicantStaIfaceCallback";
3302}
3303
3304pub trait SupplicantStaIfaceCallbackProxyInterface: Send + Sync {
3305    fn r#on_state_changed(
3306        &self,
3307        payload: &SupplicantStaIfaceCallbackOnStateChangedRequest,
3308    ) -> Result<(), fidl::Error>;
3309    fn r#on_disconnected(
3310        &self,
3311        payload: &SupplicantStaIfaceCallbackOnDisconnectedRequest,
3312    ) -> Result<(), fidl::Error>;
3313    fn r#on_association_rejected(
3314        &self,
3315        payload: &SupplicantStaIfaceCallbackOnAssociationRejectedRequest,
3316    ) -> Result<(), fidl::Error>;
3317}
3318#[derive(Debug)]
3319#[cfg(target_os = "fuchsia")]
3320pub struct SupplicantStaIfaceCallbackSynchronousProxy {
3321    client: fidl::client::sync::Client,
3322}
3323
3324#[cfg(target_os = "fuchsia")]
3325impl fidl::endpoints::SynchronousProxy for SupplicantStaIfaceCallbackSynchronousProxy {
3326    type Proxy = SupplicantStaIfaceCallbackProxy;
3327    type Protocol = SupplicantStaIfaceCallbackMarker;
3328
3329    fn from_channel(inner: fidl::Channel) -> Self {
3330        Self::new(inner)
3331    }
3332
3333    fn into_channel(self) -> fidl::Channel {
3334        self.client.into_channel()
3335    }
3336
3337    fn as_channel(&self) -> &fidl::Channel {
3338        self.client.as_channel()
3339    }
3340}
3341
3342#[cfg(target_os = "fuchsia")]
3343impl SupplicantStaIfaceCallbackSynchronousProxy {
3344    pub fn new(channel: fidl::Channel) -> Self {
3345        let protocol_name =
3346            <SupplicantStaIfaceCallbackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3347        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3348    }
3349
3350    pub fn into_channel(self) -> fidl::Channel {
3351        self.client.into_channel()
3352    }
3353
3354    /// Waits until an event arrives and returns it. It is safe for other
3355    /// threads to make concurrent requests while waiting for an event.
3356    pub fn wait_for_event(
3357        &self,
3358        deadline: zx::MonotonicInstant,
3359    ) -> Result<SupplicantStaIfaceCallbackEvent, fidl::Error> {
3360        SupplicantStaIfaceCallbackEvent::decode(self.client.wait_for_event(deadline)?)
3361    }
3362
3363    pub fn r#on_state_changed(
3364        &self,
3365        mut payload: &SupplicantStaIfaceCallbackOnStateChangedRequest,
3366    ) -> Result<(), fidl::Error> {
3367        self.client.send::<SupplicantStaIfaceCallbackOnStateChangedRequest>(
3368            payload,
3369            0x27e086d26c49eb6c,
3370            fidl::encoding::DynamicFlags::FLEXIBLE,
3371        )
3372    }
3373
3374    pub fn r#on_disconnected(
3375        &self,
3376        mut payload: &SupplicantStaIfaceCallbackOnDisconnectedRequest,
3377    ) -> Result<(), fidl::Error> {
3378        self.client.send::<SupplicantStaIfaceCallbackOnDisconnectedRequest>(
3379            payload,
3380            0x69546475f4dee0cc,
3381            fidl::encoding::DynamicFlags::FLEXIBLE,
3382        )
3383    }
3384
3385    pub fn r#on_association_rejected(
3386        &self,
3387        mut payload: &SupplicantStaIfaceCallbackOnAssociationRejectedRequest,
3388    ) -> Result<(), fidl::Error> {
3389        self.client.send::<SupplicantStaIfaceCallbackOnAssociationRejectedRequest>(
3390            payload,
3391            0x7ef3961518bed988,
3392            fidl::encoding::DynamicFlags::FLEXIBLE,
3393        )
3394    }
3395}
3396
3397#[cfg(target_os = "fuchsia")]
3398impl From<SupplicantStaIfaceCallbackSynchronousProxy> for zx::Handle {
3399    fn from(value: SupplicantStaIfaceCallbackSynchronousProxy) -> Self {
3400        value.into_channel().into()
3401    }
3402}
3403
3404#[cfg(target_os = "fuchsia")]
3405impl From<fidl::Channel> for SupplicantStaIfaceCallbackSynchronousProxy {
3406    fn from(value: fidl::Channel) -> Self {
3407        Self::new(value)
3408    }
3409}
3410
3411#[cfg(target_os = "fuchsia")]
3412impl fidl::endpoints::FromClient for SupplicantStaIfaceCallbackSynchronousProxy {
3413    type Protocol = SupplicantStaIfaceCallbackMarker;
3414
3415    fn from_client(value: fidl::endpoints::ClientEnd<SupplicantStaIfaceCallbackMarker>) -> Self {
3416        Self::new(value.into_channel())
3417    }
3418}
3419
3420#[derive(Debug, Clone)]
3421pub struct SupplicantStaIfaceCallbackProxy {
3422    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3423}
3424
3425impl fidl::endpoints::Proxy for SupplicantStaIfaceCallbackProxy {
3426    type Protocol = SupplicantStaIfaceCallbackMarker;
3427
3428    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3429        Self::new(inner)
3430    }
3431
3432    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3433        self.client.into_channel().map_err(|client| Self { client })
3434    }
3435
3436    fn as_channel(&self) -> &::fidl::AsyncChannel {
3437        self.client.as_channel()
3438    }
3439}
3440
3441impl SupplicantStaIfaceCallbackProxy {
3442    /// Create a new Proxy for fuchsia.wlan.wlanix/SupplicantStaIfaceCallback.
3443    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3444        let protocol_name =
3445            <SupplicantStaIfaceCallbackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3446        Self { client: fidl::client::Client::new(channel, protocol_name) }
3447    }
3448
3449    /// Get a Stream of events from the remote end of the protocol.
3450    ///
3451    /// # Panics
3452    ///
3453    /// Panics if the event stream was already taken.
3454    pub fn take_event_stream(&self) -> SupplicantStaIfaceCallbackEventStream {
3455        SupplicantStaIfaceCallbackEventStream { event_receiver: self.client.take_event_receiver() }
3456    }
3457
3458    pub fn r#on_state_changed(
3459        &self,
3460        mut payload: &SupplicantStaIfaceCallbackOnStateChangedRequest,
3461    ) -> Result<(), fidl::Error> {
3462        SupplicantStaIfaceCallbackProxyInterface::r#on_state_changed(self, payload)
3463    }
3464
3465    pub fn r#on_disconnected(
3466        &self,
3467        mut payload: &SupplicantStaIfaceCallbackOnDisconnectedRequest,
3468    ) -> Result<(), fidl::Error> {
3469        SupplicantStaIfaceCallbackProxyInterface::r#on_disconnected(self, payload)
3470    }
3471
3472    pub fn r#on_association_rejected(
3473        &self,
3474        mut payload: &SupplicantStaIfaceCallbackOnAssociationRejectedRequest,
3475    ) -> Result<(), fidl::Error> {
3476        SupplicantStaIfaceCallbackProxyInterface::r#on_association_rejected(self, payload)
3477    }
3478}
3479
3480impl SupplicantStaIfaceCallbackProxyInterface for SupplicantStaIfaceCallbackProxy {
3481    fn r#on_state_changed(
3482        &self,
3483        mut payload: &SupplicantStaIfaceCallbackOnStateChangedRequest,
3484    ) -> Result<(), fidl::Error> {
3485        self.client.send::<SupplicantStaIfaceCallbackOnStateChangedRequest>(
3486            payload,
3487            0x27e086d26c49eb6c,
3488            fidl::encoding::DynamicFlags::FLEXIBLE,
3489        )
3490    }
3491
3492    fn r#on_disconnected(
3493        &self,
3494        mut payload: &SupplicantStaIfaceCallbackOnDisconnectedRequest,
3495    ) -> Result<(), fidl::Error> {
3496        self.client.send::<SupplicantStaIfaceCallbackOnDisconnectedRequest>(
3497            payload,
3498            0x69546475f4dee0cc,
3499            fidl::encoding::DynamicFlags::FLEXIBLE,
3500        )
3501    }
3502
3503    fn r#on_association_rejected(
3504        &self,
3505        mut payload: &SupplicantStaIfaceCallbackOnAssociationRejectedRequest,
3506    ) -> Result<(), fidl::Error> {
3507        self.client.send::<SupplicantStaIfaceCallbackOnAssociationRejectedRequest>(
3508            payload,
3509            0x7ef3961518bed988,
3510            fidl::encoding::DynamicFlags::FLEXIBLE,
3511        )
3512    }
3513}
3514
3515pub struct SupplicantStaIfaceCallbackEventStream {
3516    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3517}
3518
3519impl std::marker::Unpin for SupplicantStaIfaceCallbackEventStream {}
3520
3521impl futures::stream::FusedStream for SupplicantStaIfaceCallbackEventStream {
3522    fn is_terminated(&self) -> bool {
3523        self.event_receiver.is_terminated()
3524    }
3525}
3526
3527impl futures::Stream for SupplicantStaIfaceCallbackEventStream {
3528    type Item = Result<SupplicantStaIfaceCallbackEvent, fidl::Error>;
3529
3530    fn poll_next(
3531        mut self: std::pin::Pin<&mut Self>,
3532        cx: &mut std::task::Context<'_>,
3533    ) -> std::task::Poll<Option<Self::Item>> {
3534        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3535            &mut self.event_receiver,
3536            cx
3537        )?) {
3538            Some(buf) => std::task::Poll::Ready(Some(SupplicantStaIfaceCallbackEvent::decode(buf))),
3539            None => std::task::Poll::Ready(None),
3540        }
3541    }
3542}
3543
3544#[derive(Debug)]
3545pub enum SupplicantStaIfaceCallbackEvent {
3546    #[non_exhaustive]
3547    _UnknownEvent {
3548        /// Ordinal of the event that was sent.
3549        ordinal: u64,
3550    },
3551}
3552
3553impl SupplicantStaIfaceCallbackEvent {
3554    /// Decodes a message buffer as a [`SupplicantStaIfaceCallbackEvent`].
3555    fn decode(
3556        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3557    ) -> Result<SupplicantStaIfaceCallbackEvent, fidl::Error> {
3558        let (bytes, _handles) = buf.split_mut();
3559        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3560        debug_assert_eq!(tx_header.tx_id, 0);
3561        match tx_header.ordinal {
3562            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3563                Ok(SupplicantStaIfaceCallbackEvent::_UnknownEvent {
3564                    ordinal: tx_header.ordinal,
3565                })
3566            }
3567            _ => Err(fidl::Error::UnknownOrdinal {
3568                ordinal: tx_header.ordinal,
3569                protocol_name: <SupplicantStaIfaceCallbackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3570            })
3571        }
3572    }
3573}
3574
3575/// A Stream of incoming requests for fuchsia.wlan.wlanix/SupplicantStaIfaceCallback.
3576pub struct SupplicantStaIfaceCallbackRequestStream {
3577    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3578    is_terminated: bool,
3579}
3580
3581impl std::marker::Unpin for SupplicantStaIfaceCallbackRequestStream {}
3582
3583impl futures::stream::FusedStream for SupplicantStaIfaceCallbackRequestStream {
3584    fn is_terminated(&self) -> bool {
3585        self.is_terminated
3586    }
3587}
3588
3589impl fidl::endpoints::RequestStream for SupplicantStaIfaceCallbackRequestStream {
3590    type Protocol = SupplicantStaIfaceCallbackMarker;
3591    type ControlHandle = SupplicantStaIfaceCallbackControlHandle;
3592
3593    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3594        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3595    }
3596
3597    fn control_handle(&self) -> Self::ControlHandle {
3598        SupplicantStaIfaceCallbackControlHandle { inner: self.inner.clone() }
3599    }
3600
3601    fn into_inner(
3602        self,
3603    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3604    {
3605        (self.inner, self.is_terminated)
3606    }
3607
3608    fn from_inner(
3609        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3610        is_terminated: bool,
3611    ) -> Self {
3612        Self { inner, is_terminated }
3613    }
3614}
3615
3616impl futures::Stream for SupplicantStaIfaceCallbackRequestStream {
3617    type Item = Result<SupplicantStaIfaceCallbackRequest, fidl::Error>;
3618
3619    fn poll_next(
3620        mut self: std::pin::Pin<&mut Self>,
3621        cx: &mut std::task::Context<'_>,
3622    ) -> std::task::Poll<Option<Self::Item>> {
3623        let this = &mut *self;
3624        if this.inner.check_shutdown(cx) {
3625            this.is_terminated = true;
3626            return std::task::Poll::Ready(None);
3627        }
3628        if this.is_terminated {
3629            panic!("polled SupplicantStaIfaceCallbackRequestStream after completion");
3630        }
3631        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3632            |bytes, handles| {
3633                match this.inner.channel().read_etc(cx, bytes, handles) {
3634                    std::task::Poll::Ready(Ok(())) => {}
3635                    std::task::Poll::Pending => return std::task::Poll::Pending,
3636                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3637                        this.is_terminated = true;
3638                        return std::task::Poll::Ready(None);
3639                    }
3640                    std::task::Poll::Ready(Err(e)) => {
3641                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3642                            e.into(),
3643                        ))));
3644                    }
3645                }
3646
3647                // A message has been received from the channel
3648                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3649
3650                std::task::Poll::Ready(Some(match header.ordinal {
3651                0x27e086d26c49eb6c => {
3652                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3653                    let mut req = fidl::new_empty!(SupplicantStaIfaceCallbackOnStateChangedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3654                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantStaIfaceCallbackOnStateChangedRequest>(&header, _body_bytes, handles, &mut req)?;
3655                    let control_handle = SupplicantStaIfaceCallbackControlHandle {
3656                        inner: this.inner.clone(),
3657                    };
3658                    Ok(SupplicantStaIfaceCallbackRequest::OnStateChanged {payload: req,
3659                        control_handle,
3660                    })
3661                }
3662                0x69546475f4dee0cc => {
3663                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3664                    let mut req = fidl::new_empty!(SupplicantStaIfaceCallbackOnDisconnectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3665                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantStaIfaceCallbackOnDisconnectedRequest>(&header, _body_bytes, handles, &mut req)?;
3666                    let control_handle = SupplicantStaIfaceCallbackControlHandle {
3667                        inner: this.inner.clone(),
3668                    };
3669                    Ok(SupplicantStaIfaceCallbackRequest::OnDisconnected {payload: req,
3670                        control_handle,
3671                    })
3672                }
3673                0x7ef3961518bed988 => {
3674                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3675                    let mut req = fidl::new_empty!(SupplicantStaIfaceCallbackOnAssociationRejectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3676                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantStaIfaceCallbackOnAssociationRejectedRequest>(&header, _body_bytes, handles, &mut req)?;
3677                    let control_handle = SupplicantStaIfaceCallbackControlHandle {
3678                        inner: this.inner.clone(),
3679                    };
3680                    Ok(SupplicantStaIfaceCallbackRequest::OnAssociationRejected {payload: req,
3681                        control_handle,
3682                    })
3683                }
3684                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3685                    Ok(SupplicantStaIfaceCallbackRequest::_UnknownMethod {
3686                        ordinal: header.ordinal,
3687                        control_handle: SupplicantStaIfaceCallbackControlHandle { inner: this.inner.clone() },
3688                        method_type: fidl::MethodType::OneWay,
3689                    })
3690                }
3691                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3692                    this.inner.send_framework_err(
3693                        fidl::encoding::FrameworkErr::UnknownMethod,
3694                        header.tx_id,
3695                        header.ordinal,
3696                        header.dynamic_flags(),
3697                        (bytes, handles),
3698                    )?;
3699                    Ok(SupplicantStaIfaceCallbackRequest::_UnknownMethod {
3700                        ordinal: header.ordinal,
3701                        control_handle: SupplicantStaIfaceCallbackControlHandle { inner: this.inner.clone() },
3702                        method_type: fidl::MethodType::TwoWay,
3703                    })
3704                }
3705                _ => Err(fidl::Error::UnknownOrdinal {
3706                    ordinal: header.ordinal,
3707                    protocol_name: <SupplicantStaIfaceCallbackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3708                }),
3709            }))
3710            },
3711        )
3712    }
3713}
3714
3715#[derive(Debug)]
3716pub enum SupplicantStaIfaceCallbackRequest {
3717    OnStateChanged {
3718        payload: SupplicantStaIfaceCallbackOnStateChangedRequest,
3719        control_handle: SupplicantStaIfaceCallbackControlHandle,
3720    },
3721    OnDisconnected {
3722        payload: SupplicantStaIfaceCallbackOnDisconnectedRequest,
3723        control_handle: SupplicantStaIfaceCallbackControlHandle,
3724    },
3725    OnAssociationRejected {
3726        payload: SupplicantStaIfaceCallbackOnAssociationRejectedRequest,
3727        control_handle: SupplicantStaIfaceCallbackControlHandle,
3728    },
3729    /// An interaction was received which does not match any known method.
3730    #[non_exhaustive]
3731    _UnknownMethod {
3732        /// Ordinal of the method that was called.
3733        ordinal: u64,
3734        control_handle: SupplicantStaIfaceCallbackControlHandle,
3735        method_type: fidl::MethodType,
3736    },
3737}
3738
3739impl SupplicantStaIfaceCallbackRequest {
3740    #[allow(irrefutable_let_patterns)]
3741    pub fn into_on_state_changed(
3742        self,
3743    ) -> Option<(
3744        SupplicantStaIfaceCallbackOnStateChangedRequest,
3745        SupplicantStaIfaceCallbackControlHandle,
3746    )> {
3747        if let SupplicantStaIfaceCallbackRequest::OnStateChanged { payload, control_handle } = self
3748        {
3749            Some((payload, control_handle))
3750        } else {
3751            None
3752        }
3753    }
3754
3755    #[allow(irrefutable_let_patterns)]
3756    pub fn into_on_disconnected(
3757        self,
3758    ) -> Option<(
3759        SupplicantStaIfaceCallbackOnDisconnectedRequest,
3760        SupplicantStaIfaceCallbackControlHandle,
3761    )> {
3762        if let SupplicantStaIfaceCallbackRequest::OnDisconnected { payload, control_handle } = self
3763        {
3764            Some((payload, control_handle))
3765        } else {
3766            None
3767        }
3768    }
3769
3770    #[allow(irrefutable_let_patterns)]
3771    pub fn into_on_association_rejected(
3772        self,
3773    ) -> Option<(
3774        SupplicantStaIfaceCallbackOnAssociationRejectedRequest,
3775        SupplicantStaIfaceCallbackControlHandle,
3776    )> {
3777        if let SupplicantStaIfaceCallbackRequest::OnAssociationRejected {
3778            payload,
3779            control_handle,
3780        } = self
3781        {
3782            Some((payload, control_handle))
3783        } else {
3784            None
3785        }
3786    }
3787
3788    /// Name of the method defined in FIDL
3789    pub fn method_name(&self) -> &'static str {
3790        match *self {
3791            SupplicantStaIfaceCallbackRequest::OnStateChanged { .. } => "on_state_changed",
3792            SupplicantStaIfaceCallbackRequest::OnDisconnected { .. } => "on_disconnected",
3793            SupplicantStaIfaceCallbackRequest::OnAssociationRejected { .. } => {
3794                "on_association_rejected"
3795            }
3796            SupplicantStaIfaceCallbackRequest::_UnknownMethod {
3797                method_type: fidl::MethodType::OneWay,
3798                ..
3799            } => "unknown one-way method",
3800            SupplicantStaIfaceCallbackRequest::_UnknownMethod {
3801                method_type: fidl::MethodType::TwoWay,
3802                ..
3803            } => "unknown two-way method",
3804        }
3805    }
3806}
3807
3808#[derive(Debug, Clone)]
3809pub struct SupplicantStaIfaceCallbackControlHandle {
3810    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3811}
3812
3813impl fidl::endpoints::ControlHandle for SupplicantStaIfaceCallbackControlHandle {
3814    fn shutdown(&self) {
3815        self.inner.shutdown()
3816    }
3817    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3818        self.inner.shutdown_with_epitaph(status)
3819    }
3820
3821    fn is_closed(&self) -> bool {
3822        self.inner.channel().is_closed()
3823    }
3824    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3825        self.inner.channel().on_closed()
3826    }
3827
3828    #[cfg(target_os = "fuchsia")]
3829    fn signal_peer(
3830        &self,
3831        clear_mask: zx::Signals,
3832        set_mask: zx::Signals,
3833    ) -> Result<(), zx_status::Status> {
3834        use fidl::Peered;
3835        self.inner.channel().signal_peer(clear_mask, set_mask)
3836    }
3837}
3838
3839impl SupplicantStaIfaceCallbackControlHandle {}
3840
3841#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3842pub struct SupplicantStaNetworkMarker;
3843
3844impl fidl::endpoints::ProtocolMarker for SupplicantStaNetworkMarker {
3845    type Proxy = SupplicantStaNetworkProxy;
3846    type RequestStream = SupplicantStaNetworkRequestStream;
3847    #[cfg(target_os = "fuchsia")]
3848    type SynchronousProxy = SupplicantStaNetworkSynchronousProxy;
3849
3850    const DEBUG_NAME: &'static str = "(anonymous) SupplicantStaNetwork";
3851}
3852pub type SupplicantStaNetworkSelectResult = Result<(), i32>;
3853
3854pub trait SupplicantStaNetworkProxyInterface: Send + Sync {
3855    fn r#set_bssid(&self, payload: &SupplicantStaNetworkSetBssidRequest)
3856    -> Result<(), fidl::Error>;
3857    fn r#clear_bssid(&self) -> Result<(), fidl::Error>;
3858    fn r#set_ssid(&self, payload: &SupplicantStaNetworkSetSsidRequest) -> Result<(), fidl::Error>;
3859    fn r#set_psk_passphrase(
3860        &self,
3861        payload: &SupplicantStaNetworkSetPskPassphraseRequest,
3862    ) -> Result<(), fidl::Error>;
3863    fn r#set_sae_password(
3864        &self,
3865        payload: &SupplicantStaNetworkSetSaePasswordRequest,
3866    ) -> Result<(), fidl::Error>;
3867    fn r#set_wep_key(
3868        &self,
3869        payload: &SupplicantStaNetworkSetWepKeyRequest,
3870    ) -> Result<(), fidl::Error>;
3871    fn r#set_wep_tx_key_idx(
3872        &self,
3873        payload: &SupplicantStaNetworkSetWepTxKeyIdxRequest,
3874    ) -> Result<(), fidl::Error>;
3875    type SelectResponseFut: std::future::Future<Output = Result<SupplicantStaNetworkSelectResult, fidl::Error>>
3876        + Send;
3877    fn r#select(&self) -> Self::SelectResponseFut;
3878}
3879#[derive(Debug)]
3880#[cfg(target_os = "fuchsia")]
3881pub struct SupplicantStaNetworkSynchronousProxy {
3882    client: fidl::client::sync::Client,
3883}
3884
3885#[cfg(target_os = "fuchsia")]
3886impl fidl::endpoints::SynchronousProxy for SupplicantStaNetworkSynchronousProxy {
3887    type Proxy = SupplicantStaNetworkProxy;
3888    type Protocol = SupplicantStaNetworkMarker;
3889
3890    fn from_channel(inner: fidl::Channel) -> Self {
3891        Self::new(inner)
3892    }
3893
3894    fn into_channel(self) -> fidl::Channel {
3895        self.client.into_channel()
3896    }
3897
3898    fn as_channel(&self) -> &fidl::Channel {
3899        self.client.as_channel()
3900    }
3901}
3902
3903#[cfg(target_os = "fuchsia")]
3904impl SupplicantStaNetworkSynchronousProxy {
3905    pub fn new(channel: fidl::Channel) -> Self {
3906        let protocol_name =
3907            <SupplicantStaNetworkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3908        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3909    }
3910
3911    pub fn into_channel(self) -> fidl::Channel {
3912        self.client.into_channel()
3913    }
3914
3915    /// Waits until an event arrives and returns it. It is safe for other
3916    /// threads to make concurrent requests while waiting for an event.
3917    pub fn wait_for_event(
3918        &self,
3919        deadline: zx::MonotonicInstant,
3920    ) -> Result<SupplicantStaNetworkEvent, fidl::Error> {
3921        SupplicantStaNetworkEvent::decode(self.client.wait_for_event(deadline)?)
3922    }
3923
3924    pub fn r#set_bssid(
3925        &self,
3926        mut payload: &SupplicantStaNetworkSetBssidRequest,
3927    ) -> Result<(), fidl::Error> {
3928        self.client.send::<SupplicantStaNetworkSetBssidRequest>(
3929            payload,
3930            0x10a91d044ee6374d,
3931            fidl::encoding::DynamicFlags::FLEXIBLE,
3932        )
3933    }
3934
3935    pub fn r#clear_bssid(&self) -> Result<(), fidl::Error> {
3936        self.client.send::<fidl::encoding::EmptyPayload>(
3937            (),
3938            0xbc7ad82f541b267,
3939            fidl::encoding::DynamicFlags::FLEXIBLE,
3940        )
3941    }
3942
3943    pub fn r#set_ssid(
3944        &self,
3945        mut payload: &SupplicantStaNetworkSetSsidRequest,
3946    ) -> Result<(), fidl::Error> {
3947        self.client.send::<SupplicantStaNetworkSetSsidRequest>(
3948            payload,
3949            0x6b598a7a802e3083,
3950            fidl::encoding::DynamicFlags::FLEXIBLE,
3951        )
3952    }
3953
3954    pub fn r#set_psk_passphrase(
3955        &self,
3956        mut payload: &SupplicantStaNetworkSetPskPassphraseRequest,
3957    ) -> Result<(), fidl::Error> {
3958        self.client.send::<SupplicantStaNetworkSetPskPassphraseRequest>(
3959            payload,
3960            0xf6d438225979307,
3961            fidl::encoding::DynamicFlags::FLEXIBLE,
3962        )
3963    }
3964
3965    pub fn r#set_sae_password(
3966        &self,
3967        mut payload: &SupplicantStaNetworkSetSaePasswordRequest,
3968    ) -> Result<(), fidl::Error> {
3969        self.client.send::<SupplicantStaNetworkSetSaePasswordRequest>(
3970            payload,
3971            0x2982737e196747b8,
3972            fidl::encoding::DynamicFlags::FLEXIBLE,
3973        )
3974    }
3975
3976    pub fn r#set_wep_key(
3977        &self,
3978        mut payload: &SupplicantStaNetworkSetWepKeyRequest,
3979    ) -> Result<(), fidl::Error> {
3980        self.client.send::<SupplicantStaNetworkSetWepKeyRequest>(
3981            payload,
3982            0x22a7e25ec81f2dee,
3983            fidl::encoding::DynamicFlags::FLEXIBLE,
3984        )
3985    }
3986
3987    /// Designate the key to use for the WEP connection based on its index. The key should have
3988    /// been previously set with SetWepKey.
3989    pub fn r#set_wep_tx_key_idx(
3990        &self,
3991        mut payload: &SupplicantStaNetworkSetWepTxKeyIdxRequest,
3992    ) -> Result<(), fidl::Error> {
3993        self.client.send::<SupplicantStaNetworkSetWepTxKeyIdxRequest>(
3994            payload,
3995            0x4f25576c21fcb8cb,
3996            fidl::encoding::DynamicFlags::FLEXIBLE,
3997        )
3998    }
3999
4000    pub fn r#select(
4001        &self,
4002        ___deadline: zx::MonotonicInstant,
4003    ) -> Result<SupplicantStaNetworkSelectResult, fidl::Error> {
4004        let _response = self.client.send_query::<
4005            fidl::encoding::EmptyPayload,
4006            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
4007        >(
4008            (),
4009            0x354bc361a0c77b45,
4010            fidl::encoding::DynamicFlags::FLEXIBLE,
4011            ___deadline,
4012        )?
4013        .into_result::<SupplicantStaNetworkMarker>("select")?;
4014        Ok(_response.map(|x| x))
4015    }
4016}
4017
4018#[cfg(target_os = "fuchsia")]
4019impl From<SupplicantStaNetworkSynchronousProxy> for zx::Handle {
4020    fn from(value: SupplicantStaNetworkSynchronousProxy) -> Self {
4021        value.into_channel().into()
4022    }
4023}
4024
4025#[cfg(target_os = "fuchsia")]
4026impl From<fidl::Channel> for SupplicantStaNetworkSynchronousProxy {
4027    fn from(value: fidl::Channel) -> Self {
4028        Self::new(value)
4029    }
4030}
4031
4032#[cfg(target_os = "fuchsia")]
4033impl fidl::endpoints::FromClient for SupplicantStaNetworkSynchronousProxy {
4034    type Protocol = SupplicantStaNetworkMarker;
4035
4036    fn from_client(value: fidl::endpoints::ClientEnd<SupplicantStaNetworkMarker>) -> Self {
4037        Self::new(value.into_channel())
4038    }
4039}
4040
4041#[derive(Debug, Clone)]
4042pub struct SupplicantStaNetworkProxy {
4043    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4044}
4045
4046impl fidl::endpoints::Proxy for SupplicantStaNetworkProxy {
4047    type Protocol = SupplicantStaNetworkMarker;
4048
4049    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4050        Self::new(inner)
4051    }
4052
4053    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4054        self.client.into_channel().map_err(|client| Self { client })
4055    }
4056
4057    fn as_channel(&self) -> &::fidl::AsyncChannel {
4058        self.client.as_channel()
4059    }
4060}
4061
4062impl SupplicantStaNetworkProxy {
4063    /// Create a new Proxy for fuchsia.wlan.wlanix/SupplicantStaNetwork.
4064    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4065        let protocol_name =
4066            <SupplicantStaNetworkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4067        Self { client: fidl::client::Client::new(channel, protocol_name) }
4068    }
4069
4070    /// Get a Stream of events from the remote end of the protocol.
4071    ///
4072    /// # Panics
4073    ///
4074    /// Panics if the event stream was already taken.
4075    pub fn take_event_stream(&self) -> SupplicantStaNetworkEventStream {
4076        SupplicantStaNetworkEventStream { event_receiver: self.client.take_event_receiver() }
4077    }
4078
4079    pub fn r#set_bssid(
4080        &self,
4081        mut payload: &SupplicantStaNetworkSetBssidRequest,
4082    ) -> Result<(), fidl::Error> {
4083        SupplicantStaNetworkProxyInterface::r#set_bssid(self, payload)
4084    }
4085
4086    pub fn r#clear_bssid(&self) -> Result<(), fidl::Error> {
4087        SupplicantStaNetworkProxyInterface::r#clear_bssid(self)
4088    }
4089
4090    pub fn r#set_ssid(
4091        &self,
4092        mut payload: &SupplicantStaNetworkSetSsidRequest,
4093    ) -> Result<(), fidl::Error> {
4094        SupplicantStaNetworkProxyInterface::r#set_ssid(self, payload)
4095    }
4096
4097    pub fn r#set_psk_passphrase(
4098        &self,
4099        mut payload: &SupplicantStaNetworkSetPskPassphraseRequest,
4100    ) -> Result<(), fidl::Error> {
4101        SupplicantStaNetworkProxyInterface::r#set_psk_passphrase(self, payload)
4102    }
4103
4104    pub fn r#set_sae_password(
4105        &self,
4106        mut payload: &SupplicantStaNetworkSetSaePasswordRequest,
4107    ) -> Result<(), fidl::Error> {
4108        SupplicantStaNetworkProxyInterface::r#set_sae_password(self, payload)
4109    }
4110
4111    pub fn r#set_wep_key(
4112        &self,
4113        mut payload: &SupplicantStaNetworkSetWepKeyRequest,
4114    ) -> Result<(), fidl::Error> {
4115        SupplicantStaNetworkProxyInterface::r#set_wep_key(self, payload)
4116    }
4117
4118    /// Designate the key to use for the WEP connection based on its index. The key should have
4119    /// been previously set with SetWepKey.
4120    pub fn r#set_wep_tx_key_idx(
4121        &self,
4122        mut payload: &SupplicantStaNetworkSetWepTxKeyIdxRequest,
4123    ) -> Result<(), fidl::Error> {
4124        SupplicantStaNetworkProxyInterface::r#set_wep_tx_key_idx(self, payload)
4125    }
4126
4127    pub fn r#select(
4128        &self,
4129    ) -> fidl::client::QueryResponseFut<
4130        SupplicantStaNetworkSelectResult,
4131        fidl::encoding::DefaultFuchsiaResourceDialect,
4132    > {
4133        SupplicantStaNetworkProxyInterface::r#select(self)
4134    }
4135}
4136
4137impl SupplicantStaNetworkProxyInterface for SupplicantStaNetworkProxy {
4138    fn r#set_bssid(
4139        &self,
4140        mut payload: &SupplicantStaNetworkSetBssidRequest,
4141    ) -> Result<(), fidl::Error> {
4142        self.client.send::<SupplicantStaNetworkSetBssidRequest>(
4143            payload,
4144            0x10a91d044ee6374d,
4145            fidl::encoding::DynamicFlags::FLEXIBLE,
4146        )
4147    }
4148
4149    fn r#clear_bssid(&self) -> Result<(), fidl::Error> {
4150        self.client.send::<fidl::encoding::EmptyPayload>(
4151            (),
4152            0xbc7ad82f541b267,
4153            fidl::encoding::DynamicFlags::FLEXIBLE,
4154        )
4155    }
4156
4157    fn r#set_ssid(
4158        &self,
4159        mut payload: &SupplicantStaNetworkSetSsidRequest,
4160    ) -> Result<(), fidl::Error> {
4161        self.client.send::<SupplicantStaNetworkSetSsidRequest>(
4162            payload,
4163            0x6b598a7a802e3083,
4164            fidl::encoding::DynamicFlags::FLEXIBLE,
4165        )
4166    }
4167
4168    fn r#set_psk_passphrase(
4169        &self,
4170        mut payload: &SupplicantStaNetworkSetPskPassphraseRequest,
4171    ) -> Result<(), fidl::Error> {
4172        self.client.send::<SupplicantStaNetworkSetPskPassphraseRequest>(
4173            payload,
4174            0xf6d438225979307,
4175            fidl::encoding::DynamicFlags::FLEXIBLE,
4176        )
4177    }
4178
4179    fn r#set_sae_password(
4180        &self,
4181        mut payload: &SupplicantStaNetworkSetSaePasswordRequest,
4182    ) -> Result<(), fidl::Error> {
4183        self.client.send::<SupplicantStaNetworkSetSaePasswordRequest>(
4184            payload,
4185            0x2982737e196747b8,
4186            fidl::encoding::DynamicFlags::FLEXIBLE,
4187        )
4188    }
4189
4190    fn r#set_wep_key(
4191        &self,
4192        mut payload: &SupplicantStaNetworkSetWepKeyRequest,
4193    ) -> Result<(), fidl::Error> {
4194        self.client.send::<SupplicantStaNetworkSetWepKeyRequest>(
4195            payload,
4196            0x22a7e25ec81f2dee,
4197            fidl::encoding::DynamicFlags::FLEXIBLE,
4198        )
4199    }
4200
4201    fn r#set_wep_tx_key_idx(
4202        &self,
4203        mut payload: &SupplicantStaNetworkSetWepTxKeyIdxRequest,
4204    ) -> Result<(), fidl::Error> {
4205        self.client.send::<SupplicantStaNetworkSetWepTxKeyIdxRequest>(
4206            payload,
4207            0x4f25576c21fcb8cb,
4208            fidl::encoding::DynamicFlags::FLEXIBLE,
4209        )
4210    }
4211
4212    type SelectResponseFut = fidl::client::QueryResponseFut<
4213        SupplicantStaNetworkSelectResult,
4214        fidl::encoding::DefaultFuchsiaResourceDialect,
4215    >;
4216    fn r#select(&self) -> Self::SelectResponseFut {
4217        fn _decode(
4218            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4219        ) -> Result<SupplicantStaNetworkSelectResult, fidl::Error> {
4220            let _response = fidl::client::decode_transaction_body::<
4221                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
4222                fidl::encoding::DefaultFuchsiaResourceDialect,
4223                0x354bc361a0c77b45,
4224            >(_buf?)?
4225            .into_result::<SupplicantStaNetworkMarker>("select")?;
4226            Ok(_response.map(|x| x))
4227        }
4228        self.client.send_query_and_decode::<
4229            fidl::encoding::EmptyPayload,
4230            SupplicantStaNetworkSelectResult,
4231        >(
4232            (),
4233            0x354bc361a0c77b45,
4234            fidl::encoding::DynamicFlags::FLEXIBLE,
4235            _decode,
4236        )
4237    }
4238}
4239
4240pub struct SupplicantStaNetworkEventStream {
4241    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4242}
4243
4244impl std::marker::Unpin for SupplicantStaNetworkEventStream {}
4245
4246impl futures::stream::FusedStream for SupplicantStaNetworkEventStream {
4247    fn is_terminated(&self) -> bool {
4248        self.event_receiver.is_terminated()
4249    }
4250}
4251
4252impl futures::Stream for SupplicantStaNetworkEventStream {
4253    type Item = Result<SupplicantStaNetworkEvent, fidl::Error>;
4254
4255    fn poll_next(
4256        mut self: std::pin::Pin<&mut Self>,
4257        cx: &mut std::task::Context<'_>,
4258    ) -> std::task::Poll<Option<Self::Item>> {
4259        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4260            &mut self.event_receiver,
4261            cx
4262        )?) {
4263            Some(buf) => std::task::Poll::Ready(Some(SupplicantStaNetworkEvent::decode(buf))),
4264            None => std::task::Poll::Ready(None),
4265        }
4266    }
4267}
4268
4269#[derive(Debug)]
4270pub enum SupplicantStaNetworkEvent {
4271    #[non_exhaustive]
4272    _UnknownEvent {
4273        /// Ordinal of the event that was sent.
4274        ordinal: u64,
4275    },
4276}
4277
4278impl SupplicantStaNetworkEvent {
4279    /// Decodes a message buffer as a [`SupplicantStaNetworkEvent`].
4280    fn decode(
4281        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4282    ) -> Result<SupplicantStaNetworkEvent, fidl::Error> {
4283        let (bytes, _handles) = buf.split_mut();
4284        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4285        debug_assert_eq!(tx_header.tx_id, 0);
4286        match tx_header.ordinal {
4287            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4288                Ok(SupplicantStaNetworkEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4289            }
4290            _ => Err(fidl::Error::UnknownOrdinal {
4291                ordinal: tx_header.ordinal,
4292                protocol_name:
4293                    <SupplicantStaNetworkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4294            }),
4295        }
4296    }
4297}
4298
4299/// A Stream of incoming requests for fuchsia.wlan.wlanix/SupplicantStaNetwork.
4300pub struct SupplicantStaNetworkRequestStream {
4301    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4302    is_terminated: bool,
4303}
4304
4305impl std::marker::Unpin for SupplicantStaNetworkRequestStream {}
4306
4307impl futures::stream::FusedStream for SupplicantStaNetworkRequestStream {
4308    fn is_terminated(&self) -> bool {
4309        self.is_terminated
4310    }
4311}
4312
4313impl fidl::endpoints::RequestStream for SupplicantStaNetworkRequestStream {
4314    type Protocol = SupplicantStaNetworkMarker;
4315    type ControlHandle = SupplicantStaNetworkControlHandle;
4316
4317    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4318        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4319    }
4320
4321    fn control_handle(&self) -> Self::ControlHandle {
4322        SupplicantStaNetworkControlHandle { inner: self.inner.clone() }
4323    }
4324
4325    fn into_inner(
4326        self,
4327    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4328    {
4329        (self.inner, self.is_terminated)
4330    }
4331
4332    fn from_inner(
4333        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4334        is_terminated: bool,
4335    ) -> Self {
4336        Self { inner, is_terminated }
4337    }
4338}
4339
4340impl futures::Stream for SupplicantStaNetworkRequestStream {
4341    type Item = Result<SupplicantStaNetworkRequest, fidl::Error>;
4342
4343    fn poll_next(
4344        mut self: std::pin::Pin<&mut Self>,
4345        cx: &mut std::task::Context<'_>,
4346    ) -> std::task::Poll<Option<Self::Item>> {
4347        let this = &mut *self;
4348        if this.inner.check_shutdown(cx) {
4349            this.is_terminated = true;
4350            return std::task::Poll::Ready(None);
4351        }
4352        if this.is_terminated {
4353            panic!("polled SupplicantStaNetworkRequestStream after completion");
4354        }
4355        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4356            |bytes, handles| {
4357                match this.inner.channel().read_etc(cx, bytes, handles) {
4358                    std::task::Poll::Ready(Ok(())) => {}
4359                    std::task::Poll::Pending => return std::task::Poll::Pending,
4360                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4361                        this.is_terminated = true;
4362                        return std::task::Poll::Ready(None);
4363                    }
4364                    std::task::Poll::Ready(Err(e)) => {
4365                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4366                            e.into(),
4367                        ))));
4368                    }
4369                }
4370
4371                // A message has been received from the channel
4372                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4373
4374                std::task::Poll::Ready(Some(match header.ordinal {
4375                0x10a91d044ee6374d => {
4376                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4377                    let mut req = fidl::new_empty!(SupplicantStaNetworkSetBssidRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4378                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantStaNetworkSetBssidRequest>(&header, _body_bytes, handles, &mut req)?;
4379                    let control_handle = SupplicantStaNetworkControlHandle {
4380                        inner: this.inner.clone(),
4381                    };
4382                    Ok(SupplicantStaNetworkRequest::SetBssid {payload: req,
4383                        control_handle,
4384                    })
4385                }
4386                0xbc7ad82f541b267 => {
4387                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4388                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
4389                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4390                    let control_handle = SupplicantStaNetworkControlHandle {
4391                        inner: this.inner.clone(),
4392                    };
4393                    Ok(SupplicantStaNetworkRequest::ClearBssid {
4394                        control_handle,
4395                    })
4396                }
4397                0x6b598a7a802e3083 => {
4398                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4399                    let mut req = fidl::new_empty!(SupplicantStaNetworkSetSsidRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4400                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantStaNetworkSetSsidRequest>(&header, _body_bytes, handles, &mut req)?;
4401                    let control_handle = SupplicantStaNetworkControlHandle {
4402                        inner: this.inner.clone(),
4403                    };
4404                    Ok(SupplicantStaNetworkRequest::SetSsid {payload: req,
4405                        control_handle,
4406                    })
4407                }
4408                0xf6d438225979307 => {
4409                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4410                    let mut req = fidl::new_empty!(SupplicantStaNetworkSetPskPassphraseRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4411                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantStaNetworkSetPskPassphraseRequest>(&header, _body_bytes, handles, &mut req)?;
4412                    let control_handle = SupplicantStaNetworkControlHandle {
4413                        inner: this.inner.clone(),
4414                    };
4415                    Ok(SupplicantStaNetworkRequest::SetPskPassphrase {payload: req,
4416                        control_handle,
4417                    })
4418                }
4419                0x2982737e196747b8 => {
4420                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4421                    let mut req = fidl::new_empty!(SupplicantStaNetworkSetSaePasswordRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4422                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantStaNetworkSetSaePasswordRequest>(&header, _body_bytes, handles, &mut req)?;
4423                    let control_handle = SupplicantStaNetworkControlHandle {
4424                        inner: this.inner.clone(),
4425                    };
4426                    Ok(SupplicantStaNetworkRequest::SetSaePassword {payload: req,
4427                        control_handle,
4428                    })
4429                }
4430                0x22a7e25ec81f2dee => {
4431                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4432                    let mut req = fidl::new_empty!(SupplicantStaNetworkSetWepKeyRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4433                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantStaNetworkSetWepKeyRequest>(&header, _body_bytes, handles, &mut req)?;
4434                    let control_handle = SupplicantStaNetworkControlHandle {
4435                        inner: this.inner.clone(),
4436                    };
4437                    Ok(SupplicantStaNetworkRequest::SetWepKey {payload: req,
4438                        control_handle,
4439                    })
4440                }
4441                0x4f25576c21fcb8cb => {
4442                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4443                    let mut req = fidl::new_empty!(SupplicantStaNetworkSetWepTxKeyIdxRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4444                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantStaNetworkSetWepTxKeyIdxRequest>(&header, _body_bytes, handles, &mut req)?;
4445                    let control_handle = SupplicantStaNetworkControlHandle {
4446                        inner: this.inner.clone(),
4447                    };
4448                    Ok(SupplicantStaNetworkRequest::SetWepTxKeyIdx {payload: req,
4449                        control_handle,
4450                    })
4451                }
4452                0x354bc361a0c77b45 => {
4453                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4454                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
4455                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4456                    let control_handle = SupplicantStaNetworkControlHandle {
4457                        inner: this.inner.clone(),
4458                    };
4459                    Ok(SupplicantStaNetworkRequest::Select {
4460                        responder: SupplicantStaNetworkSelectResponder {
4461                            control_handle: std::mem::ManuallyDrop::new(control_handle),
4462                            tx_id: header.tx_id,
4463                        },
4464                    })
4465                }
4466                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4467                    Ok(SupplicantStaNetworkRequest::_UnknownMethod {
4468                        ordinal: header.ordinal,
4469                        control_handle: SupplicantStaNetworkControlHandle { inner: this.inner.clone() },
4470                        method_type: fidl::MethodType::OneWay,
4471                    })
4472                }
4473                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4474                    this.inner.send_framework_err(
4475                        fidl::encoding::FrameworkErr::UnknownMethod,
4476                        header.tx_id,
4477                        header.ordinal,
4478                        header.dynamic_flags(),
4479                        (bytes, handles),
4480                    )?;
4481                    Ok(SupplicantStaNetworkRequest::_UnknownMethod {
4482                        ordinal: header.ordinal,
4483                        control_handle: SupplicantStaNetworkControlHandle { inner: this.inner.clone() },
4484                        method_type: fidl::MethodType::TwoWay,
4485                    })
4486                }
4487                _ => Err(fidl::Error::UnknownOrdinal {
4488                    ordinal: header.ordinal,
4489                    protocol_name: <SupplicantStaNetworkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4490                }),
4491            }))
4492            },
4493        )
4494    }
4495}
4496
4497#[derive(Debug)]
4498pub enum SupplicantStaNetworkRequest {
4499    SetBssid {
4500        payload: SupplicantStaNetworkSetBssidRequest,
4501        control_handle: SupplicantStaNetworkControlHandle,
4502    },
4503    ClearBssid {
4504        control_handle: SupplicantStaNetworkControlHandle,
4505    },
4506    SetSsid {
4507        payload: SupplicantStaNetworkSetSsidRequest,
4508        control_handle: SupplicantStaNetworkControlHandle,
4509    },
4510    SetPskPassphrase {
4511        payload: SupplicantStaNetworkSetPskPassphraseRequest,
4512        control_handle: SupplicantStaNetworkControlHandle,
4513    },
4514    SetSaePassword {
4515        payload: SupplicantStaNetworkSetSaePasswordRequest,
4516        control_handle: SupplicantStaNetworkControlHandle,
4517    },
4518    SetWepKey {
4519        payload: SupplicantStaNetworkSetWepKeyRequest,
4520        control_handle: SupplicantStaNetworkControlHandle,
4521    },
4522    /// Designate the key to use for the WEP connection based on its index. The key should have
4523    /// been previously set with SetWepKey.
4524    SetWepTxKeyIdx {
4525        payload: SupplicantStaNetworkSetWepTxKeyIdxRequest,
4526        control_handle: SupplicantStaNetworkControlHandle,
4527    },
4528    Select {
4529        responder: SupplicantStaNetworkSelectResponder,
4530    },
4531    /// An interaction was received which does not match any known method.
4532    #[non_exhaustive]
4533    _UnknownMethod {
4534        /// Ordinal of the method that was called.
4535        ordinal: u64,
4536        control_handle: SupplicantStaNetworkControlHandle,
4537        method_type: fidl::MethodType,
4538    },
4539}
4540
4541impl SupplicantStaNetworkRequest {
4542    #[allow(irrefutable_let_patterns)]
4543    pub fn into_set_bssid(
4544        self,
4545    ) -> Option<(SupplicantStaNetworkSetBssidRequest, SupplicantStaNetworkControlHandle)> {
4546        if let SupplicantStaNetworkRequest::SetBssid { payload, control_handle } = self {
4547            Some((payload, control_handle))
4548        } else {
4549            None
4550        }
4551    }
4552
4553    #[allow(irrefutable_let_patterns)]
4554    pub fn into_clear_bssid(self) -> Option<(SupplicantStaNetworkControlHandle)> {
4555        if let SupplicantStaNetworkRequest::ClearBssid { control_handle } = self {
4556            Some((control_handle))
4557        } else {
4558            None
4559        }
4560    }
4561
4562    #[allow(irrefutable_let_patterns)]
4563    pub fn into_set_ssid(
4564        self,
4565    ) -> Option<(SupplicantStaNetworkSetSsidRequest, SupplicantStaNetworkControlHandle)> {
4566        if let SupplicantStaNetworkRequest::SetSsid { payload, control_handle } = self {
4567            Some((payload, control_handle))
4568        } else {
4569            None
4570        }
4571    }
4572
4573    #[allow(irrefutable_let_patterns)]
4574    pub fn into_set_psk_passphrase(
4575        self,
4576    ) -> Option<(SupplicantStaNetworkSetPskPassphraseRequest, SupplicantStaNetworkControlHandle)>
4577    {
4578        if let SupplicantStaNetworkRequest::SetPskPassphrase { payload, control_handle } = self {
4579            Some((payload, control_handle))
4580        } else {
4581            None
4582        }
4583    }
4584
4585    #[allow(irrefutable_let_patterns)]
4586    pub fn into_set_sae_password(
4587        self,
4588    ) -> Option<(SupplicantStaNetworkSetSaePasswordRequest, SupplicantStaNetworkControlHandle)>
4589    {
4590        if let SupplicantStaNetworkRequest::SetSaePassword { payload, control_handle } = self {
4591            Some((payload, control_handle))
4592        } else {
4593            None
4594        }
4595    }
4596
4597    #[allow(irrefutable_let_patterns)]
4598    pub fn into_set_wep_key(
4599        self,
4600    ) -> Option<(SupplicantStaNetworkSetWepKeyRequest, SupplicantStaNetworkControlHandle)> {
4601        if let SupplicantStaNetworkRequest::SetWepKey { payload, control_handle } = self {
4602            Some((payload, control_handle))
4603        } else {
4604            None
4605        }
4606    }
4607
4608    #[allow(irrefutable_let_patterns)]
4609    pub fn into_set_wep_tx_key_idx(
4610        self,
4611    ) -> Option<(SupplicantStaNetworkSetWepTxKeyIdxRequest, SupplicantStaNetworkControlHandle)>
4612    {
4613        if let SupplicantStaNetworkRequest::SetWepTxKeyIdx { payload, control_handle } = self {
4614            Some((payload, control_handle))
4615        } else {
4616            None
4617        }
4618    }
4619
4620    #[allow(irrefutable_let_patterns)]
4621    pub fn into_select(self) -> Option<(SupplicantStaNetworkSelectResponder)> {
4622        if let SupplicantStaNetworkRequest::Select { responder } = self {
4623            Some((responder))
4624        } else {
4625            None
4626        }
4627    }
4628
4629    /// Name of the method defined in FIDL
4630    pub fn method_name(&self) -> &'static str {
4631        match *self {
4632            SupplicantStaNetworkRequest::SetBssid { .. } => "set_bssid",
4633            SupplicantStaNetworkRequest::ClearBssid { .. } => "clear_bssid",
4634            SupplicantStaNetworkRequest::SetSsid { .. } => "set_ssid",
4635            SupplicantStaNetworkRequest::SetPskPassphrase { .. } => "set_psk_passphrase",
4636            SupplicantStaNetworkRequest::SetSaePassword { .. } => "set_sae_password",
4637            SupplicantStaNetworkRequest::SetWepKey { .. } => "set_wep_key",
4638            SupplicantStaNetworkRequest::SetWepTxKeyIdx { .. } => "set_wep_tx_key_idx",
4639            SupplicantStaNetworkRequest::Select { .. } => "select",
4640            SupplicantStaNetworkRequest::_UnknownMethod {
4641                method_type: fidl::MethodType::OneWay,
4642                ..
4643            } => "unknown one-way method",
4644            SupplicantStaNetworkRequest::_UnknownMethod {
4645                method_type: fidl::MethodType::TwoWay,
4646                ..
4647            } => "unknown two-way method",
4648        }
4649    }
4650}
4651
4652#[derive(Debug, Clone)]
4653pub struct SupplicantStaNetworkControlHandle {
4654    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4655}
4656
4657impl fidl::endpoints::ControlHandle for SupplicantStaNetworkControlHandle {
4658    fn shutdown(&self) {
4659        self.inner.shutdown()
4660    }
4661    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4662        self.inner.shutdown_with_epitaph(status)
4663    }
4664
4665    fn is_closed(&self) -> bool {
4666        self.inner.channel().is_closed()
4667    }
4668    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4669        self.inner.channel().on_closed()
4670    }
4671
4672    #[cfg(target_os = "fuchsia")]
4673    fn signal_peer(
4674        &self,
4675        clear_mask: zx::Signals,
4676        set_mask: zx::Signals,
4677    ) -> Result<(), zx_status::Status> {
4678        use fidl::Peered;
4679        self.inner.channel().signal_peer(clear_mask, set_mask)
4680    }
4681}
4682
4683impl SupplicantStaNetworkControlHandle {}
4684
4685#[must_use = "FIDL methods require a response to be sent"]
4686#[derive(Debug)]
4687pub struct SupplicantStaNetworkSelectResponder {
4688    control_handle: std::mem::ManuallyDrop<SupplicantStaNetworkControlHandle>,
4689    tx_id: u32,
4690}
4691
4692/// Set the the channel to be shutdown (see [`SupplicantStaNetworkControlHandle::shutdown`])
4693/// if the responder is dropped without sending a response, so that the client
4694/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4695impl std::ops::Drop for SupplicantStaNetworkSelectResponder {
4696    fn drop(&mut self) {
4697        self.control_handle.shutdown();
4698        // Safety: drops once, never accessed again
4699        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4700    }
4701}
4702
4703impl fidl::endpoints::Responder for SupplicantStaNetworkSelectResponder {
4704    type ControlHandle = SupplicantStaNetworkControlHandle;
4705
4706    fn control_handle(&self) -> &SupplicantStaNetworkControlHandle {
4707        &self.control_handle
4708    }
4709
4710    fn drop_without_shutdown(mut self) {
4711        // Safety: drops once, never accessed again due to mem::forget
4712        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4713        // Prevent Drop from running (which would shut down the channel)
4714        std::mem::forget(self);
4715    }
4716}
4717
4718impl SupplicantStaNetworkSelectResponder {
4719    /// Sends a response to the FIDL transaction.
4720    ///
4721    /// Sets the channel to shutdown if an error occurs.
4722    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4723        let _result = self.send_raw(result);
4724        if _result.is_err() {
4725            self.control_handle.shutdown();
4726        }
4727        self.drop_without_shutdown();
4728        _result
4729    }
4730
4731    /// Similar to "send" but does not shutdown the channel if an error occurs.
4732    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4733        let _result = self.send_raw(result);
4734        self.drop_without_shutdown();
4735        _result
4736    }
4737
4738    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4739        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4740            fidl::encoding::EmptyStruct,
4741            i32,
4742        >>(
4743            fidl::encoding::FlexibleResult::new(result),
4744            self.tx_id,
4745            0x354bc361a0c77b45,
4746            fidl::encoding::DynamicFlags::FLEXIBLE,
4747        )
4748    }
4749}
4750
4751#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4752pub struct WifiMarker;
4753
4754impl fidl::endpoints::ProtocolMarker for WifiMarker {
4755    type Proxy = WifiProxy;
4756    type RequestStream = WifiRequestStream;
4757    #[cfg(target_os = "fuchsia")]
4758    type SynchronousProxy = WifiSynchronousProxy;
4759
4760    const DEBUG_NAME: &'static str = "(anonymous) Wifi";
4761}
4762pub type WifiStartResult = Result<(), i32>;
4763pub type WifiStopResult = Result<(), i32>;
4764pub type WifiGetChipResult = Result<(), i32>;
4765
4766pub trait WifiProxyInterface: Send + Sync {
4767    fn r#register_event_callback(
4768        &self,
4769        payload: WifiRegisterEventCallbackRequest,
4770    ) -> Result<(), fidl::Error>;
4771    type StartResponseFut: std::future::Future<Output = Result<WifiStartResult, fidl::Error>> + Send;
4772    fn r#start(&self) -> Self::StartResponseFut;
4773    type StopResponseFut: std::future::Future<Output = Result<WifiStopResult, fidl::Error>> + Send;
4774    fn r#stop(&self) -> Self::StopResponseFut;
4775    type GetStateResponseFut: std::future::Future<Output = Result<WifiGetStateResponse, fidl::Error>>
4776        + Send;
4777    fn r#get_state(&self) -> Self::GetStateResponseFut;
4778    type GetChipIdsResponseFut: std::future::Future<Output = Result<WifiGetChipIdsResponse, fidl::Error>>
4779        + Send;
4780    fn r#get_chip_ids(&self) -> Self::GetChipIdsResponseFut;
4781    type GetChipResponseFut: std::future::Future<Output = Result<WifiGetChipResult, fidl::Error>>
4782        + Send;
4783    fn r#get_chip(&self, payload: WifiGetChipRequest) -> Self::GetChipResponseFut;
4784}
4785#[derive(Debug)]
4786#[cfg(target_os = "fuchsia")]
4787pub struct WifiSynchronousProxy {
4788    client: fidl::client::sync::Client,
4789}
4790
4791#[cfg(target_os = "fuchsia")]
4792impl fidl::endpoints::SynchronousProxy for WifiSynchronousProxy {
4793    type Proxy = WifiProxy;
4794    type Protocol = WifiMarker;
4795
4796    fn from_channel(inner: fidl::Channel) -> Self {
4797        Self::new(inner)
4798    }
4799
4800    fn into_channel(self) -> fidl::Channel {
4801        self.client.into_channel()
4802    }
4803
4804    fn as_channel(&self) -> &fidl::Channel {
4805        self.client.as_channel()
4806    }
4807}
4808
4809#[cfg(target_os = "fuchsia")]
4810impl WifiSynchronousProxy {
4811    pub fn new(channel: fidl::Channel) -> Self {
4812        let protocol_name = <WifiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4813        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4814    }
4815
4816    pub fn into_channel(self) -> fidl::Channel {
4817        self.client.into_channel()
4818    }
4819
4820    /// Waits until an event arrives and returns it. It is safe for other
4821    /// threads to make concurrent requests while waiting for an event.
4822    pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<WifiEvent, fidl::Error> {
4823        WifiEvent::decode(self.client.wait_for_event(deadline)?)
4824    }
4825
4826    /// Register a callback to be notified of future events (such when WiFi has
4827    /// started or stopped)
4828    pub fn r#register_event_callback(
4829        &self,
4830        mut payload: WifiRegisterEventCallbackRequest,
4831    ) -> Result<(), fidl::Error> {
4832        self.client.send::<WifiRegisterEventCallbackRequest>(
4833            &mut payload,
4834            0x12abbdea948dd67b,
4835            fidl::encoding::DynamicFlags::FLEXIBLE,
4836        )
4837    }
4838
4839    /// Start WiFi. If this operation is not successful, return an error status.
4840    /// If this operation is successful, the `started` state is now true and all
4841    /// registered callbacks will be notified with an `OnStart` event.
4842    pub fn r#start(
4843        &self,
4844        ___deadline: zx::MonotonicInstant,
4845    ) -> Result<WifiStartResult, fidl::Error> {
4846        let _response = self.client.send_query::<
4847            fidl::encoding::EmptyPayload,
4848            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
4849        >(
4850            (),
4851            0x427030e4dc6ec07a,
4852            fidl::encoding::DynamicFlags::FLEXIBLE,
4853            ___deadline,
4854        )?
4855        .into_result::<WifiMarker>("start")?;
4856        Ok(_response.map(|x| x))
4857    }
4858
4859    /// Stop WiFi. If this operation is not successful, return an error status.
4860    /// If this operation is successful, the `started` state is now false and all
4861    /// registered callbacks will be notified with an `OnStop` event.
4862    pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<WifiStopResult, fidl::Error> {
4863        let _response = self.client.send_query::<
4864            fidl::encoding::EmptyPayload,
4865            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
4866        >(
4867            (),
4868            0x67c9bdf61b2888d,
4869            fidl::encoding::DynamicFlags::FLEXIBLE,
4870            ___deadline,
4871        )?
4872        .into_result::<WifiMarker>("stop")?;
4873        Ok(_response.map(|x| x))
4874    }
4875
4876    /// Return a boolean based on whether WiFi is `started` or not.
4877    pub fn r#get_state(
4878        &self,
4879        ___deadline: zx::MonotonicInstant,
4880    ) -> Result<WifiGetStateResponse, fidl::Error> {
4881        let _response = self.client.send_query::<
4882            fidl::encoding::EmptyPayload,
4883            fidl::encoding::FlexibleType<WifiGetStateResponse>,
4884        >(
4885            (),
4886            0x4616114a937d1fb0,
4887            fidl::encoding::DynamicFlags::FLEXIBLE,
4888            ___deadline,
4889        )?
4890        .into_result::<WifiMarker>("get_state")?;
4891        Ok(_response)
4892    }
4893
4894    /// Get the IDs of all the WiFi chips on the device.
4895    pub fn r#get_chip_ids(
4896        &self,
4897        ___deadline: zx::MonotonicInstant,
4898    ) -> Result<WifiGetChipIdsResponse, fidl::Error> {
4899        let _response = self.client.send_query::<
4900            fidl::encoding::EmptyPayload,
4901            fidl::encoding::FlexibleType<WifiGetChipIdsResponse>,
4902        >(
4903            (),
4904            0x2fb4f92351d802b5,
4905            fidl::encoding::DynamicFlags::FLEXIBLE,
4906            ___deadline,
4907        )?
4908        .into_result::<WifiMarker>("get_chip_ids")?;
4909        Ok(_response)
4910    }
4911
4912    /// Register the channel to make request to the `WifiChip` with the given
4913    /// `chip_id`
4914    pub fn r#get_chip(
4915        &self,
4916        mut payload: WifiGetChipRequest,
4917        ___deadline: zx::MonotonicInstant,
4918    ) -> Result<WifiGetChipResult, fidl::Error> {
4919        let _response = self.client.send_query::<
4920            WifiGetChipRequest,
4921            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
4922        >(
4923            &mut payload,
4924            0xef95d8246612540,
4925            fidl::encoding::DynamicFlags::FLEXIBLE,
4926            ___deadline,
4927        )?
4928        .into_result::<WifiMarker>("get_chip")?;
4929        Ok(_response.map(|x| x))
4930    }
4931}
4932
4933#[cfg(target_os = "fuchsia")]
4934impl From<WifiSynchronousProxy> for zx::Handle {
4935    fn from(value: WifiSynchronousProxy) -> Self {
4936        value.into_channel().into()
4937    }
4938}
4939
4940#[cfg(target_os = "fuchsia")]
4941impl From<fidl::Channel> for WifiSynchronousProxy {
4942    fn from(value: fidl::Channel) -> Self {
4943        Self::new(value)
4944    }
4945}
4946
4947#[cfg(target_os = "fuchsia")]
4948impl fidl::endpoints::FromClient for WifiSynchronousProxy {
4949    type Protocol = WifiMarker;
4950
4951    fn from_client(value: fidl::endpoints::ClientEnd<WifiMarker>) -> Self {
4952        Self::new(value.into_channel())
4953    }
4954}
4955
4956#[derive(Debug, Clone)]
4957pub struct WifiProxy {
4958    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4959}
4960
4961impl fidl::endpoints::Proxy for WifiProxy {
4962    type Protocol = WifiMarker;
4963
4964    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4965        Self::new(inner)
4966    }
4967
4968    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4969        self.client.into_channel().map_err(|client| Self { client })
4970    }
4971
4972    fn as_channel(&self) -> &::fidl::AsyncChannel {
4973        self.client.as_channel()
4974    }
4975}
4976
4977impl WifiProxy {
4978    /// Create a new Proxy for fuchsia.wlan.wlanix/Wifi.
4979    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4980        let protocol_name = <WifiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4981        Self { client: fidl::client::Client::new(channel, protocol_name) }
4982    }
4983
4984    /// Get a Stream of events from the remote end of the protocol.
4985    ///
4986    /// # Panics
4987    ///
4988    /// Panics if the event stream was already taken.
4989    pub fn take_event_stream(&self) -> WifiEventStream {
4990        WifiEventStream { event_receiver: self.client.take_event_receiver() }
4991    }
4992
4993    /// Register a callback to be notified of future events (such when WiFi has
4994    /// started or stopped)
4995    pub fn r#register_event_callback(
4996        &self,
4997        mut payload: WifiRegisterEventCallbackRequest,
4998    ) -> Result<(), fidl::Error> {
4999        WifiProxyInterface::r#register_event_callback(self, payload)
5000    }
5001
5002    /// Start WiFi. If this operation is not successful, return an error status.
5003    /// If this operation is successful, the `started` state is now true and all
5004    /// registered callbacks will be notified with an `OnStart` event.
5005    pub fn r#start(
5006        &self,
5007    ) -> fidl::client::QueryResponseFut<
5008        WifiStartResult,
5009        fidl::encoding::DefaultFuchsiaResourceDialect,
5010    > {
5011        WifiProxyInterface::r#start(self)
5012    }
5013
5014    /// Stop WiFi. If this operation is not successful, return an error status.
5015    /// If this operation is successful, the `started` state is now false and all
5016    /// registered callbacks will be notified with an `OnStop` event.
5017    pub fn r#stop(
5018        &self,
5019    ) -> fidl::client::QueryResponseFut<WifiStopResult, fidl::encoding::DefaultFuchsiaResourceDialect>
5020    {
5021        WifiProxyInterface::r#stop(self)
5022    }
5023
5024    /// Return a boolean based on whether WiFi is `started` or not.
5025    pub fn r#get_state(
5026        &self,
5027    ) -> fidl::client::QueryResponseFut<
5028        WifiGetStateResponse,
5029        fidl::encoding::DefaultFuchsiaResourceDialect,
5030    > {
5031        WifiProxyInterface::r#get_state(self)
5032    }
5033
5034    /// Get the IDs of all the WiFi chips on the device.
5035    pub fn r#get_chip_ids(
5036        &self,
5037    ) -> fidl::client::QueryResponseFut<
5038        WifiGetChipIdsResponse,
5039        fidl::encoding::DefaultFuchsiaResourceDialect,
5040    > {
5041        WifiProxyInterface::r#get_chip_ids(self)
5042    }
5043
5044    /// Register the channel to make request to the `WifiChip` with the given
5045    /// `chip_id`
5046    pub fn r#get_chip(
5047        &self,
5048        mut payload: WifiGetChipRequest,
5049    ) -> fidl::client::QueryResponseFut<
5050        WifiGetChipResult,
5051        fidl::encoding::DefaultFuchsiaResourceDialect,
5052    > {
5053        WifiProxyInterface::r#get_chip(self, payload)
5054    }
5055}
5056
5057impl WifiProxyInterface for WifiProxy {
5058    fn r#register_event_callback(
5059        &self,
5060        mut payload: WifiRegisterEventCallbackRequest,
5061    ) -> Result<(), fidl::Error> {
5062        self.client.send::<WifiRegisterEventCallbackRequest>(
5063            &mut payload,
5064            0x12abbdea948dd67b,
5065            fidl::encoding::DynamicFlags::FLEXIBLE,
5066        )
5067    }
5068
5069    type StartResponseFut = fidl::client::QueryResponseFut<
5070        WifiStartResult,
5071        fidl::encoding::DefaultFuchsiaResourceDialect,
5072    >;
5073    fn r#start(&self) -> Self::StartResponseFut {
5074        fn _decode(
5075            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5076        ) -> Result<WifiStartResult, fidl::Error> {
5077            let _response = fidl::client::decode_transaction_body::<
5078                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
5079                fidl::encoding::DefaultFuchsiaResourceDialect,
5080                0x427030e4dc6ec07a,
5081            >(_buf?)?
5082            .into_result::<WifiMarker>("start")?;
5083            Ok(_response.map(|x| x))
5084        }
5085        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, WifiStartResult>(
5086            (),
5087            0x427030e4dc6ec07a,
5088            fidl::encoding::DynamicFlags::FLEXIBLE,
5089            _decode,
5090        )
5091    }
5092
5093    type StopResponseFut = fidl::client::QueryResponseFut<
5094        WifiStopResult,
5095        fidl::encoding::DefaultFuchsiaResourceDialect,
5096    >;
5097    fn r#stop(&self) -> Self::StopResponseFut {
5098        fn _decode(
5099            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5100        ) -> Result<WifiStopResult, fidl::Error> {
5101            let _response = fidl::client::decode_transaction_body::<
5102                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
5103                fidl::encoding::DefaultFuchsiaResourceDialect,
5104                0x67c9bdf61b2888d,
5105            >(_buf?)?
5106            .into_result::<WifiMarker>("stop")?;
5107            Ok(_response.map(|x| x))
5108        }
5109        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, WifiStopResult>(
5110            (),
5111            0x67c9bdf61b2888d,
5112            fidl::encoding::DynamicFlags::FLEXIBLE,
5113            _decode,
5114        )
5115    }
5116
5117    type GetStateResponseFut = fidl::client::QueryResponseFut<
5118        WifiGetStateResponse,
5119        fidl::encoding::DefaultFuchsiaResourceDialect,
5120    >;
5121    fn r#get_state(&self) -> Self::GetStateResponseFut {
5122        fn _decode(
5123            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5124        ) -> Result<WifiGetStateResponse, fidl::Error> {
5125            let _response = fidl::client::decode_transaction_body::<
5126                fidl::encoding::FlexibleType<WifiGetStateResponse>,
5127                fidl::encoding::DefaultFuchsiaResourceDialect,
5128                0x4616114a937d1fb0,
5129            >(_buf?)?
5130            .into_result::<WifiMarker>("get_state")?;
5131            Ok(_response)
5132        }
5133        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, WifiGetStateResponse>(
5134            (),
5135            0x4616114a937d1fb0,
5136            fidl::encoding::DynamicFlags::FLEXIBLE,
5137            _decode,
5138        )
5139    }
5140
5141    type GetChipIdsResponseFut = fidl::client::QueryResponseFut<
5142        WifiGetChipIdsResponse,
5143        fidl::encoding::DefaultFuchsiaResourceDialect,
5144    >;
5145    fn r#get_chip_ids(&self) -> Self::GetChipIdsResponseFut {
5146        fn _decode(
5147            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5148        ) -> Result<WifiGetChipIdsResponse, fidl::Error> {
5149            let _response = fidl::client::decode_transaction_body::<
5150                fidl::encoding::FlexibleType<WifiGetChipIdsResponse>,
5151                fidl::encoding::DefaultFuchsiaResourceDialect,
5152                0x2fb4f92351d802b5,
5153            >(_buf?)?
5154            .into_result::<WifiMarker>("get_chip_ids")?;
5155            Ok(_response)
5156        }
5157        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, WifiGetChipIdsResponse>(
5158            (),
5159            0x2fb4f92351d802b5,
5160            fidl::encoding::DynamicFlags::FLEXIBLE,
5161            _decode,
5162        )
5163    }
5164
5165    type GetChipResponseFut = fidl::client::QueryResponseFut<
5166        WifiGetChipResult,
5167        fidl::encoding::DefaultFuchsiaResourceDialect,
5168    >;
5169    fn r#get_chip(&self, mut payload: WifiGetChipRequest) -> Self::GetChipResponseFut {
5170        fn _decode(
5171            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5172        ) -> Result<WifiGetChipResult, fidl::Error> {
5173            let _response = fidl::client::decode_transaction_body::<
5174                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
5175                fidl::encoding::DefaultFuchsiaResourceDialect,
5176                0xef95d8246612540,
5177            >(_buf?)?
5178            .into_result::<WifiMarker>("get_chip")?;
5179            Ok(_response.map(|x| x))
5180        }
5181        self.client.send_query_and_decode::<WifiGetChipRequest, WifiGetChipResult>(
5182            &mut payload,
5183            0xef95d8246612540,
5184            fidl::encoding::DynamicFlags::FLEXIBLE,
5185            _decode,
5186        )
5187    }
5188}
5189
5190pub struct WifiEventStream {
5191    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5192}
5193
5194impl std::marker::Unpin for WifiEventStream {}
5195
5196impl futures::stream::FusedStream for WifiEventStream {
5197    fn is_terminated(&self) -> bool {
5198        self.event_receiver.is_terminated()
5199    }
5200}
5201
5202impl futures::Stream for WifiEventStream {
5203    type Item = Result<WifiEvent, fidl::Error>;
5204
5205    fn poll_next(
5206        mut self: std::pin::Pin<&mut Self>,
5207        cx: &mut std::task::Context<'_>,
5208    ) -> std::task::Poll<Option<Self::Item>> {
5209        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5210            &mut self.event_receiver,
5211            cx
5212        )?) {
5213            Some(buf) => std::task::Poll::Ready(Some(WifiEvent::decode(buf))),
5214            None => std::task::Poll::Ready(None),
5215        }
5216    }
5217}
5218
5219#[derive(Debug)]
5220pub enum WifiEvent {
5221    #[non_exhaustive]
5222    _UnknownEvent {
5223        /// Ordinal of the event that was sent.
5224        ordinal: u64,
5225    },
5226}
5227
5228impl WifiEvent {
5229    /// Decodes a message buffer as a [`WifiEvent`].
5230    fn decode(
5231        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5232    ) -> Result<WifiEvent, fidl::Error> {
5233        let (bytes, _handles) = buf.split_mut();
5234        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5235        debug_assert_eq!(tx_header.tx_id, 0);
5236        match tx_header.ordinal {
5237            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5238                Ok(WifiEvent::_UnknownEvent { ordinal: tx_header.ordinal })
5239            }
5240            _ => Err(fidl::Error::UnknownOrdinal {
5241                ordinal: tx_header.ordinal,
5242                protocol_name: <WifiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5243            }),
5244        }
5245    }
5246}
5247
5248/// A Stream of incoming requests for fuchsia.wlan.wlanix/Wifi.
5249pub struct WifiRequestStream {
5250    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5251    is_terminated: bool,
5252}
5253
5254impl std::marker::Unpin for WifiRequestStream {}
5255
5256impl futures::stream::FusedStream for WifiRequestStream {
5257    fn is_terminated(&self) -> bool {
5258        self.is_terminated
5259    }
5260}
5261
5262impl fidl::endpoints::RequestStream for WifiRequestStream {
5263    type Protocol = WifiMarker;
5264    type ControlHandle = WifiControlHandle;
5265
5266    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5267        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5268    }
5269
5270    fn control_handle(&self) -> Self::ControlHandle {
5271        WifiControlHandle { inner: self.inner.clone() }
5272    }
5273
5274    fn into_inner(
5275        self,
5276    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5277    {
5278        (self.inner, self.is_terminated)
5279    }
5280
5281    fn from_inner(
5282        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5283        is_terminated: bool,
5284    ) -> Self {
5285        Self { inner, is_terminated }
5286    }
5287}
5288
5289impl futures::Stream for WifiRequestStream {
5290    type Item = Result<WifiRequest, fidl::Error>;
5291
5292    fn poll_next(
5293        mut self: std::pin::Pin<&mut Self>,
5294        cx: &mut std::task::Context<'_>,
5295    ) -> std::task::Poll<Option<Self::Item>> {
5296        let this = &mut *self;
5297        if this.inner.check_shutdown(cx) {
5298            this.is_terminated = true;
5299            return std::task::Poll::Ready(None);
5300        }
5301        if this.is_terminated {
5302            panic!("polled WifiRequestStream after completion");
5303        }
5304        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5305            |bytes, handles| {
5306                match this.inner.channel().read_etc(cx, bytes, handles) {
5307                    std::task::Poll::Ready(Ok(())) => {}
5308                    std::task::Poll::Pending => return std::task::Poll::Pending,
5309                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5310                        this.is_terminated = true;
5311                        return std::task::Poll::Ready(None);
5312                    }
5313                    std::task::Poll::Ready(Err(e)) => {
5314                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5315                            e.into(),
5316                        ))));
5317                    }
5318                }
5319
5320                // A message has been received from the channel
5321                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5322
5323                std::task::Poll::Ready(Some(match header.ordinal {
5324                    0x12abbdea948dd67b => {
5325                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5326                        let mut req = fidl::new_empty!(
5327                            WifiRegisterEventCallbackRequest,
5328                            fidl::encoding::DefaultFuchsiaResourceDialect
5329                        );
5330                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WifiRegisterEventCallbackRequest>(&header, _body_bytes, handles, &mut req)?;
5331                        let control_handle = WifiControlHandle { inner: this.inner.clone() };
5332                        Ok(WifiRequest::RegisterEventCallback { payload: req, control_handle })
5333                    }
5334                    0x427030e4dc6ec07a => {
5335                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5336                        let mut req = fidl::new_empty!(
5337                            fidl::encoding::EmptyPayload,
5338                            fidl::encoding::DefaultFuchsiaResourceDialect
5339                        );
5340                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5341                        let control_handle = WifiControlHandle { inner: this.inner.clone() };
5342                        Ok(WifiRequest::Start {
5343                            responder: WifiStartResponder {
5344                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5345                                tx_id: header.tx_id,
5346                            },
5347                        })
5348                    }
5349                    0x67c9bdf61b2888d => {
5350                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5351                        let mut req = fidl::new_empty!(
5352                            fidl::encoding::EmptyPayload,
5353                            fidl::encoding::DefaultFuchsiaResourceDialect
5354                        );
5355                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5356                        let control_handle = WifiControlHandle { inner: this.inner.clone() };
5357                        Ok(WifiRequest::Stop {
5358                            responder: WifiStopResponder {
5359                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5360                                tx_id: header.tx_id,
5361                            },
5362                        })
5363                    }
5364                    0x4616114a937d1fb0 => {
5365                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5366                        let mut req = fidl::new_empty!(
5367                            fidl::encoding::EmptyPayload,
5368                            fidl::encoding::DefaultFuchsiaResourceDialect
5369                        );
5370                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5371                        let control_handle = WifiControlHandle { inner: this.inner.clone() };
5372                        Ok(WifiRequest::GetState {
5373                            responder: WifiGetStateResponder {
5374                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5375                                tx_id: header.tx_id,
5376                            },
5377                        })
5378                    }
5379                    0x2fb4f92351d802b5 => {
5380                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5381                        let mut req = fidl::new_empty!(
5382                            fidl::encoding::EmptyPayload,
5383                            fidl::encoding::DefaultFuchsiaResourceDialect
5384                        );
5385                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5386                        let control_handle = WifiControlHandle { inner: this.inner.clone() };
5387                        Ok(WifiRequest::GetChipIds {
5388                            responder: WifiGetChipIdsResponder {
5389                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5390                                tx_id: header.tx_id,
5391                            },
5392                        })
5393                    }
5394                    0xef95d8246612540 => {
5395                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5396                        let mut req = fidl::new_empty!(
5397                            WifiGetChipRequest,
5398                            fidl::encoding::DefaultFuchsiaResourceDialect
5399                        );
5400                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WifiGetChipRequest>(&header, _body_bytes, handles, &mut req)?;
5401                        let control_handle = WifiControlHandle { inner: this.inner.clone() };
5402                        Ok(WifiRequest::GetChip {
5403                            payload: req,
5404                            responder: WifiGetChipResponder {
5405                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5406                                tx_id: header.tx_id,
5407                            },
5408                        })
5409                    }
5410                    _ if header.tx_id == 0
5411                        && header
5412                            .dynamic_flags()
5413                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
5414                    {
5415                        Ok(WifiRequest::_UnknownMethod {
5416                            ordinal: header.ordinal,
5417                            control_handle: WifiControlHandle { inner: this.inner.clone() },
5418                            method_type: fidl::MethodType::OneWay,
5419                        })
5420                    }
5421                    _ if header
5422                        .dynamic_flags()
5423                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
5424                    {
5425                        this.inner.send_framework_err(
5426                            fidl::encoding::FrameworkErr::UnknownMethod,
5427                            header.tx_id,
5428                            header.ordinal,
5429                            header.dynamic_flags(),
5430                            (bytes, handles),
5431                        )?;
5432                        Ok(WifiRequest::_UnknownMethod {
5433                            ordinal: header.ordinal,
5434                            control_handle: WifiControlHandle { inner: this.inner.clone() },
5435                            method_type: fidl::MethodType::TwoWay,
5436                        })
5437                    }
5438                    _ => Err(fidl::Error::UnknownOrdinal {
5439                        ordinal: header.ordinal,
5440                        protocol_name: <WifiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5441                    }),
5442                }))
5443            },
5444        )
5445    }
5446}
5447
5448#[derive(Debug)]
5449pub enum WifiRequest {
5450    /// Register a callback to be notified of future events (such when WiFi has
5451    /// started or stopped)
5452    RegisterEventCallback {
5453        payload: WifiRegisterEventCallbackRequest,
5454        control_handle: WifiControlHandle,
5455    },
5456    /// Start WiFi. If this operation is not successful, return an error status.
5457    /// If this operation is successful, the `started` state is now true and all
5458    /// registered callbacks will be notified with an `OnStart` event.
5459    Start { responder: WifiStartResponder },
5460    /// Stop WiFi. If this operation is not successful, return an error status.
5461    /// If this operation is successful, the `started` state is now false and all
5462    /// registered callbacks will be notified with an `OnStop` event.
5463    Stop { responder: WifiStopResponder },
5464    /// Return a boolean based on whether WiFi is `started` or not.
5465    GetState { responder: WifiGetStateResponder },
5466    /// Get the IDs of all the WiFi chips on the device.
5467    GetChipIds { responder: WifiGetChipIdsResponder },
5468    /// Register the channel to make request to the `WifiChip` with the given
5469    /// `chip_id`
5470    GetChip { payload: WifiGetChipRequest, responder: WifiGetChipResponder },
5471    /// An interaction was received which does not match any known method.
5472    #[non_exhaustive]
5473    _UnknownMethod {
5474        /// Ordinal of the method that was called.
5475        ordinal: u64,
5476        control_handle: WifiControlHandle,
5477        method_type: fidl::MethodType,
5478    },
5479}
5480
5481impl WifiRequest {
5482    #[allow(irrefutable_let_patterns)]
5483    pub fn into_register_event_callback(
5484        self,
5485    ) -> Option<(WifiRegisterEventCallbackRequest, WifiControlHandle)> {
5486        if let WifiRequest::RegisterEventCallback { payload, control_handle } = self {
5487            Some((payload, control_handle))
5488        } else {
5489            None
5490        }
5491    }
5492
5493    #[allow(irrefutable_let_patterns)]
5494    pub fn into_start(self) -> Option<(WifiStartResponder)> {
5495        if let WifiRequest::Start { responder } = self { Some((responder)) } else { None }
5496    }
5497
5498    #[allow(irrefutable_let_patterns)]
5499    pub fn into_stop(self) -> Option<(WifiStopResponder)> {
5500        if let WifiRequest::Stop { responder } = self { Some((responder)) } else { None }
5501    }
5502
5503    #[allow(irrefutable_let_patterns)]
5504    pub fn into_get_state(self) -> Option<(WifiGetStateResponder)> {
5505        if let WifiRequest::GetState { responder } = self { Some((responder)) } else { None }
5506    }
5507
5508    #[allow(irrefutable_let_patterns)]
5509    pub fn into_get_chip_ids(self) -> Option<(WifiGetChipIdsResponder)> {
5510        if let WifiRequest::GetChipIds { responder } = self { Some((responder)) } else { None }
5511    }
5512
5513    #[allow(irrefutable_let_patterns)]
5514    pub fn into_get_chip(self) -> Option<(WifiGetChipRequest, WifiGetChipResponder)> {
5515        if let WifiRequest::GetChip { payload, responder } = self {
5516            Some((payload, responder))
5517        } else {
5518            None
5519        }
5520    }
5521
5522    /// Name of the method defined in FIDL
5523    pub fn method_name(&self) -> &'static str {
5524        match *self {
5525            WifiRequest::RegisterEventCallback { .. } => "register_event_callback",
5526            WifiRequest::Start { .. } => "start",
5527            WifiRequest::Stop { .. } => "stop",
5528            WifiRequest::GetState { .. } => "get_state",
5529            WifiRequest::GetChipIds { .. } => "get_chip_ids",
5530            WifiRequest::GetChip { .. } => "get_chip",
5531            WifiRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
5532                "unknown one-way method"
5533            }
5534            WifiRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
5535                "unknown two-way method"
5536            }
5537        }
5538    }
5539}
5540
5541#[derive(Debug, Clone)]
5542pub struct WifiControlHandle {
5543    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5544}
5545
5546impl fidl::endpoints::ControlHandle for WifiControlHandle {
5547    fn shutdown(&self) {
5548        self.inner.shutdown()
5549    }
5550    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5551        self.inner.shutdown_with_epitaph(status)
5552    }
5553
5554    fn is_closed(&self) -> bool {
5555        self.inner.channel().is_closed()
5556    }
5557    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5558        self.inner.channel().on_closed()
5559    }
5560
5561    #[cfg(target_os = "fuchsia")]
5562    fn signal_peer(
5563        &self,
5564        clear_mask: zx::Signals,
5565        set_mask: zx::Signals,
5566    ) -> Result<(), zx_status::Status> {
5567        use fidl::Peered;
5568        self.inner.channel().signal_peer(clear_mask, set_mask)
5569    }
5570}
5571
5572impl WifiControlHandle {}
5573
5574#[must_use = "FIDL methods require a response to be sent"]
5575#[derive(Debug)]
5576pub struct WifiStartResponder {
5577    control_handle: std::mem::ManuallyDrop<WifiControlHandle>,
5578    tx_id: u32,
5579}
5580
5581/// Set the the channel to be shutdown (see [`WifiControlHandle::shutdown`])
5582/// if the responder is dropped without sending a response, so that the client
5583/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5584impl std::ops::Drop for WifiStartResponder {
5585    fn drop(&mut self) {
5586        self.control_handle.shutdown();
5587        // Safety: drops once, never accessed again
5588        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5589    }
5590}
5591
5592impl fidl::endpoints::Responder for WifiStartResponder {
5593    type ControlHandle = WifiControlHandle;
5594
5595    fn control_handle(&self) -> &WifiControlHandle {
5596        &self.control_handle
5597    }
5598
5599    fn drop_without_shutdown(mut self) {
5600        // Safety: drops once, never accessed again due to mem::forget
5601        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5602        // Prevent Drop from running (which would shut down the channel)
5603        std::mem::forget(self);
5604    }
5605}
5606
5607impl WifiStartResponder {
5608    /// Sends a response to the FIDL transaction.
5609    ///
5610    /// Sets the channel to shutdown if an error occurs.
5611    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5612        let _result = self.send_raw(result);
5613        if _result.is_err() {
5614            self.control_handle.shutdown();
5615        }
5616        self.drop_without_shutdown();
5617        _result
5618    }
5619
5620    /// Similar to "send" but does not shutdown the channel if an error occurs.
5621    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5622        let _result = self.send_raw(result);
5623        self.drop_without_shutdown();
5624        _result
5625    }
5626
5627    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5628        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5629            fidl::encoding::EmptyStruct,
5630            i32,
5631        >>(
5632            fidl::encoding::FlexibleResult::new(result),
5633            self.tx_id,
5634            0x427030e4dc6ec07a,
5635            fidl::encoding::DynamicFlags::FLEXIBLE,
5636        )
5637    }
5638}
5639
5640#[must_use = "FIDL methods require a response to be sent"]
5641#[derive(Debug)]
5642pub struct WifiStopResponder {
5643    control_handle: std::mem::ManuallyDrop<WifiControlHandle>,
5644    tx_id: u32,
5645}
5646
5647/// Set the the channel to be shutdown (see [`WifiControlHandle::shutdown`])
5648/// if the responder is dropped without sending a response, so that the client
5649/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5650impl std::ops::Drop for WifiStopResponder {
5651    fn drop(&mut self) {
5652        self.control_handle.shutdown();
5653        // Safety: drops once, never accessed again
5654        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5655    }
5656}
5657
5658impl fidl::endpoints::Responder for WifiStopResponder {
5659    type ControlHandle = WifiControlHandle;
5660
5661    fn control_handle(&self) -> &WifiControlHandle {
5662        &self.control_handle
5663    }
5664
5665    fn drop_without_shutdown(mut self) {
5666        // Safety: drops once, never accessed again due to mem::forget
5667        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5668        // Prevent Drop from running (which would shut down the channel)
5669        std::mem::forget(self);
5670    }
5671}
5672
5673impl WifiStopResponder {
5674    /// Sends a response to the FIDL transaction.
5675    ///
5676    /// Sets the channel to shutdown if an error occurs.
5677    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5678        let _result = self.send_raw(result);
5679        if _result.is_err() {
5680            self.control_handle.shutdown();
5681        }
5682        self.drop_without_shutdown();
5683        _result
5684    }
5685
5686    /// Similar to "send" but does not shutdown the channel if an error occurs.
5687    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5688        let _result = self.send_raw(result);
5689        self.drop_without_shutdown();
5690        _result
5691    }
5692
5693    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5694        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5695            fidl::encoding::EmptyStruct,
5696            i32,
5697        >>(
5698            fidl::encoding::FlexibleResult::new(result),
5699            self.tx_id,
5700            0x67c9bdf61b2888d,
5701            fidl::encoding::DynamicFlags::FLEXIBLE,
5702        )
5703    }
5704}
5705
5706#[must_use = "FIDL methods require a response to be sent"]
5707#[derive(Debug)]
5708pub struct WifiGetStateResponder {
5709    control_handle: std::mem::ManuallyDrop<WifiControlHandle>,
5710    tx_id: u32,
5711}
5712
5713/// Set the the channel to be shutdown (see [`WifiControlHandle::shutdown`])
5714/// if the responder is dropped without sending a response, so that the client
5715/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5716impl std::ops::Drop for WifiGetStateResponder {
5717    fn drop(&mut self) {
5718        self.control_handle.shutdown();
5719        // Safety: drops once, never accessed again
5720        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5721    }
5722}
5723
5724impl fidl::endpoints::Responder for WifiGetStateResponder {
5725    type ControlHandle = WifiControlHandle;
5726
5727    fn control_handle(&self) -> &WifiControlHandle {
5728        &self.control_handle
5729    }
5730
5731    fn drop_without_shutdown(mut self) {
5732        // Safety: drops once, never accessed again due to mem::forget
5733        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5734        // Prevent Drop from running (which would shut down the channel)
5735        std::mem::forget(self);
5736    }
5737}
5738
5739impl WifiGetStateResponder {
5740    /// Sends a response to the FIDL transaction.
5741    ///
5742    /// Sets the channel to shutdown if an error occurs.
5743    pub fn send(self, mut payload: &WifiGetStateResponse) -> Result<(), fidl::Error> {
5744        let _result = self.send_raw(payload);
5745        if _result.is_err() {
5746            self.control_handle.shutdown();
5747        }
5748        self.drop_without_shutdown();
5749        _result
5750    }
5751
5752    /// Similar to "send" but does not shutdown the channel if an error occurs.
5753    pub fn send_no_shutdown_on_err(
5754        self,
5755        mut payload: &WifiGetStateResponse,
5756    ) -> Result<(), fidl::Error> {
5757        let _result = self.send_raw(payload);
5758        self.drop_without_shutdown();
5759        _result
5760    }
5761
5762    fn send_raw(&self, mut payload: &WifiGetStateResponse) -> Result<(), fidl::Error> {
5763        self.control_handle.inner.send::<fidl::encoding::FlexibleType<WifiGetStateResponse>>(
5764            fidl::encoding::Flexible::new(payload),
5765            self.tx_id,
5766            0x4616114a937d1fb0,
5767            fidl::encoding::DynamicFlags::FLEXIBLE,
5768        )
5769    }
5770}
5771
5772#[must_use = "FIDL methods require a response to be sent"]
5773#[derive(Debug)]
5774pub struct WifiGetChipIdsResponder {
5775    control_handle: std::mem::ManuallyDrop<WifiControlHandle>,
5776    tx_id: u32,
5777}
5778
5779/// Set the the channel to be shutdown (see [`WifiControlHandle::shutdown`])
5780/// if the responder is dropped without sending a response, so that the client
5781/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5782impl std::ops::Drop for WifiGetChipIdsResponder {
5783    fn drop(&mut self) {
5784        self.control_handle.shutdown();
5785        // Safety: drops once, never accessed again
5786        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5787    }
5788}
5789
5790impl fidl::endpoints::Responder for WifiGetChipIdsResponder {
5791    type ControlHandle = WifiControlHandle;
5792
5793    fn control_handle(&self) -> &WifiControlHandle {
5794        &self.control_handle
5795    }
5796
5797    fn drop_without_shutdown(mut self) {
5798        // Safety: drops once, never accessed again due to mem::forget
5799        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5800        // Prevent Drop from running (which would shut down the channel)
5801        std::mem::forget(self);
5802    }
5803}
5804
5805impl WifiGetChipIdsResponder {
5806    /// Sends a response to the FIDL transaction.
5807    ///
5808    /// Sets the channel to shutdown if an error occurs.
5809    pub fn send(self, mut payload: &WifiGetChipIdsResponse) -> Result<(), fidl::Error> {
5810        let _result = self.send_raw(payload);
5811        if _result.is_err() {
5812            self.control_handle.shutdown();
5813        }
5814        self.drop_without_shutdown();
5815        _result
5816    }
5817
5818    /// Similar to "send" but does not shutdown the channel if an error occurs.
5819    pub fn send_no_shutdown_on_err(
5820        self,
5821        mut payload: &WifiGetChipIdsResponse,
5822    ) -> Result<(), fidl::Error> {
5823        let _result = self.send_raw(payload);
5824        self.drop_without_shutdown();
5825        _result
5826    }
5827
5828    fn send_raw(&self, mut payload: &WifiGetChipIdsResponse) -> Result<(), fidl::Error> {
5829        self.control_handle.inner.send::<fidl::encoding::FlexibleType<WifiGetChipIdsResponse>>(
5830            fidl::encoding::Flexible::new(payload),
5831            self.tx_id,
5832            0x2fb4f92351d802b5,
5833            fidl::encoding::DynamicFlags::FLEXIBLE,
5834        )
5835    }
5836}
5837
5838#[must_use = "FIDL methods require a response to be sent"]
5839#[derive(Debug)]
5840pub struct WifiGetChipResponder {
5841    control_handle: std::mem::ManuallyDrop<WifiControlHandle>,
5842    tx_id: u32,
5843}
5844
5845/// Set the the channel to be shutdown (see [`WifiControlHandle::shutdown`])
5846/// if the responder is dropped without sending a response, so that the client
5847/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5848impl std::ops::Drop for WifiGetChipResponder {
5849    fn drop(&mut self) {
5850        self.control_handle.shutdown();
5851        // Safety: drops once, never accessed again
5852        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5853    }
5854}
5855
5856impl fidl::endpoints::Responder for WifiGetChipResponder {
5857    type ControlHandle = WifiControlHandle;
5858
5859    fn control_handle(&self) -> &WifiControlHandle {
5860        &self.control_handle
5861    }
5862
5863    fn drop_without_shutdown(mut self) {
5864        // Safety: drops once, never accessed again due to mem::forget
5865        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5866        // Prevent Drop from running (which would shut down the channel)
5867        std::mem::forget(self);
5868    }
5869}
5870
5871impl WifiGetChipResponder {
5872    /// Sends a response to the FIDL transaction.
5873    ///
5874    /// Sets the channel to shutdown if an error occurs.
5875    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5876        let _result = self.send_raw(result);
5877        if _result.is_err() {
5878            self.control_handle.shutdown();
5879        }
5880        self.drop_without_shutdown();
5881        _result
5882    }
5883
5884    /// Similar to "send" but does not shutdown the channel if an error occurs.
5885    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5886        let _result = self.send_raw(result);
5887        self.drop_without_shutdown();
5888        _result
5889    }
5890
5891    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5892        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5893            fidl::encoding::EmptyStruct,
5894            i32,
5895        >>(
5896            fidl::encoding::FlexibleResult::new(result),
5897            self.tx_id,
5898            0xef95d8246612540,
5899            fidl::encoding::DynamicFlags::FLEXIBLE,
5900        )
5901    }
5902}
5903
5904#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5905pub struct WifiChipMarker;
5906
5907impl fidl::endpoints::ProtocolMarker for WifiChipMarker {
5908    type Proxy = WifiChipProxy;
5909    type RequestStream = WifiChipRequestStream;
5910    #[cfg(target_os = "fuchsia")]
5911    type SynchronousProxy = WifiChipSynchronousProxy;
5912
5913    const DEBUG_NAME: &'static str = "(anonymous) WifiChip";
5914}
5915pub type WifiChipCreateStaIfaceResult = Result<(), i32>;
5916pub type WifiChipGetStaIfaceResult = Result<(), i32>;
5917pub type WifiChipRemoveStaIfaceResult = Result<(), i32>;
5918pub type WifiChipSetCountryCodeResult = Result<(), i32>;
5919pub type WifiChipTriggerSubsystemRestartResult = Result<(), i32>;
5920
5921pub trait WifiChipProxyInterface: Send + Sync {
5922    type CreateStaIfaceResponseFut: std::future::Future<Output = Result<WifiChipCreateStaIfaceResult, fidl::Error>>
5923        + Send;
5924    fn r#create_sta_iface(
5925        &self,
5926        payload: WifiChipCreateStaIfaceRequest,
5927    ) -> Self::CreateStaIfaceResponseFut;
5928    type GetStaIfaceNamesResponseFut: std::future::Future<Output = Result<WifiChipGetStaIfaceNamesResponse, fidl::Error>>
5929        + Send;
5930    fn r#get_sta_iface_names(&self) -> Self::GetStaIfaceNamesResponseFut;
5931    type GetStaIfaceResponseFut: std::future::Future<Output = Result<WifiChipGetStaIfaceResult, fidl::Error>>
5932        + Send;
5933    fn r#get_sta_iface(&self, payload: WifiChipGetStaIfaceRequest) -> Self::GetStaIfaceResponseFut;
5934    type RemoveStaIfaceResponseFut: std::future::Future<Output = Result<WifiChipRemoveStaIfaceResult, fidl::Error>>
5935        + Send;
5936    fn r#remove_sta_iface(
5937        &self,
5938        payload: WifiChipRemoveStaIfaceRequest,
5939    ) -> Self::RemoveStaIfaceResponseFut;
5940    type SetCountryCodeResponseFut: std::future::Future<Output = Result<WifiChipSetCountryCodeResult, fidl::Error>>
5941        + Send;
5942    fn r#set_country_code(
5943        &self,
5944        payload: WifiChipSetCountryCodeRequest,
5945    ) -> Self::SetCountryCodeResponseFut;
5946    type GetAvailableModesResponseFut: std::future::Future<Output = Result<WifiChipGetAvailableModesResponse, fidl::Error>>
5947        + Send;
5948    fn r#get_available_modes(&self) -> Self::GetAvailableModesResponseFut;
5949    type GetIdResponseFut: std::future::Future<Output = Result<WifiChipGetIdResponse, fidl::Error>>
5950        + Send;
5951    fn r#get_id(&self) -> Self::GetIdResponseFut;
5952    type GetModeResponseFut: std::future::Future<Output = Result<WifiChipGetModeResponse, fidl::Error>>
5953        + Send;
5954    fn r#get_mode(&self) -> Self::GetModeResponseFut;
5955    type GetCapabilitiesResponseFut: std::future::Future<Output = Result<WifiChipGetCapabilitiesResponse, fidl::Error>>
5956        + Send;
5957    fn r#get_capabilities(&self) -> Self::GetCapabilitiesResponseFut;
5958    type TriggerSubsystemRestartResponseFut: std::future::Future<Output = Result<WifiChipTriggerSubsystemRestartResult, fidl::Error>>
5959        + Send;
5960    fn r#trigger_subsystem_restart(&self) -> Self::TriggerSubsystemRestartResponseFut;
5961    type SelectTxPowerScenarioResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
5962        + Send;
5963    fn r#select_tx_power_scenario(
5964        &self,
5965        scenario: WifiChipTxPowerScenario,
5966    ) -> Self::SelectTxPowerScenarioResponseFut;
5967    type ResetTxPowerScenarioResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
5968        + Send;
5969    fn r#reset_tx_power_scenario(&self) -> Self::ResetTxPowerScenarioResponseFut;
5970}
5971#[derive(Debug)]
5972#[cfg(target_os = "fuchsia")]
5973pub struct WifiChipSynchronousProxy {
5974    client: fidl::client::sync::Client,
5975}
5976
5977#[cfg(target_os = "fuchsia")]
5978impl fidl::endpoints::SynchronousProxy for WifiChipSynchronousProxy {
5979    type Proxy = WifiChipProxy;
5980    type Protocol = WifiChipMarker;
5981
5982    fn from_channel(inner: fidl::Channel) -> Self {
5983        Self::new(inner)
5984    }
5985
5986    fn into_channel(self) -> fidl::Channel {
5987        self.client.into_channel()
5988    }
5989
5990    fn as_channel(&self) -> &fidl::Channel {
5991        self.client.as_channel()
5992    }
5993}
5994
5995#[cfg(target_os = "fuchsia")]
5996impl WifiChipSynchronousProxy {
5997    pub fn new(channel: fidl::Channel) -> Self {
5998        let protocol_name = <WifiChipMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5999        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6000    }
6001
6002    pub fn into_channel(self) -> fidl::Channel {
6003        self.client.into_channel()
6004    }
6005
6006    /// Waits until an event arrives and returns it. It is safe for other
6007    /// threads to make concurrent requests while waiting for an event.
6008    pub fn wait_for_event(
6009        &self,
6010        deadline: zx::MonotonicInstant,
6011    ) -> Result<WifiChipEvent, fidl::Error> {
6012        WifiChipEvent::decode(self.client.wait_for_event(deadline)?)
6013    }
6014
6015    /// Request the chip to create a STA iface.
6016    pub fn r#create_sta_iface(
6017        &self,
6018        mut payload: WifiChipCreateStaIfaceRequest,
6019        ___deadline: zx::MonotonicInstant,
6020    ) -> Result<WifiChipCreateStaIfaceResult, fidl::Error> {
6021        let _response = self.client.send_query::<
6022            WifiChipCreateStaIfaceRequest,
6023            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6024        >(
6025            &mut payload,
6026            0x6fb2d5892face7af,
6027            fidl::encoding::DynamicFlags::FLEXIBLE,
6028            ___deadline,
6029        )?
6030        .into_result::<WifiChipMarker>("create_sta_iface")?;
6031        Ok(_response.map(|x| x))
6032    }
6033
6034    /// Get the names of all active ifaces.
6035    pub fn r#get_sta_iface_names(
6036        &self,
6037        ___deadline: zx::MonotonicInstant,
6038    ) -> Result<WifiChipGetStaIfaceNamesResponse, fidl::Error> {
6039        let _response = self.client.send_query::<
6040            fidl::encoding::EmptyPayload,
6041            fidl::encoding::FlexibleType<WifiChipGetStaIfaceNamesResponse>,
6042        >(
6043            (),
6044            0x349257482df6a000,
6045            fidl::encoding::DynamicFlags::FLEXIBLE,
6046            ___deadline,
6047        )?
6048        .into_result::<WifiChipMarker>("get_sta_iface_names")?;
6049        Ok(_response)
6050    }
6051
6052    /// Request a new connection to an existing iface.
6053    pub fn r#get_sta_iface(
6054        &self,
6055        mut payload: WifiChipGetStaIfaceRequest,
6056        ___deadline: zx::MonotonicInstant,
6057    ) -> Result<WifiChipGetStaIfaceResult, fidl::Error> {
6058        let _response = self.client.send_query::<
6059            WifiChipGetStaIfaceRequest,
6060            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6061        >(
6062            &mut payload,
6063            0x6d9704eeb36f28a2,
6064            fidl::encoding::DynamicFlags::FLEXIBLE,
6065            ___deadline,
6066        )?
6067        .into_result::<WifiChipMarker>("get_sta_iface")?;
6068        Ok(_response.map(|x| x))
6069    }
6070
6071    /// Request the destruction of a STA iface on the chip.
6072    pub fn r#remove_sta_iface(
6073        &self,
6074        mut payload: WifiChipRemoveStaIfaceRequest,
6075        ___deadline: zx::MonotonicInstant,
6076    ) -> Result<WifiChipRemoveStaIfaceResult, fidl::Error> {
6077        let _response = self.client.send_query::<
6078            WifiChipRemoveStaIfaceRequest,
6079            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6080        >(
6081            &mut payload,
6082            0x4cd8eee466f8b04c,
6083            fidl::encoding::DynamicFlags::FLEXIBLE,
6084            ___deadline,
6085        )?
6086        .into_result::<WifiChipMarker>("remove_sta_iface")?;
6087        Ok(_response.map(|x| x))
6088    }
6089
6090    pub fn r#set_country_code(
6091        &self,
6092        mut payload: WifiChipSetCountryCodeRequest,
6093        ___deadline: zx::MonotonicInstant,
6094    ) -> Result<WifiChipSetCountryCodeResult, fidl::Error> {
6095        let _response = self.client.send_query::<
6096            WifiChipSetCountryCodeRequest,
6097            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6098        >(
6099            &mut payload,
6100            0x1dfe372d1d61a490,
6101            fidl::encoding::DynamicFlags::FLEXIBLE,
6102            ___deadline,
6103        )?
6104        .into_result::<WifiChipMarker>("set_country_code")?;
6105        Ok(_response.map(|x| x))
6106    }
6107
6108    /// Get a set of operation modes that the chip supports.
6109    /// This combination encodes what iface types and how many can be created,
6110    /// and which ones can run concurrently.
6111    pub fn r#get_available_modes(
6112        &self,
6113        ___deadline: zx::MonotonicInstant,
6114    ) -> Result<WifiChipGetAvailableModesResponse, fidl::Error> {
6115        let _response = self.client.send_query::<
6116            fidl::encoding::EmptyPayload,
6117            fidl::encoding::FlexibleType<WifiChipGetAvailableModesResponse>,
6118        >(
6119            (),
6120            0x1701095b452a3acd,
6121            fidl::encoding::DynamicFlags::FLEXIBLE,
6122            ___deadline,
6123        )?
6124        .into_result::<WifiChipMarker>("get_available_modes")?;
6125        Ok(_response)
6126    }
6127
6128    /// Get the ID of the current chip.
6129    pub fn r#get_id(
6130        &self,
6131        ___deadline: zx::MonotonicInstant,
6132    ) -> Result<WifiChipGetIdResponse, fidl::Error> {
6133        let _response = self.client.send_query::<
6134            fidl::encoding::EmptyPayload,
6135            fidl::encoding::FlexibleType<WifiChipGetIdResponse>,
6136        >(
6137            (),
6138            0x37d5197325bb3370,
6139            fidl::encoding::DynamicFlags::FLEXIBLE,
6140            ___deadline,
6141        )?
6142        .into_result::<WifiChipMarker>("get_id")?;
6143        Ok(_response)
6144    }
6145
6146    /// Get the current mode that the chip is in.
6147    pub fn r#get_mode(
6148        &self,
6149        ___deadline: zx::MonotonicInstant,
6150    ) -> Result<WifiChipGetModeResponse, fidl::Error> {
6151        let _response = self.client.send_query::<
6152            fidl::encoding::EmptyPayload,
6153            fidl::encoding::FlexibleType<WifiChipGetModeResponse>,
6154        >(
6155            (),
6156            0x4d209e0f3ac84d6f,
6157            fidl::encoding::DynamicFlags::FLEXIBLE,
6158            ___deadline,
6159        )?
6160        .into_result::<WifiChipMarker>("get_mode")?;
6161        Ok(_response)
6162    }
6163
6164    /// Get capabilities supported by this chip.
6165    pub fn r#get_capabilities(
6166        &self,
6167        ___deadline: zx::MonotonicInstant,
6168    ) -> Result<WifiChipGetCapabilitiesResponse, fidl::Error> {
6169        let _response = self.client.send_query::<
6170            fidl::encoding::EmptyPayload,
6171            fidl::encoding::FlexibleType<WifiChipGetCapabilitiesResponse>,
6172        >(
6173            (),
6174            0x1b253f396dcaa2e0,
6175            fidl::encoding::DynamicFlags::FLEXIBLE,
6176            ___deadline,
6177        )?
6178        .into_result::<WifiChipMarker>("get_capabilities")?;
6179        Ok(_response)
6180    }
6181
6182    /// Restart the subsystem. This is called to attempt recovery when there
6183    /// is a persistent issue with WiFi.
6184    pub fn r#trigger_subsystem_restart(
6185        &self,
6186        ___deadline: zx::MonotonicInstant,
6187    ) -> Result<WifiChipTriggerSubsystemRestartResult, fidl::Error> {
6188        let _response = self.client.send_query::<
6189            fidl::encoding::EmptyPayload,
6190            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6191        >(
6192            (),
6193            0x42ffcae5aad196f9,
6194            fidl::encoding::DynamicFlags::FLEXIBLE,
6195            ___deadline,
6196        )?
6197        .into_result::<WifiChipMarker>("trigger_subsystem_restart")?;
6198        Ok(_response.map(|x| x))
6199    }
6200
6201    /// Configures the SAR setting for this chip.
6202    pub fn r#select_tx_power_scenario(
6203        &self,
6204        mut scenario: WifiChipTxPowerScenario,
6205        ___deadline: zx::MonotonicInstant,
6206    ) -> Result<(), fidl::Error> {
6207        let _response = self.client.send_query::<
6208            WifiChipSelectTxPowerScenarioRequest,
6209            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
6210        >(
6211            (scenario,),
6212            0x19287ab52ea72281,
6213            fidl::encoding::DynamicFlags::FLEXIBLE,
6214            ___deadline,
6215        )?
6216        .into_result::<WifiChipMarker>("select_tx_power_scenario")?;
6217        Ok(_response)
6218    }
6219
6220    /// Restore the default SAR setting for this chip.
6221    pub fn r#reset_tx_power_scenario(
6222        &self,
6223        ___deadline: zx::MonotonicInstant,
6224    ) -> Result<(), fidl::Error> {
6225        let _response = self.client.send_query::<
6226            fidl::encoding::EmptyPayload,
6227            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
6228        >(
6229            (),
6230            0x46408a2fb1eb9d09,
6231            fidl::encoding::DynamicFlags::FLEXIBLE,
6232            ___deadline,
6233        )?
6234        .into_result::<WifiChipMarker>("reset_tx_power_scenario")?;
6235        Ok(_response)
6236    }
6237}
6238
6239#[cfg(target_os = "fuchsia")]
6240impl From<WifiChipSynchronousProxy> for zx::Handle {
6241    fn from(value: WifiChipSynchronousProxy) -> Self {
6242        value.into_channel().into()
6243    }
6244}
6245
6246#[cfg(target_os = "fuchsia")]
6247impl From<fidl::Channel> for WifiChipSynchronousProxy {
6248    fn from(value: fidl::Channel) -> Self {
6249        Self::new(value)
6250    }
6251}
6252
6253#[cfg(target_os = "fuchsia")]
6254impl fidl::endpoints::FromClient for WifiChipSynchronousProxy {
6255    type Protocol = WifiChipMarker;
6256
6257    fn from_client(value: fidl::endpoints::ClientEnd<WifiChipMarker>) -> Self {
6258        Self::new(value.into_channel())
6259    }
6260}
6261
6262#[derive(Debug, Clone)]
6263pub struct WifiChipProxy {
6264    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6265}
6266
6267impl fidl::endpoints::Proxy for WifiChipProxy {
6268    type Protocol = WifiChipMarker;
6269
6270    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6271        Self::new(inner)
6272    }
6273
6274    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6275        self.client.into_channel().map_err(|client| Self { client })
6276    }
6277
6278    fn as_channel(&self) -> &::fidl::AsyncChannel {
6279        self.client.as_channel()
6280    }
6281}
6282
6283impl WifiChipProxy {
6284    /// Create a new Proxy for fuchsia.wlan.wlanix/WifiChip.
6285    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6286        let protocol_name = <WifiChipMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6287        Self { client: fidl::client::Client::new(channel, protocol_name) }
6288    }
6289
6290    /// Get a Stream of events from the remote end of the protocol.
6291    ///
6292    /// # Panics
6293    ///
6294    /// Panics if the event stream was already taken.
6295    pub fn take_event_stream(&self) -> WifiChipEventStream {
6296        WifiChipEventStream { event_receiver: self.client.take_event_receiver() }
6297    }
6298
6299    /// Request the chip to create a STA iface.
6300    pub fn r#create_sta_iface(
6301        &self,
6302        mut payload: WifiChipCreateStaIfaceRequest,
6303    ) -> fidl::client::QueryResponseFut<
6304        WifiChipCreateStaIfaceResult,
6305        fidl::encoding::DefaultFuchsiaResourceDialect,
6306    > {
6307        WifiChipProxyInterface::r#create_sta_iface(self, payload)
6308    }
6309
6310    /// Get the names of all active ifaces.
6311    pub fn r#get_sta_iface_names(
6312        &self,
6313    ) -> fidl::client::QueryResponseFut<
6314        WifiChipGetStaIfaceNamesResponse,
6315        fidl::encoding::DefaultFuchsiaResourceDialect,
6316    > {
6317        WifiChipProxyInterface::r#get_sta_iface_names(self)
6318    }
6319
6320    /// Request a new connection to an existing iface.
6321    pub fn r#get_sta_iface(
6322        &self,
6323        mut payload: WifiChipGetStaIfaceRequest,
6324    ) -> fidl::client::QueryResponseFut<
6325        WifiChipGetStaIfaceResult,
6326        fidl::encoding::DefaultFuchsiaResourceDialect,
6327    > {
6328        WifiChipProxyInterface::r#get_sta_iface(self, payload)
6329    }
6330
6331    /// Request the destruction of a STA iface on the chip.
6332    pub fn r#remove_sta_iface(
6333        &self,
6334        mut payload: WifiChipRemoveStaIfaceRequest,
6335    ) -> fidl::client::QueryResponseFut<
6336        WifiChipRemoveStaIfaceResult,
6337        fidl::encoding::DefaultFuchsiaResourceDialect,
6338    > {
6339        WifiChipProxyInterface::r#remove_sta_iface(self, payload)
6340    }
6341
6342    pub fn r#set_country_code(
6343        &self,
6344        mut payload: WifiChipSetCountryCodeRequest,
6345    ) -> fidl::client::QueryResponseFut<
6346        WifiChipSetCountryCodeResult,
6347        fidl::encoding::DefaultFuchsiaResourceDialect,
6348    > {
6349        WifiChipProxyInterface::r#set_country_code(self, payload)
6350    }
6351
6352    /// Get a set of operation modes that the chip supports.
6353    /// This combination encodes what iface types and how many can be created,
6354    /// and which ones can run concurrently.
6355    pub fn r#get_available_modes(
6356        &self,
6357    ) -> fidl::client::QueryResponseFut<
6358        WifiChipGetAvailableModesResponse,
6359        fidl::encoding::DefaultFuchsiaResourceDialect,
6360    > {
6361        WifiChipProxyInterface::r#get_available_modes(self)
6362    }
6363
6364    /// Get the ID of the current chip.
6365    pub fn r#get_id(
6366        &self,
6367    ) -> fidl::client::QueryResponseFut<
6368        WifiChipGetIdResponse,
6369        fidl::encoding::DefaultFuchsiaResourceDialect,
6370    > {
6371        WifiChipProxyInterface::r#get_id(self)
6372    }
6373
6374    /// Get the current mode that the chip is in.
6375    pub fn r#get_mode(
6376        &self,
6377    ) -> fidl::client::QueryResponseFut<
6378        WifiChipGetModeResponse,
6379        fidl::encoding::DefaultFuchsiaResourceDialect,
6380    > {
6381        WifiChipProxyInterface::r#get_mode(self)
6382    }
6383
6384    /// Get capabilities supported by this chip.
6385    pub fn r#get_capabilities(
6386        &self,
6387    ) -> fidl::client::QueryResponseFut<
6388        WifiChipGetCapabilitiesResponse,
6389        fidl::encoding::DefaultFuchsiaResourceDialect,
6390    > {
6391        WifiChipProxyInterface::r#get_capabilities(self)
6392    }
6393
6394    /// Restart the subsystem. This is called to attempt recovery when there
6395    /// is a persistent issue with WiFi.
6396    pub fn r#trigger_subsystem_restart(
6397        &self,
6398    ) -> fidl::client::QueryResponseFut<
6399        WifiChipTriggerSubsystemRestartResult,
6400        fidl::encoding::DefaultFuchsiaResourceDialect,
6401    > {
6402        WifiChipProxyInterface::r#trigger_subsystem_restart(self)
6403    }
6404
6405    /// Configures the SAR setting for this chip.
6406    pub fn r#select_tx_power_scenario(
6407        &self,
6408        mut scenario: WifiChipTxPowerScenario,
6409    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
6410        WifiChipProxyInterface::r#select_tx_power_scenario(self, scenario)
6411    }
6412
6413    /// Restore the default SAR setting for this chip.
6414    pub fn r#reset_tx_power_scenario(
6415        &self,
6416    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
6417        WifiChipProxyInterface::r#reset_tx_power_scenario(self)
6418    }
6419}
6420
6421impl WifiChipProxyInterface for WifiChipProxy {
6422    type CreateStaIfaceResponseFut = fidl::client::QueryResponseFut<
6423        WifiChipCreateStaIfaceResult,
6424        fidl::encoding::DefaultFuchsiaResourceDialect,
6425    >;
6426    fn r#create_sta_iface(
6427        &self,
6428        mut payload: WifiChipCreateStaIfaceRequest,
6429    ) -> Self::CreateStaIfaceResponseFut {
6430        fn _decode(
6431            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6432        ) -> Result<WifiChipCreateStaIfaceResult, fidl::Error> {
6433            let _response = fidl::client::decode_transaction_body::<
6434                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6435                fidl::encoding::DefaultFuchsiaResourceDialect,
6436                0x6fb2d5892face7af,
6437            >(_buf?)?
6438            .into_result::<WifiChipMarker>("create_sta_iface")?;
6439            Ok(_response.map(|x| x))
6440        }
6441        self.client
6442            .send_query_and_decode::<WifiChipCreateStaIfaceRequest, WifiChipCreateStaIfaceResult>(
6443                &mut payload,
6444                0x6fb2d5892face7af,
6445                fidl::encoding::DynamicFlags::FLEXIBLE,
6446                _decode,
6447            )
6448    }
6449
6450    type GetStaIfaceNamesResponseFut = fidl::client::QueryResponseFut<
6451        WifiChipGetStaIfaceNamesResponse,
6452        fidl::encoding::DefaultFuchsiaResourceDialect,
6453    >;
6454    fn r#get_sta_iface_names(&self) -> Self::GetStaIfaceNamesResponseFut {
6455        fn _decode(
6456            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6457        ) -> Result<WifiChipGetStaIfaceNamesResponse, fidl::Error> {
6458            let _response = fidl::client::decode_transaction_body::<
6459                fidl::encoding::FlexibleType<WifiChipGetStaIfaceNamesResponse>,
6460                fidl::encoding::DefaultFuchsiaResourceDialect,
6461                0x349257482df6a000,
6462            >(_buf?)?
6463            .into_result::<WifiChipMarker>("get_sta_iface_names")?;
6464            Ok(_response)
6465        }
6466        self.client.send_query_and_decode::<
6467            fidl::encoding::EmptyPayload,
6468            WifiChipGetStaIfaceNamesResponse,
6469        >(
6470            (),
6471            0x349257482df6a000,
6472            fidl::encoding::DynamicFlags::FLEXIBLE,
6473            _decode,
6474        )
6475    }
6476
6477    type GetStaIfaceResponseFut = fidl::client::QueryResponseFut<
6478        WifiChipGetStaIfaceResult,
6479        fidl::encoding::DefaultFuchsiaResourceDialect,
6480    >;
6481    fn r#get_sta_iface(
6482        &self,
6483        mut payload: WifiChipGetStaIfaceRequest,
6484    ) -> Self::GetStaIfaceResponseFut {
6485        fn _decode(
6486            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6487        ) -> Result<WifiChipGetStaIfaceResult, fidl::Error> {
6488            let _response = fidl::client::decode_transaction_body::<
6489                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6490                fidl::encoding::DefaultFuchsiaResourceDialect,
6491                0x6d9704eeb36f28a2,
6492            >(_buf?)?
6493            .into_result::<WifiChipMarker>("get_sta_iface")?;
6494            Ok(_response.map(|x| x))
6495        }
6496        self.client.send_query_and_decode::<WifiChipGetStaIfaceRequest, WifiChipGetStaIfaceResult>(
6497            &mut payload,
6498            0x6d9704eeb36f28a2,
6499            fidl::encoding::DynamicFlags::FLEXIBLE,
6500            _decode,
6501        )
6502    }
6503
6504    type RemoveStaIfaceResponseFut = fidl::client::QueryResponseFut<
6505        WifiChipRemoveStaIfaceResult,
6506        fidl::encoding::DefaultFuchsiaResourceDialect,
6507    >;
6508    fn r#remove_sta_iface(
6509        &self,
6510        mut payload: WifiChipRemoveStaIfaceRequest,
6511    ) -> Self::RemoveStaIfaceResponseFut {
6512        fn _decode(
6513            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6514        ) -> Result<WifiChipRemoveStaIfaceResult, fidl::Error> {
6515            let _response = fidl::client::decode_transaction_body::<
6516                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6517                fidl::encoding::DefaultFuchsiaResourceDialect,
6518                0x4cd8eee466f8b04c,
6519            >(_buf?)?
6520            .into_result::<WifiChipMarker>("remove_sta_iface")?;
6521            Ok(_response.map(|x| x))
6522        }
6523        self.client
6524            .send_query_and_decode::<WifiChipRemoveStaIfaceRequest, WifiChipRemoveStaIfaceResult>(
6525                &mut payload,
6526                0x4cd8eee466f8b04c,
6527                fidl::encoding::DynamicFlags::FLEXIBLE,
6528                _decode,
6529            )
6530    }
6531
6532    type SetCountryCodeResponseFut = fidl::client::QueryResponseFut<
6533        WifiChipSetCountryCodeResult,
6534        fidl::encoding::DefaultFuchsiaResourceDialect,
6535    >;
6536    fn r#set_country_code(
6537        &self,
6538        mut payload: WifiChipSetCountryCodeRequest,
6539    ) -> Self::SetCountryCodeResponseFut {
6540        fn _decode(
6541            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6542        ) -> Result<WifiChipSetCountryCodeResult, fidl::Error> {
6543            let _response = fidl::client::decode_transaction_body::<
6544                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6545                fidl::encoding::DefaultFuchsiaResourceDialect,
6546                0x1dfe372d1d61a490,
6547            >(_buf?)?
6548            .into_result::<WifiChipMarker>("set_country_code")?;
6549            Ok(_response.map(|x| x))
6550        }
6551        self.client
6552            .send_query_and_decode::<WifiChipSetCountryCodeRequest, WifiChipSetCountryCodeResult>(
6553                &mut payload,
6554                0x1dfe372d1d61a490,
6555                fidl::encoding::DynamicFlags::FLEXIBLE,
6556                _decode,
6557            )
6558    }
6559
6560    type GetAvailableModesResponseFut = fidl::client::QueryResponseFut<
6561        WifiChipGetAvailableModesResponse,
6562        fidl::encoding::DefaultFuchsiaResourceDialect,
6563    >;
6564    fn r#get_available_modes(&self) -> Self::GetAvailableModesResponseFut {
6565        fn _decode(
6566            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6567        ) -> Result<WifiChipGetAvailableModesResponse, fidl::Error> {
6568            let _response = fidl::client::decode_transaction_body::<
6569                fidl::encoding::FlexibleType<WifiChipGetAvailableModesResponse>,
6570                fidl::encoding::DefaultFuchsiaResourceDialect,
6571                0x1701095b452a3acd,
6572            >(_buf?)?
6573            .into_result::<WifiChipMarker>("get_available_modes")?;
6574            Ok(_response)
6575        }
6576        self.client.send_query_and_decode::<
6577            fidl::encoding::EmptyPayload,
6578            WifiChipGetAvailableModesResponse,
6579        >(
6580            (),
6581            0x1701095b452a3acd,
6582            fidl::encoding::DynamicFlags::FLEXIBLE,
6583            _decode,
6584        )
6585    }
6586
6587    type GetIdResponseFut = fidl::client::QueryResponseFut<
6588        WifiChipGetIdResponse,
6589        fidl::encoding::DefaultFuchsiaResourceDialect,
6590    >;
6591    fn r#get_id(&self) -> Self::GetIdResponseFut {
6592        fn _decode(
6593            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6594        ) -> Result<WifiChipGetIdResponse, fidl::Error> {
6595            let _response = fidl::client::decode_transaction_body::<
6596                fidl::encoding::FlexibleType<WifiChipGetIdResponse>,
6597                fidl::encoding::DefaultFuchsiaResourceDialect,
6598                0x37d5197325bb3370,
6599            >(_buf?)?
6600            .into_result::<WifiChipMarker>("get_id")?;
6601            Ok(_response)
6602        }
6603        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, WifiChipGetIdResponse>(
6604            (),
6605            0x37d5197325bb3370,
6606            fidl::encoding::DynamicFlags::FLEXIBLE,
6607            _decode,
6608        )
6609    }
6610
6611    type GetModeResponseFut = fidl::client::QueryResponseFut<
6612        WifiChipGetModeResponse,
6613        fidl::encoding::DefaultFuchsiaResourceDialect,
6614    >;
6615    fn r#get_mode(&self) -> Self::GetModeResponseFut {
6616        fn _decode(
6617            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6618        ) -> Result<WifiChipGetModeResponse, fidl::Error> {
6619            let _response = fidl::client::decode_transaction_body::<
6620                fidl::encoding::FlexibleType<WifiChipGetModeResponse>,
6621                fidl::encoding::DefaultFuchsiaResourceDialect,
6622                0x4d209e0f3ac84d6f,
6623            >(_buf?)?
6624            .into_result::<WifiChipMarker>("get_mode")?;
6625            Ok(_response)
6626        }
6627        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, WifiChipGetModeResponse>(
6628            (),
6629            0x4d209e0f3ac84d6f,
6630            fidl::encoding::DynamicFlags::FLEXIBLE,
6631            _decode,
6632        )
6633    }
6634
6635    type GetCapabilitiesResponseFut = fidl::client::QueryResponseFut<
6636        WifiChipGetCapabilitiesResponse,
6637        fidl::encoding::DefaultFuchsiaResourceDialect,
6638    >;
6639    fn r#get_capabilities(&self) -> Self::GetCapabilitiesResponseFut {
6640        fn _decode(
6641            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6642        ) -> Result<WifiChipGetCapabilitiesResponse, fidl::Error> {
6643            let _response = fidl::client::decode_transaction_body::<
6644                fidl::encoding::FlexibleType<WifiChipGetCapabilitiesResponse>,
6645                fidl::encoding::DefaultFuchsiaResourceDialect,
6646                0x1b253f396dcaa2e0,
6647            >(_buf?)?
6648            .into_result::<WifiChipMarker>("get_capabilities")?;
6649            Ok(_response)
6650        }
6651        self.client
6652            .send_query_and_decode::<fidl::encoding::EmptyPayload, WifiChipGetCapabilitiesResponse>(
6653                (),
6654                0x1b253f396dcaa2e0,
6655                fidl::encoding::DynamicFlags::FLEXIBLE,
6656                _decode,
6657            )
6658    }
6659
6660    type TriggerSubsystemRestartResponseFut = fidl::client::QueryResponseFut<
6661        WifiChipTriggerSubsystemRestartResult,
6662        fidl::encoding::DefaultFuchsiaResourceDialect,
6663    >;
6664    fn r#trigger_subsystem_restart(&self) -> Self::TriggerSubsystemRestartResponseFut {
6665        fn _decode(
6666            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6667        ) -> Result<WifiChipTriggerSubsystemRestartResult, fidl::Error> {
6668            let _response = fidl::client::decode_transaction_body::<
6669                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
6670                fidl::encoding::DefaultFuchsiaResourceDialect,
6671                0x42ffcae5aad196f9,
6672            >(_buf?)?
6673            .into_result::<WifiChipMarker>("trigger_subsystem_restart")?;
6674            Ok(_response.map(|x| x))
6675        }
6676        self.client.send_query_and_decode::<
6677            fidl::encoding::EmptyPayload,
6678            WifiChipTriggerSubsystemRestartResult,
6679        >(
6680            (),
6681            0x42ffcae5aad196f9,
6682            fidl::encoding::DynamicFlags::FLEXIBLE,
6683            _decode,
6684        )
6685    }
6686
6687    type SelectTxPowerScenarioResponseFut =
6688        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
6689    fn r#select_tx_power_scenario(
6690        &self,
6691        mut scenario: WifiChipTxPowerScenario,
6692    ) -> Self::SelectTxPowerScenarioResponseFut {
6693        fn _decode(
6694            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6695        ) -> Result<(), fidl::Error> {
6696            let _response = fidl::client::decode_transaction_body::<
6697                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
6698                fidl::encoding::DefaultFuchsiaResourceDialect,
6699                0x19287ab52ea72281,
6700            >(_buf?)?
6701            .into_result::<WifiChipMarker>("select_tx_power_scenario")?;
6702            Ok(_response)
6703        }
6704        self.client.send_query_and_decode::<WifiChipSelectTxPowerScenarioRequest, ()>(
6705            (scenario,),
6706            0x19287ab52ea72281,
6707            fidl::encoding::DynamicFlags::FLEXIBLE,
6708            _decode,
6709        )
6710    }
6711
6712    type ResetTxPowerScenarioResponseFut =
6713        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
6714    fn r#reset_tx_power_scenario(&self) -> Self::ResetTxPowerScenarioResponseFut {
6715        fn _decode(
6716            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6717        ) -> Result<(), fidl::Error> {
6718            let _response = fidl::client::decode_transaction_body::<
6719                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
6720                fidl::encoding::DefaultFuchsiaResourceDialect,
6721                0x46408a2fb1eb9d09,
6722            >(_buf?)?
6723            .into_result::<WifiChipMarker>("reset_tx_power_scenario")?;
6724            Ok(_response)
6725        }
6726        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
6727            (),
6728            0x46408a2fb1eb9d09,
6729            fidl::encoding::DynamicFlags::FLEXIBLE,
6730            _decode,
6731        )
6732    }
6733}
6734
6735pub struct WifiChipEventStream {
6736    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6737}
6738
6739impl std::marker::Unpin for WifiChipEventStream {}
6740
6741impl futures::stream::FusedStream for WifiChipEventStream {
6742    fn is_terminated(&self) -> bool {
6743        self.event_receiver.is_terminated()
6744    }
6745}
6746
6747impl futures::Stream for WifiChipEventStream {
6748    type Item = Result<WifiChipEvent, fidl::Error>;
6749
6750    fn poll_next(
6751        mut self: std::pin::Pin<&mut Self>,
6752        cx: &mut std::task::Context<'_>,
6753    ) -> std::task::Poll<Option<Self::Item>> {
6754        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6755            &mut self.event_receiver,
6756            cx
6757        )?) {
6758            Some(buf) => std::task::Poll::Ready(Some(WifiChipEvent::decode(buf))),
6759            None => std::task::Poll::Ready(None),
6760        }
6761    }
6762}
6763
6764#[derive(Debug)]
6765pub enum WifiChipEvent {
6766    #[non_exhaustive]
6767    _UnknownEvent {
6768        /// Ordinal of the event that was sent.
6769        ordinal: u64,
6770    },
6771}
6772
6773impl WifiChipEvent {
6774    /// Decodes a message buffer as a [`WifiChipEvent`].
6775    fn decode(
6776        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6777    ) -> Result<WifiChipEvent, fidl::Error> {
6778        let (bytes, _handles) = buf.split_mut();
6779        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6780        debug_assert_eq!(tx_header.tx_id, 0);
6781        match tx_header.ordinal {
6782            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
6783                Ok(WifiChipEvent::_UnknownEvent { ordinal: tx_header.ordinal })
6784            }
6785            _ => Err(fidl::Error::UnknownOrdinal {
6786                ordinal: tx_header.ordinal,
6787                protocol_name: <WifiChipMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6788            }),
6789        }
6790    }
6791}
6792
6793/// A Stream of incoming requests for fuchsia.wlan.wlanix/WifiChip.
6794pub struct WifiChipRequestStream {
6795    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6796    is_terminated: bool,
6797}
6798
6799impl std::marker::Unpin for WifiChipRequestStream {}
6800
6801impl futures::stream::FusedStream for WifiChipRequestStream {
6802    fn is_terminated(&self) -> bool {
6803        self.is_terminated
6804    }
6805}
6806
6807impl fidl::endpoints::RequestStream for WifiChipRequestStream {
6808    type Protocol = WifiChipMarker;
6809    type ControlHandle = WifiChipControlHandle;
6810
6811    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6812        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6813    }
6814
6815    fn control_handle(&self) -> Self::ControlHandle {
6816        WifiChipControlHandle { inner: self.inner.clone() }
6817    }
6818
6819    fn into_inner(
6820        self,
6821    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6822    {
6823        (self.inner, self.is_terminated)
6824    }
6825
6826    fn from_inner(
6827        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6828        is_terminated: bool,
6829    ) -> Self {
6830        Self { inner, is_terminated }
6831    }
6832}
6833
6834impl futures::Stream for WifiChipRequestStream {
6835    type Item = Result<WifiChipRequest, fidl::Error>;
6836
6837    fn poll_next(
6838        mut self: std::pin::Pin<&mut Self>,
6839        cx: &mut std::task::Context<'_>,
6840    ) -> std::task::Poll<Option<Self::Item>> {
6841        let this = &mut *self;
6842        if this.inner.check_shutdown(cx) {
6843            this.is_terminated = true;
6844            return std::task::Poll::Ready(None);
6845        }
6846        if this.is_terminated {
6847            panic!("polled WifiChipRequestStream after completion");
6848        }
6849        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6850            |bytes, handles| {
6851                match this.inner.channel().read_etc(cx, bytes, handles) {
6852                    std::task::Poll::Ready(Ok(())) => {}
6853                    std::task::Poll::Pending => return std::task::Poll::Pending,
6854                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6855                        this.is_terminated = true;
6856                        return std::task::Poll::Ready(None);
6857                    }
6858                    std::task::Poll::Ready(Err(e)) => {
6859                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6860                            e.into(),
6861                        ))));
6862                    }
6863                }
6864
6865                // A message has been received from the channel
6866                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6867
6868                std::task::Poll::Ready(Some(match header.ordinal {
6869                    0x6fb2d5892face7af => {
6870                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6871                        let mut req = fidl::new_empty!(
6872                            WifiChipCreateStaIfaceRequest,
6873                            fidl::encoding::DefaultFuchsiaResourceDialect
6874                        );
6875                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WifiChipCreateStaIfaceRequest>(&header, _body_bytes, handles, &mut req)?;
6876                        let control_handle = WifiChipControlHandle { inner: this.inner.clone() };
6877                        Ok(WifiChipRequest::CreateStaIface {
6878                            payload: req,
6879                            responder: WifiChipCreateStaIfaceResponder {
6880                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6881                                tx_id: header.tx_id,
6882                            },
6883                        })
6884                    }
6885                    0x349257482df6a000 => {
6886                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6887                        let mut req = fidl::new_empty!(
6888                            fidl::encoding::EmptyPayload,
6889                            fidl::encoding::DefaultFuchsiaResourceDialect
6890                        );
6891                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6892                        let control_handle = WifiChipControlHandle { inner: this.inner.clone() };
6893                        Ok(WifiChipRequest::GetStaIfaceNames {
6894                            responder: WifiChipGetStaIfaceNamesResponder {
6895                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6896                                tx_id: header.tx_id,
6897                            },
6898                        })
6899                    }
6900                    0x6d9704eeb36f28a2 => {
6901                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6902                        let mut req = fidl::new_empty!(
6903                            WifiChipGetStaIfaceRequest,
6904                            fidl::encoding::DefaultFuchsiaResourceDialect
6905                        );
6906                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WifiChipGetStaIfaceRequest>(&header, _body_bytes, handles, &mut req)?;
6907                        let control_handle = WifiChipControlHandle { inner: this.inner.clone() };
6908                        Ok(WifiChipRequest::GetStaIface {
6909                            payload: req,
6910                            responder: WifiChipGetStaIfaceResponder {
6911                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6912                                tx_id: header.tx_id,
6913                            },
6914                        })
6915                    }
6916                    0x4cd8eee466f8b04c => {
6917                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6918                        let mut req = fidl::new_empty!(
6919                            WifiChipRemoveStaIfaceRequest,
6920                            fidl::encoding::DefaultFuchsiaResourceDialect
6921                        );
6922                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WifiChipRemoveStaIfaceRequest>(&header, _body_bytes, handles, &mut req)?;
6923                        let control_handle = WifiChipControlHandle { inner: this.inner.clone() };
6924                        Ok(WifiChipRequest::RemoveStaIface {
6925                            payload: req,
6926                            responder: WifiChipRemoveStaIfaceResponder {
6927                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6928                                tx_id: header.tx_id,
6929                            },
6930                        })
6931                    }
6932                    0x1dfe372d1d61a490 => {
6933                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6934                        let mut req = fidl::new_empty!(
6935                            WifiChipSetCountryCodeRequest,
6936                            fidl::encoding::DefaultFuchsiaResourceDialect
6937                        );
6938                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WifiChipSetCountryCodeRequest>(&header, _body_bytes, handles, &mut req)?;
6939                        let control_handle = WifiChipControlHandle { inner: this.inner.clone() };
6940                        Ok(WifiChipRequest::SetCountryCode {
6941                            payload: req,
6942                            responder: WifiChipSetCountryCodeResponder {
6943                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6944                                tx_id: header.tx_id,
6945                            },
6946                        })
6947                    }
6948                    0x1701095b452a3acd => {
6949                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6950                        let mut req = fidl::new_empty!(
6951                            fidl::encoding::EmptyPayload,
6952                            fidl::encoding::DefaultFuchsiaResourceDialect
6953                        );
6954                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6955                        let control_handle = WifiChipControlHandle { inner: this.inner.clone() };
6956                        Ok(WifiChipRequest::GetAvailableModes {
6957                            responder: WifiChipGetAvailableModesResponder {
6958                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6959                                tx_id: header.tx_id,
6960                            },
6961                        })
6962                    }
6963                    0x37d5197325bb3370 => {
6964                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6965                        let mut req = fidl::new_empty!(
6966                            fidl::encoding::EmptyPayload,
6967                            fidl::encoding::DefaultFuchsiaResourceDialect
6968                        );
6969                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6970                        let control_handle = WifiChipControlHandle { inner: this.inner.clone() };
6971                        Ok(WifiChipRequest::GetId {
6972                            responder: WifiChipGetIdResponder {
6973                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6974                                tx_id: header.tx_id,
6975                            },
6976                        })
6977                    }
6978                    0x4d209e0f3ac84d6f => {
6979                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6980                        let mut req = fidl::new_empty!(
6981                            fidl::encoding::EmptyPayload,
6982                            fidl::encoding::DefaultFuchsiaResourceDialect
6983                        );
6984                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6985                        let control_handle = WifiChipControlHandle { inner: this.inner.clone() };
6986                        Ok(WifiChipRequest::GetMode {
6987                            responder: WifiChipGetModeResponder {
6988                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6989                                tx_id: header.tx_id,
6990                            },
6991                        })
6992                    }
6993                    0x1b253f396dcaa2e0 => {
6994                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6995                        let mut req = fidl::new_empty!(
6996                            fidl::encoding::EmptyPayload,
6997                            fidl::encoding::DefaultFuchsiaResourceDialect
6998                        );
6999                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7000                        let control_handle = WifiChipControlHandle { inner: this.inner.clone() };
7001                        Ok(WifiChipRequest::GetCapabilities {
7002                            responder: WifiChipGetCapabilitiesResponder {
7003                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7004                                tx_id: header.tx_id,
7005                            },
7006                        })
7007                    }
7008                    0x42ffcae5aad196f9 => {
7009                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7010                        let mut req = fidl::new_empty!(
7011                            fidl::encoding::EmptyPayload,
7012                            fidl::encoding::DefaultFuchsiaResourceDialect
7013                        );
7014                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7015                        let control_handle = WifiChipControlHandle { inner: this.inner.clone() };
7016                        Ok(WifiChipRequest::TriggerSubsystemRestart {
7017                            responder: WifiChipTriggerSubsystemRestartResponder {
7018                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7019                                tx_id: header.tx_id,
7020                            },
7021                        })
7022                    }
7023                    0x19287ab52ea72281 => {
7024                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7025                        let mut req = fidl::new_empty!(
7026                            WifiChipSelectTxPowerScenarioRequest,
7027                            fidl::encoding::DefaultFuchsiaResourceDialect
7028                        );
7029                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WifiChipSelectTxPowerScenarioRequest>(&header, _body_bytes, handles, &mut req)?;
7030                        let control_handle = WifiChipControlHandle { inner: this.inner.clone() };
7031                        Ok(WifiChipRequest::SelectTxPowerScenario {
7032                            scenario: req.scenario,
7033
7034                            responder: WifiChipSelectTxPowerScenarioResponder {
7035                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7036                                tx_id: header.tx_id,
7037                            },
7038                        })
7039                    }
7040                    0x46408a2fb1eb9d09 => {
7041                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7042                        let mut req = fidl::new_empty!(
7043                            fidl::encoding::EmptyPayload,
7044                            fidl::encoding::DefaultFuchsiaResourceDialect
7045                        );
7046                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7047                        let control_handle = WifiChipControlHandle { inner: this.inner.clone() };
7048                        Ok(WifiChipRequest::ResetTxPowerScenario {
7049                            responder: WifiChipResetTxPowerScenarioResponder {
7050                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7051                                tx_id: header.tx_id,
7052                            },
7053                        })
7054                    }
7055                    _ if header.tx_id == 0
7056                        && header
7057                            .dynamic_flags()
7058                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
7059                    {
7060                        Ok(WifiChipRequest::_UnknownMethod {
7061                            ordinal: header.ordinal,
7062                            control_handle: WifiChipControlHandle { inner: this.inner.clone() },
7063                            method_type: fidl::MethodType::OneWay,
7064                        })
7065                    }
7066                    _ if header
7067                        .dynamic_flags()
7068                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
7069                    {
7070                        this.inner.send_framework_err(
7071                            fidl::encoding::FrameworkErr::UnknownMethod,
7072                            header.tx_id,
7073                            header.ordinal,
7074                            header.dynamic_flags(),
7075                            (bytes, handles),
7076                        )?;
7077                        Ok(WifiChipRequest::_UnknownMethod {
7078                            ordinal: header.ordinal,
7079                            control_handle: WifiChipControlHandle { inner: this.inner.clone() },
7080                            method_type: fidl::MethodType::TwoWay,
7081                        })
7082                    }
7083                    _ => Err(fidl::Error::UnknownOrdinal {
7084                        ordinal: header.ordinal,
7085                        protocol_name:
7086                            <WifiChipMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7087                    }),
7088                }))
7089            },
7090        )
7091    }
7092}
7093
7094#[derive(Debug)]
7095pub enum WifiChipRequest {
7096    /// Request the chip to create a STA iface.
7097    CreateStaIface {
7098        payload: WifiChipCreateStaIfaceRequest,
7099        responder: WifiChipCreateStaIfaceResponder,
7100    },
7101    /// Get the names of all active ifaces.
7102    GetStaIfaceNames { responder: WifiChipGetStaIfaceNamesResponder },
7103    /// Request a new connection to an existing iface.
7104    GetStaIface { payload: WifiChipGetStaIfaceRequest, responder: WifiChipGetStaIfaceResponder },
7105    /// Request the destruction of a STA iface on the chip.
7106    RemoveStaIface {
7107        payload: WifiChipRemoveStaIfaceRequest,
7108        responder: WifiChipRemoveStaIfaceResponder,
7109    },
7110    SetCountryCode {
7111        payload: WifiChipSetCountryCodeRequest,
7112        responder: WifiChipSetCountryCodeResponder,
7113    },
7114    /// Get a set of operation modes that the chip supports.
7115    /// This combination encodes what iface types and how many can be created,
7116    /// and which ones can run concurrently.
7117    GetAvailableModes { responder: WifiChipGetAvailableModesResponder },
7118    /// Get the ID of the current chip.
7119    GetId { responder: WifiChipGetIdResponder },
7120    /// Get the current mode that the chip is in.
7121    GetMode { responder: WifiChipGetModeResponder },
7122    /// Get capabilities supported by this chip.
7123    GetCapabilities { responder: WifiChipGetCapabilitiesResponder },
7124    /// Restart the subsystem. This is called to attempt recovery when there
7125    /// is a persistent issue with WiFi.
7126    TriggerSubsystemRestart { responder: WifiChipTriggerSubsystemRestartResponder },
7127    /// Configures the SAR setting for this chip.
7128    SelectTxPowerScenario {
7129        scenario: WifiChipTxPowerScenario,
7130        responder: WifiChipSelectTxPowerScenarioResponder,
7131    },
7132    /// Restore the default SAR setting for this chip.
7133    ResetTxPowerScenario { responder: WifiChipResetTxPowerScenarioResponder },
7134    /// An interaction was received which does not match any known method.
7135    #[non_exhaustive]
7136    _UnknownMethod {
7137        /// Ordinal of the method that was called.
7138        ordinal: u64,
7139        control_handle: WifiChipControlHandle,
7140        method_type: fidl::MethodType,
7141    },
7142}
7143
7144impl WifiChipRequest {
7145    #[allow(irrefutable_let_patterns)]
7146    pub fn into_create_sta_iface(
7147        self,
7148    ) -> Option<(WifiChipCreateStaIfaceRequest, WifiChipCreateStaIfaceResponder)> {
7149        if let WifiChipRequest::CreateStaIface { payload, responder } = self {
7150            Some((payload, responder))
7151        } else {
7152            None
7153        }
7154    }
7155
7156    #[allow(irrefutable_let_patterns)]
7157    pub fn into_get_sta_iface_names(self) -> Option<(WifiChipGetStaIfaceNamesResponder)> {
7158        if let WifiChipRequest::GetStaIfaceNames { responder } = self {
7159            Some((responder))
7160        } else {
7161            None
7162        }
7163    }
7164
7165    #[allow(irrefutable_let_patterns)]
7166    pub fn into_get_sta_iface(
7167        self,
7168    ) -> Option<(WifiChipGetStaIfaceRequest, WifiChipGetStaIfaceResponder)> {
7169        if let WifiChipRequest::GetStaIface { payload, responder } = self {
7170            Some((payload, responder))
7171        } else {
7172            None
7173        }
7174    }
7175
7176    #[allow(irrefutable_let_patterns)]
7177    pub fn into_remove_sta_iface(
7178        self,
7179    ) -> Option<(WifiChipRemoveStaIfaceRequest, WifiChipRemoveStaIfaceResponder)> {
7180        if let WifiChipRequest::RemoveStaIface { payload, responder } = self {
7181            Some((payload, responder))
7182        } else {
7183            None
7184        }
7185    }
7186
7187    #[allow(irrefutable_let_patterns)]
7188    pub fn into_set_country_code(
7189        self,
7190    ) -> Option<(WifiChipSetCountryCodeRequest, WifiChipSetCountryCodeResponder)> {
7191        if let WifiChipRequest::SetCountryCode { payload, responder } = self {
7192            Some((payload, responder))
7193        } else {
7194            None
7195        }
7196    }
7197
7198    #[allow(irrefutable_let_patterns)]
7199    pub fn into_get_available_modes(self) -> Option<(WifiChipGetAvailableModesResponder)> {
7200        if let WifiChipRequest::GetAvailableModes { responder } = self {
7201            Some((responder))
7202        } else {
7203            None
7204        }
7205    }
7206
7207    #[allow(irrefutable_let_patterns)]
7208    pub fn into_get_id(self) -> Option<(WifiChipGetIdResponder)> {
7209        if let WifiChipRequest::GetId { responder } = self { Some((responder)) } else { None }
7210    }
7211
7212    #[allow(irrefutable_let_patterns)]
7213    pub fn into_get_mode(self) -> Option<(WifiChipGetModeResponder)> {
7214        if let WifiChipRequest::GetMode { responder } = self { Some((responder)) } else { None }
7215    }
7216
7217    #[allow(irrefutable_let_patterns)]
7218    pub fn into_get_capabilities(self) -> Option<(WifiChipGetCapabilitiesResponder)> {
7219        if let WifiChipRequest::GetCapabilities { responder } = self {
7220            Some((responder))
7221        } else {
7222            None
7223        }
7224    }
7225
7226    #[allow(irrefutable_let_patterns)]
7227    pub fn into_trigger_subsystem_restart(
7228        self,
7229    ) -> Option<(WifiChipTriggerSubsystemRestartResponder)> {
7230        if let WifiChipRequest::TriggerSubsystemRestart { responder } = self {
7231            Some((responder))
7232        } else {
7233            None
7234        }
7235    }
7236
7237    #[allow(irrefutable_let_patterns)]
7238    pub fn into_select_tx_power_scenario(
7239        self,
7240    ) -> Option<(WifiChipTxPowerScenario, WifiChipSelectTxPowerScenarioResponder)> {
7241        if let WifiChipRequest::SelectTxPowerScenario { scenario, responder } = self {
7242            Some((scenario, responder))
7243        } else {
7244            None
7245        }
7246    }
7247
7248    #[allow(irrefutable_let_patterns)]
7249    pub fn into_reset_tx_power_scenario(self) -> Option<(WifiChipResetTxPowerScenarioResponder)> {
7250        if let WifiChipRequest::ResetTxPowerScenario { responder } = self {
7251            Some((responder))
7252        } else {
7253            None
7254        }
7255    }
7256
7257    /// Name of the method defined in FIDL
7258    pub fn method_name(&self) -> &'static str {
7259        match *self {
7260            WifiChipRequest::CreateStaIface { .. } => "create_sta_iface",
7261            WifiChipRequest::GetStaIfaceNames { .. } => "get_sta_iface_names",
7262            WifiChipRequest::GetStaIface { .. } => "get_sta_iface",
7263            WifiChipRequest::RemoveStaIface { .. } => "remove_sta_iface",
7264            WifiChipRequest::SetCountryCode { .. } => "set_country_code",
7265            WifiChipRequest::GetAvailableModes { .. } => "get_available_modes",
7266            WifiChipRequest::GetId { .. } => "get_id",
7267            WifiChipRequest::GetMode { .. } => "get_mode",
7268            WifiChipRequest::GetCapabilities { .. } => "get_capabilities",
7269            WifiChipRequest::TriggerSubsystemRestart { .. } => "trigger_subsystem_restart",
7270            WifiChipRequest::SelectTxPowerScenario { .. } => "select_tx_power_scenario",
7271            WifiChipRequest::ResetTxPowerScenario { .. } => "reset_tx_power_scenario",
7272            WifiChipRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
7273                "unknown one-way method"
7274            }
7275            WifiChipRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
7276                "unknown two-way method"
7277            }
7278        }
7279    }
7280}
7281
7282#[derive(Debug, Clone)]
7283pub struct WifiChipControlHandle {
7284    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7285}
7286
7287impl fidl::endpoints::ControlHandle for WifiChipControlHandle {
7288    fn shutdown(&self) {
7289        self.inner.shutdown()
7290    }
7291    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7292        self.inner.shutdown_with_epitaph(status)
7293    }
7294
7295    fn is_closed(&self) -> bool {
7296        self.inner.channel().is_closed()
7297    }
7298    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7299        self.inner.channel().on_closed()
7300    }
7301
7302    #[cfg(target_os = "fuchsia")]
7303    fn signal_peer(
7304        &self,
7305        clear_mask: zx::Signals,
7306        set_mask: zx::Signals,
7307    ) -> Result<(), zx_status::Status> {
7308        use fidl::Peered;
7309        self.inner.channel().signal_peer(clear_mask, set_mask)
7310    }
7311}
7312
7313impl WifiChipControlHandle {}
7314
7315#[must_use = "FIDL methods require a response to be sent"]
7316#[derive(Debug)]
7317pub struct WifiChipCreateStaIfaceResponder {
7318    control_handle: std::mem::ManuallyDrop<WifiChipControlHandle>,
7319    tx_id: u32,
7320}
7321
7322/// Set the the channel to be shutdown (see [`WifiChipControlHandle::shutdown`])
7323/// if the responder is dropped without sending a response, so that the client
7324/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7325impl std::ops::Drop for WifiChipCreateStaIfaceResponder {
7326    fn drop(&mut self) {
7327        self.control_handle.shutdown();
7328        // Safety: drops once, never accessed again
7329        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7330    }
7331}
7332
7333impl fidl::endpoints::Responder for WifiChipCreateStaIfaceResponder {
7334    type ControlHandle = WifiChipControlHandle;
7335
7336    fn control_handle(&self) -> &WifiChipControlHandle {
7337        &self.control_handle
7338    }
7339
7340    fn drop_without_shutdown(mut self) {
7341        // Safety: drops once, never accessed again due to mem::forget
7342        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7343        // Prevent Drop from running (which would shut down the channel)
7344        std::mem::forget(self);
7345    }
7346}
7347
7348impl WifiChipCreateStaIfaceResponder {
7349    /// Sends a response to the FIDL transaction.
7350    ///
7351    /// Sets the channel to shutdown if an error occurs.
7352    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7353        let _result = self.send_raw(result);
7354        if _result.is_err() {
7355            self.control_handle.shutdown();
7356        }
7357        self.drop_without_shutdown();
7358        _result
7359    }
7360
7361    /// Similar to "send" but does not shutdown the channel if an error occurs.
7362    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7363        let _result = self.send_raw(result);
7364        self.drop_without_shutdown();
7365        _result
7366    }
7367
7368    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7369        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7370            fidl::encoding::EmptyStruct,
7371            i32,
7372        >>(
7373            fidl::encoding::FlexibleResult::new(result),
7374            self.tx_id,
7375            0x6fb2d5892face7af,
7376            fidl::encoding::DynamicFlags::FLEXIBLE,
7377        )
7378    }
7379}
7380
7381#[must_use = "FIDL methods require a response to be sent"]
7382#[derive(Debug)]
7383pub struct WifiChipGetStaIfaceNamesResponder {
7384    control_handle: std::mem::ManuallyDrop<WifiChipControlHandle>,
7385    tx_id: u32,
7386}
7387
7388/// Set the the channel to be shutdown (see [`WifiChipControlHandle::shutdown`])
7389/// if the responder is dropped without sending a response, so that the client
7390/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7391impl std::ops::Drop for WifiChipGetStaIfaceNamesResponder {
7392    fn drop(&mut self) {
7393        self.control_handle.shutdown();
7394        // Safety: drops once, never accessed again
7395        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7396    }
7397}
7398
7399impl fidl::endpoints::Responder for WifiChipGetStaIfaceNamesResponder {
7400    type ControlHandle = WifiChipControlHandle;
7401
7402    fn control_handle(&self) -> &WifiChipControlHandle {
7403        &self.control_handle
7404    }
7405
7406    fn drop_without_shutdown(mut self) {
7407        // Safety: drops once, never accessed again due to mem::forget
7408        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7409        // Prevent Drop from running (which would shut down the channel)
7410        std::mem::forget(self);
7411    }
7412}
7413
7414impl WifiChipGetStaIfaceNamesResponder {
7415    /// Sends a response to the FIDL transaction.
7416    ///
7417    /// Sets the channel to shutdown if an error occurs.
7418    pub fn send(self, mut payload: &WifiChipGetStaIfaceNamesResponse) -> Result<(), fidl::Error> {
7419        let _result = self.send_raw(payload);
7420        if _result.is_err() {
7421            self.control_handle.shutdown();
7422        }
7423        self.drop_without_shutdown();
7424        _result
7425    }
7426
7427    /// Similar to "send" but does not shutdown the channel if an error occurs.
7428    pub fn send_no_shutdown_on_err(
7429        self,
7430        mut payload: &WifiChipGetStaIfaceNamesResponse,
7431    ) -> Result<(), fidl::Error> {
7432        let _result = self.send_raw(payload);
7433        self.drop_without_shutdown();
7434        _result
7435    }
7436
7437    fn send_raw(&self, mut payload: &WifiChipGetStaIfaceNamesResponse) -> Result<(), fidl::Error> {
7438        self.control_handle
7439            .inner
7440            .send::<fidl::encoding::FlexibleType<WifiChipGetStaIfaceNamesResponse>>(
7441                fidl::encoding::Flexible::new(payload),
7442                self.tx_id,
7443                0x349257482df6a000,
7444                fidl::encoding::DynamicFlags::FLEXIBLE,
7445            )
7446    }
7447}
7448
7449#[must_use = "FIDL methods require a response to be sent"]
7450#[derive(Debug)]
7451pub struct WifiChipGetStaIfaceResponder {
7452    control_handle: std::mem::ManuallyDrop<WifiChipControlHandle>,
7453    tx_id: u32,
7454}
7455
7456/// Set the the channel to be shutdown (see [`WifiChipControlHandle::shutdown`])
7457/// if the responder is dropped without sending a response, so that the client
7458/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7459impl std::ops::Drop for WifiChipGetStaIfaceResponder {
7460    fn drop(&mut self) {
7461        self.control_handle.shutdown();
7462        // Safety: drops once, never accessed again
7463        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7464    }
7465}
7466
7467impl fidl::endpoints::Responder for WifiChipGetStaIfaceResponder {
7468    type ControlHandle = WifiChipControlHandle;
7469
7470    fn control_handle(&self) -> &WifiChipControlHandle {
7471        &self.control_handle
7472    }
7473
7474    fn drop_without_shutdown(mut self) {
7475        // Safety: drops once, never accessed again due to mem::forget
7476        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7477        // Prevent Drop from running (which would shut down the channel)
7478        std::mem::forget(self);
7479    }
7480}
7481
7482impl WifiChipGetStaIfaceResponder {
7483    /// Sends a response to the FIDL transaction.
7484    ///
7485    /// Sets the channel to shutdown if an error occurs.
7486    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7487        let _result = self.send_raw(result);
7488        if _result.is_err() {
7489            self.control_handle.shutdown();
7490        }
7491        self.drop_without_shutdown();
7492        _result
7493    }
7494
7495    /// Similar to "send" but does not shutdown the channel if an error occurs.
7496    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7497        let _result = self.send_raw(result);
7498        self.drop_without_shutdown();
7499        _result
7500    }
7501
7502    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7503        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7504            fidl::encoding::EmptyStruct,
7505            i32,
7506        >>(
7507            fidl::encoding::FlexibleResult::new(result),
7508            self.tx_id,
7509            0x6d9704eeb36f28a2,
7510            fidl::encoding::DynamicFlags::FLEXIBLE,
7511        )
7512    }
7513}
7514
7515#[must_use = "FIDL methods require a response to be sent"]
7516#[derive(Debug)]
7517pub struct WifiChipRemoveStaIfaceResponder {
7518    control_handle: std::mem::ManuallyDrop<WifiChipControlHandle>,
7519    tx_id: u32,
7520}
7521
7522/// Set the the channel to be shutdown (see [`WifiChipControlHandle::shutdown`])
7523/// if the responder is dropped without sending a response, so that the client
7524/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7525impl std::ops::Drop for WifiChipRemoveStaIfaceResponder {
7526    fn drop(&mut self) {
7527        self.control_handle.shutdown();
7528        // Safety: drops once, never accessed again
7529        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7530    }
7531}
7532
7533impl fidl::endpoints::Responder for WifiChipRemoveStaIfaceResponder {
7534    type ControlHandle = WifiChipControlHandle;
7535
7536    fn control_handle(&self) -> &WifiChipControlHandle {
7537        &self.control_handle
7538    }
7539
7540    fn drop_without_shutdown(mut self) {
7541        // Safety: drops once, never accessed again due to mem::forget
7542        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7543        // Prevent Drop from running (which would shut down the channel)
7544        std::mem::forget(self);
7545    }
7546}
7547
7548impl WifiChipRemoveStaIfaceResponder {
7549    /// Sends a response to the FIDL transaction.
7550    ///
7551    /// Sets the channel to shutdown if an error occurs.
7552    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7553        let _result = self.send_raw(result);
7554        if _result.is_err() {
7555            self.control_handle.shutdown();
7556        }
7557        self.drop_without_shutdown();
7558        _result
7559    }
7560
7561    /// Similar to "send" but does not shutdown the channel if an error occurs.
7562    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7563        let _result = self.send_raw(result);
7564        self.drop_without_shutdown();
7565        _result
7566    }
7567
7568    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7569        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7570            fidl::encoding::EmptyStruct,
7571            i32,
7572        >>(
7573            fidl::encoding::FlexibleResult::new(result),
7574            self.tx_id,
7575            0x4cd8eee466f8b04c,
7576            fidl::encoding::DynamicFlags::FLEXIBLE,
7577        )
7578    }
7579}
7580
7581#[must_use = "FIDL methods require a response to be sent"]
7582#[derive(Debug)]
7583pub struct WifiChipSetCountryCodeResponder {
7584    control_handle: std::mem::ManuallyDrop<WifiChipControlHandle>,
7585    tx_id: u32,
7586}
7587
7588/// Set the the channel to be shutdown (see [`WifiChipControlHandle::shutdown`])
7589/// if the responder is dropped without sending a response, so that the client
7590/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7591impl std::ops::Drop for WifiChipSetCountryCodeResponder {
7592    fn drop(&mut self) {
7593        self.control_handle.shutdown();
7594        // Safety: drops once, never accessed again
7595        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7596    }
7597}
7598
7599impl fidl::endpoints::Responder for WifiChipSetCountryCodeResponder {
7600    type ControlHandle = WifiChipControlHandle;
7601
7602    fn control_handle(&self) -> &WifiChipControlHandle {
7603        &self.control_handle
7604    }
7605
7606    fn drop_without_shutdown(mut self) {
7607        // Safety: drops once, never accessed again due to mem::forget
7608        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7609        // Prevent Drop from running (which would shut down the channel)
7610        std::mem::forget(self);
7611    }
7612}
7613
7614impl WifiChipSetCountryCodeResponder {
7615    /// Sends a response to the FIDL transaction.
7616    ///
7617    /// Sets the channel to shutdown if an error occurs.
7618    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7619        let _result = self.send_raw(result);
7620        if _result.is_err() {
7621            self.control_handle.shutdown();
7622        }
7623        self.drop_without_shutdown();
7624        _result
7625    }
7626
7627    /// Similar to "send" but does not shutdown the channel if an error occurs.
7628    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7629        let _result = self.send_raw(result);
7630        self.drop_without_shutdown();
7631        _result
7632    }
7633
7634    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7635        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7636            fidl::encoding::EmptyStruct,
7637            i32,
7638        >>(
7639            fidl::encoding::FlexibleResult::new(result),
7640            self.tx_id,
7641            0x1dfe372d1d61a490,
7642            fidl::encoding::DynamicFlags::FLEXIBLE,
7643        )
7644    }
7645}
7646
7647#[must_use = "FIDL methods require a response to be sent"]
7648#[derive(Debug)]
7649pub struct WifiChipGetAvailableModesResponder {
7650    control_handle: std::mem::ManuallyDrop<WifiChipControlHandle>,
7651    tx_id: u32,
7652}
7653
7654/// Set the the channel to be shutdown (see [`WifiChipControlHandle::shutdown`])
7655/// if the responder is dropped without sending a response, so that the client
7656/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7657impl std::ops::Drop for WifiChipGetAvailableModesResponder {
7658    fn drop(&mut self) {
7659        self.control_handle.shutdown();
7660        // Safety: drops once, never accessed again
7661        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7662    }
7663}
7664
7665impl fidl::endpoints::Responder for WifiChipGetAvailableModesResponder {
7666    type ControlHandle = WifiChipControlHandle;
7667
7668    fn control_handle(&self) -> &WifiChipControlHandle {
7669        &self.control_handle
7670    }
7671
7672    fn drop_without_shutdown(mut self) {
7673        // Safety: drops once, never accessed again due to mem::forget
7674        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7675        // Prevent Drop from running (which would shut down the channel)
7676        std::mem::forget(self);
7677    }
7678}
7679
7680impl WifiChipGetAvailableModesResponder {
7681    /// Sends a response to the FIDL transaction.
7682    ///
7683    /// Sets the channel to shutdown if an error occurs.
7684    pub fn send(self, mut payload: &WifiChipGetAvailableModesResponse) -> Result<(), fidl::Error> {
7685        let _result = self.send_raw(payload);
7686        if _result.is_err() {
7687            self.control_handle.shutdown();
7688        }
7689        self.drop_without_shutdown();
7690        _result
7691    }
7692
7693    /// Similar to "send" but does not shutdown the channel if an error occurs.
7694    pub fn send_no_shutdown_on_err(
7695        self,
7696        mut payload: &WifiChipGetAvailableModesResponse,
7697    ) -> Result<(), fidl::Error> {
7698        let _result = self.send_raw(payload);
7699        self.drop_without_shutdown();
7700        _result
7701    }
7702
7703    fn send_raw(&self, mut payload: &WifiChipGetAvailableModesResponse) -> Result<(), fidl::Error> {
7704        self.control_handle
7705            .inner
7706            .send::<fidl::encoding::FlexibleType<WifiChipGetAvailableModesResponse>>(
7707                fidl::encoding::Flexible::new(payload),
7708                self.tx_id,
7709                0x1701095b452a3acd,
7710                fidl::encoding::DynamicFlags::FLEXIBLE,
7711            )
7712    }
7713}
7714
7715#[must_use = "FIDL methods require a response to be sent"]
7716#[derive(Debug)]
7717pub struct WifiChipGetIdResponder {
7718    control_handle: std::mem::ManuallyDrop<WifiChipControlHandle>,
7719    tx_id: u32,
7720}
7721
7722/// Set the the channel to be shutdown (see [`WifiChipControlHandle::shutdown`])
7723/// if the responder is dropped without sending a response, so that the client
7724/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7725impl std::ops::Drop for WifiChipGetIdResponder {
7726    fn drop(&mut self) {
7727        self.control_handle.shutdown();
7728        // Safety: drops once, never accessed again
7729        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7730    }
7731}
7732
7733impl fidl::endpoints::Responder for WifiChipGetIdResponder {
7734    type ControlHandle = WifiChipControlHandle;
7735
7736    fn control_handle(&self) -> &WifiChipControlHandle {
7737        &self.control_handle
7738    }
7739
7740    fn drop_without_shutdown(mut self) {
7741        // Safety: drops once, never accessed again due to mem::forget
7742        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7743        // Prevent Drop from running (which would shut down the channel)
7744        std::mem::forget(self);
7745    }
7746}
7747
7748impl WifiChipGetIdResponder {
7749    /// Sends a response to the FIDL transaction.
7750    ///
7751    /// Sets the channel to shutdown if an error occurs.
7752    pub fn send(self, mut payload: &WifiChipGetIdResponse) -> Result<(), fidl::Error> {
7753        let _result = self.send_raw(payload);
7754        if _result.is_err() {
7755            self.control_handle.shutdown();
7756        }
7757        self.drop_without_shutdown();
7758        _result
7759    }
7760
7761    /// Similar to "send" but does not shutdown the channel if an error occurs.
7762    pub fn send_no_shutdown_on_err(
7763        self,
7764        mut payload: &WifiChipGetIdResponse,
7765    ) -> Result<(), fidl::Error> {
7766        let _result = self.send_raw(payload);
7767        self.drop_without_shutdown();
7768        _result
7769    }
7770
7771    fn send_raw(&self, mut payload: &WifiChipGetIdResponse) -> Result<(), fidl::Error> {
7772        self.control_handle.inner.send::<fidl::encoding::FlexibleType<WifiChipGetIdResponse>>(
7773            fidl::encoding::Flexible::new(payload),
7774            self.tx_id,
7775            0x37d5197325bb3370,
7776            fidl::encoding::DynamicFlags::FLEXIBLE,
7777        )
7778    }
7779}
7780
7781#[must_use = "FIDL methods require a response to be sent"]
7782#[derive(Debug)]
7783pub struct WifiChipGetModeResponder {
7784    control_handle: std::mem::ManuallyDrop<WifiChipControlHandle>,
7785    tx_id: u32,
7786}
7787
7788/// Set the the channel to be shutdown (see [`WifiChipControlHandle::shutdown`])
7789/// if the responder is dropped without sending a response, so that the client
7790/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7791impl std::ops::Drop for WifiChipGetModeResponder {
7792    fn drop(&mut self) {
7793        self.control_handle.shutdown();
7794        // Safety: drops once, never accessed again
7795        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7796    }
7797}
7798
7799impl fidl::endpoints::Responder for WifiChipGetModeResponder {
7800    type ControlHandle = WifiChipControlHandle;
7801
7802    fn control_handle(&self) -> &WifiChipControlHandle {
7803        &self.control_handle
7804    }
7805
7806    fn drop_without_shutdown(mut self) {
7807        // Safety: drops once, never accessed again due to mem::forget
7808        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7809        // Prevent Drop from running (which would shut down the channel)
7810        std::mem::forget(self);
7811    }
7812}
7813
7814impl WifiChipGetModeResponder {
7815    /// Sends a response to the FIDL transaction.
7816    ///
7817    /// Sets the channel to shutdown if an error occurs.
7818    pub fn send(self, mut payload: &WifiChipGetModeResponse) -> Result<(), fidl::Error> {
7819        let _result = self.send_raw(payload);
7820        if _result.is_err() {
7821            self.control_handle.shutdown();
7822        }
7823        self.drop_without_shutdown();
7824        _result
7825    }
7826
7827    /// Similar to "send" but does not shutdown the channel if an error occurs.
7828    pub fn send_no_shutdown_on_err(
7829        self,
7830        mut payload: &WifiChipGetModeResponse,
7831    ) -> Result<(), fidl::Error> {
7832        let _result = self.send_raw(payload);
7833        self.drop_without_shutdown();
7834        _result
7835    }
7836
7837    fn send_raw(&self, mut payload: &WifiChipGetModeResponse) -> Result<(), fidl::Error> {
7838        self.control_handle.inner.send::<fidl::encoding::FlexibleType<WifiChipGetModeResponse>>(
7839            fidl::encoding::Flexible::new(payload),
7840            self.tx_id,
7841            0x4d209e0f3ac84d6f,
7842            fidl::encoding::DynamicFlags::FLEXIBLE,
7843        )
7844    }
7845}
7846
7847#[must_use = "FIDL methods require a response to be sent"]
7848#[derive(Debug)]
7849pub struct WifiChipGetCapabilitiesResponder {
7850    control_handle: std::mem::ManuallyDrop<WifiChipControlHandle>,
7851    tx_id: u32,
7852}
7853
7854/// Set the the channel to be shutdown (see [`WifiChipControlHandle::shutdown`])
7855/// if the responder is dropped without sending a response, so that the client
7856/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7857impl std::ops::Drop for WifiChipGetCapabilitiesResponder {
7858    fn drop(&mut self) {
7859        self.control_handle.shutdown();
7860        // Safety: drops once, never accessed again
7861        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7862    }
7863}
7864
7865impl fidl::endpoints::Responder for WifiChipGetCapabilitiesResponder {
7866    type ControlHandle = WifiChipControlHandle;
7867
7868    fn control_handle(&self) -> &WifiChipControlHandle {
7869        &self.control_handle
7870    }
7871
7872    fn drop_without_shutdown(mut self) {
7873        // Safety: drops once, never accessed again due to mem::forget
7874        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7875        // Prevent Drop from running (which would shut down the channel)
7876        std::mem::forget(self);
7877    }
7878}
7879
7880impl WifiChipGetCapabilitiesResponder {
7881    /// Sends a response to the FIDL transaction.
7882    ///
7883    /// Sets the channel to shutdown if an error occurs.
7884    pub fn send(self, mut payload: &WifiChipGetCapabilitiesResponse) -> Result<(), fidl::Error> {
7885        let _result = self.send_raw(payload);
7886        if _result.is_err() {
7887            self.control_handle.shutdown();
7888        }
7889        self.drop_without_shutdown();
7890        _result
7891    }
7892
7893    /// Similar to "send" but does not shutdown the channel if an error occurs.
7894    pub fn send_no_shutdown_on_err(
7895        self,
7896        mut payload: &WifiChipGetCapabilitiesResponse,
7897    ) -> Result<(), fidl::Error> {
7898        let _result = self.send_raw(payload);
7899        self.drop_without_shutdown();
7900        _result
7901    }
7902
7903    fn send_raw(&self, mut payload: &WifiChipGetCapabilitiesResponse) -> Result<(), fidl::Error> {
7904        self.control_handle
7905            .inner
7906            .send::<fidl::encoding::FlexibleType<WifiChipGetCapabilitiesResponse>>(
7907                fidl::encoding::Flexible::new(payload),
7908                self.tx_id,
7909                0x1b253f396dcaa2e0,
7910                fidl::encoding::DynamicFlags::FLEXIBLE,
7911            )
7912    }
7913}
7914
7915#[must_use = "FIDL methods require a response to be sent"]
7916#[derive(Debug)]
7917pub struct WifiChipTriggerSubsystemRestartResponder {
7918    control_handle: std::mem::ManuallyDrop<WifiChipControlHandle>,
7919    tx_id: u32,
7920}
7921
7922/// Set the the channel to be shutdown (see [`WifiChipControlHandle::shutdown`])
7923/// if the responder is dropped without sending a response, so that the client
7924/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7925impl std::ops::Drop for WifiChipTriggerSubsystemRestartResponder {
7926    fn drop(&mut self) {
7927        self.control_handle.shutdown();
7928        // Safety: drops once, never accessed again
7929        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7930    }
7931}
7932
7933impl fidl::endpoints::Responder for WifiChipTriggerSubsystemRestartResponder {
7934    type ControlHandle = WifiChipControlHandle;
7935
7936    fn control_handle(&self) -> &WifiChipControlHandle {
7937        &self.control_handle
7938    }
7939
7940    fn drop_without_shutdown(mut self) {
7941        // Safety: drops once, never accessed again due to mem::forget
7942        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7943        // Prevent Drop from running (which would shut down the channel)
7944        std::mem::forget(self);
7945    }
7946}
7947
7948impl WifiChipTriggerSubsystemRestartResponder {
7949    /// Sends a response to the FIDL transaction.
7950    ///
7951    /// Sets the channel to shutdown if an error occurs.
7952    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7953        let _result = self.send_raw(result);
7954        if _result.is_err() {
7955            self.control_handle.shutdown();
7956        }
7957        self.drop_without_shutdown();
7958        _result
7959    }
7960
7961    /// Similar to "send" but does not shutdown the channel if an error occurs.
7962    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7963        let _result = self.send_raw(result);
7964        self.drop_without_shutdown();
7965        _result
7966    }
7967
7968    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
7969        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
7970            fidl::encoding::EmptyStruct,
7971            i32,
7972        >>(
7973            fidl::encoding::FlexibleResult::new(result),
7974            self.tx_id,
7975            0x42ffcae5aad196f9,
7976            fidl::encoding::DynamicFlags::FLEXIBLE,
7977        )
7978    }
7979}
7980
7981#[must_use = "FIDL methods require a response to be sent"]
7982#[derive(Debug)]
7983pub struct WifiChipSelectTxPowerScenarioResponder {
7984    control_handle: std::mem::ManuallyDrop<WifiChipControlHandle>,
7985    tx_id: u32,
7986}
7987
7988/// Set the the channel to be shutdown (see [`WifiChipControlHandle::shutdown`])
7989/// if the responder is dropped without sending a response, so that the client
7990/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7991impl std::ops::Drop for WifiChipSelectTxPowerScenarioResponder {
7992    fn drop(&mut self) {
7993        self.control_handle.shutdown();
7994        // Safety: drops once, never accessed again
7995        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7996    }
7997}
7998
7999impl fidl::endpoints::Responder for WifiChipSelectTxPowerScenarioResponder {
8000    type ControlHandle = WifiChipControlHandle;
8001
8002    fn control_handle(&self) -> &WifiChipControlHandle {
8003        &self.control_handle
8004    }
8005
8006    fn drop_without_shutdown(mut self) {
8007        // Safety: drops once, never accessed again due to mem::forget
8008        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8009        // Prevent Drop from running (which would shut down the channel)
8010        std::mem::forget(self);
8011    }
8012}
8013
8014impl WifiChipSelectTxPowerScenarioResponder {
8015    /// Sends a response to the FIDL transaction.
8016    ///
8017    /// Sets the channel to shutdown if an error occurs.
8018    pub fn send(self) -> Result<(), fidl::Error> {
8019        let _result = self.send_raw();
8020        if _result.is_err() {
8021            self.control_handle.shutdown();
8022        }
8023        self.drop_without_shutdown();
8024        _result
8025    }
8026
8027    /// Similar to "send" but does not shutdown the channel if an error occurs.
8028    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
8029        let _result = self.send_raw();
8030        self.drop_without_shutdown();
8031        _result
8032    }
8033
8034    fn send_raw(&self) -> Result<(), fidl::Error> {
8035        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
8036            fidl::encoding::Flexible::new(()),
8037            self.tx_id,
8038            0x19287ab52ea72281,
8039            fidl::encoding::DynamicFlags::FLEXIBLE,
8040        )
8041    }
8042}
8043
8044#[must_use = "FIDL methods require a response to be sent"]
8045#[derive(Debug)]
8046pub struct WifiChipResetTxPowerScenarioResponder {
8047    control_handle: std::mem::ManuallyDrop<WifiChipControlHandle>,
8048    tx_id: u32,
8049}
8050
8051/// Set the the channel to be shutdown (see [`WifiChipControlHandle::shutdown`])
8052/// if the responder is dropped without sending a response, so that the client
8053/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8054impl std::ops::Drop for WifiChipResetTxPowerScenarioResponder {
8055    fn drop(&mut self) {
8056        self.control_handle.shutdown();
8057        // Safety: drops once, never accessed again
8058        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8059    }
8060}
8061
8062impl fidl::endpoints::Responder for WifiChipResetTxPowerScenarioResponder {
8063    type ControlHandle = WifiChipControlHandle;
8064
8065    fn control_handle(&self) -> &WifiChipControlHandle {
8066        &self.control_handle
8067    }
8068
8069    fn drop_without_shutdown(mut self) {
8070        // Safety: drops once, never accessed again due to mem::forget
8071        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8072        // Prevent Drop from running (which would shut down the channel)
8073        std::mem::forget(self);
8074    }
8075}
8076
8077impl WifiChipResetTxPowerScenarioResponder {
8078    /// Sends a response to the FIDL transaction.
8079    ///
8080    /// Sets the channel to shutdown if an error occurs.
8081    pub fn send(self) -> Result<(), fidl::Error> {
8082        let _result = self.send_raw();
8083        if _result.is_err() {
8084            self.control_handle.shutdown();
8085        }
8086        self.drop_without_shutdown();
8087        _result
8088    }
8089
8090    /// Similar to "send" but does not shutdown the channel if an error occurs.
8091    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
8092        let _result = self.send_raw();
8093        self.drop_without_shutdown();
8094        _result
8095    }
8096
8097    fn send_raw(&self) -> Result<(), fidl::Error> {
8098        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
8099            fidl::encoding::Flexible::new(()),
8100            self.tx_id,
8101            0x46408a2fb1eb9d09,
8102            fidl::encoding::DynamicFlags::FLEXIBLE,
8103        )
8104    }
8105}
8106
8107#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8108pub struct WifiEventCallbackMarker;
8109
8110impl fidl::endpoints::ProtocolMarker for WifiEventCallbackMarker {
8111    type Proxy = WifiEventCallbackProxy;
8112    type RequestStream = WifiEventCallbackRequestStream;
8113    #[cfg(target_os = "fuchsia")]
8114    type SynchronousProxy = WifiEventCallbackSynchronousProxy;
8115
8116    const DEBUG_NAME: &'static str = "(anonymous) WifiEventCallback";
8117}
8118
8119pub trait WifiEventCallbackProxyInterface: Send + Sync {
8120    fn r#on_start(&self) -> Result<(), fidl::Error>;
8121    fn r#on_stop(&self) -> Result<(), fidl::Error>;
8122}
8123#[derive(Debug)]
8124#[cfg(target_os = "fuchsia")]
8125pub struct WifiEventCallbackSynchronousProxy {
8126    client: fidl::client::sync::Client,
8127}
8128
8129#[cfg(target_os = "fuchsia")]
8130impl fidl::endpoints::SynchronousProxy for WifiEventCallbackSynchronousProxy {
8131    type Proxy = WifiEventCallbackProxy;
8132    type Protocol = WifiEventCallbackMarker;
8133
8134    fn from_channel(inner: fidl::Channel) -> Self {
8135        Self::new(inner)
8136    }
8137
8138    fn into_channel(self) -> fidl::Channel {
8139        self.client.into_channel()
8140    }
8141
8142    fn as_channel(&self) -> &fidl::Channel {
8143        self.client.as_channel()
8144    }
8145}
8146
8147#[cfg(target_os = "fuchsia")]
8148impl WifiEventCallbackSynchronousProxy {
8149    pub fn new(channel: fidl::Channel) -> Self {
8150        let protocol_name =
8151            <WifiEventCallbackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8152        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8153    }
8154
8155    pub fn into_channel(self) -> fidl::Channel {
8156        self.client.into_channel()
8157    }
8158
8159    /// Waits until an event arrives and returns it. It is safe for other
8160    /// threads to make concurrent requests while waiting for an event.
8161    pub fn wait_for_event(
8162        &self,
8163        deadline: zx::MonotonicInstant,
8164    ) -> Result<WifiEventCallbackEvent, fidl::Error> {
8165        WifiEventCallbackEvent::decode(self.client.wait_for_event(deadline)?)
8166    }
8167
8168    pub fn r#on_start(&self) -> Result<(), fidl::Error> {
8169        self.client.send::<fidl::encoding::EmptyPayload>(
8170            (),
8171            0x61189ff44f9d35f3,
8172            fidl::encoding::DynamicFlags::FLEXIBLE,
8173        )
8174    }
8175
8176    pub fn r#on_stop(&self) -> Result<(), fidl::Error> {
8177        self.client.send::<fidl::encoding::EmptyPayload>(
8178            (),
8179            0x58b697bcd475e0f9,
8180            fidl::encoding::DynamicFlags::FLEXIBLE,
8181        )
8182    }
8183}
8184
8185#[cfg(target_os = "fuchsia")]
8186impl From<WifiEventCallbackSynchronousProxy> for zx::Handle {
8187    fn from(value: WifiEventCallbackSynchronousProxy) -> Self {
8188        value.into_channel().into()
8189    }
8190}
8191
8192#[cfg(target_os = "fuchsia")]
8193impl From<fidl::Channel> for WifiEventCallbackSynchronousProxy {
8194    fn from(value: fidl::Channel) -> Self {
8195        Self::new(value)
8196    }
8197}
8198
8199#[cfg(target_os = "fuchsia")]
8200impl fidl::endpoints::FromClient for WifiEventCallbackSynchronousProxy {
8201    type Protocol = WifiEventCallbackMarker;
8202
8203    fn from_client(value: fidl::endpoints::ClientEnd<WifiEventCallbackMarker>) -> Self {
8204        Self::new(value.into_channel())
8205    }
8206}
8207
8208#[derive(Debug, Clone)]
8209pub struct WifiEventCallbackProxy {
8210    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8211}
8212
8213impl fidl::endpoints::Proxy for WifiEventCallbackProxy {
8214    type Protocol = WifiEventCallbackMarker;
8215
8216    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8217        Self::new(inner)
8218    }
8219
8220    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8221        self.client.into_channel().map_err(|client| Self { client })
8222    }
8223
8224    fn as_channel(&self) -> &::fidl::AsyncChannel {
8225        self.client.as_channel()
8226    }
8227}
8228
8229impl WifiEventCallbackProxy {
8230    /// Create a new Proxy for fuchsia.wlan.wlanix/WifiEventCallback.
8231    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8232        let protocol_name =
8233            <WifiEventCallbackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8234        Self { client: fidl::client::Client::new(channel, protocol_name) }
8235    }
8236
8237    /// Get a Stream of events from the remote end of the protocol.
8238    ///
8239    /// # Panics
8240    ///
8241    /// Panics if the event stream was already taken.
8242    pub fn take_event_stream(&self) -> WifiEventCallbackEventStream {
8243        WifiEventCallbackEventStream { event_receiver: self.client.take_event_receiver() }
8244    }
8245
8246    pub fn r#on_start(&self) -> Result<(), fidl::Error> {
8247        WifiEventCallbackProxyInterface::r#on_start(self)
8248    }
8249
8250    pub fn r#on_stop(&self) -> Result<(), fidl::Error> {
8251        WifiEventCallbackProxyInterface::r#on_stop(self)
8252    }
8253}
8254
8255impl WifiEventCallbackProxyInterface for WifiEventCallbackProxy {
8256    fn r#on_start(&self) -> Result<(), fidl::Error> {
8257        self.client.send::<fidl::encoding::EmptyPayload>(
8258            (),
8259            0x61189ff44f9d35f3,
8260            fidl::encoding::DynamicFlags::FLEXIBLE,
8261        )
8262    }
8263
8264    fn r#on_stop(&self) -> Result<(), fidl::Error> {
8265        self.client.send::<fidl::encoding::EmptyPayload>(
8266            (),
8267            0x58b697bcd475e0f9,
8268            fidl::encoding::DynamicFlags::FLEXIBLE,
8269        )
8270    }
8271}
8272
8273pub struct WifiEventCallbackEventStream {
8274    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8275}
8276
8277impl std::marker::Unpin for WifiEventCallbackEventStream {}
8278
8279impl futures::stream::FusedStream for WifiEventCallbackEventStream {
8280    fn is_terminated(&self) -> bool {
8281        self.event_receiver.is_terminated()
8282    }
8283}
8284
8285impl futures::Stream for WifiEventCallbackEventStream {
8286    type Item = Result<WifiEventCallbackEvent, fidl::Error>;
8287
8288    fn poll_next(
8289        mut self: std::pin::Pin<&mut Self>,
8290        cx: &mut std::task::Context<'_>,
8291    ) -> std::task::Poll<Option<Self::Item>> {
8292        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8293            &mut self.event_receiver,
8294            cx
8295        )?) {
8296            Some(buf) => std::task::Poll::Ready(Some(WifiEventCallbackEvent::decode(buf))),
8297            None => std::task::Poll::Ready(None),
8298        }
8299    }
8300}
8301
8302#[derive(Debug)]
8303pub enum WifiEventCallbackEvent {
8304    #[non_exhaustive]
8305    _UnknownEvent {
8306        /// Ordinal of the event that was sent.
8307        ordinal: u64,
8308    },
8309}
8310
8311impl WifiEventCallbackEvent {
8312    /// Decodes a message buffer as a [`WifiEventCallbackEvent`].
8313    fn decode(
8314        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8315    ) -> Result<WifiEventCallbackEvent, fidl::Error> {
8316        let (bytes, _handles) = buf.split_mut();
8317        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8318        debug_assert_eq!(tx_header.tx_id, 0);
8319        match tx_header.ordinal {
8320            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
8321                Ok(WifiEventCallbackEvent::_UnknownEvent { ordinal: tx_header.ordinal })
8322            }
8323            _ => Err(fidl::Error::UnknownOrdinal {
8324                ordinal: tx_header.ordinal,
8325                protocol_name:
8326                    <WifiEventCallbackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8327            }),
8328        }
8329    }
8330}
8331
8332/// A Stream of incoming requests for fuchsia.wlan.wlanix/WifiEventCallback.
8333pub struct WifiEventCallbackRequestStream {
8334    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8335    is_terminated: bool,
8336}
8337
8338impl std::marker::Unpin for WifiEventCallbackRequestStream {}
8339
8340impl futures::stream::FusedStream for WifiEventCallbackRequestStream {
8341    fn is_terminated(&self) -> bool {
8342        self.is_terminated
8343    }
8344}
8345
8346impl fidl::endpoints::RequestStream for WifiEventCallbackRequestStream {
8347    type Protocol = WifiEventCallbackMarker;
8348    type ControlHandle = WifiEventCallbackControlHandle;
8349
8350    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8351        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8352    }
8353
8354    fn control_handle(&self) -> Self::ControlHandle {
8355        WifiEventCallbackControlHandle { inner: self.inner.clone() }
8356    }
8357
8358    fn into_inner(
8359        self,
8360    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8361    {
8362        (self.inner, self.is_terminated)
8363    }
8364
8365    fn from_inner(
8366        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8367        is_terminated: bool,
8368    ) -> Self {
8369        Self { inner, is_terminated }
8370    }
8371}
8372
8373impl futures::Stream for WifiEventCallbackRequestStream {
8374    type Item = Result<WifiEventCallbackRequest, fidl::Error>;
8375
8376    fn poll_next(
8377        mut self: std::pin::Pin<&mut Self>,
8378        cx: &mut std::task::Context<'_>,
8379    ) -> std::task::Poll<Option<Self::Item>> {
8380        let this = &mut *self;
8381        if this.inner.check_shutdown(cx) {
8382            this.is_terminated = true;
8383            return std::task::Poll::Ready(None);
8384        }
8385        if this.is_terminated {
8386            panic!("polled WifiEventCallbackRequestStream after completion");
8387        }
8388        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8389            |bytes, handles| {
8390                match this.inner.channel().read_etc(cx, bytes, handles) {
8391                    std::task::Poll::Ready(Ok(())) => {}
8392                    std::task::Poll::Pending => return std::task::Poll::Pending,
8393                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8394                        this.is_terminated = true;
8395                        return std::task::Poll::Ready(None);
8396                    }
8397                    std::task::Poll::Ready(Err(e)) => {
8398                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8399                            e.into(),
8400                        ))));
8401                    }
8402                }
8403
8404                // A message has been received from the channel
8405                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8406
8407                std::task::Poll::Ready(Some(match header.ordinal {
8408                    0x61189ff44f9d35f3 => {
8409                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8410                        let mut req = fidl::new_empty!(
8411                            fidl::encoding::EmptyPayload,
8412                            fidl::encoding::DefaultFuchsiaResourceDialect
8413                        );
8414                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8415                        let control_handle =
8416                            WifiEventCallbackControlHandle { inner: this.inner.clone() };
8417                        Ok(WifiEventCallbackRequest::OnStart { control_handle })
8418                    }
8419                    0x58b697bcd475e0f9 => {
8420                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8421                        let mut req = fidl::new_empty!(
8422                            fidl::encoding::EmptyPayload,
8423                            fidl::encoding::DefaultFuchsiaResourceDialect
8424                        );
8425                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8426                        let control_handle =
8427                            WifiEventCallbackControlHandle { inner: this.inner.clone() };
8428                        Ok(WifiEventCallbackRequest::OnStop { control_handle })
8429                    }
8430                    _ if header.tx_id == 0
8431                        && header
8432                            .dynamic_flags()
8433                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
8434                    {
8435                        Ok(WifiEventCallbackRequest::_UnknownMethod {
8436                            ordinal: header.ordinal,
8437                            control_handle: WifiEventCallbackControlHandle {
8438                                inner: this.inner.clone(),
8439                            },
8440                            method_type: fidl::MethodType::OneWay,
8441                        })
8442                    }
8443                    _ if header
8444                        .dynamic_flags()
8445                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
8446                    {
8447                        this.inner.send_framework_err(
8448                            fidl::encoding::FrameworkErr::UnknownMethod,
8449                            header.tx_id,
8450                            header.ordinal,
8451                            header.dynamic_flags(),
8452                            (bytes, handles),
8453                        )?;
8454                        Ok(WifiEventCallbackRequest::_UnknownMethod {
8455                            ordinal: header.ordinal,
8456                            control_handle: WifiEventCallbackControlHandle {
8457                                inner: this.inner.clone(),
8458                            },
8459                            method_type: fidl::MethodType::TwoWay,
8460                        })
8461                    }
8462                    _ => Err(fidl::Error::UnknownOrdinal {
8463                        ordinal: header.ordinal,
8464                        protocol_name:
8465                            <WifiEventCallbackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8466                    }),
8467                }))
8468            },
8469        )
8470    }
8471}
8472
8473#[derive(Debug)]
8474pub enum WifiEventCallbackRequest {
8475    OnStart {
8476        control_handle: WifiEventCallbackControlHandle,
8477    },
8478    OnStop {
8479        control_handle: WifiEventCallbackControlHandle,
8480    },
8481    /// An interaction was received which does not match any known method.
8482    #[non_exhaustive]
8483    _UnknownMethod {
8484        /// Ordinal of the method that was called.
8485        ordinal: u64,
8486        control_handle: WifiEventCallbackControlHandle,
8487        method_type: fidl::MethodType,
8488    },
8489}
8490
8491impl WifiEventCallbackRequest {
8492    #[allow(irrefutable_let_patterns)]
8493    pub fn into_on_start(self) -> Option<(WifiEventCallbackControlHandle)> {
8494        if let WifiEventCallbackRequest::OnStart { control_handle } = self {
8495            Some((control_handle))
8496        } else {
8497            None
8498        }
8499    }
8500
8501    #[allow(irrefutable_let_patterns)]
8502    pub fn into_on_stop(self) -> Option<(WifiEventCallbackControlHandle)> {
8503        if let WifiEventCallbackRequest::OnStop { control_handle } = self {
8504            Some((control_handle))
8505        } else {
8506            None
8507        }
8508    }
8509
8510    /// Name of the method defined in FIDL
8511    pub fn method_name(&self) -> &'static str {
8512        match *self {
8513            WifiEventCallbackRequest::OnStart { .. } => "on_start",
8514            WifiEventCallbackRequest::OnStop { .. } => "on_stop",
8515            WifiEventCallbackRequest::_UnknownMethod {
8516                method_type: fidl::MethodType::OneWay,
8517                ..
8518            } => "unknown one-way method",
8519            WifiEventCallbackRequest::_UnknownMethod {
8520                method_type: fidl::MethodType::TwoWay,
8521                ..
8522            } => "unknown two-way method",
8523        }
8524    }
8525}
8526
8527#[derive(Debug, Clone)]
8528pub struct WifiEventCallbackControlHandle {
8529    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8530}
8531
8532impl fidl::endpoints::ControlHandle for WifiEventCallbackControlHandle {
8533    fn shutdown(&self) {
8534        self.inner.shutdown()
8535    }
8536    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8537        self.inner.shutdown_with_epitaph(status)
8538    }
8539
8540    fn is_closed(&self) -> bool {
8541        self.inner.channel().is_closed()
8542    }
8543    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8544        self.inner.channel().on_closed()
8545    }
8546
8547    #[cfg(target_os = "fuchsia")]
8548    fn signal_peer(
8549        &self,
8550        clear_mask: zx::Signals,
8551        set_mask: zx::Signals,
8552    ) -> Result<(), zx_status::Status> {
8553        use fidl::Peered;
8554        self.inner.channel().signal_peer(clear_mask, set_mask)
8555    }
8556}
8557
8558impl WifiEventCallbackControlHandle {}
8559
8560#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8561pub struct WifiLegacyHalMarker;
8562
8563impl fidl::endpoints::ProtocolMarker for WifiLegacyHalMarker {
8564    type Proxy = WifiLegacyHalProxy;
8565    type RequestStream = WifiLegacyHalRequestStream;
8566    #[cfg(target_os = "fuchsia")]
8567    type SynchronousProxy = WifiLegacyHalSynchronousProxy;
8568
8569    const DEBUG_NAME: &'static str = "(anonymous) WifiLegacyHal";
8570}
8571pub type WifiLegacyHalSelectTxPowerScenarioResult = Result<(), WifiLegacyHalStatus>;
8572pub type WifiLegacyHalResetTxPowerScenarioResult = Result<(), WifiLegacyHalStatus>;
8573
8574pub trait WifiLegacyHalProxyInterface: Send + Sync {
8575    type SelectTxPowerScenarioResponseFut: std::future::Future<Output = Result<WifiLegacyHalSelectTxPowerScenarioResult, fidl::Error>>
8576        + Send;
8577    fn r#select_tx_power_scenario(
8578        &self,
8579        payload: WifiLegacyHalSelectTxPowerScenarioRequest,
8580    ) -> Self::SelectTxPowerScenarioResponseFut;
8581    type ResetTxPowerScenarioResponseFut: std::future::Future<Output = Result<WifiLegacyHalResetTxPowerScenarioResult, fidl::Error>>
8582        + Send;
8583    fn r#reset_tx_power_scenario(&self) -> Self::ResetTxPowerScenarioResponseFut;
8584}
8585#[derive(Debug)]
8586#[cfg(target_os = "fuchsia")]
8587pub struct WifiLegacyHalSynchronousProxy {
8588    client: fidl::client::sync::Client,
8589}
8590
8591#[cfg(target_os = "fuchsia")]
8592impl fidl::endpoints::SynchronousProxy for WifiLegacyHalSynchronousProxy {
8593    type Proxy = WifiLegacyHalProxy;
8594    type Protocol = WifiLegacyHalMarker;
8595
8596    fn from_channel(inner: fidl::Channel) -> Self {
8597        Self::new(inner)
8598    }
8599
8600    fn into_channel(self) -> fidl::Channel {
8601        self.client.into_channel()
8602    }
8603
8604    fn as_channel(&self) -> &fidl::Channel {
8605        self.client.as_channel()
8606    }
8607}
8608
8609#[cfg(target_os = "fuchsia")]
8610impl WifiLegacyHalSynchronousProxy {
8611    pub fn new(channel: fidl::Channel) -> Self {
8612        let protocol_name = <WifiLegacyHalMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8613        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8614    }
8615
8616    pub fn into_channel(self) -> fidl::Channel {
8617        self.client.into_channel()
8618    }
8619
8620    /// Waits until an event arrives and returns it. It is safe for other
8621    /// threads to make concurrent requests while waiting for an event.
8622    pub fn wait_for_event(
8623        &self,
8624        deadline: zx::MonotonicInstant,
8625    ) -> Result<WifiLegacyHalEvent, fidl::Error> {
8626        WifiLegacyHalEvent::decode(self.client.wait_for_event(deadline)?)
8627    }
8628
8629    /// Sets the SAR scenario for all available PHYs.
8630    pub fn r#select_tx_power_scenario(
8631        &self,
8632        mut payload: WifiLegacyHalSelectTxPowerScenarioRequest,
8633        ___deadline: zx::MonotonicInstant,
8634    ) -> Result<WifiLegacyHalSelectTxPowerScenarioResult, fidl::Error> {
8635        let _response = self.client.send_query::<
8636            WifiLegacyHalSelectTxPowerScenarioRequest,
8637            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, WifiLegacyHalStatus>,
8638        >(
8639            &mut payload,
8640            0x49f42620e0a3caf9,
8641            fidl::encoding::DynamicFlags::FLEXIBLE,
8642            ___deadline,
8643        )?
8644        .into_result::<WifiLegacyHalMarker>("select_tx_power_scenario")?;
8645        Ok(_response.map(|x| x))
8646    }
8647
8648    /// Sets each PHY's SAR scenario to the default scenario.
8649    pub fn r#reset_tx_power_scenario(
8650        &self,
8651        ___deadline: zx::MonotonicInstant,
8652    ) -> Result<WifiLegacyHalResetTxPowerScenarioResult, fidl::Error> {
8653        let _response =
8654            self.client
8655                .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::FlexibleResultType<
8656                    fidl::encoding::EmptyStruct,
8657                    WifiLegacyHalStatus,
8658                >>(
8659                    (), 0x6c0f8e9203167d8e, fidl::encoding::DynamicFlags::FLEXIBLE, ___deadline
8660                )?
8661                .into_result::<WifiLegacyHalMarker>("reset_tx_power_scenario")?;
8662        Ok(_response.map(|x| x))
8663    }
8664}
8665
8666#[cfg(target_os = "fuchsia")]
8667impl From<WifiLegacyHalSynchronousProxy> for zx::Handle {
8668    fn from(value: WifiLegacyHalSynchronousProxy) -> Self {
8669        value.into_channel().into()
8670    }
8671}
8672
8673#[cfg(target_os = "fuchsia")]
8674impl From<fidl::Channel> for WifiLegacyHalSynchronousProxy {
8675    fn from(value: fidl::Channel) -> Self {
8676        Self::new(value)
8677    }
8678}
8679
8680#[cfg(target_os = "fuchsia")]
8681impl fidl::endpoints::FromClient for WifiLegacyHalSynchronousProxy {
8682    type Protocol = WifiLegacyHalMarker;
8683
8684    fn from_client(value: fidl::endpoints::ClientEnd<WifiLegacyHalMarker>) -> Self {
8685        Self::new(value.into_channel())
8686    }
8687}
8688
8689#[derive(Debug, Clone)]
8690pub struct WifiLegacyHalProxy {
8691    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8692}
8693
8694impl fidl::endpoints::Proxy for WifiLegacyHalProxy {
8695    type Protocol = WifiLegacyHalMarker;
8696
8697    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8698        Self::new(inner)
8699    }
8700
8701    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8702        self.client.into_channel().map_err(|client| Self { client })
8703    }
8704
8705    fn as_channel(&self) -> &::fidl::AsyncChannel {
8706        self.client.as_channel()
8707    }
8708}
8709
8710impl WifiLegacyHalProxy {
8711    /// Create a new Proxy for fuchsia.wlan.wlanix/WifiLegacyHal.
8712    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8713        let protocol_name = <WifiLegacyHalMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8714        Self { client: fidl::client::Client::new(channel, protocol_name) }
8715    }
8716
8717    /// Get a Stream of events from the remote end of the protocol.
8718    ///
8719    /// # Panics
8720    ///
8721    /// Panics if the event stream was already taken.
8722    pub fn take_event_stream(&self) -> WifiLegacyHalEventStream {
8723        WifiLegacyHalEventStream { event_receiver: self.client.take_event_receiver() }
8724    }
8725
8726    /// Sets the SAR scenario for all available PHYs.
8727    pub fn r#select_tx_power_scenario(
8728        &self,
8729        mut payload: WifiLegacyHalSelectTxPowerScenarioRequest,
8730    ) -> fidl::client::QueryResponseFut<
8731        WifiLegacyHalSelectTxPowerScenarioResult,
8732        fidl::encoding::DefaultFuchsiaResourceDialect,
8733    > {
8734        WifiLegacyHalProxyInterface::r#select_tx_power_scenario(self, payload)
8735    }
8736
8737    /// Sets each PHY's SAR scenario to the default scenario.
8738    pub fn r#reset_tx_power_scenario(
8739        &self,
8740    ) -> fidl::client::QueryResponseFut<
8741        WifiLegacyHalResetTxPowerScenarioResult,
8742        fidl::encoding::DefaultFuchsiaResourceDialect,
8743    > {
8744        WifiLegacyHalProxyInterface::r#reset_tx_power_scenario(self)
8745    }
8746}
8747
8748impl WifiLegacyHalProxyInterface for WifiLegacyHalProxy {
8749    type SelectTxPowerScenarioResponseFut = fidl::client::QueryResponseFut<
8750        WifiLegacyHalSelectTxPowerScenarioResult,
8751        fidl::encoding::DefaultFuchsiaResourceDialect,
8752    >;
8753    fn r#select_tx_power_scenario(
8754        &self,
8755        mut payload: WifiLegacyHalSelectTxPowerScenarioRequest,
8756    ) -> Self::SelectTxPowerScenarioResponseFut {
8757        fn _decode(
8758            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8759        ) -> Result<WifiLegacyHalSelectTxPowerScenarioResult, fidl::Error> {
8760            let _response = fidl::client::decode_transaction_body::<
8761                fidl::encoding::FlexibleResultType<
8762                    fidl::encoding::EmptyStruct,
8763                    WifiLegacyHalStatus,
8764                >,
8765                fidl::encoding::DefaultFuchsiaResourceDialect,
8766                0x49f42620e0a3caf9,
8767            >(_buf?)?
8768            .into_result::<WifiLegacyHalMarker>("select_tx_power_scenario")?;
8769            Ok(_response.map(|x| x))
8770        }
8771        self.client.send_query_and_decode::<
8772            WifiLegacyHalSelectTxPowerScenarioRequest,
8773            WifiLegacyHalSelectTxPowerScenarioResult,
8774        >(
8775            &mut payload,
8776            0x49f42620e0a3caf9,
8777            fidl::encoding::DynamicFlags::FLEXIBLE,
8778            _decode,
8779        )
8780    }
8781
8782    type ResetTxPowerScenarioResponseFut = fidl::client::QueryResponseFut<
8783        WifiLegacyHalResetTxPowerScenarioResult,
8784        fidl::encoding::DefaultFuchsiaResourceDialect,
8785    >;
8786    fn r#reset_tx_power_scenario(&self) -> Self::ResetTxPowerScenarioResponseFut {
8787        fn _decode(
8788            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
8789        ) -> Result<WifiLegacyHalResetTxPowerScenarioResult, fidl::Error> {
8790            let _response = fidl::client::decode_transaction_body::<
8791                fidl::encoding::FlexibleResultType<
8792                    fidl::encoding::EmptyStruct,
8793                    WifiLegacyHalStatus,
8794                >,
8795                fidl::encoding::DefaultFuchsiaResourceDialect,
8796                0x6c0f8e9203167d8e,
8797            >(_buf?)?
8798            .into_result::<WifiLegacyHalMarker>("reset_tx_power_scenario")?;
8799            Ok(_response.map(|x| x))
8800        }
8801        self.client.send_query_and_decode::<
8802            fidl::encoding::EmptyPayload,
8803            WifiLegacyHalResetTxPowerScenarioResult,
8804        >(
8805            (),
8806            0x6c0f8e9203167d8e,
8807            fidl::encoding::DynamicFlags::FLEXIBLE,
8808            _decode,
8809        )
8810    }
8811}
8812
8813pub struct WifiLegacyHalEventStream {
8814    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8815}
8816
8817impl std::marker::Unpin for WifiLegacyHalEventStream {}
8818
8819impl futures::stream::FusedStream for WifiLegacyHalEventStream {
8820    fn is_terminated(&self) -> bool {
8821        self.event_receiver.is_terminated()
8822    }
8823}
8824
8825impl futures::Stream for WifiLegacyHalEventStream {
8826    type Item = Result<WifiLegacyHalEvent, fidl::Error>;
8827
8828    fn poll_next(
8829        mut self: std::pin::Pin<&mut Self>,
8830        cx: &mut std::task::Context<'_>,
8831    ) -> std::task::Poll<Option<Self::Item>> {
8832        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8833            &mut self.event_receiver,
8834            cx
8835        )?) {
8836            Some(buf) => std::task::Poll::Ready(Some(WifiLegacyHalEvent::decode(buf))),
8837            None => std::task::Poll::Ready(None),
8838        }
8839    }
8840}
8841
8842#[derive(Debug)]
8843pub enum WifiLegacyHalEvent {
8844    #[non_exhaustive]
8845    _UnknownEvent {
8846        /// Ordinal of the event that was sent.
8847        ordinal: u64,
8848    },
8849}
8850
8851impl WifiLegacyHalEvent {
8852    /// Decodes a message buffer as a [`WifiLegacyHalEvent`].
8853    fn decode(
8854        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8855    ) -> Result<WifiLegacyHalEvent, fidl::Error> {
8856        let (bytes, _handles) = buf.split_mut();
8857        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8858        debug_assert_eq!(tx_header.tx_id, 0);
8859        match tx_header.ordinal {
8860            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
8861                Ok(WifiLegacyHalEvent::_UnknownEvent { ordinal: tx_header.ordinal })
8862            }
8863            _ => Err(fidl::Error::UnknownOrdinal {
8864                ordinal: tx_header.ordinal,
8865                protocol_name: <WifiLegacyHalMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8866            }),
8867        }
8868    }
8869}
8870
8871/// A Stream of incoming requests for fuchsia.wlan.wlanix/WifiLegacyHal.
8872pub struct WifiLegacyHalRequestStream {
8873    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8874    is_terminated: bool,
8875}
8876
8877impl std::marker::Unpin for WifiLegacyHalRequestStream {}
8878
8879impl futures::stream::FusedStream for WifiLegacyHalRequestStream {
8880    fn is_terminated(&self) -> bool {
8881        self.is_terminated
8882    }
8883}
8884
8885impl fidl::endpoints::RequestStream for WifiLegacyHalRequestStream {
8886    type Protocol = WifiLegacyHalMarker;
8887    type ControlHandle = WifiLegacyHalControlHandle;
8888
8889    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8890        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8891    }
8892
8893    fn control_handle(&self) -> Self::ControlHandle {
8894        WifiLegacyHalControlHandle { inner: self.inner.clone() }
8895    }
8896
8897    fn into_inner(
8898        self,
8899    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8900    {
8901        (self.inner, self.is_terminated)
8902    }
8903
8904    fn from_inner(
8905        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8906        is_terminated: bool,
8907    ) -> Self {
8908        Self { inner, is_terminated }
8909    }
8910}
8911
8912impl futures::Stream for WifiLegacyHalRequestStream {
8913    type Item = Result<WifiLegacyHalRequest, fidl::Error>;
8914
8915    fn poll_next(
8916        mut self: std::pin::Pin<&mut Self>,
8917        cx: &mut std::task::Context<'_>,
8918    ) -> std::task::Poll<Option<Self::Item>> {
8919        let this = &mut *self;
8920        if this.inner.check_shutdown(cx) {
8921            this.is_terminated = true;
8922            return std::task::Poll::Ready(None);
8923        }
8924        if this.is_terminated {
8925            panic!("polled WifiLegacyHalRequestStream after completion");
8926        }
8927        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8928            |bytes, handles| {
8929                match this.inner.channel().read_etc(cx, bytes, handles) {
8930                    std::task::Poll::Ready(Ok(())) => {}
8931                    std::task::Poll::Pending => return std::task::Poll::Pending,
8932                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8933                        this.is_terminated = true;
8934                        return std::task::Poll::Ready(None);
8935                    }
8936                    std::task::Poll::Ready(Err(e)) => {
8937                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8938                            e.into(),
8939                        ))));
8940                    }
8941                }
8942
8943                // A message has been received from the channel
8944                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8945
8946                std::task::Poll::Ready(Some(match header.ordinal {
8947                    0x49f42620e0a3caf9 => {
8948                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8949                        let mut req = fidl::new_empty!(
8950                            WifiLegacyHalSelectTxPowerScenarioRequest,
8951                            fidl::encoding::DefaultFuchsiaResourceDialect
8952                        );
8953                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WifiLegacyHalSelectTxPowerScenarioRequest>(&header, _body_bytes, handles, &mut req)?;
8954                        let control_handle =
8955                            WifiLegacyHalControlHandle { inner: this.inner.clone() };
8956                        Ok(WifiLegacyHalRequest::SelectTxPowerScenario {
8957                            payload: req,
8958                            responder: WifiLegacyHalSelectTxPowerScenarioResponder {
8959                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8960                                tx_id: header.tx_id,
8961                            },
8962                        })
8963                    }
8964                    0x6c0f8e9203167d8e => {
8965                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8966                        let mut req = fidl::new_empty!(
8967                            fidl::encoding::EmptyPayload,
8968                            fidl::encoding::DefaultFuchsiaResourceDialect
8969                        );
8970                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8971                        let control_handle =
8972                            WifiLegacyHalControlHandle { inner: this.inner.clone() };
8973                        Ok(WifiLegacyHalRequest::ResetTxPowerScenario {
8974                            responder: WifiLegacyHalResetTxPowerScenarioResponder {
8975                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8976                                tx_id: header.tx_id,
8977                            },
8978                        })
8979                    }
8980                    _ if header.tx_id == 0
8981                        && header
8982                            .dynamic_flags()
8983                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
8984                    {
8985                        Ok(WifiLegacyHalRequest::_UnknownMethod {
8986                            ordinal: header.ordinal,
8987                            control_handle: WifiLegacyHalControlHandle {
8988                                inner: this.inner.clone(),
8989                            },
8990                            method_type: fidl::MethodType::OneWay,
8991                        })
8992                    }
8993                    _ if header
8994                        .dynamic_flags()
8995                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
8996                    {
8997                        this.inner.send_framework_err(
8998                            fidl::encoding::FrameworkErr::UnknownMethod,
8999                            header.tx_id,
9000                            header.ordinal,
9001                            header.dynamic_flags(),
9002                            (bytes, handles),
9003                        )?;
9004                        Ok(WifiLegacyHalRequest::_UnknownMethod {
9005                            ordinal: header.ordinal,
9006                            control_handle: WifiLegacyHalControlHandle {
9007                                inner: this.inner.clone(),
9008                            },
9009                            method_type: fidl::MethodType::TwoWay,
9010                        })
9011                    }
9012                    _ => Err(fidl::Error::UnknownOrdinal {
9013                        ordinal: header.ordinal,
9014                        protocol_name:
9015                            <WifiLegacyHalMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9016                    }),
9017                }))
9018            },
9019        )
9020    }
9021}
9022
9023#[derive(Debug)]
9024pub enum WifiLegacyHalRequest {
9025    /// Sets the SAR scenario for all available PHYs.
9026    SelectTxPowerScenario {
9027        payload: WifiLegacyHalSelectTxPowerScenarioRequest,
9028        responder: WifiLegacyHalSelectTxPowerScenarioResponder,
9029    },
9030    /// Sets each PHY's SAR scenario to the default scenario.
9031    ResetTxPowerScenario { responder: WifiLegacyHalResetTxPowerScenarioResponder },
9032    /// An interaction was received which does not match any known method.
9033    #[non_exhaustive]
9034    _UnknownMethod {
9035        /// Ordinal of the method that was called.
9036        ordinal: u64,
9037        control_handle: WifiLegacyHalControlHandle,
9038        method_type: fidl::MethodType,
9039    },
9040}
9041
9042impl WifiLegacyHalRequest {
9043    #[allow(irrefutable_let_patterns)]
9044    pub fn into_select_tx_power_scenario(
9045        self,
9046    ) -> Option<(
9047        WifiLegacyHalSelectTxPowerScenarioRequest,
9048        WifiLegacyHalSelectTxPowerScenarioResponder,
9049    )> {
9050        if let WifiLegacyHalRequest::SelectTxPowerScenario { payload, responder } = self {
9051            Some((payload, responder))
9052        } else {
9053            None
9054        }
9055    }
9056
9057    #[allow(irrefutable_let_patterns)]
9058    pub fn into_reset_tx_power_scenario(
9059        self,
9060    ) -> Option<(WifiLegacyHalResetTxPowerScenarioResponder)> {
9061        if let WifiLegacyHalRequest::ResetTxPowerScenario { responder } = self {
9062            Some((responder))
9063        } else {
9064            None
9065        }
9066    }
9067
9068    /// Name of the method defined in FIDL
9069    pub fn method_name(&self) -> &'static str {
9070        match *self {
9071            WifiLegacyHalRequest::SelectTxPowerScenario { .. } => "select_tx_power_scenario",
9072            WifiLegacyHalRequest::ResetTxPowerScenario { .. } => "reset_tx_power_scenario",
9073            WifiLegacyHalRequest::_UnknownMethod {
9074                method_type: fidl::MethodType::OneWay, ..
9075            } => "unknown one-way method",
9076            WifiLegacyHalRequest::_UnknownMethod {
9077                method_type: fidl::MethodType::TwoWay, ..
9078            } => "unknown two-way method",
9079        }
9080    }
9081}
9082
9083#[derive(Debug, Clone)]
9084pub struct WifiLegacyHalControlHandle {
9085    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9086}
9087
9088impl fidl::endpoints::ControlHandle for WifiLegacyHalControlHandle {
9089    fn shutdown(&self) {
9090        self.inner.shutdown()
9091    }
9092    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9093        self.inner.shutdown_with_epitaph(status)
9094    }
9095
9096    fn is_closed(&self) -> bool {
9097        self.inner.channel().is_closed()
9098    }
9099    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9100        self.inner.channel().on_closed()
9101    }
9102
9103    #[cfg(target_os = "fuchsia")]
9104    fn signal_peer(
9105        &self,
9106        clear_mask: zx::Signals,
9107        set_mask: zx::Signals,
9108    ) -> Result<(), zx_status::Status> {
9109        use fidl::Peered;
9110        self.inner.channel().signal_peer(clear_mask, set_mask)
9111    }
9112}
9113
9114impl WifiLegacyHalControlHandle {}
9115
9116#[must_use = "FIDL methods require a response to be sent"]
9117#[derive(Debug)]
9118pub struct WifiLegacyHalSelectTxPowerScenarioResponder {
9119    control_handle: std::mem::ManuallyDrop<WifiLegacyHalControlHandle>,
9120    tx_id: u32,
9121}
9122
9123/// Set the the channel to be shutdown (see [`WifiLegacyHalControlHandle::shutdown`])
9124/// if the responder is dropped without sending a response, so that the client
9125/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9126impl std::ops::Drop for WifiLegacyHalSelectTxPowerScenarioResponder {
9127    fn drop(&mut self) {
9128        self.control_handle.shutdown();
9129        // Safety: drops once, never accessed again
9130        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9131    }
9132}
9133
9134impl fidl::endpoints::Responder for WifiLegacyHalSelectTxPowerScenarioResponder {
9135    type ControlHandle = WifiLegacyHalControlHandle;
9136
9137    fn control_handle(&self) -> &WifiLegacyHalControlHandle {
9138        &self.control_handle
9139    }
9140
9141    fn drop_without_shutdown(mut self) {
9142        // Safety: drops once, never accessed again due to mem::forget
9143        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9144        // Prevent Drop from running (which would shut down the channel)
9145        std::mem::forget(self);
9146    }
9147}
9148
9149impl WifiLegacyHalSelectTxPowerScenarioResponder {
9150    /// Sends a response to the FIDL transaction.
9151    ///
9152    /// Sets the channel to shutdown if an error occurs.
9153    pub fn send(self, mut result: Result<(), WifiLegacyHalStatus>) -> Result<(), fidl::Error> {
9154        let _result = self.send_raw(result);
9155        if _result.is_err() {
9156            self.control_handle.shutdown();
9157        }
9158        self.drop_without_shutdown();
9159        _result
9160    }
9161
9162    /// Similar to "send" but does not shutdown the channel if an error occurs.
9163    pub fn send_no_shutdown_on_err(
9164        self,
9165        mut result: Result<(), WifiLegacyHalStatus>,
9166    ) -> Result<(), fidl::Error> {
9167        let _result = self.send_raw(result);
9168        self.drop_without_shutdown();
9169        _result
9170    }
9171
9172    fn send_raw(&self, mut result: Result<(), WifiLegacyHalStatus>) -> Result<(), fidl::Error> {
9173        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
9174            fidl::encoding::EmptyStruct,
9175            WifiLegacyHalStatus,
9176        >>(
9177            fidl::encoding::FlexibleResult::new(result),
9178            self.tx_id,
9179            0x49f42620e0a3caf9,
9180            fidl::encoding::DynamicFlags::FLEXIBLE,
9181        )
9182    }
9183}
9184
9185#[must_use = "FIDL methods require a response to be sent"]
9186#[derive(Debug)]
9187pub struct WifiLegacyHalResetTxPowerScenarioResponder {
9188    control_handle: std::mem::ManuallyDrop<WifiLegacyHalControlHandle>,
9189    tx_id: u32,
9190}
9191
9192/// Set the the channel to be shutdown (see [`WifiLegacyHalControlHandle::shutdown`])
9193/// if the responder is dropped without sending a response, so that the client
9194/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9195impl std::ops::Drop for WifiLegacyHalResetTxPowerScenarioResponder {
9196    fn drop(&mut self) {
9197        self.control_handle.shutdown();
9198        // Safety: drops once, never accessed again
9199        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9200    }
9201}
9202
9203impl fidl::endpoints::Responder for WifiLegacyHalResetTxPowerScenarioResponder {
9204    type ControlHandle = WifiLegacyHalControlHandle;
9205
9206    fn control_handle(&self) -> &WifiLegacyHalControlHandle {
9207        &self.control_handle
9208    }
9209
9210    fn drop_without_shutdown(mut self) {
9211        // Safety: drops once, never accessed again due to mem::forget
9212        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9213        // Prevent Drop from running (which would shut down the channel)
9214        std::mem::forget(self);
9215    }
9216}
9217
9218impl WifiLegacyHalResetTxPowerScenarioResponder {
9219    /// Sends a response to the FIDL transaction.
9220    ///
9221    /// Sets the channel to shutdown if an error occurs.
9222    pub fn send(self, mut result: Result<(), WifiLegacyHalStatus>) -> Result<(), fidl::Error> {
9223        let _result = self.send_raw(result);
9224        if _result.is_err() {
9225            self.control_handle.shutdown();
9226        }
9227        self.drop_without_shutdown();
9228        _result
9229    }
9230
9231    /// Similar to "send" but does not shutdown the channel if an error occurs.
9232    pub fn send_no_shutdown_on_err(
9233        self,
9234        mut result: Result<(), WifiLegacyHalStatus>,
9235    ) -> Result<(), fidl::Error> {
9236        let _result = self.send_raw(result);
9237        self.drop_without_shutdown();
9238        _result
9239    }
9240
9241    fn send_raw(&self, mut result: Result<(), WifiLegacyHalStatus>) -> Result<(), fidl::Error> {
9242        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
9243            fidl::encoding::EmptyStruct,
9244            WifiLegacyHalStatus,
9245        >>(
9246            fidl::encoding::FlexibleResult::new(result),
9247            self.tx_id,
9248            0x6c0f8e9203167d8e,
9249            fidl::encoding::DynamicFlags::FLEXIBLE,
9250        )
9251    }
9252}
9253
9254#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9255pub struct WifiStaIfaceMarker;
9256
9257impl fidl::endpoints::ProtocolMarker for WifiStaIfaceMarker {
9258    type Proxy = WifiStaIfaceProxy;
9259    type RequestStream = WifiStaIfaceRequestStream;
9260    #[cfg(target_os = "fuchsia")]
9261    type SynchronousProxy = WifiStaIfaceSynchronousProxy;
9262
9263    const DEBUG_NAME: &'static str = "(anonymous) WifiStaIface";
9264}
9265pub type WifiStaIfaceSetScanOnlyModeResult = Result<(), i32>;
9266
9267pub trait WifiStaIfaceProxyInterface: Send + Sync {
9268    type GetNameResponseFut: std::future::Future<Output = Result<WifiStaIfaceGetNameResponse, fidl::Error>>
9269        + Send;
9270    fn r#get_name(&self) -> Self::GetNameResponseFut;
9271    type SetScanOnlyModeResponseFut: std::future::Future<Output = Result<WifiStaIfaceSetScanOnlyModeResult, fidl::Error>>
9272        + Send;
9273    fn r#set_scan_only_mode(
9274        &self,
9275        payload: WifiStaIfaceSetScanOnlyModeRequest,
9276    ) -> Self::SetScanOnlyModeResponseFut;
9277}
9278#[derive(Debug)]
9279#[cfg(target_os = "fuchsia")]
9280pub struct WifiStaIfaceSynchronousProxy {
9281    client: fidl::client::sync::Client,
9282}
9283
9284#[cfg(target_os = "fuchsia")]
9285impl fidl::endpoints::SynchronousProxy for WifiStaIfaceSynchronousProxy {
9286    type Proxy = WifiStaIfaceProxy;
9287    type Protocol = WifiStaIfaceMarker;
9288
9289    fn from_channel(inner: fidl::Channel) -> Self {
9290        Self::new(inner)
9291    }
9292
9293    fn into_channel(self) -> fidl::Channel {
9294        self.client.into_channel()
9295    }
9296
9297    fn as_channel(&self) -> &fidl::Channel {
9298        self.client.as_channel()
9299    }
9300}
9301
9302#[cfg(target_os = "fuchsia")]
9303impl WifiStaIfaceSynchronousProxy {
9304    pub fn new(channel: fidl::Channel) -> Self {
9305        let protocol_name = <WifiStaIfaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9306        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
9307    }
9308
9309    pub fn into_channel(self) -> fidl::Channel {
9310        self.client.into_channel()
9311    }
9312
9313    /// Waits until an event arrives and returns it. It is safe for other
9314    /// threads to make concurrent requests while waiting for an event.
9315    pub fn wait_for_event(
9316        &self,
9317        deadline: zx::MonotonicInstant,
9318    ) -> Result<WifiStaIfaceEvent, fidl::Error> {
9319        WifiStaIfaceEvent::decode(self.client.wait_for_event(deadline)?)
9320    }
9321
9322    /// Get the name of this iface.
9323    pub fn r#get_name(
9324        &self,
9325        ___deadline: zx::MonotonicInstant,
9326    ) -> Result<WifiStaIfaceGetNameResponse, fidl::Error> {
9327        let _response = self.client.send_query::<
9328            fidl::encoding::EmptyPayload,
9329            fidl::encoding::FlexibleType<WifiStaIfaceGetNameResponse>,
9330        >(
9331            (),
9332            0x5c150b91c80c5789,
9333            fidl::encoding::DynamicFlags::FLEXIBLE,
9334            ___deadline,
9335        )?
9336        .into_result::<WifiStaIfaceMarker>("get_name")?;
9337        Ok(_response)
9338    }
9339
9340    pub fn r#set_scan_only_mode(
9341        &self,
9342        mut payload: WifiStaIfaceSetScanOnlyModeRequest,
9343        ___deadline: zx::MonotonicInstant,
9344    ) -> Result<WifiStaIfaceSetScanOnlyModeResult, fidl::Error> {
9345        let _response = self.client.send_query::<
9346            WifiStaIfaceSetScanOnlyModeRequest,
9347            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
9348        >(
9349            &mut payload,
9350            0x22550328583bf0e3,
9351            fidl::encoding::DynamicFlags::FLEXIBLE,
9352            ___deadline,
9353        )?
9354        .into_result::<WifiStaIfaceMarker>("set_scan_only_mode")?;
9355        Ok(_response.map(|x| x))
9356    }
9357}
9358
9359#[cfg(target_os = "fuchsia")]
9360impl From<WifiStaIfaceSynchronousProxy> for zx::Handle {
9361    fn from(value: WifiStaIfaceSynchronousProxy) -> Self {
9362        value.into_channel().into()
9363    }
9364}
9365
9366#[cfg(target_os = "fuchsia")]
9367impl From<fidl::Channel> for WifiStaIfaceSynchronousProxy {
9368    fn from(value: fidl::Channel) -> Self {
9369        Self::new(value)
9370    }
9371}
9372
9373#[cfg(target_os = "fuchsia")]
9374impl fidl::endpoints::FromClient for WifiStaIfaceSynchronousProxy {
9375    type Protocol = WifiStaIfaceMarker;
9376
9377    fn from_client(value: fidl::endpoints::ClientEnd<WifiStaIfaceMarker>) -> Self {
9378        Self::new(value.into_channel())
9379    }
9380}
9381
9382#[derive(Debug, Clone)]
9383pub struct WifiStaIfaceProxy {
9384    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
9385}
9386
9387impl fidl::endpoints::Proxy for WifiStaIfaceProxy {
9388    type Protocol = WifiStaIfaceMarker;
9389
9390    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
9391        Self::new(inner)
9392    }
9393
9394    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
9395        self.client.into_channel().map_err(|client| Self { client })
9396    }
9397
9398    fn as_channel(&self) -> &::fidl::AsyncChannel {
9399        self.client.as_channel()
9400    }
9401}
9402
9403impl WifiStaIfaceProxy {
9404    /// Create a new Proxy for fuchsia.wlan.wlanix/WifiStaIface.
9405    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
9406        let protocol_name = <WifiStaIfaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9407        Self { client: fidl::client::Client::new(channel, protocol_name) }
9408    }
9409
9410    /// Get a Stream of events from the remote end of the protocol.
9411    ///
9412    /// # Panics
9413    ///
9414    /// Panics if the event stream was already taken.
9415    pub fn take_event_stream(&self) -> WifiStaIfaceEventStream {
9416        WifiStaIfaceEventStream { event_receiver: self.client.take_event_receiver() }
9417    }
9418
9419    /// Get the name of this iface.
9420    pub fn r#get_name(
9421        &self,
9422    ) -> fidl::client::QueryResponseFut<
9423        WifiStaIfaceGetNameResponse,
9424        fidl::encoding::DefaultFuchsiaResourceDialect,
9425    > {
9426        WifiStaIfaceProxyInterface::r#get_name(self)
9427    }
9428
9429    pub fn r#set_scan_only_mode(
9430        &self,
9431        mut payload: WifiStaIfaceSetScanOnlyModeRequest,
9432    ) -> fidl::client::QueryResponseFut<
9433        WifiStaIfaceSetScanOnlyModeResult,
9434        fidl::encoding::DefaultFuchsiaResourceDialect,
9435    > {
9436        WifiStaIfaceProxyInterface::r#set_scan_only_mode(self, payload)
9437    }
9438}
9439
9440impl WifiStaIfaceProxyInterface for WifiStaIfaceProxy {
9441    type GetNameResponseFut = fidl::client::QueryResponseFut<
9442        WifiStaIfaceGetNameResponse,
9443        fidl::encoding::DefaultFuchsiaResourceDialect,
9444    >;
9445    fn r#get_name(&self) -> Self::GetNameResponseFut {
9446        fn _decode(
9447            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9448        ) -> Result<WifiStaIfaceGetNameResponse, fidl::Error> {
9449            let _response = fidl::client::decode_transaction_body::<
9450                fidl::encoding::FlexibleType<WifiStaIfaceGetNameResponse>,
9451                fidl::encoding::DefaultFuchsiaResourceDialect,
9452                0x5c150b91c80c5789,
9453            >(_buf?)?
9454            .into_result::<WifiStaIfaceMarker>("get_name")?;
9455            Ok(_response)
9456        }
9457        self.client
9458            .send_query_and_decode::<fidl::encoding::EmptyPayload, WifiStaIfaceGetNameResponse>(
9459                (),
9460                0x5c150b91c80c5789,
9461                fidl::encoding::DynamicFlags::FLEXIBLE,
9462                _decode,
9463            )
9464    }
9465
9466    type SetScanOnlyModeResponseFut = fidl::client::QueryResponseFut<
9467        WifiStaIfaceSetScanOnlyModeResult,
9468        fidl::encoding::DefaultFuchsiaResourceDialect,
9469    >;
9470    fn r#set_scan_only_mode(
9471        &self,
9472        mut payload: WifiStaIfaceSetScanOnlyModeRequest,
9473    ) -> Self::SetScanOnlyModeResponseFut {
9474        fn _decode(
9475            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
9476        ) -> Result<WifiStaIfaceSetScanOnlyModeResult, fidl::Error> {
9477            let _response = fidl::client::decode_transaction_body::<
9478                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
9479                fidl::encoding::DefaultFuchsiaResourceDialect,
9480                0x22550328583bf0e3,
9481            >(_buf?)?
9482            .into_result::<WifiStaIfaceMarker>("set_scan_only_mode")?;
9483            Ok(_response.map(|x| x))
9484        }
9485        self.client.send_query_and_decode::<
9486            WifiStaIfaceSetScanOnlyModeRequest,
9487            WifiStaIfaceSetScanOnlyModeResult,
9488        >(
9489            &mut payload,
9490            0x22550328583bf0e3,
9491            fidl::encoding::DynamicFlags::FLEXIBLE,
9492            _decode,
9493        )
9494    }
9495}
9496
9497pub struct WifiStaIfaceEventStream {
9498    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9499}
9500
9501impl std::marker::Unpin for WifiStaIfaceEventStream {}
9502
9503impl futures::stream::FusedStream for WifiStaIfaceEventStream {
9504    fn is_terminated(&self) -> bool {
9505        self.event_receiver.is_terminated()
9506    }
9507}
9508
9509impl futures::Stream for WifiStaIfaceEventStream {
9510    type Item = Result<WifiStaIfaceEvent, fidl::Error>;
9511
9512    fn poll_next(
9513        mut self: std::pin::Pin<&mut Self>,
9514        cx: &mut std::task::Context<'_>,
9515    ) -> std::task::Poll<Option<Self::Item>> {
9516        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9517            &mut self.event_receiver,
9518            cx
9519        )?) {
9520            Some(buf) => std::task::Poll::Ready(Some(WifiStaIfaceEvent::decode(buf))),
9521            None => std::task::Poll::Ready(None),
9522        }
9523    }
9524}
9525
9526#[derive(Debug)]
9527pub enum WifiStaIfaceEvent {
9528    #[non_exhaustive]
9529    _UnknownEvent {
9530        /// Ordinal of the event that was sent.
9531        ordinal: u64,
9532    },
9533}
9534
9535impl WifiStaIfaceEvent {
9536    /// Decodes a message buffer as a [`WifiStaIfaceEvent`].
9537    fn decode(
9538        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9539    ) -> Result<WifiStaIfaceEvent, fidl::Error> {
9540        let (bytes, _handles) = buf.split_mut();
9541        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9542        debug_assert_eq!(tx_header.tx_id, 0);
9543        match tx_header.ordinal {
9544            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
9545                Ok(WifiStaIfaceEvent::_UnknownEvent { ordinal: tx_header.ordinal })
9546            }
9547            _ => Err(fidl::Error::UnknownOrdinal {
9548                ordinal: tx_header.ordinal,
9549                protocol_name: <WifiStaIfaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9550            }),
9551        }
9552    }
9553}
9554
9555/// A Stream of incoming requests for fuchsia.wlan.wlanix/WifiStaIface.
9556pub struct WifiStaIfaceRequestStream {
9557    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9558    is_terminated: bool,
9559}
9560
9561impl std::marker::Unpin for WifiStaIfaceRequestStream {}
9562
9563impl futures::stream::FusedStream for WifiStaIfaceRequestStream {
9564    fn is_terminated(&self) -> bool {
9565        self.is_terminated
9566    }
9567}
9568
9569impl fidl::endpoints::RequestStream for WifiStaIfaceRequestStream {
9570    type Protocol = WifiStaIfaceMarker;
9571    type ControlHandle = WifiStaIfaceControlHandle;
9572
9573    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9574        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9575    }
9576
9577    fn control_handle(&self) -> Self::ControlHandle {
9578        WifiStaIfaceControlHandle { inner: self.inner.clone() }
9579    }
9580
9581    fn into_inner(
9582        self,
9583    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9584    {
9585        (self.inner, self.is_terminated)
9586    }
9587
9588    fn from_inner(
9589        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9590        is_terminated: bool,
9591    ) -> Self {
9592        Self { inner, is_terminated }
9593    }
9594}
9595
9596impl futures::Stream for WifiStaIfaceRequestStream {
9597    type Item = Result<WifiStaIfaceRequest, fidl::Error>;
9598
9599    fn poll_next(
9600        mut self: std::pin::Pin<&mut Self>,
9601        cx: &mut std::task::Context<'_>,
9602    ) -> std::task::Poll<Option<Self::Item>> {
9603        let this = &mut *self;
9604        if this.inner.check_shutdown(cx) {
9605            this.is_terminated = true;
9606            return std::task::Poll::Ready(None);
9607        }
9608        if this.is_terminated {
9609            panic!("polled WifiStaIfaceRequestStream after completion");
9610        }
9611        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9612            |bytes, handles| {
9613                match this.inner.channel().read_etc(cx, bytes, handles) {
9614                    std::task::Poll::Ready(Ok(())) => {}
9615                    std::task::Poll::Pending => return std::task::Poll::Pending,
9616                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9617                        this.is_terminated = true;
9618                        return std::task::Poll::Ready(None);
9619                    }
9620                    std::task::Poll::Ready(Err(e)) => {
9621                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9622                            e.into(),
9623                        ))));
9624                    }
9625                }
9626
9627                // A message has been received from the channel
9628                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9629
9630                std::task::Poll::Ready(Some(match header.ordinal {
9631                    0x5c150b91c80c5789 => {
9632                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9633                        let mut req = fidl::new_empty!(
9634                            fidl::encoding::EmptyPayload,
9635                            fidl::encoding::DefaultFuchsiaResourceDialect
9636                        );
9637                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
9638                        let control_handle =
9639                            WifiStaIfaceControlHandle { inner: this.inner.clone() };
9640                        Ok(WifiStaIfaceRequest::GetName {
9641                            responder: WifiStaIfaceGetNameResponder {
9642                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9643                                tx_id: header.tx_id,
9644                            },
9645                        })
9646                    }
9647                    0x22550328583bf0e3 => {
9648                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
9649                        let mut req = fidl::new_empty!(
9650                            WifiStaIfaceSetScanOnlyModeRequest,
9651                            fidl::encoding::DefaultFuchsiaResourceDialect
9652                        );
9653                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WifiStaIfaceSetScanOnlyModeRequest>(&header, _body_bytes, handles, &mut req)?;
9654                        let control_handle =
9655                            WifiStaIfaceControlHandle { inner: this.inner.clone() };
9656                        Ok(WifiStaIfaceRequest::SetScanOnlyMode {
9657                            payload: req,
9658                            responder: WifiStaIfaceSetScanOnlyModeResponder {
9659                                control_handle: std::mem::ManuallyDrop::new(control_handle),
9660                                tx_id: header.tx_id,
9661                            },
9662                        })
9663                    }
9664                    _ if header.tx_id == 0
9665                        && header
9666                            .dynamic_flags()
9667                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
9668                    {
9669                        Ok(WifiStaIfaceRequest::_UnknownMethod {
9670                            ordinal: header.ordinal,
9671                            control_handle: WifiStaIfaceControlHandle { inner: this.inner.clone() },
9672                            method_type: fidl::MethodType::OneWay,
9673                        })
9674                    }
9675                    _ if header
9676                        .dynamic_flags()
9677                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
9678                    {
9679                        this.inner.send_framework_err(
9680                            fidl::encoding::FrameworkErr::UnknownMethod,
9681                            header.tx_id,
9682                            header.ordinal,
9683                            header.dynamic_flags(),
9684                            (bytes, handles),
9685                        )?;
9686                        Ok(WifiStaIfaceRequest::_UnknownMethod {
9687                            ordinal: header.ordinal,
9688                            control_handle: WifiStaIfaceControlHandle { inner: this.inner.clone() },
9689                            method_type: fidl::MethodType::TwoWay,
9690                        })
9691                    }
9692                    _ => Err(fidl::Error::UnknownOrdinal {
9693                        ordinal: header.ordinal,
9694                        protocol_name:
9695                            <WifiStaIfaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9696                    }),
9697                }))
9698            },
9699        )
9700    }
9701}
9702
9703#[derive(Debug)]
9704pub enum WifiStaIfaceRequest {
9705    /// Get the name of this iface.
9706    GetName { responder: WifiStaIfaceGetNameResponder },
9707    SetScanOnlyMode {
9708        payload: WifiStaIfaceSetScanOnlyModeRequest,
9709        responder: WifiStaIfaceSetScanOnlyModeResponder,
9710    },
9711    /// An interaction was received which does not match any known method.
9712    #[non_exhaustive]
9713    _UnknownMethod {
9714        /// Ordinal of the method that was called.
9715        ordinal: u64,
9716        control_handle: WifiStaIfaceControlHandle,
9717        method_type: fidl::MethodType,
9718    },
9719}
9720
9721impl WifiStaIfaceRequest {
9722    #[allow(irrefutable_let_patterns)]
9723    pub fn into_get_name(self) -> Option<(WifiStaIfaceGetNameResponder)> {
9724        if let WifiStaIfaceRequest::GetName { responder } = self { Some((responder)) } else { None }
9725    }
9726
9727    #[allow(irrefutable_let_patterns)]
9728    pub fn into_set_scan_only_mode(
9729        self,
9730    ) -> Option<(WifiStaIfaceSetScanOnlyModeRequest, WifiStaIfaceSetScanOnlyModeResponder)> {
9731        if let WifiStaIfaceRequest::SetScanOnlyMode { payload, responder } = self {
9732            Some((payload, responder))
9733        } else {
9734            None
9735        }
9736    }
9737
9738    /// Name of the method defined in FIDL
9739    pub fn method_name(&self) -> &'static str {
9740        match *self {
9741            WifiStaIfaceRequest::GetName { .. } => "get_name",
9742            WifiStaIfaceRequest::SetScanOnlyMode { .. } => "set_scan_only_mode",
9743            WifiStaIfaceRequest::_UnknownMethod {
9744                method_type: fidl::MethodType::OneWay, ..
9745            } => "unknown one-way method",
9746            WifiStaIfaceRequest::_UnknownMethod {
9747                method_type: fidl::MethodType::TwoWay, ..
9748            } => "unknown two-way method",
9749        }
9750    }
9751}
9752
9753#[derive(Debug, Clone)]
9754pub struct WifiStaIfaceControlHandle {
9755    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9756}
9757
9758impl fidl::endpoints::ControlHandle for WifiStaIfaceControlHandle {
9759    fn shutdown(&self) {
9760        self.inner.shutdown()
9761    }
9762    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9763        self.inner.shutdown_with_epitaph(status)
9764    }
9765
9766    fn is_closed(&self) -> bool {
9767        self.inner.channel().is_closed()
9768    }
9769    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9770        self.inner.channel().on_closed()
9771    }
9772
9773    #[cfg(target_os = "fuchsia")]
9774    fn signal_peer(
9775        &self,
9776        clear_mask: zx::Signals,
9777        set_mask: zx::Signals,
9778    ) -> Result<(), zx_status::Status> {
9779        use fidl::Peered;
9780        self.inner.channel().signal_peer(clear_mask, set_mask)
9781    }
9782}
9783
9784impl WifiStaIfaceControlHandle {}
9785
9786#[must_use = "FIDL methods require a response to be sent"]
9787#[derive(Debug)]
9788pub struct WifiStaIfaceGetNameResponder {
9789    control_handle: std::mem::ManuallyDrop<WifiStaIfaceControlHandle>,
9790    tx_id: u32,
9791}
9792
9793/// Set the the channel to be shutdown (see [`WifiStaIfaceControlHandle::shutdown`])
9794/// if the responder is dropped without sending a response, so that the client
9795/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9796impl std::ops::Drop for WifiStaIfaceGetNameResponder {
9797    fn drop(&mut self) {
9798        self.control_handle.shutdown();
9799        // Safety: drops once, never accessed again
9800        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9801    }
9802}
9803
9804impl fidl::endpoints::Responder for WifiStaIfaceGetNameResponder {
9805    type ControlHandle = WifiStaIfaceControlHandle;
9806
9807    fn control_handle(&self) -> &WifiStaIfaceControlHandle {
9808        &self.control_handle
9809    }
9810
9811    fn drop_without_shutdown(mut self) {
9812        // Safety: drops once, never accessed again due to mem::forget
9813        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9814        // Prevent Drop from running (which would shut down the channel)
9815        std::mem::forget(self);
9816    }
9817}
9818
9819impl WifiStaIfaceGetNameResponder {
9820    /// Sends a response to the FIDL transaction.
9821    ///
9822    /// Sets the channel to shutdown if an error occurs.
9823    pub fn send(self, mut payload: &WifiStaIfaceGetNameResponse) -> Result<(), fidl::Error> {
9824        let _result = self.send_raw(payload);
9825        if _result.is_err() {
9826            self.control_handle.shutdown();
9827        }
9828        self.drop_without_shutdown();
9829        _result
9830    }
9831
9832    /// Similar to "send" but does not shutdown the channel if an error occurs.
9833    pub fn send_no_shutdown_on_err(
9834        self,
9835        mut payload: &WifiStaIfaceGetNameResponse,
9836    ) -> Result<(), fidl::Error> {
9837        let _result = self.send_raw(payload);
9838        self.drop_without_shutdown();
9839        _result
9840    }
9841
9842    fn send_raw(&self, mut payload: &WifiStaIfaceGetNameResponse) -> Result<(), fidl::Error> {
9843        self.control_handle.inner.send::<fidl::encoding::FlexibleType<WifiStaIfaceGetNameResponse>>(
9844            fidl::encoding::Flexible::new(payload),
9845            self.tx_id,
9846            0x5c150b91c80c5789,
9847            fidl::encoding::DynamicFlags::FLEXIBLE,
9848        )
9849    }
9850}
9851
9852#[must_use = "FIDL methods require a response to be sent"]
9853#[derive(Debug)]
9854pub struct WifiStaIfaceSetScanOnlyModeResponder {
9855    control_handle: std::mem::ManuallyDrop<WifiStaIfaceControlHandle>,
9856    tx_id: u32,
9857}
9858
9859/// Set the the channel to be shutdown (see [`WifiStaIfaceControlHandle::shutdown`])
9860/// if the responder is dropped without sending a response, so that the client
9861/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
9862impl std::ops::Drop for WifiStaIfaceSetScanOnlyModeResponder {
9863    fn drop(&mut self) {
9864        self.control_handle.shutdown();
9865        // Safety: drops once, never accessed again
9866        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9867    }
9868}
9869
9870impl fidl::endpoints::Responder for WifiStaIfaceSetScanOnlyModeResponder {
9871    type ControlHandle = WifiStaIfaceControlHandle;
9872
9873    fn control_handle(&self) -> &WifiStaIfaceControlHandle {
9874        &self.control_handle
9875    }
9876
9877    fn drop_without_shutdown(mut self) {
9878        // Safety: drops once, never accessed again due to mem::forget
9879        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
9880        // Prevent Drop from running (which would shut down the channel)
9881        std::mem::forget(self);
9882    }
9883}
9884
9885impl WifiStaIfaceSetScanOnlyModeResponder {
9886    /// Sends a response to the FIDL transaction.
9887    ///
9888    /// Sets the channel to shutdown if an error occurs.
9889    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
9890        let _result = self.send_raw(result);
9891        if _result.is_err() {
9892            self.control_handle.shutdown();
9893        }
9894        self.drop_without_shutdown();
9895        _result
9896    }
9897
9898    /// Similar to "send" but does not shutdown the channel if an error occurs.
9899    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
9900        let _result = self.send_raw(result);
9901        self.drop_without_shutdown();
9902        _result
9903    }
9904
9905    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
9906        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
9907            fidl::encoding::EmptyStruct,
9908            i32,
9909        >>(
9910            fidl::encoding::FlexibleResult::new(result),
9911            self.tx_id,
9912            0x22550328583bf0e3,
9913            fidl::encoding::DynamicFlags::FLEXIBLE,
9914        )
9915    }
9916}
9917
9918#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
9919pub struct WlanixMarker;
9920
9921impl fidl::endpoints::ProtocolMarker for WlanixMarker {
9922    type Proxy = WlanixProxy;
9923    type RequestStream = WlanixRequestStream;
9924    #[cfg(target_os = "fuchsia")]
9925    type SynchronousProxy = WlanixSynchronousProxy;
9926
9927    const DEBUG_NAME: &'static str = "fuchsia.wlan.wlanix.Wlanix";
9928}
9929impl fidl::endpoints::DiscoverableProtocolMarker for WlanixMarker {}
9930
9931pub trait WlanixProxyInterface: Send + Sync {
9932    fn r#get_wifi(&self, payload: WlanixGetWifiRequest) -> Result<(), fidl::Error>;
9933    fn r#get_supplicant(&self, payload: WlanixGetSupplicantRequest) -> Result<(), fidl::Error>;
9934    fn r#get_nl80211(&self, payload: WlanixGetNl80211Request) -> Result<(), fidl::Error>;
9935    fn r#get_wifi_legacy_hal(
9936        &self,
9937        payload: WlanixGetWifiLegacyHalRequest,
9938    ) -> Result<(), fidl::Error>;
9939}
9940#[derive(Debug)]
9941#[cfg(target_os = "fuchsia")]
9942pub struct WlanixSynchronousProxy {
9943    client: fidl::client::sync::Client,
9944}
9945
9946#[cfg(target_os = "fuchsia")]
9947impl fidl::endpoints::SynchronousProxy for WlanixSynchronousProxy {
9948    type Proxy = WlanixProxy;
9949    type Protocol = WlanixMarker;
9950
9951    fn from_channel(inner: fidl::Channel) -> Self {
9952        Self::new(inner)
9953    }
9954
9955    fn into_channel(self) -> fidl::Channel {
9956        self.client.into_channel()
9957    }
9958
9959    fn as_channel(&self) -> &fidl::Channel {
9960        self.client.as_channel()
9961    }
9962}
9963
9964#[cfg(target_os = "fuchsia")]
9965impl WlanixSynchronousProxy {
9966    pub fn new(channel: fidl::Channel) -> Self {
9967        let protocol_name = <WlanixMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
9968        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
9969    }
9970
9971    pub fn into_channel(self) -> fidl::Channel {
9972        self.client.into_channel()
9973    }
9974
9975    /// Waits until an event arrives and returns it. It is safe for other
9976    /// threads to make concurrent requests while waiting for an event.
9977    pub fn wait_for_event(
9978        &self,
9979        deadline: zx::MonotonicInstant,
9980    ) -> Result<WlanixEvent, fidl::Error> {
9981        WlanixEvent::decode(self.client.wait_for_event(deadline)?)
9982    }
9983
9984    /// Register the channel to make WiFi request to.
9985    pub fn r#get_wifi(&self, mut payload: WlanixGetWifiRequest) -> Result<(), fidl::Error> {
9986        self.client.send::<WlanixGetWifiRequest>(
9987            &mut payload,
9988            0x142511f44b2c338c,
9989            fidl::encoding::DynamicFlags::FLEXIBLE,
9990        )
9991    }
9992
9993    pub fn r#get_supplicant(
9994        &self,
9995        mut payload: WlanixGetSupplicantRequest,
9996    ) -> Result<(), fidl::Error> {
9997        self.client.send::<WlanixGetSupplicantRequest>(
9998            &mut payload,
9999            0x55554b37c4021d3d,
10000            fidl::encoding::DynamicFlags::FLEXIBLE,
10001        )
10002    }
10003
10004    pub fn r#get_nl80211(&self, mut payload: WlanixGetNl80211Request) -> Result<(), fidl::Error> {
10005        self.client.send::<WlanixGetNl80211Request>(
10006            &mut payload,
10007            0x48028a25bd855ef9,
10008            fidl::encoding::DynamicFlags::FLEXIBLE,
10009        )
10010    }
10011
10012    pub fn r#get_wifi_legacy_hal(
10013        &self,
10014        mut payload: WlanixGetWifiLegacyHalRequest,
10015    ) -> Result<(), fidl::Error> {
10016        self.client.send::<WlanixGetWifiLegacyHalRequest>(
10017            &mut payload,
10018            0x7302d9bb3b8d1edc,
10019            fidl::encoding::DynamicFlags::FLEXIBLE,
10020        )
10021    }
10022}
10023
10024#[cfg(target_os = "fuchsia")]
10025impl From<WlanixSynchronousProxy> for zx::Handle {
10026    fn from(value: WlanixSynchronousProxy) -> Self {
10027        value.into_channel().into()
10028    }
10029}
10030
10031#[cfg(target_os = "fuchsia")]
10032impl From<fidl::Channel> for WlanixSynchronousProxy {
10033    fn from(value: fidl::Channel) -> Self {
10034        Self::new(value)
10035    }
10036}
10037
10038#[cfg(target_os = "fuchsia")]
10039impl fidl::endpoints::FromClient for WlanixSynchronousProxy {
10040    type Protocol = WlanixMarker;
10041
10042    fn from_client(value: fidl::endpoints::ClientEnd<WlanixMarker>) -> Self {
10043        Self::new(value.into_channel())
10044    }
10045}
10046
10047#[derive(Debug, Clone)]
10048pub struct WlanixProxy {
10049    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
10050}
10051
10052impl fidl::endpoints::Proxy for WlanixProxy {
10053    type Protocol = WlanixMarker;
10054
10055    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
10056        Self::new(inner)
10057    }
10058
10059    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
10060        self.client.into_channel().map_err(|client| Self { client })
10061    }
10062
10063    fn as_channel(&self) -> &::fidl::AsyncChannel {
10064        self.client.as_channel()
10065    }
10066}
10067
10068impl WlanixProxy {
10069    /// Create a new Proxy for fuchsia.wlan.wlanix/Wlanix.
10070    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
10071        let protocol_name = <WlanixMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
10072        Self { client: fidl::client::Client::new(channel, protocol_name) }
10073    }
10074
10075    /// Get a Stream of events from the remote end of the protocol.
10076    ///
10077    /// # Panics
10078    ///
10079    /// Panics if the event stream was already taken.
10080    pub fn take_event_stream(&self) -> WlanixEventStream {
10081        WlanixEventStream { event_receiver: self.client.take_event_receiver() }
10082    }
10083
10084    /// Register the channel to make WiFi request to.
10085    pub fn r#get_wifi(&self, mut payload: WlanixGetWifiRequest) -> Result<(), fidl::Error> {
10086        WlanixProxyInterface::r#get_wifi(self, payload)
10087    }
10088
10089    pub fn r#get_supplicant(
10090        &self,
10091        mut payload: WlanixGetSupplicantRequest,
10092    ) -> Result<(), fidl::Error> {
10093        WlanixProxyInterface::r#get_supplicant(self, payload)
10094    }
10095
10096    pub fn r#get_nl80211(&self, mut payload: WlanixGetNl80211Request) -> Result<(), fidl::Error> {
10097        WlanixProxyInterface::r#get_nl80211(self, payload)
10098    }
10099
10100    pub fn r#get_wifi_legacy_hal(
10101        &self,
10102        mut payload: WlanixGetWifiLegacyHalRequest,
10103    ) -> Result<(), fidl::Error> {
10104        WlanixProxyInterface::r#get_wifi_legacy_hal(self, payload)
10105    }
10106}
10107
10108impl WlanixProxyInterface for WlanixProxy {
10109    fn r#get_wifi(&self, mut payload: WlanixGetWifiRequest) -> Result<(), fidl::Error> {
10110        self.client.send::<WlanixGetWifiRequest>(
10111            &mut payload,
10112            0x142511f44b2c338c,
10113            fidl::encoding::DynamicFlags::FLEXIBLE,
10114        )
10115    }
10116
10117    fn r#get_supplicant(&self, mut payload: WlanixGetSupplicantRequest) -> Result<(), fidl::Error> {
10118        self.client.send::<WlanixGetSupplicantRequest>(
10119            &mut payload,
10120            0x55554b37c4021d3d,
10121            fidl::encoding::DynamicFlags::FLEXIBLE,
10122        )
10123    }
10124
10125    fn r#get_nl80211(&self, mut payload: WlanixGetNl80211Request) -> Result<(), fidl::Error> {
10126        self.client.send::<WlanixGetNl80211Request>(
10127            &mut payload,
10128            0x48028a25bd855ef9,
10129            fidl::encoding::DynamicFlags::FLEXIBLE,
10130        )
10131    }
10132
10133    fn r#get_wifi_legacy_hal(
10134        &self,
10135        mut payload: WlanixGetWifiLegacyHalRequest,
10136    ) -> Result<(), fidl::Error> {
10137        self.client.send::<WlanixGetWifiLegacyHalRequest>(
10138            &mut payload,
10139            0x7302d9bb3b8d1edc,
10140            fidl::encoding::DynamicFlags::FLEXIBLE,
10141        )
10142    }
10143}
10144
10145pub struct WlanixEventStream {
10146    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
10147}
10148
10149impl std::marker::Unpin for WlanixEventStream {}
10150
10151impl futures::stream::FusedStream for WlanixEventStream {
10152    fn is_terminated(&self) -> bool {
10153        self.event_receiver.is_terminated()
10154    }
10155}
10156
10157impl futures::Stream for WlanixEventStream {
10158    type Item = Result<WlanixEvent, fidl::Error>;
10159
10160    fn poll_next(
10161        mut self: std::pin::Pin<&mut Self>,
10162        cx: &mut std::task::Context<'_>,
10163    ) -> std::task::Poll<Option<Self::Item>> {
10164        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
10165            &mut self.event_receiver,
10166            cx
10167        )?) {
10168            Some(buf) => std::task::Poll::Ready(Some(WlanixEvent::decode(buf))),
10169            None => std::task::Poll::Ready(None),
10170        }
10171    }
10172}
10173
10174#[derive(Debug)]
10175pub enum WlanixEvent {
10176    #[non_exhaustive]
10177    _UnknownEvent {
10178        /// Ordinal of the event that was sent.
10179        ordinal: u64,
10180    },
10181}
10182
10183impl WlanixEvent {
10184    /// Decodes a message buffer as a [`WlanixEvent`].
10185    fn decode(
10186        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
10187    ) -> Result<WlanixEvent, fidl::Error> {
10188        let (bytes, _handles) = buf.split_mut();
10189        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10190        debug_assert_eq!(tx_header.tx_id, 0);
10191        match tx_header.ordinal {
10192            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
10193                Ok(WlanixEvent::_UnknownEvent { ordinal: tx_header.ordinal })
10194            }
10195            _ => Err(fidl::Error::UnknownOrdinal {
10196                ordinal: tx_header.ordinal,
10197                protocol_name: <WlanixMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10198            }),
10199        }
10200    }
10201}
10202
10203/// A Stream of incoming requests for fuchsia.wlan.wlanix/Wlanix.
10204pub struct WlanixRequestStream {
10205    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10206    is_terminated: bool,
10207}
10208
10209impl std::marker::Unpin for WlanixRequestStream {}
10210
10211impl futures::stream::FusedStream for WlanixRequestStream {
10212    fn is_terminated(&self) -> bool {
10213        self.is_terminated
10214    }
10215}
10216
10217impl fidl::endpoints::RequestStream for WlanixRequestStream {
10218    type Protocol = WlanixMarker;
10219    type ControlHandle = WlanixControlHandle;
10220
10221    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
10222        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
10223    }
10224
10225    fn control_handle(&self) -> Self::ControlHandle {
10226        WlanixControlHandle { inner: self.inner.clone() }
10227    }
10228
10229    fn into_inner(
10230        self,
10231    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
10232    {
10233        (self.inner, self.is_terminated)
10234    }
10235
10236    fn from_inner(
10237        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10238        is_terminated: bool,
10239    ) -> Self {
10240        Self { inner, is_terminated }
10241    }
10242}
10243
10244impl futures::Stream for WlanixRequestStream {
10245    type Item = Result<WlanixRequest, fidl::Error>;
10246
10247    fn poll_next(
10248        mut self: std::pin::Pin<&mut Self>,
10249        cx: &mut std::task::Context<'_>,
10250    ) -> std::task::Poll<Option<Self::Item>> {
10251        let this = &mut *self;
10252        if this.inner.check_shutdown(cx) {
10253            this.is_terminated = true;
10254            return std::task::Poll::Ready(None);
10255        }
10256        if this.is_terminated {
10257            panic!("polled WlanixRequestStream after completion");
10258        }
10259        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
10260            |bytes, handles| {
10261                match this.inner.channel().read_etc(cx, bytes, handles) {
10262                    std::task::Poll::Ready(Ok(())) => {}
10263                    std::task::Poll::Pending => return std::task::Poll::Pending,
10264                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
10265                        this.is_terminated = true;
10266                        return std::task::Poll::Ready(None);
10267                    }
10268                    std::task::Poll::Ready(Err(e)) => {
10269                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
10270                            e.into(),
10271                        ))));
10272                    }
10273                }
10274
10275                // A message has been received from the channel
10276                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
10277
10278                std::task::Poll::Ready(Some(match header.ordinal {
10279                    0x142511f44b2c338c => {
10280                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
10281                        let mut req = fidl::new_empty!(
10282                            WlanixGetWifiRequest,
10283                            fidl::encoding::DefaultFuchsiaResourceDialect
10284                        );
10285                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlanixGetWifiRequest>(&header, _body_bytes, handles, &mut req)?;
10286                        let control_handle = WlanixControlHandle { inner: this.inner.clone() };
10287                        Ok(WlanixRequest::GetWifi { payload: req, control_handle })
10288                    }
10289                    0x55554b37c4021d3d => {
10290                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
10291                        let mut req = fidl::new_empty!(
10292                            WlanixGetSupplicantRequest,
10293                            fidl::encoding::DefaultFuchsiaResourceDialect
10294                        );
10295                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlanixGetSupplicantRequest>(&header, _body_bytes, handles, &mut req)?;
10296                        let control_handle = WlanixControlHandle { inner: this.inner.clone() };
10297                        Ok(WlanixRequest::GetSupplicant { payload: req, control_handle })
10298                    }
10299                    0x48028a25bd855ef9 => {
10300                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
10301                        let mut req = fidl::new_empty!(
10302                            WlanixGetNl80211Request,
10303                            fidl::encoding::DefaultFuchsiaResourceDialect
10304                        );
10305                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlanixGetNl80211Request>(&header, _body_bytes, handles, &mut req)?;
10306                        let control_handle = WlanixControlHandle { inner: this.inner.clone() };
10307                        Ok(WlanixRequest::GetNl80211 { payload: req, control_handle })
10308                    }
10309                    0x7302d9bb3b8d1edc => {
10310                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
10311                        let mut req = fidl::new_empty!(
10312                            WlanixGetWifiLegacyHalRequest,
10313                            fidl::encoding::DefaultFuchsiaResourceDialect
10314                        );
10315                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlanixGetWifiLegacyHalRequest>(&header, _body_bytes, handles, &mut req)?;
10316                        let control_handle = WlanixControlHandle { inner: this.inner.clone() };
10317                        Ok(WlanixRequest::GetWifiLegacyHal { payload: req, control_handle })
10318                    }
10319                    _ if header.tx_id == 0
10320                        && header
10321                            .dynamic_flags()
10322                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
10323                    {
10324                        Ok(WlanixRequest::_UnknownMethod {
10325                            ordinal: header.ordinal,
10326                            control_handle: WlanixControlHandle { inner: this.inner.clone() },
10327                            method_type: fidl::MethodType::OneWay,
10328                        })
10329                    }
10330                    _ if header
10331                        .dynamic_flags()
10332                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
10333                    {
10334                        this.inner.send_framework_err(
10335                            fidl::encoding::FrameworkErr::UnknownMethod,
10336                            header.tx_id,
10337                            header.ordinal,
10338                            header.dynamic_flags(),
10339                            (bytes, handles),
10340                        )?;
10341                        Ok(WlanixRequest::_UnknownMethod {
10342                            ordinal: header.ordinal,
10343                            control_handle: WlanixControlHandle { inner: this.inner.clone() },
10344                            method_type: fidl::MethodType::TwoWay,
10345                        })
10346                    }
10347                    _ => Err(fidl::Error::UnknownOrdinal {
10348                        ordinal: header.ordinal,
10349                        protocol_name:
10350                            <WlanixMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
10351                    }),
10352                }))
10353            },
10354        )
10355    }
10356}
10357
10358/// Protocol used to proxy Wlanix requests from Starnix into Fuchsia.
10359#[derive(Debug)]
10360pub enum WlanixRequest {
10361    /// Register the channel to make WiFi request to.
10362    GetWifi {
10363        payload: WlanixGetWifiRequest,
10364        control_handle: WlanixControlHandle,
10365    },
10366    GetSupplicant {
10367        payload: WlanixGetSupplicantRequest,
10368        control_handle: WlanixControlHandle,
10369    },
10370    GetNl80211 {
10371        payload: WlanixGetNl80211Request,
10372        control_handle: WlanixControlHandle,
10373    },
10374    GetWifiLegacyHal {
10375        payload: WlanixGetWifiLegacyHalRequest,
10376        control_handle: WlanixControlHandle,
10377    },
10378    /// An interaction was received which does not match any known method.
10379    #[non_exhaustive]
10380    _UnknownMethod {
10381        /// Ordinal of the method that was called.
10382        ordinal: u64,
10383        control_handle: WlanixControlHandle,
10384        method_type: fidl::MethodType,
10385    },
10386}
10387
10388impl WlanixRequest {
10389    #[allow(irrefutable_let_patterns)]
10390    pub fn into_get_wifi(self) -> Option<(WlanixGetWifiRequest, WlanixControlHandle)> {
10391        if let WlanixRequest::GetWifi { payload, control_handle } = self {
10392            Some((payload, control_handle))
10393        } else {
10394            None
10395        }
10396    }
10397
10398    #[allow(irrefutable_let_patterns)]
10399    pub fn into_get_supplicant(self) -> Option<(WlanixGetSupplicantRequest, WlanixControlHandle)> {
10400        if let WlanixRequest::GetSupplicant { payload, control_handle } = self {
10401            Some((payload, control_handle))
10402        } else {
10403            None
10404        }
10405    }
10406
10407    #[allow(irrefutable_let_patterns)]
10408    pub fn into_get_nl80211(self) -> Option<(WlanixGetNl80211Request, WlanixControlHandle)> {
10409        if let WlanixRequest::GetNl80211 { payload, control_handle } = self {
10410            Some((payload, control_handle))
10411        } else {
10412            None
10413        }
10414    }
10415
10416    #[allow(irrefutable_let_patterns)]
10417    pub fn into_get_wifi_legacy_hal(
10418        self,
10419    ) -> Option<(WlanixGetWifiLegacyHalRequest, WlanixControlHandle)> {
10420        if let WlanixRequest::GetWifiLegacyHal { payload, control_handle } = self {
10421            Some((payload, control_handle))
10422        } else {
10423            None
10424        }
10425    }
10426
10427    /// Name of the method defined in FIDL
10428    pub fn method_name(&self) -> &'static str {
10429        match *self {
10430            WlanixRequest::GetWifi { .. } => "get_wifi",
10431            WlanixRequest::GetSupplicant { .. } => "get_supplicant",
10432            WlanixRequest::GetNl80211 { .. } => "get_nl80211",
10433            WlanixRequest::GetWifiLegacyHal { .. } => "get_wifi_legacy_hal",
10434            WlanixRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
10435                "unknown one-way method"
10436            }
10437            WlanixRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
10438                "unknown two-way method"
10439            }
10440        }
10441    }
10442}
10443
10444#[derive(Debug, Clone)]
10445pub struct WlanixControlHandle {
10446    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
10447}
10448
10449impl fidl::endpoints::ControlHandle for WlanixControlHandle {
10450    fn shutdown(&self) {
10451        self.inner.shutdown()
10452    }
10453    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
10454        self.inner.shutdown_with_epitaph(status)
10455    }
10456
10457    fn is_closed(&self) -> bool {
10458        self.inner.channel().is_closed()
10459    }
10460    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
10461        self.inner.channel().on_closed()
10462    }
10463
10464    #[cfg(target_os = "fuchsia")]
10465    fn signal_peer(
10466        &self,
10467        clear_mask: zx::Signals,
10468        set_mask: zx::Signals,
10469    ) -> Result<(), zx_status::Status> {
10470        use fidl::Peered;
10471        self.inner.channel().signal_peer(clear_mask, set_mask)
10472    }
10473}
10474
10475impl WlanixControlHandle {}
10476
10477mod internal {
10478    use super::*;
10479
10480    impl fidl::encoding::ResourceTypeMarker for Nl80211MessageV2Request {
10481        type Borrowed<'a> = &'a mut Self;
10482        fn take_or_borrow<'a>(
10483            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10484        ) -> Self::Borrowed<'a> {
10485            value
10486        }
10487    }
10488
10489    unsafe impl fidl::encoding::TypeMarker for Nl80211MessageV2Request {
10490        type Owned = Self;
10491
10492        #[inline(always)]
10493        fn inline_align(_context: fidl::encoding::Context) -> usize {
10494            8
10495        }
10496
10497        #[inline(always)]
10498        fn inline_size(_context: fidl::encoding::Context) -> usize {
10499            16
10500        }
10501    }
10502
10503    unsafe impl
10504        fidl::encoding::Encode<
10505            Nl80211MessageV2Request,
10506            fidl::encoding::DefaultFuchsiaResourceDialect,
10507        > for &mut Nl80211MessageV2Request
10508    {
10509        #[inline]
10510        unsafe fn encode(
10511            self,
10512            encoder: &mut fidl::encoding::Encoder<
10513                '_,
10514                fidl::encoding::DefaultFuchsiaResourceDialect,
10515            >,
10516            offset: usize,
10517            _depth: fidl::encoding::Depth,
10518        ) -> fidl::Result<()> {
10519            encoder.debug_check_bounds::<Nl80211MessageV2Request>(offset);
10520            // Delegate to tuple encoding.
10521            fidl::encoding::Encode::<
10522                Nl80211MessageV2Request,
10523                fidl::encoding::DefaultFuchsiaResourceDialect,
10524            >::encode(
10525                (<Nl80211Message as fidl::encoding::ValueTypeMarker>::borrow(&self.message),),
10526                encoder,
10527                offset,
10528                _depth,
10529            )
10530        }
10531    }
10532    unsafe impl<
10533        T0: fidl::encoding::Encode<Nl80211Message, fidl::encoding::DefaultFuchsiaResourceDialect>,
10534    >
10535        fidl::encoding::Encode<
10536            Nl80211MessageV2Request,
10537            fidl::encoding::DefaultFuchsiaResourceDialect,
10538        > for (T0,)
10539    {
10540        #[inline]
10541        unsafe fn encode(
10542            self,
10543            encoder: &mut fidl::encoding::Encoder<
10544                '_,
10545                fidl::encoding::DefaultFuchsiaResourceDialect,
10546            >,
10547            offset: usize,
10548            depth: fidl::encoding::Depth,
10549        ) -> fidl::Result<()> {
10550            encoder.debug_check_bounds::<Nl80211MessageV2Request>(offset);
10551            // Zero out padding regions. There's no need to apply masks
10552            // because the unmasked parts will be overwritten by fields.
10553            // Write the fields.
10554            self.0.encode(encoder, offset + 0, depth)?;
10555            Ok(())
10556        }
10557    }
10558
10559    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10560        for Nl80211MessageV2Request
10561    {
10562        #[inline(always)]
10563        fn new_empty() -> Self {
10564            Self {
10565                message: fidl::new_empty!(
10566                    Nl80211Message,
10567                    fidl::encoding::DefaultFuchsiaResourceDialect
10568                ),
10569            }
10570        }
10571
10572        #[inline]
10573        unsafe fn decode(
10574            &mut self,
10575            decoder: &mut fidl::encoding::Decoder<
10576                '_,
10577                fidl::encoding::DefaultFuchsiaResourceDialect,
10578            >,
10579            offset: usize,
10580            _depth: fidl::encoding::Depth,
10581        ) -> fidl::Result<()> {
10582            decoder.debug_check_bounds::<Self>(offset);
10583            // Verify that padding bytes are zero.
10584            fidl::decode!(
10585                Nl80211Message,
10586                fidl::encoding::DefaultFuchsiaResourceDialect,
10587                &mut self.message,
10588                decoder,
10589                offset + 0,
10590                _depth
10591            )?;
10592            Ok(())
10593        }
10594    }
10595
10596    impl fidl::encoding::ResourceTypeMarker for Nl80211MessageV2Response {
10597        type Borrowed<'a> = &'a mut Self;
10598        fn take_or_borrow<'a>(
10599            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10600        ) -> Self::Borrowed<'a> {
10601            value
10602        }
10603    }
10604
10605    unsafe impl fidl::encoding::TypeMarker for Nl80211MessageV2Response {
10606        type Owned = Self;
10607
10608        #[inline(always)]
10609        fn inline_align(_context: fidl::encoding::Context) -> usize {
10610            4
10611        }
10612
10613        #[inline(always)]
10614        fn inline_size(_context: fidl::encoding::Context) -> usize {
10615            4
10616        }
10617    }
10618
10619    unsafe impl
10620        fidl::encoding::Encode<
10621            Nl80211MessageV2Response,
10622            fidl::encoding::DefaultFuchsiaResourceDialect,
10623        > for &mut Nl80211MessageV2Response
10624    {
10625        #[inline]
10626        unsafe fn encode(
10627            self,
10628            encoder: &mut fidl::encoding::Encoder<
10629                '_,
10630                fidl::encoding::DefaultFuchsiaResourceDialect,
10631            >,
10632            offset: usize,
10633            _depth: fidl::encoding::Depth,
10634        ) -> fidl::Result<()> {
10635            encoder.debug_check_bounds::<Nl80211MessageV2Response>(offset);
10636            // Delegate to tuple encoding.
10637            fidl::encoding::Encode::<
10638                Nl80211MessageV2Response,
10639                fidl::encoding::DefaultFuchsiaResourceDialect,
10640            >::encode(
10641                (<fidl::encoding::HandleType<
10642                    fidl::Vmo,
10643                    { fidl::ObjectType::VMO.into_raw() },
10644                    2147483648,
10645                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
10646                    &mut self.response
10647                ),),
10648                encoder,
10649                offset,
10650                _depth,
10651            )
10652        }
10653    }
10654    unsafe impl<
10655        T0: fidl::encoding::Encode<
10656                fidl::encoding::HandleType<
10657                    fidl::Vmo,
10658                    { fidl::ObjectType::VMO.into_raw() },
10659                    2147483648,
10660                >,
10661                fidl::encoding::DefaultFuchsiaResourceDialect,
10662            >,
10663    >
10664        fidl::encoding::Encode<
10665            Nl80211MessageV2Response,
10666            fidl::encoding::DefaultFuchsiaResourceDialect,
10667        > for (T0,)
10668    {
10669        #[inline]
10670        unsafe fn encode(
10671            self,
10672            encoder: &mut fidl::encoding::Encoder<
10673                '_,
10674                fidl::encoding::DefaultFuchsiaResourceDialect,
10675            >,
10676            offset: usize,
10677            depth: fidl::encoding::Depth,
10678        ) -> fidl::Result<()> {
10679            encoder.debug_check_bounds::<Nl80211MessageV2Response>(offset);
10680            // Zero out padding regions. There's no need to apply masks
10681            // because the unmasked parts will be overwritten by fields.
10682            // Write the fields.
10683            self.0.encode(encoder, offset + 0, depth)?;
10684            Ok(())
10685        }
10686    }
10687
10688    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10689        for Nl80211MessageV2Response
10690    {
10691        #[inline(always)]
10692        fn new_empty() -> Self {
10693            Self {
10694                response: fidl::new_empty!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect),
10695            }
10696        }
10697
10698        #[inline]
10699        unsafe fn decode(
10700            &mut self,
10701            decoder: &mut fidl::encoding::Decoder<
10702                '_,
10703                fidl::encoding::DefaultFuchsiaResourceDialect,
10704            >,
10705            offset: usize,
10706            _depth: fidl::encoding::Depth,
10707        ) -> fidl::Result<()> {
10708            decoder.debug_check_bounds::<Self>(offset);
10709            // Verify that padding bytes are zero.
10710            fidl::decode!(fidl::encoding::HandleType<fidl::Vmo, { fidl::ObjectType::VMO.into_raw() }, 2147483648>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.response, decoder, offset + 0, _depth)?;
10711            Ok(())
10712        }
10713    }
10714
10715    impl Nl80211GetMulticastRequest {
10716        #[inline(always)]
10717        fn max_ordinal_present(&self) -> u64 {
10718            if let Some(_) = self.multicast {
10719                return 2;
10720            }
10721            if let Some(_) = self.group {
10722                return 1;
10723            }
10724            0
10725        }
10726    }
10727
10728    impl fidl::encoding::ResourceTypeMarker for Nl80211GetMulticastRequest {
10729        type Borrowed<'a> = &'a mut Self;
10730        fn take_or_borrow<'a>(
10731            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10732        ) -> Self::Borrowed<'a> {
10733            value
10734        }
10735    }
10736
10737    unsafe impl fidl::encoding::TypeMarker for Nl80211GetMulticastRequest {
10738        type Owned = Self;
10739
10740        #[inline(always)]
10741        fn inline_align(_context: fidl::encoding::Context) -> usize {
10742            8
10743        }
10744
10745        #[inline(always)]
10746        fn inline_size(_context: fidl::encoding::Context) -> usize {
10747            16
10748        }
10749    }
10750
10751    unsafe impl
10752        fidl::encoding::Encode<
10753            Nl80211GetMulticastRequest,
10754            fidl::encoding::DefaultFuchsiaResourceDialect,
10755        > for &mut Nl80211GetMulticastRequest
10756    {
10757        unsafe fn encode(
10758            self,
10759            encoder: &mut fidl::encoding::Encoder<
10760                '_,
10761                fidl::encoding::DefaultFuchsiaResourceDialect,
10762            >,
10763            offset: usize,
10764            mut depth: fidl::encoding::Depth,
10765        ) -> fidl::Result<()> {
10766            encoder.debug_check_bounds::<Nl80211GetMulticastRequest>(offset);
10767            // Vector header
10768            let max_ordinal: u64 = self.max_ordinal_present();
10769            encoder.write_num(max_ordinal, offset);
10770            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10771            // Calling encoder.out_of_line_offset(0) is not allowed.
10772            if max_ordinal == 0 {
10773                return Ok(());
10774            }
10775            depth.increment()?;
10776            let envelope_size = 8;
10777            let bytes_len = max_ordinal as usize * envelope_size;
10778            #[allow(unused_variables)]
10779            let offset = encoder.out_of_line_offset(bytes_len);
10780            let mut _prev_end_offset: usize = 0;
10781            if 1 > max_ordinal {
10782                return Ok(());
10783            }
10784
10785            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10786            // are envelope_size bytes.
10787            let cur_offset: usize = (1 - 1) * envelope_size;
10788
10789            // Zero reserved fields.
10790            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10791
10792            // Safety:
10793            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10794            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10795            //   envelope_size bytes, there is always sufficient room.
10796            fidl::encoding::encode_in_envelope_optional::<
10797                fidl::encoding::BoundedString<32>,
10798                fidl::encoding::DefaultFuchsiaResourceDialect,
10799            >(
10800                self.group.as_ref().map(
10801                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow,
10802                ),
10803                encoder,
10804                offset + cur_offset,
10805                depth,
10806            )?;
10807
10808            _prev_end_offset = cur_offset + envelope_size;
10809            if 2 > max_ordinal {
10810                return Ok(());
10811            }
10812
10813            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10814            // are envelope_size bytes.
10815            let cur_offset: usize = (2 - 1) * envelope_size;
10816
10817            // Zero reserved fields.
10818            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10819
10820            // Safety:
10821            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10822            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10823            //   envelope_size bytes, there is always sufficient room.
10824            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<Nl80211MulticastMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
10825            self.multicast.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<Nl80211MulticastMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
10826            encoder, offset + cur_offset, depth
10827        )?;
10828
10829            _prev_end_offset = cur_offset + envelope_size;
10830
10831            Ok(())
10832        }
10833    }
10834
10835    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10836        for Nl80211GetMulticastRequest
10837    {
10838        #[inline(always)]
10839        fn new_empty() -> Self {
10840            Self::default()
10841        }
10842
10843        unsafe fn decode(
10844            &mut self,
10845            decoder: &mut fidl::encoding::Decoder<
10846                '_,
10847                fidl::encoding::DefaultFuchsiaResourceDialect,
10848            >,
10849            offset: usize,
10850            mut depth: fidl::encoding::Depth,
10851        ) -> fidl::Result<()> {
10852            decoder.debug_check_bounds::<Self>(offset);
10853            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10854                None => return Err(fidl::Error::NotNullable),
10855                Some(len) => len,
10856            };
10857            // Calling decoder.out_of_line_offset(0) is not allowed.
10858            if len == 0 {
10859                return Ok(());
10860            };
10861            depth.increment()?;
10862            let envelope_size = 8;
10863            let bytes_len = len * envelope_size;
10864            let offset = decoder.out_of_line_offset(bytes_len)?;
10865            // Decode the envelope for each type.
10866            let mut _next_ordinal_to_read = 0;
10867            let mut next_offset = offset;
10868            let end_offset = offset + bytes_len;
10869            _next_ordinal_to_read += 1;
10870            if next_offset >= end_offset {
10871                return Ok(());
10872            }
10873
10874            // Decode unknown envelopes for gaps in ordinals.
10875            while _next_ordinal_to_read < 1 {
10876                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10877                _next_ordinal_to_read += 1;
10878                next_offset += envelope_size;
10879            }
10880
10881            let next_out_of_line = decoder.next_out_of_line();
10882            let handles_before = decoder.remaining_handles();
10883            if let Some((inlined, num_bytes, num_handles)) =
10884                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10885            {
10886                let member_inline_size =
10887                    <fidl::encoding::BoundedString<32> as fidl::encoding::TypeMarker>::inline_size(
10888                        decoder.context,
10889                    );
10890                if inlined != (member_inline_size <= 4) {
10891                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10892                }
10893                let inner_offset;
10894                let mut inner_depth = depth.clone();
10895                if inlined {
10896                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10897                    inner_offset = next_offset;
10898                } else {
10899                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10900                    inner_depth.increment()?;
10901                }
10902                let val_ref = self.group.get_or_insert_with(|| {
10903                    fidl::new_empty!(
10904                        fidl::encoding::BoundedString<32>,
10905                        fidl::encoding::DefaultFuchsiaResourceDialect
10906                    )
10907                });
10908                fidl::decode!(
10909                    fidl::encoding::BoundedString<32>,
10910                    fidl::encoding::DefaultFuchsiaResourceDialect,
10911                    val_ref,
10912                    decoder,
10913                    inner_offset,
10914                    inner_depth
10915                )?;
10916                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10917                {
10918                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10919                }
10920                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10921                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10922                }
10923            }
10924
10925            next_offset += envelope_size;
10926            _next_ordinal_to_read += 1;
10927            if next_offset >= end_offset {
10928                return Ok(());
10929            }
10930
10931            // Decode unknown envelopes for gaps in ordinals.
10932            while _next_ordinal_to_read < 2 {
10933                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10934                _next_ordinal_to_read += 1;
10935                next_offset += envelope_size;
10936            }
10937
10938            let next_out_of_line = decoder.next_out_of_line();
10939            let handles_before = decoder.remaining_handles();
10940            if let Some((inlined, num_bytes, num_handles)) =
10941                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10942            {
10943                let member_inline_size = <fidl::encoding::Endpoint<
10944                    fidl::endpoints::ClientEnd<Nl80211MulticastMarker>,
10945                > as fidl::encoding::TypeMarker>::inline_size(
10946                    decoder.context
10947                );
10948                if inlined != (member_inline_size <= 4) {
10949                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10950                }
10951                let inner_offset;
10952                let mut inner_depth = depth.clone();
10953                if inlined {
10954                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10955                    inner_offset = next_offset;
10956                } else {
10957                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10958                    inner_depth.increment()?;
10959                }
10960                let val_ref = self.multicast.get_or_insert_with(|| {
10961                    fidl::new_empty!(
10962                        fidl::encoding::Endpoint<
10963                            fidl::endpoints::ClientEnd<Nl80211MulticastMarker>,
10964                        >,
10965                        fidl::encoding::DefaultFuchsiaResourceDialect
10966                    )
10967                });
10968                fidl::decode!(
10969                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<Nl80211MulticastMarker>>,
10970                    fidl::encoding::DefaultFuchsiaResourceDialect,
10971                    val_ref,
10972                    decoder,
10973                    inner_offset,
10974                    inner_depth
10975                )?;
10976                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10977                {
10978                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10979                }
10980                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10981                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10982                }
10983            }
10984
10985            next_offset += envelope_size;
10986
10987            // Decode the remaining unknown envelopes.
10988            while next_offset < end_offset {
10989                _next_ordinal_to_read += 1;
10990                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10991                next_offset += envelope_size;
10992            }
10993
10994            Ok(())
10995        }
10996    }
10997
10998    impl Nl80211MessageRequest {
10999        #[inline(always)]
11000        fn max_ordinal_present(&self) -> u64 {
11001            if let Some(_) = self.message {
11002                return 1;
11003            }
11004            0
11005        }
11006    }
11007
11008    impl fidl::encoding::ResourceTypeMarker for Nl80211MessageRequest {
11009        type Borrowed<'a> = &'a mut Self;
11010        fn take_or_borrow<'a>(
11011            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11012        ) -> Self::Borrowed<'a> {
11013            value
11014        }
11015    }
11016
11017    unsafe impl fidl::encoding::TypeMarker for Nl80211MessageRequest {
11018        type Owned = Self;
11019
11020        #[inline(always)]
11021        fn inline_align(_context: fidl::encoding::Context) -> usize {
11022            8
11023        }
11024
11025        #[inline(always)]
11026        fn inline_size(_context: fidl::encoding::Context) -> usize {
11027            16
11028        }
11029    }
11030
11031    unsafe impl
11032        fidl::encoding::Encode<Nl80211MessageRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
11033        for &mut Nl80211MessageRequest
11034    {
11035        unsafe fn encode(
11036            self,
11037            encoder: &mut fidl::encoding::Encoder<
11038                '_,
11039                fidl::encoding::DefaultFuchsiaResourceDialect,
11040            >,
11041            offset: usize,
11042            mut depth: fidl::encoding::Depth,
11043        ) -> fidl::Result<()> {
11044            encoder.debug_check_bounds::<Nl80211MessageRequest>(offset);
11045            // Vector header
11046            let max_ordinal: u64 = self.max_ordinal_present();
11047            encoder.write_num(max_ordinal, offset);
11048            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11049            // Calling encoder.out_of_line_offset(0) is not allowed.
11050            if max_ordinal == 0 {
11051                return Ok(());
11052            }
11053            depth.increment()?;
11054            let envelope_size = 8;
11055            let bytes_len = max_ordinal as usize * envelope_size;
11056            #[allow(unused_variables)]
11057            let offset = encoder.out_of_line_offset(bytes_len);
11058            let mut _prev_end_offset: usize = 0;
11059            if 1 > max_ordinal {
11060                return Ok(());
11061            }
11062
11063            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11064            // are envelope_size bytes.
11065            let cur_offset: usize = (1 - 1) * envelope_size;
11066
11067            // Zero reserved fields.
11068            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11069
11070            // Safety:
11071            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11072            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11073            //   envelope_size bytes, there is always sufficient room.
11074            fidl::encoding::encode_in_envelope_optional::<
11075                Nl80211Message,
11076                fidl::encoding::DefaultFuchsiaResourceDialect,
11077            >(
11078                self.message
11079                    .as_ref()
11080                    .map(<Nl80211Message as fidl::encoding::ValueTypeMarker>::borrow),
11081                encoder,
11082                offset + cur_offset,
11083                depth,
11084            )?;
11085
11086            _prev_end_offset = cur_offset + envelope_size;
11087
11088            Ok(())
11089        }
11090    }
11091
11092    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11093        for Nl80211MessageRequest
11094    {
11095        #[inline(always)]
11096        fn new_empty() -> Self {
11097            Self::default()
11098        }
11099
11100        unsafe fn decode(
11101            &mut self,
11102            decoder: &mut fidl::encoding::Decoder<
11103                '_,
11104                fidl::encoding::DefaultFuchsiaResourceDialect,
11105            >,
11106            offset: usize,
11107            mut depth: fidl::encoding::Depth,
11108        ) -> fidl::Result<()> {
11109            decoder.debug_check_bounds::<Self>(offset);
11110            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11111                None => return Err(fidl::Error::NotNullable),
11112                Some(len) => len,
11113            };
11114            // Calling decoder.out_of_line_offset(0) is not allowed.
11115            if len == 0 {
11116                return Ok(());
11117            };
11118            depth.increment()?;
11119            let envelope_size = 8;
11120            let bytes_len = len * envelope_size;
11121            let offset = decoder.out_of_line_offset(bytes_len)?;
11122            // Decode the envelope for each type.
11123            let mut _next_ordinal_to_read = 0;
11124            let mut next_offset = offset;
11125            let end_offset = offset + bytes_len;
11126            _next_ordinal_to_read += 1;
11127            if next_offset >= end_offset {
11128                return Ok(());
11129            }
11130
11131            // Decode unknown envelopes for gaps in ordinals.
11132            while _next_ordinal_to_read < 1 {
11133                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11134                _next_ordinal_to_read += 1;
11135                next_offset += envelope_size;
11136            }
11137
11138            let next_out_of_line = decoder.next_out_of_line();
11139            let handles_before = decoder.remaining_handles();
11140            if let Some((inlined, num_bytes, num_handles)) =
11141                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11142            {
11143                let member_inline_size =
11144                    <Nl80211Message as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11145                if inlined != (member_inline_size <= 4) {
11146                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11147                }
11148                let inner_offset;
11149                let mut inner_depth = depth.clone();
11150                if inlined {
11151                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11152                    inner_offset = next_offset;
11153                } else {
11154                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11155                    inner_depth.increment()?;
11156                }
11157                let val_ref = self.message.get_or_insert_with(|| {
11158                    fidl::new_empty!(Nl80211Message, fidl::encoding::DefaultFuchsiaResourceDialect)
11159                });
11160                fidl::decode!(
11161                    Nl80211Message,
11162                    fidl::encoding::DefaultFuchsiaResourceDialect,
11163                    val_ref,
11164                    decoder,
11165                    inner_offset,
11166                    inner_depth
11167                )?;
11168                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11169                {
11170                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11171                }
11172                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11173                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11174                }
11175            }
11176
11177            next_offset += envelope_size;
11178
11179            // Decode the remaining unknown envelopes.
11180            while next_offset < end_offset {
11181                _next_ordinal_to_read += 1;
11182                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11183                next_offset += envelope_size;
11184            }
11185
11186            Ok(())
11187        }
11188    }
11189
11190    impl Nl80211MulticastMessageRequest {
11191        #[inline(always)]
11192        fn max_ordinal_present(&self) -> u64 {
11193            if let Some(_) = self.message {
11194                return 1;
11195            }
11196            0
11197        }
11198    }
11199
11200    impl fidl::encoding::ResourceTypeMarker for Nl80211MulticastMessageRequest {
11201        type Borrowed<'a> = &'a mut Self;
11202        fn take_or_borrow<'a>(
11203            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11204        ) -> Self::Borrowed<'a> {
11205            value
11206        }
11207    }
11208
11209    unsafe impl fidl::encoding::TypeMarker for Nl80211MulticastMessageRequest {
11210        type Owned = Self;
11211
11212        #[inline(always)]
11213        fn inline_align(_context: fidl::encoding::Context) -> usize {
11214            8
11215        }
11216
11217        #[inline(always)]
11218        fn inline_size(_context: fidl::encoding::Context) -> usize {
11219            16
11220        }
11221    }
11222
11223    unsafe impl
11224        fidl::encoding::Encode<
11225            Nl80211MulticastMessageRequest,
11226            fidl::encoding::DefaultFuchsiaResourceDialect,
11227        > for &mut Nl80211MulticastMessageRequest
11228    {
11229        unsafe fn encode(
11230            self,
11231            encoder: &mut fidl::encoding::Encoder<
11232                '_,
11233                fidl::encoding::DefaultFuchsiaResourceDialect,
11234            >,
11235            offset: usize,
11236            mut depth: fidl::encoding::Depth,
11237        ) -> fidl::Result<()> {
11238            encoder.debug_check_bounds::<Nl80211MulticastMessageRequest>(offset);
11239            // Vector header
11240            let max_ordinal: u64 = self.max_ordinal_present();
11241            encoder.write_num(max_ordinal, offset);
11242            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11243            // Calling encoder.out_of_line_offset(0) is not allowed.
11244            if max_ordinal == 0 {
11245                return Ok(());
11246            }
11247            depth.increment()?;
11248            let envelope_size = 8;
11249            let bytes_len = max_ordinal as usize * envelope_size;
11250            #[allow(unused_variables)]
11251            let offset = encoder.out_of_line_offset(bytes_len);
11252            let mut _prev_end_offset: usize = 0;
11253            if 1 > max_ordinal {
11254                return Ok(());
11255            }
11256
11257            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11258            // are envelope_size bytes.
11259            let cur_offset: usize = (1 - 1) * envelope_size;
11260
11261            // Zero reserved fields.
11262            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11263
11264            // Safety:
11265            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11266            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11267            //   envelope_size bytes, there is always sufficient room.
11268            fidl::encoding::encode_in_envelope_optional::<
11269                Nl80211Message,
11270                fidl::encoding::DefaultFuchsiaResourceDialect,
11271            >(
11272                self.message
11273                    .as_ref()
11274                    .map(<Nl80211Message as fidl::encoding::ValueTypeMarker>::borrow),
11275                encoder,
11276                offset + cur_offset,
11277                depth,
11278            )?;
11279
11280            _prev_end_offset = cur_offset + envelope_size;
11281
11282            Ok(())
11283        }
11284    }
11285
11286    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11287        for Nl80211MulticastMessageRequest
11288    {
11289        #[inline(always)]
11290        fn new_empty() -> Self {
11291            Self::default()
11292        }
11293
11294        unsafe fn decode(
11295            &mut self,
11296            decoder: &mut fidl::encoding::Decoder<
11297                '_,
11298                fidl::encoding::DefaultFuchsiaResourceDialect,
11299            >,
11300            offset: usize,
11301            mut depth: fidl::encoding::Depth,
11302        ) -> fidl::Result<()> {
11303            decoder.debug_check_bounds::<Self>(offset);
11304            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11305                None => return Err(fidl::Error::NotNullable),
11306                Some(len) => len,
11307            };
11308            // Calling decoder.out_of_line_offset(0) is not allowed.
11309            if len == 0 {
11310                return Ok(());
11311            };
11312            depth.increment()?;
11313            let envelope_size = 8;
11314            let bytes_len = len * envelope_size;
11315            let offset = decoder.out_of_line_offset(bytes_len)?;
11316            // Decode the envelope for each type.
11317            let mut _next_ordinal_to_read = 0;
11318            let mut next_offset = offset;
11319            let end_offset = offset + bytes_len;
11320            _next_ordinal_to_read += 1;
11321            if next_offset >= end_offset {
11322                return Ok(());
11323            }
11324
11325            // Decode unknown envelopes for gaps in ordinals.
11326            while _next_ordinal_to_read < 1 {
11327                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11328                _next_ordinal_to_read += 1;
11329                next_offset += envelope_size;
11330            }
11331
11332            let next_out_of_line = decoder.next_out_of_line();
11333            let handles_before = decoder.remaining_handles();
11334            if let Some((inlined, num_bytes, num_handles)) =
11335                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11336            {
11337                let member_inline_size =
11338                    <Nl80211Message as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11339                if inlined != (member_inline_size <= 4) {
11340                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11341                }
11342                let inner_offset;
11343                let mut inner_depth = depth.clone();
11344                if inlined {
11345                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11346                    inner_offset = next_offset;
11347                } else {
11348                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11349                    inner_depth.increment()?;
11350                }
11351                let val_ref = self.message.get_or_insert_with(|| {
11352                    fidl::new_empty!(Nl80211Message, fidl::encoding::DefaultFuchsiaResourceDialect)
11353                });
11354                fidl::decode!(
11355                    Nl80211Message,
11356                    fidl::encoding::DefaultFuchsiaResourceDialect,
11357                    val_ref,
11358                    decoder,
11359                    inner_offset,
11360                    inner_depth
11361                )?;
11362                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11363                {
11364                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11365                }
11366                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11367                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11368                }
11369            }
11370
11371            next_offset += envelope_size;
11372
11373            // Decode the remaining unknown envelopes.
11374            while next_offset < end_offset {
11375                _next_ordinal_to_read += 1;
11376                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11377                next_offset += envelope_size;
11378            }
11379
11380            Ok(())
11381        }
11382    }
11383
11384    impl Nl80211MessageResponse {
11385        #[inline(always)]
11386        fn max_ordinal_present(&self) -> u64 {
11387            if let Some(_) = self.responses {
11388                return 1;
11389            }
11390            0
11391        }
11392    }
11393
11394    impl fidl::encoding::ResourceTypeMarker for Nl80211MessageResponse {
11395        type Borrowed<'a> = &'a mut Self;
11396        fn take_or_borrow<'a>(
11397            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11398        ) -> Self::Borrowed<'a> {
11399            value
11400        }
11401    }
11402
11403    unsafe impl fidl::encoding::TypeMarker for Nl80211MessageResponse {
11404        type Owned = Self;
11405
11406        #[inline(always)]
11407        fn inline_align(_context: fidl::encoding::Context) -> usize {
11408            8
11409        }
11410
11411        #[inline(always)]
11412        fn inline_size(_context: fidl::encoding::Context) -> usize {
11413            16
11414        }
11415    }
11416
11417    unsafe impl
11418        fidl::encoding::Encode<
11419            Nl80211MessageResponse,
11420            fidl::encoding::DefaultFuchsiaResourceDialect,
11421        > for &mut Nl80211MessageResponse
11422    {
11423        unsafe fn encode(
11424            self,
11425            encoder: &mut fidl::encoding::Encoder<
11426                '_,
11427                fidl::encoding::DefaultFuchsiaResourceDialect,
11428            >,
11429            offset: usize,
11430            mut depth: fidl::encoding::Depth,
11431        ) -> fidl::Result<()> {
11432            encoder.debug_check_bounds::<Nl80211MessageResponse>(offset);
11433            // Vector header
11434            let max_ordinal: u64 = self.max_ordinal_present();
11435            encoder.write_num(max_ordinal, offset);
11436            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11437            // Calling encoder.out_of_line_offset(0) is not allowed.
11438            if max_ordinal == 0 {
11439                return Ok(());
11440            }
11441            depth.increment()?;
11442            let envelope_size = 8;
11443            let bytes_len = max_ordinal as usize * envelope_size;
11444            #[allow(unused_variables)]
11445            let offset = encoder.out_of_line_offset(bytes_len);
11446            let mut _prev_end_offset: usize = 0;
11447            if 1 > max_ordinal {
11448                return Ok(());
11449            }
11450
11451            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11452            // are envelope_size bytes.
11453            let cur_offset: usize = (1 - 1) * envelope_size;
11454
11455            // Zero reserved fields.
11456            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11457
11458            // Safety:
11459            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11460            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11461            //   envelope_size bytes, there is always sufficient room.
11462            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<Nl80211Message>, fidl::encoding::DefaultFuchsiaResourceDialect>(
11463            self.responses.as_ref().map(<fidl::encoding::UnboundedVector<Nl80211Message> as fidl::encoding::ValueTypeMarker>::borrow),
11464            encoder, offset + cur_offset, depth
11465        )?;
11466
11467            _prev_end_offset = cur_offset + envelope_size;
11468
11469            Ok(())
11470        }
11471    }
11472
11473    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11474        for Nl80211MessageResponse
11475    {
11476        #[inline(always)]
11477        fn new_empty() -> Self {
11478            Self::default()
11479        }
11480
11481        unsafe fn decode(
11482            &mut self,
11483            decoder: &mut fidl::encoding::Decoder<
11484                '_,
11485                fidl::encoding::DefaultFuchsiaResourceDialect,
11486            >,
11487            offset: usize,
11488            mut depth: fidl::encoding::Depth,
11489        ) -> fidl::Result<()> {
11490            decoder.debug_check_bounds::<Self>(offset);
11491            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11492                None => return Err(fidl::Error::NotNullable),
11493                Some(len) => len,
11494            };
11495            // Calling decoder.out_of_line_offset(0) is not allowed.
11496            if len == 0 {
11497                return Ok(());
11498            };
11499            depth.increment()?;
11500            let envelope_size = 8;
11501            let bytes_len = len * envelope_size;
11502            let offset = decoder.out_of_line_offset(bytes_len)?;
11503            // Decode the envelope for each type.
11504            let mut _next_ordinal_to_read = 0;
11505            let mut next_offset = offset;
11506            let end_offset = offset + bytes_len;
11507            _next_ordinal_to_read += 1;
11508            if next_offset >= end_offset {
11509                return Ok(());
11510            }
11511
11512            // Decode unknown envelopes for gaps in ordinals.
11513            while _next_ordinal_to_read < 1 {
11514                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11515                _next_ordinal_to_read += 1;
11516                next_offset += envelope_size;
11517            }
11518
11519            let next_out_of_line = decoder.next_out_of_line();
11520            let handles_before = decoder.remaining_handles();
11521            if let Some((inlined, num_bytes, num_handles)) =
11522                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11523            {
11524                let member_inline_size = <fidl::encoding::UnboundedVector<Nl80211Message> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11525                if inlined != (member_inline_size <= 4) {
11526                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11527                }
11528                let inner_offset;
11529                let mut inner_depth = depth.clone();
11530                if inlined {
11531                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11532                    inner_offset = next_offset;
11533                } else {
11534                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11535                    inner_depth.increment()?;
11536                }
11537                let val_ref = self.responses.get_or_insert_with(|| {
11538                    fidl::new_empty!(
11539                        fidl::encoding::UnboundedVector<Nl80211Message>,
11540                        fidl::encoding::DefaultFuchsiaResourceDialect
11541                    )
11542                });
11543                fidl::decode!(
11544                    fidl::encoding::UnboundedVector<Nl80211Message>,
11545                    fidl::encoding::DefaultFuchsiaResourceDialect,
11546                    val_ref,
11547                    decoder,
11548                    inner_offset,
11549                    inner_depth
11550                )?;
11551                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11552                {
11553                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11554                }
11555                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11556                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11557                }
11558            }
11559
11560            next_offset += envelope_size;
11561
11562            // Decode the remaining unknown envelopes.
11563            while next_offset < end_offset {
11564                _next_ordinal_to_read += 1;
11565                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11566                next_offset += envelope_size;
11567            }
11568
11569            Ok(())
11570        }
11571    }
11572
11573    impl SupplicantAddStaInterfaceRequest {
11574        #[inline(always)]
11575        fn max_ordinal_present(&self) -> u64 {
11576            if let Some(_) = self.iface_name {
11577                return 2;
11578            }
11579            if let Some(_) = self.iface {
11580                return 1;
11581            }
11582            0
11583        }
11584    }
11585
11586    impl fidl::encoding::ResourceTypeMarker for SupplicantAddStaInterfaceRequest {
11587        type Borrowed<'a> = &'a mut Self;
11588        fn take_or_borrow<'a>(
11589            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11590        ) -> Self::Borrowed<'a> {
11591            value
11592        }
11593    }
11594
11595    unsafe impl fidl::encoding::TypeMarker for SupplicantAddStaInterfaceRequest {
11596        type Owned = Self;
11597
11598        #[inline(always)]
11599        fn inline_align(_context: fidl::encoding::Context) -> usize {
11600            8
11601        }
11602
11603        #[inline(always)]
11604        fn inline_size(_context: fidl::encoding::Context) -> usize {
11605            16
11606        }
11607    }
11608
11609    unsafe impl
11610        fidl::encoding::Encode<
11611            SupplicantAddStaInterfaceRequest,
11612            fidl::encoding::DefaultFuchsiaResourceDialect,
11613        > for &mut SupplicantAddStaInterfaceRequest
11614    {
11615        unsafe fn encode(
11616            self,
11617            encoder: &mut fidl::encoding::Encoder<
11618                '_,
11619                fidl::encoding::DefaultFuchsiaResourceDialect,
11620            >,
11621            offset: usize,
11622            mut depth: fidl::encoding::Depth,
11623        ) -> fidl::Result<()> {
11624            encoder.debug_check_bounds::<SupplicantAddStaInterfaceRequest>(offset);
11625            // Vector header
11626            let max_ordinal: u64 = self.max_ordinal_present();
11627            encoder.write_num(max_ordinal, offset);
11628            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11629            // Calling encoder.out_of_line_offset(0) is not allowed.
11630            if max_ordinal == 0 {
11631                return Ok(());
11632            }
11633            depth.increment()?;
11634            let envelope_size = 8;
11635            let bytes_len = max_ordinal as usize * envelope_size;
11636            #[allow(unused_variables)]
11637            let offset = encoder.out_of_line_offset(bytes_len);
11638            let mut _prev_end_offset: usize = 0;
11639            if 1 > max_ordinal {
11640                return Ok(());
11641            }
11642
11643            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11644            // are envelope_size bytes.
11645            let cur_offset: usize = (1 - 1) * envelope_size;
11646
11647            // Zero reserved fields.
11648            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11649
11650            // Safety:
11651            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11652            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11653            //   envelope_size bytes, there is always sufficient room.
11654            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SupplicantStaIfaceMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
11655            self.iface.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SupplicantStaIfaceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
11656            encoder, offset + cur_offset, depth
11657        )?;
11658
11659            _prev_end_offset = cur_offset + envelope_size;
11660            if 2 > max_ordinal {
11661                return Ok(());
11662            }
11663
11664            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11665            // are envelope_size bytes.
11666            let cur_offset: usize = (2 - 1) * envelope_size;
11667
11668            // Zero reserved fields.
11669            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11670
11671            // Safety:
11672            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11673            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11674            //   envelope_size bytes, there is always sufficient room.
11675            fidl::encoding::encode_in_envelope_optional::<
11676                fidl::encoding::BoundedString<16>,
11677                fidl::encoding::DefaultFuchsiaResourceDialect,
11678            >(
11679                self.iface_name.as_ref().map(
11680                    <fidl::encoding::BoundedString<16> as fidl::encoding::ValueTypeMarker>::borrow,
11681                ),
11682                encoder,
11683                offset + cur_offset,
11684                depth,
11685            )?;
11686
11687            _prev_end_offset = cur_offset + envelope_size;
11688
11689            Ok(())
11690        }
11691    }
11692
11693    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11694        for SupplicantAddStaInterfaceRequest
11695    {
11696        #[inline(always)]
11697        fn new_empty() -> Self {
11698            Self::default()
11699        }
11700
11701        unsafe fn decode(
11702            &mut self,
11703            decoder: &mut fidl::encoding::Decoder<
11704                '_,
11705                fidl::encoding::DefaultFuchsiaResourceDialect,
11706            >,
11707            offset: usize,
11708            mut depth: fidl::encoding::Depth,
11709        ) -> fidl::Result<()> {
11710            decoder.debug_check_bounds::<Self>(offset);
11711            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11712                None => return Err(fidl::Error::NotNullable),
11713                Some(len) => len,
11714            };
11715            // Calling decoder.out_of_line_offset(0) is not allowed.
11716            if len == 0 {
11717                return Ok(());
11718            };
11719            depth.increment()?;
11720            let envelope_size = 8;
11721            let bytes_len = len * envelope_size;
11722            let offset = decoder.out_of_line_offset(bytes_len)?;
11723            // Decode the envelope for each type.
11724            let mut _next_ordinal_to_read = 0;
11725            let mut next_offset = offset;
11726            let end_offset = offset + bytes_len;
11727            _next_ordinal_to_read += 1;
11728            if next_offset >= end_offset {
11729                return Ok(());
11730            }
11731
11732            // Decode unknown envelopes for gaps in ordinals.
11733            while _next_ordinal_to_read < 1 {
11734                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11735                _next_ordinal_to_read += 1;
11736                next_offset += envelope_size;
11737            }
11738
11739            let next_out_of_line = decoder.next_out_of_line();
11740            let handles_before = decoder.remaining_handles();
11741            if let Some((inlined, num_bytes, num_handles)) =
11742                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11743            {
11744                let member_inline_size = <fidl::encoding::Endpoint<
11745                    fidl::endpoints::ServerEnd<SupplicantStaIfaceMarker>,
11746                > as fidl::encoding::TypeMarker>::inline_size(
11747                    decoder.context
11748                );
11749                if inlined != (member_inline_size <= 4) {
11750                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11751                }
11752                let inner_offset;
11753                let mut inner_depth = depth.clone();
11754                if inlined {
11755                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11756                    inner_offset = next_offset;
11757                } else {
11758                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11759                    inner_depth.increment()?;
11760                }
11761                let val_ref = self.iface.get_or_insert_with(|| {
11762                    fidl::new_empty!(
11763                        fidl::encoding::Endpoint<
11764                            fidl::endpoints::ServerEnd<SupplicantStaIfaceMarker>,
11765                        >,
11766                        fidl::encoding::DefaultFuchsiaResourceDialect
11767                    )
11768                });
11769                fidl::decode!(
11770                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SupplicantStaIfaceMarker>>,
11771                    fidl::encoding::DefaultFuchsiaResourceDialect,
11772                    val_ref,
11773                    decoder,
11774                    inner_offset,
11775                    inner_depth
11776                )?;
11777                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11778                {
11779                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11780                }
11781                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11782                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11783                }
11784            }
11785
11786            next_offset += envelope_size;
11787            _next_ordinal_to_read += 1;
11788            if next_offset >= end_offset {
11789                return Ok(());
11790            }
11791
11792            // Decode unknown envelopes for gaps in ordinals.
11793            while _next_ordinal_to_read < 2 {
11794                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11795                _next_ordinal_to_read += 1;
11796                next_offset += envelope_size;
11797            }
11798
11799            let next_out_of_line = decoder.next_out_of_line();
11800            let handles_before = decoder.remaining_handles();
11801            if let Some((inlined, num_bytes, num_handles)) =
11802                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11803            {
11804                let member_inline_size =
11805                    <fidl::encoding::BoundedString<16> as fidl::encoding::TypeMarker>::inline_size(
11806                        decoder.context,
11807                    );
11808                if inlined != (member_inline_size <= 4) {
11809                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11810                }
11811                let inner_offset;
11812                let mut inner_depth = depth.clone();
11813                if inlined {
11814                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11815                    inner_offset = next_offset;
11816                } else {
11817                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11818                    inner_depth.increment()?;
11819                }
11820                let val_ref = self.iface_name.get_or_insert_with(|| {
11821                    fidl::new_empty!(
11822                        fidl::encoding::BoundedString<16>,
11823                        fidl::encoding::DefaultFuchsiaResourceDialect
11824                    )
11825                });
11826                fidl::decode!(
11827                    fidl::encoding::BoundedString<16>,
11828                    fidl::encoding::DefaultFuchsiaResourceDialect,
11829                    val_ref,
11830                    decoder,
11831                    inner_offset,
11832                    inner_depth
11833                )?;
11834                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11835                {
11836                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11837                }
11838                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11839                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11840                }
11841            }
11842
11843            next_offset += envelope_size;
11844
11845            // Decode the remaining unknown envelopes.
11846            while next_offset < end_offset {
11847                _next_ordinal_to_read += 1;
11848                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11849                next_offset += envelope_size;
11850            }
11851
11852            Ok(())
11853        }
11854    }
11855
11856    impl SupplicantRemoveInterfaceRequest {
11857        #[inline(always)]
11858        fn max_ordinal_present(&self) -> u64 {
11859            if let Some(_) = self.iface_name {
11860                return 1;
11861            }
11862            0
11863        }
11864    }
11865
11866    impl fidl::encoding::ResourceTypeMarker for SupplicantRemoveInterfaceRequest {
11867        type Borrowed<'a> = &'a mut Self;
11868        fn take_or_borrow<'a>(
11869            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11870        ) -> Self::Borrowed<'a> {
11871            value
11872        }
11873    }
11874
11875    unsafe impl fidl::encoding::TypeMarker for SupplicantRemoveInterfaceRequest {
11876        type Owned = Self;
11877
11878        #[inline(always)]
11879        fn inline_align(_context: fidl::encoding::Context) -> usize {
11880            8
11881        }
11882
11883        #[inline(always)]
11884        fn inline_size(_context: fidl::encoding::Context) -> usize {
11885            16
11886        }
11887    }
11888
11889    unsafe impl
11890        fidl::encoding::Encode<
11891            SupplicantRemoveInterfaceRequest,
11892            fidl::encoding::DefaultFuchsiaResourceDialect,
11893        > for &mut SupplicantRemoveInterfaceRequest
11894    {
11895        unsafe fn encode(
11896            self,
11897            encoder: &mut fidl::encoding::Encoder<
11898                '_,
11899                fidl::encoding::DefaultFuchsiaResourceDialect,
11900            >,
11901            offset: usize,
11902            mut depth: fidl::encoding::Depth,
11903        ) -> fidl::Result<()> {
11904            encoder.debug_check_bounds::<SupplicantRemoveInterfaceRequest>(offset);
11905            // Vector header
11906            let max_ordinal: u64 = self.max_ordinal_present();
11907            encoder.write_num(max_ordinal, offset);
11908            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11909            // Calling encoder.out_of_line_offset(0) is not allowed.
11910            if max_ordinal == 0 {
11911                return Ok(());
11912            }
11913            depth.increment()?;
11914            let envelope_size = 8;
11915            let bytes_len = max_ordinal as usize * envelope_size;
11916            #[allow(unused_variables)]
11917            let offset = encoder.out_of_line_offset(bytes_len);
11918            let mut _prev_end_offset: usize = 0;
11919            if 1 > max_ordinal {
11920                return Ok(());
11921            }
11922
11923            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11924            // are envelope_size bytes.
11925            let cur_offset: usize = (1 - 1) * envelope_size;
11926
11927            // Zero reserved fields.
11928            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11929
11930            // Safety:
11931            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11932            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11933            //   envelope_size bytes, there is always sufficient room.
11934            fidl::encoding::encode_in_envelope_optional::<
11935                fidl::encoding::BoundedString<16>,
11936                fidl::encoding::DefaultFuchsiaResourceDialect,
11937            >(
11938                self.iface_name.as_ref().map(
11939                    <fidl::encoding::BoundedString<16> as fidl::encoding::ValueTypeMarker>::borrow,
11940                ),
11941                encoder,
11942                offset + cur_offset,
11943                depth,
11944            )?;
11945
11946            _prev_end_offset = cur_offset + envelope_size;
11947
11948            Ok(())
11949        }
11950    }
11951
11952    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11953        for SupplicantRemoveInterfaceRequest
11954    {
11955        #[inline(always)]
11956        fn new_empty() -> Self {
11957            Self::default()
11958        }
11959
11960        unsafe fn decode(
11961            &mut self,
11962            decoder: &mut fidl::encoding::Decoder<
11963                '_,
11964                fidl::encoding::DefaultFuchsiaResourceDialect,
11965            >,
11966            offset: usize,
11967            mut depth: fidl::encoding::Depth,
11968        ) -> fidl::Result<()> {
11969            decoder.debug_check_bounds::<Self>(offset);
11970            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11971                None => return Err(fidl::Error::NotNullable),
11972                Some(len) => len,
11973            };
11974            // Calling decoder.out_of_line_offset(0) is not allowed.
11975            if len == 0 {
11976                return Ok(());
11977            };
11978            depth.increment()?;
11979            let envelope_size = 8;
11980            let bytes_len = len * envelope_size;
11981            let offset = decoder.out_of_line_offset(bytes_len)?;
11982            // Decode the envelope for each type.
11983            let mut _next_ordinal_to_read = 0;
11984            let mut next_offset = offset;
11985            let end_offset = offset + bytes_len;
11986            _next_ordinal_to_read += 1;
11987            if next_offset >= end_offset {
11988                return Ok(());
11989            }
11990
11991            // Decode unknown envelopes for gaps in ordinals.
11992            while _next_ordinal_to_read < 1 {
11993                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11994                _next_ordinal_to_read += 1;
11995                next_offset += envelope_size;
11996            }
11997
11998            let next_out_of_line = decoder.next_out_of_line();
11999            let handles_before = decoder.remaining_handles();
12000            if let Some((inlined, num_bytes, num_handles)) =
12001                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12002            {
12003                let member_inline_size =
12004                    <fidl::encoding::BoundedString<16> as fidl::encoding::TypeMarker>::inline_size(
12005                        decoder.context,
12006                    );
12007                if inlined != (member_inline_size <= 4) {
12008                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12009                }
12010                let inner_offset;
12011                let mut inner_depth = depth.clone();
12012                if inlined {
12013                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12014                    inner_offset = next_offset;
12015                } else {
12016                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12017                    inner_depth.increment()?;
12018                }
12019                let val_ref = self.iface_name.get_or_insert_with(|| {
12020                    fidl::new_empty!(
12021                        fidl::encoding::BoundedString<16>,
12022                        fidl::encoding::DefaultFuchsiaResourceDialect
12023                    )
12024                });
12025                fidl::decode!(
12026                    fidl::encoding::BoundedString<16>,
12027                    fidl::encoding::DefaultFuchsiaResourceDialect,
12028                    val_ref,
12029                    decoder,
12030                    inner_offset,
12031                    inner_depth
12032                )?;
12033                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12034                {
12035                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12036                }
12037                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12038                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12039                }
12040            }
12041
12042            next_offset += envelope_size;
12043
12044            // Decode the remaining unknown envelopes.
12045            while next_offset < end_offset {
12046                _next_ordinal_to_read += 1;
12047                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12048                next_offset += envelope_size;
12049            }
12050
12051            Ok(())
12052        }
12053    }
12054
12055    impl SupplicantStaIfaceAddNetworkRequest {
12056        #[inline(always)]
12057        fn max_ordinal_present(&self) -> u64 {
12058            if let Some(_) = self.network {
12059                return 1;
12060            }
12061            0
12062        }
12063    }
12064
12065    impl fidl::encoding::ResourceTypeMarker for SupplicantStaIfaceAddNetworkRequest {
12066        type Borrowed<'a> = &'a mut Self;
12067        fn take_or_borrow<'a>(
12068            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12069        ) -> Self::Borrowed<'a> {
12070            value
12071        }
12072    }
12073
12074    unsafe impl fidl::encoding::TypeMarker for SupplicantStaIfaceAddNetworkRequest {
12075        type Owned = Self;
12076
12077        #[inline(always)]
12078        fn inline_align(_context: fidl::encoding::Context) -> usize {
12079            8
12080        }
12081
12082        #[inline(always)]
12083        fn inline_size(_context: fidl::encoding::Context) -> usize {
12084            16
12085        }
12086    }
12087
12088    unsafe impl
12089        fidl::encoding::Encode<
12090            SupplicantStaIfaceAddNetworkRequest,
12091            fidl::encoding::DefaultFuchsiaResourceDialect,
12092        > for &mut SupplicantStaIfaceAddNetworkRequest
12093    {
12094        unsafe fn encode(
12095            self,
12096            encoder: &mut fidl::encoding::Encoder<
12097                '_,
12098                fidl::encoding::DefaultFuchsiaResourceDialect,
12099            >,
12100            offset: usize,
12101            mut depth: fidl::encoding::Depth,
12102        ) -> fidl::Result<()> {
12103            encoder.debug_check_bounds::<SupplicantStaIfaceAddNetworkRequest>(offset);
12104            // Vector header
12105            let max_ordinal: u64 = self.max_ordinal_present();
12106            encoder.write_num(max_ordinal, offset);
12107            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12108            // Calling encoder.out_of_line_offset(0) is not allowed.
12109            if max_ordinal == 0 {
12110                return Ok(());
12111            }
12112            depth.increment()?;
12113            let envelope_size = 8;
12114            let bytes_len = max_ordinal as usize * envelope_size;
12115            #[allow(unused_variables)]
12116            let offset = encoder.out_of_line_offset(bytes_len);
12117            let mut _prev_end_offset: usize = 0;
12118            if 1 > max_ordinal {
12119                return Ok(());
12120            }
12121
12122            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12123            // are envelope_size bytes.
12124            let cur_offset: usize = (1 - 1) * envelope_size;
12125
12126            // Zero reserved fields.
12127            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12128
12129            // Safety:
12130            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12131            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12132            //   envelope_size bytes, there is always sufficient room.
12133            fidl::encoding::encode_in_envelope_optional::<
12134                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SupplicantStaNetworkMarker>>,
12135                fidl::encoding::DefaultFuchsiaResourceDialect,
12136            >(
12137                self.network.as_mut().map(
12138                    <fidl::encoding::Endpoint<
12139                        fidl::endpoints::ServerEnd<SupplicantStaNetworkMarker>,
12140                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12141                ),
12142                encoder,
12143                offset + cur_offset,
12144                depth,
12145            )?;
12146
12147            _prev_end_offset = cur_offset + envelope_size;
12148
12149            Ok(())
12150        }
12151    }
12152
12153    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12154        for SupplicantStaIfaceAddNetworkRequest
12155    {
12156        #[inline(always)]
12157        fn new_empty() -> Self {
12158            Self::default()
12159        }
12160
12161        unsafe fn decode(
12162            &mut self,
12163            decoder: &mut fidl::encoding::Decoder<
12164                '_,
12165                fidl::encoding::DefaultFuchsiaResourceDialect,
12166            >,
12167            offset: usize,
12168            mut depth: fidl::encoding::Depth,
12169        ) -> fidl::Result<()> {
12170            decoder.debug_check_bounds::<Self>(offset);
12171            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12172                None => return Err(fidl::Error::NotNullable),
12173                Some(len) => len,
12174            };
12175            // Calling decoder.out_of_line_offset(0) is not allowed.
12176            if len == 0 {
12177                return Ok(());
12178            };
12179            depth.increment()?;
12180            let envelope_size = 8;
12181            let bytes_len = len * envelope_size;
12182            let offset = decoder.out_of_line_offset(bytes_len)?;
12183            // Decode the envelope for each type.
12184            let mut _next_ordinal_to_read = 0;
12185            let mut next_offset = offset;
12186            let end_offset = offset + bytes_len;
12187            _next_ordinal_to_read += 1;
12188            if next_offset >= end_offset {
12189                return Ok(());
12190            }
12191
12192            // Decode unknown envelopes for gaps in ordinals.
12193            while _next_ordinal_to_read < 1 {
12194                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12195                _next_ordinal_to_read += 1;
12196                next_offset += envelope_size;
12197            }
12198
12199            let next_out_of_line = decoder.next_out_of_line();
12200            let handles_before = decoder.remaining_handles();
12201            if let Some((inlined, num_bytes, num_handles)) =
12202                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12203            {
12204                let member_inline_size = <fidl::encoding::Endpoint<
12205                    fidl::endpoints::ServerEnd<SupplicantStaNetworkMarker>,
12206                > as fidl::encoding::TypeMarker>::inline_size(
12207                    decoder.context
12208                );
12209                if inlined != (member_inline_size <= 4) {
12210                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12211                }
12212                let inner_offset;
12213                let mut inner_depth = depth.clone();
12214                if inlined {
12215                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12216                    inner_offset = next_offset;
12217                } else {
12218                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12219                    inner_depth.increment()?;
12220                }
12221                let val_ref = self.network.get_or_insert_with(|| {
12222                    fidl::new_empty!(
12223                        fidl::encoding::Endpoint<
12224                            fidl::endpoints::ServerEnd<SupplicantStaNetworkMarker>,
12225                        >,
12226                        fidl::encoding::DefaultFuchsiaResourceDialect
12227                    )
12228                });
12229                fidl::decode!(
12230                    fidl::encoding::Endpoint<
12231                        fidl::endpoints::ServerEnd<SupplicantStaNetworkMarker>,
12232                    >,
12233                    fidl::encoding::DefaultFuchsiaResourceDialect,
12234                    val_ref,
12235                    decoder,
12236                    inner_offset,
12237                    inner_depth
12238                )?;
12239                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12240                {
12241                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12242                }
12243                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12244                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12245                }
12246            }
12247
12248            next_offset += envelope_size;
12249
12250            // Decode the remaining unknown envelopes.
12251            while next_offset < end_offset {
12252                _next_ordinal_to_read += 1;
12253                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12254                next_offset += envelope_size;
12255            }
12256
12257            Ok(())
12258        }
12259    }
12260
12261    impl SupplicantStaIfaceRegisterCallbackRequest {
12262        #[inline(always)]
12263        fn max_ordinal_present(&self) -> u64 {
12264            if let Some(_) = self.callback {
12265                return 1;
12266            }
12267            0
12268        }
12269    }
12270
12271    impl fidl::encoding::ResourceTypeMarker for SupplicantStaIfaceRegisterCallbackRequest {
12272        type Borrowed<'a> = &'a mut Self;
12273        fn take_or_borrow<'a>(
12274            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12275        ) -> Self::Borrowed<'a> {
12276            value
12277        }
12278    }
12279
12280    unsafe impl fidl::encoding::TypeMarker for SupplicantStaIfaceRegisterCallbackRequest {
12281        type Owned = Self;
12282
12283        #[inline(always)]
12284        fn inline_align(_context: fidl::encoding::Context) -> usize {
12285            8
12286        }
12287
12288        #[inline(always)]
12289        fn inline_size(_context: fidl::encoding::Context) -> usize {
12290            16
12291        }
12292    }
12293
12294    unsafe impl
12295        fidl::encoding::Encode<
12296            SupplicantStaIfaceRegisterCallbackRequest,
12297            fidl::encoding::DefaultFuchsiaResourceDialect,
12298        > for &mut SupplicantStaIfaceRegisterCallbackRequest
12299    {
12300        unsafe fn encode(
12301            self,
12302            encoder: &mut fidl::encoding::Encoder<
12303                '_,
12304                fidl::encoding::DefaultFuchsiaResourceDialect,
12305            >,
12306            offset: usize,
12307            mut depth: fidl::encoding::Depth,
12308        ) -> fidl::Result<()> {
12309            encoder.debug_check_bounds::<SupplicantStaIfaceRegisterCallbackRequest>(offset);
12310            // Vector header
12311            let max_ordinal: u64 = self.max_ordinal_present();
12312            encoder.write_num(max_ordinal, offset);
12313            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12314            // Calling encoder.out_of_line_offset(0) is not allowed.
12315            if max_ordinal == 0 {
12316                return Ok(());
12317            }
12318            depth.increment()?;
12319            let envelope_size = 8;
12320            let bytes_len = max_ordinal as usize * envelope_size;
12321            #[allow(unused_variables)]
12322            let offset = encoder.out_of_line_offset(bytes_len);
12323            let mut _prev_end_offset: usize = 0;
12324            if 1 > max_ordinal {
12325                return Ok(());
12326            }
12327
12328            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12329            // are envelope_size bytes.
12330            let cur_offset: usize = (1 - 1) * envelope_size;
12331
12332            // Zero reserved fields.
12333            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12334
12335            // Safety:
12336            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12337            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12338            //   envelope_size bytes, there is always sufficient room.
12339            fidl::encoding::encode_in_envelope_optional::<
12340                fidl::encoding::Endpoint<
12341                    fidl::endpoints::ClientEnd<SupplicantStaIfaceCallbackMarker>,
12342                >,
12343                fidl::encoding::DefaultFuchsiaResourceDialect,
12344            >(
12345                self.callback.as_mut().map(
12346                    <fidl::encoding::Endpoint<
12347                        fidl::endpoints::ClientEnd<SupplicantStaIfaceCallbackMarker>,
12348                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
12349                ),
12350                encoder,
12351                offset + cur_offset,
12352                depth,
12353            )?;
12354
12355            _prev_end_offset = cur_offset + envelope_size;
12356
12357            Ok(())
12358        }
12359    }
12360
12361    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12362        for SupplicantStaIfaceRegisterCallbackRequest
12363    {
12364        #[inline(always)]
12365        fn new_empty() -> Self {
12366            Self::default()
12367        }
12368
12369        unsafe fn decode(
12370            &mut self,
12371            decoder: &mut fidl::encoding::Decoder<
12372                '_,
12373                fidl::encoding::DefaultFuchsiaResourceDialect,
12374            >,
12375            offset: usize,
12376            mut depth: fidl::encoding::Depth,
12377        ) -> fidl::Result<()> {
12378            decoder.debug_check_bounds::<Self>(offset);
12379            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12380                None => return Err(fidl::Error::NotNullable),
12381                Some(len) => len,
12382            };
12383            // Calling decoder.out_of_line_offset(0) is not allowed.
12384            if len == 0 {
12385                return Ok(());
12386            };
12387            depth.increment()?;
12388            let envelope_size = 8;
12389            let bytes_len = len * envelope_size;
12390            let offset = decoder.out_of_line_offset(bytes_len)?;
12391            // Decode the envelope for each type.
12392            let mut _next_ordinal_to_read = 0;
12393            let mut next_offset = offset;
12394            let end_offset = offset + bytes_len;
12395            _next_ordinal_to_read += 1;
12396            if next_offset >= end_offset {
12397                return Ok(());
12398            }
12399
12400            // Decode unknown envelopes for gaps in ordinals.
12401            while _next_ordinal_to_read < 1 {
12402                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12403                _next_ordinal_to_read += 1;
12404                next_offset += envelope_size;
12405            }
12406
12407            let next_out_of_line = decoder.next_out_of_line();
12408            let handles_before = decoder.remaining_handles();
12409            if let Some((inlined, num_bytes, num_handles)) =
12410                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12411            {
12412                let member_inline_size = <fidl::encoding::Endpoint<
12413                    fidl::endpoints::ClientEnd<SupplicantStaIfaceCallbackMarker>,
12414                > as fidl::encoding::TypeMarker>::inline_size(
12415                    decoder.context
12416                );
12417                if inlined != (member_inline_size <= 4) {
12418                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12419                }
12420                let inner_offset;
12421                let mut inner_depth = depth.clone();
12422                if inlined {
12423                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12424                    inner_offset = next_offset;
12425                } else {
12426                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12427                    inner_depth.increment()?;
12428                }
12429                let val_ref = self.callback.get_or_insert_with(|| {
12430                    fidl::new_empty!(
12431                        fidl::encoding::Endpoint<
12432                            fidl::endpoints::ClientEnd<SupplicantStaIfaceCallbackMarker>,
12433                        >,
12434                        fidl::encoding::DefaultFuchsiaResourceDialect
12435                    )
12436                });
12437                fidl::decode!(
12438                    fidl::encoding::Endpoint<
12439                        fidl::endpoints::ClientEnd<SupplicantStaIfaceCallbackMarker>,
12440                    >,
12441                    fidl::encoding::DefaultFuchsiaResourceDialect,
12442                    val_ref,
12443                    decoder,
12444                    inner_offset,
12445                    inner_depth
12446                )?;
12447                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12448                {
12449                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12450                }
12451                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12452                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12453                }
12454            }
12455
12456            next_offset += envelope_size;
12457
12458            // Decode the remaining unknown envelopes.
12459            while next_offset < end_offset {
12460                _next_ordinal_to_read += 1;
12461                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12462                next_offset += envelope_size;
12463            }
12464
12465            Ok(())
12466        }
12467    }
12468
12469    impl SupplicantStaIfaceSetPowerSaveRequest {
12470        #[inline(always)]
12471        fn max_ordinal_present(&self) -> u64 {
12472            if let Some(_) = self.enable {
12473                return 1;
12474            }
12475            0
12476        }
12477    }
12478
12479    impl fidl::encoding::ResourceTypeMarker for SupplicantStaIfaceSetPowerSaveRequest {
12480        type Borrowed<'a> = &'a mut Self;
12481        fn take_or_borrow<'a>(
12482            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12483        ) -> Self::Borrowed<'a> {
12484            value
12485        }
12486    }
12487
12488    unsafe impl fidl::encoding::TypeMarker for SupplicantStaIfaceSetPowerSaveRequest {
12489        type Owned = Self;
12490
12491        #[inline(always)]
12492        fn inline_align(_context: fidl::encoding::Context) -> usize {
12493            8
12494        }
12495
12496        #[inline(always)]
12497        fn inline_size(_context: fidl::encoding::Context) -> usize {
12498            16
12499        }
12500    }
12501
12502    unsafe impl
12503        fidl::encoding::Encode<
12504            SupplicantStaIfaceSetPowerSaveRequest,
12505            fidl::encoding::DefaultFuchsiaResourceDialect,
12506        > for &mut SupplicantStaIfaceSetPowerSaveRequest
12507    {
12508        unsafe fn encode(
12509            self,
12510            encoder: &mut fidl::encoding::Encoder<
12511                '_,
12512                fidl::encoding::DefaultFuchsiaResourceDialect,
12513            >,
12514            offset: usize,
12515            mut depth: fidl::encoding::Depth,
12516        ) -> fidl::Result<()> {
12517            encoder.debug_check_bounds::<SupplicantStaIfaceSetPowerSaveRequest>(offset);
12518            // Vector header
12519            let max_ordinal: u64 = self.max_ordinal_present();
12520            encoder.write_num(max_ordinal, offset);
12521            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12522            // Calling encoder.out_of_line_offset(0) is not allowed.
12523            if max_ordinal == 0 {
12524                return Ok(());
12525            }
12526            depth.increment()?;
12527            let envelope_size = 8;
12528            let bytes_len = max_ordinal as usize * envelope_size;
12529            #[allow(unused_variables)]
12530            let offset = encoder.out_of_line_offset(bytes_len);
12531            let mut _prev_end_offset: usize = 0;
12532            if 1 > max_ordinal {
12533                return Ok(());
12534            }
12535
12536            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12537            // are envelope_size bytes.
12538            let cur_offset: usize = (1 - 1) * envelope_size;
12539
12540            // Zero reserved fields.
12541            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12542
12543            // Safety:
12544            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12545            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12546            //   envelope_size bytes, there is always sufficient room.
12547            fidl::encoding::encode_in_envelope_optional::<
12548                bool,
12549                fidl::encoding::DefaultFuchsiaResourceDialect,
12550            >(
12551                self.enable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
12552                encoder,
12553                offset + cur_offset,
12554                depth,
12555            )?;
12556
12557            _prev_end_offset = cur_offset + envelope_size;
12558
12559            Ok(())
12560        }
12561    }
12562
12563    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12564        for SupplicantStaIfaceSetPowerSaveRequest
12565    {
12566        #[inline(always)]
12567        fn new_empty() -> Self {
12568            Self::default()
12569        }
12570
12571        unsafe fn decode(
12572            &mut self,
12573            decoder: &mut fidl::encoding::Decoder<
12574                '_,
12575                fidl::encoding::DefaultFuchsiaResourceDialect,
12576            >,
12577            offset: usize,
12578            mut depth: fidl::encoding::Depth,
12579        ) -> fidl::Result<()> {
12580            decoder.debug_check_bounds::<Self>(offset);
12581            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12582                None => return Err(fidl::Error::NotNullable),
12583                Some(len) => len,
12584            };
12585            // Calling decoder.out_of_line_offset(0) is not allowed.
12586            if len == 0 {
12587                return Ok(());
12588            };
12589            depth.increment()?;
12590            let envelope_size = 8;
12591            let bytes_len = len * envelope_size;
12592            let offset = decoder.out_of_line_offset(bytes_len)?;
12593            // Decode the envelope for each type.
12594            let mut _next_ordinal_to_read = 0;
12595            let mut next_offset = offset;
12596            let end_offset = offset + bytes_len;
12597            _next_ordinal_to_read += 1;
12598            if next_offset >= end_offset {
12599                return Ok(());
12600            }
12601
12602            // Decode unknown envelopes for gaps in ordinals.
12603            while _next_ordinal_to_read < 1 {
12604                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12605                _next_ordinal_to_read += 1;
12606                next_offset += envelope_size;
12607            }
12608
12609            let next_out_of_line = decoder.next_out_of_line();
12610            let handles_before = decoder.remaining_handles();
12611            if let Some((inlined, num_bytes, num_handles)) =
12612                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12613            {
12614                let member_inline_size =
12615                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12616                if inlined != (member_inline_size <= 4) {
12617                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12618                }
12619                let inner_offset;
12620                let mut inner_depth = depth.clone();
12621                if inlined {
12622                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12623                    inner_offset = next_offset;
12624                } else {
12625                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12626                    inner_depth.increment()?;
12627                }
12628                let val_ref = self.enable.get_or_insert_with(|| {
12629                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
12630                });
12631                fidl::decode!(
12632                    bool,
12633                    fidl::encoding::DefaultFuchsiaResourceDialect,
12634                    val_ref,
12635                    decoder,
12636                    inner_offset,
12637                    inner_depth
12638                )?;
12639                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12640                {
12641                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12642                }
12643                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12644                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12645                }
12646            }
12647
12648            next_offset += envelope_size;
12649
12650            // Decode the remaining unknown envelopes.
12651            while next_offset < end_offset {
12652                _next_ordinal_to_read += 1;
12653                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12654                next_offset += envelope_size;
12655            }
12656
12657            Ok(())
12658        }
12659    }
12660
12661    impl SupplicantStaIfaceSetStaCountryCodeRequest {
12662        #[inline(always)]
12663        fn max_ordinal_present(&self) -> u64 {
12664            if let Some(_) = self.code {
12665                return 1;
12666            }
12667            0
12668        }
12669    }
12670
12671    impl fidl::encoding::ResourceTypeMarker for SupplicantStaIfaceSetStaCountryCodeRequest {
12672        type Borrowed<'a> = &'a mut Self;
12673        fn take_or_borrow<'a>(
12674            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12675        ) -> Self::Borrowed<'a> {
12676            value
12677        }
12678    }
12679
12680    unsafe impl fidl::encoding::TypeMarker for SupplicantStaIfaceSetStaCountryCodeRequest {
12681        type Owned = Self;
12682
12683        #[inline(always)]
12684        fn inline_align(_context: fidl::encoding::Context) -> usize {
12685            8
12686        }
12687
12688        #[inline(always)]
12689        fn inline_size(_context: fidl::encoding::Context) -> usize {
12690            16
12691        }
12692    }
12693
12694    unsafe impl
12695        fidl::encoding::Encode<
12696            SupplicantStaIfaceSetStaCountryCodeRequest,
12697            fidl::encoding::DefaultFuchsiaResourceDialect,
12698        > for &mut SupplicantStaIfaceSetStaCountryCodeRequest
12699    {
12700        unsafe fn encode(
12701            self,
12702            encoder: &mut fidl::encoding::Encoder<
12703                '_,
12704                fidl::encoding::DefaultFuchsiaResourceDialect,
12705            >,
12706            offset: usize,
12707            mut depth: fidl::encoding::Depth,
12708        ) -> fidl::Result<()> {
12709            encoder.debug_check_bounds::<SupplicantStaIfaceSetStaCountryCodeRequest>(offset);
12710            // Vector header
12711            let max_ordinal: u64 = self.max_ordinal_present();
12712            encoder.write_num(max_ordinal, offset);
12713            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12714            // Calling encoder.out_of_line_offset(0) is not allowed.
12715            if max_ordinal == 0 {
12716                return Ok(());
12717            }
12718            depth.increment()?;
12719            let envelope_size = 8;
12720            let bytes_len = max_ordinal as usize * envelope_size;
12721            #[allow(unused_variables)]
12722            let offset = encoder.out_of_line_offset(bytes_len);
12723            let mut _prev_end_offset: usize = 0;
12724            if 1 > max_ordinal {
12725                return Ok(());
12726            }
12727
12728            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12729            // are envelope_size bytes.
12730            let cur_offset: usize = (1 - 1) * envelope_size;
12731
12732            // Zero reserved fields.
12733            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12734
12735            // Safety:
12736            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12737            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12738            //   envelope_size bytes, there is always sufficient room.
12739            fidl::encoding::encode_in_envelope_optional::<
12740                fidl::encoding::Array<u8, 2>,
12741                fidl::encoding::DefaultFuchsiaResourceDialect,
12742            >(
12743                self.code
12744                    .as_ref()
12745                    .map(<fidl::encoding::Array<u8, 2> as fidl::encoding::ValueTypeMarker>::borrow),
12746                encoder,
12747                offset + cur_offset,
12748                depth,
12749            )?;
12750
12751            _prev_end_offset = cur_offset + envelope_size;
12752
12753            Ok(())
12754        }
12755    }
12756
12757    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12758        for SupplicantStaIfaceSetStaCountryCodeRequest
12759    {
12760        #[inline(always)]
12761        fn new_empty() -> Self {
12762            Self::default()
12763        }
12764
12765        unsafe fn decode(
12766            &mut self,
12767            decoder: &mut fidl::encoding::Decoder<
12768                '_,
12769                fidl::encoding::DefaultFuchsiaResourceDialect,
12770            >,
12771            offset: usize,
12772            mut depth: fidl::encoding::Depth,
12773        ) -> fidl::Result<()> {
12774            decoder.debug_check_bounds::<Self>(offset);
12775            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12776                None => return Err(fidl::Error::NotNullable),
12777                Some(len) => len,
12778            };
12779            // Calling decoder.out_of_line_offset(0) is not allowed.
12780            if len == 0 {
12781                return Ok(());
12782            };
12783            depth.increment()?;
12784            let envelope_size = 8;
12785            let bytes_len = len * envelope_size;
12786            let offset = decoder.out_of_line_offset(bytes_len)?;
12787            // Decode the envelope for each type.
12788            let mut _next_ordinal_to_read = 0;
12789            let mut next_offset = offset;
12790            let end_offset = offset + bytes_len;
12791            _next_ordinal_to_read += 1;
12792            if next_offset >= end_offset {
12793                return Ok(());
12794            }
12795
12796            // Decode unknown envelopes for gaps in ordinals.
12797            while _next_ordinal_to_read < 1 {
12798                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12799                _next_ordinal_to_read += 1;
12800                next_offset += envelope_size;
12801            }
12802
12803            let next_out_of_line = decoder.next_out_of_line();
12804            let handles_before = decoder.remaining_handles();
12805            if let Some((inlined, num_bytes, num_handles)) =
12806                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12807            {
12808                let member_inline_size =
12809                    <fidl::encoding::Array<u8, 2> as fidl::encoding::TypeMarker>::inline_size(
12810                        decoder.context,
12811                    );
12812                if inlined != (member_inline_size <= 4) {
12813                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12814                }
12815                let inner_offset;
12816                let mut inner_depth = depth.clone();
12817                if inlined {
12818                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12819                    inner_offset = next_offset;
12820                } else {
12821                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12822                    inner_depth.increment()?;
12823                }
12824                let val_ref =
12825                self.code.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 2>, fidl::encoding::DefaultFuchsiaResourceDialect));
12826                fidl::decode!(fidl::encoding::Array<u8, 2>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
12827                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12828                {
12829                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12830                }
12831                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12832                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12833                }
12834            }
12835
12836            next_offset += envelope_size;
12837
12838            // Decode the remaining unknown envelopes.
12839            while next_offset < end_offset {
12840                _next_ordinal_to_read += 1;
12841                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12842                next_offset += envelope_size;
12843            }
12844
12845            Ok(())
12846        }
12847    }
12848
12849    impl SupplicantStaIfaceSetSuspendModeEnabledRequest {
12850        #[inline(always)]
12851        fn max_ordinal_present(&self) -> u64 {
12852            if let Some(_) = self.enable {
12853                return 1;
12854            }
12855            0
12856        }
12857    }
12858
12859    impl fidl::encoding::ResourceTypeMarker for SupplicantStaIfaceSetSuspendModeEnabledRequest {
12860        type Borrowed<'a> = &'a mut Self;
12861        fn take_or_borrow<'a>(
12862            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12863        ) -> Self::Borrowed<'a> {
12864            value
12865        }
12866    }
12867
12868    unsafe impl fidl::encoding::TypeMarker for SupplicantStaIfaceSetSuspendModeEnabledRequest {
12869        type Owned = Self;
12870
12871        #[inline(always)]
12872        fn inline_align(_context: fidl::encoding::Context) -> usize {
12873            8
12874        }
12875
12876        #[inline(always)]
12877        fn inline_size(_context: fidl::encoding::Context) -> usize {
12878            16
12879        }
12880    }
12881
12882    unsafe impl
12883        fidl::encoding::Encode<
12884            SupplicantStaIfaceSetSuspendModeEnabledRequest,
12885            fidl::encoding::DefaultFuchsiaResourceDialect,
12886        > for &mut SupplicantStaIfaceSetSuspendModeEnabledRequest
12887    {
12888        unsafe fn encode(
12889            self,
12890            encoder: &mut fidl::encoding::Encoder<
12891                '_,
12892                fidl::encoding::DefaultFuchsiaResourceDialect,
12893            >,
12894            offset: usize,
12895            mut depth: fidl::encoding::Depth,
12896        ) -> fidl::Result<()> {
12897            encoder.debug_check_bounds::<SupplicantStaIfaceSetSuspendModeEnabledRequest>(offset);
12898            // Vector header
12899            let max_ordinal: u64 = self.max_ordinal_present();
12900            encoder.write_num(max_ordinal, offset);
12901            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12902            // Calling encoder.out_of_line_offset(0) is not allowed.
12903            if max_ordinal == 0 {
12904                return Ok(());
12905            }
12906            depth.increment()?;
12907            let envelope_size = 8;
12908            let bytes_len = max_ordinal as usize * envelope_size;
12909            #[allow(unused_variables)]
12910            let offset = encoder.out_of_line_offset(bytes_len);
12911            let mut _prev_end_offset: usize = 0;
12912            if 1 > max_ordinal {
12913                return Ok(());
12914            }
12915
12916            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12917            // are envelope_size bytes.
12918            let cur_offset: usize = (1 - 1) * envelope_size;
12919
12920            // Zero reserved fields.
12921            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12922
12923            // Safety:
12924            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12925            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12926            //   envelope_size bytes, there is always sufficient room.
12927            fidl::encoding::encode_in_envelope_optional::<
12928                bool,
12929                fidl::encoding::DefaultFuchsiaResourceDialect,
12930            >(
12931                self.enable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
12932                encoder,
12933                offset + cur_offset,
12934                depth,
12935            )?;
12936
12937            _prev_end_offset = cur_offset + envelope_size;
12938
12939            Ok(())
12940        }
12941    }
12942
12943    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12944        for SupplicantStaIfaceSetSuspendModeEnabledRequest
12945    {
12946        #[inline(always)]
12947        fn new_empty() -> Self {
12948            Self::default()
12949        }
12950
12951        unsafe fn decode(
12952            &mut self,
12953            decoder: &mut fidl::encoding::Decoder<
12954                '_,
12955                fidl::encoding::DefaultFuchsiaResourceDialect,
12956            >,
12957            offset: usize,
12958            mut depth: fidl::encoding::Depth,
12959        ) -> fidl::Result<()> {
12960            decoder.debug_check_bounds::<Self>(offset);
12961            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12962                None => return Err(fidl::Error::NotNullable),
12963                Some(len) => len,
12964            };
12965            // Calling decoder.out_of_line_offset(0) is not allowed.
12966            if len == 0 {
12967                return Ok(());
12968            };
12969            depth.increment()?;
12970            let envelope_size = 8;
12971            let bytes_len = len * envelope_size;
12972            let offset = decoder.out_of_line_offset(bytes_len)?;
12973            // Decode the envelope for each type.
12974            let mut _next_ordinal_to_read = 0;
12975            let mut next_offset = offset;
12976            let end_offset = offset + bytes_len;
12977            _next_ordinal_to_read += 1;
12978            if next_offset >= end_offset {
12979                return Ok(());
12980            }
12981
12982            // Decode unknown envelopes for gaps in ordinals.
12983            while _next_ordinal_to_read < 1 {
12984                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12985                _next_ordinal_to_read += 1;
12986                next_offset += envelope_size;
12987            }
12988
12989            let next_out_of_line = decoder.next_out_of_line();
12990            let handles_before = decoder.remaining_handles();
12991            if let Some((inlined, num_bytes, num_handles)) =
12992                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12993            {
12994                let member_inline_size =
12995                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
12996                if inlined != (member_inline_size <= 4) {
12997                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12998                }
12999                let inner_offset;
13000                let mut inner_depth = depth.clone();
13001                if inlined {
13002                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13003                    inner_offset = next_offset;
13004                } else {
13005                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13006                    inner_depth.increment()?;
13007                }
13008                let val_ref = self.enable.get_or_insert_with(|| {
13009                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
13010                });
13011                fidl::decode!(
13012                    bool,
13013                    fidl::encoding::DefaultFuchsiaResourceDialect,
13014                    val_ref,
13015                    decoder,
13016                    inner_offset,
13017                    inner_depth
13018                )?;
13019                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13020                {
13021                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13022                }
13023                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13024                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13025                }
13026            }
13027
13028            next_offset += envelope_size;
13029
13030            // Decode the remaining unknown envelopes.
13031            while next_offset < end_offset {
13032                _next_ordinal_to_read += 1;
13033                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13034                next_offset += envelope_size;
13035            }
13036
13037            Ok(())
13038        }
13039    }
13040
13041    impl WifiChipCreateStaIfaceRequest {
13042        #[inline(always)]
13043        fn max_ordinal_present(&self) -> u64 {
13044            if let Some(_) = self.iface {
13045                return 1;
13046            }
13047            0
13048        }
13049    }
13050
13051    impl fidl::encoding::ResourceTypeMarker for WifiChipCreateStaIfaceRequest {
13052        type Borrowed<'a> = &'a mut Self;
13053        fn take_or_borrow<'a>(
13054            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13055        ) -> Self::Borrowed<'a> {
13056            value
13057        }
13058    }
13059
13060    unsafe impl fidl::encoding::TypeMarker for WifiChipCreateStaIfaceRequest {
13061        type Owned = Self;
13062
13063        #[inline(always)]
13064        fn inline_align(_context: fidl::encoding::Context) -> usize {
13065            8
13066        }
13067
13068        #[inline(always)]
13069        fn inline_size(_context: fidl::encoding::Context) -> usize {
13070            16
13071        }
13072    }
13073
13074    unsafe impl
13075        fidl::encoding::Encode<
13076            WifiChipCreateStaIfaceRequest,
13077            fidl::encoding::DefaultFuchsiaResourceDialect,
13078        > for &mut WifiChipCreateStaIfaceRequest
13079    {
13080        unsafe fn encode(
13081            self,
13082            encoder: &mut fidl::encoding::Encoder<
13083                '_,
13084                fidl::encoding::DefaultFuchsiaResourceDialect,
13085            >,
13086            offset: usize,
13087            mut depth: fidl::encoding::Depth,
13088        ) -> fidl::Result<()> {
13089            encoder.debug_check_bounds::<WifiChipCreateStaIfaceRequest>(offset);
13090            // Vector header
13091            let max_ordinal: u64 = self.max_ordinal_present();
13092            encoder.write_num(max_ordinal, offset);
13093            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13094            // Calling encoder.out_of_line_offset(0) is not allowed.
13095            if max_ordinal == 0 {
13096                return Ok(());
13097            }
13098            depth.increment()?;
13099            let envelope_size = 8;
13100            let bytes_len = max_ordinal as usize * envelope_size;
13101            #[allow(unused_variables)]
13102            let offset = encoder.out_of_line_offset(bytes_len);
13103            let mut _prev_end_offset: usize = 0;
13104            if 1 > max_ordinal {
13105                return Ok(());
13106            }
13107
13108            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13109            // are envelope_size bytes.
13110            let cur_offset: usize = (1 - 1) * envelope_size;
13111
13112            // Zero reserved fields.
13113            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13114
13115            // Safety:
13116            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13117            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13118            //   envelope_size bytes, there is always sufficient room.
13119            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiStaIfaceMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
13120            self.iface.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiStaIfaceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
13121            encoder, offset + cur_offset, depth
13122        )?;
13123
13124            _prev_end_offset = cur_offset + envelope_size;
13125
13126            Ok(())
13127        }
13128    }
13129
13130    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13131        for WifiChipCreateStaIfaceRequest
13132    {
13133        #[inline(always)]
13134        fn new_empty() -> Self {
13135            Self::default()
13136        }
13137
13138        unsafe fn decode(
13139            &mut self,
13140            decoder: &mut fidl::encoding::Decoder<
13141                '_,
13142                fidl::encoding::DefaultFuchsiaResourceDialect,
13143            >,
13144            offset: usize,
13145            mut depth: fidl::encoding::Depth,
13146        ) -> fidl::Result<()> {
13147            decoder.debug_check_bounds::<Self>(offset);
13148            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13149                None => return Err(fidl::Error::NotNullable),
13150                Some(len) => len,
13151            };
13152            // Calling decoder.out_of_line_offset(0) is not allowed.
13153            if len == 0 {
13154                return Ok(());
13155            };
13156            depth.increment()?;
13157            let envelope_size = 8;
13158            let bytes_len = len * envelope_size;
13159            let offset = decoder.out_of_line_offset(bytes_len)?;
13160            // Decode the envelope for each type.
13161            let mut _next_ordinal_to_read = 0;
13162            let mut next_offset = offset;
13163            let end_offset = offset + bytes_len;
13164            _next_ordinal_to_read += 1;
13165            if next_offset >= end_offset {
13166                return Ok(());
13167            }
13168
13169            // Decode unknown envelopes for gaps in ordinals.
13170            while _next_ordinal_to_read < 1 {
13171                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13172                _next_ordinal_to_read += 1;
13173                next_offset += envelope_size;
13174            }
13175
13176            let next_out_of_line = decoder.next_out_of_line();
13177            let handles_before = decoder.remaining_handles();
13178            if let Some((inlined, num_bytes, num_handles)) =
13179                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13180            {
13181                let member_inline_size = <fidl::encoding::Endpoint<
13182                    fidl::endpoints::ServerEnd<WifiStaIfaceMarker>,
13183                > as fidl::encoding::TypeMarker>::inline_size(
13184                    decoder.context
13185                );
13186                if inlined != (member_inline_size <= 4) {
13187                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13188                }
13189                let inner_offset;
13190                let mut inner_depth = depth.clone();
13191                if inlined {
13192                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13193                    inner_offset = next_offset;
13194                } else {
13195                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13196                    inner_depth.increment()?;
13197                }
13198                let val_ref = self.iface.get_or_insert_with(|| {
13199                    fidl::new_empty!(
13200                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiStaIfaceMarker>>,
13201                        fidl::encoding::DefaultFuchsiaResourceDialect
13202                    )
13203                });
13204                fidl::decode!(
13205                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiStaIfaceMarker>>,
13206                    fidl::encoding::DefaultFuchsiaResourceDialect,
13207                    val_ref,
13208                    decoder,
13209                    inner_offset,
13210                    inner_depth
13211                )?;
13212                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13213                {
13214                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13215                }
13216                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13217                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13218                }
13219            }
13220
13221            next_offset += envelope_size;
13222
13223            // Decode the remaining unknown envelopes.
13224            while next_offset < end_offset {
13225                _next_ordinal_to_read += 1;
13226                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13227                next_offset += envelope_size;
13228            }
13229
13230            Ok(())
13231        }
13232    }
13233
13234    impl WifiChipGetStaIfaceRequest {
13235        #[inline(always)]
13236        fn max_ordinal_present(&self) -> u64 {
13237            if let Some(_) = self.iface {
13238                return 2;
13239            }
13240            if let Some(_) = self.iface_name {
13241                return 1;
13242            }
13243            0
13244        }
13245    }
13246
13247    impl fidl::encoding::ResourceTypeMarker for WifiChipGetStaIfaceRequest {
13248        type Borrowed<'a> = &'a mut Self;
13249        fn take_or_borrow<'a>(
13250            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13251        ) -> Self::Borrowed<'a> {
13252            value
13253        }
13254    }
13255
13256    unsafe impl fidl::encoding::TypeMarker for WifiChipGetStaIfaceRequest {
13257        type Owned = Self;
13258
13259        #[inline(always)]
13260        fn inline_align(_context: fidl::encoding::Context) -> usize {
13261            8
13262        }
13263
13264        #[inline(always)]
13265        fn inline_size(_context: fidl::encoding::Context) -> usize {
13266            16
13267        }
13268    }
13269
13270    unsafe impl
13271        fidl::encoding::Encode<
13272            WifiChipGetStaIfaceRequest,
13273            fidl::encoding::DefaultFuchsiaResourceDialect,
13274        > for &mut WifiChipGetStaIfaceRequest
13275    {
13276        unsafe fn encode(
13277            self,
13278            encoder: &mut fidl::encoding::Encoder<
13279                '_,
13280                fidl::encoding::DefaultFuchsiaResourceDialect,
13281            >,
13282            offset: usize,
13283            mut depth: fidl::encoding::Depth,
13284        ) -> fidl::Result<()> {
13285            encoder.debug_check_bounds::<WifiChipGetStaIfaceRequest>(offset);
13286            // Vector header
13287            let max_ordinal: u64 = self.max_ordinal_present();
13288            encoder.write_num(max_ordinal, offset);
13289            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13290            // Calling encoder.out_of_line_offset(0) is not allowed.
13291            if max_ordinal == 0 {
13292                return Ok(());
13293            }
13294            depth.increment()?;
13295            let envelope_size = 8;
13296            let bytes_len = max_ordinal as usize * envelope_size;
13297            #[allow(unused_variables)]
13298            let offset = encoder.out_of_line_offset(bytes_len);
13299            let mut _prev_end_offset: usize = 0;
13300            if 1 > max_ordinal {
13301                return Ok(());
13302            }
13303
13304            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13305            // are envelope_size bytes.
13306            let cur_offset: usize = (1 - 1) * envelope_size;
13307
13308            // Zero reserved fields.
13309            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13310
13311            // Safety:
13312            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13313            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13314            //   envelope_size bytes, there is always sufficient room.
13315            fidl::encoding::encode_in_envelope_optional::<
13316                fidl::encoding::BoundedString<16>,
13317                fidl::encoding::DefaultFuchsiaResourceDialect,
13318            >(
13319                self.iface_name.as_ref().map(
13320                    <fidl::encoding::BoundedString<16> as fidl::encoding::ValueTypeMarker>::borrow,
13321                ),
13322                encoder,
13323                offset + cur_offset,
13324                depth,
13325            )?;
13326
13327            _prev_end_offset = cur_offset + envelope_size;
13328            if 2 > max_ordinal {
13329                return Ok(());
13330            }
13331
13332            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13333            // are envelope_size bytes.
13334            let cur_offset: usize = (2 - 1) * envelope_size;
13335
13336            // Zero reserved fields.
13337            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13338
13339            // Safety:
13340            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13341            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13342            //   envelope_size bytes, there is always sufficient room.
13343            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiStaIfaceMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
13344            self.iface.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiStaIfaceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
13345            encoder, offset + cur_offset, depth
13346        )?;
13347
13348            _prev_end_offset = cur_offset + envelope_size;
13349
13350            Ok(())
13351        }
13352    }
13353
13354    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13355        for WifiChipGetStaIfaceRequest
13356    {
13357        #[inline(always)]
13358        fn new_empty() -> Self {
13359            Self::default()
13360        }
13361
13362        unsafe fn decode(
13363            &mut self,
13364            decoder: &mut fidl::encoding::Decoder<
13365                '_,
13366                fidl::encoding::DefaultFuchsiaResourceDialect,
13367            >,
13368            offset: usize,
13369            mut depth: fidl::encoding::Depth,
13370        ) -> fidl::Result<()> {
13371            decoder.debug_check_bounds::<Self>(offset);
13372            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13373                None => return Err(fidl::Error::NotNullable),
13374                Some(len) => len,
13375            };
13376            // Calling decoder.out_of_line_offset(0) is not allowed.
13377            if len == 0 {
13378                return Ok(());
13379            };
13380            depth.increment()?;
13381            let envelope_size = 8;
13382            let bytes_len = len * envelope_size;
13383            let offset = decoder.out_of_line_offset(bytes_len)?;
13384            // Decode the envelope for each type.
13385            let mut _next_ordinal_to_read = 0;
13386            let mut next_offset = offset;
13387            let end_offset = offset + bytes_len;
13388            _next_ordinal_to_read += 1;
13389            if next_offset >= end_offset {
13390                return Ok(());
13391            }
13392
13393            // Decode unknown envelopes for gaps in ordinals.
13394            while _next_ordinal_to_read < 1 {
13395                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13396                _next_ordinal_to_read += 1;
13397                next_offset += envelope_size;
13398            }
13399
13400            let next_out_of_line = decoder.next_out_of_line();
13401            let handles_before = decoder.remaining_handles();
13402            if let Some((inlined, num_bytes, num_handles)) =
13403                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13404            {
13405                let member_inline_size =
13406                    <fidl::encoding::BoundedString<16> as fidl::encoding::TypeMarker>::inline_size(
13407                        decoder.context,
13408                    );
13409                if inlined != (member_inline_size <= 4) {
13410                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13411                }
13412                let inner_offset;
13413                let mut inner_depth = depth.clone();
13414                if inlined {
13415                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13416                    inner_offset = next_offset;
13417                } else {
13418                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13419                    inner_depth.increment()?;
13420                }
13421                let val_ref = self.iface_name.get_or_insert_with(|| {
13422                    fidl::new_empty!(
13423                        fidl::encoding::BoundedString<16>,
13424                        fidl::encoding::DefaultFuchsiaResourceDialect
13425                    )
13426                });
13427                fidl::decode!(
13428                    fidl::encoding::BoundedString<16>,
13429                    fidl::encoding::DefaultFuchsiaResourceDialect,
13430                    val_ref,
13431                    decoder,
13432                    inner_offset,
13433                    inner_depth
13434                )?;
13435                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13436                {
13437                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13438                }
13439                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13440                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13441                }
13442            }
13443
13444            next_offset += envelope_size;
13445            _next_ordinal_to_read += 1;
13446            if next_offset >= end_offset {
13447                return Ok(());
13448            }
13449
13450            // Decode unknown envelopes for gaps in ordinals.
13451            while _next_ordinal_to_read < 2 {
13452                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13453                _next_ordinal_to_read += 1;
13454                next_offset += envelope_size;
13455            }
13456
13457            let next_out_of_line = decoder.next_out_of_line();
13458            let handles_before = decoder.remaining_handles();
13459            if let Some((inlined, num_bytes, num_handles)) =
13460                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13461            {
13462                let member_inline_size = <fidl::encoding::Endpoint<
13463                    fidl::endpoints::ServerEnd<WifiStaIfaceMarker>,
13464                > as fidl::encoding::TypeMarker>::inline_size(
13465                    decoder.context
13466                );
13467                if inlined != (member_inline_size <= 4) {
13468                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13469                }
13470                let inner_offset;
13471                let mut inner_depth = depth.clone();
13472                if inlined {
13473                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13474                    inner_offset = next_offset;
13475                } else {
13476                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13477                    inner_depth.increment()?;
13478                }
13479                let val_ref = self.iface.get_or_insert_with(|| {
13480                    fidl::new_empty!(
13481                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiStaIfaceMarker>>,
13482                        fidl::encoding::DefaultFuchsiaResourceDialect
13483                    )
13484                });
13485                fidl::decode!(
13486                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiStaIfaceMarker>>,
13487                    fidl::encoding::DefaultFuchsiaResourceDialect,
13488                    val_ref,
13489                    decoder,
13490                    inner_offset,
13491                    inner_depth
13492                )?;
13493                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13494                {
13495                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13496                }
13497                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13498                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13499                }
13500            }
13501
13502            next_offset += envelope_size;
13503
13504            // Decode the remaining unknown envelopes.
13505            while next_offset < end_offset {
13506                _next_ordinal_to_read += 1;
13507                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13508                next_offset += envelope_size;
13509            }
13510
13511            Ok(())
13512        }
13513    }
13514
13515    impl WifiChipRemoveStaIfaceRequest {
13516        #[inline(always)]
13517        fn max_ordinal_present(&self) -> u64 {
13518            if let Some(_) = self.iface_name {
13519                return 1;
13520            }
13521            0
13522        }
13523    }
13524
13525    impl fidl::encoding::ResourceTypeMarker for WifiChipRemoveStaIfaceRequest {
13526        type Borrowed<'a> = &'a mut Self;
13527        fn take_or_borrow<'a>(
13528            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13529        ) -> Self::Borrowed<'a> {
13530            value
13531        }
13532    }
13533
13534    unsafe impl fidl::encoding::TypeMarker for WifiChipRemoveStaIfaceRequest {
13535        type Owned = Self;
13536
13537        #[inline(always)]
13538        fn inline_align(_context: fidl::encoding::Context) -> usize {
13539            8
13540        }
13541
13542        #[inline(always)]
13543        fn inline_size(_context: fidl::encoding::Context) -> usize {
13544            16
13545        }
13546    }
13547
13548    unsafe impl
13549        fidl::encoding::Encode<
13550            WifiChipRemoveStaIfaceRequest,
13551            fidl::encoding::DefaultFuchsiaResourceDialect,
13552        > for &mut WifiChipRemoveStaIfaceRequest
13553    {
13554        unsafe fn encode(
13555            self,
13556            encoder: &mut fidl::encoding::Encoder<
13557                '_,
13558                fidl::encoding::DefaultFuchsiaResourceDialect,
13559            >,
13560            offset: usize,
13561            mut depth: fidl::encoding::Depth,
13562        ) -> fidl::Result<()> {
13563            encoder.debug_check_bounds::<WifiChipRemoveStaIfaceRequest>(offset);
13564            // Vector header
13565            let max_ordinal: u64 = self.max_ordinal_present();
13566            encoder.write_num(max_ordinal, offset);
13567            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13568            // Calling encoder.out_of_line_offset(0) is not allowed.
13569            if max_ordinal == 0 {
13570                return Ok(());
13571            }
13572            depth.increment()?;
13573            let envelope_size = 8;
13574            let bytes_len = max_ordinal as usize * envelope_size;
13575            #[allow(unused_variables)]
13576            let offset = encoder.out_of_line_offset(bytes_len);
13577            let mut _prev_end_offset: usize = 0;
13578            if 1 > max_ordinal {
13579                return Ok(());
13580            }
13581
13582            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13583            // are envelope_size bytes.
13584            let cur_offset: usize = (1 - 1) * envelope_size;
13585
13586            // Zero reserved fields.
13587            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13588
13589            // Safety:
13590            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13591            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13592            //   envelope_size bytes, there is always sufficient room.
13593            fidl::encoding::encode_in_envelope_optional::<
13594                fidl::encoding::BoundedString<16>,
13595                fidl::encoding::DefaultFuchsiaResourceDialect,
13596            >(
13597                self.iface_name.as_ref().map(
13598                    <fidl::encoding::BoundedString<16> as fidl::encoding::ValueTypeMarker>::borrow,
13599                ),
13600                encoder,
13601                offset + cur_offset,
13602                depth,
13603            )?;
13604
13605            _prev_end_offset = cur_offset + envelope_size;
13606
13607            Ok(())
13608        }
13609    }
13610
13611    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13612        for WifiChipRemoveStaIfaceRequest
13613    {
13614        #[inline(always)]
13615        fn new_empty() -> Self {
13616            Self::default()
13617        }
13618
13619        unsafe fn decode(
13620            &mut self,
13621            decoder: &mut fidl::encoding::Decoder<
13622                '_,
13623                fidl::encoding::DefaultFuchsiaResourceDialect,
13624            >,
13625            offset: usize,
13626            mut depth: fidl::encoding::Depth,
13627        ) -> fidl::Result<()> {
13628            decoder.debug_check_bounds::<Self>(offset);
13629            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13630                None => return Err(fidl::Error::NotNullable),
13631                Some(len) => len,
13632            };
13633            // Calling decoder.out_of_line_offset(0) is not allowed.
13634            if len == 0 {
13635                return Ok(());
13636            };
13637            depth.increment()?;
13638            let envelope_size = 8;
13639            let bytes_len = len * envelope_size;
13640            let offset = decoder.out_of_line_offset(bytes_len)?;
13641            // Decode the envelope for each type.
13642            let mut _next_ordinal_to_read = 0;
13643            let mut next_offset = offset;
13644            let end_offset = offset + bytes_len;
13645            _next_ordinal_to_read += 1;
13646            if next_offset >= end_offset {
13647                return Ok(());
13648            }
13649
13650            // Decode unknown envelopes for gaps in ordinals.
13651            while _next_ordinal_to_read < 1 {
13652                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13653                _next_ordinal_to_read += 1;
13654                next_offset += envelope_size;
13655            }
13656
13657            let next_out_of_line = decoder.next_out_of_line();
13658            let handles_before = decoder.remaining_handles();
13659            if let Some((inlined, num_bytes, num_handles)) =
13660                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13661            {
13662                let member_inline_size =
13663                    <fidl::encoding::BoundedString<16> as fidl::encoding::TypeMarker>::inline_size(
13664                        decoder.context,
13665                    );
13666                if inlined != (member_inline_size <= 4) {
13667                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13668                }
13669                let inner_offset;
13670                let mut inner_depth = depth.clone();
13671                if inlined {
13672                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13673                    inner_offset = next_offset;
13674                } else {
13675                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13676                    inner_depth.increment()?;
13677                }
13678                let val_ref = self.iface_name.get_or_insert_with(|| {
13679                    fidl::new_empty!(
13680                        fidl::encoding::BoundedString<16>,
13681                        fidl::encoding::DefaultFuchsiaResourceDialect
13682                    )
13683                });
13684                fidl::decode!(
13685                    fidl::encoding::BoundedString<16>,
13686                    fidl::encoding::DefaultFuchsiaResourceDialect,
13687                    val_ref,
13688                    decoder,
13689                    inner_offset,
13690                    inner_depth
13691                )?;
13692                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13693                {
13694                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13695                }
13696                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13697                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13698                }
13699            }
13700
13701            next_offset += envelope_size;
13702
13703            // Decode the remaining unknown envelopes.
13704            while next_offset < end_offset {
13705                _next_ordinal_to_read += 1;
13706                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13707                next_offset += envelope_size;
13708            }
13709
13710            Ok(())
13711        }
13712    }
13713
13714    impl WifiChipSetCountryCodeRequest {
13715        #[inline(always)]
13716        fn max_ordinal_present(&self) -> u64 {
13717            if let Some(_) = self.code {
13718                return 1;
13719            }
13720            0
13721        }
13722    }
13723
13724    impl fidl::encoding::ResourceTypeMarker for WifiChipSetCountryCodeRequest {
13725        type Borrowed<'a> = &'a mut Self;
13726        fn take_or_borrow<'a>(
13727            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13728        ) -> Self::Borrowed<'a> {
13729            value
13730        }
13731    }
13732
13733    unsafe impl fidl::encoding::TypeMarker for WifiChipSetCountryCodeRequest {
13734        type Owned = Self;
13735
13736        #[inline(always)]
13737        fn inline_align(_context: fidl::encoding::Context) -> usize {
13738            8
13739        }
13740
13741        #[inline(always)]
13742        fn inline_size(_context: fidl::encoding::Context) -> usize {
13743            16
13744        }
13745    }
13746
13747    unsafe impl
13748        fidl::encoding::Encode<
13749            WifiChipSetCountryCodeRequest,
13750            fidl::encoding::DefaultFuchsiaResourceDialect,
13751        > for &mut WifiChipSetCountryCodeRequest
13752    {
13753        unsafe fn encode(
13754            self,
13755            encoder: &mut fidl::encoding::Encoder<
13756                '_,
13757                fidl::encoding::DefaultFuchsiaResourceDialect,
13758            >,
13759            offset: usize,
13760            mut depth: fidl::encoding::Depth,
13761        ) -> fidl::Result<()> {
13762            encoder.debug_check_bounds::<WifiChipSetCountryCodeRequest>(offset);
13763            // Vector header
13764            let max_ordinal: u64 = self.max_ordinal_present();
13765            encoder.write_num(max_ordinal, offset);
13766            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13767            // Calling encoder.out_of_line_offset(0) is not allowed.
13768            if max_ordinal == 0 {
13769                return Ok(());
13770            }
13771            depth.increment()?;
13772            let envelope_size = 8;
13773            let bytes_len = max_ordinal as usize * envelope_size;
13774            #[allow(unused_variables)]
13775            let offset = encoder.out_of_line_offset(bytes_len);
13776            let mut _prev_end_offset: usize = 0;
13777            if 1 > max_ordinal {
13778                return Ok(());
13779            }
13780
13781            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13782            // are envelope_size bytes.
13783            let cur_offset: usize = (1 - 1) * envelope_size;
13784
13785            // Zero reserved fields.
13786            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13787
13788            // Safety:
13789            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13790            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13791            //   envelope_size bytes, there is always sufficient room.
13792            fidl::encoding::encode_in_envelope_optional::<
13793                fidl::encoding::Array<u8, 2>,
13794                fidl::encoding::DefaultFuchsiaResourceDialect,
13795            >(
13796                self.code
13797                    .as_ref()
13798                    .map(<fidl::encoding::Array<u8, 2> as fidl::encoding::ValueTypeMarker>::borrow),
13799                encoder,
13800                offset + cur_offset,
13801                depth,
13802            )?;
13803
13804            _prev_end_offset = cur_offset + envelope_size;
13805
13806            Ok(())
13807        }
13808    }
13809
13810    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
13811        for WifiChipSetCountryCodeRequest
13812    {
13813        #[inline(always)]
13814        fn new_empty() -> Self {
13815            Self::default()
13816        }
13817
13818        unsafe fn decode(
13819            &mut self,
13820            decoder: &mut fidl::encoding::Decoder<
13821                '_,
13822                fidl::encoding::DefaultFuchsiaResourceDialect,
13823            >,
13824            offset: usize,
13825            mut depth: fidl::encoding::Depth,
13826        ) -> fidl::Result<()> {
13827            decoder.debug_check_bounds::<Self>(offset);
13828            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
13829                None => return Err(fidl::Error::NotNullable),
13830                Some(len) => len,
13831            };
13832            // Calling decoder.out_of_line_offset(0) is not allowed.
13833            if len == 0 {
13834                return Ok(());
13835            };
13836            depth.increment()?;
13837            let envelope_size = 8;
13838            let bytes_len = len * envelope_size;
13839            let offset = decoder.out_of_line_offset(bytes_len)?;
13840            // Decode the envelope for each type.
13841            let mut _next_ordinal_to_read = 0;
13842            let mut next_offset = offset;
13843            let end_offset = offset + bytes_len;
13844            _next_ordinal_to_read += 1;
13845            if next_offset >= end_offset {
13846                return Ok(());
13847            }
13848
13849            // Decode unknown envelopes for gaps in ordinals.
13850            while _next_ordinal_to_read < 1 {
13851                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13852                _next_ordinal_to_read += 1;
13853                next_offset += envelope_size;
13854            }
13855
13856            let next_out_of_line = decoder.next_out_of_line();
13857            let handles_before = decoder.remaining_handles();
13858            if let Some((inlined, num_bytes, num_handles)) =
13859                fidl::encoding::decode_envelope_header(decoder, next_offset)?
13860            {
13861                let member_inline_size =
13862                    <fidl::encoding::Array<u8, 2> as fidl::encoding::TypeMarker>::inline_size(
13863                        decoder.context,
13864                    );
13865                if inlined != (member_inline_size <= 4) {
13866                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
13867                }
13868                let inner_offset;
13869                let mut inner_depth = depth.clone();
13870                if inlined {
13871                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
13872                    inner_offset = next_offset;
13873                } else {
13874                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
13875                    inner_depth.increment()?;
13876                }
13877                let val_ref =
13878                self.code.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 2>, fidl::encoding::DefaultFuchsiaResourceDialect));
13879                fidl::decode!(fidl::encoding::Array<u8, 2>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
13880                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
13881                {
13882                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
13883                }
13884                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
13885                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
13886                }
13887            }
13888
13889            next_offset += envelope_size;
13890
13891            // Decode the remaining unknown envelopes.
13892            while next_offset < end_offset {
13893                _next_ordinal_to_read += 1;
13894                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
13895                next_offset += envelope_size;
13896            }
13897
13898            Ok(())
13899        }
13900    }
13901
13902    impl WifiGetChipRequest {
13903        #[inline(always)]
13904        fn max_ordinal_present(&self) -> u64 {
13905            if let Some(_) = self.chip {
13906                return 2;
13907            }
13908            if let Some(_) = self.chip_id {
13909                return 1;
13910            }
13911            0
13912        }
13913    }
13914
13915    impl fidl::encoding::ResourceTypeMarker for WifiGetChipRequest {
13916        type Borrowed<'a> = &'a mut Self;
13917        fn take_or_borrow<'a>(
13918            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
13919        ) -> Self::Borrowed<'a> {
13920            value
13921        }
13922    }
13923
13924    unsafe impl fidl::encoding::TypeMarker for WifiGetChipRequest {
13925        type Owned = Self;
13926
13927        #[inline(always)]
13928        fn inline_align(_context: fidl::encoding::Context) -> usize {
13929            8
13930        }
13931
13932        #[inline(always)]
13933        fn inline_size(_context: fidl::encoding::Context) -> usize {
13934            16
13935        }
13936    }
13937
13938    unsafe impl
13939        fidl::encoding::Encode<WifiGetChipRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
13940        for &mut WifiGetChipRequest
13941    {
13942        unsafe fn encode(
13943            self,
13944            encoder: &mut fidl::encoding::Encoder<
13945                '_,
13946                fidl::encoding::DefaultFuchsiaResourceDialect,
13947            >,
13948            offset: usize,
13949            mut depth: fidl::encoding::Depth,
13950        ) -> fidl::Result<()> {
13951            encoder.debug_check_bounds::<WifiGetChipRequest>(offset);
13952            // Vector header
13953            let max_ordinal: u64 = self.max_ordinal_present();
13954            encoder.write_num(max_ordinal, offset);
13955            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
13956            // Calling encoder.out_of_line_offset(0) is not allowed.
13957            if max_ordinal == 0 {
13958                return Ok(());
13959            }
13960            depth.increment()?;
13961            let envelope_size = 8;
13962            let bytes_len = max_ordinal as usize * envelope_size;
13963            #[allow(unused_variables)]
13964            let offset = encoder.out_of_line_offset(bytes_len);
13965            let mut _prev_end_offset: usize = 0;
13966            if 1 > max_ordinal {
13967                return Ok(());
13968            }
13969
13970            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13971            // are envelope_size bytes.
13972            let cur_offset: usize = (1 - 1) * envelope_size;
13973
13974            // Zero reserved fields.
13975            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
13976
13977            // Safety:
13978            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
13979            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
13980            //   envelope_size bytes, there is always sufficient room.
13981            fidl::encoding::encode_in_envelope_optional::<
13982                u32,
13983                fidl::encoding::DefaultFuchsiaResourceDialect,
13984            >(
13985                self.chip_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
13986                encoder,
13987                offset + cur_offset,
13988                depth,
13989            )?;
13990
13991            _prev_end_offset = cur_offset + envelope_size;
13992            if 2 > max_ordinal {
13993                return Ok(());
13994            }
13995
13996            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
13997            // are envelope_size bytes.
13998            let cur_offset: usize = (2 - 1) * envelope_size;
13999
14000            // Zero reserved fields.
14001            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14002
14003            // Safety:
14004            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14005            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14006            //   envelope_size bytes, there is always sufficient room.
14007            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiChipMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
14008            self.chip.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiChipMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
14009            encoder, offset + cur_offset, depth
14010        )?;
14011
14012            _prev_end_offset = cur_offset + envelope_size;
14013
14014            Ok(())
14015        }
14016    }
14017
14018    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14019        for WifiGetChipRequest
14020    {
14021        #[inline(always)]
14022        fn new_empty() -> Self {
14023            Self::default()
14024        }
14025
14026        unsafe fn decode(
14027            &mut self,
14028            decoder: &mut fidl::encoding::Decoder<
14029                '_,
14030                fidl::encoding::DefaultFuchsiaResourceDialect,
14031            >,
14032            offset: usize,
14033            mut depth: fidl::encoding::Depth,
14034        ) -> fidl::Result<()> {
14035            decoder.debug_check_bounds::<Self>(offset);
14036            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14037                None => return Err(fidl::Error::NotNullable),
14038                Some(len) => len,
14039            };
14040            // Calling decoder.out_of_line_offset(0) is not allowed.
14041            if len == 0 {
14042                return Ok(());
14043            };
14044            depth.increment()?;
14045            let envelope_size = 8;
14046            let bytes_len = len * envelope_size;
14047            let offset = decoder.out_of_line_offset(bytes_len)?;
14048            // Decode the envelope for each type.
14049            let mut _next_ordinal_to_read = 0;
14050            let mut next_offset = offset;
14051            let end_offset = offset + bytes_len;
14052            _next_ordinal_to_read += 1;
14053            if next_offset >= end_offset {
14054                return Ok(());
14055            }
14056
14057            // Decode unknown envelopes for gaps in ordinals.
14058            while _next_ordinal_to_read < 1 {
14059                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14060                _next_ordinal_to_read += 1;
14061                next_offset += envelope_size;
14062            }
14063
14064            let next_out_of_line = decoder.next_out_of_line();
14065            let handles_before = decoder.remaining_handles();
14066            if let Some((inlined, num_bytes, num_handles)) =
14067                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14068            {
14069                let member_inline_size =
14070                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14071                if inlined != (member_inline_size <= 4) {
14072                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14073                }
14074                let inner_offset;
14075                let mut inner_depth = depth.clone();
14076                if inlined {
14077                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14078                    inner_offset = next_offset;
14079                } else {
14080                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14081                    inner_depth.increment()?;
14082                }
14083                let val_ref = self.chip_id.get_or_insert_with(|| {
14084                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
14085                });
14086                fidl::decode!(
14087                    u32,
14088                    fidl::encoding::DefaultFuchsiaResourceDialect,
14089                    val_ref,
14090                    decoder,
14091                    inner_offset,
14092                    inner_depth
14093                )?;
14094                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14095                {
14096                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14097                }
14098                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14099                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14100                }
14101            }
14102
14103            next_offset += envelope_size;
14104            _next_ordinal_to_read += 1;
14105            if next_offset >= end_offset {
14106                return Ok(());
14107            }
14108
14109            // Decode unknown envelopes for gaps in ordinals.
14110            while _next_ordinal_to_read < 2 {
14111                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14112                _next_ordinal_to_read += 1;
14113                next_offset += envelope_size;
14114            }
14115
14116            let next_out_of_line = decoder.next_out_of_line();
14117            let handles_before = decoder.remaining_handles();
14118            if let Some((inlined, num_bytes, num_handles)) =
14119                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14120            {
14121                let member_inline_size = <fidl::encoding::Endpoint<
14122                    fidl::endpoints::ServerEnd<WifiChipMarker>,
14123                > as fidl::encoding::TypeMarker>::inline_size(
14124                    decoder.context
14125                );
14126                if inlined != (member_inline_size <= 4) {
14127                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14128                }
14129                let inner_offset;
14130                let mut inner_depth = depth.clone();
14131                if inlined {
14132                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14133                    inner_offset = next_offset;
14134                } else {
14135                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14136                    inner_depth.increment()?;
14137                }
14138                let val_ref = self.chip.get_or_insert_with(|| {
14139                    fidl::new_empty!(
14140                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiChipMarker>>,
14141                        fidl::encoding::DefaultFuchsiaResourceDialect
14142                    )
14143                });
14144                fidl::decode!(
14145                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiChipMarker>>,
14146                    fidl::encoding::DefaultFuchsiaResourceDialect,
14147                    val_ref,
14148                    decoder,
14149                    inner_offset,
14150                    inner_depth
14151                )?;
14152                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14153                {
14154                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14155                }
14156                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14157                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14158                }
14159            }
14160
14161            next_offset += envelope_size;
14162
14163            // Decode the remaining unknown envelopes.
14164            while next_offset < end_offset {
14165                _next_ordinal_to_read += 1;
14166                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14167                next_offset += envelope_size;
14168            }
14169
14170            Ok(())
14171        }
14172    }
14173
14174    impl WifiLegacyHalSelectTxPowerScenarioRequest {
14175        #[inline(always)]
14176        fn max_ordinal_present(&self) -> u64 {
14177            if let Some(_) = self.scenario {
14178                return 1;
14179            }
14180            0
14181        }
14182    }
14183
14184    impl fidl::encoding::ResourceTypeMarker for WifiLegacyHalSelectTxPowerScenarioRequest {
14185        type Borrowed<'a> = &'a mut Self;
14186        fn take_or_borrow<'a>(
14187            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14188        ) -> Self::Borrowed<'a> {
14189            value
14190        }
14191    }
14192
14193    unsafe impl fidl::encoding::TypeMarker for WifiLegacyHalSelectTxPowerScenarioRequest {
14194        type Owned = Self;
14195
14196        #[inline(always)]
14197        fn inline_align(_context: fidl::encoding::Context) -> usize {
14198            8
14199        }
14200
14201        #[inline(always)]
14202        fn inline_size(_context: fidl::encoding::Context) -> usize {
14203            16
14204        }
14205    }
14206
14207    unsafe impl
14208        fidl::encoding::Encode<
14209            WifiLegacyHalSelectTxPowerScenarioRequest,
14210            fidl::encoding::DefaultFuchsiaResourceDialect,
14211        > for &mut WifiLegacyHalSelectTxPowerScenarioRequest
14212    {
14213        unsafe fn encode(
14214            self,
14215            encoder: &mut fidl::encoding::Encoder<
14216                '_,
14217                fidl::encoding::DefaultFuchsiaResourceDialect,
14218            >,
14219            offset: usize,
14220            mut depth: fidl::encoding::Depth,
14221        ) -> fidl::Result<()> {
14222            encoder.debug_check_bounds::<WifiLegacyHalSelectTxPowerScenarioRequest>(offset);
14223            // Vector header
14224            let max_ordinal: u64 = self.max_ordinal_present();
14225            encoder.write_num(max_ordinal, offset);
14226            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
14227            // Calling encoder.out_of_line_offset(0) is not allowed.
14228            if max_ordinal == 0 {
14229                return Ok(());
14230            }
14231            depth.increment()?;
14232            let envelope_size = 8;
14233            let bytes_len = max_ordinal as usize * envelope_size;
14234            #[allow(unused_variables)]
14235            let offset = encoder.out_of_line_offset(bytes_len);
14236            let mut _prev_end_offset: usize = 0;
14237            if 1 > max_ordinal {
14238                return Ok(());
14239            }
14240
14241            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14242            // are envelope_size bytes.
14243            let cur_offset: usize = (1 - 1) * envelope_size;
14244
14245            // Zero reserved fields.
14246            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14247
14248            // Safety:
14249            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14250            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14251            //   envelope_size bytes, there is always sufficient room.
14252            fidl::encoding::encode_in_envelope_optional::<
14253                WifiLegacyHalTxPowerScenario,
14254                fidl::encoding::DefaultFuchsiaResourceDialect,
14255            >(
14256                self.scenario
14257                    .as_ref()
14258                    .map(<WifiLegacyHalTxPowerScenario as fidl::encoding::ValueTypeMarker>::borrow),
14259                encoder,
14260                offset + cur_offset,
14261                depth,
14262            )?;
14263
14264            _prev_end_offset = cur_offset + envelope_size;
14265
14266            Ok(())
14267        }
14268    }
14269
14270    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14271        for WifiLegacyHalSelectTxPowerScenarioRequest
14272    {
14273        #[inline(always)]
14274        fn new_empty() -> Self {
14275            Self::default()
14276        }
14277
14278        unsafe fn decode(
14279            &mut self,
14280            decoder: &mut fidl::encoding::Decoder<
14281                '_,
14282                fidl::encoding::DefaultFuchsiaResourceDialect,
14283            >,
14284            offset: usize,
14285            mut depth: fidl::encoding::Depth,
14286        ) -> fidl::Result<()> {
14287            decoder.debug_check_bounds::<Self>(offset);
14288            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14289                None => return Err(fidl::Error::NotNullable),
14290                Some(len) => len,
14291            };
14292            // Calling decoder.out_of_line_offset(0) is not allowed.
14293            if len == 0 {
14294                return Ok(());
14295            };
14296            depth.increment()?;
14297            let envelope_size = 8;
14298            let bytes_len = len * envelope_size;
14299            let offset = decoder.out_of_line_offset(bytes_len)?;
14300            // Decode the envelope for each type.
14301            let mut _next_ordinal_to_read = 0;
14302            let mut next_offset = offset;
14303            let end_offset = offset + bytes_len;
14304            _next_ordinal_to_read += 1;
14305            if next_offset >= end_offset {
14306                return Ok(());
14307            }
14308
14309            // Decode unknown envelopes for gaps in ordinals.
14310            while _next_ordinal_to_read < 1 {
14311                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14312                _next_ordinal_to_read += 1;
14313                next_offset += envelope_size;
14314            }
14315
14316            let next_out_of_line = decoder.next_out_of_line();
14317            let handles_before = decoder.remaining_handles();
14318            if let Some((inlined, num_bytes, num_handles)) =
14319                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14320            {
14321                let member_inline_size =
14322                    <WifiLegacyHalTxPowerScenario as fidl::encoding::TypeMarker>::inline_size(
14323                        decoder.context,
14324                    );
14325                if inlined != (member_inline_size <= 4) {
14326                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14327                }
14328                let inner_offset;
14329                let mut inner_depth = depth.clone();
14330                if inlined {
14331                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14332                    inner_offset = next_offset;
14333                } else {
14334                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14335                    inner_depth.increment()?;
14336                }
14337                let val_ref = self.scenario.get_or_insert_with(|| {
14338                    fidl::new_empty!(
14339                        WifiLegacyHalTxPowerScenario,
14340                        fidl::encoding::DefaultFuchsiaResourceDialect
14341                    )
14342                });
14343                fidl::decode!(
14344                    WifiLegacyHalTxPowerScenario,
14345                    fidl::encoding::DefaultFuchsiaResourceDialect,
14346                    val_ref,
14347                    decoder,
14348                    inner_offset,
14349                    inner_depth
14350                )?;
14351                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14352                {
14353                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14354                }
14355                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14356                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14357                }
14358            }
14359
14360            next_offset += envelope_size;
14361
14362            // Decode the remaining unknown envelopes.
14363            while next_offset < end_offset {
14364                _next_ordinal_to_read += 1;
14365                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14366                next_offset += envelope_size;
14367            }
14368
14369            Ok(())
14370        }
14371    }
14372
14373    impl WifiRegisterEventCallbackRequest {
14374        #[inline(always)]
14375        fn max_ordinal_present(&self) -> u64 {
14376            if let Some(_) = self.callback {
14377                return 1;
14378            }
14379            0
14380        }
14381    }
14382
14383    impl fidl::encoding::ResourceTypeMarker for WifiRegisterEventCallbackRequest {
14384        type Borrowed<'a> = &'a mut Self;
14385        fn take_or_borrow<'a>(
14386            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14387        ) -> Self::Borrowed<'a> {
14388            value
14389        }
14390    }
14391
14392    unsafe impl fidl::encoding::TypeMarker for WifiRegisterEventCallbackRequest {
14393        type Owned = Self;
14394
14395        #[inline(always)]
14396        fn inline_align(_context: fidl::encoding::Context) -> usize {
14397            8
14398        }
14399
14400        #[inline(always)]
14401        fn inline_size(_context: fidl::encoding::Context) -> usize {
14402            16
14403        }
14404    }
14405
14406    unsafe impl
14407        fidl::encoding::Encode<
14408            WifiRegisterEventCallbackRequest,
14409            fidl::encoding::DefaultFuchsiaResourceDialect,
14410        > for &mut WifiRegisterEventCallbackRequest
14411    {
14412        unsafe fn encode(
14413            self,
14414            encoder: &mut fidl::encoding::Encoder<
14415                '_,
14416                fidl::encoding::DefaultFuchsiaResourceDialect,
14417            >,
14418            offset: usize,
14419            mut depth: fidl::encoding::Depth,
14420        ) -> fidl::Result<()> {
14421            encoder.debug_check_bounds::<WifiRegisterEventCallbackRequest>(offset);
14422            // Vector header
14423            let max_ordinal: u64 = self.max_ordinal_present();
14424            encoder.write_num(max_ordinal, offset);
14425            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
14426            // Calling encoder.out_of_line_offset(0) is not allowed.
14427            if max_ordinal == 0 {
14428                return Ok(());
14429            }
14430            depth.increment()?;
14431            let envelope_size = 8;
14432            let bytes_len = max_ordinal as usize * envelope_size;
14433            #[allow(unused_variables)]
14434            let offset = encoder.out_of_line_offset(bytes_len);
14435            let mut _prev_end_offset: usize = 0;
14436            if 1 > max_ordinal {
14437                return Ok(());
14438            }
14439
14440            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14441            // are envelope_size bytes.
14442            let cur_offset: usize = (1 - 1) * envelope_size;
14443
14444            // Zero reserved fields.
14445            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14446
14447            // Safety:
14448            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14449            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14450            //   envelope_size bytes, there is always sufficient room.
14451            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<WifiEventCallbackMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
14452            self.callback.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<WifiEventCallbackMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
14453            encoder, offset + cur_offset, depth
14454        )?;
14455
14456            _prev_end_offset = cur_offset + envelope_size;
14457
14458            Ok(())
14459        }
14460    }
14461
14462    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14463        for WifiRegisterEventCallbackRequest
14464    {
14465        #[inline(always)]
14466        fn new_empty() -> Self {
14467            Self::default()
14468        }
14469
14470        unsafe fn decode(
14471            &mut self,
14472            decoder: &mut fidl::encoding::Decoder<
14473                '_,
14474                fidl::encoding::DefaultFuchsiaResourceDialect,
14475            >,
14476            offset: usize,
14477            mut depth: fidl::encoding::Depth,
14478        ) -> fidl::Result<()> {
14479            decoder.debug_check_bounds::<Self>(offset);
14480            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14481                None => return Err(fidl::Error::NotNullable),
14482                Some(len) => len,
14483            };
14484            // Calling decoder.out_of_line_offset(0) is not allowed.
14485            if len == 0 {
14486                return Ok(());
14487            };
14488            depth.increment()?;
14489            let envelope_size = 8;
14490            let bytes_len = len * envelope_size;
14491            let offset = decoder.out_of_line_offset(bytes_len)?;
14492            // Decode the envelope for each type.
14493            let mut _next_ordinal_to_read = 0;
14494            let mut next_offset = offset;
14495            let end_offset = offset + bytes_len;
14496            _next_ordinal_to_read += 1;
14497            if next_offset >= end_offset {
14498                return Ok(());
14499            }
14500
14501            // Decode unknown envelopes for gaps in ordinals.
14502            while _next_ordinal_to_read < 1 {
14503                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14504                _next_ordinal_to_read += 1;
14505                next_offset += envelope_size;
14506            }
14507
14508            let next_out_of_line = decoder.next_out_of_line();
14509            let handles_before = decoder.remaining_handles();
14510            if let Some((inlined, num_bytes, num_handles)) =
14511                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14512            {
14513                let member_inline_size = <fidl::encoding::Endpoint<
14514                    fidl::endpoints::ClientEnd<WifiEventCallbackMarker>,
14515                > as fidl::encoding::TypeMarker>::inline_size(
14516                    decoder.context
14517                );
14518                if inlined != (member_inline_size <= 4) {
14519                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14520                }
14521                let inner_offset;
14522                let mut inner_depth = depth.clone();
14523                if inlined {
14524                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14525                    inner_offset = next_offset;
14526                } else {
14527                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14528                    inner_depth.increment()?;
14529                }
14530                let val_ref = self.callback.get_or_insert_with(|| {
14531                    fidl::new_empty!(
14532                        fidl::encoding::Endpoint<
14533                            fidl::endpoints::ClientEnd<WifiEventCallbackMarker>,
14534                        >,
14535                        fidl::encoding::DefaultFuchsiaResourceDialect
14536                    )
14537                });
14538                fidl::decode!(
14539                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<WifiEventCallbackMarker>>,
14540                    fidl::encoding::DefaultFuchsiaResourceDialect,
14541                    val_ref,
14542                    decoder,
14543                    inner_offset,
14544                    inner_depth
14545                )?;
14546                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14547                {
14548                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14549                }
14550                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14551                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14552                }
14553            }
14554
14555            next_offset += envelope_size;
14556
14557            // Decode the remaining unknown envelopes.
14558            while next_offset < end_offset {
14559                _next_ordinal_to_read += 1;
14560                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14561                next_offset += envelope_size;
14562            }
14563
14564            Ok(())
14565        }
14566    }
14567
14568    impl WifiStaIfaceSetScanOnlyModeRequest {
14569        #[inline(always)]
14570        fn max_ordinal_present(&self) -> u64 {
14571            if let Some(_) = self.enable {
14572                return 1;
14573            }
14574            0
14575        }
14576    }
14577
14578    impl fidl::encoding::ResourceTypeMarker for WifiStaIfaceSetScanOnlyModeRequest {
14579        type Borrowed<'a> = &'a mut Self;
14580        fn take_or_borrow<'a>(
14581            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14582        ) -> Self::Borrowed<'a> {
14583            value
14584        }
14585    }
14586
14587    unsafe impl fidl::encoding::TypeMarker for WifiStaIfaceSetScanOnlyModeRequest {
14588        type Owned = Self;
14589
14590        #[inline(always)]
14591        fn inline_align(_context: fidl::encoding::Context) -> usize {
14592            8
14593        }
14594
14595        #[inline(always)]
14596        fn inline_size(_context: fidl::encoding::Context) -> usize {
14597            16
14598        }
14599    }
14600
14601    unsafe impl
14602        fidl::encoding::Encode<
14603            WifiStaIfaceSetScanOnlyModeRequest,
14604            fidl::encoding::DefaultFuchsiaResourceDialect,
14605        > for &mut WifiStaIfaceSetScanOnlyModeRequest
14606    {
14607        unsafe fn encode(
14608            self,
14609            encoder: &mut fidl::encoding::Encoder<
14610                '_,
14611                fidl::encoding::DefaultFuchsiaResourceDialect,
14612            >,
14613            offset: usize,
14614            mut depth: fidl::encoding::Depth,
14615        ) -> fidl::Result<()> {
14616            encoder.debug_check_bounds::<WifiStaIfaceSetScanOnlyModeRequest>(offset);
14617            // Vector header
14618            let max_ordinal: u64 = self.max_ordinal_present();
14619            encoder.write_num(max_ordinal, offset);
14620            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
14621            // Calling encoder.out_of_line_offset(0) is not allowed.
14622            if max_ordinal == 0 {
14623                return Ok(());
14624            }
14625            depth.increment()?;
14626            let envelope_size = 8;
14627            let bytes_len = max_ordinal as usize * envelope_size;
14628            #[allow(unused_variables)]
14629            let offset = encoder.out_of_line_offset(bytes_len);
14630            let mut _prev_end_offset: usize = 0;
14631            if 1 > max_ordinal {
14632                return Ok(());
14633            }
14634
14635            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14636            // are envelope_size bytes.
14637            let cur_offset: usize = (1 - 1) * envelope_size;
14638
14639            // Zero reserved fields.
14640            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14641
14642            // Safety:
14643            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14644            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14645            //   envelope_size bytes, there is always sufficient room.
14646            fidl::encoding::encode_in_envelope_optional::<
14647                bool,
14648                fidl::encoding::DefaultFuchsiaResourceDialect,
14649            >(
14650                self.enable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
14651                encoder,
14652                offset + cur_offset,
14653                depth,
14654            )?;
14655
14656            _prev_end_offset = cur_offset + envelope_size;
14657
14658            Ok(())
14659        }
14660    }
14661
14662    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14663        for WifiStaIfaceSetScanOnlyModeRequest
14664    {
14665        #[inline(always)]
14666        fn new_empty() -> Self {
14667            Self::default()
14668        }
14669
14670        unsafe fn decode(
14671            &mut self,
14672            decoder: &mut fidl::encoding::Decoder<
14673                '_,
14674                fidl::encoding::DefaultFuchsiaResourceDialect,
14675            >,
14676            offset: usize,
14677            mut depth: fidl::encoding::Depth,
14678        ) -> fidl::Result<()> {
14679            decoder.debug_check_bounds::<Self>(offset);
14680            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14681                None => return Err(fidl::Error::NotNullable),
14682                Some(len) => len,
14683            };
14684            // Calling decoder.out_of_line_offset(0) is not allowed.
14685            if len == 0 {
14686                return Ok(());
14687            };
14688            depth.increment()?;
14689            let envelope_size = 8;
14690            let bytes_len = len * envelope_size;
14691            let offset = decoder.out_of_line_offset(bytes_len)?;
14692            // Decode the envelope for each type.
14693            let mut _next_ordinal_to_read = 0;
14694            let mut next_offset = offset;
14695            let end_offset = offset + bytes_len;
14696            _next_ordinal_to_read += 1;
14697            if next_offset >= end_offset {
14698                return Ok(());
14699            }
14700
14701            // Decode unknown envelopes for gaps in ordinals.
14702            while _next_ordinal_to_read < 1 {
14703                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14704                _next_ordinal_to_read += 1;
14705                next_offset += envelope_size;
14706            }
14707
14708            let next_out_of_line = decoder.next_out_of_line();
14709            let handles_before = decoder.remaining_handles();
14710            if let Some((inlined, num_bytes, num_handles)) =
14711                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14712            {
14713                let member_inline_size =
14714                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
14715                if inlined != (member_inline_size <= 4) {
14716                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14717                }
14718                let inner_offset;
14719                let mut inner_depth = depth.clone();
14720                if inlined {
14721                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14722                    inner_offset = next_offset;
14723                } else {
14724                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14725                    inner_depth.increment()?;
14726                }
14727                let val_ref = self.enable.get_or_insert_with(|| {
14728                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
14729                });
14730                fidl::decode!(
14731                    bool,
14732                    fidl::encoding::DefaultFuchsiaResourceDialect,
14733                    val_ref,
14734                    decoder,
14735                    inner_offset,
14736                    inner_depth
14737                )?;
14738                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14739                {
14740                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14741                }
14742                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14743                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14744                }
14745            }
14746
14747            next_offset += envelope_size;
14748
14749            // Decode the remaining unknown envelopes.
14750            while next_offset < end_offset {
14751                _next_ordinal_to_read += 1;
14752                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14753                next_offset += envelope_size;
14754            }
14755
14756            Ok(())
14757        }
14758    }
14759
14760    impl WlanixGetNl80211Request {
14761        #[inline(always)]
14762        fn max_ordinal_present(&self) -> u64 {
14763            if let Some(_) = self.nl80211 {
14764                return 1;
14765            }
14766            0
14767        }
14768    }
14769
14770    impl fidl::encoding::ResourceTypeMarker for WlanixGetNl80211Request {
14771        type Borrowed<'a> = &'a mut Self;
14772        fn take_or_borrow<'a>(
14773            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14774        ) -> Self::Borrowed<'a> {
14775            value
14776        }
14777    }
14778
14779    unsafe impl fidl::encoding::TypeMarker for WlanixGetNl80211Request {
14780        type Owned = Self;
14781
14782        #[inline(always)]
14783        fn inline_align(_context: fidl::encoding::Context) -> usize {
14784            8
14785        }
14786
14787        #[inline(always)]
14788        fn inline_size(_context: fidl::encoding::Context) -> usize {
14789            16
14790        }
14791    }
14792
14793    unsafe impl
14794        fidl::encoding::Encode<
14795            WlanixGetNl80211Request,
14796            fidl::encoding::DefaultFuchsiaResourceDialect,
14797        > for &mut WlanixGetNl80211Request
14798    {
14799        unsafe fn encode(
14800            self,
14801            encoder: &mut fidl::encoding::Encoder<
14802                '_,
14803                fidl::encoding::DefaultFuchsiaResourceDialect,
14804            >,
14805            offset: usize,
14806            mut depth: fidl::encoding::Depth,
14807        ) -> fidl::Result<()> {
14808            encoder.debug_check_bounds::<WlanixGetNl80211Request>(offset);
14809            // Vector header
14810            let max_ordinal: u64 = self.max_ordinal_present();
14811            encoder.write_num(max_ordinal, offset);
14812            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
14813            // Calling encoder.out_of_line_offset(0) is not allowed.
14814            if max_ordinal == 0 {
14815                return Ok(());
14816            }
14817            depth.increment()?;
14818            let envelope_size = 8;
14819            let bytes_len = max_ordinal as usize * envelope_size;
14820            #[allow(unused_variables)]
14821            let offset = encoder.out_of_line_offset(bytes_len);
14822            let mut _prev_end_offset: usize = 0;
14823            if 1 > max_ordinal {
14824                return Ok(());
14825            }
14826
14827            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
14828            // are envelope_size bytes.
14829            let cur_offset: usize = (1 - 1) * envelope_size;
14830
14831            // Zero reserved fields.
14832            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
14833
14834            // Safety:
14835            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
14836            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
14837            //   envelope_size bytes, there is always sufficient room.
14838            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<Nl80211Marker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
14839            self.nl80211.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<Nl80211Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
14840            encoder, offset + cur_offset, depth
14841        )?;
14842
14843            _prev_end_offset = cur_offset + envelope_size;
14844
14845            Ok(())
14846        }
14847    }
14848
14849    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
14850        for WlanixGetNl80211Request
14851    {
14852        #[inline(always)]
14853        fn new_empty() -> Self {
14854            Self::default()
14855        }
14856
14857        unsafe fn decode(
14858            &mut self,
14859            decoder: &mut fidl::encoding::Decoder<
14860                '_,
14861                fidl::encoding::DefaultFuchsiaResourceDialect,
14862            >,
14863            offset: usize,
14864            mut depth: fidl::encoding::Depth,
14865        ) -> fidl::Result<()> {
14866            decoder.debug_check_bounds::<Self>(offset);
14867            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
14868                None => return Err(fidl::Error::NotNullable),
14869                Some(len) => len,
14870            };
14871            // Calling decoder.out_of_line_offset(0) is not allowed.
14872            if len == 0 {
14873                return Ok(());
14874            };
14875            depth.increment()?;
14876            let envelope_size = 8;
14877            let bytes_len = len * envelope_size;
14878            let offset = decoder.out_of_line_offset(bytes_len)?;
14879            // Decode the envelope for each type.
14880            let mut _next_ordinal_to_read = 0;
14881            let mut next_offset = offset;
14882            let end_offset = offset + bytes_len;
14883            _next_ordinal_to_read += 1;
14884            if next_offset >= end_offset {
14885                return Ok(());
14886            }
14887
14888            // Decode unknown envelopes for gaps in ordinals.
14889            while _next_ordinal_to_read < 1 {
14890                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14891                _next_ordinal_to_read += 1;
14892                next_offset += envelope_size;
14893            }
14894
14895            let next_out_of_line = decoder.next_out_of_line();
14896            let handles_before = decoder.remaining_handles();
14897            if let Some((inlined, num_bytes, num_handles)) =
14898                fidl::encoding::decode_envelope_header(decoder, next_offset)?
14899            {
14900                let member_inline_size = <fidl::encoding::Endpoint<
14901                    fidl::endpoints::ServerEnd<Nl80211Marker>,
14902                > as fidl::encoding::TypeMarker>::inline_size(
14903                    decoder.context
14904                );
14905                if inlined != (member_inline_size <= 4) {
14906                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
14907                }
14908                let inner_offset;
14909                let mut inner_depth = depth.clone();
14910                if inlined {
14911                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
14912                    inner_offset = next_offset;
14913                } else {
14914                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
14915                    inner_depth.increment()?;
14916                }
14917                let val_ref = self.nl80211.get_or_insert_with(|| {
14918                    fidl::new_empty!(
14919                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<Nl80211Marker>>,
14920                        fidl::encoding::DefaultFuchsiaResourceDialect
14921                    )
14922                });
14923                fidl::decode!(
14924                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<Nl80211Marker>>,
14925                    fidl::encoding::DefaultFuchsiaResourceDialect,
14926                    val_ref,
14927                    decoder,
14928                    inner_offset,
14929                    inner_depth
14930                )?;
14931                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
14932                {
14933                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
14934                }
14935                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
14936                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
14937                }
14938            }
14939
14940            next_offset += envelope_size;
14941
14942            // Decode the remaining unknown envelopes.
14943            while next_offset < end_offset {
14944                _next_ordinal_to_read += 1;
14945                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
14946                next_offset += envelope_size;
14947            }
14948
14949            Ok(())
14950        }
14951    }
14952
14953    impl WlanixGetSupplicantRequest {
14954        #[inline(always)]
14955        fn max_ordinal_present(&self) -> u64 {
14956            if let Some(_) = self.supplicant {
14957                return 1;
14958            }
14959            0
14960        }
14961    }
14962
14963    impl fidl::encoding::ResourceTypeMarker for WlanixGetSupplicantRequest {
14964        type Borrowed<'a> = &'a mut Self;
14965        fn take_or_borrow<'a>(
14966            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
14967        ) -> Self::Borrowed<'a> {
14968            value
14969        }
14970    }
14971
14972    unsafe impl fidl::encoding::TypeMarker for WlanixGetSupplicantRequest {
14973        type Owned = Self;
14974
14975        #[inline(always)]
14976        fn inline_align(_context: fidl::encoding::Context) -> usize {
14977            8
14978        }
14979
14980        #[inline(always)]
14981        fn inline_size(_context: fidl::encoding::Context) -> usize {
14982            16
14983        }
14984    }
14985
14986    unsafe impl
14987        fidl::encoding::Encode<
14988            WlanixGetSupplicantRequest,
14989            fidl::encoding::DefaultFuchsiaResourceDialect,
14990        > for &mut WlanixGetSupplicantRequest
14991    {
14992        unsafe fn encode(
14993            self,
14994            encoder: &mut fidl::encoding::Encoder<
14995                '_,
14996                fidl::encoding::DefaultFuchsiaResourceDialect,
14997            >,
14998            offset: usize,
14999            mut depth: fidl::encoding::Depth,
15000        ) -> fidl::Result<()> {
15001            encoder.debug_check_bounds::<WlanixGetSupplicantRequest>(offset);
15002            // Vector header
15003            let max_ordinal: u64 = self.max_ordinal_present();
15004            encoder.write_num(max_ordinal, offset);
15005            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15006            // Calling encoder.out_of_line_offset(0) is not allowed.
15007            if max_ordinal == 0 {
15008                return Ok(());
15009            }
15010            depth.increment()?;
15011            let envelope_size = 8;
15012            let bytes_len = max_ordinal as usize * envelope_size;
15013            #[allow(unused_variables)]
15014            let offset = encoder.out_of_line_offset(bytes_len);
15015            let mut _prev_end_offset: usize = 0;
15016            if 1 > max_ordinal {
15017                return Ok(());
15018            }
15019
15020            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15021            // are envelope_size bytes.
15022            let cur_offset: usize = (1 - 1) * envelope_size;
15023
15024            // Zero reserved fields.
15025            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15026
15027            // Safety:
15028            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15029            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15030            //   envelope_size bytes, there is always sufficient room.
15031            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SupplicantMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15032            self.supplicant.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SupplicantMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
15033            encoder, offset + cur_offset, depth
15034        )?;
15035
15036            _prev_end_offset = cur_offset + envelope_size;
15037
15038            Ok(())
15039        }
15040    }
15041
15042    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15043        for WlanixGetSupplicantRequest
15044    {
15045        #[inline(always)]
15046        fn new_empty() -> Self {
15047            Self::default()
15048        }
15049
15050        unsafe fn decode(
15051            &mut self,
15052            decoder: &mut fidl::encoding::Decoder<
15053                '_,
15054                fidl::encoding::DefaultFuchsiaResourceDialect,
15055            >,
15056            offset: usize,
15057            mut depth: fidl::encoding::Depth,
15058        ) -> fidl::Result<()> {
15059            decoder.debug_check_bounds::<Self>(offset);
15060            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15061                None => return Err(fidl::Error::NotNullable),
15062                Some(len) => len,
15063            };
15064            // Calling decoder.out_of_line_offset(0) is not allowed.
15065            if len == 0 {
15066                return Ok(());
15067            };
15068            depth.increment()?;
15069            let envelope_size = 8;
15070            let bytes_len = len * envelope_size;
15071            let offset = decoder.out_of_line_offset(bytes_len)?;
15072            // Decode the envelope for each type.
15073            let mut _next_ordinal_to_read = 0;
15074            let mut next_offset = offset;
15075            let end_offset = offset + bytes_len;
15076            _next_ordinal_to_read += 1;
15077            if next_offset >= end_offset {
15078                return Ok(());
15079            }
15080
15081            // Decode unknown envelopes for gaps in ordinals.
15082            while _next_ordinal_to_read < 1 {
15083                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15084                _next_ordinal_to_read += 1;
15085                next_offset += envelope_size;
15086            }
15087
15088            let next_out_of_line = decoder.next_out_of_line();
15089            let handles_before = decoder.remaining_handles();
15090            if let Some((inlined, num_bytes, num_handles)) =
15091                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15092            {
15093                let member_inline_size = <fidl::encoding::Endpoint<
15094                    fidl::endpoints::ServerEnd<SupplicantMarker>,
15095                > as fidl::encoding::TypeMarker>::inline_size(
15096                    decoder.context
15097                );
15098                if inlined != (member_inline_size <= 4) {
15099                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15100                }
15101                let inner_offset;
15102                let mut inner_depth = depth.clone();
15103                if inlined {
15104                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15105                    inner_offset = next_offset;
15106                } else {
15107                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15108                    inner_depth.increment()?;
15109                }
15110                let val_ref = self.supplicant.get_or_insert_with(|| {
15111                    fidl::new_empty!(
15112                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SupplicantMarker>>,
15113                        fidl::encoding::DefaultFuchsiaResourceDialect
15114                    )
15115                });
15116                fidl::decode!(
15117                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SupplicantMarker>>,
15118                    fidl::encoding::DefaultFuchsiaResourceDialect,
15119                    val_ref,
15120                    decoder,
15121                    inner_offset,
15122                    inner_depth
15123                )?;
15124                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15125                {
15126                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15127                }
15128                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15129                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15130                }
15131            }
15132
15133            next_offset += envelope_size;
15134
15135            // Decode the remaining unknown envelopes.
15136            while next_offset < end_offset {
15137                _next_ordinal_to_read += 1;
15138                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15139                next_offset += envelope_size;
15140            }
15141
15142            Ok(())
15143        }
15144    }
15145
15146    impl WlanixGetWifiLegacyHalRequest {
15147        #[inline(always)]
15148        fn max_ordinal_present(&self) -> u64 {
15149            if let Some(_) = self.legacy_hal {
15150                return 1;
15151            }
15152            0
15153        }
15154    }
15155
15156    impl fidl::encoding::ResourceTypeMarker for WlanixGetWifiLegacyHalRequest {
15157        type Borrowed<'a> = &'a mut Self;
15158        fn take_or_borrow<'a>(
15159            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15160        ) -> Self::Borrowed<'a> {
15161            value
15162        }
15163    }
15164
15165    unsafe impl fidl::encoding::TypeMarker for WlanixGetWifiLegacyHalRequest {
15166        type Owned = Self;
15167
15168        #[inline(always)]
15169        fn inline_align(_context: fidl::encoding::Context) -> usize {
15170            8
15171        }
15172
15173        #[inline(always)]
15174        fn inline_size(_context: fidl::encoding::Context) -> usize {
15175            16
15176        }
15177    }
15178
15179    unsafe impl
15180        fidl::encoding::Encode<
15181            WlanixGetWifiLegacyHalRequest,
15182            fidl::encoding::DefaultFuchsiaResourceDialect,
15183        > for &mut WlanixGetWifiLegacyHalRequest
15184    {
15185        unsafe fn encode(
15186            self,
15187            encoder: &mut fidl::encoding::Encoder<
15188                '_,
15189                fidl::encoding::DefaultFuchsiaResourceDialect,
15190            >,
15191            offset: usize,
15192            mut depth: fidl::encoding::Depth,
15193        ) -> fidl::Result<()> {
15194            encoder.debug_check_bounds::<WlanixGetWifiLegacyHalRequest>(offset);
15195            // Vector header
15196            let max_ordinal: u64 = self.max_ordinal_present();
15197            encoder.write_num(max_ordinal, offset);
15198            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15199            // Calling encoder.out_of_line_offset(0) is not allowed.
15200            if max_ordinal == 0 {
15201                return Ok(());
15202            }
15203            depth.increment()?;
15204            let envelope_size = 8;
15205            let bytes_len = max_ordinal as usize * envelope_size;
15206            #[allow(unused_variables)]
15207            let offset = encoder.out_of_line_offset(bytes_len);
15208            let mut _prev_end_offset: usize = 0;
15209            if 1 > max_ordinal {
15210                return Ok(());
15211            }
15212
15213            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15214            // are envelope_size bytes.
15215            let cur_offset: usize = (1 - 1) * envelope_size;
15216
15217            // Zero reserved fields.
15218            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15219
15220            // Safety:
15221            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15222            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15223            //   envelope_size bytes, there is always sufficient room.
15224            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiLegacyHalMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15225            self.legacy_hal.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiLegacyHalMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
15226            encoder, offset + cur_offset, depth
15227        )?;
15228
15229            _prev_end_offset = cur_offset + envelope_size;
15230
15231            Ok(())
15232        }
15233    }
15234
15235    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15236        for WlanixGetWifiLegacyHalRequest
15237    {
15238        #[inline(always)]
15239        fn new_empty() -> Self {
15240            Self::default()
15241        }
15242
15243        unsafe fn decode(
15244            &mut self,
15245            decoder: &mut fidl::encoding::Decoder<
15246                '_,
15247                fidl::encoding::DefaultFuchsiaResourceDialect,
15248            >,
15249            offset: usize,
15250            mut depth: fidl::encoding::Depth,
15251        ) -> fidl::Result<()> {
15252            decoder.debug_check_bounds::<Self>(offset);
15253            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15254                None => return Err(fidl::Error::NotNullable),
15255                Some(len) => len,
15256            };
15257            // Calling decoder.out_of_line_offset(0) is not allowed.
15258            if len == 0 {
15259                return Ok(());
15260            };
15261            depth.increment()?;
15262            let envelope_size = 8;
15263            let bytes_len = len * envelope_size;
15264            let offset = decoder.out_of_line_offset(bytes_len)?;
15265            // Decode the envelope for each type.
15266            let mut _next_ordinal_to_read = 0;
15267            let mut next_offset = offset;
15268            let end_offset = offset + bytes_len;
15269            _next_ordinal_to_read += 1;
15270            if next_offset >= end_offset {
15271                return Ok(());
15272            }
15273
15274            // Decode unknown envelopes for gaps in ordinals.
15275            while _next_ordinal_to_read < 1 {
15276                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15277                _next_ordinal_to_read += 1;
15278                next_offset += envelope_size;
15279            }
15280
15281            let next_out_of_line = decoder.next_out_of_line();
15282            let handles_before = decoder.remaining_handles();
15283            if let Some((inlined, num_bytes, num_handles)) =
15284                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15285            {
15286                let member_inline_size = <fidl::encoding::Endpoint<
15287                    fidl::endpoints::ServerEnd<WifiLegacyHalMarker>,
15288                > as fidl::encoding::TypeMarker>::inline_size(
15289                    decoder.context
15290                );
15291                if inlined != (member_inline_size <= 4) {
15292                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15293                }
15294                let inner_offset;
15295                let mut inner_depth = depth.clone();
15296                if inlined {
15297                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15298                    inner_offset = next_offset;
15299                } else {
15300                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15301                    inner_depth.increment()?;
15302                }
15303                let val_ref = self.legacy_hal.get_or_insert_with(|| {
15304                    fidl::new_empty!(
15305                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiLegacyHalMarker>>,
15306                        fidl::encoding::DefaultFuchsiaResourceDialect
15307                    )
15308                });
15309                fidl::decode!(
15310                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiLegacyHalMarker>>,
15311                    fidl::encoding::DefaultFuchsiaResourceDialect,
15312                    val_ref,
15313                    decoder,
15314                    inner_offset,
15315                    inner_depth
15316                )?;
15317                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15318                {
15319                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15320                }
15321                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15322                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15323                }
15324            }
15325
15326            next_offset += envelope_size;
15327
15328            // Decode the remaining unknown envelopes.
15329            while next_offset < end_offset {
15330                _next_ordinal_to_read += 1;
15331                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15332                next_offset += envelope_size;
15333            }
15334
15335            Ok(())
15336        }
15337    }
15338
15339    impl WlanixGetWifiRequest {
15340        #[inline(always)]
15341        fn max_ordinal_present(&self) -> u64 {
15342            if let Some(_) = self.wifi {
15343                return 1;
15344            }
15345            0
15346        }
15347    }
15348
15349    impl fidl::encoding::ResourceTypeMarker for WlanixGetWifiRequest {
15350        type Borrowed<'a> = &'a mut Self;
15351        fn take_or_borrow<'a>(
15352            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
15353        ) -> Self::Borrowed<'a> {
15354            value
15355        }
15356    }
15357
15358    unsafe impl fidl::encoding::TypeMarker for WlanixGetWifiRequest {
15359        type Owned = Self;
15360
15361        #[inline(always)]
15362        fn inline_align(_context: fidl::encoding::Context) -> usize {
15363            8
15364        }
15365
15366        #[inline(always)]
15367        fn inline_size(_context: fidl::encoding::Context) -> usize {
15368            16
15369        }
15370    }
15371
15372    unsafe impl
15373        fidl::encoding::Encode<WlanixGetWifiRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
15374        for &mut WlanixGetWifiRequest
15375    {
15376        unsafe fn encode(
15377            self,
15378            encoder: &mut fidl::encoding::Encoder<
15379                '_,
15380                fidl::encoding::DefaultFuchsiaResourceDialect,
15381            >,
15382            offset: usize,
15383            mut depth: fidl::encoding::Depth,
15384        ) -> fidl::Result<()> {
15385            encoder.debug_check_bounds::<WlanixGetWifiRequest>(offset);
15386            // Vector header
15387            let max_ordinal: u64 = self.max_ordinal_present();
15388            encoder.write_num(max_ordinal, offset);
15389            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
15390            // Calling encoder.out_of_line_offset(0) is not allowed.
15391            if max_ordinal == 0 {
15392                return Ok(());
15393            }
15394            depth.increment()?;
15395            let envelope_size = 8;
15396            let bytes_len = max_ordinal as usize * envelope_size;
15397            #[allow(unused_variables)]
15398            let offset = encoder.out_of_line_offset(bytes_len);
15399            let mut _prev_end_offset: usize = 0;
15400            if 1 > max_ordinal {
15401                return Ok(());
15402            }
15403
15404            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
15405            // are envelope_size bytes.
15406            let cur_offset: usize = (1 - 1) * envelope_size;
15407
15408            // Zero reserved fields.
15409            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
15410
15411            // Safety:
15412            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
15413            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
15414            //   envelope_size bytes, there is always sufficient room.
15415            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
15416            self.wifi.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
15417            encoder, offset + cur_offset, depth
15418        )?;
15419
15420            _prev_end_offset = cur_offset + envelope_size;
15421
15422            Ok(())
15423        }
15424    }
15425
15426    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
15427        for WlanixGetWifiRequest
15428    {
15429        #[inline(always)]
15430        fn new_empty() -> Self {
15431            Self::default()
15432        }
15433
15434        unsafe fn decode(
15435            &mut self,
15436            decoder: &mut fidl::encoding::Decoder<
15437                '_,
15438                fidl::encoding::DefaultFuchsiaResourceDialect,
15439            >,
15440            offset: usize,
15441            mut depth: fidl::encoding::Depth,
15442        ) -> fidl::Result<()> {
15443            decoder.debug_check_bounds::<Self>(offset);
15444            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
15445                None => return Err(fidl::Error::NotNullable),
15446                Some(len) => len,
15447            };
15448            // Calling decoder.out_of_line_offset(0) is not allowed.
15449            if len == 0 {
15450                return Ok(());
15451            };
15452            depth.increment()?;
15453            let envelope_size = 8;
15454            let bytes_len = len * envelope_size;
15455            let offset = decoder.out_of_line_offset(bytes_len)?;
15456            // Decode the envelope for each type.
15457            let mut _next_ordinal_to_read = 0;
15458            let mut next_offset = offset;
15459            let end_offset = offset + bytes_len;
15460            _next_ordinal_to_read += 1;
15461            if next_offset >= end_offset {
15462                return Ok(());
15463            }
15464
15465            // Decode unknown envelopes for gaps in ordinals.
15466            while _next_ordinal_to_read < 1 {
15467                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15468                _next_ordinal_to_read += 1;
15469                next_offset += envelope_size;
15470            }
15471
15472            let next_out_of_line = decoder.next_out_of_line();
15473            let handles_before = decoder.remaining_handles();
15474            if let Some((inlined, num_bytes, num_handles)) =
15475                fidl::encoding::decode_envelope_header(decoder, next_offset)?
15476            {
15477                let member_inline_size = <fidl::encoding::Endpoint<
15478                    fidl::endpoints::ServerEnd<WifiMarker>,
15479                > as fidl::encoding::TypeMarker>::inline_size(
15480                    decoder.context
15481                );
15482                if inlined != (member_inline_size <= 4) {
15483                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
15484                }
15485                let inner_offset;
15486                let mut inner_depth = depth.clone();
15487                if inlined {
15488                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
15489                    inner_offset = next_offset;
15490                } else {
15491                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
15492                    inner_depth.increment()?;
15493                }
15494                let val_ref = self.wifi.get_or_insert_with(|| {
15495                    fidl::new_empty!(
15496                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiMarker>>,
15497                        fidl::encoding::DefaultFuchsiaResourceDialect
15498                    )
15499                });
15500                fidl::decode!(
15501                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiMarker>>,
15502                    fidl::encoding::DefaultFuchsiaResourceDialect,
15503                    val_ref,
15504                    decoder,
15505                    inner_offset,
15506                    inner_depth
15507                )?;
15508                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
15509                {
15510                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
15511                }
15512                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
15513                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
15514                }
15515            }
15516
15517            next_offset += envelope_size;
15518
15519            // Decode the remaining unknown envelopes.
15520            while next_offset < end_offset {
15521                _next_ordinal_to_read += 1;
15522                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
15523                next_offset += envelope_size;
15524            }
15525
15526            Ok(())
15527        }
15528    }
15529}