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, Default, PartialEq)]
15pub struct Nl80211GetMulticastRequest {
16    pub group: Option<String>,
17    pub multicast: Option<fidl::endpoints::ClientEnd<Nl80211MulticastMarker>>,
18    #[doc(hidden)]
19    pub __source_breaking: fidl::marker::SourceBreaking,
20}
21
22impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
23    for Nl80211GetMulticastRequest
24{
25}
26
27#[derive(Debug, Default, PartialEq)]
28pub struct Nl80211MessageRequest {
29    pub message: Option<Nl80211Message>,
30    #[doc(hidden)]
31    pub __source_breaking: fidl::marker::SourceBreaking,
32}
33
34impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Nl80211MessageRequest {}
35
36#[derive(Debug, Default, PartialEq)]
37pub struct Nl80211MulticastMessageRequest {
38    pub message: Option<Nl80211Message>,
39    #[doc(hidden)]
40    pub __source_breaking: fidl::marker::SourceBreaking,
41}
42
43impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
44    for Nl80211MulticastMessageRequest
45{
46}
47
48#[derive(Debug, Default, PartialEq)]
49pub struct Nl80211MessageResponse {
50    pub responses: Option<Vec<Nl80211Message>>,
51    #[doc(hidden)]
52    pub __source_breaking: fidl::marker::SourceBreaking,
53}
54
55impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Nl80211MessageResponse {}
56
57#[derive(Debug, Default, PartialEq)]
58pub struct SupplicantAddStaInterfaceRequest {
59    pub iface: Option<fidl::endpoints::ServerEnd<SupplicantStaIfaceMarker>>,
60    pub iface_name: Option<String>,
61    #[doc(hidden)]
62    pub __source_breaking: fidl::marker::SourceBreaking,
63}
64
65impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
66    for SupplicantAddStaInterfaceRequest
67{
68}
69
70#[derive(Debug, Default, PartialEq)]
71pub struct SupplicantStaIfaceAddNetworkRequest {
72    pub network: Option<fidl::endpoints::ServerEnd<SupplicantStaNetworkMarker>>,
73    #[doc(hidden)]
74    pub __source_breaking: fidl::marker::SourceBreaking,
75}
76
77impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
78    for SupplicantStaIfaceAddNetworkRequest
79{
80}
81
82#[derive(Debug, Default, PartialEq)]
83pub struct SupplicantStaIfaceRegisterCallbackRequest {
84    pub callback: Option<fidl::endpoints::ClientEnd<SupplicantStaIfaceCallbackMarker>>,
85    #[doc(hidden)]
86    pub __source_breaking: fidl::marker::SourceBreaking,
87}
88
89impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
90    for SupplicantStaIfaceRegisterCallbackRequest
91{
92}
93
94#[derive(Debug, Default, PartialEq)]
95pub struct SupplicantStaIfaceSetPowerSaveRequest {
96    pub enable: Option<bool>,
97    #[doc(hidden)]
98    pub __source_breaking: fidl::marker::SourceBreaking,
99}
100
101impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
102    for SupplicantStaIfaceSetPowerSaveRequest
103{
104}
105
106#[derive(Debug, Default, PartialEq)]
107pub struct SupplicantStaIfaceSetStaCountryCodeRequest {
108    pub code: Option<[u8; 2]>,
109    #[doc(hidden)]
110    pub __source_breaking: fidl::marker::SourceBreaking,
111}
112
113impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
114    for SupplicantStaIfaceSetStaCountryCodeRequest
115{
116}
117
118#[derive(Debug, Default, PartialEq)]
119pub struct SupplicantStaIfaceSetSuspendModeEnabledRequest {
120    pub enable: Option<bool>,
121    #[doc(hidden)]
122    pub __source_breaking: fidl::marker::SourceBreaking,
123}
124
125impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
126    for SupplicantStaIfaceSetSuspendModeEnabledRequest
127{
128}
129
130#[derive(Debug, Default, PartialEq)]
131pub struct WifiChipCreateStaIfaceRequest {
132    pub iface: Option<fidl::endpoints::ServerEnd<WifiStaIfaceMarker>>,
133    #[doc(hidden)]
134    pub __source_breaking: fidl::marker::SourceBreaking,
135}
136
137impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
138    for WifiChipCreateStaIfaceRequest
139{
140}
141
142#[derive(Debug, Default, PartialEq)]
143pub struct WifiChipGetStaIfaceRequest {
144    pub iface_name: Option<String>,
145    pub iface: Option<fidl::endpoints::ServerEnd<WifiStaIfaceMarker>>,
146    #[doc(hidden)]
147    pub __source_breaking: fidl::marker::SourceBreaking,
148}
149
150impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
151    for WifiChipGetStaIfaceRequest
152{
153}
154
155#[derive(Debug, Default, PartialEq)]
156pub struct WifiChipRemoveStaIfaceRequest {
157    pub iface_name: Option<String>,
158    #[doc(hidden)]
159    pub __source_breaking: fidl::marker::SourceBreaking,
160}
161
162impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
163    for WifiChipRemoveStaIfaceRequest
164{
165}
166
167#[derive(Debug, Default, PartialEq)]
168pub struct WifiChipSetCountryCodeRequest {
169    pub code: Option<[u8; 2]>,
170    #[doc(hidden)]
171    pub __source_breaking: fidl::marker::SourceBreaking,
172}
173
174impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
175    for WifiChipSetCountryCodeRequest
176{
177}
178
179#[derive(Debug, Default, PartialEq)]
180pub struct WifiGetChipRequest {
181    pub chip_id: Option<u32>,
182    pub chip: Option<fidl::endpoints::ServerEnd<WifiChipMarker>>,
183    #[doc(hidden)]
184    pub __source_breaking: fidl::marker::SourceBreaking,
185}
186
187impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for WifiGetChipRequest {}
188
189#[derive(Debug, Default, PartialEq)]
190pub struct WifiRegisterEventCallbackRequest {
191    pub callback: Option<fidl::endpoints::ClientEnd<WifiEventCallbackMarker>>,
192    #[doc(hidden)]
193    pub __source_breaking: fidl::marker::SourceBreaking,
194}
195
196impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
197    for WifiRegisterEventCallbackRequest
198{
199}
200
201#[derive(Debug, Default, PartialEq)]
202pub struct WlanixGetNl80211Request {
203    pub nl80211: Option<fidl::endpoints::ServerEnd<Nl80211Marker>>,
204    #[doc(hidden)]
205    pub __source_breaking: fidl::marker::SourceBreaking,
206}
207
208impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for WlanixGetNl80211Request {}
209
210#[derive(Debug, Default, PartialEq)]
211pub struct WlanixGetSupplicantRequest {
212    pub supplicant: Option<fidl::endpoints::ServerEnd<SupplicantMarker>>,
213    #[doc(hidden)]
214    pub __source_breaking: fidl::marker::SourceBreaking,
215}
216
217impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
218    for WlanixGetSupplicantRequest
219{
220}
221
222#[derive(Debug, Default, PartialEq)]
223pub struct WlanixGetWifiRequest {
224    pub wifi: Option<fidl::endpoints::ServerEnd<WifiMarker>>,
225    #[doc(hidden)]
226    pub __source_breaking: fidl::marker::SourceBreaking,
227}
228
229impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for WlanixGetWifiRequest {}
230
231#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
232pub struct Nl80211Marker;
233
234impl fidl::endpoints::ProtocolMarker for Nl80211Marker {
235    type Proxy = Nl80211Proxy;
236    type RequestStream = Nl80211RequestStream;
237    #[cfg(target_os = "fuchsia")]
238    type SynchronousProxy = Nl80211SynchronousProxy;
239
240    const DEBUG_NAME: &'static str = "(anonymous) Nl80211";
241}
242pub type Nl80211MessageResult = Result<Nl80211MessageResponse, i32>;
243
244pub trait Nl80211ProxyInterface: Send + Sync {
245    fn r#get_multicast(&self, payload: Nl80211GetMulticastRequest) -> Result<(), fidl::Error>;
246    type MessageResponseFut: std::future::Future<Output = Result<Nl80211MessageResult, fidl::Error>>
247        + Send;
248    fn r#message(&self, payload: Nl80211MessageRequest) -> Self::MessageResponseFut;
249}
250#[derive(Debug)]
251#[cfg(target_os = "fuchsia")]
252pub struct Nl80211SynchronousProxy {
253    client: fidl::client::sync::Client,
254}
255
256#[cfg(target_os = "fuchsia")]
257impl fidl::endpoints::SynchronousProxy for Nl80211SynchronousProxy {
258    type Proxy = Nl80211Proxy;
259    type Protocol = Nl80211Marker;
260
261    fn from_channel(inner: fidl::Channel) -> Self {
262        Self::new(inner)
263    }
264
265    fn into_channel(self) -> fidl::Channel {
266        self.client.into_channel()
267    }
268
269    fn as_channel(&self) -> &fidl::Channel {
270        self.client.as_channel()
271    }
272}
273
274#[cfg(target_os = "fuchsia")]
275impl Nl80211SynchronousProxy {
276    pub fn new(channel: fidl::Channel) -> Self {
277        let protocol_name = <Nl80211Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
278        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
279    }
280
281    pub fn into_channel(self) -> fidl::Channel {
282        self.client.into_channel()
283    }
284
285    /// Waits until an event arrives and returns it. It is safe for other
286    /// threads to make concurrent requests while waiting for an event.
287    pub fn wait_for_event(
288        &self,
289        deadline: zx::MonotonicInstant,
290    ) -> Result<Nl80211Event, fidl::Error> {
291        Nl80211Event::decode(self.client.wait_for_event(deadline)?)
292    }
293
294    pub fn r#get_multicast(
295        &self,
296        mut payload: Nl80211GetMulticastRequest,
297    ) -> Result<(), fidl::Error> {
298        self.client.send::<Nl80211GetMulticastRequest>(
299            &mut payload,
300            0x58b73dd089681dc2,
301            fidl::encoding::DynamicFlags::FLEXIBLE,
302        )
303    }
304
305    pub fn r#message(
306        &self,
307        mut payload: Nl80211MessageRequest,
308        ___deadline: zx::MonotonicInstant,
309    ) -> Result<Nl80211MessageResult, fidl::Error> {
310        let _response = self.client.send_query::<
311            Nl80211MessageRequest,
312            fidl::encoding::FlexibleResultType<Nl80211MessageResponse, i32>,
313        >(
314            &mut payload,
315            0x6336259e15bb3795,
316            fidl::encoding::DynamicFlags::FLEXIBLE,
317            ___deadline,
318        )?
319        .into_result::<Nl80211Marker>("message")?;
320        Ok(_response.map(|x| x))
321    }
322}
323
324#[cfg(target_os = "fuchsia")]
325impl From<Nl80211SynchronousProxy> for zx::Handle {
326    fn from(value: Nl80211SynchronousProxy) -> Self {
327        value.into_channel().into()
328    }
329}
330
331#[cfg(target_os = "fuchsia")]
332impl From<fidl::Channel> for Nl80211SynchronousProxy {
333    fn from(value: fidl::Channel) -> Self {
334        Self::new(value)
335    }
336}
337
338#[derive(Debug, Clone)]
339pub struct Nl80211Proxy {
340    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
341}
342
343impl fidl::endpoints::Proxy for Nl80211Proxy {
344    type Protocol = Nl80211Marker;
345
346    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
347        Self::new(inner)
348    }
349
350    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
351        self.client.into_channel().map_err(|client| Self { client })
352    }
353
354    fn as_channel(&self) -> &::fidl::AsyncChannel {
355        self.client.as_channel()
356    }
357}
358
359impl Nl80211Proxy {
360    /// Create a new Proxy for fuchsia.wlan.wlanix/Nl80211.
361    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
362        let protocol_name = <Nl80211Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
363        Self { client: fidl::client::Client::new(channel, protocol_name) }
364    }
365
366    /// Get a Stream of events from the remote end of the protocol.
367    ///
368    /// # Panics
369    ///
370    /// Panics if the event stream was already taken.
371    pub fn take_event_stream(&self) -> Nl80211EventStream {
372        Nl80211EventStream { event_receiver: self.client.take_event_receiver() }
373    }
374
375    pub fn r#get_multicast(
376        &self,
377        mut payload: Nl80211GetMulticastRequest,
378    ) -> Result<(), fidl::Error> {
379        Nl80211ProxyInterface::r#get_multicast(self, payload)
380    }
381
382    pub fn r#message(
383        &self,
384        mut payload: Nl80211MessageRequest,
385    ) -> fidl::client::QueryResponseFut<
386        Nl80211MessageResult,
387        fidl::encoding::DefaultFuchsiaResourceDialect,
388    > {
389        Nl80211ProxyInterface::r#message(self, payload)
390    }
391}
392
393impl Nl80211ProxyInterface for Nl80211Proxy {
394    fn r#get_multicast(&self, mut payload: Nl80211GetMulticastRequest) -> Result<(), fidl::Error> {
395        self.client.send::<Nl80211GetMulticastRequest>(
396            &mut payload,
397            0x58b73dd089681dc2,
398            fidl::encoding::DynamicFlags::FLEXIBLE,
399        )
400    }
401
402    type MessageResponseFut = fidl::client::QueryResponseFut<
403        Nl80211MessageResult,
404        fidl::encoding::DefaultFuchsiaResourceDialect,
405    >;
406    fn r#message(&self, mut payload: Nl80211MessageRequest) -> Self::MessageResponseFut {
407        fn _decode(
408            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
409        ) -> Result<Nl80211MessageResult, fidl::Error> {
410            let _response = fidl::client::decode_transaction_body::<
411                fidl::encoding::FlexibleResultType<Nl80211MessageResponse, i32>,
412                fidl::encoding::DefaultFuchsiaResourceDialect,
413                0x6336259e15bb3795,
414            >(_buf?)?
415            .into_result::<Nl80211Marker>("message")?;
416            Ok(_response.map(|x| x))
417        }
418        self.client.send_query_and_decode::<Nl80211MessageRequest, Nl80211MessageResult>(
419            &mut payload,
420            0x6336259e15bb3795,
421            fidl::encoding::DynamicFlags::FLEXIBLE,
422            _decode,
423        )
424    }
425}
426
427pub struct Nl80211EventStream {
428    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
429}
430
431impl std::marker::Unpin for Nl80211EventStream {}
432
433impl futures::stream::FusedStream for Nl80211EventStream {
434    fn is_terminated(&self) -> bool {
435        self.event_receiver.is_terminated()
436    }
437}
438
439impl futures::Stream for Nl80211EventStream {
440    type Item = Result<Nl80211Event, fidl::Error>;
441
442    fn poll_next(
443        mut self: std::pin::Pin<&mut Self>,
444        cx: &mut std::task::Context<'_>,
445    ) -> std::task::Poll<Option<Self::Item>> {
446        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
447            &mut self.event_receiver,
448            cx
449        )?) {
450            Some(buf) => std::task::Poll::Ready(Some(Nl80211Event::decode(buf))),
451            None => std::task::Poll::Ready(None),
452        }
453    }
454}
455
456#[derive(Debug)]
457pub enum Nl80211Event {
458    #[non_exhaustive]
459    _UnknownEvent {
460        /// Ordinal of the event that was sent.
461        ordinal: u64,
462    },
463}
464
465impl Nl80211Event {
466    /// Decodes a message buffer as a [`Nl80211Event`].
467    fn decode(
468        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
469    ) -> Result<Nl80211Event, fidl::Error> {
470        let (bytes, _handles) = buf.split_mut();
471        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
472        debug_assert_eq!(tx_header.tx_id, 0);
473        match tx_header.ordinal {
474            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
475                Ok(Nl80211Event::_UnknownEvent { ordinal: tx_header.ordinal })
476            }
477            _ => Err(fidl::Error::UnknownOrdinal {
478                ordinal: tx_header.ordinal,
479                protocol_name: <Nl80211Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
480            }),
481        }
482    }
483}
484
485/// A Stream of incoming requests for fuchsia.wlan.wlanix/Nl80211.
486pub struct Nl80211RequestStream {
487    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
488    is_terminated: bool,
489}
490
491impl std::marker::Unpin for Nl80211RequestStream {}
492
493impl futures::stream::FusedStream for Nl80211RequestStream {
494    fn is_terminated(&self) -> bool {
495        self.is_terminated
496    }
497}
498
499impl fidl::endpoints::RequestStream for Nl80211RequestStream {
500    type Protocol = Nl80211Marker;
501    type ControlHandle = Nl80211ControlHandle;
502
503    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
504        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
505    }
506
507    fn control_handle(&self) -> Self::ControlHandle {
508        Nl80211ControlHandle { inner: self.inner.clone() }
509    }
510
511    fn into_inner(
512        self,
513    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
514    {
515        (self.inner, self.is_terminated)
516    }
517
518    fn from_inner(
519        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
520        is_terminated: bool,
521    ) -> Self {
522        Self { inner, is_terminated }
523    }
524}
525
526impl futures::Stream for Nl80211RequestStream {
527    type Item = Result<Nl80211Request, fidl::Error>;
528
529    fn poll_next(
530        mut self: std::pin::Pin<&mut Self>,
531        cx: &mut std::task::Context<'_>,
532    ) -> std::task::Poll<Option<Self::Item>> {
533        let this = &mut *self;
534        if this.inner.check_shutdown(cx) {
535            this.is_terminated = true;
536            return std::task::Poll::Ready(None);
537        }
538        if this.is_terminated {
539            panic!("polled Nl80211RequestStream after completion");
540        }
541        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
542            |bytes, handles| {
543                match this.inner.channel().read_etc(cx, bytes, handles) {
544                    std::task::Poll::Ready(Ok(())) => {}
545                    std::task::Poll::Pending => return std::task::Poll::Pending,
546                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
547                        this.is_terminated = true;
548                        return std::task::Poll::Ready(None);
549                    }
550                    std::task::Poll::Ready(Err(e)) => {
551                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
552                            e.into(),
553                        ))))
554                    }
555                }
556
557                // A message has been received from the channel
558                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
559
560                std::task::Poll::Ready(Some(match header.ordinal {
561                    0x58b73dd089681dc2 => {
562                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
563                        let mut req = fidl::new_empty!(
564                            Nl80211GetMulticastRequest,
565                            fidl::encoding::DefaultFuchsiaResourceDialect
566                        );
567                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Nl80211GetMulticastRequest>(&header, _body_bytes, handles, &mut req)?;
568                        let control_handle = Nl80211ControlHandle { inner: this.inner.clone() };
569                        Ok(Nl80211Request::GetMulticast { payload: req, control_handle })
570                    }
571                    0x6336259e15bb3795 => {
572                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
573                        let mut req = fidl::new_empty!(
574                            Nl80211MessageRequest,
575                            fidl::encoding::DefaultFuchsiaResourceDialect
576                        );
577                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Nl80211MessageRequest>(&header, _body_bytes, handles, &mut req)?;
578                        let control_handle = Nl80211ControlHandle { inner: this.inner.clone() };
579                        Ok(Nl80211Request::Message {
580                            payload: req,
581                            responder: Nl80211MessageResponder {
582                                control_handle: std::mem::ManuallyDrop::new(control_handle),
583                                tx_id: header.tx_id,
584                            },
585                        })
586                    }
587                    _ if header.tx_id == 0
588                        && header
589                            .dynamic_flags()
590                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
591                    {
592                        Ok(Nl80211Request::_UnknownMethod {
593                            ordinal: header.ordinal,
594                            control_handle: Nl80211ControlHandle { inner: this.inner.clone() },
595                            method_type: fidl::MethodType::OneWay,
596                        })
597                    }
598                    _ if header
599                        .dynamic_flags()
600                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
601                    {
602                        this.inner.send_framework_err(
603                            fidl::encoding::FrameworkErr::UnknownMethod,
604                            header.tx_id,
605                            header.ordinal,
606                            header.dynamic_flags(),
607                            (bytes, handles),
608                        )?;
609                        Ok(Nl80211Request::_UnknownMethod {
610                            ordinal: header.ordinal,
611                            control_handle: Nl80211ControlHandle { inner: this.inner.clone() },
612                            method_type: fidl::MethodType::TwoWay,
613                        })
614                    }
615                    _ => Err(fidl::Error::UnknownOrdinal {
616                        ordinal: header.ordinal,
617                        protocol_name:
618                            <Nl80211Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
619                    }),
620                }))
621            },
622        )
623    }
624}
625
626#[derive(Debug)]
627pub enum Nl80211Request {
628    GetMulticast {
629        payload: Nl80211GetMulticastRequest,
630        control_handle: Nl80211ControlHandle,
631    },
632    Message {
633        payload: Nl80211MessageRequest,
634        responder: Nl80211MessageResponder,
635    },
636    /// An interaction was received which does not match any known method.
637    #[non_exhaustive]
638    _UnknownMethod {
639        /// Ordinal of the method that was called.
640        ordinal: u64,
641        control_handle: Nl80211ControlHandle,
642        method_type: fidl::MethodType,
643    },
644}
645
646impl Nl80211Request {
647    #[allow(irrefutable_let_patterns)]
648    pub fn into_get_multicast(self) -> Option<(Nl80211GetMulticastRequest, Nl80211ControlHandle)> {
649        if let Nl80211Request::GetMulticast { payload, control_handle } = self {
650            Some((payload, control_handle))
651        } else {
652            None
653        }
654    }
655
656    #[allow(irrefutable_let_patterns)]
657    pub fn into_message(self) -> Option<(Nl80211MessageRequest, Nl80211MessageResponder)> {
658        if let Nl80211Request::Message { payload, responder } = self {
659            Some((payload, responder))
660        } else {
661            None
662        }
663    }
664
665    /// Name of the method defined in FIDL
666    pub fn method_name(&self) -> &'static str {
667        match *self {
668            Nl80211Request::GetMulticast { .. } => "get_multicast",
669            Nl80211Request::Message { .. } => "message",
670            Nl80211Request::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
671                "unknown one-way method"
672            }
673            Nl80211Request::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
674                "unknown two-way method"
675            }
676        }
677    }
678}
679
680#[derive(Debug, Clone)]
681pub struct Nl80211ControlHandle {
682    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
683}
684
685impl fidl::endpoints::ControlHandle for Nl80211ControlHandle {
686    fn shutdown(&self) {
687        self.inner.shutdown()
688    }
689    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
690        self.inner.shutdown_with_epitaph(status)
691    }
692
693    fn is_closed(&self) -> bool {
694        self.inner.channel().is_closed()
695    }
696    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
697        self.inner.channel().on_closed()
698    }
699
700    #[cfg(target_os = "fuchsia")]
701    fn signal_peer(
702        &self,
703        clear_mask: zx::Signals,
704        set_mask: zx::Signals,
705    ) -> Result<(), zx_status::Status> {
706        use fidl::Peered;
707        self.inner.channel().signal_peer(clear_mask, set_mask)
708    }
709}
710
711impl Nl80211ControlHandle {}
712
713#[must_use = "FIDL methods require a response to be sent"]
714#[derive(Debug)]
715pub struct Nl80211MessageResponder {
716    control_handle: std::mem::ManuallyDrop<Nl80211ControlHandle>,
717    tx_id: u32,
718}
719
720/// Set the the channel to be shutdown (see [`Nl80211ControlHandle::shutdown`])
721/// if the responder is dropped without sending a response, so that the client
722/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
723impl std::ops::Drop for Nl80211MessageResponder {
724    fn drop(&mut self) {
725        self.control_handle.shutdown();
726        // Safety: drops once, never accessed again
727        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
728    }
729}
730
731impl fidl::endpoints::Responder for Nl80211MessageResponder {
732    type ControlHandle = Nl80211ControlHandle;
733
734    fn control_handle(&self) -> &Nl80211ControlHandle {
735        &self.control_handle
736    }
737
738    fn drop_without_shutdown(mut self) {
739        // Safety: drops once, never accessed again due to mem::forget
740        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
741        // Prevent Drop from running (which would shut down the channel)
742        std::mem::forget(self);
743    }
744}
745
746impl Nl80211MessageResponder {
747    /// Sends a response to the FIDL transaction.
748    ///
749    /// Sets the channel to shutdown if an error occurs.
750    pub fn send(self, mut result: Result<Nl80211MessageResponse, i32>) -> Result<(), fidl::Error> {
751        let _result = self.send_raw(result);
752        if _result.is_err() {
753            self.control_handle.shutdown();
754        }
755        self.drop_without_shutdown();
756        _result
757    }
758
759    /// Similar to "send" but does not shutdown the channel if an error occurs.
760    pub fn send_no_shutdown_on_err(
761        self,
762        mut result: Result<Nl80211MessageResponse, i32>,
763    ) -> Result<(), fidl::Error> {
764        let _result = self.send_raw(result);
765        self.drop_without_shutdown();
766        _result
767    }
768
769    fn send_raw(&self, mut result: Result<Nl80211MessageResponse, i32>) -> Result<(), fidl::Error> {
770        self.control_handle
771            .inner
772            .send::<fidl::encoding::FlexibleResultType<Nl80211MessageResponse, i32>>(
773                fidl::encoding::FlexibleResult::new(result.as_mut().map_err(|e| *e)),
774                self.tx_id,
775                0x6336259e15bb3795,
776                fidl::encoding::DynamicFlags::FLEXIBLE,
777            )
778    }
779}
780
781#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
782pub struct Nl80211MulticastMarker;
783
784impl fidl::endpoints::ProtocolMarker for Nl80211MulticastMarker {
785    type Proxy = Nl80211MulticastProxy;
786    type RequestStream = Nl80211MulticastRequestStream;
787    #[cfg(target_os = "fuchsia")]
788    type SynchronousProxy = Nl80211MulticastSynchronousProxy;
789
790    const DEBUG_NAME: &'static str = "(anonymous) Nl80211Multicast";
791}
792
793pub trait Nl80211MulticastProxyInterface: Send + Sync {
794    fn r#message(&self, payload: Nl80211MulticastMessageRequest) -> Result<(), fidl::Error>;
795}
796#[derive(Debug)]
797#[cfg(target_os = "fuchsia")]
798pub struct Nl80211MulticastSynchronousProxy {
799    client: fidl::client::sync::Client,
800}
801
802#[cfg(target_os = "fuchsia")]
803impl fidl::endpoints::SynchronousProxy for Nl80211MulticastSynchronousProxy {
804    type Proxy = Nl80211MulticastProxy;
805    type Protocol = Nl80211MulticastMarker;
806
807    fn from_channel(inner: fidl::Channel) -> Self {
808        Self::new(inner)
809    }
810
811    fn into_channel(self) -> fidl::Channel {
812        self.client.into_channel()
813    }
814
815    fn as_channel(&self) -> &fidl::Channel {
816        self.client.as_channel()
817    }
818}
819
820#[cfg(target_os = "fuchsia")]
821impl Nl80211MulticastSynchronousProxy {
822    pub fn new(channel: fidl::Channel) -> Self {
823        let protocol_name = <Nl80211MulticastMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
824        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
825    }
826
827    pub fn into_channel(self) -> fidl::Channel {
828        self.client.into_channel()
829    }
830
831    /// Waits until an event arrives and returns it. It is safe for other
832    /// threads to make concurrent requests while waiting for an event.
833    pub fn wait_for_event(
834        &self,
835        deadline: zx::MonotonicInstant,
836    ) -> Result<Nl80211MulticastEvent, fidl::Error> {
837        Nl80211MulticastEvent::decode(self.client.wait_for_event(deadline)?)
838    }
839
840    pub fn r#message(
841        &self,
842        mut payload: Nl80211MulticastMessageRequest,
843    ) -> Result<(), fidl::Error> {
844        self.client.send::<Nl80211MulticastMessageRequest>(
845            &mut payload,
846            0x4cc9241f302f16c0,
847            fidl::encoding::DynamicFlags::FLEXIBLE,
848        )
849    }
850}
851
852#[cfg(target_os = "fuchsia")]
853impl From<Nl80211MulticastSynchronousProxy> for zx::Handle {
854    fn from(value: Nl80211MulticastSynchronousProxy) -> Self {
855        value.into_channel().into()
856    }
857}
858
859#[cfg(target_os = "fuchsia")]
860impl From<fidl::Channel> for Nl80211MulticastSynchronousProxy {
861    fn from(value: fidl::Channel) -> Self {
862        Self::new(value)
863    }
864}
865
866#[derive(Debug, Clone)]
867pub struct Nl80211MulticastProxy {
868    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
869}
870
871impl fidl::endpoints::Proxy for Nl80211MulticastProxy {
872    type Protocol = Nl80211MulticastMarker;
873
874    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
875        Self::new(inner)
876    }
877
878    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
879        self.client.into_channel().map_err(|client| Self { client })
880    }
881
882    fn as_channel(&self) -> &::fidl::AsyncChannel {
883        self.client.as_channel()
884    }
885}
886
887impl Nl80211MulticastProxy {
888    /// Create a new Proxy for fuchsia.wlan.wlanix/Nl80211Multicast.
889    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
890        let protocol_name = <Nl80211MulticastMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
891        Self { client: fidl::client::Client::new(channel, protocol_name) }
892    }
893
894    /// Get a Stream of events from the remote end of the protocol.
895    ///
896    /// # Panics
897    ///
898    /// Panics if the event stream was already taken.
899    pub fn take_event_stream(&self) -> Nl80211MulticastEventStream {
900        Nl80211MulticastEventStream { event_receiver: self.client.take_event_receiver() }
901    }
902
903    pub fn r#message(
904        &self,
905        mut payload: Nl80211MulticastMessageRequest,
906    ) -> Result<(), fidl::Error> {
907        Nl80211MulticastProxyInterface::r#message(self, payload)
908    }
909}
910
911impl Nl80211MulticastProxyInterface for Nl80211MulticastProxy {
912    fn r#message(&self, mut payload: Nl80211MulticastMessageRequest) -> Result<(), fidl::Error> {
913        self.client.send::<Nl80211MulticastMessageRequest>(
914            &mut payload,
915            0x4cc9241f302f16c0,
916            fidl::encoding::DynamicFlags::FLEXIBLE,
917        )
918    }
919}
920
921pub struct Nl80211MulticastEventStream {
922    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
923}
924
925impl std::marker::Unpin for Nl80211MulticastEventStream {}
926
927impl futures::stream::FusedStream for Nl80211MulticastEventStream {
928    fn is_terminated(&self) -> bool {
929        self.event_receiver.is_terminated()
930    }
931}
932
933impl futures::Stream for Nl80211MulticastEventStream {
934    type Item = Result<Nl80211MulticastEvent, fidl::Error>;
935
936    fn poll_next(
937        mut self: std::pin::Pin<&mut Self>,
938        cx: &mut std::task::Context<'_>,
939    ) -> std::task::Poll<Option<Self::Item>> {
940        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
941            &mut self.event_receiver,
942            cx
943        )?) {
944            Some(buf) => std::task::Poll::Ready(Some(Nl80211MulticastEvent::decode(buf))),
945            None => std::task::Poll::Ready(None),
946        }
947    }
948}
949
950#[derive(Debug)]
951pub enum Nl80211MulticastEvent {
952    #[non_exhaustive]
953    _UnknownEvent {
954        /// Ordinal of the event that was sent.
955        ordinal: u64,
956    },
957}
958
959impl Nl80211MulticastEvent {
960    /// Decodes a message buffer as a [`Nl80211MulticastEvent`].
961    fn decode(
962        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
963    ) -> Result<Nl80211MulticastEvent, fidl::Error> {
964        let (bytes, _handles) = buf.split_mut();
965        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
966        debug_assert_eq!(tx_header.tx_id, 0);
967        match tx_header.ordinal {
968            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
969                Ok(Nl80211MulticastEvent::_UnknownEvent { ordinal: tx_header.ordinal })
970            }
971            _ => Err(fidl::Error::UnknownOrdinal {
972                ordinal: tx_header.ordinal,
973                protocol_name:
974                    <Nl80211MulticastMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
975            }),
976        }
977    }
978}
979
980/// A Stream of incoming requests for fuchsia.wlan.wlanix/Nl80211Multicast.
981pub struct Nl80211MulticastRequestStream {
982    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
983    is_terminated: bool,
984}
985
986impl std::marker::Unpin for Nl80211MulticastRequestStream {}
987
988impl futures::stream::FusedStream for Nl80211MulticastRequestStream {
989    fn is_terminated(&self) -> bool {
990        self.is_terminated
991    }
992}
993
994impl fidl::endpoints::RequestStream for Nl80211MulticastRequestStream {
995    type Protocol = Nl80211MulticastMarker;
996    type ControlHandle = Nl80211MulticastControlHandle;
997
998    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
999        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1000    }
1001
1002    fn control_handle(&self) -> Self::ControlHandle {
1003        Nl80211MulticastControlHandle { inner: self.inner.clone() }
1004    }
1005
1006    fn into_inner(
1007        self,
1008    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1009    {
1010        (self.inner, self.is_terminated)
1011    }
1012
1013    fn from_inner(
1014        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1015        is_terminated: bool,
1016    ) -> Self {
1017        Self { inner, is_terminated }
1018    }
1019}
1020
1021impl futures::Stream for Nl80211MulticastRequestStream {
1022    type Item = Result<Nl80211MulticastRequest, fidl::Error>;
1023
1024    fn poll_next(
1025        mut self: std::pin::Pin<&mut Self>,
1026        cx: &mut std::task::Context<'_>,
1027    ) -> std::task::Poll<Option<Self::Item>> {
1028        let this = &mut *self;
1029        if this.inner.check_shutdown(cx) {
1030            this.is_terminated = true;
1031            return std::task::Poll::Ready(None);
1032        }
1033        if this.is_terminated {
1034            panic!("polled Nl80211MulticastRequestStream after completion");
1035        }
1036        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1037            |bytes, handles| {
1038                match this.inner.channel().read_etc(cx, bytes, handles) {
1039                    std::task::Poll::Ready(Ok(())) => {}
1040                    std::task::Poll::Pending => return std::task::Poll::Pending,
1041                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1042                        this.is_terminated = true;
1043                        return std::task::Poll::Ready(None);
1044                    }
1045                    std::task::Poll::Ready(Err(e)) => {
1046                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1047                            e.into(),
1048                        ))))
1049                    }
1050                }
1051
1052                // A message has been received from the channel
1053                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1054
1055                std::task::Poll::Ready(Some(match header.ordinal {
1056                    0x4cc9241f302f16c0 => {
1057                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1058                        let mut req = fidl::new_empty!(
1059                            Nl80211MulticastMessageRequest,
1060                            fidl::encoding::DefaultFuchsiaResourceDialect
1061                        );
1062                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Nl80211MulticastMessageRequest>(&header, _body_bytes, handles, &mut req)?;
1063                        let control_handle =
1064                            Nl80211MulticastControlHandle { inner: this.inner.clone() };
1065                        Ok(Nl80211MulticastRequest::Message { payload: req, control_handle })
1066                    }
1067                    _ if header.tx_id == 0
1068                        && header
1069                            .dynamic_flags()
1070                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1071                    {
1072                        Ok(Nl80211MulticastRequest::_UnknownMethod {
1073                            ordinal: header.ordinal,
1074                            control_handle: Nl80211MulticastControlHandle {
1075                                inner: this.inner.clone(),
1076                            },
1077                            method_type: fidl::MethodType::OneWay,
1078                        })
1079                    }
1080                    _ if header
1081                        .dynamic_flags()
1082                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1083                    {
1084                        this.inner.send_framework_err(
1085                            fidl::encoding::FrameworkErr::UnknownMethod,
1086                            header.tx_id,
1087                            header.ordinal,
1088                            header.dynamic_flags(),
1089                            (bytes, handles),
1090                        )?;
1091                        Ok(Nl80211MulticastRequest::_UnknownMethod {
1092                            ordinal: header.ordinal,
1093                            control_handle: Nl80211MulticastControlHandle {
1094                                inner: this.inner.clone(),
1095                            },
1096                            method_type: fidl::MethodType::TwoWay,
1097                        })
1098                    }
1099                    _ => Err(fidl::Error::UnknownOrdinal {
1100                        ordinal: header.ordinal,
1101                        protocol_name:
1102                            <Nl80211MulticastMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1103                    }),
1104                }))
1105            },
1106        )
1107    }
1108}
1109
1110#[derive(Debug)]
1111pub enum Nl80211MulticastRequest {
1112    Message {
1113        payload: Nl80211MulticastMessageRequest,
1114        control_handle: Nl80211MulticastControlHandle,
1115    },
1116    /// An interaction was received which does not match any known method.
1117    #[non_exhaustive]
1118    _UnknownMethod {
1119        /// Ordinal of the method that was called.
1120        ordinal: u64,
1121        control_handle: Nl80211MulticastControlHandle,
1122        method_type: fidl::MethodType,
1123    },
1124}
1125
1126impl Nl80211MulticastRequest {
1127    #[allow(irrefutable_let_patterns)]
1128    pub fn into_message(
1129        self,
1130    ) -> Option<(Nl80211MulticastMessageRequest, Nl80211MulticastControlHandle)> {
1131        if let Nl80211MulticastRequest::Message { payload, control_handle } = self {
1132            Some((payload, control_handle))
1133        } else {
1134            None
1135        }
1136    }
1137
1138    /// Name of the method defined in FIDL
1139    pub fn method_name(&self) -> &'static str {
1140        match *self {
1141            Nl80211MulticastRequest::Message { .. } => "message",
1142            Nl80211MulticastRequest::_UnknownMethod {
1143                method_type: fidl::MethodType::OneWay,
1144                ..
1145            } => "unknown one-way method",
1146            Nl80211MulticastRequest::_UnknownMethod {
1147                method_type: fidl::MethodType::TwoWay,
1148                ..
1149            } => "unknown two-way method",
1150        }
1151    }
1152}
1153
1154#[derive(Debug, Clone)]
1155pub struct Nl80211MulticastControlHandle {
1156    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1157}
1158
1159impl fidl::endpoints::ControlHandle for Nl80211MulticastControlHandle {
1160    fn shutdown(&self) {
1161        self.inner.shutdown()
1162    }
1163    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1164        self.inner.shutdown_with_epitaph(status)
1165    }
1166
1167    fn is_closed(&self) -> bool {
1168        self.inner.channel().is_closed()
1169    }
1170    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1171        self.inner.channel().on_closed()
1172    }
1173
1174    #[cfg(target_os = "fuchsia")]
1175    fn signal_peer(
1176        &self,
1177        clear_mask: zx::Signals,
1178        set_mask: zx::Signals,
1179    ) -> Result<(), zx_status::Status> {
1180        use fidl::Peered;
1181        self.inner.channel().signal_peer(clear_mask, set_mask)
1182    }
1183}
1184
1185impl Nl80211MulticastControlHandle {}
1186
1187#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1188pub struct SupplicantMarker;
1189
1190impl fidl::endpoints::ProtocolMarker for SupplicantMarker {
1191    type Proxy = SupplicantProxy;
1192    type RequestStream = SupplicantRequestStream;
1193    #[cfg(target_os = "fuchsia")]
1194    type SynchronousProxy = SupplicantSynchronousProxy;
1195
1196    const DEBUG_NAME: &'static str = "(anonymous) Supplicant";
1197}
1198
1199pub trait SupplicantProxyInterface: Send + Sync {
1200    fn r#add_sta_interface(
1201        &self,
1202        payload: SupplicantAddStaInterfaceRequest,
1203    ) -> Result<(), fidl::Error>;
1204}
1205#[derive(Debug)]
1206#[cfg(target_os = "fuchsia")]
1207pub struct SupplicantSynchronousProxy {
1208    client: fidl::client::sync::Client,
1209}
1210
1211#[cfg(target_os = "fuchsia")]
1212impl fidl::endpoints::SynchronousProxy for SupplicantSynchronousProxy {
1213    type Proxy = SupplicantProxy;
1214    type Protocol = SupplicantMarker;
1215
1216    fn from_channel(inner: fidl::Channel) -> Self {
1217        Self::new(inner)
1218    }
1219
1220    fn into_channel(self) -> fidl::Channel {
1221        self.client.into_channel()
1222    }
1223
1224    fn as_channel(&self) -> &fidl::Channel {
1225        self.client.as_channel()
1226    }
1227}
1228
1229#[cfg(target_os = "fuchsia")]
1230impl SupplicantSynchronousProxy {
1231    pub fn new(channel: fidl::Channel) -> Self {
1232        let protocol_name = <SupplicantMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1233        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1234    }
1235
1236    pub fn into_channel(self) -> fidl::Channel {
1237        self.client.into_channel()
1238    }
1239
1240    /// Waits until an event arrives and returns it. It is safe for other
1241    /// threads to make concurrent requests while waiting for an event.
1242    pub fn wait_for_event(
1243        &self,
1244        deadline: zx::MonotonicInstant,
1245    ) -> Result<SupplicantEvent, fidl::Error> {
1246        SupplicantEvent::decode(self.client.wait_for_event(deadline)?)
1247    }
1248
1249    pub fn r#add_sta_interface(
1250        &self,
1251        mut payload: SupplicantAddStaInterfaceRequest,
1252    ) -> Result<(), fidl::Error> {
1253        self.client.send::<SupplicantAddStaInterfaceRequest>(
1254            &mut payload,
1255            0x73194b2afe9b367e,
1256            fidl::encoding::DynamicFlags::FLEXIBLE,
1257        )
1258    }
1259}
1260
1261#[cfg(target_os = "fuchsia")]
1262impl From<SupplicantSynchronousProxy> for zx::Handle {
1263    fn from(value: SupplicantSynchronousProxy) -> Self {
1264        value.into_channel().into()
1265    }
1266}
1267
1268#[cfg(target_os = "fuchsia")]
1269impl From<fidl::Channel> for SupplicantSynchronousProxy {
1270    fn from(value: fidl::Channel) -> Self {
1271        Self::new(value)
1272    }
1273}
1274
1275#[derive(Debug, Clone)]
1276pub struct SupplicantProxy {
1277    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1278}
1279
1280impl fidl::endpoints::Proxy for SupplicantProxy {
1281    type Protocol = SupplicantMarker;
1282
1283    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1284        Self::new(inner)
1285    }
1286
1287    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1288        self.client.into_channel().map_err(|client| Self { client })
1289    }
1290
1291    fn as_channel(&self) -> &::fidl::AsyncChannel {
1292        self.client.as_channel()
1293    }
1294}
1295
1296impl SupplicantProxy {
1297    /// Create a new Proxy for fuchsia.wlan.wlanix/Supplicant.
1298    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1299        let protocol_name = <SupplicantMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1300        Self { client: fidl::client::Client::new(channel, protocol_name) }
1301    }
1302
1303    /// Get a Stream of events from the remote end of the protocol.
1304    ///
1305    /// # Panics
1306    ///
1307    /// Panics if the event stream was already taken.
1308    pub fn take_event_stream(&self) -> SupplicantEventStream {
1309        SupplicantEventStream { event_receiver: self.client.take_event_receiver() }
1310    }
1311
1312    pub fn r#add_sta_interface(
1313        &self,
1314        mut payload: SupplicantAddStaInterfaceRequest,
1315    ) -> Result<(), fidl::Error> {
1316        SupplicantProxyInterface::r#add_sta_interface(self, payload)
1317    }
1318}
1319
1320impl SupplicantProxyInterface for SupplicantProxy {
1321    fn r#add_sta_interface(
1322        &self,
1323        mut payload: SupplicantAddStaInterfaceRequest,
1324    ) -> Result<(), fidl::Error> {
1325        self.client.send::<SupplicantAddStaInterfaceRequest>(
1326            &mut payload,
1327            0x73194b2afe9b367e,
1328            fidl::encoding::DynamicFlags::FLEXIBLE,
1329        )
1330    }
1331}
1332
1333pub struct SupplicantEventStream {
1334    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1335}
1336
1337impl std::marker::Unpin for SupplicantEventStream {}
1338
1339impl futures::stream::FusedStream for SupplicantEventStream {
1340    fn is_terminated(&self) -> bool {
1341        self.event_receiver.is_terminated()
1342    }
1343}
1344
1345impl futures::Stream for SupplicantEventStream {
1346    type Item = Result<SupplicantEvent, fidl::Error>;
1347
1348    fn poll_next(
1349        mut self: std::pin::Pin<&mut Self>,
1350        cx: &mut std::task::Context<'_>,
1351    ) -> std::task::Poll<Option<Self::Item>> {
1352        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1353            &mut self.event_receiver,
1354            cx
1355        )?) {
1356            Some(buf) => std::task::Poll::Ready(Some(SupplicantEvent::decode(buf))),
1357            None => std::task::Poll::Ready(None),
1358        }
1359    }
1360}
1361
1362#[derive(Debug)]
1363pub enum SupplicantEvent {
1364    #[non_exhaustive]
1365    _UnknownEvent {
1366        /// Ordinal of the event that was sent.
1367        ordinal: u64,
1368    },
1369}
1370
1371impl SupplicantEvent {
1372    /// Decodes a message buffer as a [`SupplicantEvent`].
1373    fn decode(
1374        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1375    ) -> Result<SupplicantEvent, fidl::Error> {
1376        let (bytes, _handles) = buf.split_mut();
1377        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1378        debug_assert_eq!(tx_header.tx_id, 0);
1379        match tx_header.ordinal {
1380            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1381                Ok(SupplicantEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1382            }
1383            _ => Err(fidl::Error::UnknownOrdinal {
1384                ordinal: tx_header.ordinal,
1385                protocol_name: <SupplicantMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1386            }),
1387        }
1388    }
1389}
1390
1391/// A Stream of incoming requests for fuchsia.wlan.wlanix/Supplicant.
1392pub struct SupplicantRequestStream {
1393    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1394    is_terminated: bool,
1395}
1396
1397impl std::marker::Unpin for SupplicantRequestStream {}
1398
1399impl futures::stream::FusedStream for SupplicantRequestStream {
1400    fn is_terminated(&self) -> bool {
1401        self.is_terminated
1402    }
1403}
1404
1405impl fidl::endpoints::RequestStream for SupplicantRequestStream {
1406    type Protocol = SupplicantMarker;
1407    type ControlHandle = SupplicantControlHandle;
1408
1409    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1410        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1411    }
1412
1413    fn control_handle(&self) -> Self::ControlHandle {
1414        SupplicantControlHandle { inner: self.inner.clone() }
1415    }
1416
1417    fn into_inner(
1418        self,
1419    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1420    {
1421        (self.inner, self.is_terminated)
1422    }
1423
1424    fn from_inner(
1425        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1426        is_terminated: bool,
1427    ) -> Self {
1428        Self { inner, is_terminated }
1429    }
1430}
1431
1432impl futures::Stream for SupplicantRequestStream {
1433    type Item = Result<SupplicantRequest, fidl::Error>;
1434
1435    fn poll_next(
1436        mut self: std::pin::Pin<&mut Self>,
1437        cx: &mut std::task::Context<'_>,
1438    ) -> std::task::Poll<Option<Self::Item>> {
1439        let this = &mut *self;
1440        if this.inner.check_shutdown(cx) {
1441            this.is_terminated = true;
1442            return std::task::Poll::Ready(None);
1443        }
1444        if this.is_terminated {
1445            panic!("polled SupplicantRequestStream after completion");
1446        }
1447        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1448            |bytes, handles| {
1449                match this.inner.channel().read_etc(cx, bytes, handles) {
1450                    std::task::Poll::Ready(Ok(())) => {}
1451                    std::task::Poll::Pending => return std::task::Poll::Pending,
1452                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1453                        this.is_terminated = true;
1454                        return std::task::Poll::Ready(None);
1455                    }
1456                    std::task::Poll::Ready(Err(e)) => {
1457                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1458                            e.into(),
1459                        ))))
1460                    }
1461                }
1462
1463                // A message has been received from the channel
1464                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1465
1466                std::task::Poll::Ready(Some(match header.ordinal {
1467                    0x73194b2afe9b367e => {
1468                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1469                        let mut req = fidl::new_empty!(
1470                            SupplicantAddStaInterfaceRequest,
1471                            fidl::encoding::DefaultFuchsiaResourceDialect
1472                        );
1473                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantAddStaInterfaceRequest>(&header, _body_bytes, handles, &mut req)?;
1474                        let control_handle = SupplicantControlHandle { inner: this.inner.clone() };
1475                        Ok(SupplicantRequest::AddStaInterface { payload: req, control_handle })
1476                    }
1477                    _ if header.tx_id == 0
1478                        && header
1479                            .dynamic_flags()
1480                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1481                    {
1482                        Ok(SupplicantRequest::_UnknownMethod {
1483                            ordinal: header.ordinal,
1484                            control_handle: SupplicantControlHandle { inner: this.inner.clone() },
1485                            method_type: fidl::MethodType::OneWay,
1486                        })
1487                    }
1488                    _ if header
1489                        .dynamic_flags()
1490                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1491                    {
1492                        this.inner.send_framework_err(
1493                            fidl::encoding::FrameworkErr::UnknownMethod,
1494                            header.tx_id,
1495                            header.ordinal,
1496                            header.dynamic_flags(),
1497                            (bytes, handles),
1498                        )?;
1499                        Ok(SupplicantRequest::_UnknownMethod {
1500                            ordinal: header.ordinal,
1501                            control_handle: SupplicantControlHandle { inner: this.inner.clone() },
1502                            method_type: fidl::MethodType::TwoWay,
1503                        })
1504                    }
1505                    _ => Err(fidl::Error::UnknownOrdinal {
1506                        ordinal: header.ordinal,
1507                        protocol_name:
1508                            <SupplicantMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1509                    }),
1510                }))
1511            },
1512        )
1513    }
1514}
1515
1516#[derive(Debug)]
1517pub enum SupplicantRequest {
1518    AddStaInterface {
1519        payload: SupplicantAddStaInterfaceRequest,
1520        control_handle: SupplicantControlHandle,
1521    },
1522    /// An interaction was received which does not match any known method.
1523    #[non_exhaustive]
1524    _UnknownMethod {
1525        /// Ordinal of the method that was called.
1526        ordinal: u64,
1527        control_handle: SupplicantControlHandle,
1528        method_type: fidl::MethodType,
1529    },
1530}
1531
1532impl SupplicantRequest {
1533    #[allow(irrefutable_let_patterns)]
1534    pub fn into_add_sta_interface(
1535        self,
1536    ) -> Option<(SupplicantAddStaInterfaceRequest, SupplicantControlHandle)> {
1537        if let SupplicantRequest::AddStaInterface { payload, control_handle } = self {
1538            Some((payload, control_handle))
1539        } else {
1540            None
1541        }
1542    }
1543
1544    /// Name of the method defined in FIDL
1545    pub fn method_name(&self) -> &'static str {
1546        match *self {
1547            SupplicantRequest::AddStaInterface { .. } => "add_sta_interface",
1548            SupplicantRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1549                "unknown one-way method"
1550            }
1551            SupplicantRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1552                "unknown two-way method"
1553            }
1554        }
1555    }
1556}
1557
1558#[derive(Debug, Clone)]
1559pub struct SupplicantControlHandle {
1560    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1561}
1562
1563impl fidl::endpoints::ControlHandle for SupplicantControlHandle {
1564    fn shutdown(&self) {
1565        self.inner.shutdown()
1566    }
1567    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1568        self.inner.shutdown_with_epitaph(status)
1569    }
1570
1571    fn is_closed(&self) -> bool {
1572        self.inner.channel().is_closed()
1573    }
1574    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1575        self.inner.channel().on_closed()
1576    }
1577
1578    #[cfg(target_os = "fuchsia")]
1579    fn signal_peer(
1580        &self,
1581        clear_mask: zx::Signals,
1582        set_mask: zx::Signals,
1583    ) -> Result<(), zx_status::Status> {
1584        use fidl::Peered;
1585        self.inner.channel().signal_peer(clear_mask, set_mask)
1586    }
1587}
1588
1589impl SupplicantControlHandle {}
1590
1591#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1592pub struct SupplicantStaIfaceMarker;
1593
1594impl fidl::endpoints::ProtocolMarker for SupplicantStaIfaceMarker {
1595    type Proxy = SupplicantStaIfaceProxy;
1596    type RequestStream = SupplicantStaIfaceRequestStream;
1597    #[cfg(target_os = "fuchsia")]
1598    type SynchronousProxy = SupplicantStaIfaceSynchronousProxy;
1599
1600    const DEBUG_NAME: &'static str = "(anonymous) SupplicantStaIface";
1601}
1602pub type SupplicantStaIfaceGetMacAddressResult =
1603    Result<SupplicantStaIfaceGetMacAddressResponse, i32>;
1604pub type SupplicantStaIfaceSetStaCountryCodeResult = Result<(), i32>;
1605
1606pub trait SupplicantStaIfaceProxyInterface: Send + Sync {
1607    fn r#register_callback(
1608        &self,
1609        payload: SupplicantStaIfaceRegisterCallbackRequest,
1610    ) -> Result<(), fidl::Error>;
1611    fn r#add_network(
1612        &self,
1613        payload: SupplicantStaIfaceAddNetworkRequest,
1614    ) -> Result<(), fidl::Error>;
1615    type DisconnectResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1616    fn r#disconnect(&self) -> Self::DisconnectResponseFut;
1617    type GetMacAddressResponseFut: std::future::Future<Output = Result<SupplicantStaIfaceGetMacAddressResult, fidl::Error>>
1618        + Send;
1619    fn r#get_mac_address(&self) -> Self::GetMacAddressResponseFut;
1620    type SetPowerSaveResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1621    fn r#set_power_save(
1622        &self,
1623        payload: SupplicantStaIfaceSetPowerSaveRequest,
1624    ) -> Self::SetPowerSaveResponseFut;
1625    type SetSuspendModeEnabledResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
1626        + Send;
1627    fn r#set_suspend_mode_enabled(
1628        &self,
1629        payload: SupplicantStaIfaceSetSuspendModeEnabledRequest,
1630    ) -> Self::SetSuspendModeEnabledResponseFut;
1631    type SetStaCountryCodeResponseFut: std::future::Future<Output = Result<SupplicantStaIfaceSetStaCountryCodeResult, fidl::Error>>
1632        + Send;
1633    fn r#set_sta_country_code(
1634        &self,
1635        payload: SupplicantStaIfaceSetStaCountryCodeRequest,
1636    ) -> Self::SetStaCountryCodeResponseFut;
1637}
1638#[derive(Debug)]
1639#[cfg(target_os = "fuchsia")]
1640pub struct SupplicantStaIfaceSynchronousProxy {
1641    client: fidl::client::sync::Client,
1642}
1643
1644#[cfg(target_os = "fuchsia")]
1645impl fidl::endpoints::SynchronousProxy for SupplicantStaIfaceSynchronousProxy {
1646    type Proxy = SupplicantStaIfaceProxy;
1647    type Protocol = SupplicantStaIfaceMarker;
1648
1649    fn from_channel(inner: fidl::Channel) -> Self {
1650        Self::new(inner)
1651    }
1652
1653    fn into_channel(self) -> fidl::Channel {
1654        self.client.into_channel()
1655    }
1656
1657    fn as_channel(&self) -> &fidl::Channel {
1658        self.client.as_channel()
1659    }
1660}
1661
1662#[cfg(target_os = "fuchsia")]
1663impl SupplicantStaIfaceSynchronousProxy {
1664    pub fn new(channel: fidl::Channel) -> Self {
1665        let protocol_name =
1666            <SupplicantStaIfaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1667        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1668    }
1669
1670    pub fn into_channel(self) -> fidl::Channel {
1671        self.client.into_channel()
1672    }
1673
1674    /// Waits until an event arrives and returns it. It is safe for other
1675    /// threads to make concurrent requests while waiting for an event.
1676    pub fn wait_for_event(
1677        &self,
1678        deadline: zx::MonotonicInstant,
1679    ) -> Result<SupplicantStaIfaceEvent, fidl::Error> {
1680        SupplicantStaIfaceEvent::decode(self.client.wait_for_event(deadline)?)
1681    }
1682
1683    pub fn r#register_callback(
1684        &self,
1685        mut payload: SupplicantStaIfaceRegisterCallbackRequest,
1686    ) -> Result<(), fidl::Error> {
1687        self.client.send::<SupplicantStaIfaceRegisterCallbackRequest>(
1688            &mut payload,
1689            0x1be680e863a8e71,
1690            fidl::encoding::DynamicFlags::FLEXIBLE,
1691        )
1692    }
1693
1694    pub fn r#add_network(
1695        &self,
1696        mut payload: SupplicantStaIfaceAddNetworkRequest,
1697    ) -> Result<(), fidl::Error> {
1698        self.client.send::<SupplicantStaIfaceAddNetworkRequest>(
1699            &mut payload,
1700            0xa77cf60628766dc,
1701            fidl::encoding::DynamicFlags::FLEXIBLE,
1702        )
1703    }
1704
1705    pub fn r#disconnect(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
1706        let _response = self.client.send_query::<
1707            fidl::encoding::EmptyPayload,
1708            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1709        >(
1710            (),
1711            0x52a1d38e0b4871fa,
1712            fidl::encoding::DynamicFlags::FLEXIBLE,
1713            ___deadline,
1714        )?
1715        .into_result::<SupplicantStaIfaceMarker>("disconnect")?;
1716        Ok(_response)
1717    }
1718
1719    pub fn r#get_mac_address(
1720        &self,
1721        ___deadline: zx::MonotonicInstant,
1722    ) -> Result<SupplicantStaIfaceGetMacAddressResult, fidl::Error> {
1723        let _response = self.client.send_query::<
1724            fidl::encoding::EmptyPayload,
1725            fidl::encoding::FlexibleResultType<SupplicantStaIfaceGetMacAddressResponse, i32>,
1726        >(
1727            (),
1728            0x60591d204a3f537f,
1729            fidl::encoding::DynamicFlags::FLEXIBLE,
1730            ___deadline,
1731        )?
1732        .into_result::<SupplicantStaIfaceMarker>("get_mac_address")?;
1733        Ok(_response.map(|x| x))
1734    }
1735
1736    pub fn r#set_power_save(
1737        &self,
1738        mut payload: SupplicantStaIfaceSetPowerSaveRequest,
1739        ___deadline: zx::MonotonicInstant,
1740    ) -> Result<(), fidl::Error> {
1741        let _response = self.client.send_query::<
1742            SupplicantStaIfaceSetPowerSaveRequest,
1743            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1744        >(
1745            &mut payload,
1746            0x5a04c29320085298,
1747            fidl::encoding::DynamicFlags::FLEXIBLE,
1748            ___deadline,
1749        )?
1750        .into_result::<SupplicantStaIfaceMarker>("set_power_save")?;
1751        Ok(_response)
1752    }
1753
1754    pub fn r#set_suspend_mode_enabled(
1755        &self,
1756        mut payload: SupplicantStaIfaceSetSuspendModeEnabledRequest,
1757        ___deadline: zx::MonotonicInstant,
1758    ) -> Result<(), fidl::Error> {
1759        let _response = self.client.send_query::<
1760            SupplicantStaIfaceSetSuspendModeEnabledRequest,
1761            fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1762        >(
1763            &mut payload,
1764            0xaf10de85bb7023a,
1765            fidl::encoding::DynamicFlags::FLEXIBLE,
1766            ___deadline,
1767        )?
1768        .into_result::<SupplicantStaIfaceMarker>("set_suspend_mode_enabled")?;
1769        Ok(_response)
1770    }
1771
1772    pub fn r#set_sta_country_code(
1773        &self,
1774        mut payload: SupplicantStaIfaceSetStaCountryCodeRequest,
1775        ___deadline: zx::MonotonicInstant,
1776    ) -> Result<SupplicantStaIfaceSetStaCountryCodeResult, fidl::Error> {
1777        let _response = self.client.send_query::<
1778            SupplicantStaIfaceSetStaCountryCodeRequest,
1779            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1780        >(
1781            &mut payload,
1782            0x977e22f9b79b26e,
1783            fidl::encoding::DynamicFlags::FLEXIBLE,
1784            ___deadline,
1785        )?
1786        .into_result::<SupplicantStaIfaceMarker>("set_sta_country_code")?;
1787        Ok(_response.map(|x| x))
1788    }
1789}
1790
1791#[cfg(target_os = "fuchsia")]
1792impl From<SupplicantStaIfaceSynchronousProxy> for zx::Handle {
1793    fn from(value: SupplicantStaIfaceSynchronousProxy) -> Self {
1794        value.into_channel().into()
1795    }
1796}
1797
1798#[cfg(target_os = "fuchsia")]
1799impl From<fidl::Channel> for SupplicantStaIfaceSynchronousProxy {
1800    fn from(value: fidl::Channel) -> Self {
1801        Self::new(value)
1802    }
1803}
1804
1805#[derive(Debug, Clone)]
1806pub struct SupplicantStaIfaceProxy {
1807    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1808}
1809
1810impl fidl::endpoints::Proxy for SupplicantStaIfaceProxy {
1811    type Protocol = SupplicantStaIfaceMarker;
1812
1813    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1814        Self::new(inner)
1815    }
1816
1817    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1818        self.client.into_channel().map_err(|client| Self { client })
1819    }
1820
1821    fn as_channel(&self) -> &::fidl::AsyncChannel {
1822        self.client.as_channel()
1823    }
1824}
1825
1826impl SupplicantStaIfaceProxy {
1827    /// Create a new Proxy for fuchsia.wlan.wlanix/SupplicantStaIface.
1828    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1829        let protocol_name =
1830            <SupplicantStaIfaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1831        Self { client: fidl::client::Client::new(channel, protocol_name) }
1832    }
1833
1834    /// Get a Stream of events from the remote end of the protocol.
1835    ///
1836    /// # Panics
1837    ///
1838    /// Panics if the event stream was already taken.
1839    pub fn take_event_stream(&self) -> SupplicantStaIfaceEventStream {
1840        SupplicantStaIfaceEventStream { event_receiver: self.client.take_event_receiver() }
1841    }
1842
1843    pub fn r#register_callback(
1844        &self,
1845        mut payload: SupplicantStaIfaceRegisterCallbackRequest,
1846    ) -> Result<(), fidl::Error> {
1847        SupplicantStaIfaceProxyInterface::r#register_callback(self, payload)
1848    }
1849
1850    pub fn r#add_network(
1851        &self,
1852        mut payload: SupplicantStaIfaceAddNetworkRequest,
1853    ) -> Result<(), fidl::Error> {
1854        SupplicantStaIfaceProxyInterface::r#add_network(self, payload)
1855    }
1856
1857    pub fn r#disconnect(
1858        &self,
1859    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1860        SupplicantStaIfaceProxyInterface::r#disconnect(self)
1861    }
1862
1863    pub fn r#get_mac_address(
1864        &self,
1865    ) -> fidl::client::QueryResponseFut<
1866        SupplicantStaIfaceGetMacAddressResult,
1867        fidl::encoding::DefaultFuchsiaResourceDialect,
1868    > {
1869        SupplicantStaIfaceProxyInterface::r#get_mac_address(self)
1870    }
1871
1872    pub fn r#set_power_save(
1873        &self,
1874        mut payload: SupplicantStaIfaceSetPowerSaveRequest,
1875    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1876        SupplicantStaIfaceProxyInterface::r#set_power_save(self, payload)
1877    }
1878
1879    pub fn r#set_suspend_mode_enabled(
1880        &self,
1881        mut payload: SupplicantStaIfaceSetSuspendModeEnabledRequest,
1882    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1883        SupplicantStaIfaceProxyInterface::r#set_suspend_mode_enabled(self, payload)
1884    }
1885
1886    pub fn r#set_sta_country_code(
1887        &self,
1888        mut payload: SupplicantStaIfaceSetStaCountryCodeRequest,
1889    ) -> fidl::client::QueryResponseFut<
1890        SupplicantStaIfaceSetStaCountryCodeResult,
1891        fidl::encoding::DefaultFuchsiaResourceDialect,
1892    > {
1893        SupplicantStaIfaceProxyInterface::r#set_sta_country_code(self, payload)
1894    }
1895}
1896
1897impl SupplicantStaIfaceProxyInterface for SupplicantStaIfaceProxy {
1898    fn r#register_callback(
1899        &self,
1900        mut payload: SupplicantStaIfaceRegisterCallbackRequest,
1901    ) -> Result<(), fidl::Error> {
1902        self.client.send::<SupplicantStaIfaceRegisterCallbackRequest>(
1903            &mut payload,
1904            0x1be680e863a8e71,
1905            fidl::encoding::DynamicFlags::FLEXIBLE,
1906        )
1907    }
1908
1909    fn r#add_network(
1910        &self,
1911        mut payload: SupplicantStaIfaceAddNetworkRequest,
1912    ) -> Result<(), fidl::Error> {
1913        self.client.send::<SupplicantStaIfaceAddNetworkRequest>(
1914            &mut payload,
1915            0xa77cf60628766dc,
1916            fidl::encoding::DynamicFlags::FLEXIBLE,
1917        )
1918    }
1919
1920    type DisconnectResponseFut =
1921        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1922    fn r#disconnect(&self) -> Self::DisconnectResponseFut {
1923        fn _decode(
1924            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1925        ) -> Result<(), fidl::Error> {
1926            let _response = fidl::client::decode_transaction_body::<
1927                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1928                fidl::encoding::DefaultFuchsiaResourceDialect,
1929                0x52a1d38e0b4871fa,
1930            >(_buf?)?
1931            .into_result::<SupplicantStaIfaceMarker>("disconnect")?;
1932            Ok(_response)
1933        }
1934        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
1935            (),
1936            0x52a1d38e0b4871fa,
1937            fidl::encoding::DynamicFlags::FLEXIBLE,
1938            _decode,
1939        )
1940    }
1941
1942    type GetMacAddressResponseFut = fidl::client::QueryResponseFut<
1943        SupplicantStaIfaceGetMacAddressResult,
1944        fidl::encoding::DefaultFuchsiaResourceDialect,
1945    >;
1946    fn r#get_mac_address(&self) -> Self::GetMacAddressResponseFut {
1947        fn _decode(
1948            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1949        ) -> Result<SupplicantStaIfaceGetMacAddressResult, fidl::Error> {
1950            let _response = fidl::client::decode_transaction_body::<
1951                fidl::encoding::FlexibleResultType<SupplicantStaIfaceGetMacAddressResponse, i32>,
1952                fidl::encoding::DefaultFuchsiaResourceDialect,
1953                0x60591d204a3f537f,
1954            >(_buf?)?
1955            .into_result::<SupplicantStaIfaceMarker>("get_mac_address")?;
1956            Ok(_response.map(|x| x))
1957        }
1958        self.client.send_query_and_decode::<
1959            fidl::encoding::EmptyPayload,
1960            SupplicantStaIfaceGetMacAddressResult,
1961        >(
1962            (),
1963            0x60591d204a3f537f,
1964            fidl::encoding::DynamicFlags::FLEXIBLE,
1965            _decode,
1966        )
1967    }
1968
1969    type SetPowerSaveResponseFut =
1970        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1971    fn r#set_power_save(
1972        &self,
1973        mut payload: SupplicantStaIfaceSetPowerSaveRequest,
1974    ) -> Self::SetPowerSaveResponseFut {
1975        fn _decode(
1976            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1977        ) -> Result<(), fidl::Error> {
1978            let _response = fidl::client::decode_transaction_body::<
1979                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
1980                fidl::encoding::DefaultFuchsiaResourceDialect,
1981                0x5a04c29320085298,
1982            >(_buf?)?
1983            .into_result::<SupplicantStaIfaceMarker>("set_power_save")?;
1984            Ok(_response)
1985        }
1986        self.client.send_query_and_decode::<SupplicantStaIfaceSetPowerSaveRequest, ()>(
1987            &mut payload,
1988            0x5a04c29320085298,
1989            fidl::encoding::DynamicFlags::FLEXIBLE,
1990            _decode,
1991        )
1992    }
1993
1994    type SetSuspendModeEnabledResponseFut =
1995        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1996    fn r#set_suspend_mode_enabled(
1997        &self,
1998        mut payload: SupplicantStaIfaceSetSuspendModeEnabledRequest,
1999    ) -> Self::SetSuspendModeEnabledResponseFut {
2000        fn _decode(
2001            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2002        ) -> Result<(), fidl::Error> {
2003            let _response = fidl::client::decode_transaction_body::<
2004                fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>,
2005                fidl::encoding::DefaultFuchsiaResourceDialect,
2006                0xaf10de85bb7023a,
2007            >(_buf?)?
2008            .into_result::<SupplicantStaIfaceMarker>("set_suspend_mode_enabled")?;
2009            Ok(_response)
2010        }
2011        self.client.send_query_and_decode::<SupplicantStaIfaceSetSuspendModeEnabledRequest, ()>(
2012            &mut payload,
2013            0xaf10de85bb7023a,
2014            fidl::encoding::DynamicFlags::FLEXIBLE,
2015            _decode,
2016        )
2017    }
2018
2019    type SetStaCountryCodeResponseFut = fidl::client::QueryResponseFut<
2020        SupplicantStaIfaceSetStaCountryCodeResult,
2021        fidl::encoding::DefaultFuchsiaResourceDialect,
2022    >;
2023    fn r#set_sta_country_code(
2024        &self,
2025        mut payload: SupplicantStaIfaceSetStaCountryCodeRequest,
2026    ) -> Self::SetStaCountryCodeResponseFut {
2027        fn _decode(
2028            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2029        ) -> Result<SupplicantStaIfaceSetStaCountryCodeResult, fidl::Error> {
2030            let _response = fidl::client::decode_transaction_body::<
2031                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
2032                fidl::encoding::DefaultFuchsiaResourceDialect,
2033                0x977e22f9b79b26e,
2034            >(_buf?)?
2035            .into_result::<SupplicantStaIfaceMarker>("set_sta_country_code")?;
2036            Ok(_response.map(|x| x))
2037        }
2038        self.client.send_query_and_decode::<
2039            SupplicantStaIfaceSetStaCountryCodeRequest,
2040            SupplicantStaIfaceSetStaCountryCodeResult,
2041        >(
2042            &mut payload,
2043            0x977e22f9b79b26e,
2044            fidl::encoding::DynamicFlags::FLEXIBLE,
2045            _decode,
2046        )
2047    }
2048}
2049
2050pub struct SupplicantStaIfaceEventStream {
2051    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2052}
2053
2054impl std::marker::Unpin for SupplicantStaIfaceEventStream {}
2055
2056impl futures::stream::FusedStream for SupplicantStaIfaceEventStream {
2057    fn is_terminated(&self) -> bool {
2058        self.event_receiver.is_terminated()
2059    }
2060}
2061
2062impl futures::Stream for SupplicantStaIfaceEventStream {
2063    type Item = Result<SupplicantStaIfaceEvent, fidl::Error>;
2064
2065    fn poll_next(
2066        mut self: std::pin::Pin<&mut Self>,
2067        cx: &mut std::task::Context<'_>,
2068    ) -> std::task::Poll<Option<Self::Item>> {
2069        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2070            &mut self.event_receiver,
2071            cx
2072        )?) {
2073            Some(buf) => std::task::Poll::Ready(Some(SupplicantStaIfaceEvent::decode(buf))),
2074            None => std::task::Poll::Ready(None),
2075        }
2076    }
2077}
2078
2079#[derive(Debug)]
2080pub enum SupplicantStaIfaceEvent {
2081    #[non_exhaustive]
2082    _UnknownEvent {
2083        /// Ordinal of the event that was sent.
2084        ordinal: u64,
2085    },
2086}
2087
2088impl SupplicantStaIfaceEvent {
2089    /// Decodes a message buffer as a [`SupplicantStaIfaceEvent`].
2090    fn decode(
2091        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2092    ) -> Result<SupplicantStaIfaceEvent, fidl::Error> {
2093        let (bytes, _handles) = buf.split_mut();
2094        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2095        debug_assert_eq!(tx_header.tx_id, 0);
2096        match tx_header.ordinal {
2097            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2098                Ok(SupplicantStaIfaceEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2099            }
2100            _ => Err(fidl::Error::UnknownOrdinal {
2101                ordinal: tx_header.ordinal,
2102                protocol_name:
2103                    <SupplicantStaIfaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2104            }),
2105        }
2106    }
2107}
2108
2109/// A Stream of incoming requests for fuchsia.wlan.wlanix/SupplicantStaIface.
2110pub struct SupplicantStaIfaceRequestStream {
2111    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2112    is_terminated: bool,
2113}
2114
2115impl std::marker::Unpin for SupplicantStaIfaceRequestStream {}
2116
2117impl futures::stream::FusedStream for SupplicantStaIfaceRequestStream {
2118    fn is_terminated(&self) -> bool {
2119        self.is_terminated
2120    }
2121}
2122
2123impl fidl::endpoints::RequestStream for SupplicantStaIfaceRequestStream {
2124    type Protocol = SupplicantStaIfaceMarker;
2125    type ControlHandle = SupplicantStaIfaceControlHandle;
2126
2127    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2128        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2129    }
2130
2131    fn control_handle(&self) -> Self::ControlHandle {
2132        SupplicantStaIfaceControlHandle { inner: self.inner.clone() }
2133    }
2134
2135    fn into_inner(
2136        self,
2137    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2138    {
2139        (self.inner, self.is_terminated)
2140    }
2141
2142    fn from_inner(
2143        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2144        is_terminated: bool,
2145    ) -> Self {
2146        Self { inner, is_terminated }
2147    }
2148}
2149
2150impl futures::Stream for SupplicantStaIfaceRequestStream {
2151    type Item = Result<SupplicantStaIfaceRequest, fidl::Error>;
2152
2153    fn poll_next(
2154        mut self: std::pin::Pin<&mut Self>,
2155        cx: &mut std::task::Context<'_>,
2156    ) -> std::task::Poll<Option<Self::Item>> {
2157        let this = &mut *self;
2158        if this.inner.check_shutdown(cx) {
2159            this.is_terminated = true;
2160            return std::task::Poll::Ready(None);
2161        }
2162        if this.is_terminated {
2163            panic!("polled SupplicantStaIfaceRequestStream after completion");
2164        }
2165        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2166            |bytes, handles| {
2167                match this.inner.channel().read_etc(cx, bytes, handles) {
2168                    std::task::Poll::Ready(Ok(())) => {}
2169                    std::task::Poll::Pending => return std::task::Poll::Pending,
2170                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2171                        this.is_terminated = true;
2172                        return std::task::Poll::Ready(None);
2173                    }
2174                    std::task::Poll::Ready(Err(e)) => {
2175                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2176                            e.into(),
2177                        ))))
2178                    }
2179                }
2180
2181                // A message has been received from the channel
2182                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2183
2184                std::task::Poll::Ready(Some(match header.ordinal {
2185                0x1be680e863a8e71 => {
2186                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2187                    let mut req = fidl::new_empty!(SupplicantStaIfaceRegisterCallbackRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2188                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantStaIfaceRegisterCallbackRequest>(&header, _body_bytes, handles, &mut req)?;
2189                    let control_handle = SupplicantStaIfaceControlHandle {
2190                        inner: this.inner.clone(),
2191                    };
2192                    Ok(SupplicantStaIfaceRequest::RegisterCallback {payload: req,
2193                        control_handle,
2194                    })
2195                }
2196                0xa77cf60628766dc => {
2197                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2198                    let mut req = fidl::new_empty!(SupplicantStaIfaceAddNetworkRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2199                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantStaIfaceAddNetworkRequest>(&header, _body_bytes, handles, &mut req)?;
2200                    let control_handle = SupplicantStaIfaceControlHandle {
2201                        inner: this.inner.clone(),
2202                    };
2203                    Ok(SupplicantStaIfaceRequest::AddNetwork {payload: req,
2204                        control_handle,
2205                    })
2206                }
2207                0x52a1d38e0b4871fa => {
2208                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2209                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
2210                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2211                    let control_handle = SupplicantStaIfaceControlHandle {
2212                        inner: this.inner.clone(),
2213                    };
2214                    Ok(SupplicantStaIfaceRequest::Disconnect {
2215                        responder: SupplicantStaIfaceDisconnectResponder {
2216                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2217                            tx_id: header.tx_id,
2218                        },
2219                    })
2220                }
2221                0x60591d204a3f537f => {
2222                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2223                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
2224                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2225                    let control_handle = SupplicantStaIfaceControlHandle {
2226                        inner: this.inner.clone(),
2227                    };
2228                    Ok(SupplicantStaIfaceRequest::GetMacAddress {
2229                        responder: SupplicantStaIfaceGetMacAddressResponder {
2230                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2231                            tx_id: header.tx_id,
2232                        },
2233                    })
2234                }
2235                0x5a04c29320085298 => {
2236                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2237                    let mut req = fidl::new_empty!(SupplicantStaIfaceSetPowerSaveRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2238                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantStaIfaceSetPowerSaveRequest>(&header, _body_bytes, handles, &mut req)?;
2239                    let control_handle = SupplicantStaIfaceControlHandle {
2240                        inner: this.inner.clone(),
2241                    };
2242                    Ok(SupplicantStaIfaceRequest::SetPowerSave {payload: req,
2243                        responder: SupplicantStaIfaceSetPowerSaveResponder {
2244                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2245                            tx_id: header.tx_id,
2246                        },
2247                    })
2248                }
2249                0xaf10de85bb7023a => {
2250                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2251                    let mut req = fidl::new_empty!(SupplicantStaIfaceSetSuspendModeEnabledRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2252                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantStaIfaceSetSuspendModeEnabledRequest>(&header, _body_bytes, handles, &mut req)?;
2253                    let control_handle = SupplicantStaIfaceControlHandle {
2254                        inner: this.inner.clone(),
2255                    };
2256                    Ok(SupplicantStaIfaceRequest::SetSuspendModeEnabled {payload: req,
2257                        responder: SupplicantStaIfaceSetSuspendModeEnabledResponder {
2258                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2259                            tx_id: header.tx_id,
2260                        },
2261                    })
2262                }
2263                0x977e22f9b79b26e => {
2264                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2265                    let mut req = fidl::new_empty!(SupplicantStaIfaceSetStaCountryCodeRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2266                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantStaIfaceSetStaCountryCodeRequest>(&header, _body_bytes, handles, &mut req)?;
2267                    let control_handle = SupplicantStaIfaceControlHandle {
2268                        inner: this.inner.clone(),
2269                    };
2270                    Ok(SupplicantStaIfaceRequest::SetStaCountryCode {payload: req,
2271                        responder: SupplicantStaIfaceSetStaCountryCodeResponder {
2272                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2273                            tx_id: header.tx_id,
2274                        },
2275                    })
2276                }
2277                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2278                    Ok(SupplicantStaIfaceRequest::_UnknownMethod {
2279                        ordinal: header.ordinal,
2280                        control_handle: SupplicantStaIfaceControlHandle { inner: this.inner.clone() },
2281                        method_type: fidl::MethodType::OneWay,
2282                    })
2283                }
2284                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2285                    this.inner.send_framework_err(
2286                        fidl::encoding::FrameworkErr::UnknownMethod,
2287                        header.tx_id,
2288                        header.ordinal,
2289                        header.dynamic_flags(),
2290                        (bytes, handles),
2291                    )?;
2292                    Ok(SupplicantStaIfaceRequest::_UnknownMethod {
2293                        ordinal: header.ordinal,
2294                        control_handle: SupplicantStaIfaceControlHandle { inner: this.inner.clone() },
2295                        method_type: fidl::MethodType::TwoWay,
2296                    })
2297                }
2298                _ => Err(fidl::Error::UnknownOrdinal {
2299                    ordinal: header.ordinal,
2300                    protocol_name: <SupplicantStaIfaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2301                }),
2302            }))
2303            },
2304        )
2305    }
2306}
2307
2308#[derive(Debug)]
2309pub enum SupplicantStaIfaceRequest {
2310    RegisterCallback {
2311        payload: SupplicantStaIfaceRegisterCallbackRequest,
2312        control_handle: SupplicantStaIfaceControlHandle,
2313    },
2314    AddNetwork {
2315        payload: SupplicantStaIfaceAddNetworkRequest,
2316        control_handle: SupplicantStaIfaceControlHandle,
2317    },
2318    Disconnect {
2319        responder: SupplicantStaIfaceDisconnectResponder,
2320    },
2321    GetMacAddress {
2322        responder: SupplicantStaIfaceGetMacAddressResponder,
2323    },
2324    SetPowerSave {
2325        payload: SupplicantStaIfaceSetPowerSaveRequest,
2326        responder: SupplicantStaIfaceSetPowerSaveResponder,
2327    },
2328    SetSuspendModeEnabled {
2329        payload: SupplicantStaIfaceSetSuspendModeEnabledRequest,
2330        responder: SupplicantStaIfaceSetSuspendModeEnabledResponder,
2331    },
2332    SetStaCountryCode {
2333        payload: SupplicantStaIfaceSetStaCountryCodeRequest,
2334        responder: SupplicantStaIfaceSetStaCountryCodeResponder,
2335    },
2336    /// An interaction was received which does not match any known method.
2337    #[non_exhaustive]
2338    _UnknownMethod {
2339        /// Ordinal of the method that was called.
2340        ordinal: u64,
2341        control_handle: SupplicantStaIfaceControlHandle,
2342        method_type: fidl::MethodType,
2343    },
2344}
2345
2346impl SupplicantStaIfaceRequest {
2347    #[allow(irrefutable_let_patterns)]
2348    pub fn into_register_callback(
2349        self,
2350    ) -> Option<(SupplicantStaIfaceRegisterCallbackRequest, SupplicantStaIfaceControlHandle)> {
2351        if let SupplicantStaIfaceRequest::RegisterCallback { payload, control_handle } = self {
2352            Some((payload, control_handle))
2353        } else {
2354            None
2355        }
2356    }
2357
2358    #[allow(irrefutable_let_patterns)]
2359    pub fn into_add_network(
2360        self,
2361    ) -> Option<(SupplicantStaIfaceAddNetworkRequest, SupplicantStaIfaceControlHandle)> {
2362        if let SupplicantStaIfaceRequest::AddNetwork { payload, control_handle } = self {
2363            Some((payload, control_handle))
2364        } else {
2365            None
2366        }
2367    }
2368
2369    #[allow(irrefutable_let_patterns)]
2370    pub fn into_disconnect(self) -> Option<(SupplicantStaIfaceDisconnectResponder)> {
2371        if let SupplicantStaIfaceRequest::Disconnect { responder } = self {
2372            Some((responder))
2373        } else {
2374            None
2375        }
2376    }
2377
2378    #[allow(irrefutable_let_patterns)]
2379    pub fn into_get_mac_address(self) -> Option<(SupplicantStaIfaceGetMacAddressResponder)> {
2380        if let SupplicantStaIfaceRequest::GetMacAddress { responder } = self {
2381            Some((responder))
2382        } else {
2383            None
2384        }
2385    }
2386
2387    #[allow(irrefutable_let_patterns)]
2388    pub fn into_set_power_save(
2389        self,
2390    ) -> Option<(SupplicantStaIfaceSetPowerSaveRequest, SupplicantStaIfaceSetPowerSaveResponder)>
2391    {
2392        if let SupplicantStaIfaceRequest::SetPowerSave { payload, responder } = self {
2393            Some((payload, responder))
2394        } else {
2395            None
2396        }
2397    }
2398
2399    #[allow(irrefutable_let_patterns)]
2400    pub fn into_set_suspend_mode_enabled(
2401        self,
2402    ) -> Option<(
2403        SupplicantStaIfaceSetSuspendModeEnabledRequest,
2404        SupplicantStaIfaceSetSuspendModeEnabledResponder,
2405    )> {
2406        if let SupplicantStaIfaceRequest::SetSuspendModeEnabled { payload, responder } = self {
2407            Some((payload, responder))
2408        } else {
2409            None
2410        }
2411    }
2412
2413    #[allow(irrefutable_let_patterns)]
2414    pub fn into_set_sta_country_code(
2415        self,
2416    ) -> Option<(
2417        SupplicantStaIfaceSetStaCountryCodeRequest,
2418        SupplicantStaIfaceSetStaCountryCodeResponder,
2419    )> {
2420        if let SupplicantStaIfaceRequest::SetStaCountryCode { payload, responder } = self {
2421            Some((payload, responder))
2422        } else {
2423            None
2424        }
2425    }
2426
2427    /// Name of the method defined in FIDL
2428    pub fn method_name(&self) -> &'static str {
2429        match *self {
2430            SupplicantStaIfaceRequest::RegisterCallback { .. } => "register_callback",
2431            SupplicantStaIfaceRequest::AddNetwork { .. } => "add_network",
2432            SupplicantStaIfaceRequest::Disconnect { .. } => "disconnect",
2433            SupplicantStaIfaceRequest::GetMacAddress { .. } => "get_mac_address",
2434            SupplicantStaIfaceRequest::SetPowerSave { .. } => "set_power_save",
2435            SupplicantStaIfaceRequest::SetSuspendModeEnabled { .. } => "set_suspend_mode_enabled",
2436            SupplicantStaIfaceRequest::SetStaCountryCode { .. } => "set_sta_country_code",
2437            SupplicantStaIfaceRequest::_UnknownMethod {
2438                method_type: fidl::MethodType::OneWay,
2439                ..
2440            } => "unknown one-way method",
2441            SupplicantStaIfaceRequest::_UnknownMethod {
2442                method_type: fidl::MethodType::TwoWay,
2443                ..
2444            } => "unknown two-way method",
2445        }
2446    }
2447}
2448
2449#[derive(Debug, Clone)]
2450pub struct SupplicantStaIfaceControlHandle {
2451    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2452}
2453
2454impl fidl::endpoints::ControlHandle for SupplicantStaIfaceControlHandle {
2455    fn shutdown(&self) {
2456        self.inner.shutdown()
2457    }
2458    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2459        self.inner.shutdown_with_epitaph(status)
2460    }
2461
2462    fn is_closed(&self) -> bool {
2463        self.inner.channel().is_closed()
2464    }
2465    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2466        self.inner.channel().on_closed()
2467    }
2468
2469    #[cfg(target_os = "fuchsia")]
2470    fn signal_peer(
2471        &self,
2472        clear_mask: zx::Signals,
2473        set_mask: zx::Signals,
2474    ) -> Result<(), zx_status::Status> {
2475        use fidl::Peered;
2476        self.inner.channel().signal_peer(clear_mask, set_mask)
2477    }
2478}
2479
2480impl SupplicantStaIfaceControlHandle {}
2481
2482#[must_use = "FIDL methods require a response to be sent"]
2483#[derive(Debug)]
2484pub struct SupplicantStaIfaceDisconnectResponder {
2485    control_handle: std::mem::ManuallyDrop<SupplicantStaIfaceControlHandle>,
2486    tx_id: u32,
2487}
2488
2489/// Set the the channel to be shutdown (see [`SupplicantStaIfaceControlHandle::shutdown`])
2490/// if the responder is dropped without sending a response, so that the client
2491/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2492impl std::ops::Drop for SupplicantStaIfaceDisconnectResponder {
2493    fn drop(&mut self) {
2494        self.control_handle.shutdown();
2495        // Safety: drops once, never accessed again
2496        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2497    }
2498}
2499
2500impl fidl::endpoints::Responder for SupplicantStaIfaceDisconnectResponder {
2501    type ControlHandle = SupplicantStaIfaceControlHandle;
2502
2503    fn control_handle(&self) -> &SupplicantStaIfaceControlHandle {
2504        &self.control_handle
2505    }
2506
2507    fn drop_without_shutdown(mut self) {
2508        // Safety: drops once, never accessed again due to mem::forget
2509        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2510        // Prevent Drop from running (which would shut down the channel)
2511        std::mem::forget(self);
2512    }
2513}
2514
2515impl SupplicantStaIfaceDisconnectResponder {
2516    /// Sends a response to the FIDL transaction.
2517    ///
2518    /// Sets the channel to shutdown if an error occurs.
2519    pub fn send(self) -> Result<(), fidl::Error> {
2520        let _result = self.send_raw();
2521        if _result.is_err() {
2522            self.control_handle.shutdown();
2523        }
2524        self.drop_without_shutdown();
2525        _result
2526    }
2527
2528    /// Similar to "send" but does not shutdown the channel if an error occurs.
2529    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2530        let _result = self.send_raw();
2531        self.drop_without_shutdown();
2532        _result
2533    }
2534
2535    fn send_raw(&self) -> Result<(), fidl::Error> {
2536        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
2537            fidl::encoding::Flexible::new(()),
2538            self.tx_id,
2539            0x52a1d38e0b4871fa,
2540            fidl::encoding::DynamicFlags::FLEXIBLE,
2541        )
2542    }
2543}
2544
2545#[must_use = "FIDL methods require a response to be sent"]
2546#[derive(Debug)]
2547pub struct SupplicantStaIfaceGetMacAddressResponder {
2548    control_handle: std::mem::ManuallyDrop<SupplicantStaIfaceControlHandle>,
2549    tx_id: u32,
2550}
2551
2552/// Set the the channel to be shutdown (see [`SupplicantStaIfaceControlHandle::shutdown`])
2553/// if the responder is dropped without sending a response, so that the client
2554/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2555impl std::ops::Drop for SupplicantStaIfaceGetMacAddressResponder {
2556    fn drop(&mut self) {
2557        self.control_handle.shutdown();
2558        // Safety: drops once, never accessed again
2559        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2560    }
2561}
2562
2563impl fidl::endpoints::Responder for SupplicantStaIfaceGetMacAddressResponder {
2564    type ControlHandle = SupplicantStaIfaceControlHandle;
2565
2566    fn control_handle(&self) -> &SupplicantStaIfaceControlHandle {
2567        &self.control_handle
2568    }
2569
2570    fn drop_without_shutdown(mut self) {
2571        // Safety: drops once, never accessed again due to mem::forget
2572        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2573        // Prevent Drop from running (which would shut down the channel)
2574        std::mem::forget(self);
2575    }
2576}
2577
2578impl SupplicantStaIfaceGetMacAddressResponder {
2579    /// Sends a response to the FIDL transaction.
2580    ///
2581    /// Sets the channel to shutdown if an error occurs.
2582    pub fn send(
2583        self,
2584        mut result: Result<&SupplicantStaIfaceGetMacAddressResponse, i32>,
2585    ) -> Result<(), fidl::Error> {
2586        let _result = self.send_raw(result);
2587        if _result.is_err() {
2588            self.control_handle.shutdown();
2589        }
2590        self.drop_without_shutdown();
2591        _result
2592    }
2593
2594    /// Similar to "send" but does not shutdown the channel if an error occurs.
2595    pub fn send_no_shutdown_on_err(
2596        self,
2597        mut result: Result<&SupplicantStaIfaceGetMacAddressResponse, i32>,
2598    ) -> Result<(), fidl::Error> {
2599        let _result = self.send_raw(result);
2600        self.drop_without_shutdown();
2601        _result
2602    }
2603
2604    fn send_raw(
2605        &self,
2606        mut result: Result<&SupplicantStaIfaceGetMacAddressResponse, i32>,
2607    ) -> Result<(), fidl::Error> {
2608        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2609            SupplicantStaIfaceGetMacAddressResponse,
2610            i32,
2611        >>(
2612            fidl::encoding::FlexibleResult::new(result),
2613            self.tx_id,
2614            0x60591d204a3f537f,
2615            fidl::encoding::DynamicFlags::FLEXIBLE,
2616        )
2617    }
2618}
2619
2620#[must_use = "FIDL methods require a response to be sent"]
2621#[derive(Debug)]
2622pub struct SupplicantStaIfaceSetPowerSaveResponder {
2623    control_handle: std::mem::ManuallyDrop<SupplicantStaIfaceControlHandle>,
2624    tx_id: u32,
2625}
2626
2627/// Set the the channel to be shutdown (see [`SupplicantStaIfaceControlHandle::shutdown`])
2628/// if the responder is dropped without sending a response, so that the client
2629/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2630impl std::ops::Drop for SupplicantStaIfaceSetPowerSaveResponder {
2631    fn drop(&mut self) {
2632        self.control_handle.shutdown();
2633        // Safety: drops once, never accessed again
2634        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2635    }
2636}
2637
2638impl fidl::endpoints::Responder for SupplicantStaIfaceSetPowerSaveResponder {
2639    type ControlHandle = SupplicantStaIfaceControlHandle;
2640
2641    fn control_handle(&self) -> &SupplicantStaIfaceControlHandle {
2642        &self.control_handle
2643    }
2644
2645    fn drop_without_shutdown(mut self) {
2646        // Safety: drops once, never accessed again due to mem::forget
2647        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2648        // Prevent Drop from running (which would shut down the channel)
2649        std::mem::forget(self);
2650    }
2651}
2652
2653impl SupplicantStaIfaceSetPowerSaveResponder {
2654    /// Sends a response to the FIDL transaction.
2655    ///
2656    /// Sets the channel to shutdown if an error occurs.
2657    pub fn send(self) -> Result<(), fidl::Error> {
2658        let _result = self.send_raw();
2659        if _result.is_err() {
2660            self.control_handle.shutdown();
2661        }
2662        self.drop_without_shutdown();
2663        _result
2664    }
2665
2666    /// Similar to "send" but does not shutdown the channel if an error occurs.
2667    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2668        let _result = self.send_raw();
2669        self.drop_without_shutdown();
2670        _result
2671    }
2672
2673    fn send_raw(&self) -> Result<(), fidl::Error> {
2674        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
2675            fidl::encoding::Flexible::new(()),
2676            self.tx_id,
2677            0x5a04c29320085298,
2678            fidl::encoding::DynamicFlags::FLEXIBLE,
2679        )
2680    }
2681}
2682
2683#[must_use = "FIDL methods require a response to be sent"]
2684#[derive(Debug)]
2685pub struct SupplicantStaIfaceSetSuspendModeEnabledResponder {
2686    control_handle: std::mem::ManuallyDrop<SupplicantStaIfaceControlHandle>,
2687    tx_id: u32,
2688}
2689
2690/// Set the the channel to be shutdown (see [`SupplicantStaIfaceControlHandle::shutdown`])
2691/// if the responder is dropped without sending a response, so that the client
2692/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2693impl std::ops::Drop for SupplicantStaIfaceSetSuspendModeEnabledResponder {
2694    fn drop(&mut self) {
2695        self.control_handle.shutdown();
2696        // Safety: drops once, never accessed again
2697        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2698    }
2699}
2700
2701impl fidl::endpoints::Responder for SupplicantStaIfaceSetSuspendModeEnabledResponder {
2702    type ControlHandle = SupplicantStaIfaceControlHandle;
2703
2704    fn control_handle(&self) -> &SupplicantStaIfaceControlHandle {
2705        &self.control_handle
2706    }
2707
2708    fn drop_without_shutdown(mut self) {
2709        // Safety: drops once, never accessed again due to mem::forget
2710        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2711        // Prevent Drop from running (which would shut down the channel)
2712        std::mem::forget(self);
2713    }
2714}
2715
2716impl SupplicantStaIfaceSetSuspendModeEnabledResponder {
2717    /// Sends a response to the FIDL transaction.
2718    ///
2719    /// Sets the channel to shutdown if an error occurs.
2720    pub fn send(self) -> Result<(), fidl::Error> {
2721        let _result = self.send_raw();
2722        if _result.is_err() {
2723            self.control_handle.shutdown();
2724        }
2725        self.drop_without_shutdown();
2726        _result
2727    }
2728
2729    /// Similar to "send" but does not shutdown the channel if an error occurs.
2730    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2731        let _result = self.send_raw();
2732        self.drop_without_shutdown();
2733        _result
2734    }
2735
2736    fn send_raw(&self) -> Result<(), fidl::Error> {
2737        self.control_handle.inner.send::<fidl::encoding::FlexibleType<fidl::encoding::EmptyStruct>>(
2738            fidl::encoding::Flexible::new(()),
2739            self.tx_id,
2740            0xaf10de85bb7023a,
2741            fidl::encoding::DynamicFlags::FLEXIBLE,
2742        )
2743    }
2744}
2745
2746#[must_use = "FIDL methods require a response to be sent"]
2747#[derive(Debug)]
2748pub struct SupplicantStaIfaceSetStaCountryCodeResponder {
2749    control_handle: std::mem::ManuallyDrop<SupplicantStaIfaceControlHandle>,
2750    tx_id: u32,
2751}
2752
2753/// Set the the channel to be shutdown (see [`SupplicantStaIfaceControlHandle::shutdown`])
2754/// if the responder is dropped without sending a response, so that the client
2755/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2756impl std::ops::Drop for SupplicantStaIfaceSetStaCountryCodeResponder {
2757    fn drop(&mut self) {
2758        self.control_handle.shutdown();
2759        // Safety: drops once, never accessed again
2760        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2761    }
2762}
2763
2764impl fidl::endpoints::Responder for SupplicantStaIfaceSetStaCountryCodeResponder {
2765    type ControlHandle = SupplicantStaIfaceControlHandle;
2766
2767    fn control_handle(&self) -> &SupplicantStaIfaceControlHandle {
2768        &self.control_handle
2769    }
2770
2771    fn drop_without_shutdown(mut self) {
2772        // Safety: drops once, never accessed again due to mem::forget
2773        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2774        // Prevent Drop from running (which would shut down the channel)
2775        std::mem::forget(self);
2776    }
2777}
2778
2779impl SupplicantStaIfaceSetStaCountryCodeResponder {
2780    /// Sends a response to the FIDL transaction.
2781    ///
2782    /// Sets the channel to shutdown if an error occurs.
2783    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2784        let _result = self.send_raw(result);
2785        if _result.is_err() {
2786            self.control_handle.shutdown();
2787        }
2788        self.drop_without_shutdown();
2789        _result
2790    }
2791
2792    /// Similar to "send" but does not shutdown the channel if an error occurs.
2793    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2794        let _result = self.send_raw(result);
2795        self.drop_without_shutdown();
2796        _result
2797    }
2798
2799    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2800        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2801            fidl::encoding::EmptyStruct,
2802            i32,
2803        >>(
2804            fidl::encoding::FlexibleResult::new(result),
2805            self.tx_id,
2806            0x977e22f9b79b26e,
2807            fidl::encoding::DynamicFlags::FLEXIBLE,
2808        )
2809    }
2810}
2811
2812#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2813pub struct SupplicantStaIfaceCallbackMarker;
2814
2815impl fidl::endpoints::ProtocolMarker for SupplicantStaIfaceCallbackMarker {
2816    type Proxy = SupplicantStaIfaceCallbackProxy;
2817    type RequestStream = SupplicantStaIfaceCallbackRequestStream;
2818    #[cfg(target_os = "fuchsia")]
2819    type SynchronousProxy = SupplicantStaIfaceCallbackSynchronousProxy;
2820
2821    const DEBUG_NAME: &'static str = "(anonymous) SupplicantStaIfaceCallback";
2822}
2823
2824pub trait SupplicantStaIfaceCallbackProxyInterface: Send + Sync {
2825    fn r#on_state_changed(
2826        &self,
2827        payload: &SupplicantStaIfaceCallbackOnStateChangedRequest,
2828    ) -> Result<(), fidl::Error>;
2829    fn r#on_disconnected(
2830        &self,
2831        payload: &SupplicantStaIfaceCallbackOnDisconnectedRequest,
2832    ) -> Result<(), fidl::Error>;
2833    fn r#on_association_rejected(
2834        &self,
2835        payload: &SupplicantStaIfaceCallbackOnAssociationRejectedRequest,
2836    ) -> Result<(), fidl::Error>;
2837}
2838#[derive(Debug)]
2839#[cfg(target_os = "fuchsia")]
2840pub struct SupplicantStaIfaceCallbackSynchronousProxy {
2841    client: fidl::client::sync::Client,
2842}
2843
2844#[cfg(target_os = "fuchsia")]
2845impl fidl::endpoints::SynchronousProxy for SupplicantStaIfaceCallbackSynchronousProxy {
2846    type Proxy = SupplicantStaIfaceCallbackProxy;
2847    type Protocol = SupplicantStaIfaceCallbackMarker;
2848
2849    fn from_channel(inner: fidl::Channel) -> Self {
2850        Self::new(inner)
2851    }
2852
2853    fn into_channel(self) -> fidl::Channel {
2854        self.client.into_channel()
2855    }
2856
2857    fn as_channel(&self) -> &fidl::Channel {
2858        self.client.as_channel()
2859    }
2860}
2861
2862#[cfg(target_os = "fuchsia")]
2863impl SupplicantStaIfaceCallbackSynchronousProxy {
2864    pub fn new(channel: fidl::Channel) -> Self {
2865        let protocol_name =
2866            <SupplicantStaIfaceCallbackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2867        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2868    }
2869
2870    pub fn into_channel(self) -> fidl::Channel {
2871        self.client.into_channel()
2872    }
2873
2874    /// Waits until an event arrives and returns it. It is safe for other
2875    /// threads to make concurrent requests while waiting for an event.
2876    pub fn wait_for_event(
2877        &self,
2878        deadline: zx::MonotonicInstant,
2879    ) -> Result<SupplicantStaIfaceCallbackEvent, fidl::Error> {
2880        SupplicantStaIfaceCallbackEvent::decode(self.client.wait_for_event(deadline)?)
2881    }
2882
2883    pub fn r#on_state_changed(
2884        &self,
2885        mut payload: &SupplicantStaIfaceCallbackOnStateChangedRequest,
2886    ) -> Result<(), fidl::Error> {
2887        self.client.send::<SupplicantStaIfaceCallbackOnStateChangedRequest>(
2888            payload,
2889            0x27e086d26c49eb6c,
2890            fidl::encoding::DynamicFlags::FLEXIBLE,
2891        )
2892    }
2893
2894    pub fn r#on_disconnected(
2895        &self,
2896        mut payload: &SupplicantStaIfaceCallbackOnDisconnectedRequest,
2897    ) -> Result<(), fidl::Error> {
2898        self.client.send::<SupplicantStaIfaceCallbackOnDisconnectedRequest>(
2899            payload,
2900            0x69546475f4dee0cc,
2901            fidl::encoding::DynamicFlags::FLEXIBLE,
2902        )
2903    }
2904
2905    pub fn r#on_association_rejected(
2906        &self,
2907        mut payload: &SupplicantStaIfaceCallbackOnAssociationRejectedRequest,
2908    ) -> Result<(), fidl::Error> {
2909        self.client.send::<SupplicantStaIfaceCallbackOnAssociationRejectedRequest>(
2910            payload,
2911            0x7ef3961518bed988,
2912            fidl::encoding::DynamicFlags::FLEXIBLE,
2913        )
2914    }
2915}
2916
2917#[cfg(target_os = "fuchsia")]
2918impl From<SupplicantStaIfaceCallbackSynchronousProxy> for zx::Handle {
2919    fn from(value: SupplicantStaIfaceCallbackSynchronousProxy) -> Self {
2920        value.into_channel().into()
2921    }
2922}
2923
2924#[cfg(target_os = "fuchsia")]
2925impl From<fidl::Channel> for SupplicantStaIfaceCallbackSynchronousProxy {
2926    fn from(value: fidl::Channel) -> Self {
2927        Self::new(value)
2928    }
2929}
2930
2931#[derive(Debug, Clone)]
2932pub struct SupplicantStaIfaceCallbackProxy {
2933    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2934}
2935
2936impl fidl::endpoints::Proxy for SupplicantStaIfaceCallbackProxy {
2937    type Protocol = SupplicantStaIfaceCallbackMarker;
2938
2939    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2940        Self::new(inner)
2941    }
2942
2943    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2944        self.client.into_channel().map_err(|client| Self { client })
2945    }
2946
2947    fn as_channel(&self) -> &::fidl::AsyncChannel {
2948        self.client.as_channel()
2949    }
2950}
2951
2952impl SupplicantStaIfaceCallbackProxy {
2953    /// Create a new Proxy for fuchsia.wlan.wlanix/SupplicantStaIfaceCallback.
2954    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2955        let protocol_name =
2956            <SupplicantStaIfaceCallbackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2957        Self { client: fidl::client::Client::new(channel, protocol_name) }
2958    }
2959
2960    /// Get a Stream of events from the remote end of the protocol.
2961    ///
2962    /// # Panics
2963    ///
2964    /// Panics if the event stream was already taken.
2965    pub fn take_event_stream(&self) -> SupplicantStaIfaceCallbackEventStream {
2966        SupplicantStaIfaceCallbackEventStream { event_receiver: self.client.take_event_receiver() }
2967    }
2968
2969    pub fn r#on_state_changed(
2970        &self,
2971        mut payload: &SupplicantStaIfaceCallbackOnStateChangedRequest,
2972    ) -> Result<(), fidl::Error> {
2973        SupplicantStaIfaceCallbackProxyInterface::r#on_state_changed(self, payload)
2974    }
2975
2976    pub fn r#on_disconnected(
2977        &self,
2978        mut payload: &SupplicantStaIfaceCallbackOnDisconnectedRequest,
2979    ) -> Result<(), fidl::Error> {
2980        SupplicantStaIfaceCallbackProxyInterface::r#on_disconnected(self, payload)
2981    }
2982
2983    pub fn r#on_association_rejected(
2984        &self,
2985        mut payload: &SupplicantStaIfaceCallbackOnAssociationRejectedRequest,
2986    ) -> Result<(), fidl::Error> {
2987        SupplicantStaIfaceCallbackProxyInterface::r#on_association_rejected(self, payload)
2988    }
2989}
2990
2991impl SupplicantStaIfaceCallbackProxyInterface for SupplicantStaIfaceCallbackProxy {
2992    fn r#on_state_changed(
2993        &self,
2994        mut payload: &SupplicantStaIfaceCallbackOnStateChangedRequest,
2995    ) -> Result<(), fidl::Error> {
2996        self.client.send::<SupplicantStaIfaceCallbackOnStateChangedRequest>(
2997            payload,
2998            0x27e086d26c49eb6c,
2999            fidl::encoding::DynamicFlags::FLEXIBLE,
3000        )
3001    }
3002
3003    fn r#on_disconnected(
3004        &self,
3005        mut payload: &SupplicantStaIfaceCallbackOnDisconnectedRequest,
3006    ) -> Result<(), fidl::Error> {
3007        self.client.send::<SupplicantStaIfaceCallbackOnDisconnectedRequest>(
3008            payload,
3009            0x69546475f4dee0cc,
3010            fidl::encoding::DynamicFlags::FLEXIBLE,
3011        )
3012    }
3013
3014    fn r#on_association_rejected(
3015        &self,
3016        mut payload: &SupplicantStaIfaceCallbackOnAssociationRejectedRequest,
3017    ) -> Result<(), fidl::Error> {
3018        self.client.send::<SupplicantStaIfaceCallbackOnAssociationRejectedRequest>(
3019            payload,
3020            0x7ef3961518bed988,
3021            fidl::encoding::DynamicFlags::FLEXIBLE,
3022        )
3023    }
3024}
3025
3026pub struct SupplicantStaIfaceCallbackEventStream {
3027    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3028}
3029
3030impl std::marker::Unpin for SupplicantStaIfaceCallbackEventStream {}
3031
3032impl futures::stream::FusedStream for SupplicantStaIfaceCallbackEventStream {
3033    fn is_terminated(&self) -> bool {
3034        self.event_receiver.is_terminated()
3035    }
3036}
3037
3038impl futures::Stream for SupplicantStaIfaceCallbackEventStream {
3039    type Item = Result<SupplicantStaIfaceCallbackEvent, fidl::Error>;
3040
3041    fn poll_next(
3042        mut self: std::pin::Pin<&mut Self>,
3043        cx: &mut std::task::Context<'_>,
3044    ) -> std::task::Poll<Option<Self::Item>> {
3045        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3046            &mut self.event_receiver,
3047            cx
3048        )?) {
3049            Some(buf) => std::task::Poll::Ready(Some(SupplicantStaIfaceCallbackEvent::decode(buf))),
3050            None => std::task::Poll::Ready(None),
3051        }
3052    }
3053}
3054
3055#[derive(Debug)]
3056pub enum SupplicantStaIfaceCallbackEvent {
3057    #[non_exhaustive]
3058    _UnknownEvent {
3059        /// Ordinal of the event that was sent.
3060        ordinal: u64,
3061    },
3062}
3063
3064impl SupplicantStaIfaceCallbackEvent {
3065    /// Decodes a message buffer as a [`SupplicantStaIfaceCallbackEvent`].
3066    fn decode(
3067        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3068    ) -> Result<SupplicantStaIfaceCallbackEvent, fidl::Error> {
3069        let (bytes, _handles) = buf.split_mut();
3070        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3071        debug_assert_eq!(tx_header.tx_id, 0);
3072        match tx_header.ordinal {
3073            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3074                Ok(SupplicantStaIfaceCallbackEvent::_UnknownEvent {
3075                    ordinal: tx_header.ordinal,
3076                })
3077            }
3078            _ => Err(fidl::Error::UnknownOrdinal {
3079                ordinal: tx_header.ordinal,
3080                protocol_name: <SupplicantStaIfaceCallbackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3081            })
3082        }
3083    }
3084}
3085
3086/// A Stream of incoming requests for fuchsia.wlan.wlanix/SupplicantStaIfaceCallback.
3087pub struct SupplicantStaIfaceCallbackRequestStream {
3088    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3089    is_terminated: bool,
3090}
3091
3092impl std::marker::Unpin for SupplicantStaIfaceCallbackRequestStream {}
3093
3094impl futures::stream::FusedStream for SupplicantStaIfaceCallbackRequestStream {
3095    fn is_terminated(&self) -> bool {
3096        self.is_terminated
3097    }
3098}
3099
3100impl fidl::endpoints::RequestStream for SupplicantStaIfaceCallbackRequestStream {
3101    type Protocol = SupplicantStaIfaceCallbackMarker;
3102    type ControlHandle = SupplicantStaIfaceCallbackControlHandle;
3103
3104    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3105        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3106    }
3107
3108    fn control_handle(&self) -> Self::ControlHandle {
3109        SupplicantStaIfaceCallbackControlHandle { inner: self.inner.clone() }
3110    }
3111
3112    fn into_inner(
3113        self,
3114    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3115    {
3116        (self.inner, self.is_terminated)
3117    }
3118
3119    fn from_inner(
3120        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3121        is_terminated: bool,
3122    ) -> Self {
3123        Self { inner, is_terminated }
3124    }
3125}
3126
3127impl futures::Stream for SupplicantStaIfaceCallbackRequestStream {
3128    type Item = Result<SupplicantStaIfaceCallbackRequest, fidl::Error>;
3129
3130    fn poll_next(
3131        mut self: std::pin::Pin<&mut Self>,
3132        cx: &mut std::task::Context<'_>,
3133    ) -> std::task::Poll<Option<Self::Item>> {
3134        let this = &mut *self;
3135        if this.inner.check_shutdown(cx) {
3136            this.is_terminated = true;
3137            return std::task::Poll::Ready(None);
3138        }
3139        if this.is_terminated {
3140            panic!("polled SupplicantStaIfaceCallbackRequestStream after completion");
3141        }
3142        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3143            |bytes, handles| {
3144                match this.inner.channel().read_etc(cx, bytes, handles) {
3145                    std::task::Poll::Ready(Ok(())) => {}
3146                    std::task::Poll::Pending => return std::task::Poll::Pending,
3147                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3148                        this.is_terminated = true;
3149                        return std::task::Poll::Ready(None);
3150                    }
3151                    std::task::Poll::Ready(Err(e)) => {
3152                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3153                            e.into(),
3154                        ))))
3155                    }
3156                }
3157
3158                // A message has been received from the channel
3159                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3160
3161                std::task::Poll::Ready(Some(match header.ordinal {
3162                0x27e086d26c49eb6c => {
3163                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3164                    let mut req = fidl::new_empty!(SupplicantStaIfaceCallbackOnStateChangedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3165                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantStaIfaceCallbackOnStateChangedRequest>(&header, _body_bytes, handles, &mut req)?;
3166                    let control_handle = SupplicantStaIfaceCallbackControlHandle {
3167                        inner: this.inner.clone(),
3168                    };
3169                    Ok(SupplicantStaIfaceCallbackRequest::OnStateChanged {payload: req,
3170                        control_handle,
3171                    })
3172                }
3173                0x69546475f4dee0cc => {
3174                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3175                    let mut req = fidl::new_empty!(SupplicantStaIfaceCallbackOnDisconnectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3176                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantStaIfaceCallbackOnDisconnectedRequest>(&header, _body_bytes, handles, &mut req)?;
3177                    let control_handle = SupplicantStaIfaceCallbackControlHandle {
3178                        inner: this.inner.clone(),
3179                    };
3180                    Ok(SupplicantStaIfaceCallbackRequest::OnDisconnected {payload: req,
3181                        control_handle,
3182                    })
3183                }
3184                0x7ef3961518bed988 => {
3185                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3186                    let mut req = fidl::new_empty!(SupplicantStaIfaceCallbackOnAssociationRejectedRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3187                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantStaIfaceCallbackOnAssociationRejectedRequest>(&header, _body_bytes, handles, &mut req)?;
3188                    let control_handle = SupplicantStaIfaceCallbackControlHandle {
3189                        inner: this.inner.clone(),
3190                    };
3191                    Ok(SupplicantStaIfaceCallbackRequest::OnAssociationRejected {payload: req,
3192                        control_handle,
3193                    })
3194                }
3195                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3196                    Ok(SupplicantStaIfaceCallbackRequest::_UnknownMethod {
3197                        ordinal: header.ordinal,
3198                        control_handle: SupplicantStaIfaceCallbackControlHandle { inner: this.inner.clone() },
3199                        method_type: fidl::MethodType::OneWay,
3200                    })
3201                }
3202                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3203                    this.inner.send_framework_err(
3204                        fidl::encoding::FrameworkErr::UnknownMethod,
3205                        header.tx_id,
3206                        header.ordinal,
3207                        header.dynamic_flags(),
3208                        (bytes, handles),
3209                    )?;
3210                    Ok(SupplicantStaIfaceCallbackRequest::_UnknownMethod {
3211                        ordinal: header.ordinal,
3212                        control_handle: SupplicantStaIfaceCallbackControlHandle { inner: this.inner.clone() },
3213                        method_type: fidl::MethodType::TwoWay,
3214                    })
3215                }
3216                _ => Err(fidl::Error::UnknownOrdinal {
3217                    ordinal: header.ordinal,
3218                    protocol_name: <SupplicantStaIfaceCallbackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3219                }),
3220            }))
3221            },
3222        )
3223    }
3224}
3225
3226#[derive(Debug)]
3227pub enum SupplicantStaIfaceCallbackRequest {
3228    OnStateChanged {
3229        payload: SupplicantStaIfaceCallbackOnStateChangedRequest,
3230        control_handle: SupplicantStaIfaceCallbackControlHandle,
3231    },
3232    OnDisconnected {
3233        payload: SupplicantStaIfaceCallbackOnDisconnectedRequest,
3234        control_handle: SupplicantStaIfaceCallbackControlHandle,
3235    },
3236    OnAssociationRejected {
3237        payload: SupplicantStaIfaceCallbackOnAssociationRejectedRequest,
3238        control_handle: SupplicantStaIfaceCallbackControlHandle,
3239    },
3240    /// An interaction was received which does not match any known method.
3241    #[non_exhaustive]
3242    _UnknownMethod {
3243        /// Ordinal of the method that was called.
3244        ordinal: u64,
3245        control_handle: SupplicantStaIfaceCallbackControlHandle,
3246        method_type: fidl::MethodType,
3247    },
3248}
3249
3250impl SupplicantStaIfaceCallbackRequest {
3251    #[allow(irrefutable_let_patterns)]
3252    pub fn into_on_state_changed(
3253        self,
3254    ) -> Option<(
3255        SupplicantStaIfaceCallbackOnStateChangedRequest,
3256        SupplicantStaIfaceCallbackControlHandle,
3257    )> {
3258        if let SupplicantStaIfaceCallbackRequest::OnStateChanged { payload, control_handle } = self
3259        {
3260            Some((payload, control_handle))
3261        } else {
3262            None
3263        }
3264    }
3265
3266    #[allow(irrefutable_let_patterns)]
3267    pub fn into_on_disconnected(
3268        self,
3269    ) -> Option<(
3270        SupplicantStaIfaceCallbackOnDisconnectedRequest,
3271        SupplicantStaIfaceCallbackControlHandle,
3272    )> {
3273        if let SupplicantStaIfaceCallbackRequest::OnDisconnected { payload, control_handle } = self
3274        {
3275            Some((payload, control_handle))
3276        } else {
3277            None
3278        }
3279    }
3280
3281    #[allow(irrefutable_let_patterns)]
3282    pub fn into_on_association_rejected(
3283        self,
3284    ) -> Option<(
3285        SupplicantStaIfaceCallbackOnAssociationRejectedRequest,
3286        SupplicantStaIfaceCallbackControlHandle,
3287    )> {
3288        if let SupplicantStaIfaceCallbackRequest::OnAssociationRejected {
3289            payload,
3290            control_handle,
3291        } = self
3292        {
3293            Some((payload, control_handle))
3294        } else {
3295            None
3296        }
3297    }
3298
3299    /// Name of the method defined in FIDL
3300    pub fn method_name(&self) -> &'static str {
3301        match *self {
3302            SupplicantStaIfaceCallbackRequest::OnStateChanged { .. } => "on_state_changed",
3303            SupplicantStaIfaceCallbackRequest::OnDisconnected { .. } => "on_disconnected",
3304            SupplicantStaIfaceCallbackRequest::OnAssociationRejected { .. } => {
3305                "on_association_rejected"
3306            }
3307            SupplicantStaIfaceCallbackRequest::_UnknownMethod {
3308                method_type: fidl::MethodType::OneWay,
3309                ..
3310            } => "unknown one-way method",
3311            SupplicantStaIfaceCallbackRequest::_UnknownMethod {
3312                method_type: fidl::MethodType::TwoWay,
3313                ..
3314            } => "unknown two-way method",
3315        }
3316    }
3317}
3318
3319#[derive(Debug, Clone)]
3320pub struct SupplicantStaIfaceCallbackControlHandle {
3321    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3322}
3323
3324impl fidl::endpoints::ControlHandle for SupplicantStaIfaceCallbackControlHandle {
3325    fn shutdown(&self) {
3326        self.inner.shutdown()
3327    }
3328    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3329        self.inner.shutdown_with_epitaph(status)
3330    }
3331
3332    fn is_closed(&self) -> bool {
3333        self.inner.channel().is_closed()
3334    }
3335    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3336        self.inner.channel().on_closed()
3337    }
3338
3339    #[cfg(target_os = "fuchsia")]
3340    fn signal_peer(
3341        &self,
3342        clear_mask: zx::Signals,
3343        set_mask: zx::Signals,
3344    ) -> Result<(), zx_status::Status> {
3345        use fidl::Peered;
3346        self.inner.channel().signal_peer(clear_mask, set_mask)
3347    }
3348}
3349
3350impl SupplicantStaIfaceCallbackControlHandle {}
3351
3352#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3353pub struct SupplicantStaNetworkMarker;
3354
3355impl fidl::endpoints::ProtocolMarker for SupplicantStaNetworkMarker {
3356    type Proxy = SupplicantStaNetworkProxy;
3357    type RequestStream = SupplicantStaNetworkRequestStream;
3358    #[cfg(target_os = "fuchsia")]
3359    type SynchronousProxy = SupplicantStaNetworkSynchronousProxy;
3360
3361    const DEBUG_NAME: &'static str = "(anonymous) SupplicantStaNetwork";
3362}
3363pub type SupplicantStaNetworkSelectResult = Result<(), i32>;
3364
3365pub trait SupplicantStaNetworkProxyInterface: Send + Sync {
3366    fn r#set_bssid(&self, payload: &SupplicantStaNetworkSetBssidRequest)
3367        -> Result<(), fidl::Error>;
3368    fn r#clear_bssid(&self) -> Result<(), fidl::Error>;
3369    fn r#set_ssid(&self, payload: &SupplicantStaNetworkSetSsidRequest) -> Result<(), fidl::Error>;
3370    fn r#set_psk_passphrase(
3371        &self,
3372        payload: &SupplicantStaNetworkSetPskPassphraseRequest,
3373    ) -> Result<(), fidl::Error>;
3374    type SelectResponseFut: std::future::Future<Output = Result<SupplicantStaNetworkSelectResult, fidl::Error>>
3375        + Send;
3376    fn r#select(&self) -> Self::SelectResponseFut;
3377}
3378#[derive(Debug)]
3379#[cfg(target_os = "fuchsia")]
3380pub struct SupplicantStaNetworkSynchronousProxy {
3381    client: fidl::client::sync::Client,
3382}
3383
3384#[cfg(target_os = "fuchsia")]
3385impl fidl::endpoints::SynchronousProxy for SupplicantStaNetworkSynchronousProxy {
3386    type Proxy = SupplicantStaNetworkProxy;
3387    type Protocol = SupplicantStaNetworkMarker;
3388
3389    fn from_channel(inner: fidl::Channel) -> Self {
3390        Self::new(inner)
3391    }
3392
3393    fn into_channel(self) -> fidl::Channel {
3394        self.client.into_channel()
3395    }
3396
3397    fn as_channel(&self) -> &fidl::Channel {
3398        self.client.as_channel()
3399    }
3400}
3401
3402#[cfg(target_os = "fuchsia")]
3403impl SupplicantStaNetworkSynchronousProxy {
3404    pub fn new(channel: fidl::Channel) -> Self {
3405        let protocol_name =
3406            <SupplicantStaNetworkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3407        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3408    }
3409
3410    pub fn into_channel(self) -> fidl::Channel {
3411        self.client.into_channel()
3412    }
3413
3414    /// Waits until an event arrives and returns it. It is safe for other
3415    /// threads to make concurrent requests while waiting for an event.
3416    pub fn wait_for_event(
3417        &self,
3418        deadline: zx::MonotonicInstant,
3419    ) -> Result<SupplicantStaNetworkEvent, fidl::Error> {
3420        SupplicantStaNetworkEvent::decode(self.client.wait_for_event(deadline)?)
3421    }
3422
3423    pub fn r#set_bssid(
3424        &self,
3425        mut payload: &SupplicantStaNetworkSetBssidRequest,
3426    ) -> Result<(), fidl::Error> {
3427        self.client.send::<SupplicantStaNetworkSetBssidRequest>(
3428            payload,
3429            0x10a91d044ee6374d,
3430            fidl::encoding::DynamicFlags::FLEXIBLE,
3431        )
3432    }
3433
3434    pub fn r#clear_bssid(&self) -> Result<(), fidl::Error> {
3435        self.client.send::<fidl::encoding::EmptyPayload>(
3436            (),
3437            0xbc7ad82f541b267,
3438            fidl::encoding::DynamicFlags::FLEXIBLE,
3439        )
3440    }
3441
3442    pub fn r#set_ssid(
3443        &self,
3444        mut payload: &SupplicantStaNetworkSetSsidRequest,
3445    ) -> Result<(), fidl::Error> {
3446        self.client.send::<SupplicantStaNetworkSetSsidRequest>(
3447            payload,
3448            0x6b598a7a802e3083,
3449            fidl::encoding::DynamicFlags::FLEXIBLE,
3450        )
3451    }
3452
3453    pub fn r#set_psk_passphrase(
3454        &self,
3455        mut payload: &SupplicantStaNetworkSetPskPassphraseRequest,
3456    ) -> Result<(), fidl::Error> {
3457        self.client.send::<SupplicantStaNetworkSetPskPassphraseRequest>(
3458            payload,
3459            0xf6d438225979307,
3460            fidl::encoding::DynamicFlags::FLEXIBLE,
3461        )
3462    }
3463
3464    pub fn r#select(
3465        &self,
3466        ___deadline: zx::MonotonicInstant,
3467    ) -> Result<SupplicantStaNetworkSelectResult, fidl::Error> {
3468        let _response = self.client.send_query::<
3469            fidl::encoding::EmptyPayload,
3470            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
3471        >(
3472            (),
3473            0x354bc361a0c77b45,
3474            fidl::encoding::DynamicFlags::FLEXIBLE,
3475            ___deadline,
3476        )?
3477        .into_result::<SupplicantStaNetworkMarker>("select")?;
3478        Ok(_response.map(|x| x))
3479    }
3480}
3481
3482#[cfg(target_os = "fuchsia")]
3483impl From<SupplicantStaNetworkSynchronousProxy> for zx::Handle {
3484    fn from(value: SupplicantStaNetworkSynchronousProxy) -> Self {
3485        value.into_channel().into()
3486    }
3487}
3488
3489#[cfg(target_os = "fuchsia")]
3490impl From<fidl::Channel> for SupplicantStaNetworkSynchronousProxy {
3491    fn from(value: fidl::Channel) -> Self {
3492        Self::new(value)
3493    }
3494}
3495
3496#[derive(Debug, Clone)]
3497pub struct SupplicantStaNetworkProxy {
3498    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3499}
3500
3501impl fidl::endpoints::Proxy for SupplicantStaNetworkProxy {
3502    type Protocol = SupplicantStaNetworkMarker;
3503
3504    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3505        Self::new(inner)
3506    }
3507
3508    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3509        self.client.into_channel().map_err(|client| Self { client })
3510    }
3511
3512    fn as_channel(&self) -> &::fidl::AsyncChannel {
3513        self.client.as_channel()
3514    }
3515}
3516
3517impl SupplicantStaNetworkProxy {
3518    /// Create a new Proxy for fuchsia.wlan.wlanix/SupplicantStaNetwork.
3519    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3520        let protocol_name =
3521            <SupplicantStaNetworkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3522        Self { client: fidl::client::Client::new(channel, protocol_name) }
3523    }
3524
3525    /// Get a Stream of events from the remote end of the protocol.
3526    ///
3527    /// # Panics
3528    ///
3529    /// Panics if the event stream was already taken.
3530    pub fn take_event_stream(&self) -> SupplicantStaNetworkEventStream {
3531        SupplicantStaNetworkEventStream { event_receiver: self.client.take_event_receiver() }
3532    }
3533
3534    pub fn r#set_bssid(
3535        &self,
3536        mut payload: &SupplicantStaNetworkSetBssidRequest,
3537    ) -> Result<(), fidl::Error> {
3538        SupplicantStaNetworkProxyInterface::r#set_bssid(self, payload)
3539    }
3540
3541    pub fn r#clear_bssid(&self) -> Result<(), fidl::Error> {
3542        SupplicantStaNetworkProxyInterface::r#clear_bssid(self)
3543    }
3544
3545    pub fn r#set_ssid(
3546        &self,
3547        mut payload: &SupplicantStaNetworkSetSsidRequest,
3548    ) -> Result<(), fidl::Error> {
3549        SupplicantStaNetworkProxyInterface::r#set_ssid(self, payload)
3550    }
3551
3552    pub fn r#set_psk_passphrase(
3553        &self,
3554        mut payload: &SupplicantStaNetworkSetPskPassphraseRequest,
3555    ) -> Result<(), fidl::Error> {
3556        SupplicantStaNetworkProxyInterface::r#set_psk_passphrase(self, payload)
3557    }
3558
3559    pub fn r#select(
3560        &self,
3561    ) -> fidl::client::QueryResponseFut<
3562        SupplicantStaNetworkSelectResult,
3563        fidl::encoding::DefaultFuchsiaResourceDialect,
3564    > {
3565        SupplicantStaNetworkProxyInterface::r#select(self)
3566    }
3567}
3568
3569impl SupplicantStaNetworkProxyInterface for SupplicantStaNetworkProxy {
3570    fn r#set_bssid(
3571        &self,
3572        mut payload: &SupplicantStaNetworkSetBssidRequest,
3573    ) -> Result<(), fidl::Error> {
3574        self.client.send::<SupplicantStaNetworkSetBssidRequest>(
3575            payload,
3576            0x10a91d044ee6374d,
3577            fidl::encoding::DynamicFlags::FLEXIBLE,
3578        )
3579    }
3580
3581    fn r#clear_bssid(&self) -> Result<(), fidl::Error> {
3582        self.client.send::<fidl::encoding::EmptyPayload>(
3583            (),
3584            0xbc7ad82f541b267,
3585            fidl::encoding::DynamicFlags::FLEXIBLE,
3586        )
3587    }
3588
3589    fn r#set_ssid(
3590        &self,
3591        mut payload: &SupplicantStaNetworkSetSsidRequest,
3592    ) -> Result<(), fidl::Error> {
3593        self.client.send::<SupplicantStaNetworkSetSsidRequest>(
3594            payload,
3595            0x6b598a7a802e3083,
3596            fidl::encoding::DynamicFlags::FLEXIBLE,
3597        )
3598    }
3599
3600    fn r#set_psk_passphrase(
3601        &self,
3602        mut payload: &SupplicantStaNetworkSetPskPassphraseRequest,
3603    ) -> Result<(), fidl::Error> {
3604        self.client.send::<SupplicantStaNetworkSetPskPassphraseRequest>(
3605            payload,
3606            0xf6d438225979307,
3607            fidl::encoding::DynamicFlags::FLEXIBLE,
3608        )
3609    }
3610
3611    type SelectResponseFut = fidl::client::QueryResponseFut<
3612        SupplicantStaNetworkSelectResult,
3613        fidl::encoding::DefaultFuchsiaResourceDialect,
3614    >;
3615    fn r#select(&self) -> Self::SelectResponseFut {
3616        fn _decode(
3617            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3618        ) -> Result<SupplicantStaNetworkSelectResult, fidl::Error> {
3619            let _response = fidl::client::decode_transaction_body::<
3620                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
3621                fidl::encoding::DefaultFuchsiaResourceDialect,
3622                0x354bc361a0c77b45,
3623            >(_buf?)?
3624            .into_result::<SupplicantStaNetworkMarker>("select")?;
3625            Ok(_response.map(|x| x))
3626        }
3627        self.client.send_query_and_decode::<
3628            fidl::encoding::EmptyPayload,
3629            SupplicantStaNetworkSelectResult,
3630        >(
3631            (),
3632            0x354bc361a0c77b45,
3633            fidl::encoding::DynamicFlags::FLEXIBLE,
3634            _decode,
3635        )
3636    }
3637}
3638
3639pub struct SupplicantStaNetworkEventStream {
3640    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3641}
3642
3643impl std::marker::Unpin for SupplicantStaNetworkEventStream {}
3644
3645impl futures::stream::FusedStream for SupplicantStaNetworkEventStream {
3646    fn is_terminated(&self) -> bool {
3647        self.event_receiver.is_terminated()
3648    }
3649}
3650
3651impl futures::Stream for SupplicantStaNetworkEventStream {
3652    type Item = Result<SupplicantStaNetworkEvent, fidl::Error>;
3653
3654    fn poll_next(
3655        mut self: std::pin::Pin<&mut Self>,
3656        cx: &mut std::task::Context<'_>,
3657    ) -> std::task::Poll<Option<Self::Item>> {
3658        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3659            &mut self.event_receiver,
3660            cx
3661        )?) {
3662            Some(buf) => std::task::Poll::Ready(Some(SupplicantStaNetworkEvent::decode(buf))),
3663            None => std::task::Poll::Ready(None),
3664        }
3665    }
3666}
3667
3668#[derive(Debug)]
3669pub enum SupplicantStaNetworkEvent {
3670    #[non_exhaustive]
3671    _UnknownEvent {
3672        /// Ordinal of the event that was sent.
3673        ordinal: u64,
3674    },
3675}
3676
3677impl SupplicantStaNetworkEvent {
3678    /// Decodes a message buffer as a [`SupplicantStaNetworkEvent`].
3679    fn decode(
3680        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3681    ) -> Result<SupplicantStaNetworkEvent, fidl::Error> {
3682        let (bytes, _handles) = buf.split_mut();
3683        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3684        debug_assert_eq!(tx_header.tx_id, 0);
3685        match tx_header.ordinal {
3686            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3687                Ok(SupplicantStaNetworkEvent::_UnknownEvent { ordinal: tx_header.ordinal })
3688            }
3689            _ => Err(fidl::Error::UnknownOrdinal {
3690                ordinal: tx_header.ordinal,
3691                protocol_name:
3692                    <SupplicantStaNetworkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3693            }),
3694        }
3695    }
3696}
3697
3698/// A Stream of incoming requests for fuchsia.wlan.wlanix/SupplicantStaNetwork.
3699pub struct SupplicantStaNetworkRequestStream {
3700    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3701    is_terminated: bool,
3702}
3703
3704impl std::marker::Unpin for SupplicantStaNetworkRequestStream {}
3705
3706impl futures::stream::FusedStream for SupplicantStaNetworkRequestStream {
3707    fn is_terminated(&self) -> bool {
3708        self.is_terminated
3709    }
3710}
3711
3712impl fidl::endpoints::RequestStream for SupplicantStaNetworkRequestStream {
3713    type Protocol = SupplicantStaNetworkMarker;
3714    type ControlHandle = SupplicantStaNetworkControlHandle;
3715
3716    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3717        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3718    }
3719
3720    fn control_handle(&self) -> Self::ControlHandle {
3721        SupplicantStaNetworkControlHandle { inner: self.inner.clone() }
3722    }
3723
3724    fn into_inner(
3725        self,
3726    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3727    {
3728        (self.inner, self.is_terminated)
3729    }
3730
3731    fn from_inner(
3732        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3733        is_terminated: bool,
3734    ) -> Self {
3735        Self { inner, is_terminated }
3736    }
3737}
3738
3739impl futures::Stream for SupplicantStaNetworkRequestStream {
3740    type Item = Result<SupplicantStaNetworkRequest, fidl::Error>;
3741
3742    fn poll_next(
3743        mut self: std::pin::Pin<&mut Self>,
3744        cx: &mut std::task::Context<'_>,
3745    ) -> std::task::Poll<Option<Self::Item>> {
3746        let this = &mut *self;
3747        if this.inner.check_shutdown(cx) {
3748            this.is_terminated = true;
3749            return std::task::Poll::Ready(None);
3750        }
3751        if this.is_terminated {
3752            panic!("polled SupplicantStaNetworkRequestStream after completion");
3753        }
3754        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3755            |bytes, handles| {
3756                match this.inner.channel().read_etc(cx, bytes, handles) {
3757                    std::task::Poll::Ready(Ok(())) => {}
3758                    std::task::Poll::Pending => return std::task::Poll::Pending,
3759                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3760                        this.is_terminated = true;
3761                        return std::task::Poll::Ready(None);
3762                    }
3763                    std::task::Poll::Ready(Err(e)) => {
3764                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3765                            e.into(),
3766                        ))))
3767                    }
3768                }
3769
3770                // A message has been received from the channel
3771                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3772
3773                std::task::Poll::Ready(Some(match header.ordinal {
3774                0x10a91d044ee6374d => {
3775                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3776                    let mut req = fidl::new_empty!(SupplicantStaNetworkSetBssidRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3777                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantStaNetworkSetBssidRequest>(&header, _body_bytes, handles, &mut req)?;
3778                    let control_handle = SupplicantStaNetworkControlHandle {
3779                        inner: this.inner.clone(),
3780                    };
3781                    Ok(SupplicantStaNetworkRequest::SetBssid {payload: req,
3782                        control_handle,
3783                    })
3784                }
3785                0xbc7ad82f541b267 => {
3786                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3787                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
3788                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3789                    let control_handle = SupplicantStaNetworkControlHandle {
3790                        inner: this.inner.clone(),
3791                    };
3792                    Ok(SupplicantStaNetworkRequest::ClearBssid {
3793                        control_handle,
3794                    })
3795                }
3796                0x6b598a7a802e3083 => {
3797                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3798                    let mut req = fidl::new_empty!(SupplicantStaNetworkSetSsidRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3799                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantStaNetworkSetSsidRequest>(&header, _body_bytes, handles, &mut req)?;
3800                    let control_handle = SupplicantStaNetworkControlHandle {
3801                        inner: this.inner.clone(),
3802                    };
3803                    Ok(SupplicantStaNetworkRequest::SetSsid {payload: req,
3804                        control_handle,
3805                    })
3806                }
3807                0xf6d438225979307 => {
3808                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3809                    let mut req = fidl::new_empty!(SupplicantStaNetworkSetPskPassphraseRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3810                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<SupplicantStaNetworkSetPskPassphraseRequest>(&header, _body_bytes, handles, &mut req)?;
3811                    let control_handle = SupplicantStaNetworkControlHandle {
3812                        inner: this.inner.clone(),
3813                    };
3814                    Ok(SupplicantStaNetworkRequest::SetPskPassphrase {payload: req,
3815                        control_handle,
3816                    })
3817                }
3818                0x354bc361a0c77b45 => {
3819                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3820                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
3821                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3822                    let control_handle = SupplicantStaNetworkControlHandle {
3823                        inner: this.inner.clone(),
3824                    };
3825                    Ok(SupplicantStaNetworkRequest::Select {
3826                        responder: SupplicantStaNetworkSelectResponder {
3827                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3828                            tx_id: header.tx_id,
3829                        },
3830                    })
3831                }
3832                _ if header.tx_id == 0 && header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3833                    Ok(SupplicantStaNetworkRequest::_UnknownMethod {
3834                        ordinal: header.ordinal,
3835                        control_handle: SupplicantStaNetworkControlHandle { inner: this.inner.clone() },
3836                        method_type: fidl::MethodType::OneWay,
3837                    })
3838                }
3839                _ if header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
3840                    this.inner.send_framework_err(
3841                        fidl::encoding::FrameworkErr::UnknownMethod,
3842                        header.tx_id,
3843                        header.ordinal,
3844                        header.dynamic_flags(),
3845                        (bytes, handles),
3846                    )?;
3847                    Ok(SupplicantStaNetworkRequest::_UnknownMethod {
3848                        ordinal: header.ordinal,
3849                        control_handle: SupplicantStaNetworkControlHandle { inner: this.inner.clone() },
3850                        method_type: fidl::MethodType::TwoWay,
3851                    })
3852                }
3853                _ => Err(fidl::Error::UnknownOrdinal {
3854                    ordinal: header.ordinal,
3855                    protocol_name: <SupplicantStaNetworkMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3856                }),
3857            }))
3858            },
3859        )
3860    }
3861}
3862
3863#[derive(Debug)]
3864pub enum SupplicantStaNetworkRequest {
3865    SetBssid {
3866        payload: SupplicantStaNetworkSetBssidRequest,
3867        control_handle: SupplicantStaNetworkControlHandle,
3868    },
3869    ClearBssid {
3870        control_handle: SupplicantStaNetworkControlHandle,
3871    },
3872    SetSsid {
3873        payload: SupplicantStaNetworkSetSsidRequest,
3874        control_handle: SupplicantStaNetworkControlHandle,
3875    },
3876    SetPskPassphrase {
3877        payload: SupplicantStaNetworkSetPskPassphraseRequest,
3878        control_handle: SupplicantStaNetworkControlHandle,
3879    },
3880    Select {
3881        responder: SupplicantStaNetworkSelectResponder,
3882    },
3883    /// An interaction was received which does not match any known method.
3884    #[non_exhaustive]
3885    _UnknownMethod {
3886        /// Ordinal of the method that was called.
3887        ordinal: u64,
3888        control_handle: SupplicantStaNetworkControlHandle,
3889        method_type: fidl::MethodType,
3890    },
3891}
3892
3893impl SupplicantStaNetworkRequest {
3894    #[allow(irrefutable_let_patterns)]
3895    pub fn into_set_bssid(
3896        self,
3897    ) -> Option<(SupplicantStaNetworkSetBssidRequest, SupplicantStaNetworkControlHandle)> {
3898        if let SupplicantStaNetworkRequest::SetBssid { payload, control_handle } = self {
3899            Some((payload, control_handle))
3900        } else {
3901            None
3902        }
3903    }
3904
3905    #[allow(irrefutable_let_patterns)]
3906    pub fn into_clear_bssid(self) -> Option<(SupplicantStaNetworkControlHandle)> {
3907        if let SupplicantStaNetworkRequest::ClearBssid { control_handle } = self {
3908            Some((control_handle))
3909        } else {
3910            None
3911        }
3912    }
3913
3914    #[allow(irrefutable_let_patterns)]
3915    pub fn into_set_ssid(
3916        self,
3917    ) -> Option<(SupplicantStaNetworkSetSsidRequest, SupplicantStaNetworkControlHandle)> {
3918        if let SupplicantStaNetworkRequest::SetSsid { payload, control_handle } = self {
3919            Some((payload, control_handle))
3920        } else {
3921            None
3922        }
3923    }
3924
3925    #[allow(irrefutable_let_patterns)]
3926    pub fn into_set_psk_passphrase(
3927        self,
3928    ) -> Option<(SupplicantStaNetworkSetPskPassphraseRequest, SupplicantStaNetworkControlHandle)>
3929    {
3930        if let SupplicantStaNetworkRequest::SetPskPassphrase { payload, control_handle } = self {
3931            Some((payload, control_handle))
3932        } else {
3933            None
3934        }
3935    }
3936
3937    #[allow(irrefutable_let_patterns)]
3938    pub fn into_select(self) -> Option<(SupplicantStaNetworkSelectResponder)> {
3939        if let SupplicantStaNetworkRequest::Select { responder } = self {
3940            Some((responder))
3941        } else {
3942            None
3943        }
3944    }
3945
3946    /// Name of the method defined in FIDL
3947    pub fn method_name(&self) -> &'static str {
3948        match *self {
3949            SupplicantStaNetworkRequest::SetBssid { .. } => "set_bssid",
3950            SupplicantStaNetworkRequest::ClearBssid { .. } => "clear_bssid",
3951            SupplicantStaNetworkRequest::SetSsid { .. } => "set_ssid",
3952            SupplicantStaNetworkRequest::SetPskPassphrase { .. } => "set_psk_passphrase",
3953            SupplicantStaNetworkRequest::Select { .. } => "select",
3954            SupplicantStaNetworkRequest::_UnknownMethod {
3955                method_type: fidl::MethodType::OneWay,
3956                ..
3957            } => "unknown one-way method",
3958            SupplicantStaNetworkRequest::_UnknownMethod {
3959                method_type: fidl::MethodType::TwoWay,
3960                ..
3961            } => "unknown two-way method",
3962        }
3963    }
3964}
3965
3966#[derive(Debug, Clone)]
3967pub struct SupplicantStaNetworkControlHandle {
3968    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3969}
3970
3971impl fidl::endpoints::ControlHandle for SupplicantStaNetworkControlHandle {
3972    fn shutdown(&self) {
3973        self.inner.shutdown()
3974    }
3975    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3976        self.inner.shutdown_with_epitaph(status)
3977    }
3978
3979    fn is_closed(&self) -> bool {
3980        self.inner.channel().is_closed()
3981    }
3982    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3983        self.inner.channel().on_closed()
3984    }
3985
3986    #[cfg(target_os = "fuchsia")]
3987    fn signal_peer(
3988        &self,
3989        clear_mask: zx::Signals,
3990        set_mask: zx::Signals,
3991    ) -> Result<(), zx_status::Status> {
3992        use fidl::Peered;
3993        self.inner.channel().signal_peer(clear_mask, set_mask)
3994    }
3995}
3996
3997impl SupplicantStaNetworkControlHandle {}
3998
3999#[must_use = "FIDL methods require a response to be sent"]
4000#[derive(Debug)]
4001pub struct SupplicantStaNetworkSelectResponder {
4002    control_handle: std::mem::ManuallyDrop<SupplicantStaNetworkControlHandle>,
4003    tx_id: u32,
4004}
4005
4006/// Set the the channel to be shutdown (see [`SupplicantStaNetworkControlHandle::shutdown`])
4007/// if the responder is dropped without sending a response, so that the client
4008/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4009impl std::ops::Drop for SupplicantStaNetworkSelectResponder {
4010    fn drop(&mut self) {
4011        self.control_handle.shutdown();
4012        // Safety: drops once, never accessed again
4013        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4014    }
4015}
4016
4017impl fidl::endpoints::Responder for SupplicantStaNetworkSelectResponder {
4018    type ControlHandle = SupplicantStaNetworkControlHandle;
4019
4020    fn control_handle(&self) -> &SupplicantStaNetworkControlHandle {
4021        &self.control_handle
4022    }
4023
4024    fn drop_without_shutdown(mut self) {
4025        // Safety: drops once, never accessed again due to mem::forget
4026        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4027        // Prevent Drop from running (which would shut down the channel)
4028        std::mem::forget(self);
4029    }
4030}
4031
4032impl SupplicantStaNetworkSelectResponder {
4033    /// Sends a response to the FIDL transaction.
4034    ///
4035    /// Sets the channel to shutdown if an error occurs.
4036    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4037        let _result = self.send_raw(result);
4038        if _result.is_err() {
4039            self.control_handle.shutdown();
4040        }
4041        self.drop_without_shutdown();
4042        _result
4043    }
4044
4045    /// Similar to "send" but does not shutdown the channel if an error occurs.
4046    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4047        let _result = self.send_raw(result);
4048        self.drop_without_shutdown();
4049        _result
4050    }
4051
4052    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4053        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4054            fidl::encoding::EmptyStruct,
4055            i32,
4056        >>(
4057            fidl::encoding::FlexibleResult::new(result),
4058            self.tx_id,
4059            0x354bc361a0c77b45,
4060            fidl::encoding::DynamicFlags::FLEXIBLE,
4061        )
4062    }
4063}
4064
4065#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4066pub struct WifiMarker;
4067
4068impl fidl::endpoints::ProtocolMarker for WifiMarker {
4069    type Proxy = WifiProxy;
4070    type RequestStream = WifiRequestStream;
4071    #[cfg(target_os = "fuchsia")]
4072    type SynchronousProxy = WifiSynchronousProxy;
4073
4074    const DEBUG_NAME: &'static str = "(anonymous) Wifi";
4075}
4076pub type WifiStartResult = Result<(), i32>;
4077pub type WifiStopResult = Result<(), i32>;
4078pub type WifiGetChipResult = Result<(), i32>;
4079
4080pub trait WifiProxyInterface: Send + Sync {
4081    fn r#register_event_callback(
4082        &self,
4083        payload: WifiRegisterEventCallbackRequest,
4084    ) -> Result<(), fidl::Error>;
4085    type StartResponseFut: std::future::Future<Output = Result<WifiStartResult, fidl::Error>> + Send;
4086    fn r#start(&self) -> Self::StartResponseFut;
4087    type StopResponseFut: std::future::Future<Output = Result<WifiStopResult, fidl::Error>> + Send;
4088    fn r#stop(&self) -> Self::StopResponseFut;
4089    type GetStateResponseFut: std::future::Future<Output = Result<WifiGetStateResponse, fidl::Error>>
4090        + Send;
4091    fn r#get_state(&self) -> Self::GetStateResponseFut;
4092    type GetChipIdsResponseFut: std::future::Future<Output = Result<WifiGetChipIdsResponse, fidl::Error>>
4093        + Send;
4094    fn r#get_chip_ids(&self) -> Self::GetChipIdsResponseFut;
4095    type GetChipResponseFut: std::future::Future<Output = Result<WifiGetChipResult, fidl::Error>>
4096        + Send;
4097    fn r#get_chip(&self, payload: WifiGetChipRequest) -> Self::GetChipResponseFut;
4098}
4099#[derive(Debug)]
4100#[cfg(target_os = "fuchsia")]
4101pub struct WifiSynchronousProxy {
4102    client: fidl::client::sync::Client,
4103}
4104
4105#[cfg(target_os = "fuchsia")]
4106impl fidl::endpoints::SynchronousProxy for WifiSynchronousProxy {
4107    type Proxy = WifiProxy;
4108    type Protocol = WifiMarker;
4109
4110    fn from_channel(inner: fidl::Channel) -> Self {
4111        Self::new(inner)
4112    }
4113
4114    fn into_channel(self) -> fidl::Channel {
4115        self.client.into_channel()
4116    }
4117
4118    fn as_channel(&self) -> &fidl::Channel {
4119        self.client.as_channel()
4120    }
4121}
4122
4123#[cfg(target_os = "fuchsia")]
4124impl WifiSynchronousProxy {
4125    pub fn new(channel: fidl::Channel) -> Self {
4126        let protocol_name = <WifiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4127        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4128    }
4129
4130    pub fn into_channel(self) -> fidl::Channel {
4131        self.client.into_channel()
4132    }
4133
4134    /// Waits until an event arrives and returns it. It is safe for other
4135    /// threads to make concurrent requests while waiting for an event.
4136    pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<WifiEvent, fidl::Error> {
4137        WifiEvent::decode(self.client.wait_for_event(deadline)?)
4138    }
4139
4140    /// Register a callback to be notified of future events (such when WiFi has
4141    /// started or stopped)
4142    pub fn r#register_event_callback(
4143        &self,
4144        mut payload: WifiRegisterEventCallbackRequest,
4145    ) -> Result<(), fidl::Error> {
4146        self.client.send::<WifiRegisterEventCallbackRequest>(
4147            &mut payload,
4148            0x12abbdea948dd67b,
4149            fidl::encoding::DynamicFlags::FLEXIBLE,
4150        )
4151    }
4152
4153    /// Start WiFi. If this operation is not successful, return an error status.
4154    /// If this operation is successful, the `started` state is now true and all
4155    /// registered callbacks will be notified with an `OnStart` event.
4156    pub fn r#start(
4157        &self,
4158        ___deadline: zx::MonotonicInstant,
4159    ) -> Result<WifiStartResult, fidl::Error> {
4160        let _response = self.client.send_query::<
4161            fidl::encoding::EmptyPayload,
4162            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
4163        >(
4164            (),
4165            0x427030e4dc6ec07a,
4166            fidl::encoding::DynamicFlags::FLEXIBLE,
4167            ___deadline,
4168        )?
4169        .into_result::<WifiMarker>("start")?;
4170        Ok(_response.map(|x| x))
4171    }
4172
4173    /// Stop WiFi. If this operation is not successful, return an error status.
4174    /// If this operation is successful, the `started` state is now false and all
4175    /// registered callbacks will be notified with an `OnStop` event.
4176    pub fn r#stop(&self, ___deadline: zx::MonotonicInstant) -> Result<WifiStopResult, fidl::Error> {
4177        let _response = self.client.send_query::<
4178            fidl::encoding::EmptyPayload,
4179            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
4180        >(
4181            (),
4182            0x67c9bdf61b2888d,
4183            fidl::encoding::DynamicFlags::FLEXIBLE,
4184            ___deadline,
4185        )?
4186        .into_result::<WifiMarker>("stop")?;
4187        Ok(_response.map(|x| x))
4188    }
4189
4190    /// Return a boolean based on whether WiFi is `started` or not.
4191    pub fn r#get_state(
4192        &self,
4193        ___deadline: zx::MonotonicInstant,
4194    ) -> Result<WifiGetStateResponse, fidl::Error> {
4195        let _response = self.client.send_query::<
4196            fidl::encoding::EmptyPayload,
4197            fidl::encoding::FlexibleType<WifiGetStateResponse>,
4198        >(
4199            (),
4200            0x4616114a937d1fb0,
4201            fidl::encoding::DynamicFlags::FLEXIBLE,
4202            ___deadline,
4203        )?
4204        .into_result::<WifiMarker>("get_state")?;
4205        Ok(_response)
4206    }
4207
4208    /// Get the IDs of all the WiFi chips on the device.
4209    pub fn r#get_chip_ids(
4210        &self,
4211        ___deadline: zx::MonotonicInstant,
4212    ) -> Result<WifiGetChipIdsResponse, fidl::Error> {
4213        let _response = self.client.send_query::<
4214            fidl::encoding::EmptyPayload,
4215            fidl::encoding::FlexibleType<WifiGetChipIdsResponse>,
4216        >(
4217            (),
4218            0x2fb4f92351d802b5,
4219            fidl::encoding::DynamicFlags::FLEXIBLE,
4220            ___deadline,
4221        )?
4222        .into_result::<WifiMarker>("get_chip_ids")?;
4223        Ok(_response)
4224    }
4225
4226    /// Register the channel to make request to the `WifiChip` with the given
4227    /// `chip_id`
4228    pub fn r#get_chip(
4229        &self,
4230        mut payload: WifiGetChipRequest,
4231        ___deadline: zx::MonotonicInstant,
4232    ) -> Result<WifiGetChipResult, fidl::Error> {
4233        let _response = self.client.send_query::<
4234            WifiGetChipRequest,
4235            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
4236        >(
4237            &mut payload,
4238            0xef95d8246612540,
4239            fidl::encoding::DynamicFlags::FLEXIBLE,
4240            ___deadline,
4241        )?
4242        .into_result::<WifiMarker>("get_chip")?;
4243        Ok(_response.map(|x| x))
4244    }
4245}
4246
4247#[cfg(target_os = "fuchsia")]
4248impl From<WifiSynchronousProxy> for zx::Handle {
4249    fn from(value: WifiSynchronousProxy) -> Self {
4250        value.into_channel().into()
4251    }
4252}
4253
4254#[cfg(target_os = "fuchsia")]
4255impl From<fidl::Channel> for WifiSynchronousProxy {
4256    fn from(value: fidl::Channel) -> Self {
4257        Self::new(value)
4258    }
4259}
4260
4261#[derive(Debug, Clone)]
4262pub struct WifiProxy {
4263    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4264}
4265
4266impl fidl::endpoints::Proxy for WifiProxy {
4267    type Protocol = WifiMarker;
4268
4269    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4270        Self::new(inner)
4271    }
4272
4273    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4274        self.client.into_channel().map_err(|client| Self { client })
4275    }
4276
4277    fn as_channel(&self) -> &::fidl::AsyncChannel {
4278        self.client.as_channel()
4279    }
4280}
4281
4282impl WifiProxy {
4283    /// Create a new Proxy for fuchsia.wlan.wlanix/Wifi.
4284    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4285        let protocol_name = <WifiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4286        Self { client: fidl::client::Client::new(channel, protocol_name) }
4287    }
4288
4289    /// Get a Stream of events from the remote end of the protocol.
4290    ///
4291    /// # Panics
4292    ///
4293    /// Panics if the event stream was already taken.
4294    pub fn take_event_stream(&self) -> WifiEventStream {
4295        WifiEventStream { event_receiver: self.client.take_event_receiver() }
4296    }
4297
4298    /// Register a callback to be notified of future events (such when WiFi has
4299    /// started or stopped)
4300    pub fn r#register_event_callback(
4301        &self,
4302        mut payload: WifiRegisterEventCallbackRequest,
4303    ) -> Result<(), fidl::Error> {
4304        WifiProxyInterface::r#register_event_callback(self, payload)
4305    }
4306
4307    /// Start WiFi. If this operation is not successful, return an error status.
4308    /// If this operation is successful, the `started` state is now true and all
4309    /// registered callbacks will be notified with an `OnStart` event.
4310    pub fn r#start(
4311        &self,
4312    ) -> fidl::client::QueryResponseFut<
4313        WifiStartResult,
4314        fidl::encoding::DefaultFuchsiaResourceDialect,
4315    > {
4316        WifiProxyInterface::r#start(self)
4317    }
4318
4319    /// Stop WiFi. If this operation is not successful, return an error status.
4320    /// If this operation is successful, the `started` state is now false and all
4321    /// registered callbacks will be notified with an `OnStop` event.
4322    pub fn r#stop(
4323        &self,
4324    ) -> fidl::client::QueryResponseFut<WifiStopResult, fidl::encoding::DefaultFuchsiaResourceDialect>
4325    {
4326        WifiProxyInterface::r#stop(self)
4327    }
4328
4329    /// Return a boolean based on whether WiFi is `started` or not.
4330    pub fn r#get_state(
4331        &self,
4332    ) -> fidl::client::QueryResponseFut<
4333        WifiGetStateResponse,
4334        fidl::encoding::DefaultFuchsiaResourceDialect,
4335    > {
4336        WifiProxyInterface::r#get_state(self)
4337    }
4338
4339    /// Get the IDs of all the WiFi chips on the device.
4340    pub fn r#get_chip_ids(
4341        &self,
4342    ) -> fidl::client::QueryResponseFut<
4343        WifiGetChipIdsResponse,
4344        fidl::encoding::DefaultFuchsiaResourceDialect,
4345    > {
4346        WifiProxyInterface::r#get_chip_ids(self)
4347    }
4348
4349    /// Register the channel to make request to the `WifiChip` with the given
4350    /// `chip_id`
4351    pub fn r#get_chip(
4352        &self,
4353        mut payload: WifiGetChipRequest,
4354    ) -> fidl::client::QueryResponseFut<
4355        WifiGetChipResult,
4356        fidl::encoding::DefaultFuchsiaResourceDialect,
4357    > {
4358        WifiProxyInterface::r#get_chip(self, payload)
4359    }
4360}
4361
4362impl WifiProxyInterface for WifiProxy {
4363    fn r#register_event_callback(
4364        &self,
4365        mut payload: WifiRegisterEventCallbackRequest,
4366    ) -> Result<(), fidl::Error> {
4367        self.client.send::<WifiRegisterEventCallbackRequest>(
4368            &mut payload,
4369            0x12abbdea948dd67b,
4370            fidl::encoding::DynamicFlags::FLEXIBLE,
4371        )
4372    }
4373
4374    type StartResponseFut = fidl::client::QueryResponseFut<
4375        WifiStartResult,
4376        fidl::encoding::DefaultFuchsiaResourceDialect,
4377    >;
4378    fn r#start(&self) -> Self::StartResponseFut {
4379        fn _decode(
4380            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4381        ) -> Result<WifiStartResult, fidl::Error> {
4382            let _response = fidl::client::decode_transaction_body::<
4383                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
4384                fidl::encoding::DefaultFuchsiaResourceDialect,
4385                0x427030e4dc6ec07a,
4386            >(_buf?)?
4387            .into_result::<WifiMarker>("start")?;
4388            Ok(_response.map(|x| x))
4389        }
4390        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, WifiStartResult>(
4391            (),
4392            0x427030e4dc6ec07a,
4393            fidl::encoding::DynamicFlags::FLEXIBLE,
4394            _decode,
4395        )
4396    }
4397
4398    type StopResponseFut = fidl::client::QueryResponseFut<
4399        WifiStopResult,
4400        fidl::encoding::DefaultFuchsiaResourceDialect,
4401    >;
4402    fn r#stop(&self) -> Self::StopResponseFut {
4403        fn _decode(
4404            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4405        ) -> Result<WifiStopResult, fidl::Error> {
4406            let _response = fidl::client::decode_transaction_body::<
4407                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
4408                fidl::encoding::DefaultFuchsiaResourceDialect,
4409                0x67c9bdf61b2888d,
4410            >(_buf?)?
4411            .into_result::<WifiMarker>("stop")?;
4412            Ok(_response.map(|x| x))
4413        }
4414        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, WifiStopResult>(
4415            (),
4416            0x67c9bdf61b2888d,
4417            fidl::encoding::DynamicFlags::FLEXIBLE,
4418            _decode,
4419        )
4420    }
4421
4422    type GetStateResponseFut = fidl::client::QueryResponseFut<
4423        WifiGetStateResponse,
4424        fidl::encoding::DefaultFuchsiaResourceDialect,
4425    >;
4426    fn r#get_state(&self) -> Self::GetStateResponseFut {
4427        fn _decode(
4428            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4429        ) -> Result<WifiGetStateResponse, fidl::Error> {
4430            let _response = fidl::client::decode_transaction_body::<
4431                fidl::encoding::FlexibleType<WifiGetStateResponse>,
4432                fidl::encoding::DefaultFuchsiaResourceDialect,
4433                0x4616114a937d1fb0,
4434            >(_buf?)?
4435            .into_result::<WifiMarker>("get_state")?;
4436            Ok(_response)
4437        }
4438        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, WifiGetStateResponse>(
4439            (),
4440            0x4616114a937d1fb0,
4441            fidl::encoding::DynamicFlags::FLEXIBLE,
4442            _decode,
4443        )
4444    }
4445
4446    type GetChipIdsResponseFut = fidl::client::QueryResponseFut<
4447        WifiGetChipIdsResponse,
4448        fidl::encoding::DefaultFuchsiaResourceDialect,
4449    >;
4450    fn r#get_chip_ids(&self) -> Self::GetChipIdsResponseFut {
4451        fn _decode(
4452            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4453        ) -> Result<WifiGetChipIdsResponse, fidl::Error> {
4454            let _response = fidl::client::decode_transaction_body::<
4455                fidl::encoding::FlexibleType<WifiGetChipIdsResponse>,
4456                fidl::encoding::DefaultFuchsiaResourceDialect,
4457                0x2fb4f92351d802b5,
4458            >(_buf?)?
4459            .into_result::<WifiMarker>("get_chip_ids")?;
4460            Ok(_response)
4461        }
4462        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, WifiGetChipIdsResponse>(
4463            (),
4464            0x2fb4f92351d802b5,
4465            fidl::encoding::DynamicFlags::FLEXIBLE,
4466            _decode,
4467        )
4468    }
4469
4470    type GetChipResponseFut = fidl::client::QueryResponseFut<
4471        WifiGetChipResult,
4472        fidl::encoding::DefaultFuchsiaResourceDialect,
4473    >;
4474    fn r#get_chip(&self, mut payload: WifiGetChipRequest) -> Self::GetChipResponseFut {
4475        fn _decode(
4476            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4477        ) -> Result<WifiGetChipResult, fidl::Error> {
4478            let _response = fidl::client::decode_transaction_body::<
4479                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
4480                fidl::encoding::DefaultFuchsiaResourceDialect,
4481                0xef95d8246612540,
4482            >(_buf?)?
4483            .into_result::<WifiMarker>("get_chip")?;
4484            Ok(_response.map(|x| x))
4485        }
4486        self.client.send_query_and_decode::<WifiGetChipRequest, WifiGetChipResult>(
4487            &mut payload,
4488            0xef95d8246612540,
4489            fidl::encoding::DynamicFlags::FLEXIBLE,
4490            _decode,
4491        )
4492    }
4493}
4494
4495pub struct WifiEventStream {
4496    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4497}
4498
4499impl std::marker::Unpin for WifiEventStream {}
4500
4501impl futures::stream::FusedStream for WifiEventStream {
4502    fn is_terminated(&self) -> bool {
4503        self.event_receiver.is_terminated()
4504    }
4505}
4506
4507impl futures::Stream for WifiEventStream {
4508    type Item = Result<WifiEvent, fidl::Error>;
4509
4510    fn poll_next(
4511        mut self: std::pin::Pin<&mut Self>,
4512        cx: &mut std::task::Context<'_>,
4513    ) -> std::task::Poll<Option<Self::Item>> {
4514        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4515            &mut self.event_receiver,
4516            cx
4517        )?) {
4518            Some(buf) => std::task::Poll::Ready(Some(WifiEvent::decode(buf))),
4519            None => std::task::Poll::Ready(None),
4520        }
4521    }
4522}
4523
4524#[derive(Debug)]
4525pub enum WifiEvent {
4526    #[non_exhaustive]
4527    _UnknownEvent {
4528        /// Ordinal of the event that was sent.
4529        ordinal: u64,
4530    },
4531}
4532
4533impl WifiEvent {
4534    /// Decodes a message buffer as a [`WifiEvent`].
4535    fn decode(
4536        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4537    ) -> Result<WifiEvent, fidl::Error> {
4538        let (bytes, _handles) = buf.split_mut();
4539        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4540        debug_assert_eq!(tx_header.tx_id, 0);
4541        match tx_header.ordinal {
4542            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
4543                Ok(WifiEvent::_UnknownEvent { ordinal: tx_header.ordinal })
4544            }
4545            _ => Err(fidl::Error::UnknownOrdinal {
4546                ordinal: tx_header.ordinal,
4547                protocol_name: <WifiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4548            }),
4549        }
4550    }
4551}
4552
4553/// A Stream of incoming requests for fuchsia.wlan.wlanix/Wifi.
4554pub struct WifiRequestStream {
4555    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4556    is_terminated: bool,
4557}
4558
4559impl std::marker::Unpin for WifiRequestStream {}
4560
4561impl futures::stream::FusedStream for WifiRequestStream {
4562    fn is_terminated(&self) -> bool {
4563        self.is_terminated
4564    }
4565}
4566
4567impl fidl::endpoints::RequestStream for WifiRequestStream {
4568    type Protocol = WifiMarker;
4569    type ControlHandle = WifiControlHandle;
4570
4571    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4572        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4573    }
4574
4575    fn control_handle(&self) -> Self::ControlHandle {
4576        WifiControlHandle { inner: self.inner.clone() }
4577    }
4578
4579    fn into_inner(
4580        self,
4581    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4582    {
4583        (self.inner, self.is_terminated)
4584    }
4585
4586    fn from_inner(
4587        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4588        is_terminated: bool,
4589    ) -> Self {
4590        Self { inner, is_terminated }
4591    }
4592}
4593
4594impl futures::Stream for WifiRequestStream {
4595    type Item = Result<WifiRequest, fidl::Error>;
4596
4597    fn poll_next(
4598        mut self: std::pin::Pin<&mut Self>,
4599        cx: &mut std::task::Context<'_>,
4600    ) -> std::task::Poll<Option<Self::Item>> {
4601        let this = &mut *self;
4602        if this.inner.check_shutdown(cx) {
4603            this.is_terminated = true;
4604            return std::task::Poll::Ready(None);
4605        }
4606        if this.is_terminated {
4607            panic!("polled WifiRequestStream after completion");
4608        }
4609        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4610            |bytes, handles| {
4611                match this.inner.channel().read_etc(cx, bytes, handles) {
4612                    std::task::Poll::Ready(Ok(())) => {}
4613                    std::task::Poll::Pending => return std::task::Poll::Pending,
4614                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4615                        this.is_terminated = true;
4616                        return std::task::Poll::Ready(None);
4617                    }
4618                    std::task::Poll::Ready(Err(e)) => {
4619                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4620                            e.into(),
4621                        ))))
4622                    }
4623                }
4624
4625                // A message has been received from the channel
4626                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4627
4628                std::task::Poll::Ready(Some(match header.ordinal {
4629                    0x12abbdea948dd67b => {
4630                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4631                        let mut req = fidl::new_empty!(
4632                            WifiRegisterEventCallbackRequest,
4633                            fidl::encoding::DefaultFuchsiaResourceDialect
4634                        );
4635                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WifiRegisterEventCallbackRequest>(&header, _body_bytes, handles, &mut req)?;
4636                        let control_handle = WifiControlHandle { inner: this.inner.clone() };
4637                        Ok(WifiRequest::RegisterEventCallback { payload: req, control_handle })
4638                    }
4639                    0x427030e4dc6ec07a => {
4640                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4641                        let mut req = fidl::new_empty!(
4642                            fidl::encoding::EmptyPayload,
4643                            fidl::encoding::DefaultFuchsiaResourceDialect
4644                        );
4645                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4646                        let control_handle = WifiControlHandle { inner: this.inner.clone() };
4647                        Ok(WifiRequest::Start {
4648                            responder: WifiStartResponder {
4649                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4650                                tx_id: header.tx_id,
4651                            },
4652                        })
4653                    }
4654                    0x67c9bdf61b2888d => {
4655                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4656                        let mut req = fidl::new_empty!(
4657                            fidl::encoding::EmptyPayload,
4658                            fidl::encoding::DefaultFuchsiaResourceDialect
4659                        );
4660                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4661                        let control_handle = WifiControlHandle { inner: this.inner.clone() };
4662                        Ok(WifiRequest::Stop {
4663                            responder: WifiStopResponder {
4664                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4665                                tx_id: header.tx_id,
4666                            },
4667                        })
4668                    }
4669                    0x4616114a937d1fb0 => {
4670                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4671                        let mut req = fidl::new_empty!(
4672                            fidl::encoding::EmptyPayload,
4673                            fidl::encoding::DefaultFuchsiaResourceDialect
4674                        );
4675                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4676                        let control_handle = WifiControlHandle { inner: this.inner.clone() };
4677                        Ok(WifiRequest::GetState {
4678                            responder: WifiGetStateResponder {
4679                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4680                                tx_id: header.tx_id,
4681                            },
4682                        })
4683                    }
4684                    0x2fb4f92351d802b5 => {
4685                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4686                        let mut req = fidl::new_empty!(
4687                            fidl::encoding::EmptyPayload,
4688                            fidl::encoding::DefaultFuchsiaResourceDialect
4689                        );
4690                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4691                        let control_handle = WifiControlHandle { inner: this.inner.clone() };
4692                        Ok(WifiRequest::GetChipIds {
4693                            responder: WifiGetChipIdsResponder {
4694                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4695                                tx_id: header.tx_id,
4696                            },
4697                        })
4698                    }
4699                    0xef95d8246612540 => {
4700                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4701                        let mut req = fidl::new_empty!(
4702                            WifiGetChipRequest,
4703                            fidl::encoding::DefaultFuchsiaResourceDialect
4704                        );
4705                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WifiGetChipRequest>(&header, _body_bytes, handles, &mut req)?;
4706                        let control_handle = WifiControlHandle { inner: this.inner.clone() };
4707                        Ok(WifiRequest::GetChip {
4708                            payload: req,
4709                            responder: WifiGetChipResponder {
4710                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4711                                tx_id: header.tx_id,
4712                            },
4713                        })
4714                    }
4715                    _ if header.tx_id == 0
4716                        && header
4717                            .dynamic_flags()
4718                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4719                    {
4720                        Ok(WifiRequest::_UnknownMethod {
4721                            ordinal: header.ordinal,
4722                            control_handle: WifiControlHandle { inner: this.inner.clone() },
4723                            method_type: fidl::MethodType::OneWay,
4724                        })
4725                    }
4726                    _ if header
4727                        .dynamic_flags()
4728                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
4729                    {
4730                        this.inner.send_framework_err(
4731                            fidl::encoding::FrameworkErr::UnknownMethod,
4732                            header.tx_id,
4733                            header.ordinal,
4734                            header.dynamic_flags(),
4735                            (bytes, handles),
4736                        )?;
4737                        Ok(WifiRequest::_UnknownMethod {
4738                            ordinal: header.ordinal,
4739                            control_handle: WifiControlHandle { inner: this.inner.clone() },
4740                            method_type: fidl::MethodType::TwoWay,
4741                        })
4742                    }
4743                    _ => Err(fidl::Error::UnknownOrdinal {
4744                        ordinal: header.ordinal,
4745                        protocol_name: <WifiMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4746                    }),
4747                }))
4748            },
4749        )
4750    }
4751}
4752
4753#[derive(Debug)]
4754pub enum WifiRequest {
4755    /// Register a callback to be notified of future events (such when WiFi has
4756    /// started or stopped)
4757    RegisterEventCallback {
4758        payload: WifiRegisterEventCallbackRequest,
4759        control_handle: WifiControlHandle,
4760    },
4761    /// Start WiFi. If this operation is not successful, return an error status.
4762    /// If this operation is successful, the `started` state is now true and all
4763    /// registered callbacks will be notified with an `OnStart` event.
4764    Start { responder: WifiStartResponder },
4765    /// Stop WiFi. If this operation is not successful, return an error status.
4766    /// If this operation is successful, the `started` state is now false and all
4767    /// registered callbacks will be notified with an `OnStop` event.
4768    Stop { responder: WifiStopResponder },
4769    /// Return a boolean based on whether WiFi is `started` or not.
4770    GetState { responder: WifiGetStateResponder },
4771    /// Get the IDs of all the WiFi chips on the device.
4772    GetChipIds { responder: WifiGetChipIdsResponder },
4773    /// Register the channel to make request to the `WifiChip` with the given
4774    /// `chip_id`
4775    GetChip { payload: WifiGetChipRequest, responder: WifiGetChipResponder },
4776    /// An interaction was received which does not match any known method.
4777    #[non_exhaustive]
4778    _UnknownMethod {
4779        /// Ordinal of the method that was called.
4780        ordinal: u64,
4781        control_handle: WifiControlHandle,
4782        method_type: fidl::MethodType,
4783    },
4784}
4785
4786impl WifiRequest {
4787    #[allow(irrefutable_let_patterns)]
4788    pub fn into_register_event_callback(
4789        self,
4790    ) -> Option<(WifiRegisterEventCallbackRequest, WifiControlHandle)> {
4791        if let WifiRequest::RegisterEventCallback { payload, control_handle } = self {
4792            Some((payload, control_handle))
4793        } else {
4794            None
4795        }
4796    }
4797
4798    #[allow(irrefutable_let_patterns)]
4799    pub fn into_start(self) -> Option<(WifiStartResponder)> {
4800        if let WifiRequest::Start { responder } = self {
4801            Some((responder))
4802        } else {
4803            None
4804        }
4805    }
4806
4807    #[allow(irrefutable_let_patterns)]
4808    pub fn into_stop(self) -> Option<(WifiStopResponder)> {
4809        if let WifiRequest::Stop { responder } = self {
4810            Some((responder))
4811        } else {
4812            None
4813        }
4814    }
4815
4816    #[allow(irrefutable_let_patterns)]
4817    pub fn into_get_state(self) -> Option<(WifiGetStateResponder)> {
4818        if let WifiRequest::GetState { responder } = self {
4819            Some((responder))
4820        } else {
4821            None
4822        }
4823    }
4824
4825    #[allow(irrefutable_let_patterns)]
4826    pub fn into_get_chip_ids(self) -> Option<(WifiGetChipIdsResponder)> {
4827        if let WifiRequest::GetChipIds { responder } = self {
4828            Some((responder))
4829        } else {
4830            None
4831        }
4832    }
4833
4834    #[allow(irrefutable_let_patterns)]
4835    pub fn into_get_chip(self) -> Option<(WifiGetChipRequest, WifiGetChipResponder)> {
4836        if let WifiRequest::GetChip { payload, responder } = self {
4837            Some((payload, responder))
4838        } else {
4839            None
4840        }
4841    }
4842
4843    /// Name of the method defined in FIDL
4844    pub fn method_name(&self) -> &'static str {
4845        match *self {
4846            WifiRequest::RegisterEventCallback { .. } => "register_event_callback",
4847            WifiRequest::Start { .. } => "start",
4848            WifiRequest::Stop { .. } => "stop",
4849            WifiRequest::GetState { .. } => "get_state",
4850            WifiRequest::GetChipIds { .. } => "get_chip_ids",
4851            WifiRequest::GetChip { .. } => "get_chip",
4852            WifiRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
4853                "unknown one-way method"
4854            }
4855            WifiRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
4856                "unknown two-way method"
4857            }
4858        }
4859    }
4860}
4861
4862#[derive(Debug, Clone)]
4863pub struct WifiControlHandle {
4864    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4865}
4866
4867impl fidl::endpoints::ControlHandle for WifiControlHandle {
4868    fn shutdown(&self) {
4869        self.inner.shutdown()
4870    }
4871    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4872        self.inner.shutdown_with_epitaph(status)
4873    }
4874
4875    fn is_closed(&self) -> bool {
4876        self.inner.channel().is_closed()
4877    }
4878    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4879        self.inner.channel().on_closed()
4880    }
4881
4882    #[cfg(target_os = "fuchsia")]
4883    fn signal_peer(
4884        &self,
4885        clear_mask: zx::Signals,
4886        set_mask: zx::Signals,
4887    ) -> Result<(), zx_status::Status> {
4888        use fidl::Peered;
4889        self.inner.channel().signal_peer(clear_mask, set_mask)
4890    }
4891}
4892
4893impl WifiControlHandle {}
4894
4895#[must_use = "FIDL methods require a response to be sent"]
4896#[derive(Debug)]
4897pub struct WifiStartResponder {
4898    control_handle: std::mem::ManuallyDrop<WifiControlHandle>,
4899    tx_id: u32,
4900}
4901
4902/// Set the the channel to be shutdown (see [`WifiControlHandle::shutdown`])
4903/// if the responder is dropped without sending a response, so that the client
4904/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4905impl std::ops::Drop for WifiStartResponder {
4906    fn drop(&mut self) {
4907        self.control_handle.shutdown();
4908        // Safety: drops once, never accessed again
4909        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4910    }
4911}
4912
4913impl fidl::endpoints::Responder for WifiStartResponder {
4914    type ControlHandle = WifiControlHandle;
4915
4916    fn control_handle(&self) -> &WifiControlHandle {
4917        &self.control_handle
4918    }
4919
4920    fn drop_without_shutdown(mut self) {
4921        // Safety: drops once, never accessed again due to mem::forget
4922        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4923        // Prevent Drop from running (which would shut down the channel)
4924        std::mem::forget(self);
4925    }
4926}
4927
4928impl WifiStartResponder {
4929    /// Sends a response to the FIDL transaction.
4930    ///
4931    /// Sets the channel to shutdown if an error occurs.
4932    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4933        let _result = self.send_raw(result);
4934        if _result.is_err() {
4935            self.control_handle.shutdown();
4936        }
4937        self.drop_without_shutdown();
4938        _result
4939    }
4940
4941    /// Similar to "send" but does not shutdown the channel if an error occurs.
4942    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4943        let _result = self.send_raw(result);
4944        self.drop_without_shutdown();
4945        _result
4946    }
4947
4948    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4949        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
4950            fidl::encoding::EmptyStruct,
4951            i32,
4952        >>(
4953            fidl::encoding::FlexibleResult::new(result),
4954            self.tx_id,
4955            0x427030e4dc6ec07a,
4956            fidl::encoding::DynamicFlags::FLEXIBLE,
4957        )
4958    }
4959}
4960
4961#[must_use = "FIDL methods require a response to be sent"]
4962#[derive(Debug)]
4963pub struct WifiStopResponder {
4964    control_handle: std::mem::ManuallyDrop<WifiControlHandle>,
4965    tx_id: u32,
4966}
4967
4968/// Set the the channel to be shutdown (see [`WifiControlHandle::shutdown`])
4969/// if the responder is dropped without sending a response, so that the client
4970/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4971impl std::ops::Drop for WifiStopResponder {
4972    fn drop(&mut self) {
4973        self.control_handle.shutdown();
4974        // Safety: drops once, never accessed again
4975        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4976    }
4977}
4978
4979impl fidl::endpoints::Responder for WifiStopResponder {
4980    type ControlHandle = WifiControlHandle;
4981
4982    fn control_handle(&self) -> &WifiControlHandle {
4983        &self.control_handle
4984    }
4985
4986    fn drop_without_shutdown(mut self) {
4987        // Safety: drops once, never accessed again due to mem::forget
4988        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4989        // Prevent Drop from running (which would shut down the channel)
4990        std::mem::forget(self);
4991    }
4992}
4993
4994impl WifiStopResponder {
4995    /// Sends a response to the FIDL transaction.
4996    ///
4997    /// Sets the channel to shutdown if an error occurs.
4998    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
4999        let _result = self.send_raw(result);
5000        if _result.is_err() {
5001            self.control_handle.shutdown();
5002        }
5003        self.drop_without_shutdown();
5004        _result
5005    }
5006
5007    /// Similar to "send" but does not shutdown the channel if an error occurs.
5008    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5009        let _result = self.send_raw(result);
5010        self.drop_without_shutdown();
5011        _result
5012    }
5013
5014    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5015        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5016            fidl::encoding::EmptyStruct,
5017            i32,
5018        >>(
5019            fidl::encoding::FlexibleResult::new(result),
5020            self.tx_id,
5021            0x67c9bdf61b2888d,
5022            fidl::encoding::DynamicFlags::FLEXIBLE,
5023        )
5024    }
5025}
5026
5027#[must_use = "FIDL methods require a response to be sent"]
5028#[derive(Debug)]
5029pub struct WifiGetStateResponder {
5030    control_handle: std::mem::ManuallyDrop<WifiControlHandle>,
5031    tx_id: u32,
5032}
5033
5034/// Set the the channel to be shutdown (see [`WifiControlHandle::shutdown`])
5035/// if the responder is dropped without sending a response, so that the client
5036/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5037impl std::ops::Drop for WifiGetStateResponder {
5038    fn drop(&mut self) {
5039        self.control_handle.shutdown();
5040        // Safety: drops once, never accessed again
5041        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5042    }
5043}
5044
5045impl fidl::endpoints::Responder for WifiGetStateResponder {
5046    type ControlHandle = WifiControlHandle;
5047
5048    fn control_handle(&self) -> &WifiControlHandle {
5049        &self.control_handle
5050    }
5051
5052    fn drop_without_shutdown(mut self) {
5053        // Safety: drops once, never accessed again due to mem::forget
5054        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5055        // Prevent Drop from running (which would shut down the channel)
5056        std::mem::forget(self);
5057    }
5058}
5059
5060impl WifiGetStateResponder {
5061    /// Sends a response to the FIDL transaction.
5062    ///
5063    /// Sets the channel to shutdown if an error occurs.
5064    pub fn send(self, mut payload: &WifiGetStateResponse) -> Result<(), fidl::Error> {
5065        let _result = self.send_raw(payload);
5066        if _result.is_err() {
5067            self.control_handle.shutdown();
5068        }
5069        self.drop_without_shutdown();
5070        _result
5071    }
5072
5073    /// Similar to "send" but does not shutdown the channel if an error occurs.
5074    pub fn send_no_shutdown_on_err(
5075        self,
5076        mut payload: &WifiGetStateResponse,
5077    ) -> Result<(), fidl::Error> {
5078        let _result = self.send_raw(payload);
5079        self.drop_without_shutdown();
5080        _result
5081    }
5082
5083    fn send_raw(&self, mut payload: &WifiGetStateResponse) -> Result<(), fidl::Error> {
5084        self.control_handle.inner.send::<fidl::encoding::FlexibleType<WifiGetStateResponse>>(
5085            fidl::encoding::Flexible::new(payload),
5086            self.tx_id,
5087            0x4616114a937d1fb0,
5088            fidl::encoding::DynamicFlags::FLEXIBLE,
5089        )
5090    }
5091}
5092
5093#[must_use = "FIDL methods require a response to be sent"]
5094#[derive(Debug)]
5095pub struct WifiGetChipIdsResponder {
5096    control_handle: std::mem::ManuallyDrop<WifiControlHandle>,
5097    tx_id: u32,
5098}
5099
5100/// Set the the channel to be shutdown (see [`WifiControlHandle::shutdown`])
5101/// if the responder is dropped without sending a response, so that the client
5102/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5103impl std::ops::Drop for WifiGetChipIdsResponder {
5104    fn drop(&mut self) {
5105        self.control_handle.shutdown();
5106        // Safety: drops once, never accessed again
5107        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5108    }
5109}
5110
5111impl fidl::endpoints::Responder for WifiGetChipIdsResponder {
5112    type ControlHandle = WifiControlHandle;
5113
5114    fn control_handle(&self) -> &WifiControlHandle {
5115        &self.control_handle
5116    }
5117
5118    fn drop_without_shutdown(mut self) {
5119        // Safety: drops once, never accessed again due to mem::forget
5120        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5121        // Prevent Drop from running (which would shut down the channel)
5122        std::mem::forget(self);
5123    }
5124}
5125
5126impl WifiGetChipIdsResponder {
5127    /// Sends a response to the FIDL transaction.
5128    ///
5129    /// Sets the channel to shutdown if an error occurs.
5130    pub fn send(self, mut payload: &WifiGetChipIdsResponse) -> Result<(), fidl::Error> {
5131        let _result = self.send_raw(payload);
5132        if _result.is_err() {
5133            self.control_handle.shutdown();
5134        }
5135        self.drop_without_shutdown();
5136        _result
5137    }
5138
5139    /// Similar to "send" but does not shutdown the channel if an error occurs.
5140    pub fn send_no_shutdown_on_err(
5141        self,
5142        mut payload: &WifiGetChipIdsResponse,
5143    ) -> Result<(), fidl::Error> {
5144        let _result = self.send_raw(payload);
5145        self.drop_without_shutdown();
5146        _result
5147    }
5148
5149    fn send_raw(&self, mut payload: &WifiGetChipIdsResponse) -> Result<(), fidl::Error> {
5150        self.control_handle.inner.send::<fidl::encoding::FlexibleType<WifiGetChipIdsResponse>>(
5151            fidl::encoding::Flexible::new(payload),
5152            self.tx_id,
5153            0x2fb4f92351d802b5,
5154            fidl::encoding::DynamicFlags::FLEXIBLE,
5155        )
5156    }
5157}
5158
5159#[must_use = "FIDL methods require a response to be sent"]
5160#[derive(Debug)]
5161pub struct WifiGetChipResponder {
5162    control_handle: std::mem::ManuallyDrop<WifiControlHandle>,
5163    tx_id: u32,
5164}
5165
5166/// Set the the channel to be shutdown (see [`WifiControlHandle::shutdown`])
5167/// if the responder is dropped without sending a response, so that the client
5168/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5169impl std::ops::Drop for WifiGetChipResponder {
5170    fn drop(&mut self) {
5171        self.control_handle.shutdown();
5172        // Safety: drops once, never accessed again
5173        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5174    }
5175}
5176
5177impl fidl::endpoints::Responder for WifiGetChipResponder {
5178    type ControlHandle = WifiControlHandle;
5179
5180    fn control_handle(&self) -> &WifiControlHandle {
5181        &self.control_handle
5182    }
5183
5184    fn drop_without_shutdown(mut self) {
5185        // Safety: drops once, never accessed again due to mem::forget
5186        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5187        // Prevent Drop from running (which would shut down the channel)
5188        std::mem::forget(self);
5189    }
5190}
5191
5192impl WifiGetChipResponder {
5193    /// Sends a response to the FIDL transaction.
5194    ///
5195    /// Sets the channel to shutdown if an error occurs.
5196    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5197        let _result = self.send_raw(result);
5198        if _result.is_err() {
5199            self.control_handle.shutdown();
5200        }
5201        self.drop_without_shutdown();
5202        _result
5203    }
5204
5205    /// Similar to "send" but does not shutdown the channel if an error occurs.
5206    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5207        let _result = self.send_raw(result);
5208        self.drop_without_shutdown();
5209        _result
5210    }
5211
5212    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
5213        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
5214            fidl::encoding::EmptyStruct,
5215            i32,
5216        >>(
5217            fidl::encoding::FlexibleResult::new(result),
5218            self.tx_id,
5219            0xef95d8246612540,
5220            fidl::encoding::DynamicFlags::FLEXIBLE,
5221        )
5222    }
5223}
5224
5225#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5226pub struct WifiChipMarker;
5227
5228impl fidl::endpoints::ProtocolMarker for WifiChipMarker {
5229    type Proxy = WifiChipProxy;
5230    type RequestStream = WifiChipRequestStream;
5231    #[cfg(target_os = "fuchsia")]
5232    type SynchronousProxy = WifiChipSynchronousProxy;
5233
5234    const DEBUG_NAME: &'static str = "(anonymous) WifiChip";
5235}
5236pub type WifiChipCreateStaIfaceResult = Result<(), i32>;
5237pub type WifiChipGetStaIfaceResult = Result<(), i32>;
5238pub type WifiChipRemoveStaIfaceResult = Result<(), i32>;
5239pub type WifiChipSetCountryCodeResult = Result<(), i32>;
5240
5241pub trait WifiChipProxyInterface: Send + Sync {
5242    type CreateStaIfaceResponseFut: std::future::Future<Output = Result<WifiChipCreateStaIfaceResult, fidl::Error>>
5243        + Send;
5244    fn r#create_sta_iface(
5245        &self,
5246        payload: WifiChipCreateStaIfaceRequest,
5247    ) -> Self::CreateStaIfaceResponseFut;
5248    type GetStaIfaceNamesResponseFut: std::future::Future<Output = Result<WifiChipGetStaIfaceNamesResponse, fidl::Error>>
5249        + Send;
5250    fn r#get_sta_iface_names(&self) -> Self::GetStaIfaceNamesResponseFut;
5251    type GetStaIfaceResponseFut: std::future::Future<Output = Result<WifiChipGetStaIfaceResult, fidl::Error>>
5252        + Send;
5253    fn r#get_sta_iface(&self, payload: WifiChipGetStaIfaceRequest) -> Self::GetStaIfaceResponseFut;
5254    type RemoveStaIfaceResponseFut: std::future::Future<Output = Result<WifiChipRemoveStaIfaceResult, fidl::Error>>
5255        + Send;
5256    fn r#remove_sta_iface(
5257        &self,
5258        payload: WifiChipRemoveStaIfaceRequest,
5259    ) -> Self::RemoveStaIfaceResponseFut;
5260    type SetCountryCodeResponseFut: std::future::Future<Output = Result<WifiChipSetCountryCodeResult, fidl::Error>>
5261        + Send;
5262    fn r#set_country_code(
5263        &self,
5264        payload: WifiChipSetCountryCodeRequest,
5265    ) -> Self::SetCountryCodeResponseFut;
5266    type GetAvailableModesResponseFut: std::future::Future<Output = Result<WifiChipGetAvailableModesResponse, fidl::Error>>
5267        + Send;
5268    fn r#get_available_modes(&self) -> Self::GetAvailableModesResponseFut;
5269    type GetIdResponseFut: std::future::Future<Output = Result<WifiChipGetIdResponse, fidl::Error>>
5270        + Send;
5271    fn r#get_id(&self) -> Self::GetIdResponseFut;
5272    type GetModeResponseFut: std::future::Future<Output = Result<WifiChipGetModeResponse, fidl::Error>>
5273        + Send;
5274    fn r#get_mode(&self) -> Self::GetModeResponseFut;
5275    type GetCapabilitiesResponseFut: std::future::Future<Output = Result<WifiChipGetCapabilitiesResponse, fidl::Error>>
5276        + Send;
5277    fn r#get_capabilities(&self) -> Self::GetCapabilitiesResponseFut;
5278}
5279#[derive(Debug)]
5280#[cfg(target_os = "fuchsia")]
5281pub struct WifiChipSynchronousProxy {
5282    client: fidl::client::sync::Client,
5283}
5284
5285#[cfg(target_os = "fuchsia")]
5286impl fidl::endpoints::SynchronousProxy for WifiChipSynchronousProxy {
5287    type Proxy = WifiChipProxy;
5288    type Protocol = WifiChipMarker;
5289
5290    fn from_channel(inner: fidl::Channel) -> Self {
5291        Self::new(inner)
5292    }
5293
5294    fn into_channel(self) -> fidl::Channel {
5295        self.client.into_channel()
5296    }
5297
5298    fn as_channel(&self) -> &fidl::Channel {
5299        self.client.as_channel()
5300    }
5301}
5302
5303#[cfg(target_os = "fuchsia")]
5304impl WifiChipSynchronousProxy {
5305    pub fn new(channel: fidl::Channel) -> Self {
5306        let protocol_name = <WifiChipMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5307        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5308    }
5309
5310    pub fn into_channel(self) -> fidl::Channel {
5311        self.client.into_channel()
5312    }
5313
5314    /// Waits until an event arrives and returns it. It is safe for other
5315    /// threads to make concurrent requests while waiting for an event.
5316    pub fn wait_for_event(
5317        &self,
5318        deadline: zx::MonotonicInstant,
5319    ) -> Result<WifiChipEvent, fidl::Error> {
5320        WifiChipEvent::decode(self.client.wait_for_event(deadline)?)
5321    }
5322
5323    /// Request the chip to create a STA iface.
5324    pub fn r#create_sta_iface(
5325        &self,
5326        mut payload: WifiChipCreateStaIfaceRequest,
5327        ___deadline: zx::MonotonicInstant,
5328    ) -> Result<WifiChipCreateStaIfaceResult, fidl::Error> {
5329        let _response = self.client.send_query::<
5330            WifiChipCreateStaIfaceRequest,
5331            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
5332        >(
5333            &mut payload,
5334            0x6fb2d5892face7af,
5335            fidl::encoding::DynamicFlags::FLEXIBLE,
5336            ___deadline,
5337        )?
5338        .into_result::<WifiChipMarker>("create_sta_iface")?;
5339        Ok(_response.map(|x| x))
5340    }
5341
5342    /// Get the names of all active ifaces.
5343    pub fn r#get_sta_iface_names(
5344        &self,
5345        ___deadline: zx::MonotonicInstant,
5346    ) -> Result<WifiChipGetStaIfaceNamesResponse, fidl::Error> {
5347        let _response = self.client.send_query::<
5348            fidl::encoding::EmptyPayload,
5349            fidl::encoding::FlexibleType<WifiChipGetStaIfaceNamesResponse>,
5350        >(
5351            (),
5352            0x349257482df6a000,
5353            fidl::encoding::DynamicFlags::FLEXIBLE,
5354            ___deadline,
5355        )?
5356        .into_result::<WifiChipMarker>("get_sta_iface_names")?;
5357        Ok(_response)
5358    }
5359
5360    /// Request a new connection to an existing iface.
5361    pub fn r#get_sta_iface(
5362        &self,
5363        mut payload: WifiChipGetStaIfaceRequest,
5364        ___deadline: zx::MonotonicInstant,
5365    ) -> Result<WifiChipGetStaIfaceResult, fidl::Error> {
5366        let _response = self.client.send_query::<
5367            WifiChipGetStaIfaceRequest,
5368            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
5369        >(
5370            &mut payload,
5371            0x6d9704eeb36f28a2,
5372            fidl::encoding::DynamicFlags::FLEXIBLE,
5373            ___deadline,
5374        )?
5375        .into_result::<WifiChipMarker>("get_sta_iface")?;
5376        Ok(_response.map(|x| x))
5377    }
5378
5379    /// Request the destruction of a STA iface on the chip.
5380    pub fn r#remove_sta_iface(
5381        &self,
5382        mut payload: WifiChipRemoveStaIfaceRequest,
5383        ___deadline: zx::MonotonicInstant,
5384    ) -> Result<WifiChipRemoveStaIfaceResult, fidl::Error> {
5385        let _response = self.client.send_query::<
5386            WifiChipRemoveStaIfaceRequest,
5387            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
5388        >(
5389            &mut payload,
5390            0x4cd8eee466f8b04c,
5391            fidl::encoding::DynamicFlags::FLEXIBLE,
5392            ___deadline,
5393        )?
5394        .into_result::<WifiChipMarker>("remove_sta_iface")?;
5395        Ok(_response.map(|x| x))
5396    }
5397
5398    pub fn r#set_country_code(
5399        &self,
5400        mut payload: WifiChipSetCountryCodeRequest,
5401        ___deadline: zx::MonotonicInstant,
5402    ) -> Result<WifiChipSetCountryCodeResult, fidl::Error> {
5403        let _response = self.client.send_query::<
5404            WifiChipSetCountryCodeRequest,
5405            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
5406        >(
5407            &mut payload,
5408            0x1dfe372d1d61a490,
5409            fidl::encoding::DynamicFlags::FLEXIBLE,
5410            ___deadline,
5411        )?
5412        .into_result::<WifiChipMarker>("set_country_code")?;
5413        Ok(_response.map(|x| x))
5414    }
5415
5416    /// Get a set of operation modes that the chip supports.
5417    /// This combination encodes what iface types and how many can be created,
5418    /// and which ones can run concurrently.
5419    pub fn r#get_available_modes(
5420        &self,
5421        ___deadline: zx::MonotonicInstant,
5422    ) -> Result<WifiChipGetAvailableModesResponse, fidl::Error> {
5423        let _response = self.client.send_query::<
5424            fidl::encoding::EmptyPayload,
5425            fidl::encoding::FlexibleType<WifiChipGetAvailableModesResponse>,
5426        >(
5427            (),
5428            0x1701095b452a3acd,
5429            fidl::encoding::DynamicFlags::FLEXIBLE,
5430            ___deadline,
5431        )?
5432        .into_result::<WifiChipMarker>("get_available_modes")?;
5433        Ok(_response)
5434    }
5435
5436    /// Get the ID of the current chip.
5437    pub fn r#get_id(
5438        &self,
5439        ___deadline: zx::MonotonicInstant,
5440    ) -> Result<WifiChipGetIdResponse, fidl::Error> {
5441        let _response = self.client.send_query::<
5442            fidl::encoding::EmptyPayload,
5443            fidl::encoding::FlexibleType<WifiChipGetIdResponse>,
5444        >(
5445            (),
5446            0x37d5197325bb3370,
5447            fidl::encoding::DynamicFlags::FLEXIBLE,
5448            ___deadline,
5449        )?
5450        .into_result::<WifiChipMarker>("get_id")?;
5451        Ok(_response)
5452    }
5453
5454    /// Get the current mode that the chip is in.
5455    pub fn r#get_mode(
5456        &self,
5457        ___deadline: zx::MonotonicInstant,
5458    ) -> Result<WifiChipGetModeResponse, fidl::Error> {
5459        let _response = self.client.send_query::<
5460            fidl::encoding::EmptyPayload,
5461            fidl::encoding::FlexibleType<WifiChipGetModeResponse>,
5462        >(
5463            (),
5464            0x4d209e0f3ac84d6f,
5465            fidl::encoding::DynamicFlags::FLEXIBLE,
5466            ___deadline,
5467        )?
5468        .into_result::<WifiChipMarker>("get_mode")?;
5469        Ok(_response)
5470    }
5471
5472    /// Get capabilities supported by this chip.
5473    pub fn r#get_capabilities(
5474        &self,
5475        ___deadline: zx::MonotonicInstant,
5476    ) -> Result<WifiChipGetCapabilitiesResponse, fidl::Error> {
5477        let _response = self.client.send_query::<
5478            fidl::encoding::EmptyPayload,
5479            fidl::encoding::FlexibleType<WifiChipGetCapabilitiesResponse>,
5480        >(
5481            (),
5482            0x1b253f396dcaa2e0,
5483            fidl::encoding::DynamicFlags::FLEXIBLE,
5484            ___deadline,
5485        )?
5486        .into_result::<WifiChipMarker>("get_capabilities")?;
5487        Ok(_response)
5488    }
5489}
5490
5491#[cfg(target_os = "fuchsia")]
5492impl From<WifiChipSynchronousProxy> for zx::Handle {
5493    fn from(value: WifiChipSynchronousProxy) -> Self {
5494        value.into_channel().into()
5495    }
5496}
5497
5498#[cfg(target_os = "fuchsia")]
5499impl From<fidl::Channel> for WifiChipSynchronousProxy {
5500    fn from(value: fidl::Channel) -> Self {
5501        Self::new(value)
5502    }
5503}
5504
5505#[derive(Debug, Clone)]
5506pub struct WifiChipProxy {
5507    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5508}
5509
5510impl fidl::endpoints::Proxy for WifiChipProxy {
5511    type Protocol = WifiChipMarker;
5512
5513    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5514        Self::new(inner)
5515    }
5516
5517    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5518        self.client.into_channel().map_err(|client| Self { client })
5519    }
5520
5521    fn as_channel(&self) -> &::fidl::AsyncChannel {
5522        self.client.as_channel()
5523    }
5524}
5525
5526impl WifiChipProxy {
5527    /// Create a new Proxy for fuchsia.wlan.wlanix/WifiChip.
5528    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5529        let protocol_name = <WifiChipMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5530        Self { client: fidl::client::Client::new(channel, protocol_name) }
5531    }
5532
5533    /// Get a Stream of events from the remote end of the protocol.
5534    ///
5535    /// # Panics
5536    ///
5537    /// Panics if the event stream was already taken.
5538    pub fn take_event_stream(&self) -> WifiChipEventStream {
5539        WifiChipEventStream { event_receiver: self.client.take_event_receiver() }
5540    }
5541
5542    /// Request the chip to create a STA iface.
5543    pub fn r#create_sta_iface(
5544        &self,
5545        mut payload: WifiChipCreateStaIfaceRequest,
5546    ) -> fidl::client::QueryResponseFut<
5547        WifiChipCreateStaIfaceResult,
5548        fidl::encoding::DefaultFuchsiaResourceDialect,
5549    > {
5550        WifiChipProxyInterface::r#create_sta_iface(self, payload)
5551    }
5552
5553    /// Get the names of all active ifaces.
5554    pub fn r#get_sta_iface_names(
5555        &self,
5556    ) -> fidl::client::QueryResponseFut<
5557        WifiChipGetStaIfaceNamesResponse,
5558        fidl::encoding::DefaultFuchsiaResourceDialect,
5559    > {
5560        WifiChipProxyInterface::r#get_sta_iface_names(self)
5561    }
5562
5563    /// Request a new connection to an existing iface.
5564    pub fn r#get_sta_iface(
5565        &self,
5566        mut payload: WifiChipGetStaIfaceRequest,
5567    ) -> fidl::client::QueryResponseFut<
5568        WifiChipGetStaIfaceResult,
5569        fidl::encoding::DefaultFuchsiaResourceDialect,
5570    > {
5571        WifiChipProxyInterface::r#get_sta_iface(self, payload)
5572    }
5573
5574    /// Request the destruction of a STA iface on the chip.
5575    pub fn r#remove_sta_iface(
5576        &self,
5577        mut payload: WifiChipRemoveStaIfaceRequest,
5578    ) -> fidl::client::QueryResponseFut<
5579        WifiChipRemoveStaIfaceResult,
5580        fidl::encoding::DefaultFuchsiaResourceDialect,
5581    > {
5582        WifiChipProxyInterface::r#remove_sta_iface(self, payload)
5583    }
5584
5585    pub fn r#set_country_code(
5586        &self,
5587        mut payload: WifiChipSetCountryCodeRequest,
5588    ) -> fidl::client::QueryResponseFut<
5589        WifiChipSetCountryCodeResult,
5590        fidl::encoding::DefaultFuchsiaResourceDialect,
5591    > {
5592        WifiChipProxyInterface::r#set_country_code(self, payload)
5593    }
5594
5595    /// Get a set of operation modes that the chip supports.
5596    /// This combination encodes what iface types and how many can be created,
5597    /// and which ones can run concurrently.
5598    pub fn r#get_available_modes(
5599        &self,
5600    ) -> fidl::client::QueryResponseFut<
5601        WifiChipGetAvailableModesResponse,
5602        fidl::encoding::DefaultFuchsiaResourceDialect,
5603    > {
5604        WifiChipProxyInterface::r#get_available_modes(self)
5605    }
5606
5607    /// Get the ID of the current chip.
5608    pub fn r#get_id(
5609        &self,
5610    ) -> fidl::client::QueryResponseFut<
5611        WifiChipGetIdResponse,
5612        fidl::encoding::DefaultFuchsiaResourceDialect,
5613    > {
5614        WifiChipProxyInterface::r#get_id(self)
5615    }
5616
5617    /// Get the current mode that the chip is in.
5618    pub fn r#get_mode(
5619        &self,
5620    ) -> fidl::client::QueryResponseFut<
5621        WifiChipGetModeResponse,
5622        fidl::encoding::DefaultFuchsiaResourceDialect,
5623    > {
5624        WifiChipProxyInterface::r#get_mode(self)
5625    }
5626
5627    /// Get capabilities supported by this chip.
5628    pub fn r#get_capabilities(
5629        &self,
5630    ) -> fidl::client::QueryResponseFut<
5631        WifiChipGetCapabilitiesResponse,
5632        fidl::encoding::DefaultFuchsiaResourceDialect,
5633    > {
5634        WifiChipProxyInterface::r#get_capabilities(self)
5635    }
5636}
5637
5638impl WifiChipProxyInterface for WifiChipProxy {
5639    type CreateStaIfaceResponseFut = fidl::client::QueryResponseFut<
5640        WifiChipCreateStaIfaceResult,
5641        fidl::encoding::DefaultFuchsiaResourceDialect,
5642    >;
5643    fn r#create_sta_iface(
5644        &self,
5645        mut payload: WifiChipCreateStaIfaceRequest,
5646    ) -> Self::CreateStaIfaceResponseFut {
5647        fn _decode(
5648            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5649        ) -> Result<WifiChipCreateStaIfaceResult, fidl::Error> {
5650            let _response = fidl::client::decode_transaction_body::<
5651                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
5652                fidl::encoding::DefaultFuchsiaResourceDialect,
5653                0x6fb2d5892face7af,
5654            >(_buf?)?
5655            .into_result::<WifiChipMarker>("create_sta_iface")?;
5656            Ok(_response.map(|x| x))
5657        }
5658        self.client
5659            .send_query_and_decode::<WifiChipCreateStaIfaceRequest, WifiChipCreateStaIfaceResult>(
5660                &mut payload,
5661                0x6fb2d5892face7af,
5662                fidl::encoding::DynamicFlags::FLEXIBLE,
5663                _decode,
5664            )
5665    }
5666
5667    type GetStaIfaceNamesResponseFut = fidl::client::QueryResponseFut<
5668        WifiChipGetStaIfaceNamesResponse,
5669        fidl::encoding::DefaultFuchsiaResourceDialect,
5670    >;
5671    fn r#get_sta_iface_names(&self) -> Self::GetStaIfaceNamesResponseFut {
5672        fn _decode(
5673            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5674        ) -> Result<WifiChipGetStaIfaceNamesResponse, fidl::Error> {
5675            let _response = fidl::client::decode_transaction_body::<
5676                fidl::encoding::FlexibleType<WifiChipGetStaIfaceNamesResponse>,
5677                fidl::encoding::DefaultFuchsiaResourceDialect,
5678                0x349257482df6a000,
5679            >(_buf?)?
5680            .into_result::<WifiChipMarker>("get_sta_iface_names")?;
5681            Ok(_response)
5682        }
5683        self.client.send_query_and_decode::<
5684            fidl::encoding::EmptyPayload,
5685            WifiChipGetStaIfaceNamesResponse,
5686        >(
5687            (),
5688            0x349257482df6a000,
5689            fidl::encoding::DynamicFlags::FLEXIBLE,
5690            _decode,
5691        )
5692    }
5693
5694    type GetStaIfaceResponseFut = fidl::client::QueryResponseFut<
5695        WifiChipGetStaIfaceResult,
5696        fidl::encoding::DefaultFuchsiaResourceDialect,
5697    >;
5698    fn r#get_sta_iface(
5699        &self,
5700        mut payload: WifiChipGetStaIfaceRequest,
5701    ) -> Self::GetStaIfaceResponseFut {
5702        fn _decode(
5703            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5704        ) -> Result<WifiChipGetStaIfaceResult, fidl::Error> {
5705            let _response = fidl::client::decode_transaction_body::<
5706                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
5707                fidl::encoding::DefaultFuchsiaResourceDialect,
5708                0x6d9704eeb36f28a2,
5709            >(_buf?)?
5710            .into_result::<WifiChipMarker>("get_sta_iface")?;
5711            Ok(_response.map(|x| x))
5712        }
5713        self.client.send_query_and_decode::<WifiChipGetStaIfaceRequest, WifiChipGetStaIfaceResult>(
5714            &mut payload,
5715            0x6d9704eeb36f28a2,
5716            fidl::encoding::DynamicFlags::FLEXIBLE,
5717            _decode,
5718        )
5719    }
5720
5721    type RemoveStaIfaceResponseFut = fidl::client::QueryResponseFut<
5722        WifiChipRemoveStaIfaceResult,
5723        fidl::encoding::DefaultFuchsiaResourceDialect,
5724    >;
5725    fn r#remove_sta_iface(
5726        &self,
5727        mut payload: WifiChipRemoveStaIfaceRequest,
5728    ) -> Self::RemoveStaIfaceResponseFut {
5729        fn _decode(
5730            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5731        ) -> Result<WifiChipRemoveStaIfaceResult, fidl::Error> {
5732            let _response = fidl::client::decode_transaction_body::<
5733                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
5734                fidl::encoding::DefaultFuchsiaResourceDialect,
5735                0x4cd8eee466f8b04c,
5736            >(_buf?)?
5737            .into_result::<WifiChipMarker>("remove_sta_iface")?;
5738            Ok(_response.map(|x| x))
5739        }
5740        self.client
5741            .send_query_and_decode::<WifiChipRemoveStaIfaceRequest, WifiChipRemoveStaIfaceResult>(
5742                &mut payload,
5743                0x4cd8eee466f8b04c,
5744                fidl::encoding::DynamicFlags::FLEXIBLE,
5745                _decode,
5746            )
5747    }
5748
5749    type SetCountryCodeResponseFut = fidl::client::QueryResponseFut<
5750        WifiChipSetCountryCodeResult,
5751        fidl::encoding::DefaultFuchsiaResourceDialect,
5752    >;
5753    fn r#set_country_code(
5754        &self,
5755        mut payload: WifiChipSetCountryCodeRequest,
5756    ) -> Self::SetCountryCodeResponseFut {
5757        fn _decode(
5758            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5759        ) -> Result<WifiChipSetCountryCodeResult, fidl::Error> {
5760            let _response = fidl::client::decode_transaction_body::<
5761                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
5762                fidl::encoding::DefaultFuchsiaResourceDialect,
5763                0x1dfe372d1d61a490,
5764            >(_buf?)?
5765            .into_result::<WifiChipMarker>("set_country_code")?;
5766            Ok(_response.map(|x| x))
5767        }
5768        self.client
5769            .send_query_and_decode::<WifiChipSetCountryCodeRequest, WifiChipSetCountryCodeResult>(
5770                &mut payload,
5771                0x1dfe372d1d61a490,
5772                fidl::encoding::DynamicFlags::FLEXIBLE,
5773                _decode,
5774            )
5775    }
5776
5777    type GetAvailableModesResponseFut = fidl::client::QueryResponseFut<
5778        WifiChipGetAvailableModesResponse,
5779        fidl::encoding::DefaultFuchsiaResourceDialect,
5780    >;
5781    fn r#get_available_modes(&self) -> Self::GetAvailableModesResponseFut {
5782        fn _decode(
5783            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5784        ) -> Result<WifiChipGetAvailableModesResponse, fidl::Error> {
5785            let _response = fidl::client::decode_transaction_body::<
5786                fidl::encoding::FlexibleType<WifiChipGetAvailableModesResponse>,
5787                fidl::encoding::DefaultFuchsiaResourceDialect,
5788                0x1701095b452a3acd,
5789            >(_buf?)?
5790            .into_result::<WifiChipMarker>("get_available_modes")?;
5791            Ok(_response)
5792        }
5793        self.client.send_query_and_decode::<
5794            fidl::encoding::EmptyPayload,
5795            WifiChipGetAvailableModesResponse,
5796        >(
5797            (),
5798            0x1701095b452a3acd,
5799            fidl::encoding::DynamicFlags::FLEXIBLE,
5800            _decode,
5801        )
5802    }
5803
5804    type GetIdResponseFut = fidl::client::QueryResponseFut<
5805        WifiChipGetIdResponse,
5806        fidl::encoding::DefaultFuchsiaResourceDialect,
5807    >;
5808    fn r#get_id(&self) -> Self::GetIdResponseFut {
5809        fn _decode(
5810            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5811        ) -> Result<WifiChipGetIdResponse, fidl::Error> {
5812            let _response = fidl::client::decode_transaction_body::<
5813                fidl::encoding::FlexibleType<WifiChipGetIdResponse>,
5814                fidl::encoding::DefaultFuchsiaResourceDialect,
5815                0x37d5197325bb3370,
5816            >(_buf?)?
5817            .into_result::<WifiChipMarker>("get_id")?;
5818            Ok(_response)
5819        }
5820        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, WifiChipGetIdResponse>(
5821            (),
5822            0x37d5197325bb3370,
5823            fidl::encoding::DynamicFlags::FLEXIBLE,
5824            _decode,
5825        )
5826    }
5827
5828    type GetModeResponseFut = fidl::client::QueryResponseFut<
5829        WifiChipGetModeResponse,
5830        fidl::encoding::DefaultFuchsiaResourceDialect,
5831    >;
5832    fn r#get_mode(&self) -> Self::GetModeResponseFut {
5833        fn _decode(
5834            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5835        ) -> Result<WifiChipGetModeResponse, fidl::Error> {
5836            let _response = fidl::client::decode_transaction_body::<
5837                fidl::encoding::FlexibleType<WifiChipGetModeResponse>,
5838                fidl::encoding::DefaultFuchsiaResourceDialect,
5839                0x4d209e0f3ac84d6f,
5840            >(_buf?)?
5841            .into_result::<WifiChipMarker>("get_mode")?;
5842            Ok(_response)
5843        }
5844        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, WifiChipGetModeResponse>(
5845            (),
5846            0x4d209e0f3ac84d6f,
5847            fidl::encoding::DynamicFlags::FLEXIBLE,
5848            _decode,
5849        )
5850    }
5851
5852    type GetCapabilitiesResponseFut = fidl::client::QueryResponseFut<
5853        WifiChipGetCapabilitiesResponse,
5854        fidl::encoding::DefaultFuchsiaResourceDialect,
5855    >;
5856    fn r#get_capabilities(&self) -> Self::GetCapabilitiesResponseFut {
5857        fn _decode(
5858            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5859        ) -> Result<WifiChipGetCapabilitiesResponse, fidl::Error> {
5860            let _response = fidl::client::decode_transaction_body::<
5861                fidl::encoding::FlexibleType<WifiChipGetCapabilitiesResponse>,
5862                fidl::encoding::DefaultFuchsiaResourceDialect,
5863                0x1b253f396dcaa2e0,
5864            >(_buf?)?
5865            .into_result::<WifiChipMarker>("get_capabilities")?;
5866            Ok(_response)
5867        }
5868        self.client
5869            .send_query_and_decode::<fidl::encoding::EmptyPayload, WifiChipGetCapabilitiesResponse>(
5870                (),
5871                0x1b253f396dcaa2e0,
5872                fidl::encoding::DynamicFlags::FLEXIBLE,
5873                _decode,
5874            )
5875    }
5876}
5877
5878pub struct WifiChipEventStream {
5879    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5880}
5881
5882impl std::marker::Unpin for WifiChipEventStream {}
5883
5884impl futures::stream::FusedStream for WifiChipEventStream {
5885    fn is_terminated(&self) -> bool {
5886        self.event_receiver.is_terminated()
5887    }
5888}
5889
5890impl futures::Stream for WifiChipEventStream {
5891    type Item = Result<WifiChipEvent, fidl::Error>;
5892
5893    fn poll_next(
5894        mut self: std::pin::Pin<&mut Self>,
5895        cx: &mut std::task::Context<'_>,
5896    ) -> std::task::Poll<Option<Self::Item>> {
5897        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5898            &mut self.event_receiver,
5899            cx
5900        )?) {
5901            Some(buf) => std::task::Poll::Ready(Some(WifiChipEvent::decode(buf))),
5902            None => std::task::Poll::Ready(None),
5903        }
5904    }
5905}
5906
5907#[derive(Debug)]
5908pub enum WifiChipEvent {
5909    #[non_exhaustive]
5910    _UnknownEvent {
5911        /// Ordinal of the event that was sent.
5912        ordinal: u64,
5913    },
5914}
5915
5916impl WifiChipEvent {
5917    /// Decodes a message buffer as a [`WifiChipEvent`].
5918    fn decode(
5919        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5920    ) -> Result<WifiChipEvent, fidl::Error> {
5921        let (bytes, _handles) = buf.split_mut();
5922        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5923        debug_assert_eq!(tx_header.tx_id, 0);
5924        match tx_header.ordinal {
5925            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
5926                Ok(WifiChipEvent::_UnknownEvent { ordinal: tx_header.ordinal })
5927            }
5928            _ => Err(fidl::Error::UnknownOrdinal {
5929                ordinal: tx_header.ordinal,
5930                protocol_name: <WifiChipMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5931            }),
5932        }
5933    }
5934}
5935
5936/// A Stream of incoming requests for fuchsia.wlan.wlanix/WifiChip.
5937pub struct WifiChipRequestStream {
5938    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5939    is_terminated: bool,
5940}
5941
5942impl std::marker::Unpin for WifiChipRequestStream {}
5943
5944impl futures::stream::FusedStream for WifiChipRequestStream {
5945    fn is_terminated(&self) -> bool {
5946        self.is_terminated
5947    }
5948}
5949
5950impl fidl::endpoints::RequestStream for WifiChipRequestStream {
5951    type Protocol = WifiChipMarker;
5952    type ControlHandle = WifiChipControlHandle;
5953
5954    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5955        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5956    }
5957
5958    fn control_handle(&self) -> Self::ControlHandle {
5959        WifiChipControlHandle { inner: self.inner.clone() }
5960    }
5961
5962    fn into_inner(
5963        self,
5964    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5965    {
5966        (self.inner, self.is_terminated)
5967    }
5968
5969    fn from_inner(
5970        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5971        is_terminated: bool,
5972    ) -> Self {
5973        Self { inner, is_terminated }
5974    }
5975}
5976
5977impl futures::Stream for WifiChipRequestStream {
5978    type Item = Result<WifiChipRequest, fidl::Error>;
5979
5980    fn poll_next(
5981        mut self: std::pin::Pin<&mut Self>,
5982        cx: &mut std::task::Context<'_>,
5983    ) -> std::task::Poll<Option<Self::Item>> {
5984        let this = &mut *self;
5985        if this.inner.check_shutdown(cx) {
5986            this.is_terminated = true;
5987            return std::task::Poll::Ready(None);
5988        }
5989        if this.is_terminated {
5990            panic!("polled WifiChipRequestStream after completion");
5991        }
5992        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5993            |bytes, handles| {
5994                match this.inner.channel().read_etc(cx, bytes, handles) {
5995                    std::task::Poll::Ready(Ok(())) => {}
5996                    std::task::Poll::Pending => return std::task::Poll::Pending,
5997                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5998                        this.is_terminated = true;
5999                        return std::task::Poll::Ready(None);
6000                    }
6001                    std::task::Poll::Ready(Err(e)) => {
6002                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6003                            e.into(),
6004                        ))))
6005                    }
6006                }
6007
6008                // A message has been received from the channel
6009                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6010
6011                std::task::Poll::Ready(Some(match header.ordinal {
6012                    0x6fb2d5892face7af => {
6013                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6014                        let mut req = fidl::new_empty!(
6015                            WifiChipCreateStaIfaceRequest,
6016                            fidl::encoding::DefaultFuchsiaResourceDialect
6017                        );
6018                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WifiChipCreateStaIfaceRequest>(&header, _body_bytes, handles, &mut req)?;
6019                        let control_handle = WifiChipControlHandle { inner: this.inner.clone() };
6020                        Ok(WifiChipRequest::CreateStaIface {
6021                            payload: req,
6022                            responder: WifiChipCreateStaIfaceResponder {
6023                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6024                                tx_id: header.tx_id,
6025                            },
6026                        })
6027                    }
6028                    0x349257482df6a000 => {
6029                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6030                        let mut req = fidl::new_empty!(
6031                            fidl::encoding::EmptyPayload,
6032                            fidl::encoding::DefaultFuchsiaResourceDialect
6033                        );
6034                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6035                        let control_handle = WifiChipControlHandle { inner: this.inner.clone() };
6036                        Ok(WifiChipRequest::GetStaIfaceNames {
6037                            responder: WifiChipGetStaIfaceNamesResponder {
6038                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6039                                tx_id: header.tx_id,
6040                            },
6041                        })
6042                    }
6043                    0x6d9704eeb36f28a2 => {
6044                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6045                        let mut req = fidl::new_empty!(
6046                            WifiChipGetStaIfaceRequest,
6047                            fidl::encoding::DefaultFuchsiaResourceDialect
6048                        );
6049                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WifiChipGetStaIfaceRequest>(&header, _body_bytes, handles, &mut req)?;
6050                        let control_handle = WifiChipControlHandle { inner: this.inner.clone() };
6051                        Ok(WifiChipRequest::GetStaIface {
6052                            payload: req,
6053                            responder: WifiChipGetStaIfaceResponder {
6054                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6055                                tx_id: header.tx_id,
6056                            },
6057                        })
6058                    }
6059                    0x4cd8eee466f8b04c => {
6060                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6061                        let mut req = fidl::new_empty!(
6062                            WifiChipRemoveStaIfaceRequest,
6063                            fidl::encoding::DefaultFuchsiaResourceDialect
6064                        );
6065                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WifiChipRemoveStaIfaceRequest>(&header, _body_bytes, handles, &mut req)?;
6066                        let control_handle = WifiChipControlHandle { inner: this.inner.clone() };
6067                        Ok(WifiChipRequest::RemoveStaIface {
6068                            payload: req,
6069                            responder: WifiChipRemoveStaIfaceResponder {
6070                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6071                                tx_id: header.tx_id,
6072                            },
6073                        })
6074                    }
6075                    0x1dfe372d1d61a490 => {
6076                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6077                        let mut req = fidl::new_empty!(
6078                            WifiChipSetCountryCodeRequest,
6079                            fidl::encoding::DefaultFuchsiaResourceDialect
6080                        );
6081                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WifiChipSetCountryCodeRequest>(&header, _body_bytes, handles, &mut req)?;
6082                        let control_handle = WifiChipControlHandle { inner: this.inner.clone() };
6083                        Ok(WifiChipRequest::SetCountryCode {
6084                            payload: req,
6085                            responder: WifiChipSetCountryCodeResponder {
6086                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6087                                tx_id: header.tx_id,
6088                            },
6089                        })
6090                    }
6091                    0x1701095b452a3acd => {
6092                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6093                        let mut req = fidl::new_empty!(
6094                            fidl::encoding::EmptyPayload,
6095                            fidl::encoding::DefaultFuchsiaResourceDialect
6096                        );
6097                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6098                        let control_handle = WifiChipControlHandle { inner: this.inner.clone() };
6099                        Ok(WifiChipRequest::GetAvailableModes {
6100                            responder: WifiChipGetAvailableModesResponder {
6101                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6102                                tx_id: header.tx_id,
6103                            },
6104                        })
6105                    }
6106                    0x37d5197325bb3370 => {
6107                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6108                        let mut req = fidl::new_empty!(
6109                            fidl::encoding::EmptyPayload,
6110                            fidl::encoding::DefaultFuchsiaResourceDialect
6111                        );
6112                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6113                        let control_handle = WifiChipControlHandle { inner: this.inner.clone() };
6114                        Ok(WifiChipRequest::GetId {
6115                            responder: WifiChipGetIdResponder {
6116                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6117                                tx_id: header.tx_id,
6118                            },
6119                        })
6120                    }
6121                    0x4d209e0f3ac84d6f => {
6122                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6123                        let mut req = fidl::new_empty!(
6124                            fidl::encoding::EmptyPayload,
6125                            fidl::encoding::DefaultFuchsiaResourceDialect
6126                        );
6127                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6128                        let control_handle = WifiChipControlHandle { inner: this.inner.clone() };
6129                        Ok(WifiChipRequest::GetMode {
6130                            responder: WifiChipGetModeResponder {
6131                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6132                                tx_id: header.tx_id,
6133                            },
6134                        })
6135                    }
6136                    0x1b253f396dcaa2e0 => {
6137                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6138                        let mut req = fidl::new_empty!(
6139                            fidl::encoding::EmptyPayload,
6140                            fidl::encoding::DefaultFuchsiaResourceDialect
6141                        );
6142                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6143                        let control_handle = WifiChipControlHandle { inner: this.inner.clone() };
6144                        Ok(WifiChipRequest::GetCapabilities {
6145                            responder: WifiChipGetCapabilitiesResponder {
6146                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6147                                tx_id: header.tx_id,
6148                            },
6149                        })
6150                    }
6151                    _ if header.tx_id == 0
6152                        && header
6153                            .dynamic_flags()
6154                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
6155                    {
6156                        Ok(WifiChipRequest::_UnknownMethod {
6157                            ordinal: header.ordinal,
6158                            control_handle: WifiChipControlHandle { inner: this.inner.clone() },
6159                            method_type: fidl::MethodType::OneWay,
6160                        })
6161                    }
6162                    _ if header
6163                        .dynamic_flags()
6164                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
6165                    {
6166                        this.inner.send_framework_err(
6167                            fidl::encoding::FrameworkErr::UnknownMethod,
6168                            header.tx_id,
6169                            header.ordinal,
6170                            header.dynamic_flags(),
6171                            (bytes, handles),
6172                        )?;
6173                        Ok(WifiChipRequest::_UnknownMethod {
6174                            ordinal: header.ordinal,
6175                            control_handle: WifiChipControlHandle { inner: this.inner.clone() },
6176                            method_type: fidl::MethodType::TwoWay,
6177                        })
6178                    }
6179                    _ => Err(fidl::Error::UnknownOrdinal {
6180                        ordinal: header.ordinal,
6181                        protocol_name:
6182                            <WifiChipMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6183                    }),
6184                }))
6185            },
6186        )
6187    }
6188}
6189
6190#[derive(Debug)]
6191pub enum WifiChipRequest {
6192    /// Request the chip to create a STA iface.
6193    CreateStaIface {
6194        payload: WifiChipCreateStaIfaceRequest,
6195        responder: WifiChipCreateStaIfaceResponder,
6196    },
6197    /// Get the names of all active ifaces.
6198    GetStaIfaceNames { responder: WifiChipGetStaIfaceNamesResponder },
6199    /// Request a new connection to an existing iface.
6200    GetStaIface { payload: WifiChipGetStaIfaceRequest, responder: WifiChipGetStaIfaceResponder },
6201    /// Request the destruction of a STA iface on the chip.
6202    RemoveStaIface {
6203        payload: WifiChipRemoveStaIfaceRequest,
6204        responder: WifiChipRemoveStaIfaceResponder,
6205    },
6206    SetCountryCode {
6207        payload: WifiChipSetCountryCodeRequest,
6208        responder: WifiChipSetCountryCodeResponder,
6209    },
6210    /// Get a set of operation modes that the chip supports.
6211    /// This combination encodes what iface types and how many can be created,
6212    /// and which ones can run concurrently.
6213    GetAvailableModes { responder: WifiChipGetAvailableModesResponder },
6214    /// Get the ID of the current chip.
6215    GetId { responder: WifiChipGetIdResponder },
6216    /// Get the current mode that the chip is in.
6217    GetMode { responder: WifiChipGetModeResponder },
6218    /// Get capabilities supported by this chip.
6219    GetCapabilities { responder: WifiChipGetCapabilitiesResponder },
6220    /// An interaction was received which does not match any known method.
6221    #[non_exhaustive]
6222    _UnknownMethod {
6223        /// Ordinal of the method that was called.
6224        ordinal: u64,
6225        control_handle: WifiChipControlHandle,
6226        method_type: fidl::MethodType,
6227    },
6228}
6229
6230impl WifiChipRequest {
6231    #[allow(irrefutable_let_patterns)]
6232    pub fn into_create_sta_iface(
6233        self,
6234    ) -> Option<(WifiChipCreateStaIfaceRequest, WifiChipCreateStaIfaceResponder)> {
6235        if let WifiChipRequest::CreateStaIface { payload, responder } = self {
6236            Some((payload, responder))
6237        } else {
6238            None
6239        }
6240    }
6241
6242    #[allow(irrefutable_let_patterns)]
6243    pub fn into_get_sta_iface_names(self) -> Option<(WifiChipGetStaIfaceNamesResponder)> {
6244        if let WifiChipRequest::GetStaIfaceNames { responder } = self {
6245            Some((responder))
6246        } else {
6247            None
6248        }
6249    }
6250
6251    #[allow(irrefutable_let_patterns)]
6252    pub fn into_get_sta_iface(
6253        self,
6254    ) -> Option<(WifiChipGetStaIfaceRequest, WifiChipGetStaIfaceResponder)> {
6255        if let WifiChipRequest::GetStaIface { payload, responder } = self {
6256            Some((payload, responder))
6257        } else {
6258            None
6259        }
6260    }
6261
6262    #[allow(irrefutable_let_patterns)]
6263    pub fn into_remove_sta_iface(
6264        self,
6265    ) -> Option<(WifiChipRemoveStaIfaceRequest, WifiChipRemoveStaIfaceResponder)> {
6266        if let WifiChipRequest::RemoveStaIface { payload, responder } = self {
6267            Some((payload, responder))
6268        } else {
6269            None
6270        }
6271    }
6272
6273    #[allow(irrefutable_let_patterns)]
6274    pub fn into_set_country_code(
6275        self,
6276    ) -> Option<(WifiChipSetCountryCodeRequest, WifiChipSetCountryCodeResponder)> {
6277        if let WifiChipRequest::SetCountryCode { payload, responder } = self {
6278            Some((payload, responder))
6279        } else {
6280            None
6281        }
6282    }
6283
6284    #[allow(irrefutable_let_patterns)]
6285    pub fn into_get_available_modes(self) -> Option<(WifiChipGetAvailableModesResponder)> {
6286        if let WifiChipRequest::GetAvailableModes { responder } = self {
6287            Some((responder))
6288        } else {
6289            None
6290        }
6291    }
6292
6293    #[allow(irrefutable_let_patterns)]
6294    pub fn into_get_id(self) -> Option<(WifiChipGetIdResponder)> {
6295        if let WifiChipRequest::GetId { responder } = self {
6296            Some((responder))
6297        } else {
6298            None
6299        }
6300    }
6301
6302    #[allow(irrefutable_let_patterns)]
6303    pub fn into_get_mode(self) -> Option<(WifiChipGetModeResponder)> {
6304        if let WifiChipRequest::GetMode { responder } = self {
6305            Some((responder))
6306        } else {
6307            None
6308        }
6309    }
6310
6311    #[allow(irrefutable_let_patterns)]
6312    pub fn into_get_capabilities(self) -> Option<(WifiChipGetCapabilitiesResponder)> {
6313        if let WifiChipRequest::GetCapabilities { responder } = self {
6314            Some((responder))
6315        } else {
6316            None
6317        }
6318    }
6319
6320    /// Name of the method defined in FIDL
6321    pub fn method_name(&self) -> &'static str {
6322        match *self {
6323            WifiChipRequest::CreateStaIface { .. } => "create_sta_iface",
6324            WifiChipRequest::GetStaIfaceNames { .. } => "get_sta_iface_names",
6325            WifiChipRequest::GetStaIface { .. } => "get_sta_iface",
6326            WifiChipRequest::RemoveStaIface { .. } => "remove_sta_iface",
6327            WifiChipRequest::SetCountryCode { .. } => "set_country_code",
6328            WifiChipRequest::GetAvailableModes { .. } => "get_available_modes",
6329            WifiChipRequest::GetId { .. } => "get_id",
6330            WifiChipRequest::GetMode { .. } => "get_mode",
6331            WifiChipRequest::GetCapabilities { .. } => "get_capabilities",
6332            WifiChipRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
6333                "unknown one-way method"
6334            }
6335            WifiChipRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
6336                "unknown two-way method"
6337            }
6338        }
6339    }
6340}
6341
6342#[derive(Debug, Clone)]
6343pub struct WifiChipControlHandle {
6344    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6345}
6346
6347impl fidl::endpoints::ControlHandle for WifiChipControlHandle {
6348    fn shutdown(&self) {
6349        self.inner.shutdown()
6350    }
6351    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6352        self.inner.shutdown_with_epitaph(status)
6353    }
6354
6355    fn is_closed(&self) -> bool {
6356        self.inner.channel().is_closed()
6357    }
6358    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6359        self.inner.channel().on_closed()
6360    }
6361
6362    #[cfg(target_os = "fuchsia")]
6363    fn signal_peer(
6364        &self,
6365        clear_mask: zx::Signals,
6366        set_mask: zx::Signals,
6367    ) -> Result<(), zx_status::Status> {
6368        use fidl::Peered;
6369        self.inner.channel().signal_peer(clear_mask, set_mask)
6370    }
6371}
6372
6373impl WifiChipControlHandle {}
6374
6375#[must_use = "FIDL methods require a response to be sent"]
6376#[derive(Debug)]
6377pub struct WifiChipCreateStaIfaceResponder {
6378    control_handle: std::mem::ManuallyDrop<WifiChipControlHandle>,
6379    tx_id: u32,
6380}
6381
6382/// Set the the channel to be shutdown (see [`WifiChipControlHandle::shutdown`])
6383/// if the responder is dropped without sending a response, so that the client
6384/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6385impl std::ops::Drop for WifiChipCreateStaIfaceResponder {
6386    fn drop(&mut self) {
6387        self.control_handle.shutdown();
6388        // Safety: drops once, never accessed again
6389        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6390    }
6391}
6392
6393impl fidl::endpoints::Responder for WifiChipCreateStaIfaceResponder {
6394    type ControlHandle = WifiChipControlHandle;
6395
6396    fn control_handle(&self) -> &WifiChipControlHandle {
6397        &self.control_handle
6398    }
6399
6400    fn drop_without_shutdown(mut self) {
6401        // Safety: drops once, never accessed again due to mem::forget
6402        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6403        // Prevent Drop from running (which would shut down the channel)
6404        std::mem::forget(self);
6405    }
6406}
6407
6408impl WifiChipCreateStaIfaceResponder {
6409    /// Sends a response to the FIDL transaction.
6410    ///
6411    /// Sets the channel to shutdown if an error occurs.
6412    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6413        let _result = self.send_raw(result);
6414        if _result.is_err() {
6415            self.control_handle.shutdown();
6416        }
6417        self.drop_without_shutdown();
6418        _result
6419    }
6420
6421    /// Similar to "send" but does not shutdown the channel if an error occurs.
6422    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6423        let _result = self.send_raw(result);
6424        self.drop_without_shutdown();
6425        _result
6426    }
6427
6428    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6429        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6430            fidl::encoding::EmptyStruct,
6431            i32,
6432        >>(
6433            fidl::encoding::FlexibleResult::new(result),
6434            self.tx_id,
6435            0x6fb2d5892face7af,
6436            fidl::encoding::DynamicFlags::FLEXIBLE,
6437        )
6438    }
6439}
6440
6441#[must_use = "FIDL methods require a response to be sent"]
6442#[derive(Debug)]
6443pub struct WifiChipGetStaIfaceNamesResponder {
6444    control_handle: std::mem::ManuallyDrop<WifiChipControlHandle>,
6445    tx_id: u32,
6446}
6447
6448/// Set the the channel to be shutdown (see [`WifiChipControlHandle::shutdown`])
6449/// if the responder is dropped without sending a response, so that the client
6450/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6451impl std::ops::Drop for WifiChipGetStaIfaceNamesResponder {
6452    fn drop(&mut self) {
6453        self.control_handle.shutdown();
6454        // Safety: drops once, never accessed again
6455        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6456    }
6457}
6458
6459impl fidl::endpoints::Responder for WifiChipGetStaIfaceNamesResponder {
6460    type ControlHandle = WifiChipControlHandle;
6461
6462    fn control_handle(&self) -> &WifiChipControlHandle {
6463        &self.control_handle
6464    }
6465
6466    fn drop_without_shutdown(mut self) {
6467        // Safety: drops once, never accessed again due to mem::forget
6468        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6469        // Prevent Drop from running (which would shut down the channel)
6470        std::mem::forget(self);
6471    }
6472}
6473
6474impl WifiChipGetStaIfaceNamesResponder {
6475    /// Sends a response to the FIDL transaction.
6476    ///
6477    /// Sets the channel to shutdown if an error occurs.
6478    pub fn send(self, mut payload: &WifiChipGetStaIfaceNamesResponse) -> Result<(), fidl::Error> {
6479        let _result = self.send_raw(payload);
6480        if _result.is_err() {
6481            self.control_handle.shutdown();
6482        }
6483        self.drop_without_shutdown();
6484        _result
6485    }
6486
6487    /// Similar to "send" but does not shutdown the channel if an error occurs.
6488    pub fn send_no_shutdown_on_err(
6489        self,
6490        mut payload: &WifiChipGetStaIfaceNamesResponse,
6491    ) -> Result<(), fidl::Error> {
6492        let _result = self.send_raw(payload);
6493        self.drop_without_shutdown();
6494        _result
6495    }
6496
6497    fn send_raw(&self, mut payload: &WifiChipGetStaIfaceNamesResponse) -> Result<(), fidl::Error> {
6498        self.control_handle
6499            .inner
6500            .send::<fidl::encoding::FlexibleType<WifiChipGetStaIfaceNamesResponse>>(
6501                fidl::encoding::Flexible::new(payload),
6502                self.tx_id,
6503                0x349257482df6a000,
6504                fidl::encoding::DynamicFlags::FLEXIBLE,
6505            )
6506    }
6507}
6508
6509#[must_use = "FIDL methods require a response to be sent"]
6510#[derive(Debug)]
6511pub struct WifiChipGetStaIfaceResponder {
6512    control_handle: std::mem::ManuallyDrop<WifiChipControlHandle>,
6513    tx_id: u32,
6514}
6515
6516/// Set the the channel to be shutdown (see [`WifiChipControlHandle::shutdown`])
6517/// if the responder is dropped without sending a response, so that the client
6518/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6519impl std::ops::Drop for WifiChipGetStaIfaceResponder {
6520    fn drop(&mut self) {
6521        self.control_handle.shutdown();
6522        // Safety: drops once, never accessed again
6523        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6524    }
6525}
6526
6527impl fidl::endpoints::Responder for WifiChipGetStaIfaceResponder {
6528    type ControlHandle = WifiChipControlHandle;
6529
6530    fn control_handle(&self) -> &WifiChipControlHandle {
6531        &self.control_handle
6532    }
6533
6534    fn drop_without_shutdown(mut self) {
6535        // Safety: drops once, never accessed again due to mem::forget
6536        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6537        // Prevent Drop from running (which would shut down the channel)
6538        std::mem::forget(self);
6539    }
6540}
6541
6542impl WifiChipGetStaIfaceResponder {
6543    /// Sends a response to the FIDL transaction.
6544    ///
6545    /// Sets the channel to shutdown if an error occurs.
6546    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6547        let _result = self.send_raw(result);
6548        if _result.is_err() {
6549            self.control_handle.shutdown();
6550        }
6551        self.drop_without_shutdown();
6552        _result
6553    }
6554
6555    /// Similar to "send" but does not shutdown the channel if an error occurs.
6556    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6557        let _result = self.send_raw(result);
6558        self.drop_without_shutdown();
6559        _result
6560    }
6561
6562    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6563        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6564            fidl::encoding::EmptyStruct,
6565            i32,
6566        >>(
6567            fidl::encoding::FlexibleResult::new(result),
6568            self.tx_id,
6569            0x6d9704eeb36f28a2,
6570            fidl::encoding::DynamicFlags::FLEXIBLE,
6571        )
6572    }
6573}
6574
6575#[must_use = "FIDL methods require a response to be sent"]
6576#[derive(Debug)]
6577pub struct WifiChipRemoveStaIfaceResponder {
6578    control_handle: std::mem::ManuallyDrop<WifiChipControlHandle>,
6579    tx_id: u32,
6580}
6581
6582/// Set the the channel to be shutdown (see [`WifiChipControlHandle::shutdown`])
6583/// if the responder is dropped without sending a response, so that the client
6584/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6585impl std::ops::Drop for WifiChipRemoveStaIfaceResponder {
6586    fn drop(&mut self) {
6587        self.control_handle.shutdown();
6588        // Safety: drops once, never accessed again
6589        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6590    }
6591}
6592
6593impl fidl::endpoints::Responder for WifiChipRemoveStaIfaceResponder {
6594    type ControlHandle = WifiChipControlHandle;
6595
6596    fn control_handle(&self) -> &WifiChipControlHandle {
6597        &self.control_handle
6598    }
6599
6600    fn drop_without_shutdown(mut self) {
6601        // Safety: drops once, never accessed again due to mem::forget
6602        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6603        // Prevent Drop from running (which would shut down the channel)
6604        std::mem::forget(self);
6605    }
6606}
6607
6608impl WifiChipRemoveStaIfaceResponder {
6609    /// Sends a response to the FIDL transaction.
6610    ///
6611    /// Sets the channel to shutdown if an error occurs.
6612    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6613        let _result = self.send_raw(result);
6614        if _result.is_err() {
6615            self.control_handle.shutdown();
6616        }
6617        self.drop_without_shutdown();
6618        _result
6619    }
6620
6621    /// Similar to "send" but does not shutdown the channel if an error occurs.
6622    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6623        let _result = self.send_raw(result);
6624        self.drop_without_shutdown();
6625        _result
6626    }
6627
6628    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6629        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6630            fidl::encoding::EmptyStruct,
6631            i32,
6632        >>(
6633            fidl::encoding::FlexibleResult::new(result),
6634            self.tx_id,
6635            0x4cd8eee466f8b04c,
6636            fidl::encoding::DynamicFlags::FLEXIBLE,
6637        )
6638    }
6639}
6640
6641#[must_use = "FIDL methods require a response to be sent"]
6642#[derive(Debug)]
6643pub struct WifiChipSetCountryCodeResponder {
6644    control_handle: std::mem::ManuallyDrop<WifiChipControlHandle>,
6645    tx_id: u32,
6646}
6647
6648/// Set the the channel to be shutdown (see [`WifiChipControlHandle::shutdown`])
6649/// if the responder is dropped without sending a response, so that the client
6650/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6651impl std::ops::Drop for WifiChipSetCountryCodeResponder {
6652    fn drop(&mut self) {
6653        self.control_handle.shutdown();
6654        // Safety: drops once, never accessed again
6655        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6656    }
6657}
6658
6659impl fidl::endpoints::Responder for WifiChipSetCountryCodeResponder {
6660    type ControlHandle = WifiChipControlHandle;
6661
6662    fn control_handle(&self) -> &WifiChipControlHandle {
6663        &self.control_handle
6664    }
6665
6666    fn drop_without_shutdown(mut self) {
6667        // Safety: drops once, never accessed again due to mem::forget
6668        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6669        // Prevent Drop from running (which would shut down the channel)
6670        std::mem::forget(self);
6671    }
6672}
6673
6674impl WifiChipSetCountryCodeResponder {
6675    /// Sends a response to the FIDL transaction.
6676    ///
6677    /// Sets the channel to shutdown if an error occurs.
6678    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6679        let _result = self.send_raw(result);
6680        if _result.is_err() {
6681            self.control_handle.shutdown();
6682        }
6683        self.drop_without_shutdown();
6684        _result
6685    }
6686
6687    /// Similar to "send" but does not shutdown the channel if an error occurs.
6688    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6689        let _result = self.send_raw(result);
6690        self.drop_without_shutdown();
6691        _result
6692    }
6693
6694    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
6695        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
6696            fidl::encoding::EmptyStruct,
6697            i32,
6698        >>(
6699            fidl::encoding::FlexibleResult::new(result),
6700            self.tx_id,
6701            0x1dfe372d1d61a490,
6702            fidl::encoding::DynamicFlags::FLEXIBLE,
6703        )
6704    }
6705}
6706
6707#[must_use = "FIDL methods require a response to be sent"]
6708#[derive(Debug)]
6709pub struct WifiChipGetAvailableModesResponder {
6710    control_handle: std::mem::ManuallyDrop<WifiChipControlHandle>,
6711    tx_id: u32,
6712}
6713
6714/// Set the the channel to be shutdown (see [`WifiChipControlHandle::shutdown`])
6715/// if the responder is dropped without sending a response, so that the client
6716/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6717impl std::ops::Drop for WifiChipGetAvailableModesResponder {
6718    fn drop(&mut self) {
6719        self.control_handle.shutdown();
6720        // Safety: drops once, never accessed again
6721        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6722    }
6723}
6724
6725impl fidl::endpoints::Responder for WifiChipGetAvailableModesResponder {
6726    type ControlHandle = WifiChipControlHandle;
6727
6728    fn control_handle(&self) -> &WifiChipControlHandle {
6729        &self.control_handle
6730    }
6731
6732    fn drop_without_shutdown(mut self) {
6733        // Safety: drops once, never accessed again due to mem::forget
6734        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6735        // Prevent Drop from running (which would shut down the channel)
6736        std::mem::forget(self);
6737    }
6738}
6739
6740impl WifiChipGetAvailableModesResponder {
6741    /// Sends a response to the FIDL transaction.
6742    ///
6743    /// Sets the channel to shutdown if an error occurs.
6744    pub fn send(self, mut payload: &WifiChipGetAvailableModesResponse) -> Result<(), fidl::Error> {
6745        let _result = self.send_raw(payload);
6746        if _result.is_err() {
6747            self.control_handle.shutdown();
6748        }
6749        self.drop_without_shutdown();
6750        _result
6751    }
6752
6753    /// Similar to "send" but does not shutdown the channel if an error occurs.
6754    pub fn send_no_shutdown_on_err(
6755        self,
6756        mut payload: &WifiChipGetAvailableModesResponse,
6757    ) -> Result<(), fidl::Error> {
6758        let _result = self.send_raw(payload);
6759        self.drop_without_shutdown();
6760        _result
6761    }
6762
6763    fn send_raw(&self, mut payload: &WifiChipGetAvailableModesResponse) -> Result<(), fidl::Error> {
6764        self.control_handle
6765            .inner
6766            .send::<fidl::encoding::FlexibleType<WifiChipGetAvailableModesResponse>>(
6767                fidl::encoding::Flexible::new(payload),
6768                self.tx_id,
6769                0x1701095b452a3acd,
6770                fidl::encoding::DynamicFlags::FLEXIBLE,
6771            )
6772    }
6773}
6774
6775#[must_use = "FIDL methods require a response to be sent"]
6776#[derive(Debug)]
6777pub struct WifiChipGetIdResponder {
6778    control_handle: std::mem::ManuallyDrop<WifiChipControlHandle>,
6779    tx_id: u32,
6780}
6781
6782/// Set the the channel to be shutdown (see [`WifiChipControlHandle::shutdown`])
6783/// if the responder is dropped without sending a response, so that the client
6784/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6785impl std::ops::Drop for WifiChipGetIdResponder {
6786    fn drop(&mut self) {
6787        self.control_handle.shutdown();
6788        // Safety: drops once, never accessed again
6789        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6790    }
6791}
6792
6793impl fidl::endpoints::Responder for WifiChipGetIdResponder {
6794    type ControlHandle = WifiChipControlHandle;
6795
6796    fn control_handle(&self) -> &WifiChipControlHandle {
6797        &self.control_handle
6798    }
6799
6800    fn drop_without_shutdown(mut self) {
6801        // Safety: drops once, never accessed again due to mem::forget
6802        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6803        // Prevent Drop from running (which would shut down the channel)
6804        std::mem::forget(self);
6805    }
6806}
6807
6808impl WifiChipGetIdResponder {
6809    /// Sends a response to the FIDL transaction.
6810    ///
6811    /// Sets the channel to shutdown if an error occurs.
6812    pub fn send(self, mut payload: &WifiChipGetIdResponse) -> Result<(), fidl::Error> {
6813        let _result = self.send_raw(payload);
6814        if _result.is_err() {
6815            self.control_handle.shutdown();
6816        }
6817        self.drop_without_shutdown();
6818        _result
6819    }
6820
6821    /// Similar to "send" but does not shutdown the channel if an error occurs.
6822    pub fn send_no_shutdown_on_err(
6823        self,
6824        mut payload: &WifiChipGetIdResponse,
6825    ) -> Result<(), fidl::Error> {
6826        let _result = self.send_raw(payload);
6827        self.drop_without_shutdown();
6828        _result
6829    }
6830
6831    fn send_raw(&self, mut payload: &WifiChipGetIdResponse) -> Result<(), fidl::Error> {
6832        self.control_handle.inner.send::<fidl::encoding::FlexibleType<WifiChipGetIdResponse>>(
6833            fidl::encoding::Flexible::new(payload),
6834            self.tx_id,
6835            0x37d5197325bb3370,
6836            fidl::encoding::DynamicFlags::FLEXIBLE,
6837        )
6838    }
6839}
6840
6841#[must_use = "FIDL methods require a response to be sent"]
6842#[derive(Debug)]
6843pub struct WifiChipGetModeResponder {
6844    control_handle: std::mem::ManuallyDrop<WifiChipControlHandle>,
6845    tx_id: u32,
6846}
6847
6848/// Set the the channel to be shutdown (see [`WifiChipControlHandle::shutdown`])
6849/// if the responder is dropped without sending a response, so that the client
6850/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6851impl std::ops::Drop for WifiChipGetModeResponder {
6852    fn drop(&mut self) {
6853        self.control_handle.shutdown();
6854        // Safety: drops once, never accessed again
6855        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6856    }
6857}
6858
6859impl fidl::endpoints::Responder for WifiChipGetModeResponder {
6860    type ControlHandle = WifiChipControlHandle;
6861
6862    fn control_handle(&self) -> &WifiChipControlHandle {
6863        &self.control_handle
6864    }
6865
6866    fn drop_without_shutdown(mut self) {
6867        // Safety: drops once, never accessed again due to mem::forget
6868        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6869        // Prevent Drop from running (which would shut down the channel)
6870        std::mem::forget(self);
6871    }
6872}
6873
6874impl WifiChipGetModeResponder {
6875    /// Sends a response to the FIDL transaction.
6876    ///
6877    /// Sets the channel to shutdown if an error occurs.
6878    pub fn send(self, mut payload: &WifiChipGetModeResponse) -> Result<(), fidl::Error> {
6879        let _result = self.send_raw(payload);
6880        if _result.is_err() {
6881            self.control_handle.shutdown();
6882        }
6883        self.drop_without_shutdown();
6884        _result
6885    }
6886
6887    /// Similar to "send" but does not shutdown the channel if an error occurs.
6888    pub fn send_no_shutdown_on_err(
6889        self,
6890        mut payload: &WifiChipGetModeResponse,
6891    ) -> Result<(), fidl::Error> {
6892        let _result = self.send_raw(payload);
6893        self.drop_without_shutdown();
6894        _result
6895    }
6896
6897    fn send_raw(&self, mut payload: &WifiChipGetModeResponse) -> Result<(), fidl::Error> {
6898        self.control_handle.inner.send::<fidl::encoding::FlexibleType<WifiChipGetModeResponse>>(
6899            fidl::encoding::Flexible::new(payload),
6900            self.tx_id,
6901            0x4d209e0f3ac84d6f,
6902            fidl::encoding::DynamicFlags::FLEXIBLE,
6903        )
6904    }
6905}
6906
6907#[must_use = "FIDL methods require a response to be sent"]
6908#[derive(Debug)]
6909pub struct WifiChipGetCapabilitiesResponder {
6910    control_handle: std::mem::ManuallyDrop<WifiChipControlHandle>,
6911    tx_id: u32,
6912}
6913
6914/// Set the the channel to be shutdown (see [`WifiChipControlHandle::shutdown`])
6915/// if the responder is dropped without sending a response, so that the client
6916/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6917impl std::ops::Drop for WifiChipGetCapabilitiesResponder {
6918    fn drop(&mut self) {
6919        self.control_handle.shutdown();
6920        // Safety: drops once, never accessed again
6921        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6922    }
6923}
6924
6925impl fidl::endpoints::Responder for WifiChipGetCapabilitiesResponder {
6926    type ControlHandle = WifiChipControlHandle;
6927
6928    fn control_handle(&self) -> &WifiChipControlHandle {
6929        &self.control_handle
6930    }
6931
6932    fn drop_without_shutdown(mut self) {
6933        // Safety: drops once, never accessed again due to mem::forget
6934        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6935        // Prevent Drop from running (which would shut down the channel)
6936        std::mem::forget(self);
6937    }
6938}
6939
6940impl WifiChipGetCapabilitiesResponder {
6941    /// Sends a response to the FIDL transaction.
6942    ///
6943    /// Sets the channel to shutdown if an error occurs.
6944    pub fn send(self, mut payload: &WifiChipGetCapabilitiesResponse) -> Result<(), fidl::Error> {
6945        let _result = self.send_raw(payload);
6946        if _result.is_err() {
6947            self.control_handle.shutdown();
6948        }
6949        self.drop_without_shutdown();
6950        _result
6951    }
6952
6953    /// Similar to "send" but does not shutdown the channel if an error occurs.
6954    pub fn send_no_shutdown_on_err(
6955        self,
6956        mut payload: &WifiChipGetCapabilitiesResponse,
6957    ) -> Result<(), fidl::Error> {
6958        let _result = self.send_raw(payload);
6959        self.drop_without_shutdown();
6960        _result
6961    }
6962
6963    fn send_raw(&self, mut payload: &WifiChipGetCapabilitiesResponse) -> Result<(), fidl::Error> {
6964        self.control_handle
6965            .inner
6966            .send::<fidl::encoding::FlexibleType<WifiChipGetCapabilitiesResponse>>(
6967                fidl::encoding::Flexible::new(payload),
6968                self.tx_id,
6969                0x1b253f396dcaa2e0,
6970                fidl::encoding::DynamicFlags::FLEXIBLE,
6971            )
6972    }
6973}
6974
6975#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6976pub struct WifiEventCallbackMarker;
6977
6978impl fidl::endpoints::ProtocolMarker for WifiEventCallbackMarker {
6979    type Proxy = WifiEventCallbackProxy;
6980    type RequestStream = WifiEventCallbackRequestStream;
6981    #[cfg(target_os = "fuchsia")]
6982    type SynchronousProxy = WifiEventCallbackSynchronousProxy;
6983
6984    const DEBUG_NAME: &'static str = "(anonymous) WifiEventCallback";
6985}
6986
6987pub trait WifiEventCallbackProxyInterface: Send + Sync {
6988    fn r#on_start(&self) -> Result<(), fidl::Error>;
6989    fn r#on_stop(&self) -> Result<(), fidl::Error>;
6990}
6991#[derive(Debug)]
6992#[cfg(target_os = "fuchsia")]
6993pub struct WifiEventCallbackSynchronousProxy {
6994    client: fidl::client::sync::Client,
6995}
6996
6997#[cfg(target_os = "fuchsia")]
6998impl fidl::endpoints::SynchronousProxy for WifiEventCallbackSynchronousProxy {
6999    type Proxy = WifiEventCallbackProxy;
7000    type Protocol = WifiEventCallbackMarker;
7001
7002    fn from_channel(inner: fidl::Channel) -> Self {
7003        Self::new(inner)
7004    }
7005
7006    fn into_channel(self) -> fidl::Channel {
7007        self.client.into_channel()
7008    }
7009
7010    fn as_channel(&self) -> &fidl::Channel {
7011        self.client.as_channel()
7012    }
7013}
7014
7015#[cfg(target_os = "fuchsia")]
7016impl WifiEventCallbackSynchronousProxy {
7017    pub fn new(channel: fidl::Channel) -> Self {
7018        let protocol_name =
7019            <WifiEventCallbackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7020        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7021    }
7022
7023    pub fn into_channel(self) -> fidl::Channel {
7024        self.client.into_channel()
7025    }
7026
7027    /// Waits until an event arrives and returns it. It is safe for other
7028    /// threads to make concurrent requests while waiting for an event.
7029    pub fn wait_for_event(
7030        &self,
7031        deadline: zx::MonotonicInstant,
7032    ) -> Result<WifiEventCallbackEvent, fidl::Error> {
7033        WifiEventCallbackEvent::decode(self.client.wait_for_event(deadline)?)
7034    }
7035
7036    pub fn r#on_start(&self) -> Result<(), fidl::Error> {
7037        self.client.send::<fidl::encoding::EmptyPayload>(
7038            (),
7039            0x61189ff44f9d35f3,
7040            fidl::encoding::DynamicFlags::FLEXIBLE,
7041        )
7042    }
7043
7044    pub fn r#on_stop(&self) -> Result<(), fidl::Error> {
7045        self.client.send::<fidl::encoding::EmptyPayload>(
7046            (),
7047            0x58b697bcd475e0f9,
7048            fidl::encoding::DynamicFlags::FLEXIBLE,
7049        )
7050    }
7051}
7052
7053#[cfg(target_os = "fuchsia")]
7054impl From<WifiEventCallbackSynchronousProxy> for zx::Handle {
7055    fn from(value: WifiEventCallbackSynchronousProxy) -> Self {
7056        value.into_channel().into()
7057    }
7058}
7059
7060#[cfg(target_os = "fuchsia")]
7061impl From<fidl::Channel> for WifiEventCallbackSynchronousProxy {
7062    fn from(value: fidl::Channel) -> Self {
7063        Self::new(value)
7064    }
7065}
7066
7067#[derive(Debug, Clone)]
7068pub struct WifiEventCallbackProxy {
7069    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7070}
7071
7072impl fidl::endpoints::Proxy for WifiEventCallbackProxy {
7073    type Protocol = WifiEventCallbackMarker;
7074
7075    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7076        Self::new(inner)
7077    }
7078
7079    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7080        self.client.into_channel().map_err(|client| Self { client })
7081    }
7082
7083    fn as_channel(&self) -> &::fidl::AsyncChannel {
7084        self.client.as_channel()
7085    }
7086}
7087
7088impl WifiEventCallbackProxy {
7089    /// Create a new Proxy for fuchsia.wlan.wlanix/WifiEventCallback.
7090    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7091        let protocol_name =
7092            <WifiEventCallbackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7093        Self { client: fidl::client::Client::new(channel, protocol_name) }
7094    }
7095
7096    /// Get a Stream of events from the remote end of the protocol.
7097    ///
7098    /// # Panics
7099    ///
7100    /// Panics if the event stream was already taken.
7101    pub fn take_event_stream(&self) -> WifiEventCallbackEventStream {
7102        WifiEventCallbackEventStream { event_receiver: self.client.take_event_receiver() }
7103    }
7104
7105    pub fn r#on_start(&self) -> Result<(), fidl::Error> {
7106        WifiEventCallbackProxyInterface::r#on_start(self)
7107    }
7108
7109    pub fn r#on_stop(&self) -> Result<(), fidl::Error> {
7110        WifiEventCallbackProxyInterface::r#on_stop(self)
7111    }
7112}
7113
7114impl WifiEventCallbackProxyInterface for WifiEventCallbackProxy {
7115    fn r#on_start(&self) -> Result<(), fidl::Error> {
7116        self.client.send::<fidl::encoding::EmptyPayload>(
7117            (),
7118            0x61189ff44f9d35f3,
7119            fidl::encoding::DynamicFlags::FLEXIBLE,
7120        )
7121    }
7122
7123    fn r#on_stop(&self) -> Result<(), fidl::Error> {
7124        self.client.send::<fidl::encoding::EmptyPayload>(
7125            (),
7126            0x58b697bcd475e0f9,
7127            fidl::encoding::DynamicFlags::FLEXIBLE,
7128        )
7129    }
7130}
7131
7132pub struct WifiEventCallbackEventStream {
7133    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7134}
7135
7136impl std::marker::Unpin for WifiEventCallbackEventStream {}
7137
7138impl futures::stream::FusedStream for WifiEventCallbackEventStream {
7139    fn is_terminated(&self) -> bool {
7140        self.event_receiver.is_terminated()
7141    }
7142}
7143
7144impl futures::Stream for WifiEventCallbackEventStream {
7145    type Item = Result<WifiEventCallbackEvent, fidl::Error>;
7146
7147    fn poll_next(
7148        mut self: std::pin::Pin<&mut Self>,
7149        cx: &mut std::task::Context<'_>,
7150    ) -> std::task::Poll<Option<Self::Item>> {
7151        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7152            &mut self.event_receiver,
7153            cx
7154        )?) {
7155            Some(buf) => std::task::Poll::Ready(Some(WifiEventCallbackEvent::decode(buf))),
7156            None => std::task::Poll::Ready(None),
7157        }
7158    }
7159}
7160
7161#[derive(Debug)]
7162pub enum WifiEventCallbackEvent {
7163    #[non_exhaustive]
7164    _UnknownEvent {
7165        /// Ordinal of the event that was sent.
7166        ordinal: u64,
7167    },
7168}
7169
7170impl WifiEventCallbackEvent {
7171    /// Decodes a message buffer as a [`WifiEventCallbackEvent`].
7172    fn decode(
7173        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7174    ) -> Result<WifiEventCallbackEvent, fidl::Error> {
7175        let (bytes, _handles) = buf.split_mut();
7176        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7177        debug_assert_eq!(tx_header.tx_id, 0);
7178        match tx_header.ordinal {
7179            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
7180                Ok(WifiEventCallbackEvent::_UnknownEvent { ordinal: tx_header.ordinal })
7181            }
7182            _ => Err(fidl::Error::UnknownOrdinal {
7183                ordinal: tx_header.ordinal,
7184                protocol_name:
7185                    <WifiEventCallbackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7186            }),
7187        }
7188    }
7189}
7190
7191/// A Stream of incoming requests for fuchsia.wlan.wlanix/WifiEventCallback.
7192pub struct WifiEventCallbackRequestStream {
7193    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7194    is_terminated: bool,
7195}
7196
7197impl std::marker::Unpin for WifiEventCallbackRequestStream {}
7198
7199impl futures::stream::FusedStream for WifiEventCallbackRequestStream {
7200    fn is_terminated(&self) -> bool {
7201        self.is_terminated
7202    }
7203}
7204
7205impl fidl::endpoints::RequestStream for WifiEventCallbackRequestStream {
7206    type Protocol = WifiEventCallbackMarker;
7207    type ControlHandle = WifiEventCallbackControlHandle;
7208
7209    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7210        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7211    }
7212
7213    fn control_handle(&self) -> Self::ControlHandle {
7214        WifiEventCallbackControlHandle { inner: self.inner.clone() }
7215    }
7216
7217    fn into_inner(
7218        self,
7219    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7220    {
7221        (self.inner, self.is_terminated)
7222    }
7223
7224    fn from_inner(
7225        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7226        is_terminated: bool,
7227    ) -> Self {
7228        Self { inner, is_terminated }
7229    }
7230}
7231
7232impl futures::Stream for WifiEventCallbackRequestStream {
7233    type Item = Result<WifiEventCallbackRequest, fidl::Error>;
7234
7235    fn poll_next(
7236        mut self: std::pin::Pin<&mut Self>,
7237        cx: &mut std::task::Context<'_>,
7238    ) -> std::task::Poll<Option<Self::Item>> {
7239        let this = &mut *self;
7240        if this.inner.check_shutdown(cx) {
7241            this.is_terminated = true;
7242            return std::task::Poll::Ready(None);
7243        }
7244        if this.is_terminated {
7245            panic!("polled WifiEventCallbackRequestStream after completion");
7246        }
7247        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7248            |bytes, handles| {
7249                match this.inner.channel().read_etc(cx, bytes, handles) {
7250                    std::task::Poll::Ready(Ok(())) => {}
7251                    std::task::Poll::Pending => return std::task::Poll::Pending,
7252                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7253                        this.is_terminated = true;
7254                        return std::task::Poll::Ready(None);
7255                    }
7256                    std::task::Poll::Ready(Err(e)) => {
7257                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7258                            e.into(),
7259                        ))))
7260                    }
7261                }
7262
7263                // A message has been received from the channel
7264                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7265
7266                std::task::Poll::Ready(Some(match header.ordinal {
7267                    0x61189ff44f9d35f3 => {
7268                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
7269                        let mut req = fidl::new_empty!(
7270                            fidl::encoding::EmptyPayload,
7271                            fidl::encoding::DefaultFuchsiaResourceDialect
7272                        );
7273                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7274                        let control_handle =
7275                            WifiEventCallbackControlHandle { inner: this.inner.clone() };
7276                        Ok(WifiEventCallbackRequest::OnStart { control_handle })
7277                    }
7278                    0x58b697bcd475e0f9 => {
7279                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
7280                        let mut req = fidl::new_empty!(
7281                            fidl::encoding::EmptyPayload,
7282                            fidl::encoding::DefaultFuchsiaResourceDialect
7283                        );
7284                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7285                        let control_handle =
7286                            WifiEventCallbackControlHandle { inner: this.inner.clone() };
7287                        Ok(WifiEventCallbackRequest::OnStop { control_handle })
7288                    }
7289                    _ if header.tx_id == 0
7290                        && header
7291                            .dynamic_flags()
7292                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
7293                    {
7294                        Ok(WifiEventCallbackRequest::_UnknownMethod {
7295                            ordinal: header.ordinal,
7296                            control_handle: WifiEventCallbackControlHandle {
7297                                inner: this.inner.clone(),
7298                            },
7299                            method_type: fidl::MethodType::OneWay,
7300                        })
7301                    }
7302                    _ if header
7303                        .dynamic_flags()
7304                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
7305                    {
7306                        this.inner.send_framework_err(
7307                            fidl::encoding::FrameworkErr::UnknownMethod,
7308                            header.tx_id,
7309                            header.ordinal,
7310                            header.dynamic_flags(),
7311                            (bytes, handles),
7312                        )?;
7313                        Ok(WifiEventCallbackRequest::_UnknownMethod {
7314                            ordinal: header.ordinal,
7315                            control_handle: WifiEventCallbackControlHandle {
7316                                inner: this.inner.clone(),
7317                            },
7318                            method_type: fidl::MethodType::TwoWay,
7319                        })
7320                    }
7321                    _ => Err(fidl::Error::UnknownOrdinal {
7322                        ordinal: header.ordinal,
7323                        protocol_name:
7324                            <WifiEventCallbackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7325                    }),
7326                }))
7327            },
7328        )
7329    }
7330}
7331
7332#[derive(Debug)]
7333pub enum WifiEventCallbackRequest {
7334    OnStart {
7335        control_handle: WifiEventCallbackControlHandle,
7336    },
7337    OnStop {
7338        control_handle: WifiEventCallbackControlHandle,
7339    },
7340    /// An interaction was received which does not match any known method.
7341    #[non_exhaustive]
7342    _UnknownMethod {
7343        /// Ordinal of the method that was called.
7344        ordinal: u64,
7345        control_handle: WifiEventCallbackControlHandle,
7346        method_type: fidl::MethodType,
7347    },
7348}
7349
7350impl WifiEventCallbackRequest {
7351    #[allow(irrefutable_let_patterns)]
7352    pub fn into_on_start(self) -> Option<(WifiEventCallbackControlHandle)> {
7353        if let WifiEventCallbackRequest::OnStart { control_handle } = self {
7354            Some((control_handle))
7355        } else {
7356            None
7357        }
7358    }
7359
7360    #[allow(irrefutable_let_patterns)]
7361    pub fn into_on_stop(self) -> Option<(WifiEventCallbackControlHandle)> {
7362        if let WifiEventCallbackRequest::OnStop { control_handle } = self {
7363            Some((control_handle))
7364        } else {
7365            None
7366        }
7367    }
7368
7369    /// Name of the method defined in FIDL
7370    pub fn method_name(&self) -> &'static str {
7371        match *self {
7372            WifiEventCallbackRequest::OnStart { .. } => "on_start",
7373            WifiEventCallbackRequest::OnStop { .. } => "on_stop",
7374            WifiEventCallbackRequest::_UnknownMethod {
7375                method_type: fidl::MethodType::OneWay,
7376                ..
7377            } => "unknown one-way method",
7378            WifiEventCallbackRequest::_UnknownMethod {
7379                method_type: fidl::MethodType::TwoWay,
7380                ..
7381            } => "unknown two-way method",
7382        }
7383    }
7384}
7385
7386#[derive(Debug, Clone)]
7387pub struct WifiEventCallbackControlHandle {
7388    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7389}
7390
7391impl fidl::endpoints::ControlHandle for WifiEventCallbackControlHandle {
7392    fn shutdown(&self) {
7393        self.inner.shutdown()
7394    }
7395    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7396        self.inner.shutdown_with_epitaph(status)
7397    }
7398
7399    fn is_closed(&self) -> bool {
7400        self.inner.channel().is_closed()
7401    }
7402    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7403        self.inner.channel().on_closed()
7404    }
7405
7406    #[cfg(target_os = "fuchsia")]
7407    fn signal_peer(
7408        &self,
7409        clear_mask: zx::Signals,
7410        set_mask: zx::Signals,
7411    ) -> Result<(), zx_status::Status> {
7412        use fidl::Peered;
7413        self.inner.channel().signal_peer(clear_mask, set_mask)
7414    }
7415}
7416
7417impl WifiEventCallbackControlHandle {}
7418
7419#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7420pub struct WifiStaIfaceMarker;
7421
7422impl fidl::endpoints::ProtocolMarker for WifiStaIfaceMarker {
7423    type Proxy = WifiStaIfaceProxy;
7424    type RequestStream = WifiStaIfaceRequestStream;
7425    #[cfg(target_os = "fuchsia")]
7426    type SynchronousProxy = WifiStaIfaceSynchronousProxy;
7427
7428    const DEBUG_NAME: &'static str = "(anonymous) WifiStaIface";
7429}
7430
7431pub trait WifiStaIfaceProxyInterface: Send + Sync {
7432    type GetNameResponseFut: std::future::Future<Output = Result<WifiStaIfaceGetNameResponse, fidl::Error>>
7433        + Send;
7434    fn r#get_name(&self) -> Self::GetNameResponseFut;
7435}
7436#[derive(Debug)]
7437#[cfg(target_os = "fuchsia")]
7438pub struct WifiStaIfaceSynchronousProxy {
7439    client: fidl::client::sync::Client,
7440}
7441
7442#[cfg(target_os = "fuchsia")]
7443impl fidl::endpoints::SynchronousProxy for WifiStaIfaceSynchronousProxy {
7444    type Proxy = WifiStaIfaceProxy;
7445    type Protocol = WifiStaIfaceMarker;
7446
7447    fn from_channel(inner: fidl::Channel) -> Self {
7448        Self::new(inner)
7449    }
7450
7451    fn into_channel(self) -> fidl::Channel {
7452        self.client.into_channel()
7453    }
7454
7455    fn as_channel(&self) -> &fidl::Channel {
7456        self.client.as_channel()
7457    }
7458}
7459
7460#[cfg(target_os = "fuchsia")]
7461impl WifiStaIfaceSynchronousProxy {
7462    pub fn new(channel: fidl::Channel) -> Self {
7463        let protocol_name = <WifiStaIfaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7464        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7465    }
7466
7467    pub fn into_channel(self) -> fidl::Channel {
7468        self.client.into_channel()
7469    }
7470
7471    /// Waits until an event arrives and returns it. It is safe for other
7472    /// threads to make concurrent requests while waiting for an event.
7473    pub fn wait_for_event(
7474        &self,
7475        deadline: zx::MonotonicInstant,
7476    ) -> Result<WifiStaIfaceEvent, fidl::Error> {
7477        WifiStaIfaceEvent::decode(self.client.wait_for_event(deadline)?)
7478    }
7479
7480    /// Get the name of this iface.
7481    pub fn r#get_name(
7482        &self,
7483        ___deadline: zx::MonotonicInstant,
7484    ) -> Result<WifiStaIfaceGetNameResponse, fidl::Error> {
7485        let _response = self.client.send_query::<
7486            fidl::encoding::EmptyPayload,
7487            fidl::encoding::FlexibleType<WifiStaIfaceGetNameResponse>,
7488        >(
7489            (),
7490            0x5c150b91c80c5789,
7491            fidl::encoding::DynamicFlags::FLEXIBLE,
7492            ___deadline,
7493        )?
7494        .into_result::<WifiStaIfaceMarker>("get_name")?;
7495        Ok(_response)
7496    }
7497}
7498
7499#[cfg(target_os = "fuchsia")]
7500impl From<WifiStaIfaceSynchronousProxy> for zx::Handle {
7501    fn from(value: WifiStaIfaceSynchronousProxy) -> Self {
7502        value.into_channel().into()
7503    }
7504}
7505
7506#[cfg(target_os = "fuchsia")]
7507impl From<fidl::Channel> for WifiStaIfaceSynchronousProxy {
7508    fn from(value: fidl::Channel) -> Self {
7509        Self::new(value)
7510    }
7511}
7512
7513#[derive(Debug, Clone)]
7514pub struct WifiStaIfaceProxy {
7515    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7516}
7517
7518impl fidl::endpoints::Proxy for WifiStaIfaceProxy {
7519    type Protocol = WifiStaIfaceMarker;
7520
7521    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7522        Self::new(inner)
7523    }
7524
7525    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7526        self.client.into_channel().map_err(|client| Self { client })
7527    }
7528
7529    fn as_channel(&self) -> &::fidl::AsyncChannel {
7530        self.client.as_channel()
7531    }
7532}
7533
7534impl WifiStaIfaceProxy {
7535    /// Create a new Proxy for fuchsia.wlan.wlanix/WifiStaIface.
7536    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7537        let protocol_name = <WifiStaIfaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7538        Self { client: fidl::client::Client::new(channel, protocol_name) }
7539    }
7540
7541    /// Get a Stream of events from the remote end of the protocol.
7542    ///
7543    /// # Panics
7544    ///
7545    /// Panics if the event stream was already taken.
7546    pub fn take_event_stream(&self) -> WifiStaIfaceEventStream {
7547        WifiStaIfaceEventStream { event_receiver: self.client.take_event_receiver() }
7548    }
7549
7550    /// Get the name of this iface.
7551    pub fn r#get_name(
7552        &self,
7553    ) -> fidl::client::QueryResponseFut<
7554        WifiStaIfaceGetNameResponse,
7555        fidl::encoding::DefaultFuchsiaResourceDialect,
7556    > {
7557        WifiStaIfaceProxyInterface::r#get_name(self)
7558    }
7559}
7560
7561impl WifiStaIfaceProxyInterface for WifiStaIfaceProxy {
7562    type GetNameResponseFut = fidl::client::QueryResponseFut<
7563        WifiStaIfaceGetNameResponse,
7564        fidl::encoding::DefaultFuchsiaResourceDialect,
7565    >;
7566    fn r#get_name(&self) -> Self::GetNameResponseFut {
7567        fn _decode(
7568            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7569        ) -> Result<WifiStaIfaceGetNameResponse, fidl::Error> {
7570            let _response = fidl::client::decode_transaction_body::<
7571                fidl::encoding::FlexibleType<WifiStaIfaceGetNameResponse>,
7572                fidl::encoding::DefaultFuchsiaResourceDialect,
7573                0x5c150b91c80c5789,
7574            >(_buf?)?
7575            .into_result::<WifiStaIfaceMarker>("get_name")?;
7576            Ok(_response)
7577        }
7578        self.client
7579            .send_query_and_decode::<fidl::encoding::EmptyPayload, WifiStaIfaceGetNameResponse>(
7580                (),
7581                0x5c150b91c80c5789,
7582                fidl::encoding::DynamicFlags::FLEXIBLE,
7583                _decode,
7584            )
7585    }
7586}
7587
7588pub struct WifiStaIfaceEventStream {
7589    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7590}
7591
7592impl std::marker::Unpin for WifiStaIfaceEventStream {}
7593
7594impl futures::stream::FusedStream for WifiStaIfaceEventStream {
7595    fn is_terminated(&self) -> bool {
7596        self.event_receiver.is_terminated()
7597    }
7598}
7599
7600impl futures::Stream for WifiStaIfaceEventStream {
7601    type Item = Result<WifiStaIfaceEvent, fidl::Error>;
7602
7603    fn poll_next(
7604        mut self: std::pin::Pin<&mut Self>,
7605        cx: &mut std::task::Context<'_>,
7606    ) -> std::task::Poll<Option<Self::Item>> {
7607        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7608            &mut self.event_receiver,
7609            cx
7610        )?) {
7611            Some(buf) => std::task::Poll::Ready(Some(WifiStaIfaceEvent::decode(buf))),
7612            None => std::task::Poll::Ready(None),
7613        }
7614    }
7615}
7616
7617#[derive(Debug)]
7618pub enum WifiStaIfaceEvent {
7619    #[non_exhaustive]
7620    _UnknownEvent {
7621        /// Ordinal of the event that was sent.
7622        ordinal: u64,
7623    },
7624}
7625
7626impl WifiStaIfaceEvent {
7627    /// Decodes a message buffer as a [`WifiStaIfaceEvent`].
7628    fn decode(
7629        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7630    ) -> Result<WifiStaIfaceEvent, fidl::Error> {
7631        let (bytes, _handles) = buf.split_mut();
7632        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7633        debug_assert_eq!(tx_header.tx_id, 0);
7634        match tx_header.ordinal {
7635            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
7636                Ok(WifiStaIfaceEvent::_UnknownEvent { ordinal: tx_header.ordinal })
7637            }
7638            _ => Err(fidl::Error::UnknownOrdinal {
7639                ordinal: tx_header.ordinal,
7640                protocol_name: <WifiStaIfaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7641            }),
7642        }
7643    }
7644}
7645
7646/// A Stream of incoming requests for fuchsia.wlan.wlanix/WifiStaIface.
7647pub struct WifiStaIfaceRequestStream {
7648    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7649    is_terminated: bool,
7650}
7651
7652impl std::marker::Unpin for WifiStaIfaceRequestStream {}
7653
7654impl futures::stream::FusedStream for WifiStaIfaceRequestStream {
7655    fn is_terminated(&self) -> bool {
7656        self.is_terminated
7657    }
7658}
7659
7660impl fidl::endpoints::RequestStream for WifiStaIfaceRequestStream {
7661    type Protocol = WifiStaIfaceMarker;
7662    type ControlHandle = WifiStaIfaceControlHandle;
7663
7664    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7665        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7666    }
7667
7668    fn control_handle(&self) -> Self::ControlHandle {
7669        WifiStaIfaceControlHandle { inner: self.inner.clone() }
7670    }
7671
7672    fn into_inner(
7673        self,
7674    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7675    {
7676        (self.inner, self.is_terminated)
7677    }
7678
7679    fn from_inner(
7680        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7681        is_terminated: bool,
7682    ) -> Self {
7683        Self { inner, is_terminated }
7684    }
7685}
7686
7687impl futures::Stream for WifiStaIfaceRequestStream {
7688    type Item = Result<WifiStaIfaceRequest, fidl::Error>;
7689
7690    fn poll_next(
7691        mut self: std::pin::Pin<&mut Self>,
7692        cx: &mut std::task::Context<'_>,
7693    ) -> std::task::Poll<Option<Self::Item>> {
7694        let this = &mut *self;
7695        if this.inner.check_shutdown(cx) {
7696            this.is_terminated = true;
7697            return std::task::Poll::Ready(None);
7698        }
7699        if this.is_terminated {
7700            panic!("polled WifiStaIfaceRequestStream after completion");
7701        }
7702        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7703            |bytes, handles| {
7704                match this.inner.channel().read_etc(cx, bytes, handles) {
7705                    std::task::Poll::Ready(Ok(())) => {}
7706                    std::task::Poll::Pending => return std::task::Poll::Pending,
7707                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7708                        this.is_terminated = true;
7709                        return std::task::Poll::Ready(None);
7710                    }
7711                    std::task::Poll::Ready(Err(e)) => {
7712                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7713                            e.into(),
7714                        ))))
7715                    }
7716                }
7717
7718                // A message has been received from the channel
7719                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7720
7721                std::task::Poll::Ready(Some(match header.ordinal {
7722                    0x5c150b91c80c5789 => {
7723                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7724                        let mut req = fidl::new_empty!(
7725                            fidl::encoding::EmptyPayload,
7726                            fidl::encoding::DefaultFuchsiaResourceDialect
7727                        );
7728                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7729                        let control_handle =
7730                            WifiStaIfaceControlHandle { inner: this.inner.clone() };
7731                        Ok(WifiStaIfaceRequest::GetName {
7732                            responder: WifiStaIfaceGetNameResponder {
7733                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7734                                tx_id: header.tx_id,
7735                            },
7736                        })
7737                    }
7738                    _ if header.tx_id == 0
7739                        && header
7740                            .dynamic_flags()
7741                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
7742                    {
7743                        Ok(WifiStaIfaceRequest::_UnknownMethod {
7744                            ordinal: header.ordinal,
7745                            control_handle: WifiStaIfaceControlHandle { inner: this.inner.clone() },
7746                            method_type: fidl::MethodType::OneWay,
7747                        })
7748                    }
7749                    _ if header
7750                        .dynamic_flags()
7751                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
7752                    {
7753                        this.inner.send_framework_err(
7754                            fidl::encoding::FrameworkErr::UnknownMethod,
7755                            header.tx_id,
7756                            header.ordinal,
7757                            header.dynamic_flags(),
7758                            (bytes, handles),
7759                        )?;
7760                        Ok(WifiStaIfaceRequest::_UnknownMethod {
7761                            ordinal: header.ordinal,
7762                            control_handle: WifiStaIfaceControlHandle { inner: this.inner.clone() },
7763                            method_type: fidl::MethodType::TwoWay,
7764                        })
7765                    }
7766                    _ => Err(fidl::Error::UnknownOrdinal {
7767                        ordinal: header.ordinal,
7768                        protocol_name:
7769                            <WifiStaIfaceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7770                    }),
7771                }))
7772            },
7773        )
7774    }
7775}
7776
7777#[derive(Debug)]
7778pub enum WifiStaIfaceRequest {
7779    /// Get the name of this iface.
7780    GetName { responder: WifiStaIfaceGetNameResponder },
7781    /// An interaction was received which does not match any known method.
7782    #[non_exhaustive]
7783    _UnknownMethod {
7784        /// Ordinal of the method that was called.
7785        ordinal: u64,
7786        control_handle: WifiStaIfaceControlHandle,
7787        method_type: fidl::MethodType,
7788    },
7789}
7790
7791impl WifiStaIfaceRequest {
7792    #[allow(irrefutable_let_patterns)]
7793    pub fn into_get_name(self) -> Option<(WifiStaIfaceGetNameResponder)> {
7794        if let WifiStaIfaceRequest::GetName { responder } = self {
7795            Some((responder))
7796        } else {
7797            None
7798        }
7799    }
7800
7801    /// Name of the method defined in FIDL
7802    pub fn method_name(&self) -> &'static str {
7803        match *self {
7804            WifiStaIfaceRequest::GetName { .. } => "get_name",
7805            WifiStaIfaceRequest::_UnknownMethod {
7806                method_type: fidl::MethodType::OneWay, ..
7807            } => "unknown one-way method",
7808            WifiStaIfaceRequest::_UnknownMethod {
7809                method_type: fidl::MethodType::TwoWay, ..
7810            } => "unknown two-way method",
7811        }
7812    }
7813}
7814
7815#[derive(Debug, Clone)]
7816pub struct WifiStaIfaceControlHandle {
7817    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7818}
7819
7820impl fidl::endpoints::ControlHandle for WifiStaIfaceControlHandle {
7821    fn shutdown(&self) {
7822        self.inner.shutdown()
7823    }
7824    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7825        self.inner.shutdown_with_epitaph(status)
7826    }
7827
7828    fn is_closed(&self) -> bool {
7829        self.inner.channel().is_closed()
7830    }
7831    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7832        self.inner.channel().on_closed()
7833    }
7834
7835    #[cfg(target_os = "fuchsia")]
7836    fn signal_peer(
7837        &self,
7838        clear_mask: zx::Signals,
7839        set_mask: zx::Signals,
7840    ) -> Result<(), zx_status::Status> {
7841        use fidl::Peered;
7842        self.inner.channel().signal_peer(clear_mask, set_mask)
7843    }
7844}
7845
7846impl WifiStaIfaceControlHandle {}
7847
7848#[must_use = "FIDL methods require a response to be sent"]
7849#[derive(Debug)]
7850pub struct WifiStaIfaceGetNameResponder {
7851    control_handle: std::mem::ManuallyDrop<WifiStaIfaceControlHandle>,
7852    tx_id: u32,
7853}
7854
7855/// Set the the channel to be shutdown (see [`WifiStaIfaceControlHandle::shutdown`])
7856/// if the responder is dropped without sending a response, so that the client
7857/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7858impl std::ops::Drop for WifiStaIfaceGetNameResponder {
7859    fn drop(&mut self) {
7860        self.control_handle.shutdown();
7861        // Safety: drops once, never accessed again
7862        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7863    }
7864}
7865
7866impl fidl::endpoints::Responder for WifiStaIfaceGetNameResponder {
7867    type ControlHandle = WifiStaIfaceControlHandle;
7868
7869    fn control_handle(&self) -> &WifiStaIfaceControlHandle {
7870        &self.control_handle
7871    }
7872
7873    fn drop_without_shutdown(mut self) {
7874        // Safety: drops once, never accessed again due to mem::forget
7875        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7876        // Prevent Drop from running (which would shut down the channel)
7877        std::mem::forget(self);
7878    }
7879}
7880
7881impl WifiStaIfaceGetNameResponder {
7882    /// Sends a response to the FIDL transaction.
7883    ///
7884    /// Sets the channel to shutdown if an error occurs.
7885    pub fn send(self, mut payload: &WifiStaIfaceGetNameResponse) -> Result<(), fidl::Error> {
7886        let _result = self.send_raw(payload);
7887        if _result.is_err() {
7888            self.control_handle.shutdown();
7889        }
7890        self.drop_without_shutdown();
7891        _result
7892    }
7893
7894    /// Similar to "send" but does not shutdown the channel if an error occurs.
7895    pub fn send_no_shutdown_on_err(
7896        self,
7897        mut payload: &WifiStaIfaceGetNameResponse,
7898    ) -> Result<(), fidl::Error> {
7899        let _result = self.send_raw(payload);
7900        self.drop_without_shutdown();
7901        _result
7902    }
7903
7904    fn send_raw(&self, mut payload: &WifiStaIfaceGetNameResponse) -> Result<(), fidl::Error> {
7905        self.control_handle.inner.send::<fidl::encoding::FlexibleType<WifiStaIfaceGetNameResponse>>(
7906            fidl::encoding::Flexible::new(payload),
7907            self.tx_id,
7908            0x5c150b91c80c5789,
7909            fidl::encoding::DynamicFlags::FLEXIBLE,
7910        )
7911    }
7912}
7913
7914#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7915pub struct WlanixMarker;
7916
7917impl fidl::endpoints::ProtocolMarker for WlanixMarker {
7918    type Proxy = WlanixProxy;
7919    type RequestStream = WlanixRequestStream;
7920    #[cfg(target_os = "fuchsia")]
7921    type SynchronousProxy = WlanixSynchronousProxy;
7922
7923    const DEBUG_NAME: &'static str = "fuchsia.wlan.wlanix.Wlanix";
7924}
7925impl fidl::endpoints::DiscoverableProtocolMarker for WlanixMarker {}
7926
7927pub trait WlanixProxyInterface: Send + Sync {
7928    fn r#get_wifi(&self, payload: WlanixGetWifiRequest) -> Result<(), fidl::Error>;
7929    fn r#get_supplicant(&self, payload: WlanixGetSupplicantRequest) -> Result<(), fidl::Error>;
7930    fn r#get_nl80211(&self, payload: WlanixGetNl80211Request) -> Result<(), fidl::Error>;
7931}
7932#[derive(Debug)]
7933#[cfg(target_os = "fuchsia")]
7934pub struct WlanixSynchronousProxy {
7935    client: fidl::client::sync::Client,
7936}
7937
7938#[cfg(target_os = "fuchsia")]
7939impl fidl::endpoints::SynchronousProxy for WlanixSynchronousProxy {
7940    type Proxy = WlanixProxy;
7941    type Protocol = WlanixMarker;
7942
7943    fn from_channel(inner: fidl::Channel) -> Self {
7944        Self::new(inner)
7945    }
7946
7947    fn into_channel(self) -> fidl::Channel {
7948        self.client.into_channel()
7949    }
7950
7951    fn as_channel(&self) -> &fidl::Channel {
7952        self.client.as_channel()
7953    }
7954}
7955
7956#[cfg(target_os = "fuchsia")]
7957impl WlanixSynchronousProxy {
7958    pub fn new(channel: fidl::Channel) -> Self {
7959        let protocol_name = <WlanixMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7960        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7961    }
7962
7963    pub fn into_channel(self) -> fidl::Channel {
7964        self.client.into_channel()
7965    }
7966
7967    /// Waits until an event arrives and returns it. It is safe for other
7968    /// threads to make concurrent requests while waiting for an event.
7969    pub fn wait_for_event(
7970        &self,
7971        deadline: zx::MonotonicInstant,
7972    ) -> Result<WlanixEvent, fidl::Error> {
7973        WlanixEvent::decode(self.client.wait_for_event(deadline)?)
7974    }
7975
7976    /// Register the channel to make WiFi request to.
7977    pub fn r#get_wifi(&self, mut payload: WlanixGetWifiRequest) -> Result<(), fidl::Error> {
7978        self.client.send::<WlanixGetWifiRequest>(
7979            &mut payload,
7980            0x142511f44b2c338c,
7981            fidl::encoding::DynamicFlags::FLEXIBLE,
7982        )
7983    }
7984
7985    pub fn r#get_supplicant(
7986        &self,
7987        mut payload: WlanixGetSupplicantRequest,
7988    ) -> Result<(), fidl::Error> {
7989        self.client.send::<WlanixGetSupplicantRequest>(
7990            &mut payload,
7991            0x55554b37c4021d3d,
7992            fidl::encoding::DynamicFlags::FLEXIBLE,
7993        )
7994    }
7995
7996    pub fn r#get_nl80211(&self, mut payload: WlanixGetNl80211Request) -> Result<(), fidl::Error> {
7997        self.client.send::<WlanixGetNl80211Request>(
7998            &mut payload,
7999            0x48028a25bd855ef9,
8000            fidl::encoding::DynamicFlags::FLEXIBLE,
8001        )
8002    }
8003}
8004
8005#[cfg(target_os = "fuchsia")]
8006impl From<WlanixSynchronousProxy> for zx::Handle {
8007    fn from(value: WlanixSynchronousProxy) -> Self {
8008        value.into_channel().into()
8009    }
8010}
8011
8012#[cfg(target_os = "fuchsia")]
8013impl From<fidl::Channel> for WlanixSynchronousProxy {
8014    fn from(value: fidl::Channel) -> Self {
8015        Self::new(value)
8016    }
8017}
8018
8019#[derive(Debug, Clone)]
8020pub struct WlanixProxy {
8021    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8022}
8023
8024impl fidl::endpoints::Proxy for WlanixProxy {
8025    type Protocol = WlanixMarker;
8026
8027    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8028        Self::new(inner)
8029    }
8030
8031    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8032        self.client.into_channel().map_err(|client| Self { client })
8033    }
8034
8035    fn as_channel(&self) -> &::fidl::AsyncChannel {
8036        self.client.as_channel()
8037    }
8038}
8039
8040impl WlanixProxy {
8041    /// Create a new Proxy for fuchsia.wlan.wlanix/Wlanix.
8042    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8043        let protocol_name = <WlanixMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8044        Self { client: fidl::client::Client::new(channel, protocol_name) }
8045    }
8046
8047    /// Get a Stream of events from the remote end of the protocol.
8048    ///
8049    /// # Panics
8050    ///
8051    /// Panics if the event stream was already taken.
8052    pub fn take_event_stream(&self) -> WlanixEventStream {
8053        WlanixEventStream { event_receiver: self.client.take_event_receiver() }
8054    }
8055
8056    /// Register the channel to make WiFi request to.
8057    pub fn r#get_wifi(&self, mut payload: WlanixGetWifiRequest) -> Result<(), fidl::Error> {
8058        WlanixProxyInterface::r#get_wifi(self, payload)
8059    }
8060
8061    pub fn r#get_supplicant(
8062        &self,
8063        mut payload: WlanixGetSupplicantRequest,
8064    ) -> Result<(), fidl::Error> {
8065        WlanixProxyInterface::r#get_supplicant(self, payload)
8066    }
8067
8068    pub fn r#get_nl80211(&self, mut payload: WlanixGetNl80211Request) -> Result<(), fidl::Error> {
8069        WlanixProxyInterface::r#get_nl80211(self, payload)
8070    }
8071}
8072
8073impl WlanixProxyInterface for WlanixProxy {
8074    fn r#get_wifi(&self, mut payload: WlanixGetWifiRequest) -> Result<(), fidl::Error> {
8075        self.client.send::<WlanixGetWifiRequest>(
8076            &mut payload,
8077            0x142511f44b2c338c,
8078            fidl::encoding::DynamicFlags::FLEXIBLE,
8079        )
8080    }
8081
8082    fn r#get_supplicant(&self, mut payload: WlanixGetSupplicantRequest) -> Result<(), fidl::Error> {
8083        self.client.send::<WlanixGetSupplicantRequest>(
8084            &mut payload,
8085            0x55554b37c4021d3d,
8086            fidl::encoding::DynamicFlags::FLEXIBLE,
8087        )
8088    }
8089
8090    fn r#get_nl80211(&self, mut payload: WlanixGetNl80211Request) -> Result<(), fidl::Error> {
8091        self.client.send::<WlanixGetNl80211Request>(
8092            &mut payload,
8093            0x48028a25bd855ef9,
8094            fidl::encoding::DynamicFlags::FLEXIBLE,
8095        )
8096    }
8097}
8098
8099pub struct WlanixEventStream {
8100    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8101}
8102
8103impl std::marker::Unpin for WlanixEventStream {}
8104
8105impl futures::stream::FusedStream for WlanixEventStream {
8106    fn is_terminated(&self) -> bool {
8107        self.event_receiver.is_terminated()
8108    }
8109}
8110
8111impl futures::Stream for WlanixEventStream {
8112    type Item = Result<WlanixEvent, fidl::Error>;
8113
8114    fn poll_next(
8115        mut self: std::pin::Pin<&mut Self>,
8116        cx: &mut std::task::Context<'_>,
8117    ) -> std::task::Poll<Option<Self::Item>> {
8118        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8119            &mut self.event_receiver,
8120            cx
8121        )?) {
8122            Some(buf) => std::task::Poll::Ready(Some(WlanixEvent::decode(buf))),
8123            None => std::task::Poll::Ready(None),
8124        }
8125    }
8126}
8127
8128#[derive(Debug)]
8129pub enum WlanixEvent {
8130    #[non_exhaustive]
8131    _UnknownEvent {
8132        /// Ordinal of the event that was sent.
8133        ordinal: u64,
8134    },
8135}
8136
8137impl WlanixEvent {
8138    /// Decodes a message buffer as a [`WlanixEvent`].
8139    fn decode(
8140        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8141    ) -> Result<WlanixEvent, fidl::Error> {
8142        let (bytes, _handles) = buf.split_mut();
8143        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8144        debug_assert_eq!(tx_header.tx_id, 0);
8145        match tx_header.ordinal {
8146            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
8147                Ok(WlanixEvent::_UnknownEvent { ordinal: tx_header.ordinal })
8148            }
8149            _ => Err(fidl::Error::UnknownOrdinal {
8150                ordinal: tx_header.ordinal,
8151                protocol_name: <WlanixMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8152            }),
8153        }
8154    }
8155}
8156
8157/// A Stream of incoming requests for fuchsia.wlan.wlanix/Wlanix.
8158pub struct WlanixRequestStream {
8159    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8160    is_terminated: bool,
8161}
8162
8163impl std::marker::Unpin for WlanixRequestStream {}
8164
8165impl futures::stream::FusedStream for WlanixRequestStream {
8166    fn is_terminated(&self) -> bool {
8167        self.is_terminated
8168    }
8169}
8170
8171impl fidl::endpoints::RequestStream for WlanixRequestStream {
8172    type Protocol = WlanixMarker;
8173    type ControlHandle = WlanixControlHandle;
8174
8175    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8176        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8177    }
8178
8179    fn control_handle(&self) -> Self::ControlHandle {
8180        WlanixControlHandle { inner: self.inner.clone() }
8181    }
8182
8183    fn into_inner(
8184        self,
8185    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8186    {
8187        (self.inner, self.is_terminated)
8188    }
8189
8190    fn from_inner(
8191        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8192        is_terminated: bool,
8193    ) -> Self {
8194        Self { inner, is_terminated }
8195    }
8196}
8197
8198impl futures::Stream for WlanixRequestStream {
8199    type Item = Result<WlanixRequest, fidl::Error>;
8200
8201    fn poll_next(
8202        mut self: std::pin::Pin<&mut Self>,
8203        cx: &mut std::task::Context<'_>,
8204    ) -> std::task::Poll<Option<Self::Item>> {
8205        let this = &mut *self;
8206        if this.inner.check_shutdown(cx) {
8207            this.is_terminated = true;
8208            return std::task::Poll::Ready(None);
8209        }
8210        if this.is_terminated {
8211            panic!("polled WlanixRequestStream after completion");
8212        }
8213        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8214            |bytes, handles| {
8215                match this.inner.channel().read_etc(cx, bytes, handles) {
8216                    std::task::Poll::Ready(Ok(())) => {}
8217                    std::task::Poll::Pending => return std::task::Poll::Pending,
8218                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8219                        this.is_terminated = true;
8220                        return std::task::Poll::Ready(None);
8221                    }
8222                    std::task::Poll::Ready(Err(e)) => {
8223                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8224                            e.into(),
8225                        ))))
8226                    }
8227                }
8228
8229                // A message has been received from the channel
8230                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8231
8232                std::task::Poll::Ready(Some(match header.ordinal {
8233                    0x142511f44b2c338c => {
8234                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8235                        let mut req = fidl::new_empty!(
8236                            WlanixGetWifiRequest,
8237                            fidl::encoding::DefaultFuchsiaResourceDialect
8238                        );
8239                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlanixGetWifiRequest>(&header, _body_bytes, handles, &mut req)?;
8240                        let control_handle = WlanixControlHandle { inner: this.inner.clone() };
8241                        Ok(WlanixRequest::GetWifi { payload: req, control_handle })
8242                    }
8243                    0x55554b37c4021d3d => {
8244                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8245                        let mut req = fidl::new_empty!(
8246                            WlanixGetSupplicantRequest,
8247                            fidl::encoding::DefaultFuchsiaResourceDialect
8248                        );
8249                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlanixGetSupplicantRequest>(&header, _body_bytes, handles, &mut req)?;
8250                        let control_handle = WlanixControlHandle { inner: this.inner.clone() };
8251                        Ok(WlanixRequest::GetSupplicant { payload: req, control_handle })
8252                    }
8253                    0x48028a25bd855ef9 => {
8254                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8255                        let mut req = fidl::new_empty!(
8256                            WlanixGetNl80211Request,
8257                            fidl::encoding::DefaultFuchsiaResourceDialect
8258                        );
8259                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlanixGetNl80211Request>(&header, _body_bytes, handles, &mut req)?;
8260                        let control_handle = WlanixControlHandle { inner: this.inner.clone() };
8261                        Ok(WlanixRequest::GetNl80211 { payload: req, control_handle })
8262                    }
8263                    _ if header.tx_id == 0
8264                        && header
8265                            .dynamic_flags()
8266                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
8267                    {
8268                        Ok(WlanixRequest::_UnknownMethod {
8269                            ordinal: header.ordinal,
8270                            control_handle: WlanixControlHandle { inner: this.inner.clone() },
8271                            method_type: fidl::MethodType::OneWay,
8272                        })
8273                    }
8274                    _ if header
8275                        .dynamic_flags()
8276                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
8277                    {
8278                        this.inner.send_framework_err(
8279                            fidl::encoding::FrameworkErr::UnknownMethod,
8280                            header.tx_id,
8281                            header.ordinal,
8282                            header.dynamic_flags(),
8283                            (bytes, handles),
8284                        )?;
8285                        Ok(WlanixRequest::_UnknownMethod {
8286                            ordinal: header.ordinal,
8287                            control_handle: WlanixControlHandle { inner: this.inner.clone() },
8288                            method_type: fidl::MethodType::TwoWay,
8289                        })
8290                    }
8291                    _ => Err(fidl::Error::UnknownOrdinal {
8292                        ordinal: header.ordinal,
8293                        protocol_name:
8294                            <WlanixMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8295                    }),
8296                }))
8297            },
8298        )
8299    }
8300}
8301
8302/// Protocol used to proxy Wlanix requests from Starnix into Fuchsia.
8303#[derive(Debug)]
8304pub enum WlanixRequest {
8305    /// Register the channel to make WiFi request to.
8306    GetWifi {
8307        payload: WlanixGetWifiRequest,
8308        control_handle: WlanixControlHandle,
8309    },
8310    GetSupplicant {
8311        payload: WlanixGetSupplicantRequest,
8312        control_handle: WlanixControlHandle,
8313    },
8314    GetNl80211 {
8315        payload: WlanixGetNl80211Request,
8316        control_handle: WlanixControlHandle,
8317    },
8318    /// An interaction was received which does not match any known method.
8319    #[non_exhaustive]
8320    _UnknownMethod {
8321        /// Ordinal of the method that was called.
8322        ordinal: u64,
8323        control_handle: WlanixControlHandle,
8324        method_type: fidl::MethodType,
8325    },
8326}
8327
8328impl WlanixRequest {
8329    #[allow(irrefutable_let_patterns)]
8330    pub fn into_get_wifi(self) -> Option<(WlanixGetWifiRequest, WlanixControlHandle)> {
8331        if let WlanixRequest::GetWifi { payload, control_handle } = self {
8332            Some((payload, control_handle))
8333        } else {
8334            None
8335        }
8336    }
8337
8338    #[allow(irrefutable_let_patterns)]
8339    pub fn into_get_supplicant(self) -> Option<(WlanixGetSupplicantRequest, WlanixControlHandle)> {
8340        if let WlanixRequest::GetSupplicant { payload, control_handle } = self {
8341            Some((payload, control_handle))
8342        } else {
8343            None
8344        }
8345    }
8346
8347    #[allow(irrefutable_let_patterns)]
8348    pub fn into_get_nl80211(self) -> Option<(WlanixGetNl80211Request, WlanixControlHandle)> {
8349        if let WlanixRequest::GetNl80211 { payload, control_handle } = self {
8350            Some((payload, control_handle))
8351        } else {
8352            None
8353        }
8354    }
8355
8356    /// Name of the method defined in FIDL
8357    pub fn method_name(&self) -> &'static str {
8358        match *self {
8359            WlanixRequest::GetWifi { .. } => "get_wifi",
8360            WlanixRequest::GetSupplicant { .. } => "get_supplicant",
8361            WlanixRequest::GetNl80211 { .. } => "get_nl80211",
8362            WlanixRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
8363                "unknown one-way method"
8364            }
8365            WlanixRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
8366                "unknown two-way method"
8367            }
8368        }
8369    }
8370}
8371
8372#[derive(Debug, Clone)]
8373pub struct WlanixControlHandle {
8374    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8375}
8376
8377impl fidl::endpoints::ControlHandle for WlanixControlHandle {
8378    fn shutdown(&self) {
8379        self.inner.shutdown()
8380    }
8381    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8382        self.inner.shutdown_with_epitaph(status)
8383    }
8384
8385    fn is_closed(&self) -> bool {
8386        self.inner.channel().is_closed()
8387    }
8388    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8389        self.inner.channel().on_closed()
8390    }
8391
8392    #[cfg(target_os = "fuchsia")]
8393    fn signal_peer(
8394        &self,
8395        clear_mask: zx::Signals,
8396        set_mask: zx::Signals,
8397    ) -> Result<(), zx_status::Status> {
8398        use fidl::Peered;
8399        self.inner.channel().signal_peer(clear_mask, set_mask)
8400    }
8401}
8402
8403impl WlanixControlHandle {}
8404
8405mod internal {
8406    use super::*;
8407
8408    impl Nl80211GetMulticastRequest {
8409        #[inline(always)]
8410        fn max_ordinal_present(&self) -> u64 {
8411            if let Some(_) = self.multicast {
8412                return 2;
8413            }
8414            if let Some(_) = self.group {
8415                return 1;
8416            }
8417            0
8418        }
8419    }
8420
8421    impl fidl::encoding::ResourceTypeMarker for Nl80211GetMulticastRequest {
8422        type Borrowed<'a> = &'a mut Self;
8423        fn take_or_borrow<'a>(
8424            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8425        ) -> Self::Borrowed<'a> {
8426            value
8427        }
8428    }
8429
8430    unsafe impl fidl::encoding::TypeMarker for Nl80211GetMulticastRequest {
8431        type Owned = Self;
8432
8433        #[inline(always)]
8434        fn inline_align(_context: fidl::encoding::Context) -> usize {
8435            8
8436        }
8437
8438        #[inline(always)]
8439        fn inline_size(_context: fidl::encoding::Context) -> usize {
8440            16
8441        }
8442    }
8443
8444    unsafe impl
8445        fidl::encoding::Encode<
8446            Nl80211GetMulticastRequest,
8447            fidl::encoding::DefaultFuchsiaResourceDialect,
8448        > for &mut Nl80211GetMulticastRequest
8449    {
8450        unsafe fn encode(
8451            self,
8452            encoder: &mut fidl::encoding::Encoder<
8453                '_,
8454                fidl::encoding::DefaultFuchsiaResourceDialect,
8455            >,
8456            offset: usize,
8457            mut depth: fidl::encoding::Depth,
8458        ) -> fidl::Result<()> {
8459            encoder.debug_check_bounds::<Nl80211GetMulticastRequest>(offset);
8460            // Vector header
8461            let max_ordinal: u64 = self.max_ordinal_present();
8462            encoder.write_num(max_ordinal, offset);
8463            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8464            // Calling encoder.out_of_line_offset(0) is not allowed.
8465            if max_ordinal == 0 {
8466                return Ok(());
8467            }
8468            depth.increment()?;
8469            let envelope_size = 8;
8470            let bytes_len = max_ordinal as usize * envelope_size;
8471            #[allow(unused_variables)]
8472            let offset = encoder.out_of_line_offset(bytes_len);
8473            let mut _prev_end_offset: usize = 0;
8474            if 1 > max_ordinal {
8475                return Ok(());
8476            }
8477
8478            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8479            // are envelope_size bytes.
8480            let cur_offset: usize = (1 - 1) * envelope_size;
8481
8482            // Zero reserved fields.
8483            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8484
8485            // Safety:
8486            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8487            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8488            //   envelope_size bytes, there is always sufficient room.
8489            fidl::encoding::encode_in_envelope_optional::<
8490                fidl::encoding::BoundedString<32>,
8491                fidl::encoding::DefaultFuchsiaResourceDialect,
8492            >(
8493                self.group.as_ref().map(
8494                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow,
8495                ),
8496                encoder,
8497                offset + cur_offset,
8498                depth,
8499            )?;
8500
8501            _prev_end_offset = cur_offset + envelope_size;
8502            if 2 > max_ordinal {
8503                return Ok(());
8504            }
8505
8506            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8507            // are envelope_size bytes.
8508            let cur_offset: usize = (2 - 1) * envelope_size;
8509
8510            // Zero reserved fields.
8511            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8512
8513            // Safety:
8514            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8515            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8516            //   envelope_size bytes, there is always sufficient room.
8517            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<Nl80211MulticastMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
8518            self.multicast.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<Nl80211MulticastMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
8519            encoder, offset + cur_offset, depth
8520        )?;
8521
8522            _prev_end_offset = cur_offset + envelope_size;
8523
8524            Ok(())
8525        }
8526    }
8527
8528    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8529        for Nl80211GetMulticastRequest
8530    {
8531        #[inline(always)]
8532        fn new_empty() -> Self {
8533            Self::default()
8534        }
8535
8536        unsafe fn decode(
8537            &mut self,
8538            decoder: &mut fidl::encoding::Decoder<
8539                '_,
8540                fidl::encoding::DefaultFuchsiaResourceDialect,
8541            >,
8542            offset: usize,
8543            mut depth: fidl::encoding::Depth,
8544        ) -> fidl::Result<()> {
8545            decoder.debug_check_bounds::<Self>(offset);
8546            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8547                None => return Err(fidl::Error::NotNullable),
8548                Some(len) => len,
8549            };
8550            // Calling decoder.out_of_line_offset(0) is not allowed.
8551            if len == 0 {
8552                return Ok(());
8553            };
8554            depth.increment()?;
8555            let envelope_size = 8;
8556            let bytes_len = len * envelope_size;
8557            let offset = decoder.out_of_line_offset(bytes_len)?;
8558            // Decode the envelope for each type.
8559            let mut _next_ordinal_to_read = 0;
8560            let mut next_offset = offset;
8561            let end_offset = offset + bytes_len;
8562            _next_ordinal_to_read += 1;
8563            if next_offset >= end_offset {
8564                return Ok(());
8565            }
8566
8567            // Decode unknown envelopes for gaps in ordinals.
8568            while _next_ordinal_to_read < 1 {
8569                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8570                _next_ordinal_to_read += 1;
8571                next_offset += envelope_size;
8572            }
8573
8574            let next_out_of_line = decoder.next_out_of_line();
8575            let handles_before = decoder.remaining_handles();
8576            if let Some((inlined, num_bytes, num_handles)) =
8577                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8578            {
8579                let member_inline_size =
8580                    <fidl::encoding::BoundedString<32> as fidl::encoding::TypeMarker>::inline_size(
8581                        decoder.context,
8582                    );
8583                if inlined != (member_inline_size <= 4) {
8584                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8585                }
8586                let inner_offset;
8587                let mut inner_depth = depth.clone();
8588                if inlined {
8589                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8590                    inner_offset = next_offset;
8591                } else {
8592                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8593                    inner_depth.increment()?;
8594                }
8595                let val_ref = self.group.get_or_insert_with(|| {
8596                    fidl::new_empty!(
8597                        fidl::encoding::BoundedString<32>,
8598                        fidl::encoding::DefaultFuchsiaResourceDialect
8599                    )
8600                });
8601                fidl::decode!(
8602                    fidl::encoding::BoundedString<32>,
8603                    fidl::encoding::DefaultFuchsiaResourceDialect,
8604                    val_ref,
8605                    decoder,
8606                    inner_offset,
8607                    inner_depth
8608                )?;
8609                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8610                {
8611                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8612                }
8613                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8614                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8615                }
8616            }
8617
8618            next_offset += envelope_size;
8619            _next_ordinal_to_read += 1;
8620            if next_offset >= end_offset {
8621                return Ok(());
8622            }
8623
8624            // Decode unknown envelopes for gaps in ordinals.
8625            while _next_ordinal_to_read < 2 {
8626                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8627                _next_ordinal_to_read += 1;
8628                next_offset += envelope_size;
8629            }
8630
8631            let next_out_of_line = decoder.next_out_of_line();
8632            let handles_before = decoder.remaining_handles();
8633            if let Some((inlined, num_bytes, num_handles)) =
8634                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8635            {
8636                let member_inline_size = <fidl::encoding::Endpoint<
8637                    fidl::endpoints::ClientEnd<Nl80211MulticastMarker>,
8638                > as fidl::encoding::TypeMarker>::inline_size(
8639                    decoder.context
8640                );
8641                if inlined != (member_inline_size <= 4) {
8642                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8643                }
8644                let inner_offset;
8645                let mut inner_depth = depth.clone();
8646                if inlined {
8647                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8648                    inner_offset = next_offset;
8649                } else {
8650                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8651                    inner_depth.increment()?;
8652                }
8653                let val_ref = self.multicast.get_or_insert_with(|| {
8654                    fidl::new_empty!(
8655                        fidl::encoding::Endpoint<
8656                            fidl::endpoints::ClientEnd<Nl80211MulticastMarker>,
8657                        >,
8658                        fidl::encoding::DefaultFuchsiaResourceDialect
8659                    )
8660                });
8661                fidl::decode!(
8662                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<Nl80211MulticastMarker>>,
8663                    fidl::encoding::DefaultFuchsiaResourceDialect,
8664                    val_ref,
8665                    decoder,
8666                    inner_offset,
8667                    inner_depth
8668                )?;
8669                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8670                {
8671                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8672                }
8673                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8674                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8675                }
8676            }
8677
8678            next_offset += envelope_size;
8679
8680            // Decode the remaining unknown envelopes.
8681            while next_offset < end_offset {
8682                _next_ordinal_to_read += 1;
8683                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8684                next_offset += envelope_size;
8685            }
8686
8687            Ok(())
8688        }
8689    }
8690
8691    impl Nl80211MessageRequest {
8692        #[inline(always)]
8693        fn max_ordinal_present(&self) -> u64 {
8694            if let Some(_) = self.message {
8695                return 1;
8696            }
8697            0
8698        }
8699    }
8700
8701    impl fidl::encoding::ResourceTypeMarker for Nl80211MessageRequest {
8702        type Borrowed<'a> = &'a mut Self;
8703        fn take_or_borrow<'a>(
8704            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8705        ) -> Self::Borrowed<'a> {
8706            value
8707        }
8708    }
8709
8710    unsafe impl fidl::encoding::TypeMarker for Nl80211MessageRequest {
8711        type Owned = Self;
8712
8713        #[inline(always)]
8714        fn inline_align(_context: fidl::encoding::Context) -> usize {
8715            8
8716        }
8717
8718        #[inline(always)]
8719        fn inline_size(_context: fidl::encoding::Context) -> usize {
8720            16
8721        }
8722    }
8723
8724    unsafe impl
8725        fidl::encoding::Encode<Nl80211MessageRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
8726        for &mut Nl80211MessageRequest
8727    {
8728        unsafe fn encode(
8729            self,
8730            encoder: &mut fidl::encoding::Encoder<
8731                '_,
8732                fidl::encoding::DefaultFuchsiaResourceDialect,
8733            >,
8734            offset: usize,
8735            mut depth: fidl::encoding::Depth,
8736        ) -> fidl::Result<()> {
8737            encoder.debug_check_bounds::<Nl80211MessageRequest>(offset);
8738            // Vector header
8739            let max_ordinal: u64 = self.max_ordinal_present();
8740            encoder.write_num(max_ordinal, offset);
8741            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8742            // Calling encoder.out_of_line_offset(0) is not allowed.
8743            if max_ordinal == 0 {
8744                return Ok(());
8745            }
8746            depth.increment()?;
8747            let envelope_size = 8;
8748            let bytes_len = max_ordinal as usize * envelope_size;
8749            #[allow(unused_variables)]
8750            let offset = encoder.out_of_line_offset(bytes_len);
8751            let mut _prev_end_offset: usize = 0;
8752            if 1 > max_ordinal {
8753                return Ok(());
8754            }
8755
8756            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8757            // are envelope_size bytes.
8758            let cur_offset: usize = (1 - 1) * envelope_size;
8759
8760            // Zero reserved fields.
8761            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8762
8763            // Safety:
8764            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8765            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8766            //   envelope_size bytes, there is always sufficient room.
8767            fidl::encoding::encode_in_envelope_optional::<
8768                Nl80211Message,
8769                fidl::encoding::DefaultFuchsiaResourceDialect,
8770            >(
8771                self.message
8772                    .as_ref()
8773                    .map(<Nl80211Message as fidl::encoding::ValueTypeMarker>::borrow),
8774                encoder,
8775                offset + cur_offset,
8776                depth,
8777            )?;
8778
8779            _prev_end_offset = cur_offset + envelope_size;
8780
8781            Ok(())
8782        }
8783    }
8784
8785    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8786        for Nl80211MessageRequest
8787    {
8788        #[inline(always)]
8789        fn new_empty() -> Self {
8790            Self::default()
8791        }
8792
8793        unsafe fn decode(
8794            &mut self,
8795            decoder: &mut fidl::encoding::Decoder<
8796                '_,
8797                fidl::encoding::DefaultFuchsiaResourceDialect,
8798            >,
8799            offset: usize,
8800            mut depth: fidl::encoding::Depth,
8801        ) -> fidl::Result<()> {
8802            decoder.debug_check_bounds::<Self>(offset);
8803            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8804                None => return Err(fidl::Error::NotNullable),
8805                Some(len) => len,
8806            };
8807            // Calling decoder.out_of_line_offset(0) is not allowed.
8808            if len == 0 {
8809                return Ok(());
8810            };
8811            depth.increment()?;
8812            let envelope_size = 8;
8813            let bytes_len = len * envelope_size;
8814            let offset = decoder.out_of_line_offset(bytes_len)?;
8815            // Decode the envelope for each type.
8816            let mut _next_ordinal_to_read = 0;
8817            let mut next_offset = offset;
8818            let end_offset = offset + bytes_len;
8819            _next_ordinal_to_read += 1;
8820            if next_offset >= end_offset {
8821                return Ok(());
8822            }
8823
8824            // Decode unknown envelopes for gaps in ordinals.
8825            while _next_ordinal_to_read < 1 {
8826                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8827                _next_ordinal_to_read += 1;
8828                next_offset += envelope_size;
8829            }
8830
8831            let next_out_of_line = decoder.next_out_of_line();
8832            let handles_before = decoder.remaining_handles();
8833            if let Some((inlined, num_bytes, num_handles)) =
8834                fidl::encoding::decode_envelope_header(decoder, next_offset)?
8835            {
8836                let member_inline_size =
8837                    <Nl80211Message as fidl::encoding::TypeMarker>::inline_size(decoder.context);
8838                if inlined != (member_inline_size <= 4) {
8839                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
8840                }
8841                let inner_offset;
8842                let mut inner_depth = depth.clone();
8843                if inlined {
8844                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
8845                    inner_offset = next_offset;
8846                } else {
8847                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
8848                    inner_depth.increment()?;
8849                }
8850                let val_ref = self.message.get_or_insert_with(|| {
8851                    fidl::new_empty!(Nl80211Message, fidl::encoding::DefaultFuchsiaResourceDialect)
8852                });
8853                fidl::decode!(
8854                    Nl80211Message,
8855                    fidl::encoding::DefaultFuchsiaResourceDialect,
8856                    val_ref,
8857                    decoder,
8858                    inner_offset,
8859                    inner_depth
8860                )?;
8861                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
8862                {
8863                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
8864                }
8865                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
8866                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
8867                }
8868            }
8869
8870            next_offset += envelope_size;
8871
8872            // Decode the remaining unknown envelopes.
8873            while next_offset < end_offset {
8874                _next_ordinal_to_read += 1;
8875                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
8876                next_offset += envelope_size;
8877            }
8878
8879            Ok(())
8880        }
8881    }
8882
8883    impl Nl80211MulticastMessageRequest {
8884        #[inline(always)]
8885        fn max_ordinal_present(&self) -> u64 {
8886            if let Some(_) = self.message {
8887                return 1;
8888            }
8889            0
8890        }
8891    }
8892
8893    impl fidl::encoding::ResourceTypeMarker for Nl80211MulticastMessageRequest {
8894        type Borrowed<'a> = &'a mut Self;
8895        fn take_or_borrow<'a>(
8896            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8897        ) -> Self::Borrowed<'a> {
8898            value
8899        }
8900    }
8901
8902    unsafe impl fidl::encoding::TypeMarker for Nl80211MulticastMessageRequest {
8903        type Owned = Self;
8904
8905        #[inline(always)]
8906        fn inline_align(_context: fidl::encoding::Context) -> usize {
8907            8
8908        }
8909
8910        #[inline(always)]
8911        fn inline_size(_context: fidl::encoding::Context) -> usize {
8912            16
8913        }
8914    }
8915
8916    unsafe impl
8917        fidl::encoding::Encode<
8918            Nl80211MulticastMessageRequest,
8919            fidl::encoding::DefaultFuchsiaResourceDialect,
8920        > for &mut Nl80211MulticastMessageRequest
8921    {
8922        unsafe fn encode(
8923            self,
8924            encoder: &mut fidl::encoding::Encoder<
8925                '_,
8926                fidl::encoding::DefaultFuchsiaResourceDialect,
8927            >,
8928            offset: usize,
8929            mut depth: fidl::encoding::Depth,
8930        ) -> fidl::Result<()> {
8931            encoder.debug_check_bounds::<Nl80211MulticastMessageRequest>(offset);
8932            // Vector header
8933            let max_ordinal: u64 = self.max_ordinal_present();
8934            encoder.write_num(max_ordinal, offset);
8935            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
8936            // Calling encoder.out_of_line_offset(0) is not allowed.
8937            if max_ordinal == 0 {
8938                return Ok(());
8939            }
8940            depth.increment()?;
8941            let envelope_size = 8;
8942            let bytes_len = max_ordinal as usize * envelope_size;
8943            #[allow(unused_variables)]
8944            let offset = encoder.out_of_line_offset(bytes_len);
8945            let mut _prev_end_offset: usize = 0;
8946            if 1 > max_ordinal {
8947                return Ok(());
8948            }
8949
8950            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
8951            // are envelope_size bytes.
8952            let cur_offset: usize = (1 - 1) * envelope_size;
8953
8954            // Zero reserved fields.
8955            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
8956
8957            // Safety:
8958            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
8959            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
8960            //   envelope_size bytes, there is always sufficient room.
8961            fidl::encoding::encode_in_envelope_optional::<
8962                Nl80211Message,
8963                fidl::encoding::DefaultFuchsiaResourceDialect,
8964            >(
8965                self.message
8966                    .as_ref()
8967                    .map(<Nl80211Message as fidl::encoding::ValueTypeMarker>::borrow),
8968                encoder,
8969                offset + cur_offset,
8970                depth,
8971            )?;
8972
8973            _prev_end_offset = cur_offset + envelope_size;
8974
8975            Ok(())
8976        }
8977    }
8978
8979    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8980        for Nl80211MulticastMessageRequest
8981    {
8982        #[inline(always)]
8983        fn new_empty() -> Self {
8984            Self::default()
8985        }
8986
8987        unsafe fn decode(
8988            &mut self,
8989            decoder: &mut fidl::encoding::Decoder<
8990                '_,
8991                fidl::encoding::DefaultFuchsiaResourceDialect,
8992            >,
8993            offset: usize,
8994            mut depth: fidl::encoding::Depth,
8995        ) -> fidl::Result<()> {
8996            decoder.debug_check_bounds::<Self>(offset);
8997            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
8998                None => return Err(fidl::Error::NotNullable),
8999                Some(len) => len,
9000            };
9001            // Calling decoder.out_of_line_offset(0) is not allowed.
9002            if len == 0 {
9003                return Ok(());
9004            };
9005            depth.increment()?;
9006            let envelope_size = 8;
9007            let bytes_len = len * envelope_size;
9008            let offset = decoder.out_of_line_offset(bytes_len)?;
9009            // Decode the envelope for each type.
9010            let mut _next_ordinal_to_read = 0;
9011            let mut next_offset = offset;
9012            let end_offset = offset + bytes_len;
9013            _next_ordinal_to_read += 1;
9014            if next_offset >= end_offset {
9015                return Ok(());
9016            }
9017
9018            // Decode unknown envelopes for gaps in ordinals.
9019            while _next_ordinal_to_read < 1 {
9020                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9021                _next_ordinal_to_read += 1;
9022                next_offset += envelope_size;
9023            }
9024
9025            let next_out_of_line = decoder.next_out_of_line();
9026            let handles_before = decoder.remaining_handles();
9027            if let Some((inlined, num_bytes, num_handles)) =
9028                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9029            {
9030                let member_inline_size =
9031                    <Nl80211Message as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9032                if inlined != (member_inline_size <= 4) {
9033                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9034                }
9035                let inner_offset;
9036                let mut inner_depth = depth.clone();
9037                if inlined {
9038                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9039                    inner_offset = next_offset;
9040                } else {
9041                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9042                    inner_depth.increment()?;
9043                }
9044                let val_ref = self.message.get_or_insert_with(|| {
9045                    fidl::new_empty!(Nl80211Message, fidl::encoding::DefaultFuchsiaResourceDialect)
9046                });
9047                fidl::decode!(
9048                    Nl80211Message,
9049                    fidl::encoding::DefaultFuchsiaResourceDialect,
9050                    val_ref,
9051                    decoder,
9052                    inner_offset,
9053                    inner_depth
9054                )?;
9055                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9056                {
9057                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9058                }
9059                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9060                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9061                }
9062            }
9063
9064            next_offset += envelope_size;
9065
9066            // Decode the remaining unknown envelopes.
9067            while next_offset < end_offset {
9068                _next_ordinal_to_read += 1;
9069                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9070                next_offset += envelope_size;
9071            }
9072
9073            Ok(())
9074        }
9075    }
9076
9077    impl Nl80211MessageResponse {
9078        #[inline(always)]
9079        fn max_ordinal_present(&self) -> u64 {
9080            if let Some(_) = self.responses {
9081                return 1;
9082            }
9083            0
9084        }
9085    }
9086
9087    impl fidl::encoding::ResourceTypeMarker for Nl80211MessageResponse {
9088        type Borrowed<'a> = &'a mut Self;
9089        fn take_or_borrow<'a>(
9090            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9091        ) -> Self::Borrowed<'a> {
9092            value
9093        }
9094    }
9095
9096    unsafe impl fidl::encoding::TypeMarker for Nl80211MessageResponse {
9097        type Owned = Self;
9098
9099        #[inline(always)]
9100        fn inline_align(_context: fidl::encoding::Context) -> usize {
9101            8
9102        }
9103
9104        #[inline(always)]
9105        fn inline_size(_context: fidl::encoding::Context) -> usize {
9106            16
9107        }
9108    }
9109
9110    unsafe impl
9111        fidl::encoding::Encode<
9112            Nl80211MessageResponse,
9113            fidl::encoding::DefaultFuchsiaResourceDialect,
9114        > for &mut Nl80211MessageResponse
9115    {
9116        unsafe fn encode(
9117            self,
9118            encoder: &mut fidl::encoding::Encoder<
9119                '_,
9120                fidl::encoding::DefaultFuchsiaResourceDialect,
9121            >,
9122            offset: usize,
9123            mut depth: fidl::encoding::Depth,
9124        ) -> fidl::Result<()> {
9125            encoder.debug_check_bounds::<Nl80211MessageResponse>(offset);
9126            // Vector header
9127            let max_ordinal: u64 = self.max_ordinal_present();
9128            encoder.write_num(max_ordinal, offset);
9129            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9130            // Calling encoder.out_of_line_offset(0) is not allowed.
9131            if max_ordinal == 0 {
9132                return Ok(());
9133            }
9134            depth.increment()?;
9135            let envelope_size = 8;
9136            let bytes_len = max_ordinal as usize * envelope_size;
9137            #[allow(unused_variables)]
9138            let offset = encoder.out_of_line_offset(bytes_len);
9139            let mut _prev_end_offset: usize = 0;
9140            if 1 > max_ordinal {
9141                return Ok(());
9142            }
9143
9144            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9145            // are envelope_size bytes.
9146            let cur_offset: usize = (1 - 1) * envelope_size;
9147
9148            // Zero reserved fields.
9149            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9150
9151            // Safety:
9152            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9153            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9154            //   envelope_size bytes, there is always sufficient room.
9155            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<Nl80211Message>, fidl::encoding::DefaultFuchsiaResourceDialect>(
9156            self.responses.as_ref().map(<fidl::encoding::UnboundedVector<Nl80211Message> as fidl::encoding::ValueTypeMarker>::borrow),
9157            encoder, offset + cur_offset, depth
9158        )?;
9159
9160            _prev_end_offset = cur_offset + envelope_size;
9161
9162            Ok(())
9163        }
9164    }
9165
9166    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9167        for Nl80211MessageResponse
9168    {
9169        #[inline(always)]
9170        fn new_empty() -> Self {
9171            Self::default()
9172        }
9173
9174        unsafe fn decode(
9175            &mut self,
9176            decoder: &mut fidl::encoding::Decoder<
9177                '_,
9178                fidl::encoding::DefaultFuchsiaResourceDialect,
9179            >,
9180            offset: usize,
9181            mut depth: fidl::encoding::Depth,
9182        ) -> fidl::Result<()> {
9183            decoder.debug_check_bounds::<Self>(offset);
9184            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9185                None => return Err(fidl::Error::NotNullable),
9186                Some(len) => len,
9187            };
9188            // Calling decoder.out_of_line_offset(0) is not allowed.
9189            if len == 0 {
9190                return Ok(());
9191            };
9192            depth.increment()?;
9193            let envelope_size = 8;
9194            let bytes_len = len * envelope_size;
9195            let offset = decoder.out_of_line_offset(bytes_len)?;
9196            // Decode the envelope for each type.
9197            let mut _next_ordinal_to_read = 0;
9198            let mut next_offset = offset;
9199            let end_offset = offset + bytes_len;
9200            _next_ordinal_to_read += 1;
9201            if next_offset >= end_offset {
9202                return Ok(());
9203            }
9204
9205            // Decode unknown envelopes for gaps in ordinals.
9206            while _next_ordinal_to_read < 1 {
9207                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9208                _next_ordinal_to_read += 1;
9209                next_offset += envelope_size;
9210            }
9211
9212            let next_out_of_line = decoder.next_out_of_line();
9213            let handles_before = decoder.remaining_handles();
9214            if let Some((inlined, num_bytes, num_handles)) =
9215                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9216            {
9217                let member_inline_size = <fidl::encoding::UnboundedVector<Nl80211Message> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
9218                if inlined != (member_inline_size <= 4) {
9219                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9220                }
9221                let inner_offset;
9222                let mut inner_depth = depth.clone();
9223                if inlined {
9224                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9225                    inner_offset = next_offset;
9226                } else {
9227                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9228                    inner_depth.increment()?;
9229                }
9230                let val_ref = self.responses.get_or_insert_with(|| {
9231                    fidl::new_empty!(
9232                        fidl::encoding::UnboundedVector<Nl80211Message>,
9233                        fidl::encoding::DefaultFuchsiaResourceDialect
9234                    )
9235                });
9236                fidl::decode!(
9237                    fidl::encoding::UnboundedVector<Nl80211Message>,
9238                    fidl::encoding::DefaultFuchsiaResourceDialect,
9239                    val_ref,
9240                    decoder,
9241                    inner_offset,
9242                    inner_depth
9243                )?;
9244                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9245                {
9246                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9247                }
9248                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9249                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9250                }
9251            }
9252
9253            next_offset += envelope_size;
9254
9255            // Decode the remaining unknown envelopes.
9256            while next_offset < end_offset {
9257                _next_ordinal_to_read += 1;
9258                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9259                next_offset += envelope_size;
9260            }
9261
9262            Ok(())
9263        }
9264    }
9265
9266    impl SupplicantAddStaInterfaceRequest {
9267        #[inline(always)]
9268        fn max_ordinal_present(&self) -> u64 {
9269            if let Some(_) = self.iface_name {
9270                return 2;
9271            }
9272            if let Some(_) = self.iface {
9273                return 1;
9274            }
9275            0
9276        }
9277    }
9278
9279    impl fidl::encoding::ResourceTypeMarker for SupplicantAddStaInterfaceRequest {
9280        type Borrowed<'a> = &'a mut Self;
9281        fn take_or_borrow<'a>(
9282            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9283        ) -> Self::Borrowed<'a> {
9284            value
9285        }
9286    }
9287
9288    unsafe impl fidl::encoding::TypeMarker for SupplicantAddStaInterfaceRequest {
9289        type Owned = Self;
9290
9291        #[inline(always)]
9292        fn inline_align(_context: fidl::encoding::Context) -> usize {
9293            8
9294        }
9295
9296        #[inline(always)]
9297        fn inline_size(_context: fidl::encoding::Context) -> usize {
9298            16
9299        }
9300    }
9301
9302    unsafe impl
9303        fidl::encoding::Encode<
9304            SupplicantAddStaInterfaceRequest,
9305            fidl::encoding::DefaultFuchsiaResourceDialect,
9306        > for &mut SupplicantAddStaInterfaceRequest
9307    {
9308        unsafe fn encode(
9309            self,
9310            encoder: &mut fidl::encoding::Encoder<
9311                '_,
9312                fidl::encoding::DefaultFuchsiaResourceDialect,
9313            >,
9314            offset: usize,
9315            mut depth: fidl::encoding::Depth,
9316        ) -> fidl::Result<()> {
9317            encoder.debug_check_bounds::<SupplicantAddStaInterfaceRequest>(offset);
9318            // Vector header
9319            let max_ordinal: u64 = self.max_ordinal_present();
9320            encoder.write_num(max_ordinal, offset);
9321            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9322            // Calling encoder.out_of_line_offset(0) is not allowed.
9323            if max_ordinal == 0 {
9324                return Ok(());
9325            }
9326            depth.increment()?;
9327            let envelope_size = 8;
9328            let bytes_len = max_ordinal as usize * envelope_size;
9329            #[allow(unused_variables)]
9330            let offset = encoder.out_of_line_offset(bytes_len);
9331            let mut _prev_end_offset: usize = 0;
9332            if 1 > max_ordinal {
9333                return Ok(());
9334            }
9335
9336            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9337            // are envelope_size bytes.
9338            let cur_offset: usize = (1 - 1) * envelope_size;
9339
9340            // Zero reserved fields.
9341            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9342
9343            // Safety:
9344            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9345            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9346            //   envelope_size bytes, there is always sufficient room.
9347            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SupplicantStaIfaceMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
9348            self.iface.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SupplicantStaIfaceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
9349            encoder, offset + cur_offset, depth
9350        )?;
9351
9352            _prev_end_offset = cur_offset + envelope_size;
9353            if 2 > max_ordinal {
9354                return Ok(());
9355            }
9356
9357            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9358            // are envelope_size bytes.
9359            let cur_offset: usize = (2 - 1) * envelope_size;
9360
9361            // Zero reserved fields.
9362            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9363
9364            // Safety:
9365            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9366            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9367            //   envelope_size bytes, there is always sufficient room.
9368            fidl::encoding::encode_in_envelope_optional::<
9369                fidl::encoding::BoundedString<16>,
9370                fidl::encoding::DefaultFuchsiaResourceDialect,
9371            >(
9372                self.iface_name.as_ref().map(
9373                    <fidl::encoding::BoundedString<16> as fidl::encoding::ValueTypeMarker>::borrow,
9374                ),
9375                encoder,
9376                offset + cur_offset,
9377                depth,
9378            )?;
9379
9380            _prev_end_offset = cur_offset + envelope_size;
9381
9382            Ok(())
9383        }
9384    }
9385
9386    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9387        for SupplicantAddStaInterfaceRequest
9388    {
9389        #[inline(always)]
9390        fn new_empty() -> Self {
9391            Self::default()
9392        }
9393
9394        unsafe fn decode(
9395            &mut self,
9396            decoder: &mut fidl::encoding::Decoder<
9397                '_,
9398                fidl::encoding::DefaultFuchsiaResourceDialect,
9399            >,
9400            offset: usize,
9401            mut depth: fidl::encoding::Depth,
9402        ) -> fidl::Result<()> {
9403            decoder.debug_check_bounds::<Self>(offset);
9404            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9405                None => return Err(fidl::Error::NotNullable),
9406                Some(len) => len,
9407            };
9408            // Calling decoder.out_of_line_offset(0) is not allowed.
9409            if len == 0 {
9410                return Ok(());
9411            };
9412            depth.increment()?;
9413            let envelope_size = 8;
9414            let bytes_len = len * envelope_size;
9415            let offset = decoder.out_of_line_offset(bytes_len)?;
9416            // Decode the envelope for each type.
9417            let mut _next_ordinal_to_read = 0;
9418            let mut next_offset = offset;
9419            let end_offset = offset + bytes_len;
9420            _next_ordinal_to_read += 1;
9421            if next_offset >= end_offset {
9422                return Ok(());
9423            }
9424
9425            // Decode unknown envelopes for gaps in ordinals.
9426            while _next_ordinal_to_read < 1 {
9427                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9428                _next_ordinal_to_read += 1;
9429                next_offset += envelope_size;
9430            }
9431
9432            let next_out_of_line = decoder.next_out_of_line();
9433            let handles_before = decoder.remaining_handles();
9434            if let Some((inlined, num_bytes, num_handles)) =
9435                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9436            {
9437                let member_inline_size = <fidl::encoding::Endpoint<
9438                    fidl::endpoints::ServerEnd<SupplicantStaIfaceMarker>,
9439                > as fidl::encoding::TypeMarker>::inline_size(
9440                    decoder.context
9441                );
9442                if inlined != (member_inline_size <= 4) {
9443                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9444                }
9445                let inner_offset;
9446                let mut inner_depth = depth.clone();
9447                if inlined {
9448                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9449                    inner_offset = next_offset;
9450                } else {
9451                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9452                    inner_depth.increment()?;
9453                }
9454                let val_ref = self.iface.get_or_insert_with(|| {
9455                    fidl::new_empty!(
9456                        fidl::encoding::Endpoint<
9457                            fidl::endpoints::ServerEnd<SupplicantStaIfaceMarker>,
9458                        >,
9459                        fidl::encoding::DefaultFuchsiaResourceDialect
9460                    )
9461                });
9462                fidl::decode!(
9463                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SupplicantStaIfaceMarker>>,
9464                    fidl::encoding::DefaultFuchsiaResourceDialect,
9465                    val_ref,
9466                    decoder,
9467                    inner_offset,
9468                    inner_depth
9469                )?;
9470                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9471                {
9472                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9473                }
9474                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9475                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9476                }
9477            }
9478
9479            next_offset += envelope_size;
9480            _next_ordinal_to_read += 1;
9481            if next_offset >= end_offset {
9482                return Ok(());
9483            }
9484
9485            // Decode unknown envelopes for gaps in ordinals.
9486            while _next_ordinal_to_read < 2 {
9487                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9488                _next_ordinal_to_read += 1;
9489                next_offset += envelope_size;
9490            }
9491
9492            let next_out_of_line = decoder.next_out_of_line();
9493            let handles_before = decoder.remaining_handles();
9494            if let Some((inlined, num_bytes, num_handles)) =
9495                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9496            {
9497                let member_inline_size =
9498                    <fidl::encoding::BoundedString<16> as fidl::encoding::TypeMarker>::inline_size(
9499                        decoder.context,
9500                    );
9501                if inlined != (member_inline_size <= 4) {
9502                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9503                }
9504                let inner_offset;
9505                let mut inner_depth = depth.clone();
9506                if inlined {
9507                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9508                    inner_offset = next_offset;
9509                } else {
9510                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9511                    inner_depth.increment()?;
9512                }
9513                let val_ref = self.iface_name.get_or_insert_with(|| {
9514                    fidl::new_empty!(
9515                        fidl::encoding::BoundedString<16>,
9516                        fidl::encoding::DefaultFuchsiaResourceDialect
9517                    )
9518                });
9519                fidl::decode!(
9520                    fidl::encoding::BoundedString<16>,
9521                    fidl::encoding::DefaultFuchsiaResourceDialect,
9522                    val_ref,
9523                    decoder,
9524                    inner_offset,
9525                    inner_depth
9526                )?;
9527                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9528                {
9529                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9530                }
9531                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9532                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9533                }
9534            }
9535
9536            next_offset += envelope_size;
9537
9538            // Decode the remaining unknown envelopes.
9539            while next_offset < end_offset {
9540                _next_ordinal_to_read += 1;
9541                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9542                next_offset += envelope_size;
9543            }
9544
9545            Ok(())
9546        }
9547    }
9548
9549    impl SupplicantStaIfaceAddNetworkRequest {
9550        #[inline(always)]
9551        fn max_ordinal_present(&self) -> u64 {
9552            if let Some(_) = self.network {
9553                return 1;
9554            }
9555            0
9556        }
9557    }
9558
9559    impl fidl::encoding::ResourceTypeMarker for SupplicantStaIfaceAddNetworkRequest {
9560        type Borrowed<'a> = &'a mut Self;
9561        fn take_or_borrow<'a>(
9562            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9563        ) -> Self::Borrowed<'a> {
9564            value
9565        }
9566    }
9567
9568    unsafe impl fidl::encoding::TypeMarker for SupplicantStaIfaceAddNetworkRequest {
9569        type Owned = Self;
9570
9571        #[inline(always)]
9572        fn inline_align(_context: fidl::encoding::Context) -> usize {
9573            8
9574        }
9575
9576        #[inline(always)]
9577        fn inline_size(_context: fidl::encoding::Context) -> usize {
9578            16
9579        }
9580    }
9581
9582    unsafe impl
9583        fidl::encoding::Encode<
9584            SupplicantStaIfaceAddNetworkRequest,
9585            fidl::encoding::DefaultFuchsiaResourceDialect,
9586        > for &mut SupplicantStaIfaceAddNetworkRequest
9587    {
9588        unsafe fn encode(
9589            self,
9590            encoder: &mut fidl::encoding::Encoder<
9591                '_,
9592                fidl::encoding::DefaultFuchsiaResourceDialect,
9593            >,
9594            offset: usize,
9595            mut depth: fidl::encoding::Depth,
9596        ) -> fidl::Result<()> {
9597            encoder.debug_check_bounds::<SupplicantStaIfaceAddNetworkRequest>(offset);
9598            // Vector header
9599            let max_ordinal: u64 = self.max_ordinal_present();
9600            encoder.write_num(max_ordinal, offset);
9601            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9602            // Calling encoder.out_of_line_offset(0) is not allowed.
9603            if max_ordinal == 0 {
9604                return Ok(());
9605            }
9606            depth.increment()?;
9607            let envelope_size = 8;
9608            let bytes_len = max_ordinal as usize * envelope_size;
9609            #[allow(unused_variables)]
9610            let offset = encoder.out_of_line_offset(bytes_len);
9611            let mut _prev_end_offset: usize = 0;
9612            if 1 > max_ordinal {
9613                return Ok(());
9614            }
9615
9616            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9617            // are envelope_size bytes.
9618            let cur_offset: usize = (1 - 1) * envelope_size;
9619
9620            // Zero reserved fields.
9621            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9622
9623            // Safety:
9624            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9625            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9626            //   envelope_size bytes, there is always sufficient room.
9627            fidl::encoding::encode_in_envelope_optional::<
9628                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SupplicantStaNetworkMarker>>,
9629                fidl::encoding::DefaultFuchsiaResourceDialect,
9630            >(
9631                self.network.as_mut().map(
9632                    <fidl::encoding::Endpoint<
9633                        fidl::endpoints::ServerEnd<SupplicantStaNetworkMarker>,
9634                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
9635                ),
9636                encoder,
9637                offset + cur_offset,
9638                depth,
9639            )?;
9640
9641            _prev_end_offset = cur_offset + envelope_size;
9642
9643            Ok(())
9644        }
9645    }
9646
9647    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9648        for SupplicantStaIfaceAddNetworkRequest
9649    {
9650        #[inline(always)]
9651        fn new_empty() -> Self {
9652            Self::default()
9653        }
9654
9655        unsafe fn decode(
9656            &mut self,
9657            decoder: &mut fidl::encoding::Decoder<
9658                '_,
9659                fidl::encoding::DefaultFuchsiaResourceDialect,
9660            >,
9661            offset: usize,
9662            mut depth: fidl::encoding::Depth,
9663        ) -> fidl::Result<()> {
9664            decoder.debug_check_bounds::<Self>(offset);
9665            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9666                None => return Err(fidl::Error::NotNullable),
9667                Some(len) => len,
9668            };
9669            // Calling decoder.out_of_line_offset(0) is not allowed.
9670            if len == 0 {
9671                return Ok(());
9672            };
9673            depth.increment()?;
9674            let envelope_size = 8;
9675            let bytes_len = len * envelope_size;
9676            let offset = decoder.out_of_line_offset(bytes_len)?;
9677            // Decode the envelope for each type.
9678            let mut _next_ordinal_to_read = 0;
9679            let mut next_offset = offset;
9680            let end_offset = offset + bytes_len;
9681            _next_ordinal_to_read += 1;
9682            if next_offset >= end_offset {
9683                return Ok(());
9684            }
9685
9686            // Decode unknown envelopes for gaps in ordinals.
9687            while _next_ordinal_to_read < 1 {
9688                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9689                _next_ordinal_to_read += 1;
9690                next_offset += envelope_size;
9691            }
9692
9693            let next_out_of_line = decoder.next_out_of_line();
9694            let handles_before = decoder.remaining_handles();
9695            if let Some((inlined, num_bytes, num_handles)) =
9696                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9697            {
9698                let member_inline_size = <fidl::encoding::Endpoint<
9699                    fidl::endpoints::ServerEnd<SupplicantStaNetworkMarker>,
9700                > as fidl::encoding::TypeMarker>::inline_size(
9701                    decoder.context
9702                );
9703                if inlined != (member_inline_size <= 4) {
9704                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9705                }
9706                let inner_offset;
9707                let mut inner_depth = depth.clone();
9708                if inlined {
9709                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9710                    inner_offset = next_offset;
9711                } else {
9712                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9713                    inner_depth.increment()?;
9714                }
9715                let val_ref = self.network.get_or_insert_with(|| {
9716                    fidl::new_empty!(
9717                        fidl::encoding::Endpoint<
9718                            fidl::endpoints::ServerEnd<SupplicantStaNetworkMarker>,
9719                        >,
9720                        fidl::encoding::DefaultFuchsiaResourceDialect
9721                    )
9722                });
9723                fidl::decode!(
9724                    fidl::encoding::Endpoint<
9725                        fidl::endpoints::ServerEnd<SupplicantStaNetworkMarker>,
9726                    >,
9727                    fidl::encoding::DefaultFuchsiaResourceDialect,
9728                    val_ref,
9729                    decoder,
9730                    inner_offset,
9731                    inner_depth
9732                )?;
9733                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9734                {
9735                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9736                }
9737                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9738                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9739                }
9740            }
9741
9742            next_offset += envelope_size;
9743
9744            // Decode the remaining unknown envelopes.
9745            while next_offset < end_offset {
9746                _next_ordinal_to_read += 1;
9747                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9748                next_offset += envelope_size;
9749            }
9750
9751            Ok(())
9752        }
9753    }
9754
9755    impl SupplicantStaIfaceRegisterCallbackRequest {
9756        #[inline(always)]
9757        fn max_ordinal_present(&self) -> u64 {
9758            if let Some(_) = self.callback {
9759                return 1;
9760            }
9761            0
9762        }
9763    }
9764
9765    impl fidl::encoding::ResourceTypeMarker for SupplicantStaIfaceRegisterCallbackRequest {
9766        type Borrowed<'a> = &'a mut Self;
9767        fn take_or_borrow<'a>(
9768            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9769        ) -> Self::Borrowed<'a> {
9770            value
9771        }
9772    }
9773
9774    unsafe impl fidl::encoding::TypeMarker for SupplicantStaIfaceRegisterCallbackRequest {
9775        type Owned = Self;
9776
9777        #[inline(always)]
9778        fn inline_align(_context: fidl::encoding::Context) -> usize {
9779            8
9780        }
9781
9782        #[inline(always)]
9783        fn inline_size(_context: fidl::encoding::Context) -> usize {
9784            16
9785        }
9786    }
9787
9788    unsafe impl
9789        fidl::encoding::Encode<
9790            SupplicantStaIfaceRegisterCallbackRequest,
9791            fidl::encoding::DefaultFuchsiaResourceDialect,
9792        > for &mut SupplicantStaIfaceRegisterCallbackRequest
9793    {
9794        unsafe fn encode(
9795            self,
9796            encoder: &mut fidl::encoding::Encoder<
9797                '_,
9798                fidl::encoding::DefaultFuchsiaResourceDialect,
9799            >,
9800            offset: usize,
9801            mut depth: fidl::encoding::Depth,
9802        ) -> fidl::Result<()> {
9803            encoder.debug_check_bounds::<SupplicantStaIfaceRegisterCallbackRequest>(offset);
9804            // Vector header
9805            let max_ordinal: u64 = self.max_ordinal_present();
9806            encoder.write_num(max_ordinal, offset);
9807            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
9808            // Calling encoder.out_of_line_offset(0) is not allowed.
9809            if max_ordinal == 0 {
9810                return Ok(());
9811            }
9812            depth.increment()?;
9813            let envelope_size = 8;
9814            let bytes_len = max_ordinal as usize * envelope_size;
9815            #[allow(unused_variables)]
9816            let offset = encoder.out_of_line_offset(bytes_len);
9817            let mut _prev_end_offset: usize = 0;
9818            if 1 > max_ordinal {
9819                return Ok(());
9820            }
9821
9822            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
9823            // are envelope_size bytes.
9824            let cur_offset: usize = (1 - 1) * envelope_size;
9825
9826            // Zero reserved fields.
9827            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
9828
9829            // Safety:
9830            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
9831            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
9832            //   envelope_size bytes, there is always sufficient room.
9833            fidl::encoding::encode_in_envelope_optional::<
9834                fidl::encoding::Endpoint<
9835                    fidl::endpoints::ClientEnd<SupplicantStaIfaceCallbackMarker>,
9836                >,
9837                fidl::encoding::DefaultFuchsiaResourceDialect,
9838            >(
9839                self.callback.as_mut().map(
9840                    <fidl::encoding::Endpoint<
9841                        fidl::endpoints::ClientEnd<SupplicantStaIfaceCallbackMarker>,
9842                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
9843                ),
9844                encoder,
9845                offset + cur_offset,
9846                depth,
9847            )?;
9848
9849            _prev_end_offset = cur_offset + envelope_size;
9850
9851            Ok(())
9852        }
9853    }
9854
9855    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9856        for SupplicantStaIfaceRegisterCallbackRequest
9857    {
9858        #[inline(always)]
9859        fn new_empty() -> Self {
9860            Self::default()
9861        }
9862
9863        unsafe fn decode(
9864            &mut self,
9865            decoder: &mut fidl::encoding::Decoder<
9866                '_,
9867                fidl::encoding::DefaultFuchsiaResourceDialect,
9868            >,
9869            offset: usize,
9870            mut depth: fidl::encoding::Depth,
9871        ) -> fidl::Result<()> {
9872            decoder.debug_check_bounds::<Self>(offset);
9873            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
9874                None => return Err(fidl::Error::NotNullable),
9875                Some(len) => len,
9876            };
9877            // Calling decoder.out_of_line_offset(0) is not allowed.
9878            if len == 0 {
9879                return Ok(());
9880            };
9881            depth.increment()?;
9882            let envelope_size = 8;
9883            let bytes_len = len * envelope_size;
9884            let offset = decoder.out_of_line_offset(bytes_len)?;
9885            // Decode the envelope for each type.
9886            let mut _next_ordinal_to_read = 0;
9887            let mut next_offset = offset;
9888            let end_offset = offset + bytes_len;
9889            _next_ordinal_to_read += 1;
9890            if next_offset >= end_offset {
9891                return Ok(());
9892            }
9893
9894            // Decode unknown envelopes for gaps in ordinals.
9895            while _next_ordinal_to_read < 1 {
9896                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9897                _next_ordinal_to_read += 1;
9898                next_offset += envelope_size;
9899            }
9900
9901            let next_out_of_line = decoder.next_out_of_line();
9902            let handles_before = decoder.remaining_handles();
9903            if let Some((inlined, num_bytes, num_handles)) =
9904                fidl::encoding::decode_envelope_header(decoder, next_offset)?
9905            {
9906                let member_inline_size = <fidl::encoding::Endpoint<
9907                    fidl::endpoints::ClientEnd<SupplicantStaIfaceCallbackMarker>,
9908                > as fidl::encoding::TypeMarker>::inline_size(
9909                    decoder.context
9910                );
9911                if inlined != (member_inline_size <= 4) {
9912                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
9913                }
9914                let inner_offset;
9915                let mut inner_depth = depth.clone();
9916                if inlined {
9917                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
9918                    inner_offset = next_offset;
9919                } else {
9920                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
9921                    inner_depth.increment()?;
9922                }
9923                let val_ref = self.callback.get_or_insert_with(|| {
9924                    fidl::new_empty!(
9925                        fidl::encoding::Endpoint<
9926                            fidl::endpoints::ClientEnd<SupplicantStaIfaceCallbackMarker>,
9927                        >,
9928                        fidl::encoding::DefaultFuchsiaResourceDialect
9929                    )
9930                });
9931                fidl::decode!(
9932                    fidl::encoding::Endpoint<
9933                        fidl::endpoints::ClientEnd<SupplicantStaIfaceCallbackMarker>,
9934                    >,
9935                    fidl::encoding::DefaultFuchsiaResourceDialect,
9936                    val_ref,
9937                    decoder,
9938                    inner_offset,
9939                    inner_depth
9940                )?;
9941                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
9942                {
9943                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
9944                }
9945                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
9946                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
9947                }
9948            }
9949
9950            next_offset += envelope_size;
9951
9952            // Decode the remaining unknown envelopes.
9953            while next_offset < end_offset {
9954                _next_ordinal_to_read += 1;
9955                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
9956                next_offset += envelope_size;
9957            }
9958
9959            Ok(())
9960        }
9961    }
9962
9963    impl SupplicantStaIfaceSetPowerSaveRequest {
9964        #[inline(always)]
9965        fn max_ordinal_present(&self) -> u64 {
9966            if let Some(_) = self.enable {
9967                return 1;
9968            }
9969            0
9970        }
9971    }
9972
9973    impl fidl::encoding::ResourceTypeMarker for SupplicantStaIfaceSetPowerSaveRequest {
9974        type Borrowed<'a> = &'a mut Self;
9975        fn take_or_borrow<'a>(
9976            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9977        ) -> Self::Borrowed<'a> {
9978            value
9979        }
9980    }
9981
9982    unsafe impl fidl::encoding::TypeMarker for SupplicantStaIfaceSetPowerSaveRequest {
9983        type Owned = Self;
9984
9985        #[inline(always)]
9986        fn inline_align(_context: fidl::encoding::Context) -> usize {
9987            8
9988        }
9989
9990        #[inline(always)]
9991        fn inline_size(_context: fidl::encoding::Context) -> usize {
9992            16
9993        }
9994    }
9995
9996    unsafe impl
9997        fidl::encoding::Encode<
9998            SupplicantStaIfaceSetPowerSaveRequest,
9999            fidl::encoding::DefaultFuchsiaResourceDialect,
10000        > for &mut SupplicantStaIfaceSetPowerSaveRequest
10001    {
10002        unsafe fn encode(
10003            self,
10004            encoder: &mut fidl::encoding::Encoder<
10005                '_,
10006                fidl::encoding::DefaultFuchsiaResourceDialect,
10007            >,
10008            offset: usize,
10009            mut depth: fidl::encoding::Depth,
10010        ) -> fidl::Result<()> {
10011            encoder.debug_check_bounds::<SupplicantStaIfaceSetPowerSaveRequest>(offset);
10012            // Vector header
10013            let max_ordinal: u64 = self.max_ordinal_present();
10014            encoder.write_num(max_ordinal, offset);
10015            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10016            // Calling encoder.out_of_line_offset(0) is not allowed.
10017            if max_ordinal == 0 {
10018                return Ok(());
10019            }
10020            depth.increment()?;
10021            let envelope_size = 8;
10022            let bytes_len = max_ordinal as usize * envelope_size;
10023            #[allow(unused_variables)]
10024            let offset = encoder.out_of_line_offset(bytes_len);
10025            let mut _prev_end_offset: usize = 0;
10026            if 1 > max_ordinal {
10027                return Ok(());
10028            }
10029
10030            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10031            // are envelope_size bytes.
10032            let cur_offset: usize = (1 - 1) * envelope_size;
10033
10034            // Zero reserved fields.
10035            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10036
10037            // Safety:
10038            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10039            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10040            //   envelope_size bytes, there is always sufficient room.
10041            fidl::encoding::encode_in_envelope_optional::<
10042                bool,
10043                fidl::encoding::DefaultFuchsiaResourceDialect,
10044            >(
10045                self.enable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
10046                encoder,
10047                offset + cur_offset,
10048                depth,
10049            )?;
10050
10051            _prev_end_offset = cur_offset + envelope_size;
10052
10053            Ok(())
10054        }
10055    }
10056
10057    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10058        for SupplicantStaIfaceSetPowerSaveRequest
10059    {
10060        #[inline(always)]
10061        fn new_empty() -> Self {
10062            Self::default()
10063        }
10064
10065        unsafe fn decode(
10066            &mut self,
10067            decoder: &mut fidl::encoding::Decoder<
10068                '_,
10069                fidl::encoding::DefaultFuchsiaResourceDialect,
10070            >,
10071            offset: usize,
10072            mut depth: fidl::encoding::Depth,
10073        ) -> fidl::Result<()> {
10074            decoder.debug_check_bounds::<Self>(offset);
10075            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10076                None => return Err(fidl::Error::NotNullable),
10077                Some(len) => len,
10078            };
10079            // Calling decoder.out_of_line_offset(0) is not allowed.
10080            if len == 0 {
10081                return Ok(());
10082            };
10083            depth.increment()?;
10084            let envelope_size = 8;
10085            let bytes_len = len * envelope_size;
10086            let offset = decoder.out_of_line_offset(bytes_len)?;
10087            // Decode the envelope for each type.
10088            let mut _next_ordinal_to_read = 0;
10089            let mut next_offset = offset;
10090            let end_offset = offset + bytes_len;
10091            _next_ordinal_to_read += 1;
10092            if next_offset >= end_offset {
10093                return Ok(());
10094            }
10095
10096            // Decode unknown envelopes for gaps in ordinals.
10097            while _next_ordinal_to_read < 1 {
10098                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10099                _next_ordinal_to_read += 1;
10100                next_offset += envelope_size;
10101            }
10102
10103            let next_out_of_line = decoder.next_out_of_line();
10104            let handles_before = decoder.remaining_handles();
10105            if let Some((inlined, num_bytes, num_handles)) =
10106                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10107            {
10108                let member_inline_size =
10109                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10110                if inlined != (member_inline_size <= 4) {
10111                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10112                }
10113                let inner_offset;
10114                let mut inner_depth = depth.clone();
10115                if inlined {
10116                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10117                    inner_offset = next_offset;
10118                } else {
10119                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10120                    inner_depth.increment()?;
10121                }
10122                let val_ref = self.enable.get_or_insert_with(|| {
10123                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
10124                });
10125                fidl::decode!(
10126                    bool,
10127                    fidl::encoding::DefaultFuchsiaResourceDialect,
10128                    val_ref,
10129                    decoder,
10130                    inner_offset,
10131                    inner_depth
10132                )?;
10133                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10134                {
10135                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10136                }
10137                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10138                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10139                }
10140            }
10141
10142            next_offset += envelope_size;
10143
10144            // Decode the remaining unknown envelopes.
10145            while next_offset < end_offset {
10146                _next_ordinal_to_read += 1;
10147                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10148                next_offset += envelope_size;
10149            }
10150
10151            Ok(())
10152        }
10153    }
10154
10155    impl SupplicantStaIfaceSetStaCountryCodeRequest {
10156        #[inline(always)]
10157        fn max_ordinal_present(&self) -> u64 {
10158            if let Some(_) = self.code {
10159                return 1;
10160            }
10161            0
10162        }
10163    }
10164
10165    impl fidl::encoding::ResourceTypeMarker for SupplicantStaIfaceSetStaCountryCodeRequest {
10166        type Borrowed<'a> = &'a mut Self;
10167        fn take_or_borrow<'a>(
10168            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10169        ) -> Self::Borrowed<'a> {
10170            value
10171        }
10172    }
10173
10174    unsafe impl fidl::encoding::TypeMarker for SupplicantStaIfaceSetStaCountryCodeRequest {
10175        type Owned = Self;
10176
10177        #[inline(always)]
10178        fn inline_align(_context: fidl::encoding::Context) -> usize {
10179            8
10180        }
10181
10182        #[inline(always)]
10183        fn inline_size(_context: fidl::encoding::Context) -> usize {
10184            16
10185        }
10186    }
10187
10188    unsafe impl
10189        fidl::encoding::Encode<
10190            SupplicantStaIfaceSetStaCountryCodeRequest,
10191            fidl::encoding::DefaultFuchsiaResourceDialect,
10192        > for &mut SupplicantStaIfaceSetStaCountryCodeRequest
10193    {
10194        unsafe fn encode(
10195            self,
10196            encoder: &mut fidl::encoding::Encoder<
10197                '_,
10198                fidl::encoding::DefaultFuchsiaResourceDialect,
10199            >,
10200            offset: usize,
10201            mut depth: fidl::encoding::Depth,
10202        ) -> fidl::Result<()> {
10203            encoder.debug_check_bounds::<SupplicantStaIfaceSetStaCountryCodeRequest>(offset);
10204            // Vector header
10205            let max_ordinal: u64 = self.max_ordinal_present();
10206            encoder.write_num(max_ordinal, offset);
10207            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10208            // Calling encoder.out_of_line_offset(0) is not allowed.
10209            if max_ordinal == 0 {
10210                return Ok(());
10211            }
10212            depth.increment()?;
10213            let envelope_size = 8;
10214            let bytes_len = max_ordinal as usize * envelope_size;
10215            #[allow(unused_variables)]
10216            let offset = encoder.out_of_line_offset(bytes_len);
10217            let mut _prev_end_offset: usize = 0;
10218            if 1 > max_ordinal {
10219                return Ok(());
10220            }
10221
10222            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10223            // are envelope_size bytes.
10224            let cur_offset: usize = (1 - 1) * envelope_size;
10225
10226            // Zero reserved fields.
10227            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10228
10229            // Safety:
10230            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10231            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10232            //   envelope_size bytes, there is always sufficient room.
10233            fidl::encoding::encode_in_envelope_optional::<
10234                fidl::encoding::Array<u8, 2>,
10235                fidl::encoding::DefaultFuchsiaResourceDialect,
10236            >(
10237                self.code
10238                    .as_ref()
10239                    .map(<fidl::encoding::Array<u8, 2> as fidl::encoding::ValueTypeMarker>::borrow),
10240                encoder,
10241                offset + cur_offset,
10242                depth,
10243            )?;
10244
10245            _prev_end_offset = cur_offset + envelope_size;
10246
10247            Ok(())
10248        }
10249    }
10250
10251    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10252        for SupplicantStaIfaceSetStaCountryCodeRequest
10253    {
10254        #[inline(always)]
10255        fn new_empty() -> Self {
10256            Self::default()
10257        }
10258
10259        unsafe fn decode(
10260            &mut self,
10261            decoder: &mut fidl::encoding::Decoder<
10262                '_,
10263                fidl::encoding::DefaultFuchsiaResourceDialect,
10264            >,
10265            offset: usize,
10266            mut depth: fidl::encoding::Depth,
10267        ) -> fidl::Result<()> {
10268            decoder.debug_check_bounds::<Self>(offset);
10269            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10270                None => return Err(fidl::Error::NotNullable),
10271                Some(len) => len,
10272            };
10273            // Calling decoder.out_of_line_offset(0) is not allowed.
10274            if len == 0 {
10275                return Ok(());
10276            };
10277            depth.increment()?;
10278            let envelope_size = 8;
10279            let bytes_len = len * envelope_size;
10280            let offset = decoder.out_of_line_offset(bytes_len)?;
10281            // Decode the envelope for each type.
10282            let mut _next_ordinal_to_read = 0;
10283            let mut next_offset = offset;
10284            let end_offset = offset + bytes_len;
10285            _next_ordinal_to_read += 1;
10286            if next_offset >= end_offset {
10287                return Ok(());
10288            }
10289
10290            // Decode unknown envelopes for gaps in ordinals.
10291            while _next_ordinal_to_read < 1 {
10292                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10293                _next_ordinal_to_read += 1;
10294                next_offset += envelope_size;
10295            }
10296
10297            let next_out_of_line = decoder.next_out_of_line();
10298            let handles_before = decoder.remaining_handles();
10299            if let Some((inlined, num_bytes, num_handles)) =
10300                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10301            {
10302                let member_inline_size =
10303                    <fidl::encoding::Array<u8, 2> as fidl::encoding::TypeMarker>::inline_size(
10304                        decoder.context,
10305                    );
10306                if inlined != (member_inline_size <= 4) {
10307                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10308                }
10309                let inner_offset;
10310                let mut inner_depth = depth.clone();
10311                if inlined {
10312                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10313                    inner_offset = next_offset;
10314                } else {
10315                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10316                    inner_depth.increment()?;
10317                }
10318                let val_ref =
10319                self.code.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 2>, fidl::encoding::DefaultFuchsiaResourceDialect));
10320                fidl::decode!(fidl::encoding::Array<u8, 2>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
10321                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10322                {
10323                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10324                }
10325                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10326                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10327                }
10328            }
10329
10330            next_offset += envelope_size;
10331
10332            // Decode the remaining unknown envelopes.
10333            while next_offset < end_offset {
10334                _next_ordinal_to_read += 1;
10335                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10336                next_offset += envelope_size;
10337            }
10338
10339            Ok(())
10340        }
10341    }
10342
10343    impl SupplicantStaIfaceSetSuspendModeEnabledRequest {
10344        #[inline(always)]
10345        fn max_ordinal_present(&self) -> u64 {
10346            if let Some(_) = self.enable {
10347                return 1;
10348            }
10349            0
10350        }
10351    }
10352
10353    impl fidl::encoding::ResourceTypeMarker for SupplicantStaIfaceSetSuspendModeEnabledRequest {
10354        type Borrowed<'a> = &'a mut Self;
10355        fn take_or_borrow<'a>(
10356            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10357        ) -> Self::Borrowed<'a> {
10358            value
10359        }
10360    }
10361
10362    unsafe impl fidl::encoding::TypeMarker for SupplicantStaIfaceSetSuspendModeEnabledRequest {
10363        type Owned = Self;
10364
10365        #[inline(always)]
10366        fn inline_align(_context: fidl::encoding::Context) -> usize {
10367            8
10368        }
10369
10370        #[inline(always)]
10371        fn inline_size(_context: fidl::encoding::Context) -> usize {
10372            16
10373        }
10374    }
10375
10376    unsafe impl
10377        fidl::encoding::Encode<
10378            SupplicantStaIfaceSetSuspendModeEnabledRequest,
10379            fidl::encoding::DefaultFuchsiaResourceDialect,
10380        > for &mut SupplicantStaIfaceSetSuspendModeEnabledRequest
10381    {
10382        unsafe fn encode(
10383            self,
10384            encoder: &mut fidl::encoding::Encoder<
10385                '_,
10386                fidl::encoding::DefaultFuchsiaResourceDialect,
10387            >,
10388            offset: usize,
10389            mut depth: fidl::encoding::Depth,
10390        ) -> fidl::Result<()> {
10391            encoder.debug_check_bounds::<SupplicantStaIfaceSetSuspendModeEnabledRequest>(offset);
10392            // Vector header
10393            let max_ordinal: u64 = self.max_ordinal_present();
10394            encoder.write_num(max_ordinal, offset);
10395            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10396            // Calling encoder.out_of_line_offset(0) is not allowed.
10397            if max_ordinal == 0 {
10398                return Ok(());
10399            }
10400            depth.increment()?;
10401            let envelope_size = 8;
10402            let bytes_len = max_ordinal as usize * envelope_size;
10403            #[allow(unused_variables)]
10404            let offset = encoder.out_of_line_offset(bytes_len);
10405            let mut _prev_end_offset: usize = 0;
10406            if 1 > max_ordinal {
10407                return Ok(());
10408            }
10409
10410            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10411            // are envelope_size bytes.
10412            let cur_offset: usize = (1 - 1) * envelope_size;
10413
10414            // Zero reserved fields.
10415            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10416
10417            // Safety:
10418            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10419            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10420            //   envelope_size bytes, there is always sufficient room.
10421            fidl::encoding::encode_in_envelope_optional::<
10422                bool,
10423                fidl::encoding::DefaultFuchsiaResourceDialect,
10424            >(
10425                self.enable.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
10426                encoder,
10427                offset + cur_offset,
10428                depth,
10429            )?;
10430
10431            _prev_end_offset = cur_offset + envelope_size;
10432
10433            Ok(())
10434        }
10435    }
10436
10437    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10438        for SupplicantStaIfaceSetSuspendModeEnabledRequest
10439    {
10440        #[inline(always)]
10441        fn new_empty() -> Self {
10442            Self::default()
10443        }
10444
10445        unsafe fn decode(
10446            &mut self,
10447            decoder: &mut fidl::encoding::Decoder<
10448                '_,
10449                fidl::encoding::DefaultFuchsiaResourceDialect,
10450            >,
10451            offset: usize,
10452            mut depth: fidl::encoding::Depth,
10453        ) -> fidl::Result<()> {
10454            decoder.debug_check_bounds::<Self>(offset);
10455            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10456                None => return Err(fidl::Error::NotNullable),
10457                Some(len) => len,
10458            };
10459            // Calling decoder.out_of_line_offset(0) is not allowed.
10460            if len == 0 {
10461                return Ok(());
10462            };
10463            depth.increment()?;
10464            let envelope_size = 8;
10465            let bytes_len = len * envelope_size;
10466            let offset = decoder.out_of_line_offset(bytes_len)?;
10467            // Decode the envelope for each type.
10468            let mut _next_ordinal_to_read = 0;
10469            let mut next_offset = offset;
10470            let end_offset = offset + bytes_len;
10471            _next_ordinal_to_read += 1;
10472            if next_offset >= end_offset {
10473                return Ok(());
10474            }
10475
10476            // Decode unknown envelopes for gaps in ordinals.
10477            while _next_ordinal_to_read < 1 {
10478                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10479                _next_ordinal_to_read += 1;
10480                next_offset += envelope_size;
10481            }
10482
10483            let next_out_of_line = decoder.next_out_of_line();
10484            let handles_before = decoder.remaining_handles();
10485            if let Some((inlined, num_bytes, num_handles)) =
10486                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10487            {
10488                let member_inline_size =
10489                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
10490                if inlined != (member_inline_size <= 4) {
10491                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10492                }
10493                let inner_offset;
10494                let mut inner_depth = depth.clone();
10495                if inlined {
10496                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10497                    inner_offset = next_offset;
10498                } else {
10499                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10500                    inner_depth.increment()?;
10501                }
10502                let val_ref = self.enable.get_or_insert_with(|| {
10503                    fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect)
10504                });
10505                fidl::decode!(
10506                    bool,
10507                    fidl::encoding::DefaultFuchsiaResourceDialect,
10508                    val_ref,
10509                    decoder,
10510                    inner_offset,
10511                    inner_depth
10512                )?;
10513                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10514                {
10515                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10516                }
10517                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10518                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10519                }
10520            }
10521
10522            next_offset += envelope_size;
10523
10524            // Decode the remaining unknown envelopes.
10525            while next_offset < end_offset {
10526                _next_ordinal_to_read += 1;
10527                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10528                next_offset += envelope_size;
10529            }
10530
10531            Ok(())
10532        }
10533    }
10534
10535    impl WifiChipCreateStaIfaceRequest {
10536        #[inline(always)]
10537        fn max_ordinal_present(&self) -> u64 {
10538            if let Some(_) = self.iface {
10539                return 1;
10540            }
10541            0
10542        }
10543    }
10544
10545    impl fidl::encoding::ResourceTypeMarker for WifiChipCreateStaIfaceRequest {
10546        type Borrowed<'a> = &'a mut Self;
10547        fn take_or_borrow<'a>(
10548            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10549        ) -> Self::Borrowed<'a> {
10550            value
10551        }
10552    }
10553
10554    unsafe impl fidl::encoding::TypeMarker for WifiChipCreateStaIfaceRequest {
10555        type Owned = Self;
10556
10557        #[inline(always)]
10558        fn inline_align(_context: fidl::encoding::Context) -> usize {
10559            8
10560        }
10561
10562        #[inline(always)]
10563        fn inline_size(_context: fidl::encoding::Context) -> usize {
10564            16
10565        }
10566    }
10567
10568    unsafe impl
10569        fidl::encoding::Encode<
10570            WifiChipCreateStaIfaceRequest,
10571            fidl::encoding::DefaultFuchsiaResourceDialect,
10572        > for &mut WifiChipCreateStaIfaceRequest
10573    {
10574        unsafe fn encode(
10575            self,
10576            encoder: &mut fidl::encoding::Encoder<
10577                '_,
10578                fidl::encoding::DefaultFuchsiaResourceDialect,
10579            >,
10580            offset: usize,
10581            mut depth: fidl::encoding::Depth,
10582        ) -> fidl::Result<()> {
10583            encoder.debug_check_bounds::<WifiChipCreateStaIfaceRequest>(offset);
10584            // Vector header
10585            let max_ordinal: u64 = self.max_ordinal_present();
10586            encoder.write_num(max_ordinal, offset);
10587            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10588            // Calling encoder.out_of_line_offset(0) is not allowed.
10589            if max_ordinal == 0 {
10590                return Ok(());
10591            }
10592            depth.increment()?;
10593            let envelope_size = 8;
10594            let bytes_len = max_ordinal as usize * envelope_size;
10595            #[allow(unused_variables)]
10596            let offset = encoder.out_of_line_offset(bytes_len);
10597            let mut _prev_end_offset: usize = 0;
10598            if 1 > max_ordinal {
10599                return Ok(());
10600            }
10601
10602            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10603            // are envelope_size bytes.
10604            let cur_offset: usize = (1 - 1) * envelope_size;
10605
10606            // Zero reserved fields.
10607            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10608
10609            // Safety:
10610            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10611            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10612            //   envelope_size bytes, there is always sufficient room.
10613            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiStaIfaceMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
10614            self.iface.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiStaIfaceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
10615            encoder, offset + cur_offset, depth
10616        )?;
10617
10618            _prev_end_offset = cur_offset + envelope_size;
10619
10620            Ok(())
10621        }
10622    }
10623
10624    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10625        for WifiChipCreateStaIfaceRequest
10626    {
10627        #[inline(always)]
10628        fn new_empty() -> Self {
10629            Self::default()
10630        }
10631
10632        unsafe fn decode(
10633            &mut self,
10634            decoder: &mut fidl::encoding::Decoder<
10635                '_,
10636                fidl::encoding::DefaultFuchsiaResourceDialect,
10637            >,
10638            offset: usize,
10639            mut depth: fidl::encoding::Depth,
10640        ) -> fidl::Result<()> {
10641            decoder.debug_check_bounds::<Self>(offset);
10642            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10643                None => return Err(fidl::Error::NotNullable),
10644                Some(len) => len,
10645            };
10646            // Calling decoder.out_of_line_offset(0) is not allowed.
10647            if len == 0 {
10648                return Ok(());
10649            };
10650            depth.increment()?;
10651            let envelope_size = 8;
10652            let bytes_len = len * envelope_size;
10653            let offset = decoder.out_of_line_offset(bytes_len)?;
10654            // Decode the envelope for each type.
10655            let mut _next_ordinal_to_read = 0;
10656            let mut next_offset = offset;
10657            let end_offset = offset + bytes_len;
10658            _next_ordinal_to_read += 1;
10659            if next_offset >= end_offset {
10660                return Ok(());
10661            }
10662
10663            // Decode unknown envelopes for gaps in ordinals.
10664            while _next_ordinal_to_read < 1 {
10665                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10666                _next_ordinal_to_read += 1;
10667                next_offset += envelope_size;
10668            }
10669
10670            let next_out_of_line = decoder.next_out_of_line();
10671            let handles_before = decoder.remaining_handles();
10672            if let Some((inlined, num_bytes, num_handles)) =
10673                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10674            {
10675                let member_inline_size = <fidl::encoding::Endpoint<
10676                    fidl::endpoints::ServerEnd<WifiStaIfaceMarker>,
10677                > as fidl::encoding::TypeMarker>::inline_size(
10678                    decoder.context
10679                );
10680                if inlined != (member_inline_size <= 4) {
10681                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10682                }
10683                let inner_offset;
10684                let mut inner_depth = depth.clone();
10685                if inlined {
10686                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10687                    inner_offset = next_offset;
10688                } else {
10689                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10690                    inner_depth.increment()?;
10691                }
10692                let val_ref = self.iface.get_or_insert_with(|| {
10693                    fidl::new_empty!(
10694                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiStaIfaceMarker>>,
10695                        fidl::encoding::DefaultFuchsiaResourceDialect
10696                    )
10697                });
10698                fidl::decode!(
10699                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiStaIfaceMarker>>,
10700                    fidl::encoding::DefaultFuchsiaResourceDialect,
10701                    val_ref,
10702                    decoder,
10703                    inner_offset,
10704                    inner_depth
10705                )?;
10706                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10707                {
10708                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10709                }
10710                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10711                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10712                }
10713            }
10714
10715            next_offset += envelope_size;
10716
10717            // Decode the remaining unknown envelopes.
10718            while next_offset < end_offset {
10719                _next_ordinal_to_read += 1;
10720                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10721                next_offset += envelope_size;
10722            }
10723
10724            Ok(())
10725        }
10726    }
10727
10728    impl WifiChipGetStaIfaceRequest {
10729        #[inline(always)]
10730        fn max_ordinal_present(&self) -> u64 {
10731            if let Some(_) = self.iface {
10732                return 2;
10733            }
10734            if let Some(_) = self.iface_name {
10735                return 1;
10736            }
10737            0
10738        }
10739    }
10740
10741    impl fidl::encoding::ResourceTypeMarker for WifiChipGetStaIfaceRequest {
10742        type Borrowed<'a> = &'a mut Self;
10743        fn take_or_borrow<'a>(
10744            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10745        ) -> Self::Borrowed<'a> {
10746            value
10747        }
10748    }
10749
10750    unsafe impl fidl::encoding::TypeMarker for WifiChipGetStaIfaceRequest {
10751        type Owned = Self;
10752
10753        #[inline(always)]
10754        fn inline_align(_context: fidl::encoding::Context) -> usize {
10755            8
10756        }
10757
10758        #[inline(always)]
10759        fn inline_size(_context: fidl::encoding::Context) -> usize {
10760            16
10761        }
10762    }
10763
10764    unsafe impl
10765        fidl::encoding::Encode<
10766            WifiChipGetStaIfaceRequest,
10767            fidl::encoding::DefaultFuchsiaResourceDialect,
10768        > for &mut WifiChipGetStaIfaceRequest
10769    {
10770        unsafe fn encode(
10771            self,
10772            encoder: &mut fidl::encoding::Encoder<
10773                '_,
10774                fidl::encoding::DefaultFuchsiaResourceDialect,
10775            >,
10776            offset: usize,
10777            mut depth: fidl::encoding::Depth,
10778        ) -> fidl::Result<()> {
10779            encoder.debug_check_bounds::<WifiChipGetStaIfaceRequest>(offset);
10780            // Vector header
10781            let max_ordinal: u64 = self.max_ordinal_present();
10782            encoder.write_num(max_ordinal, offset);
10783            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
10784            // Calling encoder.out_of_line_offset(0) is not allowed.
10785            if max_ordinal == 0 {
10786                return Ok(());
10787            }
10788            depth.increment()?;
10789            let envelope_size = 8;
10790            let bytes_len = max_ordinal as usize * envelope_size;
10791            #[allow(unused_variables)]
10792            let offset = encoder.out_of_line_offset(bytes_len);
10793            let mut _prev_end_offset: usize = 0;
10794            if 1 > max_ordinal {
10795                return Ok(());
10796            }
10797
10798            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10799            // are envelope_size bytes.
10800            let cur_offset: usize = (1 - 1) * envelope_size;
10801
10802            // Zero reserved fields.
10803            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10804
10805            // Safety:
10806            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10807            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10808            //   envelope_size bytes, there is always sufficient room.
10809            fidl::encoding::encode_in_envelope_optional::<
10810                fidl::encoding::BoundedString<16>,
10811                fidl::encoding::DefaultFuchsiaResourceDialect,
10812            >(
10813                self.iface_name.as_ref().map(
10814                    <fidl::encoding::BoundedString<16> as fidl::encoding::ValueTypeMarker>::borrow,
10815                ),
10816                encoder,
10817                offset + cur_offset,
10818                depth,
10819            )?;
10820
10821            _prev_end_offset = cur_offset + envelope_size;
10822            if 2 > max_ordinal {
10823                return Ok(());
10824            }
10825
10826            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
10827            // are envelope_size bytes.
10828            let cur_offset: usize = (2 - 1) * envelope_size;
10829
10830            // Zero reserved fields.
10831            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
10832
10833            // Safety:
10834            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
10835            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
10836            //   envelope_size bytes, there is always sufficient room.
10837            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiStaIfaceMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
10838            self.iface.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiStaIfaceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
10839            encoder, offset + cur_offset, depth
10840        )?;
10841
10842            _prev_end_offset = cur_offset + envelope_size;
10843
10844            Ok(())
10845        }
10846    }
10847
10848    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10849        for WifiChipGetStaIfaceRequest
10850    {
10851        #[inline(always)]
10852        fn new_empty() -> Self {
10853            Self::default()
10854        }
10855
10856        unsafe fn decode(
10857            &mut self,
10858            decoder: &mut fidl::encoding::Decoder<
10859                '_,
10860                fidl::encoding::DefaultFuchsiaResourceDialect,
10861            >,
10862            offset: usize,
10863            mut depth: fidl::encoding::Depth,
10864        ) -> fidl::Result<()> {
10865            decoder.debug_check_bounds::<Self>(offset);
10866            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
10867                None => return Err(fidl::Error::NotNullable),
10868                Some(len) => len,
10869            };
10870            // Calling decoder.out_of_line_offset(0) is not allowed.
10871            if len == 0 {
10872                return Ok(());
10873            };
10874            depth.increment()?;
10875            let envelope_size = 8;
10876            let bytes_len = len * envelope_size;
10877            let offset = decoder.out_of_line_offset(bytes_len)?;
10878            // Decode the envelope for each type.
10879            let mut _next_ordinal_to_read = 0;
10880            let mut next_offset = offset;
10881            let end_offset = offset + bytes_len;
10882            _next_ordinal_to_read += 1;
10883            if next_offset >= end_offset {
10884                return Ok(());
10885            }
10886
10887            // Decode unknown envelopes for gaps in ordinals.
10888            while _next_ordinal_to_read < 1 {
10889                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10890                _next_ordinal_to_read += 1;
10891                next_offset += envelope_size;
10892            }
10893
10894            let next_out_of_line = decoder.next_out_of_line();
10895            let handles_before = decoder.remaining_handles();
10896            if let Some((inlined, num_bytes, num_handles)) =
10897                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10898            {
10899                let member_inline_size =
10900                    <fidl::encoding::BoundedString<16> as fidl::encoding::TypeMarker>::inline_size(
10901                        decoder.context,
10902                    );
10903                if inlined != (member_inline_size <= 4) {
10904                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10905                }
10906                let inner_offset;
10907                let mut inner_depth = depth.clone();
10908                if inlined {
10909                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10910                    inner_offset = next_offset;
10911                } else {
10912                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10913                    inner_depth.increment()?;
10914                }
10915                let val_ref = self.iface_name.get_or_insert_with(|| {
10916                    fidl::new_empty!(
10917                        fidl::encoding::BoundedString<16>,
10918                        fidl::encoding::DefaultFuchsiaResourceDialect
10919                    )
10920                });
10921                fidl::decode!(
10922                    fidl::encoding::BoundedString<16>,
10923                    fidl::encoding::DefaultFuchsiaResourceDialect,
10924                    val_ref,
10925                    decoder,
10926                    inner_offset,
10927                    inner_depth
10928                )?;
10929                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10930                {
10931                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10932                }
10933                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10934                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10935                }
10936            }
10937
10938            next_offset += envelope_size;
10939            _next_ordinal_to_read += 1;
10940            if next_offset >= end_offset {
10941                return Ok(());
10942            }
10943
10944            // Decode unknown envelopes for gaps in ordinals.
10945            while _next_ordinal_to_read < 2 {
10946                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
10947                _next_ordinal_to_read += 1;
10948                next_offset += envelope_size;
10949            }
10950
10951            let next_out_of_line = decoder.next_out_of_line();
10952            let handles_before = decoder.remaining_handles();
10953            if let Some((inlined, num_bytes, num_handles)) =
10954                fidl::encoding::decode_envelope_header(decoder, next_offset)?
10955            {
10956                let member_inline_size = <fidl::encoding::Endpoint<
10957                    fidl::endpoints::ServerEnd<WifiStaIfaceMarker>,
10958                > as fidl::encoding::TypeMarker>::inline_size(
10959                    decoder.context
10960                );
10961                if inlined != (member_inline_size <= 4) {
10962                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
10963                }
10964                let inner_offset;
10965                let mut inner_depth = depth.clone();
10966                if inlined {
10967                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
10968                    inner_offset = next_offset;
10969                } else {
10970                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
10971                    inner_depth.increment()?;
10972                }
10973                let val_ref = self.iface.get_or_insert_with(|| {
10974                    fidl::new_empty!(
10975                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiStaIfaceMarker>>,
10976                        fidl::encoding::DefaultFuchsiaResourceDialect
10977                    )
10978                });
10979                fidl::decode!(
10980                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiStaIfaceMarker>>,
10981                    fidl::encoding::DefaultFuchsiaResourceDialect,
10982                    val_ref,
10983                    decoder,
10984                    inner_offset,
10985                    inner_depth
10986                )?;
10987                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
10988                {
10989                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
10990                }
10991                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
10992                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
10993                }
10994            }
10995
10996            next_offset += envelope_size;
10997
10998            // Decode the remaining unknown envelopes.
10999            while next_offset < end_offset {
11000                _next_ordinal_to_read += 1;
11001                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11002                next_offset += envelope_size;
11003            }
11004
11005            Ok(())
11006        }
11007    }
11008
11009    impl WifiChipRemoveStaIfaceRequest {
11010        #[inline(always)]
11011        fn max_ordinal_present(&self) -> u64 {
11012            if let Some(_) = self.iface_name {
11013                return 1;
11014            }
11015            0
11016        }
11017    }
11018
11019    impl fidl::encoding::ResourceTypeMarker for WifiChipRemoveStaIfaceRequest {
11020        type Borrowed<'a> = &'a mut Self;
11021        fn take_or_borrow<'a>(
11022            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11023        ) -> Self::Borrowed<'a> {
11024            value
11025        }
11026    }
11027
11028    unsafe impl fidl::encoding::TypeMarker for WifiChipRemoveStaIfaceRequest {
11029        type Owned = Self;
11030
11031        #[inline(always)]
11032        fn inline_align(_context: fidl::encoding::Context) -> usize {
11033            8
11034        }
11035
11036        #[inline(always)]
11037        fn inline_size(_context: fidl::encoding::Context) -> usize {
11038            16
11039        }
11040    }
11041
11042    unsafe impl
11043        fidl::encoding::Encode<
11044            WifiChipRemoveStaIfaceRequest,
11045            fidl::encoding::DefaultFuchsiaResourceDialect,
11046        > for &mut WifiChipRemoveStaIfaceRequest
11047    {
11048        unsafe fn encode(
11049            self,
11050            encoder: &mut fidl::encoding::Encoder<
11051                '_,
11052                fidl::encoding::DefaultFuchsiaResourceDialect,
11053            >,
11054            offset: usize,
11055            mut depth: fidl::encoding::Depth,
11056        ) -> fidl::Result<()> {
11057            encoder.debug_check_bounds::<WifiChipRemoveStaIfaceRequest>(offset);
11058            // Vector header
11059            let max_ordinal: u64 = self.max_ordinal_present();
11060            encoder.write_num(max_ordinal, offset);
11061            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11062            // Calling encoder.out_of_line_offset(0) is not allowed.
11063            if max_ordinal == 0 {
11064                return Ok(());
11065            }
11066            depth.increment()?;
11067            let envelope_size = 8;
11068            let bytes_len = max_ordinal as usize * envelope_size;
11069            #[allow(unused_variables)]
11070            let offset = encoder.out_of_line_offset(bytes_len);
11071            let mut _prev_end_offset: usize = 0;
11072            if 1 > max_ordinal {
11073                return Ok(());
11074            }
11075
11076            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11077            // are envelope_size bytes.
11078            let cur_offset: usize = (1 - 1) * envelope_size;
11079
11080            // Zero reserved fields.
11081            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11082
11083            // Safety:
11084            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11085            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11086            //   envelope_size bytes, there is always sufficient room.
11087            fidl::encoding::encode_in_envelope_optional::<
11088                fidl::encoding::BoundedString<16>,
11089                fidl::encoding::DefaultFuchsiaResourceDialect,
11090            >(
11091                self.iface_name.as_ref().map(
11092                    <fidl::encoding::BoundedString<16> as fidl::encoding::ValueTypeMarker>::borrow,
11093                ),
11094                encoder,
11095                offset + cur_offset,
11096                depth,
11097            )?;
11098
11099            _prev_end_offset = cur_offset + envelope_size;
11100
11101            Ok(())
11102        }
11103    }
11104
11105    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11106        for WifiChipRemoveStaIfaceRequest
11107    {
11108        #[inline(always)]
11109        fn new_empty() -> Self {
11110            Self::default()
11111        }
11112
11113        unsafe fn decode(
11114            &mut self,
11115            decoder: &mut fidl::encoding::Decoder<
11116                '_,
11117                fidl::encoding::DefaultFuchsiaResourceDialect,
11118            >,
11119            offset: usize,
11120            mut depth: fidl::encoding::Depth,
11121        ) -> fidl::Result<()> {
11122            decoder.debug_check_bounds::<Self>(offset);
11123            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11124                None => return Err(fidl::Error::NotNullable),
11125                Some(len) => len,
11126            };
11127            // Calling decoder.out_of_line_offset(0) is not allowed.
11128            if len == 0 {
11129                return Ok(());
11130            };
11131            depth.increment()?;
11132            let envelope_size = 8;
11133            let bytes_len = len * envelope_size;
11134            let offset = decoder.out_of_line_offset(bytes_len)?;
11135            // Decode the envelope for each type.
11136            let mut _next_ordinal_to_read = 0;
11137            let mut next_offset = offset;
11138            let end_offset = offset + bytes_len;
11139            _next_ordinal_to_read += 1;
11140            if next_offset >= end_offset {
11141                return Ok(());
11142            }
11143
11144            // Decode unknown envelopes for gaps in ordinals.
11145            while _next_ordinal_to_read < 1 {
11146                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11147                _next_ordinal_to_read += 1;
11148                next_offset += envelope_size;
11149            }
11150
11151            let next_out_of_line = decoder.next_out_of_line();
11152            let handles_before = decoder.remaining_handles();
11153            if let Some((inlined, num_bytes, num_handles)) =
11154                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11155            {
11156                let member_inline_size =
11157                    <fidl::encoding::BoundedString<16> as fidl::encoding::TypeMarker>::inline_size(
11158                        decoder.context,
11159                    );
11160                if inlined != (member_inline_size <= 4) {
11161                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11162                }
11163                let inner_offset;
11164                let mut inner_depth = depth.clone();
11165                if inlined {
11166                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11167                    inner_offset = next_offset;
11168                } else {
11169                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11170                    inner_depth.increment()?;
11171                }
11172                let val_ref = self.iface_name.get_or_insert_with(|| {
11173                    fidl::new_empty!(
11174                        fidl::encoding::BoundedString<16>,
11175                        fidl::encoding::DefaultFuchsiaResourceDialect
11176                    )
11177                });
11178                fidl::decode!(
11179                    fidl::encoding::BoundedString<16>,
11180                    fidl::encoding::DefaultFuchsiaResourceDialect,
11181                    val_ref,
11182                    decoder,
11183                    inner_offset,
11184                    inner_depth
11185                )?;
11186                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11187                {
11188                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11189                }
11190                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11191                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11192                }
11193            }
11194
11195            next_offset += envelope_size;
11196
11197            // Decode the remaining unknown envelopes.
11198            while next_offset < end_offset {
11199                _next_ordinal_to_read += 1;
11200                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11201                next_offset += envelope_size;
11202            }
11203
11204            Ok(())
11205        }
11206    }
11207
11208    impl WifiChipSetCountryCodeRequest {
11209        #[inline(always)]
11210        fn max_ordinal_present(&self) -> u64 {
11211            if let Some(_) = self.code {
11212                return 1;
11213            }
11214            0
11215        }
11216    }
11217
11218    impl fidl::encoding::ResourceTypeMarker for WifiChipSetCountryCodeRequest {
11219        type Borrowed<'a> = &'a mut Self;
11220        fn take_or_borrow<'a>(
11221            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11222        ) -> Self::Borrowed<'a> {
11223            value
11224        }
11225    }
11226
11227    unsafe impl fidl::encoding::TypeMarker for WifiChipSetCountryCodeRequest {
11228        type Owned = Self;
11229
11230        #[inline(always)]
11231        fn inline_align(_context: fidl::encoding::Context) -> usize {
11232            8
11233        }
11234
11235        #[inline(always)]
11236        fn inline_size(_context: fidl::encoding::Context) -> usize {
11237            16
11238        }
11239    }
11240
11241    unsafe impl
11242        fidl::encoding::Encode<
11243            WifiChipSetCountryCodeRequest,
11244            fidl::encoding::DefaultFuchsiaResourceDialect,
11245        > for &mut WifiChipSetCountryCodeRequest
11246    {
11247        unsafe fn encode(
11248            self,
11249            encoder: &mut fidl::encoding::Encoder<
11250                '_,
11251                fidl::encoding::DefaultFuchsiaResourceDialect,
11252            >,
11253            offset: usize,
11254            mut depth: fidl::encoding::Depth,
11255        ) -> fidl::Result<()> {
11256            encoder.debug_check_bounds::<WifiChipSetCountryCodeRequest>(offset);
11257            // Vector header
11258            let max_ordinal: u64 = self.max_ordinal_present();
11259            encoder.write_num(max_ordinal, offset);
11260            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11261            // Calling encoder.out_of_line_offset(0) is not allowed.
11262            if max_ordinal == 0 {
11263                return Ok(());
11264            }
11265            depth.increment()?;
11266            let envelope_size = 8;
11267            let bytes_len = max_ordinal as usize * envelope_size;
11268            #[allow(unused_variables)]
11269            let offset = encoder.out_of_line_offset(bytes_len);
11270            let mut _prev_end_offset: usize = 0;
11271            if 1 > max_ordinal {
11272                return Ok(());
11273            }
11274
11275            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11276            // are envelope_size bytes.
11277            let cur_offset: usize = (1 - 1) * envelope_size;
11278
11279            // Zero reserved fields.
11280            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11281
11282            // Safety:
11283            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11284            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11285            //   envelope_size bytes, there is always sufficient room.
11286            fidl::encoding::encode_in_envelope_optional::<
11287                fidl::encoding::Array<u8, 2>,
11288                fidl::encoding::DefaultFuchsiaResourceDialect,
11289            >(
11290                self.code
11291                    .as_ref()
11292                    .map(<fidl::encoding::Array<u8, 2> as fidl::encoding::ValueTypeMarker>::borrow),
11293                encoder,
11294                offset + cur_offset,
11295                depth,
11296            )?;
11297
11298            _prev_end_offset = cur_offset + envelope_size;
11299
11300            Ok(())
11301        }
11302    }
11303
11304    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11305        for WifiChipSetCountryCodeRequest
11306    {
11307        #[inline(always)]
11308        fn new_empty() -> Self {
11309            Self::default()
11310        }
11311
11312        unsafe fn decode(
11313            &mut self,
11314            decoder: &mut fidl::encoding::Decoder<
11315                '_,
11316                fidl::encoding::DefaultFuchsiaResourceDialect,
11317            >,
11318            offset: usize,
11319            mut depth: fidl::encoding::Depth,
11320        ) -> fidl::Result<()> {
11321            decoder.debug_check_bounds::<Self>(offset);
11322            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11323                None => return Err(fidl::Error::NotNullable),
11324                Some(len) => len,
11325            };
11326            // Calling decoder.out_of_line_offset(0) is not allowed.
11327            if len == 0 {
11328                return Ok(());
11329            };
11330            depth.increment()?;
11331            let envelope_size = 8;
11332            let bytes_len = len * envelope_size;
11333            let offset = decoder.out_of_line_offset(bytes_len)?;
11334            // Decode the envelope for each type.
11335            let mut _next_ordinal_to_read = 0;
11336            let mut next_offset = offset;
11337            let end_offset = offset + bytes_len;
11338            _next_ordinal_to_read += 1;
11339            if next_offset >= end_offset {
11340                return Ok(());
11341            }
11342
11343            // Decode unknown envelopes for gaps in ordinals.
11344            while _next_ordinal_to_read < 1 {
11345                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11346                _next_ordinal_to_read += 1;
11347                next_offset += envelope_size;
11348            }
11349
11350            let next_out_of_line = decoder.next_out_of_line();
11351            let handles_before = decoder.remaining_handles();
11352            if let Some((inlined, num_bytes, num_handles)) =
11353                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11354            {
11355                let member_inline_size =
11356                    <fidl::encoding::Array<u8, 2> as fidl::encoding::TypeMarker>::inline_size(
11357                        decoder.context,
11358                    );
11359                if inlined != (member_inline_size <= 4) {
11360                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11361                }
11362                let inner_offset;
11363                let mut inner_depth = depth.clone();
11364                if inlined {
11365                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11366                    inner_offset = next_offset;
11367                } else {
11368                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11369                    inner_depth.increment()?;
11370                }
11371                let val_ref =
11372                self.code.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 2>, fidl::encoding::DefaultFuchsiaResourceDialect));
11373                fidl::decode!(fidl::encoding::Array<u8, 2>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
11374                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11375                {
11376                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11377                }
11378                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11379                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11380                }
11381            }
11382
11383            next_offset += envelope_size;
11384
11385            // Decode the remaining unknown envelopes.
11386            while next_offset < end_offset {
11387                _next_ordinal_to_read += 1;
11388                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11389                next_offset += envelope_size;
11390            }
11391
11392            Ok(())
11393        }
11394    }
11395
11396    impl WifiGetChipRequest {
11397        #[inline(always)]
11398        fn max_ordinal_present(&self) -> u64 {
11399            if let Some(_) = self.chip {
11400                return 2;
11401            }
11402            if let Some(_) = self.chip_id {
11403                return 1;
11404            }
11405            0
11406        }
11407    }
11408
11409    impl fidl::encoding::ResourceTypeMarker for WifiGetChipRequest {
11410        type Borrowed<'a> = &'a mut Self;
11411        fn take_or_borrow<'a>(
11412            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11413        ) -> Self::Borrowed<'a> {
11414            value
11415        }
11416    }
11417
11418    unsafe impl fidl::encoding::TypeMarker for WifiGetChipRequest {
11419        type Owned = Self;
11420
11421        #[inline(always)]
11422        fn inline_align(_context: fidl::encoding::Context) -> usize {
11423            8
11424        }
11425
11426        #[inline(always)]
11427        fn inline_size(_context: fidl::encoding::Context) -> usize {
11428            16
11429        }
11430    }
11431
11432    unsafe impl
11433        fidl::encoding::Encode<WifiGetChipRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
11434        for &mut WifiGetChipRequest
11435    {
11436        unsafe fn encode(
11437            self,
11438            encoder: &mut fidl::encoding::Encoder<
11439                '_,
11440                fidl::encoding::DefaultFuchsiaResourceDialect,
11441            >,
11442            offset: usize,
11443            mut depth: fidl::encoding::Depth,
11444        ) -> fidl::Result<()> {
11445            encoder.debug_check_bounds::<WifiGetChipRequest>(offset);
11446            // Vector header
11447            let max_ordinal: u64 = self.max_ordinal_present();
11448            encoder.write_num(max_ordinal, offset);
11449            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11450            // Calling encoder.out_of_line_offset(0) is not allowed.
11451            if max_ordinal == 0 {
11452                return Ok(());
11453            }
11454            depth.increment()?;
11455            let envelope_size = 8;
11456            let bytes_len = max_ordinal as usize * envelope_size;
11457            #[allow(unused_variables)]
11458            let offset = encoder.out_of_line_offset(bytes_len);
11459            let mut _prev_end_offset: usize = 0;
11460            if 1 > max_ordinal {
11461                return Ok(());
11462            }
11463
11464            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11465            // are envelope_size bytes.
11466            let cur_offset: usize = (1 - 1) * envelope_size;
11467
11468            // Zero reserved fields.
11469            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11470
11471            // Safety:
11472            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11473            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11474            //   envelope_size bytes, there is always sufficient room.
11475            fidl::encoding::encode_in_envelope_optional::<
11476                u32,
11477                fidl::encoding::DefaultFuchsiaResourceDialect,
11478            >(
11479                self.chip_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
11480                encoder,
11481                offset + cur_offset,
11482                depth,
11483            )?;
11484
11485            _prev_end_offset = cur_offset + envelope_size;
11486            if 2 > max_ordinal {
11487                return Ok(());
11488            }
11489
11490            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11491            // are envelope_size bytes.
11492            let cur_offset: usize = (2 - 1) * envelope_size;
11493
11494            // Zero reserved fields.
11495            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11496
11497            // Safety:
11498            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11499            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11500            //   envelope_size bytes, there is always sufficient room.
11501            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiChipMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
11502            self.chip.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiChipMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
11503            encoder, offset + cur_offset, depth
11504        )?;
11505
11506            _prev_end_offset = cur_offset + envelope_size;
11507
11508            Ok(())
11509        }
11510    }
11511
11512    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11513        for WifiGetChipRequest
11514    {
11515        #[inline(always)]
11516        fn new_empty() -> Self {
11517            Self::default()
11518        }
11519
11520        unsafe fn decode(
11521            &mut self,
11522            decoder: &mut fidl::encoding::Decoder<
11523                '_,
11524                fidl::encoding::DefaultFuchsiaResourceDialect,
11525            >,
11526            offset: usize,
11527            mut depth: fidl::encoding::Depth,
11528        ) -> fidl::Result<()> {
11529            decoder.debug_check_bounds::<Self>(offset);
11530            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11531                None => return Err(fidl::Error::NotNullable),
11532                Some(len) => len,
11533            };
11534            // Calling decoder.out_of_line_offset(0) is not allowed.
11535            if len == 0 {
11536                return Ok(());
11537            };
11538            depth.increment()?;
11539            let envelope_size = 8;
11540            let bytes_len = len * envelope_size;
11541            let offset = decoder.out_of_line_offset(bytes_len)?;
11542            // Decode the envelope for each type.
11543            let mut _next_ordinal_to_read = 0;
11544            let mut next_offset = offset;
11545            let end_offset = offset + bytes_len;
11546            _next_ordinal_to_read += 1;
11547            if next_offset >= end_offset {
11548                return Ok(());
11549            }
11550
11551            // Decode unknown envelopes for gaps in ordinals.
11552            while _next_ordinal_to_read < 1 {
11553                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11554                _next_ordinal_to_read += 1;
11555                next_offset += envelope_size;
11556            }
11557
11558            let next_out_of_line = decoder.next_out_of_line();
11559            let handles_before = decoder.remaining_handles();
11560            if let Some((inlined, num_bytes, num_handles)) =
11561                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11562            {
11563                let member_inline_size =
11564                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
11565                if inlined != (member_inline_size <= 4) {
11566                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11567                }
11568                let inner_offset;
11569                let mut inner_depth = depth.clone();
11570                if inlined {
11571                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11572                    inner_offset = next_offset;
11573                } else {
11574                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11575                    inner_depth.increment()?;
11576                }
11577                let val_ref = self.chip_id.get_or_insert_with(|| {
11578                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
11579                });
11580                fidl::decode!(
11581                    u32,
11582                    fidl::encoding::DefaultFuchsiaResourceDialect,
11583                    val_ref,
11584                    decoder,
11585                    inner_offset,
11586                    inner_depth
11587                )?;
11588                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11589                {
11590                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11591                }
11592                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11593                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11594                }
11595            }
11596
11597            next_offset += envelope_size;
11598            _next_ordinal_to_read += 1;
11599            if next_offset >= end_offset {
11600                return Ok(());
11601            }
11602
11603            // Decode unknown envelopes for gaps in ordinals.
11604            while _next_ordinal_to_read < 2 {
11605                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11606                _next_ordinal_to_read += 1;
11607                next_offset += envelope_size;
11608            }
11609
11610            let next_out_of_line = decoder.next_out_of_line();
11611            let handles_before = decoder.remaining_handles();
11612            if let Some((inlined, num_bytes, num_handles)) =
11613                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11614            {
11615                let member_inline_size = <fidl::encoding::Endpoint<
11616                    fidl::endpoints::ServerEnd<WifiChipMarker>,
11617                > as fidl::encoding::TypeMarker>::inline_size(
11618                    decoder.context
11619                );
11620                if inlined != (member_inline_size <= 4) {
11621                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11622                }
11623                let inner_offset;
11624                let mut inner_depth = depth.clone();
11625                if inlined {
11626                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11627                    inner_offset = next_offset;
11628                } else {
11629                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11630                    inner_depth.increment()?;
11631                }
11632                let val_ref = self.chip.get_or_insert_with(|| {
11633                    fidl::new_empty!(
11634                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiChipMarker>>,
11635                        fidl::encoding::DefaultFuchsiaResourceDialect
11636                    )
11637                });
11638                fidl::decode!(
11639                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiChipMarker>>,
11640                    fidl::encoding::DefaultFuchsiaResourceDialect,
11641                    val_ref,
11642                    decoder,
11643                    inner_offset,
11644                    inner_depth
11645                )?;
11646                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11647                {
11648                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11649                }
11650                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11651                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11652                }
11653            }
11654
11655            next_offset += envelope_size;
11656
11657            // Decode the remaining unknown envelopes.
11658            while next_offset < end_offset {
11659                _next_ordinal_to_read += 1;
11660                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11661                next_offset += envelope_size;
11662            }
11663
11664            Ok(())
11665        }
11666    }
11667
11668    impl WifiRegisterEventCallbackRequest {
11669        #[inline(always)]
11670        fn max_ordinal_present(&self) -> u64 {
11671            if let Some(_) = self.callback {
11672                return 1;
11673            }
11674            0
11675        }
11676    }
11677
11678    impl fidl::encoding::ResourceTypeMarker for WifiRegisterEventCallbackRequest {
11679        type Borrowed<'a> = &'a mut Self;
11680        fn take_or_borrow<'a>(
11681            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11682        ) -> Self::Borrowed<'a> {
11683            value
11684        }
11685    }
11686
11687    unsafe impl fidl::encoding::TypeMarker for WifiRegisterEventCallbackRequest {
11688        type Owned = Self;
11689
11690        #[inline(always)]
11691        fn inline_align(_context: fidl::encoding::Context) -> usize {
11692            8
11693        }
11694
11695        #[inline(always)]
11696        fn inline_size(_context: fidl::encoding::Context) -> usize {
11697            16
11698        }
11699    }
11700
11701    unsafe impl
11702        fidl::encoding::Encode<
11703            WifiRegisterEventCallbackRequest,
11704            fidl::encoding::DefaultFuchsiaResourceDialect,
11705        > for &mut WifiRegisterEventCallbackRequest
11706    {
11707        unsafe fn encode(
11708            self,
11709            encoder: &mut fidl::encoding::Encoder<
11710                '_,
11711                fidl::encoding::DefaultFuchsiaResourceDialect,
11712            >,
11713            offset: usize,
11714            mut depth: fidl::encoding::Depth,
11715        ) -> fidl::Result<()> {
11716            encoder.debug_check_bounds::<WifiRegisterEventCallbackRequest>(offset);
11717            // Vector header
11718            let max_ordinal: u64 = self.max_ordinal_present();
11719            encoder.write_num(max_ordinal, offset);
11720            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11721            // Calling encoder.out_of_line_offset(0) is not allowed.
11722            if max_ordinal == 0 {
11723                return Ok(());
11724            }
11725            depth.increment()?;
11726            let envelope_size = 8;
11727            let bytes_len = max_ordinal as usize * envelope_size;
11728            #[allow(unused_variables)]
11729            let offset = encoder.out_of_line_offset(bytes_len);
11730            let mut _prev_end_offset: usize = 0;
11731            if 1 > max_ordinal {
11732                return Ok(());
11733            }
11734
11735            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11736            // are envelope_size bytes.
11737            let cur_offset: usize = (1 - 1) * envelope_size;
11738
11739            // Zero reserved fields.
11740            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11741
11742            // Safety:
11743            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11744            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11745            //   envelope_size bytes, there is always sufficient room.
11746            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<WifiEventCallbackMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
11747            self.callback.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<WifiEventCallbackMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
11748            encoder, offset + cur_offset, depth
11749        )?;
11750
11751            _prev_end_offset = cur_offset + envelope_size;
11752
11753            Ok(())
11754        }
11755    }
11756
11757    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11758        for WifiRegisterEventCallbackRequest
11759    {
11760        #[inline(always)]
11761        fn new_empty() -> Self {
11762            Self::default()
11763        }
11764
11765        unsafe fn decode(
11766            &mut self,
11767            decoder: &mut fidl::encoding::Decoder<
11768                '_,
11769                fidl::encoding::DefaultFuchsiaResourceDialect,
11770            >,
11771            offset: usize,
11772            mut depth: fidl::encoding::Depth,
11773        ) -> fidl::Result<()> {
11774            decoder.debug_check_bounds::<Self>(offset);
11775            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
11776                None => return Err(fidl::Error::NotNullable),
11777                Some(len) => len,
11778            };
11779            // Calling decoder.out_of_line_offset(0) is not allowed.
11780            if len == 0 {
11781                return Ok(());
11782            };
11783            depth.increment()?;
11784            let envelope_size = 8;
11785            let bytes_len = len * envelope_size;
11786            let offset = decoder.out_of_line_offset(bytes_len)?;
11787            // Decode the envelope for each type.
11788            let mut _next_ordinal_to_read = 0;
11789            let mut next_offset = offset;
11790            let end_offset = offset + bytes_len;
11791            _next_ordinal_to_read += 1;
11792            if next_offset >= end_offset {
11793                return Ok(());
11794            }
11795
11796            // Decode unknown envelopes for gaps in ordinals.
11797            while _next_ordinal_to_read < 1 {
11798                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11799                _next_ordinal_to_read += 1;
11800                next_offset += envelope_size;
11801            }
11802
11803            let next_out_of_line = decoder.next_out_of_line();
11804            let handles_before = decoder.remaining_handles();
11805            if let Some((inlined, num_bytes, num_handles)) =
11806                fidl::encoding::decode_envelope_header(decoder, next_offset)?
11807            {
11808                let member_inline_size = <fidl::encoding::Endpoint<
11809                    fidl::endpoints::ClientEnd<WifiEventCallbackMarker>,
11810                > as fidl::encoding::TypeMarker>::inline_size(
11811                    decoder.context
11812                );
11813                if inlined != (member_inline_size <= 4) {
11814                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
11815                }
11816                let inner_offset;
11817                let mut inner_depth = depth.clone();
11818                if inlined {
11819                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
11820                    inner_offset = next_offset;
11821                } else {
11822                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
11823                    inner_depth.increment()?;
11824                }
11825                let val_ref = self.callback.get_or_insert_with(|| {
11826                    fidl::new_empty!(
11827                        fidl::encoding::Endpoint<
11828                            fidl::endpoints::ClientEnd<WifiEventCallbackMarker>,
11829                        >,
11830                        fidl::encoding::DefaultFuchsiaResourceDialect
11831                    )
11832                });
11833                fidl::decode!(
11834                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<WifiEventCallbackMarker>>,
11835                    fidl::encoding::DefaultFuchsiaResourceDialect,
11836                    val_ref,
11837                    decoder,
11838                    inner_offset,
11839                    inner_depth
11840                )?;
11841                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
11842                {
11843                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
11844                }
11845                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
11846                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
11847                }
11848            }
11849
11850            next_offset += envelope_size;
11851
11852            // Decode the remaining unknown envelopes.
11853            while next_offset < end_offset {
11854                _next_ordinal_to_read += 1;
11855                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
11856                next_offset += envelope_size;
11857            }
11858
11859            Ok(())
11860        }
11861    }
11862
11863    impl WlanixGetNl80211Request {
11864        #[inline(always)]
11865        fn max_ordinal_present(&self) -> u64 {
11866            if let Some(_) = self.nl80211 {
11867                return 1;
11868            }
11869            0
11870        }
11871    }
11872
11873    impl fidl::encoding::ResourceTypeMarker for WlanixGetNl80211Request {
11874        type Borrowed<'a> = &'a mut Self;
11875        fn take_or_borrow<'a>(
11876            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11877        ) -> Self::Borrowed<'a> {
11878            value
11879        }
11880    }
11881
11882    unsafe impl fidl::encoding::TypeMarker for WlanixGetNl80211Request {
11883        type Owned = Self;
11884
11885        #[inline(always)]
11886        fn inline_align(_context: fidl::encoding::Context) -> usize {
11887            8
11888        }
11889
11890        #[inline(always)]
11891        fn inline_size(_context: fidl::encoding::Context) -> usize {
11892            16
11893        }
11894    }
11895
11896    unsafe impl
11897        fidl::encoding::Encode<
11898            WlanixGetNl80211Request,
11899            fidl::encoding::DefaultFuchsiaResourceDialect,
11900        > for &mut WlanixGetNl80211Request
11901    {
11902        unsafe fn encode(
11903            self,
11904            encoder: &mut fidl::encoding::Encoder<
11905                '_,
11906                fidl::encoding::DefaultFuchsiaResourceDialect,
11907            >,
11908            offset: usize,
11909            mut depth: fidl::encoding::Depth,
11910        ) -> fidl::Result<()> {
11911            encoder.debug_check_bounds::<WlanixGetNl80211Request>(offset);
11912            // Vector header
11913            let max_ordinal: u64 = self.max_ordinal_present();
11914            encoder.write_num(max_ordinal, offset);
11915            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
11916            // Calling encoder.out_of_line_offset(0) is not allowed.
11917            if max_ordinal == 0 {
11918                return Ok(());
11919            }
11920            depth.increment()?;
11921            let envelope_size = 8;
11922            let bytes_len = max_ordinal as usize * envelope_size;
11923            #[allow(unused_variables)]
11924            let offset = encoder.out_of_line_offset(bytes_len);
11925            let mut _prev_end_offset: usize = 0;
11926            if 1 > max_ordinal {
11927                return Ok(());
11928            }
11929
11930            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
11931            // are envelope_size bytes.
11932            let cur_offset: usize = (1 - 1) * envelope_size;
11933
11934            // Zero reserved fields.
11935            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
11936
11937            // Safety:
11938            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
11939            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
11940            //   envelope_size bytes, there is always sufficient room.
11941            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<Nl80211Marker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
11942            self.nl80211.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<Nl80211Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
11943            encoder, offset + cur_offset, 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 WlanixGetNl80211Request
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 = <fidl::encoding::Endpoint<
12004                    fidl::endpoints::ServerEnd<Nl80211Marker>,
12005                > as fidl::encoding::TypeMarker>::inline_size(
12006                    decoder.context
12007                );
12008                if inlined != (member_inline_size <= 4) {
12009                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12010                }
12011                let inner_offset;
12012                let mut inner_depth = depth.clone();
12013                if inlined {
12014                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12015                    inner_offset = next_offset;
12016                } else {
12017                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12018                    inner_depth.increment()?;
12019                }
12020                let val_ref = self.nl80211.get_or_insert_with(|| {
12021                    fidl::new_empty!(
12022                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<Nl80211Marker>>,
12023                        fidl::encoding::DefaultFuchsiaResourceDialect
12024                    )
12025                });
12026                fidl::decode!(
12027                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<Nl80211Marker>>,
12028                    fidl::encoding::DefaultFuchsiaResourceDialect,
12029                    val_ref,
12030                    decoder,
12031                    inner_offset,
12032                    inner_depth
12033                )?;
12034                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12035                {
12036                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12037                }
12038                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12039                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12040                }
12041            }
12042
12043            next_offset += envelope_size;
12044
12045            // Decode the remaining unknown envelopes.
12046            while next_offset < end_offset {
12047                _next_ordinal_to_read += 1;
12048                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12049                next_offset += envelope_size;
12050            }
12051
12052            Ok(())
12053        }
12054    }
12055
12056    impl WlanixGetSupplicantRequest {
12057        #[inline(always)]
12058        fn max_ordinal_present(&self) -> u64 {
12059            if let Some(_) = self.supplicant {
12060                return 1;
12061            }
12062            0
12063        }
12064    }
12065
12066    impl fidl::encoding::ResourceTypeMarker for WlanixGetSupplicantRequest {
12067        type Borrowed<'a> = &'a mut Self;
12068        fn take_or_borrow<'a>(
12069            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12070        ) -> Self::Borrowed<'a> {
12071            value
12072        }
12073    }
12074
12075    unsafe impl fidl::encoding::TypeMarker for WlanixGetSupplicantRequest {
12076        type Owned = Self;
12077
12078        #[inline(always)]
12079        fn inline_align(_context: fidl::encoding::Context) -> usize {
12080            8
12081        }
12082
12083        #[inline(always)]
12084        fn inline_size(_context: fidl::encoding::Context) -> usize {
12085            16
12086        }
12087    }
12088
12089    unsafe impl
12090        fidl::encoding::Encode<
12091            WlanixGetSupplicantRequest,
12092            fidl::encoding::DefaultFuchsiaResourceDialect,
12093        > for &mut WlanixGetSupplicantRequest
12094    {
12095        unsafe fn encode(
12096            self,
12097            encoder: &mut fidl::encoding::Encoder<
12098                '_,
12099                fidl::encoding::DefaultFuchsiaResourceDialect,
12100            >,
12101            offset: usize,
12102            mut depth: fidl::encoding::Depth,
12103        ) -> fidl::Result<()> {
12104            encoder.debug_check_bounds::<WlanixGetSupplicantRequest>(offset);
12105            // Vector header
12106            let max_ordinal: u64 = self.max_ordinal_present();
12107            encoder.write_num(max_ordinal, offset);
12108            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12109            // Calling encoder.out_of_line_offset(0) is not allowed.
12110            if max_ordinal == 0 {
12111                return Ok(());
12112            }
12113            depth.increment()?;
12114            let envelope_size = 8;
12115            let bytes_len = max_ordinal as usize * envelope_size;
12116            #[allow(unused_variables)]
12117            let offset = encoder.out_of_line_offset(bytes_len);
12118            let mut _prev_end_offset: usize = 0;
12119            if 1 > max_ordinal {
12120                return Ok(());
12121            }
12122
12123            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12124            // are envelope_size bytes.
12125            let cur_offset: usize = (1 - 1) * envelope_size;
12126
12127            // Zero reserved fields.
12128            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12129
12130            // Safety:
12131            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12132            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12133            //   envelope_size bytes, there is always sufficient room.
12134            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SupplicantMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
12135            self.supplicant.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SupplicantMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12136            encoder, offset + cur_offset, depth
12137        )?;
12138
12139            _prev_end_offset = cur_offset + envelope_size;
12140
12141            Ok(())
12142        }
12143    }
12144
12145    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12146        for WlanixGetSupplicantRequest
12147    {
12148        #[inline(always)]
12149        fn new_empty() -> Self {
12150            Self::default()
12151        }
12152
12153        unsafe fn decode(
12154            &mut self,
12155            decoder: &mut fidl::encoding::Decoder<
12156                '_,
12157                fidl::encoding::DefaultFuchsiaResourceDialect,
12158            >,
12159            offset: usize,
12160            mut depth: fidl::encoding::Depth,
12161        ) -> fidl::Result<()> {
12162            decoder.debug_check_bounds::<Self>(offset);
12163            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12164                None => return Err(fidl::Error::NotNullable),
12165                Some(len) => len,
12166            };
12167            // Calling decoder.out_of_line_offset(0) is not allowed.
12168            if len == 0 {
12169                return Ok(());
12170            };
12171            depth.increment()?;
12172            let envelope_size = 8;
12173            let bytes_len = len * envelope_size;
12174            let offset = decoder.out_of_line_offset(bytes_len)?;
12175            // Decode the envelope for each type.
12176            let mut _next_ordinal_to_read = 0;
12177            let mut next_offset = offset;
12178            let end_offset = offset + bytes_len;
12179            _next_ordinal_to_read += 1;
12180            if next_offset >= end_offset {
12181                return Ok(());
12182            }
12183
12184            // Decode unknown envelopes for gaps in ordinals.
12185            while _next_ordinal_to_read < 1 {
12186                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12187                _next_ordinal_to_read += 1;
12188                next_offset += envelope_size;
12189            }
12190
12191            let next_out_of_line = decoder.next_out_of_line();
12192            let handles_before = decoder.remaining_handles();
12193            if let Some((inlined, num_bytes, num_handles)) =
12194                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12195            {
12196                let member_inline_size = <fidl::encoding::Endpoint<
12197                    fidl::endpoints::ServerEnd<SupplicantMarker>,
12198                > as fidl::encoding::TypeMarker>::inline_size(
12199                    decoder.context
12200                );
12201                if inlined != (member_inline_size <= 4) {
12202                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12203                }
12204                let inner_offset;
12205                let mut inner_depth = depth.clone();
12206                if inlined {
12207                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12208                    inner_offset = next_offset;
12209                } else {
12210                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12211                    inner_depth.increment()?;
12212                }
12213                let val_ref = self.supplicant.get_or_insert_with(|| {
12214                    fidl::new_empty!(
12215                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SupplicantMarker>>,
12216                        fidl::encoding::DefaultFuchsiaResourceDialect
12217                    )
12218                });
12219                fidl::decode!(
12220                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<SupplicantMarker>>,
12221                    fidl::encoding::DefaultFuchsiaResourceDialect,
12222                    val_ref,
12223                    decoder,
12224                    inner_offset,
12225                    inner_depth
12226                )?;
12227                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12228                {
12229                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12230                }
12231                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12232                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12233                }
12234            }
12235
12236            next_offset += envelope_size;
12237
12238            // Decode the remaining unknown envelopes.
12239            while next_offset < end_offset {
12240                _next_ordinal_to_read += 1;
12241                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12242                next_offset += envelope_size;
12243            }
12244
12245            Ok(())
12246        }
12247    }
12248
12249    impl WlanixGetWifiRequest {
12250        #[inline(always)]
12251        fn max_ordinal_present(&self) -> u64 {
12252            if let Some(_) = self.wifi {
12253                return 1;
12254            }
12255            0
12256        }
12257    }
12258
12259    impl fidl::encoding::ResourceTypeMarker for WlanixGetWifiRequest {
12260        type Borrowed<'a> = &'a mut Self;
12261        fn take_or_borrow<'a>(
12262            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
12263        ) -> Self::Borrowed<'a> {
12264            value
12265        }
12266    }
12267
12268    unsafe impl fidl::encoding::TypeMarker for WlanixGetWifiRequest {
12269        type Owned = Self;
12270
12271        #[inline(always)]
12272        fn inline_align(_context: fidl::encoding::Context) -> usize {
12273            8
12274        }
12275
12276        #[inline(always)]
12277        fn inline_size(_context: fidl::encoding::Context) -> usize {
12278            16
12279        }
12280    }
12281
12282    unsafe impl
12283        fidl::encoding::Encode<WlanixGetWifiRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
12284        for &mut WlanixGetWifiRequest
12285    {
12286        unsafe fn encode(
12287            self,
12288            encoder: &mut fidl::encoding::Encoder<
12289                '_,
12290                fidl::encoding::DefaultFuchsiaResourceDialect,
12291            >,
12292            offset: usize,
12293            mut depth: fidl::encoding::Depth,
12294        ) -> fidl::Result<()> {
12295            encoder.debug_check_bounds::<WlanixGetWifiRequest>(offset);
12296            // Vector header
12297            let max_ordinal: u64 = self.max_ordinal_present();
12298            encoder.write_num(max_ordinal, offset);
12299            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12300            // Calling encoder.out_of_line_offset(0) is not allowed.
12301            if max_ordinal == 0 {
12302                return Ok(());
12303            }
12304            depth.increment()?;
12305            let envelope_size = 8;
12306            let bytes_len = max_ordinal as usize * envelope_size;
12307            #[allow(unused_variables)]
12308            let offset = encoder.out_of_line_offset(bytes_len);
12309            let mut _prev_end_offset: usize = 0;
12310            if 1 > max_ordinal {
12311                return Ok(());
12312            }
12313
12314            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12315            // are envelope_size bytes.
12316            let cur_offset: usize = (1 - 1) * envelope_size;
12317
12318            // Zero reserved fields.
12319            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12320
12321            // Safety:
12322            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12323            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12324            //   envelope_size bytes, there is always sufficient room.
12325            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiMarker>>, fidl::encoding::DefaultFuchsiaResourceDialect>(
12326            self.wifi.as_mut().map(<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
12327            encoder, offset + cur_offset, depth
12328        )?;
12329
12330            _prev_end_offset = cur_offset + envelope_size;
12331
12332            Ok(())
12333        }
12334    }
12335
12336    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
12337        for WlanixGetWifiRequest
12338    {
12339        #[inline(always)]
12340        fn new_empty() -> Self {
12341            Self::default()
12342        }
12343
12344        unsafe fn decode(
12345            &mut self,
12346            decoder: &mut fidl::encoding::Decoder<
12347                '_,
12348                fidl::encoding::DefaultFuchsiaResourceDialect,
12349            >,
12350            offset: usize,
12351            mut depth: fidl::encoding::Depth,
12352        ) -> fidl::Result<()> {
12353            decoder.debug_check_bounds::<Self>(offset);
12354            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12355                None => return Err(fidl::Error::NotNullable),
12356                Some(len) => len,
12357            };
12358            // Calling decoder.out_of_line_offset(0) is not allowed.
12359            if len == 0 {
12360                return Ok(());
12361            };
12362            depth.increment()?;
12363            let envelope_size = 8;
12364            let bytes_len = len * envelope_size;
12365            let offset = decoder.out_of_line_offset(bytes_len)?;
12366            // Decode the envelope for each type.
12367            let mut _next_ordinal_to_read = 0;
12368            let mut next_offset = offset;
12369            let end_offset = offset + bytes_len;
12370            _next_ordinal_to_read += 1;
12371            if next_offset >= end_offset {
12372                return Ok(());
12373            }
12374
12375            // Decode unknown envelopes for gaps in ordinals.
12376            while _next_ordinal_to_read < 1 {
12377                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12378                _next_ordinal_to_read += 1;
12379                next_offset += envelope_size;
12380            }
12381
12382            let next_out_of_line = decoder.next_out_of_line();
12383            let handles_before = decoder.remaining_handles();
12384            if let Some((inlined, num_bytes, num_handles)) =
12385                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12386            {
12387                let member_inline_size = <fidl::encoding::Endpoint<
12388                    fidl::endpoints::ServerEnd<WifiMarker>,
12389                > as fidl::encoding::TypeMarker>::inline_size(
12390                    decoder.context
12391                );
12392                if inlined != (member_inline_size <= 4) {
12393                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12394                }
12395                let inner_offset;
12396                let mut inner_depth = depth.clone();
12397                if inlined {
12398                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12399                    inner_offset = next_offset;
12400                } else {
12401                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12402                    inner_depth.increment()?;
12403                }
12404                let val_ref = self.wifi.get_or_insert_with(|| {
12405                    fidl::new_empty!(
12406                        fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiMarker>>,
12407                        fidl::encoding::DefaultFuchsiaResourceDialect
12408                    )
12409                });
12410                fidl::decode!(
12411                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WifiMarker>>,
12412                    fidl::encoding::DefaultFuchsiaResourceDialect,
12413                    val_ref,
12414                    decoder,
12415                    inner_offset,
12416                    inner_depth
12417                )?;
12418                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12419                {
12420                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12421                }
12422                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12423                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12424                }
12425            }
12426
12427            next_offset += envelope_size;
12428
12429            // Decode the remaining unknown envelopes.
12430            while next_offset < end_offset {
12431                _next_ordinal_to_read += 1;
12432                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12433                next_offset += envelope_size;
12434            }
12435
12436            Ok(())
12437        }
12438    }
12439}