fidl_fuchsia_wlan_device/
fidl_fuchsia_wlan_device.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_device_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct ConnectorConnectRequest {
16    pub request: fidl::endpoints::ServerEnd<PhyMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ConnectorConnectRequest {}
20
21#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
22pub struct CreateIfaceRequest {
23    pub role: fidl_fuchsia_wlan_common::WlanMacRole,
24    pub mlme_channel: Option<fidl::Channel>,
25    pub init_sta_addr: [u8; 6],
26}
27
28impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for CreateIfaceRequest {}
29
30#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
31pub struct PhyCreateIfaceRequest {
32    pub req: CreateIfaceRequest,
33}
34
35impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for PhyCreateIfaceRequest {}
36
37#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
38pub struct ConnectorMarker;
39
40impl fidl::endpoints::ProtocolMarker for ConnectorMarker {
41    type Proxy = ConnectorProxy;
42    type RequestStream = ConnectorRequestStream;
43    #[cfg(target_os = "fuchsia")]
44    type SynchronousProxy = ConnectorSynchronousProxy;
45
46    const DEBUG_NAME: &'static str = "(anonymous) Connector";
47}
48
49pub trait ConnectorProxyInterface: Send + Sync {
50    fn r#connect(&self, request: fidl::endpoints::ServerEnd<PhyMarker>) -> Result<(), fidl::Error>;
51}
52#[derive(Debug)]
53#[cfg(target_os = "fuchsia")]
54pub struct ConnectorSynchronousProxy {
55    client: fidl::client::sync::Client,
56}
57
58#[cfg(target_os = "fuchsia")]
59impl fidl::endpoints::SynchronousProxy for ConnectorSynchronousProxy {
60    type Proxy = ConnectorProxy;
61    type Protocol = ConnectorMarker;
62
63    fn from_channel(inner: fidl::Channel) -> Self {
64        Self::new(inner)
65    }
66
67    fn into_channel(self) -> fidl::Channel {
68        self.client.into_channel()
69    }
70
71    fn as_channel(&self) -> &fidl::Channel {
72        self.client.as_channel()
73    }
74}
75
76#[cfg(target_os = "fuchsia")]
77impl ConnectorSynchronousProxy {
78    pub fn new(channel: fidl::Channel) -> Self {
79        let protocol_name = <ConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
80        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
81    }
82
83    pub fn into_channel(self) -> fidl::Channel {
84        self.client.into_channel()
85    }
86
87    /// Waits until an event arrives and returns it. It is safe for other
88    /// threads to make concurrent requests while waiting for an event.
89    pub fn wait_for_event(
90        &self,
91        deadline: zx::MonotonicInstant,
92    ) -> Result<ConnectorEvent, fidl::Error> {
93        ConnectorEvent::decode(self.client.wait_for_event(deadline)?)
94    }
95
96    pub fn r#connect(
97        &self,
98        mut request: fidl::endpoints::ServerEnd<PhyMarker>,
99    ) -> Result<(), fidl::Error> {
100        self.client.send::<ConnectorConnectRequest>(
101            (request,),
102            0x2dd039e4ba3a4d26,
103            fidl::encoding::DynamicFlags::empty(),
104        )
105    }
106}
107
108#[derive(Debug, Clone)]
109pub struct ConnectorProxy {
110    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
111}
112
113impl fidl::endpoints::Proxy for ConnectorProxy {
114    type Protocol = ConnectorMarker;
115
116    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
117        Self::new(inner)
118    }
119
120    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
121        self.client.into_channel().map_err(|client| Self { client })
122    }
123
124    fn as_channel(&self) -> &::fidl::AsyncChannel {
125        self.client.as_channel()
126    }
127}
128
129impl ConnectorProxy {
130    /// Create a new Proxy for fuchsia.wlan.device/Connector.
131    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
132        let protocol_name = <ConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
133        Self { client: fidl::client::Client::new(channel, protocol_name) }
134    }
135
136    /// Get a Stream of events from the remote end of the protocol.
137    ///
138    /// # Panics
139    ///
140    /// Panics if the event stream was already taken.
141    pub fn take_event_stream(&self) -> ConnectorEventStream {
142        ConnectorEventStream { event_receiver: self.client.take_event_receiver() }
143    }
144
145    pub fn r#connect(
146        &self,
147        mut request: fidl::endpoints::ServerEnd<PhyMarker>,
148    ) -> Result<(), fidl::Error> {
149        ConnectorProxyInterface::r#connect(self, request)
150    }
151}
152
153impl ConnectorProxyInterface for ConnectorProxy {
154    fn r#connect(
155        &self,
156        mut request: fidl::endpoints::ServerEnd<PhyMarker>,
157    ) -> Result<(), fidl::Error> {
158        self.client.send::<ConnectorConnectRequest>(
159            (request,),
160            0x2dd039e4ba3a4d26,
161            fidl::encoding::DynamicFlags::empty(),
162        )
163    }
164}
165
166pub struct ConnectorEventStream {
167    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
168}
169
170impl std::marker::Unpin for ConnectorEventStream {}
171
172impl futures::stream::FusedStream for ConnectorEventStream {
173    fn is_terminated(&self) -> bool {
174        self.event_receiver.is_terminated()
175    }
176}
177
178impl futures::Stream for ConnectorEventStream {
179    type Item = Result<ConnectorEvent, fidl::Error>;
180
181    fn poll_next(
182        mut self: std::pin::Pin<&mut Self>,
183        cx: &mut std::task::Context<'_>,
184    ) -> std::task::Poll<Option<Self::Item>> {
185        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
186            &mut self.event_receiver,
187            cx
188        )?) {
189            Some(buf) => std::task::Poll::Ready(Some(ConnectorEvent::decode(buf))),
190            None => std::task::Poll::Ready(None),
191        }
192    }
193}
194
195#[derive(Debug)]
196pub enum ConnectorEvent {}
197
198impl ConnectorEvent {
199    /// Decodes a message buffer as a [`ConnectorEvent`].
200    fn decode(
201        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
202    ) -> Result<ConnectorEvent, fidl::Error> {
203        let (bytes, _handles) = buf.split_mut();
204        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
205        debug_assert_eq!(tx_header.tx_id, 0);
206        match tx_header.ordinal {
207            _ => Err(fidl::Error::UnknownOrdinal {
208                ordinal: tx_header.ordinal,
209                protocol_name: <ConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
210            }),
211        }
212    }
213}
214
215/// A Stream of incoming requests for fuchsia.wlan.device/Connector.
216pub struct ConnectorRequestStream {
217    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
218    is_terminated: bool,
219}
220
221impl std::marker::Unpin for ConnectorRequestStream {}
222
223impl futures::stream::FusedStream for ConnectorRequestStream {
224    fn is_terminated(&self) -> bool {
225        self.is_terminated
226    }
227}
228
229impl fidl::endpoints::RequestStream for ConnectorRequestStream {
230    type Protocol = ConnectorMarker;
231    type ControlHandle = ConnectorControlHandle;
232
233    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
234        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
235    }
236
237    fn control_handle(&self) -> Self::ControlHandle {
238        ConnectorControlHandle { inner: self.inner.clone() }
239    }
240
241    fn into_inner(
242        self,
243    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
244    {
245        (self.inner, self.is_terminated)
246    }
247
248    fn from_inner(
249        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
250        is_terminated: bool,
251    ) -> Self {
252        Self { inner, is_terminated }
253    }
254}
255
256impl futures::Stream for ConnectorRequestStream {
257    type Item = Result<ConnectorRequest, fidl::Error>;
258
259    fn poll_next(
260        mut self: std::pin::Pin<&mut Self>,
261        cx: &mut std::task::Context<'_>,
262    ) -> std::task::Poll<Option<Self::Item>> {
263        let this = &mut *self;
264        if this.inner.check_shutdown(cx) {
265            this.is_terminated = true;
266            return std::task::Poll::Ready(None);
267        }
268        if this.is_terminated {
269            panic!("polled ConnectorRequestStream after completion");
270        }
271        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
272            |bytes, handles| {
273                match this.inner.channel().read_etc(cx, bytes, handles) {
274                    std::task::Poll::Ready(Ok(())) => {}
275                    std::task::Poll::Pending => return std::task::Poll::Pending,
276                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
277                        this.is_terminated = true;
278                        return std::task::Poll::Ready(None);
279                    }
280                    std::task::Poll::Ready(Err(e)) => {
281                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
282                            e.into(),
283                        ))))
284                    }
285                }
286
287                // A message has been received from the channel
288                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
289
290                std::task::Poll::Ready(Some(match header.ordinal {
291                    0x2dd039e4ba3a4d26 => {
292                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
293                        let mut req = fidl::new_empty!(
294                            ConnectorConnectRequest,
295                            fidl::encoding::DefaultFuchsiaResourceDialect
296                        );
297                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
298                        let control_handle = ConnectorControlHandle { inner: this.inner.clone() };
299                        Ok(ConnectorRequest::Connect { request: req.request, control_handle })
300                    }
301                    _ => Err(fidl::Error::UnknownOrdinal {
302                        ordinal: header.ordinal,
303                        protocol_name:
304                            <ConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
305                    }),
306                }))
307            },
308        )
309    }
310}
311
312/// This protocol is used to connect to the real Phy protocol underlying this device.
313#[derive(Debug)]
314pub enum ConnectorRequest {
315    Connect {
316        request: fidl::endpoints::ServerEnd<PhyMarker>,
317        control_handle: ConnectorControlHandle,
318    },
319}
320
321impl ConnectorRequest {
322    #[allow(irrefutable_let_patterns)]
323    pub fn into_connect(
324        self,
325    ) -> Option<(fidl::endpoints::ServerEnd<PhyMarker>, ConnectorControlHandle)> {
326        if let ConnectorRequest::Connect { request, control_handle } = self {
327            Some((request, control_handle))
328        } else {
329            None
330        }
331    }
332
333    /// Name of the method defined in FIDL
334    pub fn method_name(&self) -> &'static str {
335        match *self {
336            ConnectorRequest::Connect { .. } => "connect",
337        }
338    }
339}
340
341#[derive(Debug, Clone)]
342pub struct ConnectorControlHandle {
343    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
344}
345
346impl fidl::endpoints::ControlHandle for ConnectorControlHandle {
347    fn shutdown(&self) {
348        self.inner.shutdown()
349    }
350    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
351        self.inner.shutdown_with_epitaph(status)
352    }
353
354    fn is_closed(&self) -> bool {
355        self.inner.channel().is_closed()
356    }
357    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
358        self.inner.channel().on_closed()
359    }
360
361    #[cfg(target_os = "fuchsia")]
362    fn signal_peer(
363        &self,
364        clear_mask: zx::Signals,
365        set_mask: zx::Signals,
366    ) -> Result<(), zx_status::Status> {
367        use fidl::Peered;
368        self.inner.channel().signal_peer(clear_mask, set_mask)
369    }
370}
371
372impl ConnectorControlHandle {}
373
374#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
375pub struct PhyMarker;
376
377impl fidl::endpoints::ProtocolMarker for PhyMarker {
378    type Proxy = PhyProxy;
379    type RequestStream = PhyRequestStream;
380    #[cfg(target_os = "fuchsia")]
381    type SynchronousProxy = PhySynchronousProxy;
382
383    const DEBUG_NAME: &'static str = "(anonymous) Phy";
384}
385pub type PhyGetSupportedMacRolesResult = Result<Vec<fidl_fuchsia_wlan_common::WlanMacRole>, i32>;
386pub type PhyCreateIfaceResult = Result<u16, i32>;
387pub type PhyDestroyIfaceResult = Result<(), i32>;
388pub type PhyGetCountryResult = Result<CountryCode, i32>;
389pub type PhyGetPowerSaveModeResult = Result<fidl_fuchsia_wlan_common::PowerSaveType, i32>;
390
391pub trait PhyProxyInterface: Send + Sync {
392    type GetSupportedMacRolesResponseFut: std::future::Future<Output = Result<PhyGetSupportedMacRolesResult, fidl::Error>>
393        + Send;
394    fn r#get_supported_mac_roles(&self) -> Self::GetSupportedMacRolesResponseFut;
395    type CreateIfaceResponseFut: std::future::Future<Output = Result<PhyCreateIfaceResult, fidl::Error>>
396        + Send;
397    fn r#create_iface(&self, req: CreateIfaceRequest) -> Self::CreateIfaceResponseFut;
398    type DestroyIfaceResponseFut: std::future::Future<Output = Result<PhyDestroyIfaceResult, fidl::Error>>
399        + Send;
400    fn r#destroy_iface(&self, req: &DestroyIfaceRequest) -> Self::DestroyIfaceResponseFut;
401    type SetCountryResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
402    fn r#set_country(&self, req: &CountryCode) -> Self::SetCountryResponseFut;
403    type GetCountryResponseFut: std::future::Future<Output = Result<PhyGetCountryResult, fidl::Error>>
404        + Send;
405    fn r#get_country(&self) -> Self::GetCountryResponseFut;
406    type ClearCountryResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
407    fn r#clear_country(&self) -> Self::ClearCountryResponseFut;
408    type SetPowerSaveModeResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
409    fn r#set_power_save_mode(
410        &self,
411        req: fidl_fuchsia_wlan_common::PowerSaveType,
412    ) -> Self::SetPowerSaveModeResponseFut;
413    type GetPowerSaveModeResponseFut: std::future::Future<Output = Result<PhyGetPowerSaveModeResult, fidl::Error>>
414        + Send;
415    fn r#get_power_save_mode(&self) -> Self::GetPowerSaveModeResponseFut;
416}
417#[derive(Debug)]
418#[cfg(target_os = "fuchsia")]
419pub struct PhySynchronousProxy {
420    client: fidl::client::sync::Client,
421}
422
423#[cfg(target_os = "fuchsia")]
424impl fidl::endpoints::SynchronousProxy for PhySynchronousProxy {
425    type Proxy = PhyProxy;
426    type Protocol = PhyMarker;
427
428    fn from_channel(inner: fidl::Channel) -> Self {
429        Self::new(inner)
430    }
431
432    fn into_channel(self) -> fidl::Channel {
433        self.client.into_channel()
434    }
435
436    fn as_channel(&self) -> &fidl::Channel {
437        self.client.as_channel()
438    }
439}
440
441#[cfg(target_os = "fuchsia")]
442impl PhySynchronousProxy {
443    pub fn new(channel: fidl::Channel) -> Self {
444        let protocol_name = <PhyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
445        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
446    }
447
448    pub fn into_channel(self) -> fidl::Channel {
449        self.client.into_channel()
450    }
451
452    /// Waits until an event arrives and returns it. It is safe for other
453    /// threads to make concurrent requests while waiting for an event.
454    pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<PhyEvent, fidl::Error> {
455        PhyEvent::decode(self.client.wait_for_event(deadline)?)
456    }
457
458    pub fn r#get_supported_mac_roles(
459        &self,
460        ___deadline: zx::MonotonicInstant,
461    ) -> Result<PhyGetSupportedMacRolesResult, fidl::Error> {
462        let _response = self.client.send_query::<
463            fidl::encoding::EmptyPayload,
464            fidl::encoding::ResultType<PhyGetSupportedMacRolesResponse, i32>,
465        >(
466            (),
467            0x18f6b9091aa8a44,
468            fidl::encoding::DynamicFlags::empty(),
469            ___deadline,
470        )?;
471        Ok(_response.map(|x| x.supported_mac_roles))
472    }
473
474    pub fn r#create_iface(
475        &self,
476        mut req: CreateIfaceRequest,
477        ___deadline: zx::MonotonicInstant,
478    ) -> Result<PhyCreateIfaceResult, fidl::Error> {
479        let _response = self.client.send_query::<
480            PhyCreateIfaceRequest,
481            fidl::encoding::ResultType<PhyCreateIfaceResponse, i32>,
482        >(
483            (&mut req,),
484            0x665940c7aa4b9785,
485            fidl::encoding::DynamicFlags::empty(),
486            ___deadline,
487        )?;
488        Ok(_response.map(|x| x.iface_id))
489    }
490
491    pub fn r#destroy_iface(
492        &self,
493        mut req: &DestroyIfaceRequest,
494        ___deadline: zx::MonotonicInstant,
495    ) -> Result<PhyDestroyIfaceResult, fidl::Error> {
496        let _response = self.client.send_query::<
497            PhyDestroyIfaceRequest,
498            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
499        >(
500            (req,),
501            0x75a3048ae01942e8,
502            fidl::encoding::DynamicFlags::empty(),
503            ___deadline,
504        )?;
505        Ok(_response.map(|x| x))
506    }
507
508    pub fn r#set_country(
509        &self,
510        mut req: &CountryCode,
511        ___deadline: zx::MonotonicInstant,
512    ) -> Result<i32, fidl::Error> {
513        let _response = self.client.send_query::<PhySetCountryRequest, PhySetCountryResponse>(
514            (req,),
515            0x1367e9997ba00806,
516            fidl::encoding::DynamicFlags::empty(),
517            ___deadline,
518        )?;
519        Ok(_response.status)
520    }
521
522    pub fn r#get_country(
523        &self,
524        ___deadline: zx::MonotonicInstant,
525    ) -> Result<PhyGetCountryResult, fidl::Error> {
526        let _response = self.client.send_query::<
527            fidl::encoding::EmptyPayload,
528            fidl::encoding::ResultType<PhyGetCountryResponse, i32>,
529        >(
530            (),
531            0x3ed3281ce6feab3e,
532            fidl::encoding::DynamicFlags::empty(),
533            ___deadline,
534        )?;
535        Ok(_response.map(|x| x.resp))
536    }
537
538    pub fn r#clear_country(&self, ___deadline: zx::MonotonicInstant) -> Result<i32, fidl::Error> {
539        let _response =
540            self.client.send_query::<fidl::encoding::EmptyPayload, PhyClearCountryResponse>(
541                (),
542                0x4ea9b83a9c494c95,
543                fidl::encoding::DynamicFlags::empty(),
544                ___deadline,
545            )?;
546        Ok(_response.status)
547    }
548
549    pub fn r#set_power_save_mode(
550        &self,
551        mut req: fidl_fuchsia_wlan_common::PowerSaveType,
552        ___deadline: zx::MonotonicInstant,
553    ) -> Result<i32, fidl::Error> {
554        let _response =
555            self.client.send_query::<PhySetPowerSaveModeRequest, PhySetPowerSaveModeResponse>(
556                (req,),
557                0x56be34b2f3abe17f,
558                fidl::encoding::DynamicFlags::empty(),
559                ___deadline,
560            )?;
561        Ok(_response.status)
562    }
563
564    pub fn r#get_power_save_mode(
565        &self,
566        ___deadline: zx::MonotonicInstant,
567    ) -> Result<PhyGetPowerSaveModeResult, fidl::Error> {
568        let _response = self.client.send_query::<
569            fidl::encoding::EmptyPayload,
570            fidl::encoding::ResultType<PhyGetPowerSaveModeResponse, i32>,
571        >(
572            (),
573            0x3f7019c3672bc798,
574            fidl::encoding::DynamicFlags::empty(),
575            ___deadline,
576        )?;
577        Ok(_response.map(|x| x.resp))
578    }
579}
580
581#[derive(Debug, Clone)]
582pub struct PhyProxy {
583    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
584}
585
586impl fidl::endpoints::Proxy for PhyProxy {
587    type Protocol = PhyMarker;
588
589    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
590        Self::new(inner)
591    }
592
593    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
594        self.client.into_channel().map_err(|client| Self { client })
595    }
596
597    fn as_channel(&self) -> &::fidl::AsyncChannel {
598        self.client.as_channel()
599    }
600}
601
602impl PhyProxy {
603    /// Create a new Proxy for fuchsia.wlan.device/Phy.
604    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
605        let protocol_name = <PhyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
606        Self { client: fidl::client::Client::new(channel, protocol_name) }
607    }
608
609    /// Get a Stream of events from the remote end of the protocol.
610    ///
611    /// # Panics
612    ///
613    /// Panics if the event stream was already taken.
614    pub fn take_event_stream(&self) -> PhyEventStream {
615        PhyEventStream { event_receiver: self.client.take_event_receiver() }
616    }
617
618    pub fn r#get_supported_mac_roles(
619        &self,
620    ) -> fidl::client::QueryResponseFut<
621        PhyGetSupportedMacRolesResult,
622        fidl::encoding::DefaultFuchsiaResourceDialect,
623    > {
624        PhyProxyInterface::r#get_supported_mac_roles(self)
625    }
626
627    pub fn r#create_iface(
628        &self,
629        mut req: CreateIfaceRequest,
630    ) -> fidl::client::QueryResponseFut<
631        PhyCreateIfaceResult,
632        fidl::encoding::DefaultFuchsiaResourceDialect,
633    > {
634        PhyProxyInterface::r#create_iface(self, req)
635    }
636
637    pub fn r#destroy_iface(
638        &self,
639        mut req: &DestroyIfaceRequest,
640    ) -> fidl::client::QueryResponseFut<
641        PhyDestroyIfaceResult,
642        fidl::encoding::DefaultFuchsiaResourceDialect,
643    > {
644        PhyProxyInterface::r#destroy_iface(self, req)
645    }
646
647    pub fn r#set_country(
648        &self,
649        mut req: &CountryCode,
650    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
651        PhyProxyInterface::r#set_country(self, req)
652    }
653
654    pub fn r#get_country(
655        &self,
656    ) -> fidl::client::QueryResponseFut<
657        PhyGetCountryResult,
658        fidl::encoding::DefaultFuchsiaResourceDialect,
659    > {
660        PhyProxyInterface::r#get_country(self)
661    }
662
663    pub fn r#clear_country(
664        &self,
665    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
666        PhyProxyInterface::r#clear_country(self)
667    }
668
669    pub fn r#set_power_save_mode(
670        &self,
671        mut req: fidl_fuchsia_wlan_common::PowerSaveType,
672    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
673        PhyProxyInterface::r#set_power_save_mode(self, req)
674    }
675
676    pub fn r#get_power_save_mode(
677        &self,
678    ) -> fidl::client::QueryResponseFut<
679        PhyGetPowerSaveModeResult,
680        fidl::encoding::DefaultFuchsiaResourceDialect,
681    > {
682        PhyProxyInterface::r#get_power_save_mode(self)
683    }
684}
685
686impl PhyProxyInterface for PhyProxy {
687    type GetSupportedMacRolesResponseFut = fidl::client::QueryResponseFut<
688        PhyGetSupportedMacRolesResult,
689        fidl::encoding::DefaultFuchsiaResourceDialect,
690    >;
691    fn r#get_supported_mac_roles(&self) -> Self::GetSupportedMacRolesResponseFut {
692        fn _decode(
693            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
694        ) -> Result<PhyGetSupportedMacRolesResult, fidl::Error> {
695            let _response = fidl::client::decode_transaction_body::<
696                fidl::encoding::ResultType<PhyGetSupportedMacRolesResponse, i32>,
697                fidl::encoding::DefaultFuchsiaResourceDialect,
698                0x18f6b9091aa8a44,
699            >(_buf?)?;
700            Ok(_response.map(|x| x.supported_mac_roles))
701        }
702        self.client
703            .send_query_and_decode::<fidl::encoding::EmptyPayload, PhyGetSupportedMacRolesResult>(
704                (),
705                0x18f6b9091aa8a44,
706                fidl::encoding::DynamicFlags::empty(),
707                _decode,
708            )
709    }
710
711    type CreateIfaceResponseFut = fidl::client::QueryResponseFut<
712        PhyCreateIfaceResult,
713        fidl::encoding::DefaultFuchsiaResourceDialect,
714    >;
715    fn r#create_iface(&self, mut req: CreateIfaceRequest) -> Self::CreateIfaceResponseFut {
716        fn _decode(
717            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
718        ) -> Result<PhyCreateIfaceResult, fidl::Error> {
719            let _response = fidl::client::decode_transaction_body::<
720                fidl::encoding::ResultType<PhyCreateIfaceResponse, i32>,
721                fidl::encoding::DefaultFuchsiaResourceDialect,
722                0x665940c7aa4b9785,
723            >(_buf?)?;
724            Ok(_response.map(|x| x.iface_id))
725        }
726        self.client.send_query_and_decode::<PhyCreateIfaceRequest, PhyCreateIfaceResult>(
727            (&mut req,),
728            0x665940c7aa4b9785,
729            fidl::encoding::DynamicFlags::empty(),
730            _decode,
731        )
732    }
733
734    type DestroyIfaceResponseFut = fidl::client::QueryResponseFut<
735        PhyDestroyIfaceResult,
736        fidl::encoding::DefaultFuchsiaResourceDialect,
737    >;
738    fn r#destroy_iface(&self, mut req: &DestroyIfaceRequest) -> Self::DestroyIfaceResponseFut {
739        fn _decode(
740            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
741        ) -> Result<PhyDestroyIfaceResult, fidl::Error> {
742            let _response = fidl::client::decode_transaction_body::<
743                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
744                fidl::encoding::DefaultFuchsiaResourceDialect,
745                0x75a3048ae01942e8,
746            >(_buf?)?;
747            Ok(_response.map(|x| x))
748        }
749        self.client.send_query_and_decode::<PhyDestroyIfaceRequest, PhyDestroyIfaceResult>(
750            (req,),
751            0x75a3048ae01942e8,
752            fidl::encoding::DynamicFlags::empty(),
753            _decode,
754        )
755    }
756
757    type SetCountryResponseFut =
758        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
759    fn r#set_country(&self, mut req: &CountryCode) -> Self::SetCountryResponseFut {
760        fn _decode(
761            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
762        ) -> Result<i32, fidl::Error> {
763            let _response = fidl::client::decode_transaction_body::<
764                PhySetCountryResponse,
765                fidl::encoding::DefaultFuchsiaResourceDialect,
766                0x1367e9997ba00806,
767            >(_buf?)?;
768            Ok(_response.status)
769        }
770        self.client.send_query_and_decode::<PhySetCountryRequest, i32>(
771            (req,),
772            0x1367e9997ba00806,
773            fidl::encoding::DynamicFlags::empty(),
774            _decode,
775        )
776    }
777
778    type GetCountryResponseFut = fidl::client::QueryResponseFut<
779        PhyGetCountryResult,
780        fidl::encoding::DefaultFuchsiaResourceDialect,
781    >;
782    fn r#get_country(&self) -> Self::GetCountryResponseFut {
783        fn _decode(
784            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
785        ) -> Result<PhyGetCountryResult, fidl::Error> {
786            let _response = fidl::client::decode_transaction_body::<
787                fidl::encoding::ResultType<PhyGetCountryResponse, i32>,
788                fidl::encoding::DefaultFuchsiaResourceDialect,
789                0x3ed3281ce6feab3e,
790            >(_buf?)?;
791            Ok(_response.map(|x| x.resp))
792        }
793        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PhyGetCountryResult>(
794            (),
795            0x3ed3281ce6feab3e,
796            fidl::encoding::DynamicFlags::empty(),
797            _decode,
798        )
799    }
800
801    type ClearCountryResponseFut =
802        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
803    fn r#clear_country(&self) -> Self::ClearCountryResponseFut {
804        fn _decode(
805            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
806        ) -> Result<i32, fidl::Error> {
807            let _response = fidl::client::decode_transaction_body::<
808                PhyClearCountryResponse,
809                fidl::encoding::DefaultFuchsiaResourceDialect,
810                0x4ea9b83a9c494c95,
811            >(_buf?)?;
812            Ok(_response.status)
813        }
814        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i32>(
815            (),
816            0x4ea9b83a9c494c95,
817            fidl::encoding::DynamicFlags::empty(),
818            _decode,
819        )
820    }
821
822    type SetPowerSaveModeResponseFut =
823        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
824    fn r#set_power_save_mode(
825        &self,
826        mut req: fidl_fuchsia_wlan_common::PowerSaveType,
827    ) -> Self::SetPowerSaveModeResponseFut {
828        fn _decode(
829            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
830        ) -> Result<i32, fidl::Error> {
831            let _response = fidl::client::decode_transaction_body::<
832                PhySetPowerSaveModeResponse,
833                fidl::encoding::DefaultFuchsiaResourceDialect,
834                0x56be34b2f3abe17f,
835            >(_buf?)?;
836            Ok(_response.status)
837        }
838        self.client.send_query_and_decode::<PhySetPowerSaveModeRequest, i32>(
839            (req,),
840            0x56be34b2f3abe17f,
841            fidl::encoding::DynamicFlags::empty(),
842            _decode,
843        )
844    }
845
846    type GetPowerSaveModeResponseFut = fidl::client::QueryResponseFut<
847        PhyGetPowerSaveModeResult,
848        fidl::encoding::DefaultFuchsiaResourceDialect,
849    >;
850    fn r#get_power_save_mode(&self) -> Self::GetPowerSaveModeResponseFut {
851        fn _decode(
852            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
853        ) -> Result<PhyGetPowerSaveModeResult, fidl::Error> {
854            let _response = fidl::client::decode_transaction_body::<
855                fidl::encoding::ResultType<PhyGetPowerSaveModeResponse, i32>,
856                fidl::encoding::DefaultFuchsiaResourceDialect,
857                0x3f7019c3672bc798,
858            >(_buf?)?;
859            Ok(_response.map(|x| x.resp))
860        }
861        self.client
862            .send_query_and_decode::<fidl::encoding::EmptyPayload, PhyGetPowerSaveModeResult>(
863                (),
864                0x3f7019c3672bc798,
865                fidl::encoding::DynamicFlags::empty(),
866                _decode,
867            )
868    }
869}
870
871pub struct PhyEventStream {
872    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
873}
874
875impl std::marker::Unpin for PhyEventStream {}
876
877impl futures::stream::FusedStream for PhyEventStream {
878    fn is_terminated(&self) -> bool {
879        self.event_receiver.is_terminated()
880    }
881}
882
883impl futures::Stream for PhyEventStream {
884    type Item = Result<PhyEvent, fidl::Error>;
885
886    fn poll_next(
887        mut self: std::pin::Pin<&mut Self>,
888        cx: &mut std::task::Context<'_>,
889    ) -> std::task::Poll<Option<Self::Item>> {
890        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
891            &mut self.event_receiver,
892            cx
893        )?) {
894            Some(buf) => std::task::Poll::Ready(Some(PhyEvent::decode(buf))),
895            None => std::task::Poll::Ready(None),
896        }
897    }
898}
899
900#[derive(Debug)]
901pub enum PhyEvent {}
902
903impl PhyEvent {
904    /// Decodes a message buffer as a [`PhyEvent`].
905    fn decode(
906        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
907    ) -> Result<PhyEvent, fidl::Error> {
908        let (bytes, _handles) = buf.split_mut();
909        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
910        debug_assert_eq!(tx_header.tx_id, 0);
911        match tx_header.ordinal {
912            _ => Err(fidl::Error::UnknownOrdinal {
913                ordinal: tx_header.ordinal,
914                protocol_name: <PhyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
915            }),
916        }
917    }
918}
919
920/// A Stream of incoming requests for fuchsia.wlan.device/Phy.
921pub struct PhyRequestStream {
922    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
923    is_terminated: bool,
924}
925
926impl std::marker::Unpin for PhyRequestStream {}
927
928impl futures::stream::FusedStream for PhyRequestStream {
929    fn is_terminated(&self) -> bool {
930        self.is_terminated
931    }
932}
933
934impl fidl::endpoints::RequestStream for PhyRequestStream {
935    type Protocol = PhyMarker;
936    type ControlHandle = PhyControlHandle;
937
938    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
939        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
940    }
941
942    fn control_handle(&self) -> Self::ControlHandle {
943        PhyControlHandle { inner: self.inner.clone() }
944    }
945
946    fn into_inner(
947        self,
948    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
949    {
950        (self.inner, self.is_terminated)
951    }
952
953    fn from_inner(
954        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
955        is_terminated: bool,
956    ) -> Self {
957        Self { inner, is_terminated }
958    }
959}
960
961impl futures::Stream for PhyRequestStream {
962    type Item = Result<PhyRequest, fidl::Error>;
963
964    fn poll_next(
965        mut self: std::pin::Pin<&mut Self>,
966        cx: &mut std::task::Context<'_>,
967    ) -> std::task::Poll<Option<Self::Item>> {
968        let this = &mut *self;
969        if this.inner.check_shutdown(cx) {
970            this.is_terminated = true;
971            return std::task::Poll::Ready(None);
972        }
973        if this.is_terminated {
974            panic!("polled PhyRequestStream after completion");
975        }
976        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
977            |bytes, handles| {
978                match this.inner.channel().read_etc(cx, bytes, handles) {
979                    std::task::Poll::Ready(Ok(())) => {}
980                    std::task::Poll::Pending => return std::task::Poll::Pending,
981                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
982                        this.is_terminated = true;
983                        return std::task::Poll::Ready(None);
984                    }
985                    std::task::Poll::Ready(Err(e)) => {
986                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
987                            e.into(),
988                        ))))
989                    }
990                }
991
992                // A message has been received from the channel
993                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
994
995                std::task::Poll::Ready(Some(match header.ordinal {
996                    0x18f6b9091aa8a44 => {
997                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
998                        let mut req = fidl::new_empty!(
999                            fidl::encoding::EmptyPayload,
1000                            fidl::encoding::DefaultFuchsiaResourceDialect
1001                        );
1002                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1003                        let control_handle = PhyControlHandle { inner: this.inner.clone() };
1004                        Ok(PhyRequest::GetSupportedMacRoles {
1005                            responder: PhyGetSupportedMacRolesResponder {
1006                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1007                                tx_id: header.tx_id,
1008                            },
1009                        })
1010                    }
1011                    0x665940c7aa4b9785 => {
1012                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1013                        let mut req = fidl::new_empty!(
1014                            PhyCreateIfaceRequest,
1015                            fidl::encoding::DefaultFuchsiaResourceDialect
1016                        );
1017                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PhyCreateIfaceRequest>(&header, _body_bytes, handles, &mut req)?;
1018                        let control_handle = PhyControlHandle { inner: this.inner.clone() };
1019                        Ok(PhyRequest::CreateIface {
1020                            req: req.req,
1021
1022                            responder: PhyCreateIfaceResponder {
1023                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1024                                tx_id: header.tx_id,
1025                            },
1026                        })
1027                    }
1028                    0x75a3048ae01942e8 => {
1029                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1030                        let mut req = fidl::new_empty!(
1031                            PhyDestroyIfaceRequest,
1032                            fidl::encoding::DefaultFuchsiaResourceDialect
1033                        );
1034                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PhyDestroyIfaceRequest>(&header, _body_bytes, handles, &mut req)?;
1035                        let control_handle = PhyControlHandle { inner: this.inner.clone() };
1036                        Ok(PhyRequest::DestroyIface {
1037                            req: req.req,
1038
1039                            responder: PhyDestroyIfaceResponder {
1040                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1041                                tx_id: header.tx_id,
1042                            },
1043                        })
1044                    }
1045                    0x1367e9997ba00806 => {
1046                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1047                        let mut req = fidl::new_empty!(
1048                            PhySetCountryRequest,
1049                            fidl::encoding::DefaultFuchsiaResourceDialect
1050                        );
1051                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PhySetCountryRequest>(&header, _body_bytes, handles, &mut req)?;
1052                        let control_handle = PhyControlHandle { inner: this.inner.clone() };
1053                        Ok(PhyRequest::SetCountry {
1054                            req: req.req,
1055
1056                            responder: PhySetCountryResponder {
1057                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1058                                tx_id: header.tx_id,
1059                            },
1060                        })
1061                    }
1062                    0x3ed3281ce6feab3e => {
1063                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1064                        let mut req = fidl::new_empty!(
1065                            fidl::encoding::EmptyPayload,
1066                            fidl::encoding::DefaultFuchsiaResourceDialect
1067                        );
1068                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1069                        let control_handle = PhyControlHandle { inner: this.inner.clone() };
1070                        Ok(PhyRequest::GetCountry {
1071                            responder: PhyGetCountryResponder {
1072                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1073                                tx_id: header.tx_id,
1074                            },
1075                        })
1076                    }
1077                    0x4ea9b83a9c494c95 => {
1078                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1079                        let mut req = fidl::new_empty!(
1080                            fidl::encoding::EmptyPayload,
1081                            fidl::encoding::DefaultFuchsiaResourceDialect
1082                        );
1083                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1084                        let control_handle = PhyControlHandle { inner: this.inner.clone() };
1085                        Ok(PhyRequest::ClearCountry {
1086                            responder: PhyClearCountryResponder {
1087                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1088                                tx_id: header.tx_id,
1089                            },
1090                        })
1091                    }
1092                    0x56be34b2f3abe17f => {
1093                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1094                        let mut req = fidl::new_empty!(
1095                            PhySetPowerSaveModeRequest,
1096                            fidl::encoding::DefaultFuchsiaResourceDialect
1097                        );
1098                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PhySetPowerSaveModeRequest>(&header, _body_bytes, handles, &mut req)?;
1099                        let control_handle = PhyControlHandle { inner: this.inner.clone() };
1100                        Ok(PhyRequest::SetPowerSaveMode {
1101                            req: req.req,
1102
1103                            responder: PhySetPowerSaveModeResponder {
1104                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1105                                tx_id: header.tx_id,
1106                            },
1107                        })
1108                    }
1109                    0x3f7019c3672bc798 => {
1110                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1111                        let mut req = fidl::new_empty!(
1112                            fidl::encoding::EmptyPayload,
1113                            fidl::encoding::DefaultFuchsiaResourceDialect
1114                        );
1115                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1116                        let control_handle = PhyControlHandle { inner: this.inner.clone() };
1117                        Ok(PhyRequest::GetPowerSaveMode {
1118                            responder: PhyGetPowerSaveModeResponder {
1119                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1120                                tx_id: header.tx_id,
1121                            },
1122                        })
1123                    }
1124                    _ => Err(fidl::Error::UnknownOrdinal {
1125                        ordinal: header.ordinal,
1126                        protocol_name: <PhyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1127                    }),
1128                }))
1129            },
1130        )
1131    }
1132}
1133
1134#[derive(Debug)]
1135pub enum PhyRequest {
1136    GetSupportedMacRoles {
1137        responder: PhyGetSupportedMacRolesResponder,
1138    },
1139    CreateIface {
1140        req: CreateIfaceRequest,
1141        responder: PhyCreateIfaceResponder,
1142    },
1143    DestroyIface {
1144        req: DestroyIfaceRequest,
1145        responder: PhyDestroyIfaceResponder,
1146    },
1147    SetCountry {
1148        req: CountryCode,
1149        responder: PhySetCountryResponder,
1150    },
1151    GetCountry {
1152        responder: PhyGetCountryResponder,
1153    },
1154    ClearCountry {
1155        responder: PhyClearCountryResponder,
1156    },
1157    SetPowerSaveMode {
1158        req: fidl_fuchsia_wlan_common::PowerSaveType,
1159        responder: PhySetPowerSaveModeResponder,
1160    },
1161    GetPowerSaveMode {
1162        responder: PhyGetPowerSaveModeResponder,
1163    },
1164}
1165
1166impl PhyRequest {
1167    #[allow(irrefutable_let_patterns)]
1168    pub fn into_get_supported_mac_roles(self) -> Option<(PhyGetSupportedMacRolesResponder)> {
1169        if let PhyRequest::GetSupportedMacRoles { responder } = self {
1170            Some((responder))
1171        } else {
1172            None
1173        }
1174    }
1175
1176    #[allow(irrefutable_let_patterns)]
1177    pub fn into_create_iface(self) -> Option<(CreateIfaceRequest, PhyCreateIfaceResponder)> {
1178        if let PhyRequest::CreateIface { req, responder } = self {
1179            Some((req, responder))
1180        } else {
1181            None
1182        }
1183    }
1184
1185    #[allow(irrefutable_let_patterns)]
1186    pub fn into_destroy_iface(self) -> Option<(DestroyIfaceRequest, PhyDestroyIfaceResponder)> {
1187        if let PhyRequest::DestroyIface { req, responder } = self {
1188            Some((req, responder))
1189        } else {
1190            None
1191        }
1192    }
1193
1194    #[allow(irrefutable_let_patterns)]
1195    pub fn into_set_country(self) -> Option<(CountryCode, PhySetCountryResponder)> {
1196        if let PhyRequest::SetCountry { req, responder } = self {
1197            Some((req, responder))
1198        } else {
1199            None
1200        }
1201    }
1202
1203    #[allow(irrefutable_let_patterns)]
1204    pub fn into_get_country(self) -> Option<(PhyGetCountryResponder)> {
1205        if let PhyRequest::GetCountry { responder } = self {
1206            Some((responder))
1207        } else {
1208            None
1209        }
1210    }
1211
1212    #[allow(irrefutable_let_patterns)]
1213    pub fn into_clear_country(self) -> Option<(PhyClearCountryResponder)> {
1214        if let PhyRequest::ClearCountry { responder } = self {
1215            Some((responder))
1216        } else {
1217            None
1218        }
1219    }
1220
1221    #[allow(irrefutable_let_patterns)]
1222    pub fn into_set_power_save_mode(
1223        self,
1224    ) -> Option<(fidl_fuchsia_wlan_common::PowerSaveType, PhySetPowerSaveModeResponder)> {
1225        if let PhyRequest::SetPowerSaveMode { req, responder } = self {
1226            Some((req, responder))
1227        } else {
1228            None
1229        }
1230    }
1231
1232    #[allow(irrefutable_let_patterns)]
1233    pub fn into_get_power_save_mode(self) -> Option<(PhyGetPowerSaveModeResponder)> {
1234        if let PhyRequest::GetPowerSaveMode { responder } = self {
1235            Some((responder))
1236        } else {
1237            None
1238        }
1239    }
1240
1241    /// Name of the method defined in FIDL
1242    pub fn method_name(&self) -> &'static str {
1243        match *self {
1244            PhyRequest::GetSupportedMacRoles { .. } => "get_supported_mac_roles",
1245            PhyRequest::CreateIface { .. } => "create_iface",
1246            PhyRequest::DestroyIface { .. } => "destroy_iface",
1247            PhyRequest::SetCountry { .. } => "set_country",
1248            PhyRequest::GetCountry { .. } => "get_country",
1249            PhyRequest::ClearCountry { .. } => "clear_country",
1250            PhyRequest::SetPowerSaveMode { .. } => "set_power_save_mode",
1251            PhyRequest::GetPowerSaveMode { .. } => "get_power_save_mode",
1252        }
1253    }
1254}
1255
1256#[derive(Debug, Clone)]
1257pub struct PhyControlHandle {
1258    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1259}
1260
1261impl fidl::endpoints::ControlHandle for PhyControlHandle {
1262    fn shutdown(&self) {
1263        self.inner.shutdown()
1264    }
1265    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1266        self.inner.shutdown_with_epitaph(status)
1267    }
1268
1269    fn is_closed(&self) -> bool {
1270        self.inner.channel().is_closed()
1271    }
1272    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1273        self.inner.channel().on_closed()
1274    }
1275
1276    #[cfg(target_os = "fuchsia")]
1277    fn signal_peer(
1278        &self,
1279        clear_mask: zx::Signals,
1280        set_mask: zx::Signals,
1281    ) -> Result<(), zx_status::Status> {
1282        use fidl::Peered;
1283        self.inner.channel().signal_peer(clear_mask, set_mask)
1284    }
1285}
1286
1287impl PhyControlHandle {}
1288
1289#[must_use = "FIDL methods require a response to be sent"]
1290#[derive(Debug)]
1291pub struct PhyGetSupportedMacRolesResponder {
1292    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
1293    tx_id: u32,
1294}
1295
1296/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
1297/// if the responder is dropped without sending a response, so that the client
1298/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1299impl std::ops::Drop for PhyGetSupportedMacRolesResponder {
1300    fn drop(&mut self) {
1301        self.control_handle.shutdown();
1302        // Safety: drops once, never accessed again
1303        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1304    }
1305}
1306
1307impl fidl::endpoints::Responder for PhyGetSupportedMacRolesResponder {
1308    type ControlHandle = PhyControlHandle;
1309
1310    fn control_handle(&self) -> &PhyControlHandle {
1311        &self.control_handle
1312    }
1313
1314    fn drop_without_shutdown(mut self) {
1315        // Safety: drops once, never accessed again due to mem::forget
1316        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1317        // Prevent Drop from running (which would shut down the channel)
1318        std::mem::forget(self);
1319    }
1320}
1321
1322impl PhyGetSupportedMacRolesResponder {
1323    /// Sends a response to the FIDL transaction.
1324    ///
1325    /// Sets the channel to shutdown if an error occurs.
1326    pub fn send(
1327        self,
1328        mut result: Result<&[fidl_fuchsia_wlan_common::WlanMacRole], i32>,
1329    ) -> Result<(), fidl::Error> {
1330        let _result = self.send_raw(result);
1331        if _result.is_err() {
1332            self.control_handle.shutdown();
1333        }
1334        self.drop_without_shutdown();
1335        _result
1336    }
1337
1338    /// Similar to "send" but does not shutdown the channel if an error occurs.
1339    pub fn send_no_shutdown_on_err(
1340        self,
1341        mut result: Result<&[fidl_fuchsia_wlan_common::WlanMacRole], i32>,
1342    ) -> Result<(), fidl::Error> {
1343        let _result = self.send_raw(result);
1344        self.drop_without_shutdown();
1345        _result
1346    }
1347
1348    fn send_raw(
1349        &self,
1350        mut result: Result<&[fidl_fuchsia_wlan_common::WlanMacRole], i32>,
1351    ) -> Result<(), fidl::Error> {
1352        self.control_handle
1353            .inner
1354            .send::<fidl::encoding::ResultType<PhyGetSupportedMacRolesResponse, i32>>(
1355                result.map(|supported_mac_roles| (supported_mac_roles,)),
1356                self.tx_id,
1357                0x18f6b9091aa8a44,
1358                fidl::encoding::DynamicFlags::empty(),
1359            )
1360    }
1361}
1362
1363#[must_use = "FIDL methods require a response to be sent"]
1364#[derive(Debug)]
1365pub struct PhyCreateIfaceResponder {
1366    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
1367    tx_id: u32,
1368}
1369
1370/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
1371/// if the responder is dropped without sending a response, so that the client
1372/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1373impl std::ops::Drop for PhyCreateIfaceResponder {
1374    fn drop(&mut self) {
1375        self.control_handle.shutdown();
1376        // Safety: drops once, never accessed again
1377        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1378    }
1379}
1380
1381impl fidl::endpoints::Responder for PhyCreateIfaceResponder {
1382    type ControlHandle = PhyControlHandle;
1383
1384    fn control_handle(&self) -> &PhyControlHandle {
1385        &self.control_handle
1386    }
1387
1388    fn drop_without_shutdown(mut self) {
1389        // Safety: drops once, never accessed again due to mem::forget
1390        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1391        // Prevent Drop from running (which would shut down the channel)
1392        std::mem::forget(self);
1393    }
1394}
1395
1396impl PhyCreateIfaceResponder {
1397    /// Sends a response to the FIDL transaction.
1398    ///
1399    /// Sets the channel to shutdown if an error occurs.
1400    pub fn send(self, mut result: Result<u16, i32>) -> Result<(), fidl::Error> {
1401        let _result = self.send_raw(result);
1402        if _result.is_err() {
1403            self.control_handle.shutdown();
1404        }
1405        self.drop_without_shutdown();
1406        _result
1407    }
1408
1409    /// Similar to "send" but does not shutdown the channel if an error occurs.
1410    pub fn send_no_shutdown_on_err(self, mut result: Result<u16, i32>) -> Result<(), fidl::Error> {
1411        let _result = self.send_raw(result);
1412        self.drop_without_shutdown();
1413        _result
1414    }
1415
1416    fn send_raw(&self, mut result: Result<u16, i32>) -> Result<(), fidl::Error> {
1417        self.control_handle.inner.send::<fidl::encoding::ResultType<PhyCreateIfaceResponse, i32>>(
1418            result.map(|iface_id| (iface_id,)),
1419            self.tx_id,
1420            0x665940c7aa4b9785,
1421            fidl::encoding::DynamicFlags::empty(),
1422        )
1423    }
1424}
1425
1426#[must_use = "FIDL methods require a response to be sent"]
1427#[derive(Debug)]
1428pub struct PhyDestroyIfaceResponder {
1429    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
1430    tx_id: u32,
1431}
1432
1433/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
1434/// if the responder is dropped without sending a response, so that the client
1435/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1436impl std::ops::Drop for PhyDestroyIfaceResponder {
1437    fn drop(&mut self) {
1438        self.control_handle.shutdown();
1439        // Safety: drops once, never accessed again
1440        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1441    }
1442}
1443
1444impl fidl::endpoints::Responder for PhyDestroyIfaceResponder {
1445    type ControlHandle = PhyControlHandle;
1446
1447    fn control_handle(&self) -> &PhyControlHandle {
1448        &self.control_handle
1449    }
1450
1451    fn drop_without_shutdown(mut self) {
1452        // Safety: drops once, never accessed again due to mem::forget
1453        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1454        // Prevent Drop from running (which would shut down the channel)
1455        std::mem::forget(self);
1456    }
1457}
1458
1459impl PhyDestroyIfaceResponder {
1460    /// Sends a response to the FIDL transaction.
1461    ///
1462    /// Sets the channel to shutdown if an error occurs.
1463    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1464        let _result = self.send_raw(result);
1465        if _result.is_err() {
1466            self.control_handle.shutdown();
1467        }
1468        self.drop_without_shutdown();
1469        _result
1470    }
1471
1472    /// Similar to "send" but does not shutdown the channel if an error occurs.
1473    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1474        let _result = self.send_raw(result);
1475        self.drop_without_shutdown();
1476        _result
1477    }
1478
1479    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1480        self.control_handle
1481            .inner
1482            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1483                result,
1484                self.tx_id,
1485                0x75a3048ae01942e8,
1486                fidl::encoding::DynamicFlags::empty(),
1487            )
1488    }
1489}
1490
1491#[must_use = "FIDL methods require a response to be sent"]
1492#[derive(Debug)]
1493pub struct PhySetCountryResponder {
1494    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
1495    tx_id: u32,
1496}
1497
1498/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
1499/// if the responder is dropped without sending a response, so that the client
1500/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1501impl std::ops::Drop for PhySetCountryResponder {
1502    fn drop(&mut self) {
1503        self.control_handle.shutdown();
1504        // Safety: drops once, never accessed again
1505        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1506    }
1507}
1508
1509impl fidl::endpoints::Responder for PhySetCountryResponder {
1510    type ControlHandle = PhyControlHandle;
1511
1512    fn control_handle(&self) -> &PhyControlHandle {
1513        &self.control_handle
1514    }
1515
1516    fn drop_without_shutdown(mut self) {
1517        // Safety: drops once, never accessed again due to mem::forget
1518        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1519        // Prevent Drop from running (which would shut down the channel)
1520        std::mem::forget(self);
1521    }
1522}
1523
1524impl PhySetCountryResponder {
1525    /// Sends a response to the FIDL transaction.
1526    ///
1527    /// Sets the channel to shutdown if an error occurs.
1528    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1529        let _result = self.send_raw(status);
1530        if _result.is_err() {
1531            self.control_handle.shutdown();
1532        }
1533        self.drop_without_shutdown();
1534        _result
1535    }
1536
1537    /// Similar to "send" but does not shutdown the channel if an error occurs.
1538    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1539        let _result = self.send_raw(status);
1540        self.drop_without_shutdown();
1541        _result
1542    }
1543
1544    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1545        self.control_handle.inner.send::<PhySetCountryResponse>(
1546            (status,),
1547            self.tx_id,
1548            0x1367e9997ba00806,
1549            fidl::encoding::DynamicFlags::empty(),
1550        )
1551    }
1552}
1553
1554#[must_use = "FIDL methods require a response to be sent"]
1555#[derive(Debug)]
1556pub struct PhyGetCountryResponder {
1557    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
1558    tx_id: u32,
1559}
1560
1561/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
1562/// if the responder is dropped without sending a response, so that the client
1563/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1564impl std::ops::Drop for PhyGetCountryResponder {
1565    fn drop(&mut self) {
1566        self.control_handle.shutdown();
1567        // Safety: drops once, never accessed again
1568        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1569    }
1570}
1571
1572impl fidl::endpoints::Responder for PhyGetCountryResponder {
1573    type ControlHandle = PhyControlHandle;
1574
1575    fn control_handle(&self) -> &PhyControlHandle {
1576        &self.control_handle
1577    }
1578
1579    fn drop_without_shutdown(mut self) {
1580        // Safety: drops once, never accessed again due to mem::forget
1581        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1582        // Prevent Drop from running (which would shut down the channel)
1583        std::mem::forget(self);
1584    }
1585}
1586
1587impl PhyGetCountryResponder {
1588    /// Sends a response to the FIDL transaction.
1589    ///
1590    /// Sets the channel to shutdown if an error occurs.
1591    pub fn send(self, mut result: Result<&CountryCode, i32>) -> Result<(), fidl::Error> {
1592        let _result = self.send_raw(result);
1593        if _result.is_err() {
1594            self.control_handle.shutdown();
1595        }
1596        self.drop_without_shutdown();
1597        _result
1598    }
1599
1600    /// Similar to "send" but does not shutdown the channel if an error occurs.
1601    pub fn send_no_shutdown_on_err(
1602        self,
1603        mut result: Result<&CountryCode, i32>,
1604    ) -> Result<(), fidl::Error> {
1605        let _result = self.send_raw(result);
1606        self.drop_without_shutdown();
1607        _result
1608    }
1609
1610    fn send_raw(&self, mut result: Result<&CountryCode, i32>) -> Result<(), fidl::Error> {
1611        self.control_handle.inner.send::<fidl::encoding::ResultType<PhyGetCountryResponse, i32>>(
1612            result.map(|resp| (resp,)),
1613            self.tx_id,
1614            0x3ed3281ce6feab3e,
1615            fidl::encoding::DynamicFlags::empty(),
1616        )
1617    }
1618}
1619
1620#[must_use = "FIDL methods require a response to be sent"]
1621#[derive(Debug)]
1622pub struct PhyClearCountryResponder {
1623    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
1624    tx_id: u32,
1625}
1626
1627/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
1628/// if the responder is dropped without sending a response, so that the client
1629/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1630impl std::ops::Drop for PhyClearCountryResponder {
1631    fn drop(&mut self) {
1632        self.control_handle.shutdown();
1633        // Safety: drops once, never accessed again
1634        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1635    }
1636}
1637
1638impl fidl::endpoints::Responder for PhyClearCountryResponder {
1639    type ControlHandle = PhyControlHandle;
1640
1641    fn control_handle(&self) -> &PhyControlHandle {
1642        &self.control_handle
1643    }
1644
1645    fn drop_without_shutdown(mut self) {
1646        // Safety: drops once, never accessed again due to mem::forget
1647        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1648        // Prevent Drop from running (which would shut down the channel)
1649        std::mem::forget(self);
1650    }
1651}
1652
1653impl PhyClearCountryResponder {
1654    /// Sends a response to the FIDL transaction.
1655    ///
1656    /// Sets the channel to shutdown if an error occurs.
1657    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1658        let _result = self.send_raw(status);
1659        if _result.is_err() {
1660            self.control_handle.shutdown();
1661        }
1662        self.drop_without_shutdown();
1663        _result
1664    }
1665
1666    /// Similar to "send" but does not shutdown the channel if an error occurs.
1667    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1668        let _result = self.send_raw(status);
1669        self.drop_without_shutdown();
1670        _result
1671    }
1672
1673    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1674        self.control_handle.inner.send::<PhyClearCountryResponse>(
1675            (status,),
1676            self.tx_id,
1677            0x4ea9b83a9c494c95,
1678            fidl::encoding::DynamicFlags::empty(),
1679        )
1680    }
1681}
1682
1683#[must_use = "FIDL methods require a response to be sent"]
1684#[derive(Debug)]
1685pub struct PhySetPowerSaveModeResponder {
1686    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
1687    tx_id: u32,
1688}
1689
1690/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
1691/// if the responder is dropped without sending a response, so that the client
1692/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1693impl std::ops::Drop for PhySetPowerSaveModeResponder {
1694    fn drop(&mut self) {
1695        self.control_handle.shutdown();
1696        // Safety: drops once, never accessed again
1697        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1698    }
1699}
1700
1701impl fidl::endpoints::Responder for PhySetPowerSaveModeResponder {
1702    type ControlHandle = PhyControlHandle;
1703
1704    fn control_handle(&self) -> &PhyControlHandle {
1705        &self.control_handle
1706    }
1707
1708    fn drop_without_shutdown(mut self) {
1709        // Safety: drops once, never accessed again due to mem::forget
1710        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1711        // Prevent Drop from running (which would shut down the channel)
1712        std::mem::forget(self);
1713    }
1714}
1715
1716impl PhySetPowerSaveModeResponder {
1717    /// Sends a response to the FIDL transaction.
1718    ///
1719    /// Sets the channel to shutdown if an error occurs.
1720    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1721        let _result = self.send_raw(status);
1722        if _result.is_err() {
1723            self.control_handle.shutdown();
1724        }
1725        self.drop_without_shutdown();
1726        _result
1727    }
1728
1729    /// Similar to "send" but does not shutdown the channel if an error occurs.
1730    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1731        let _result = self.send_raw(status);
1732        self.drop_without_shutdown();
1733        _result
1734    }
1735
1736    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1737        self.control_handle.inner.send::<PhySetPowerSaveModeResponse>(
1738            (status,),
1739            self.tx_id,
1740            0x56be34b2f3abe17f,
1741            fidl::encoding::DynamicFlags::empty(),
1742        )
1743    }
1744}
1745
1746#[must_use = "FIDL methods require a response to be sent"]
1747#[derive(Debug)]
1748pub struct PhyGetPowerSaveModeResponder {
1749    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
1750    tx_id: u32,
1751}
1752
1753/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
1754/// if the responder is dropped without sending a response, so that the client
1755/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1756impl std::ops::Drop for PhyGetPowerSaveModeResponder {
1757    fn drop(&mut self) {
1758        self.control_handle.shutdown();
1759        // Safety: drops once, never accessed again
1760        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1761    }
1762}
1763
1764impl fidl::endpoints::Responder for PhyGetPowerSaveModeResponder {
1765    type ControlHandle = PhyControlHandle;
1766
1767    fn control_handle(&self) -> &PhyControlHandle {
1768        &self.control_handle
1769    }
1770
1771    fn drop_without_shutdown(mut self) {
1772        // Safety: drops once, never accessed again due to mem::forget
1773        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1774        // Prevent Drop from running (which would shut down the channel)
1775        std::mem::forget(self);
1776    }
1777}
1778
1779impl PhyGetPowerSaveModeResponder {
1780    /// Sends a response to the FIDL transaction.
1781    ///
1782    /// Sets the channel to shutdown if an error occurs.
1783    pub fn send(
1784        self,
1785        mut result: Result<fidl_fuchsia_wlan_common::PowerSaveType, i32>,
1786    ) -> Result<(), fidl::Error> {
1787        let _result = self.send_raw(result);
1788        if _result.is_err() {
1789            self.control_handle.shutdown();
1790        }
1791        self.drop_without_shutdown();
1792        _result
1793    }
1794
1795    /// Similar to "send" but does not shutdown the channel if an error occurs.
1796    pub fn send_no_shutdown_on_err(
1797        self,
1798        mut result: Result<fidl_fuchsia_wlan_common::PowerSaveType, i32>,
1799    ) -> Result<(), fidl::Error> {
1800        let _result = self.send_raw(result);
1801        self.drop_without_shutdown();
1802        _result
1803    }
1804
1805    fn send_raw(
1806        &self,
1807        mut result: Result<fidl_fuchsia_wlan_common::PowerSaveType, i32>,
1808    ) -> Result<(), fidl::Error> {
1809        self.control_handle
1810            .inner
1811            .send::<fidl::encoding::ResultType<PhyGetPowerSaveModeResponse, i32>>(
1812                result.map(|resp| (resp,)),
1813                self.tx_id,
1814                0x3f7019c3672bc798,
1815                fidl::encoding::DynamicFlags::empty(),
1816            )
1817    }
1818}
1819
1820#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1821pub struct ServiceMarker;
1822
1823#[cfg(target_os = "fuchsia")]
1824impl fidl::endpoints::ServiceMarker for ServiceMarker {
1825    type Proxy = ServiceProxy;
1826    type Request = ServiceRequest;
1827    const SERVICE_NAME: &'static str = "fuchsia.wlan.device.Service";
1828}
1829
1830/// A request for one of the member protocols of Service.
1831///
1832#[cfg(target_os = "fuchsia")]
1833pub enum ServiceRequest {
1834    Device(ConnectorRequestStream),
1835}
1836
1837#[cfg(target_os = "fuchsia")]
1838impl fidl::endpoints::ServiceRequest for ServiceRequest {
1839    type Service = ServiceMarker;
1840
1841    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
1842        match name {
1843            "device" => Self::Device(
1844                <ConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
1845            ),
1846            _ => panic!("no such member protocol name for service Service"),
1847        }
1848    }
1849
1850    fn member_names() -> &'static [&'static str] {
1851        &["device"]
1852    }
1853}
1854#[cfg(target_os = "fuchsia")]
1855pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
1856
1857#[cfg(target_os = "fuchsia")]
1858impl fidl::endpoints::ServiceProxy for ServiceProxy {
1859    type Service = ServiceMarker;
1860
1861    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
1862        Self(opener)
1863    }
1864}
1865
1866#[cfg(target_os = "fuchsia")]
1867impl ServiceProxy {
1868    pub fn connect_to_device(&self) -> Result<ConnectorProxy, fidl::Error> {
1869        let (proxy, server_end) = fidl::endpoints::create_proxy::<ConnectorMarker>();
1870        self.connect_channel_to_device(server_end)?;
1871        Ok(proxy)
1872    }
1873
1874    /// Like `connect_to_device`, but returns a sync proxy.
1875    /// See [`Self::connect_to_device`] for more details.
1876    pub fn connect_to_device_sync(&self) -> Result<ConnectorSynchronousProxy, fidl::Error> {
1877        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<ConnectorMarker>();
1878        self.connect_channel_to_device(server_end)?;
1879        Ok(proxy)
1880    }
1881
1882    /// Like `connect_to_device`, but accepts a server end.
1883    /// See [`Self::connect_to_device`] for more details.
1884    pub fn connect_channel_to_device(
1885        &self,
1886        server_end: fidl::endpoints::ServerEnd<ConnectorMarker>,
1887    ) -> Result<(), fidl::Error> {
1888        self.0.open_member("device", server_end.into_channel())
1889    }
1890
1891    pub fn instance_name(&self) -> &str {
1892        self.0.instance_name()
1893    }
1894}
1895
1896mod internal {
1897    use super::*;
1898
1899    impl fidl::encoding::ResourceTypeMarker for ConnectorConnectRequest {
1900        type Borrowed<'a> = &'a mut Self;
1901        fn take_or_borrow<'a>(
1902            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1903        ) -> Self::Borrowed<'a> {
1904            value
1905        }
1906    }
1907
1908    unsafe impl fidl::encoding::TypeMarker for ConnectorConnectRequest {
1909        type Owned = Self;
1910
1911        #[inline(always)]
1912        fn inline_align(_context: fidl::encoding::Context) -> usize {
1913            4
1914        }
1915
1916        #[inline(always)]
1917        fn inline_size(_context: fidl::encoding::Context) -> usize {
1918            4
1919        }
1920    }
1921
1922    unsafe impl
1923        fidl::encoding::Encode<
1924            ConnectorConnectRequest,
1925            fidl::encoding::DefaultFuchsiaResourceDialect,
1926        > for &mut ConnectorConnectRequest
1927    {
1928        #[inline]
1929        unsafe fn encode(
1930            self,
1931            encoder: &mut fidl::encoding::Encoder<
1932                '_,
1933                fidl::encoding::DefaultFuchsiaResourceDialect,
1934            >,
1935            offset: usize,
1936            _depth: fidl::encoding::Depth,
1937        ) -> fidl::Result<()> {
1938            encoder.debug_check_bounds::<ConnectorConnectRequest>(offset);
1939            // Delegate to tuple encoding.
1940            fidl::encoding::Encode::<ConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1941                (
1942                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PhyMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
1943                ),
1944                encoder, offset, _depth
1945            )
1946        }
1947    }
1948    unsafe impl<
1949            T0: fidl::encoding::Encode<
1950                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PhyMarker>>,
1951                fidl::encoding::DefaultFuchsiaResourceDialect,
1952            >,
1953        >
1954        fidl::encoding::Encode<
1955            ConnectorConnectRequest,
1956            fidl::encoding::DefaultFuchsiaResourceDialect,
1957        > for (T0,)
1958    {
1959        #[inline]
1960        unsafe fn encode(
1961            self,
1962            encoder: &mut fidl::encoding::Encoder<
1963                '_,
1964                fidl::encoding::DefaultFuchsiaResourceDialect,
1965            >,
1966            offset: usize,
1967            depth: fidl::encoding::Depth,
1968        ) -> fidl::Result<()> {
1969            encoder.debug_check_bounds::<ConnectorConnectRequest>(offset);
1970            // Zero out padding regions. There's no need to apply masks
1971            // because the unmasked parts will be overwritten by fields.
1972            // Write the fields.
1973            self.0.encode(encoder, offset + 0, depth)?;
1974            Ok(())
1975        }
1976    }
1977
1978    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1979        for ConnectorConnectRequest
1980    {
1981        #[inline(always)]
1982        fn new_empty() -> Self {
1983            Self {
1984                request: fidl::new_empty!(
1985                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PhyMarker>>,
1986                    fidl::encoding::DefaultFuchsiaResourceDialect
1987                ),
1988            }
1989        }
1990
1991        #[inline]
1992        unsafe fn decode(
1993            &mut self,
1994            decoder: &mut fidl::encoding::Decoder<
1995                '_,
1996                fidl::encoding::DefaultFuchsiaResourceDialect,
1997            >,
1998            offset: usize,
1999            _depth: fidl::encoding::Depth,
2000        ) -> fidl::Result<()> {
2001            decoder.debug_check_bounds::<Self>(offset);
2002            // Verify that padding bytes are zero.
2003            fidl::decode!(
2004                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PhyMarker>>,
2005                fidl::encoding::DefaultFuchsiaResourceDialect,
2006                &mut self.request,
2007                decoder,
2008                offset + 0,
2009                _depth
2010            )?;
2011            Ok(())
2012        }
2013    }
2014
2015    impl fidl::encoding::ResourceTypeMarker for CreateIfaceRequest {
2016        type Borrowed<'a> = &'a mut Self;
2017        fn take_or_borrow<'a>(
2018            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2019        ) -> Self::Borrowed<'a> {
2020            value
2021        }
2022    }
2023
2024    unsafe impl fidl::encoding::TypeMarker for CreateIfaceRequest {
2025        type Owned = Self;
2026
2027        #[inline(always)]
2028        fn inline_align(_context: fidl::encoding::Context) -> usize {
2029            4
2030        }
2031
2032        #[inline(always)]
2033        fn inline_size(_context: fidl::encoding::Context) -> usize {
2034            16
2035        }
2036    }
2037
2038    unsafe impl
2039        fidl::encoding::Encode<CreateIfaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2040        for &mut CreateIfaceRequest
2041    {
2042        #[inline]
2043        unsafe fn encode(
2044            self,
2045            encoder: &mut fidl::encoding::Encoder<
2046                '_,
2047                fidl::encoding::DefaultFuchsiaResourceDialect,
2048            >,
2049            offset: usize,
2050            _depth: fidl::encoding::Depth,
2051        ) -> fidl::Result<()> {
2052            encoder.debug_check_bounds::<CreateIfaceRequest>(offset);
2053            // Delegate to tuple encoding.
2054            fidl::encoding::Encode::<CreateIfaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2055                (
2056                    <fidl_fuchsia_wlan_common::WlanMacRole as fidl::encoding::ValueTypeMarker>::borrow(&self.role),
2057                    <fidl::encoding::Optional<fidl::encoding::HandleType<fidl::Channel, { fidl::ObjectType::CHANNEL.into_raw() }, 2147483648>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.mlme_channel),
2058                    <fidl::encoding::Array<u8, 6> as fidl::encoding::ValueTypeMarker>::borrow(&self.init_sta_addr),
2059                ),
2060                encoder, offset, _depth
2061            )
2062        }
2063    }
2064    unsafe impl<
2065            T0: fidl::encoding::Encode<
2066                fidl_fuchsia_wlan_common::WlanMacRole,
2067                fidl::encoding::DefaultFuchsiaResourceDialect,
2068            >,
2069            T1: fidl::encoding::Encode<
2070                fidl::encoding::Optional<
2071                    fidl::encoding::HandleType<
2072                        fidl::Channel,
2073                        { fidl::ObjectType::CHANNEL.into_raw() },
2074                        2147483648,
2075                    >,
2076                >,
2077                fidl::encoding::DefaultFuchsiaResourceDialect,
2078            >,
2079            T2: fidl::encoding::Encode<
2080                fidl::encoding::Array<u8, 6>,
2081                fidl::encoding::DefaultFuchsiaResourceDialect,
2082            >,
2083        >
2084        fidl::encoding::Encode<CreateIfaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2085        for (T0, T1, T2)
2086    {
2087        #[inline]
2088        unsafe fn encode(
2089            self,
2090            encoder: &mut fidl::encoding::Encoder<
2091                '_,
2092                fidl::encoding::DefaultFuchsiaResourceDialect,
2093            >,
2094            offset: usize,
2095            depth: fidl::encoding::Depth,
2096        ) -> fidl::Result<()> {
2097            encoder.debug_check_bounds::<CreateIfaceRequest>(offset);
2098            // Zero out padding regions. There's no need to apply masks
2099            // because the unmasked parts will be overwritten by fields.
2100            unsafe {
2101                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(12);
2102                (ptr as *mut u32).write_unaligned(0);
2103            }
2104            // Write the fields.
2105            self.0.encode(encoder, offset + 0, depth)?;
2106            self.1.encode(encoder, offset + 4, depth)?;
2107            self.2.encode(encoder, offset + 8, depth)?;
2108            Ok(())
2109        }
2110    }
2111
2112    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2113        for CreateIfaceRequest
2114    {
2115        #[inline(always)]
2116        fn new_empty() -> Self {
2117            Self {
2118                role: fidl::new_empty!(
2119                    fidl_fuchsia_wlan_common::WlanMacRole,
2120                    fidl::encoding::DefaultFuchsiaResourceDialect
2121                ),
2122                mlme_channel: fidl::new_empty!(
2123                    fidl::encoding::Optional<
2124                        fidl::encoding::HandleType<
2125                            fidl::Channel,
2126                            { fidl::ObjectType::CHANNEL.into_raw() },
2127                            2147483648,
2128                        >,
2129                    >,
2130                    fidl::encoding::DefaultFuchsiaResourceDialect
2131                ),
2132                init_sta_addr: fidl::new_empty!(fidl::encoding::Array<u8, 6>, fidl::encoding::DefaultFuchsiaResourceDialect),
2133            }
2134        }
2135
2136        #[inline]
2137        unsafe fn decode(
2138            &mut self,
2139            decoder: &mut fidl::encoding::Decoder<
2140                '_,
2141                fidl::encoding::DefaultFuchsiaResourceDialect,
2142            >,
2143            offset: usize,
2144            _depth: fidl::encoding::Depth,
2145        ) -> fidl::Result<()> {
2146            decoder.debug_check_bounds::<Self>(offset);
2147            // Verify that padding bytes are zero.
2148            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(12) };
2149            let padval = unsafe { (ptr as *const u32).read_unaligned() };
2150            let mask = 0xffff0000u32;
2151            let maskedval = padval & mask;
2152            if maskedval != 0 {
2153                return Err(fidl::Error::NonZeroPadding {
2154                    padding_start: offset + 12 + ((mask as u64).trailing_zeros() / 8) as usize,
2155                });
2156            }
2157            fidl::decode!(
2158                fidl_fuchsia_wlan_common::WlanMacRole,
2159                fidl::encoding::DefaultFuchsiaResourceDialect,
2160                &mut self.role,
2161                decoder,
2162                offset + 0,
2163                _depth
2164            )?;
2165            fidl::decode!(
2166                fidl::encoding::Optional<
2167                    fidl::encoding::HandleType<
2168                        fidl::Channel,
2169                        { fidl::ObjectType::CHANNEL.into_raw() },
2170                        2147483648,
2171                    >,
2172                >,
2173                fidl::encoding::DefaultFuchsiaResourceDialect,
2174                &mut self.mlme_channel,
2175                decoder,
2176                offset + 4,
2177                _depth
2178            )?;
2179            fidl::decode!(fidl::encoding::Array<u8, 6>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.init_sta_addr, decoder, offset + 8, _depth)?;
2180            Ok(())
2181        }
2182    }
2183
2184    impl fidl::encoding::ResourceTypeMarker for PhyCreateIfaceRequest {
2185        type Borrowed<'a> = &'a mut Self;
2186        fn take_or_borrow<'a>(
2187            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2188        ) -> Self::Borrowed<'a> {
2189            value
2190        }
2191    }
2192
2193    unsafe impl fidl::encoding::TypeMarker for PhyCreateIfaceRequest {
2194        type Owned = Self;
2195
2196        #[inline(always)]
2197        fn inline_align(_context: fidl::encoding::Context) -> usize {
2198            4
2199        }
2200
2201        #[inline(always)]
2202        fn inline_size(_context: fidl::encoding::Context) -> usize {
2203            16
2204        }
2205    }
2206
2207    unsafe impl
2208        fidl::encoding::Encode<PhyCreateIfaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2209        for &mut PhyCreateIfaceRequest
2210    {
2211        #[inline]
2212        unsafe fn encode(
2213            self,
2214            encoder: &mut fidl::encoding::Encoder<
2215                '_,
2216                fidl::encoding::DefaultFuchsiaResourceDialect,
2217            >,
2218            offset: usize,
2219            _depth: fidl::encoding::Depth,
2220        ) -> fidl::Result<()> {
2221            encoder.debug_check_bounds::<PhyCreateIfaceRequest>(offset);
2222            // Delegate to tuple encoding.
2223            fidl::encoding::Encode::<
2224                PhyCreateIfaceRequest,
2225                fidl::encoding::DefaultFuchsiaResourceDialect,
2226            >::encode(
2227                (<CreateIfaceRequest as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2228                    &mut self.req,
2229                ),),
2230                encoder,
2231                offset,
2232                _depth,
2233            )
2234        }
2235    }
2236    unsafe impl<
2237            T0: fidl::encoding::Encode<
2238                CreateIfaceRequest,
2239                fidl::encoding::DefaultFuchsiaResourceDialect,
2240            >,
2241        >
2242        fidl::encoding::Encode<PhyCreateIfaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2243        for (T0,)
2244    {
2245        #[inline]
2246        unsafe fn encode(
2247            self,
2248            encoder: &mut fidl::encoding::Encoder<
2249                '_,
2250                fidl::encoding::DefaultFuchsiaResourceDialect,
2251            >,
2252            offset: usize,
2253            depth: fidl::encoding::Depth,
2254        ) -> fidl::Result<()> {
2255            encoder.debug_check_bounds::<PhyCreateIfaceRequest>(offset);
2256            // Zero out padding regions. There's no need to apply masks
2257            // because the unmasked parts will be overwritten by fields.
2258            // Write the fields.
2259            self.0.encode(encoder, offset + 0, depth)?;
2260            Ok(())
2261        }
2262    }
2263
2264    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2265        for PhyCreateIfaceRequest
2266    {
2267        #[inline(always)]
2268        fn new_empty() -> Self {
2269            Self {
2270                req: fidl::new_empty!(
2271                    CreateIfaceRequest,
2272                    fidl::encoding::DefaultFuchsiaResourceDialect
2273                ),
2274            }
2275        }
2276
2277        #[inline]
2278        unsafe fn decode(
2279            &mut self,
2280            decoder: &mut fidl::encoding::Decoder<
2281                '_,
2282                fidl::encoding::DefaultFuchsiaResourceDialect,
2283            >,
2284            offset: usize,
2285            _depth: fidl::encoding::Depth,
2286        ) -> fidl::Result<()> {
2287            decoder.debug_check_bounds::<Self>(offset);
2288            // Verify that padding bytes are zero.
2289            fidl::decode!(
2290                CreateIfaceRequest,
2291                fidl::encoding::DefaultFuchsiaResourceDialect,
2292                &mut self.req,
2293                decoder,
2294                offset + 0,
2295                _depth
2296            )?;
2297            Ok(())
2298        }
2299    }
2300}