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