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#[cfg(target_os = "fuchsia")]
109impl From<ConnectorSynchronousProxy> for zx::Handle {
110    fn from(value: ConnectorSynchronousProxy) -> Self {
111        value.into_channel().into()
112    }
113}
114
115#[cfg(target_os = "fuchsia")]
116impl From<fidl::Channel> for ConnectorSynchronousProxy {
117    fn from(value: fidl::Channel) -> Self {
118        Self::new(value)
119    }
120}
121
122#[cfg(target_os = "fuchsia")]
123impl fidl::endpoints::FromClient for ConnectorSynchronousProxy {
124    type Protocol = ConnectorMarker;
125
126    fn from_client(value: fidl::endpoints::ClientEnd<ConnectorMarker>) -> Self {
127        Self::new(value.into_channel())
128    }
129}
130
131#[derive(Debug, Clone)]
132pub struct ConnectorProxy {
133    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
134}
135
136impl fidl::endpoints::Proxy for ConnectorProxy {
137    type Protocol = ConnectorMarker;
138
139    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
140        Self::new(inner)
141    }
142
143    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
144        self.client.into_channel().map_err(|client| Self { client })
145    }
146
147    fn as_channel(&self) -> &::fidl::AsyncChannel {
148        self.client.as_channel()
149    }
150}
151
152impl ConnectorProxy {
153    /// Create a new Proxy for fuchsia.wlan.device/Connector.
154    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
155        let protocol_name = <ConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
156        Self { client: fidl::client::Client::new(channel, protocol_name) }
157    }
158
159    /// Get a Stream of events from the remote end of the protocol.
160    ///
161    /// # Panics
162    ///
163    /// Panics if the event stream was already taken.
164    pub fn take_event_stream(&self) -> ConnectorEventStream {
165        ConnectorEventStream { event_receiver: self.client.take_event_receiver() }
166    }
167
168    pub fn r#connect(
169        &self,
170        mut request: fidl::endpoints::ServerEnd<PhyMarker>,
171    ) -> Result<(), fidl::Error> {
172        ConnectorProxyInterface::r#connect(self, request)
173    }
174}
175
176impl ConnectorProxyInterface for ConnectorProxy {
177    fn r#connect(
178        &self,
179        mut request: fidl::endpoints::ServerEnd<PhyMarker>,
180    ) -> Result<(), fidl::Error> {
181        self.client.send::<ConnectorConnectRequest>(
182            (request,),
183            0x2dd039e4ba3a4d26,
184            fidl::encoding::DynamicFlags::empty(),
185        )
186    }
187}
188
189pub struct ConnectorEventStream {
190    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
191}
192
193impl std::marker::Unpin for ConnectorEventStream {}
194
195impl futures::stream::FusedStream for ConnectorEventStream {
196    fn is_terminated(&self) -> bool {
197        self.event_receiver.is_terminated()
198    }
199}
200
201impl futures::Stream for ConnectorEventStream {
202    type Item = Result<ConnectorEvent, fidl::Error>;
203
204    fn poll_next(
205        mut self: std::pin::Pin<&mut Self>,
206        cx: &mut std::task::Context<'_>,
207    ) -> std::task::Poll<Option<Self::Item>> {
208        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
209            &mut self.event_receiver,
210            cx
211        )?) {
212            Some(buf) => std::task::Poll::Ready(Some(ConnectorEvent::decode(buf))),
213            None => std::task::Poll::Ready(None),
214        }
215    }
216}
217
218#[derive(Debug)]
219pub enum ConnectorEvent {}
220
221impl ConnectorEvent {
222    /// Decodes a message buffer as a [`ConnectorEvent`].
223    fn decode(
224        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
225    ) -> Result<ConnectorEvent, fidl::Error> {
226        let (bytes, _handles) = buf.split_mut();
227        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
228        debug_assert_eq!(tx_header.tx_id, 0);
229        match tx_header.ordinal {
230            _ => Err(fidl::Error::UnknownOrdinal {
231                ordinal: tx_header.ordinal,
232                protocol_name: <ConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
233            }),
234        }
235    }
236}
237
238/// A Stream of incoming requests for fuchsia.wlan.device/Connector.
239pub struct ConnectorRequestStream {
240    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
241    is_terminated: bool,
242}
243
244impl std::marker::Unpin for ConnectorRequestStream {}
245
246impl futures::stream::FusedStream for ConnectorRequestStream {
247    fn is_terminated(&self) -> bool {
248        self.is_terminated
249    }
250}
251
252impl fidl::endpoints::RequestStream for ConnectorRequestStream {
253    type Protocol = ConnectorMarker;
254    type ControlHandle = ConnectorControlHandle;
255
256    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
257        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
258    }
259
260    fn control_handle(&self) -> Self::ControlHandle {
261        ConnectorControlHandle { inner: self.inner.clone() }
262    }
263
264    fn into_inner(
265        self,
266    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
267    {
268        (self.inner, self.is_terminated)
269    }
270
271    fn from_inner(
272        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
273        is_terminated: bool,
274    ) -> Self {
275        Self { inner, is_terminated }
276    }
277}
278
279impl futures::Stream for ConnectorRequestStream {
280    type Item = Result<ConnectorRequest, fidl::Error>;
281
282    fn poll_next(
283        mut self: std::pin::Pin<&mut Self>,
284        cx: &mut std::task::Context<'_>,
285    ) -> std::task::Poll<Option<Self::Item>> {
286        let this = &mut *self;
287        if this.inner.check_shutdown(cx) {
288            this.is_terminated = true;
289            return std::task::Poll::Ready(None);
290        }
291        if this.is_terminated {
292            panic!("polled ConnectorRequestStream after completion");
293        }
294        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
295            |bytes, handles| {
296                match this.inner.channel().read_etc(cx, bytes, handles) {
297                    std::task::Poll::Ready(Ok(())) => {}
298                    std::task::Poll::Pending => return std::task::Poll::Pending,
299                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
300                        this.is_terminated = true;
301                        return std::task::Poll::Ready(None);
302                    }
303                    std::task::Poll::Ready(Err(e)) => {
304                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
305                            e.into(),
306                        ))));
307                    }
308                }
309
310                // A message has been received from the channel
311                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
312
313                std::task::Poll::Ready(Some(match header.ordinal {
314                    0x2dd039e4ba3a4d26 => {
315                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
316                        let mut req = fidl::new_empty!(
317                            ConnectorConnectRequest,
318                            fidl::encoding::DefaultFuchsiaResourceDialect
319                        );
320                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
321                        let control_handle = ConnectorControlHandle { inner: this.inner.clone() };
322                        Ok(ConnectorRequest::Connect { request: req.request, control_handle })
323                    }
324                    _ => Err(fidl::Error::UnknownOrdinal {
325                        ordinal: header.ordinal,
326                        protocol_name:
327                            <ConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
328                    }),
329                }))
330            },
331        )
332    }
333}
334
335/// This protocol is used to connect to the real Phy protocol underlying this device.
336#[derive(Debug)]
337pub enum ConnectorRequest {
338    Connect {
339        request: fidl::endpoints::ServerEnd<PhyMarker>,
340        control_handle: ConnectorControlHandle,
341    },
342}
343
344impl ConnectorRequest {
345    #[allow(irrefutable_let_patterns)]
346    pub fn into_connect(
347        self,
348    ) -> Option<(fidl::endpoints::ServerEnd<PhyMarker>, ConnectorControlHandle)> {
349        if let ConnectorRequest::Connect { request, control_handle } = self {
350            Some((request, control_handle))
351        } else {
352            None
353        }
354    }
355
356    /// Name of the method defined in FIDL
357    pub fn method_name(&self) -> &'static str {
358        match *self {
359            ConnectorRequest::Connect { .. } => "connect",
360        }
361    }
362}
363
364#[derive(Debug, Clone)]
365pub struct ConnectorControlHandle {
366    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
367}
368
369impl fidl::endpoints::ControlHandle for ConnectorControlHandle {
370    fn shutdown(&self) {
371        self.inner.shutdown()
372    }
373    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
374        self.inner.shutdown_with_epitaph(status)
375    }
376
377    fn is_closed(&self) -> bool {
378        self.inner.channel().is_closed()
379    }
380    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
381        self.inner.channel().on_closed()
382    }
383
384    #[cfg(target_os = "fuchsia")]
385    fn signal_peer(
386        &self,
387        clear_mask: zx::Signals,
388        set_mask: zx::Signals,
389    ) -> Result<(), zx_status::Status> {
390        use fidl::Peered;
391        self.inner.channel().signal_peer(clear_mask, set_mask)
392    }
393}
394
395impl ConnectorControlHandle {}
396
397#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
398pub struct PhyMarker;
399
400impl fidl::endpoints::ProtocolMarker for PhyMarker {
401    type Proxy = PhyProxy;
402    type RequestStream = PhyRequestStream;
403    #[cfg(target_os = "fuchsia")]
404    type SynchronousProxy = PhySynchronousProxy;
405
406    const DEBUG_NAME: &'static str = "(anonymous) Phy";
407}
408pub type PhyGetSupportedMacRolesResult = Result<Vec<fidl_fuchsia_wlan_common::WlanMacRole>, i32>;
409pub type PhyCreateIfaceResult = Result<u16, i32>;
410pub type PhyDestroyIfaceResult = Result<(), i32>;
411pub type PhyGetCountryResult = Result<CountryCode, i32>;
412pub type PhyGetPowerSaveModeResult = Result<fidl_fuchsia_wlan_common::PowerSaveType, i32>;
413pub type PhyPowerDownResult = Result<(), i32>;
414pub type PhyPowerUpResult = Result<(), i32>;
415pub type PhyResetResult = Result<(), i32>;
416pub type PhyGetPowerStateResult = Result<bool, i32>;
417
418pub trait PhyProxyInterface: Send + Sync {
419    type GetSupportedMacRolesResponseFut: std::future::Future<Output = Result<PhyGetSupportedMacRolesResult, fidl::Error>>
420        + Send;
421    fn r#get_supported_mac_roles(&self) -> Self::GetSupportedMacRolesResponseFut;
422    type CreateIfaceResponseFut: std::future::Future<Output = Result<PhyCreateIfaceResult, fidl::Error>>
423        + Send;
424    fn r#create_iface(&self, req: CreateIfaceRequest) -> Self::CreateIfaceResponseFut;
425    type DestroyIfaceResponseFut: std::future::Future<Output = Result<PhyDestroyIfaceResult, fidl::Error>>
426        + Send;
427    fn r#destroy_iface(&self, req: &DestroyIfaceRequest) -> Self::DestroyIfaceResponseFut;
428    type SetCountryResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
429    fn r#set_country(&self, req: &CountryCode) -> Self::SetCountryResponseFut;
430    type GetCountryResponseFut: std::future::Future<Output = Result<PhyGetCountryResult, fidl::Error>>
431        + Send;
432    fn r#get_country(&self) -> Self::GetCountryResponseFut;
433    type ClearCountryResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
434    fn r#clear_country(&self) -> Self::ClearCountryResponseFut;
435    type SetPowerSaveModeResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
436    fn r#set_power_save_mode(
437        &self,
438        req: fidl_fuchsia_wlan_common::PowerSaveType,
439    ) -> Self::SetPowerSaveModeResponseFut;
440    type GetPowerSaveModeResponseFut: std::future::Future<Output = Result<PhyGetPowerSaveModeResult, fidl::Error>>
441        + Send;
442    fn r#get_power_save_mode(&self) -> Self::GetPowerSaveModeResponseFut;
443    type PowerDownResponseFut: std::future::Future<Output = Result<PhyPowerDownResult, fidl::Error>>
444        + Send;
445    fn r#power_down(&self) -> Self::PowerDownResponseFut;
446    type PowerUpResponseFut: std::future::Future<Output = Result<PhyPowerUpResult, fidl::Error>>
447        + Send;
448    fn r#power_up(&self) -> Self::PowerUpResponseFut;
449    type ResetResponseFut: std::future::Future<Output = Result<PhyResetResult, fidl::Error>> + Send;
450    fn r#reset(&self) -> Self::ResetResponseFut;
451    type GetPowerStateResponseFut: std::future::Future<Output = Result<PhyGetPowerStateResult, fidl::Error>>
452        + Send;
453    fn r#get_power_state(&self) -> Self::GetPowerStateResponseFut;
454}
455#[derive(Debug)]
456#[cfg(target_os = "fuchsia")]
457pub struct PhySynchronousProxy {
458    client: fidl::client::sync::Client,
459}
460
461#[cfg(target_os = "fuchsia")]
462impl fidl::endpoints::SynchronousProxy for PhySynchronousProxy {
463    type Proxy = PhyProxy;
464    type Protocol = PhyMarker;
465
466    fn from_channel(inner: fidl::Channel) -> Self {
467        Self::new(inner)
468    }
469
470    fn into_channel(self) -> fidl::Channel {
471        self.client.into_channel()
472    }
473
474    fn as_channel(&self) -> &fidl::Channel {
475        self.client.as_channel()
476    }
477}
478
479#[cfg(target_os = "fuchsia")]
480impl PhySynchronousProxy {
481    pub fn new(channel: fidl::Channel) -> Self {
482        let protocol_name = <PhyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
483        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
484    }
485
486    pub fn into_channel(self) -> fidl::Channel {
487        self.client.into_channel()
488    }
489
490    /// Waits until an event arrives and returns it. It is safe for other
491    /// threads to make concurrent requests while waiting for an event.
492    pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<PhyEvent, fidl::Error> {
493        PhyEvent::decode(self.client.wait_for_event(deadline)?)
494    }
495
496    pub fn r#get_supported_mac_roles(
497        &self,
498        ___deadline: zx::MonotonicInstant,
499    ) -> Result<PhyGetSupportedMacRolesResult, fidl::Error> {
500        let _response = self.client.send_query::<
501            fidl::encoding::EmptyPayload,
502            fidl::encoding::ResultType<PhyGetSupportedMacRolesResponse, i32>,
503        >(
504            (),
505            0x18f6b9091aa8a44,
506            fidl::encoding::DynamicFlags::empty(),
507            ___deadline,
508        )?;
509        Ok(_response.map(|x| x.supported_mac_roles))
510    }
511
512    pub fn r#create_iface(
513        &self,
514        mut req: CreateIfaceRequest,
515        ___deadline: zx::MonotonicInstant,
516    ) -> Result<PhyCreateIfaceResult, fidl::Error> {
517        let _response = self.client.send_query::<
518            PhyCreateIfaceRequest,
519            fidl::encoding::ResultType<PhyCreateIfaceResponse, i32>,
520        >(
521            (&mut req,),
522            0x665940c7aa4b9785,
523            fidl::encoding::DynamicFlags::empty(),
524            ___deadline,
525        )?;
526        Ok(_response.map(|x| x.iface_id))
527    }
528
529    pub fn r#destroy_iface(
530        &self,
531        mut req: &DestroyIfaceRequest,
532        ___deadline: zx::MonotonicInstant,
533    ) -> Result<PhyDestroyIfaceResult, fidl::Error> {
534        let _response = self.client.send_query::<
535            PhyDestroyIfaceRequest,
536            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
537        >(
538            (req,),
539            0x75a3048ae01942e8,
540            fidl::encoding::DynamicFlags::empty(),
541            ___deadline,
542        )?;
543        Ok(_response.map(|x| x))
544    }
545
546    pub fn r#set_country(
547        &self,
548        mut req: &CountryCode,
549        ___deadline: zx::MonotonicInstant,
550    ) -> Result<i32, fidl::Error> {
551        let _response = self.client.send_query::<PhySetCountryRequest, PhySetCountryResponse>(
552            (req,),
553            0x1367e9997ba00806,
554            fidl::encoding::DynamicFlags::empty(),
555            ___deadline,
556        )?;
557        Ok(_response.status)
558    }
559
560    pub fn r#get_country(
561        &self,
562        ___deadline: zx::MonotonicInstant,
563    ) -> Result<PhyGetCountryResult, fidl::Error> {
564        let _response = self.client.send_query::<
565            fidl::encoding::EmptyPayload,
566            fidl::encoding::ResultType<PhyGetCountryResponse, i32>,
567        >(
568            (),
569            0x3ed3281ce6feab3e,
570            fidl::encoding::DynamicFlags::empty(),
571            ___deadline,
572        )?;
573        Ok(_response.map(|x| x.resp))
574    }
575
576    pub fn r#clear_country(&self, ___deadline: zx::MonotonicInstant) -> Result<i32, fidl::Error> {
577        let _response =
578            self.client.send_query::<fidl::encoding::EmptyPayload, PhyClearCountryResponse>(
579                (),
580                0x4ea9b83a9c494c95,
581                fidl::encoding::DynamicFlags::empty(),
582                ___deadline,
583            )?;
584        Ok(_response.status)
585    }
586
587    pub fn r#set_power_save_mode(
588        &self,
589        mut req: fidl_fuchsia_wlan_common::PowerSaveType,
590        ___deadline: zx::MonotonicInstant,
591    ) -> Result<i32, fidl::Error> {
592        let _response =
593            self.client.send_query::<PhySetPowerSaveModeRequest, PhySetPowerSaveModeResponse>(
594                (req,),
595                0x56be34b2f3abe17f,
596                fidl::encoding::DynamicFlags::empty(),
597                ___deadline,
598            )?;
599        Ok(_response.status)
600    }
601
602    pub fn r#get_power_save_mode(
603        &self,
604        ___deadline: zx::MonotonicInstant,
605    ) -> Result<PhyGetPowerSaveModeResult, fidl::Error> {
606        let _response = self.client.send_query::<
607            fidl::encoding::EmptyPayload,
608            fidl::encoding::ResultType<PhyGetPowerSaveModeResponse, i32>,
609        >(
610            (),
611            0x3f7019c3672bc798,
612            fidl::encoding::DynamicFlags::empty(),
613            ___deadline,
614        )?;
615        Ok(_response.map(|x| x.resp))
616    }
617
618    pub fn r#power_down(
619        &self,
620        ___deadline: zx::MonotonicInstant,
621    ) -> Result<PhyPowerDownResult, fidl::Error> {
622        let _response = self.client.send_query::<
623            fidl::encoding::EmptyPayload,
624            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
625        >(
626            (),
627            0x56bcae4b27a564d2,
628            fidl::encoding::DynamicFlags::empty(),
629            ___deadline,
630        )?;
631        Ok(_response.map(|x| x))
632    }
633
634    pub fn r#power_up(
635        &self,
636        ___deadline: zx::MonotonicInstant,
637    ) -> Result<PhyPowerUpResult, fidl::Error> {
638        let _response = self.client.send_query::<
639            fidl::encoding::EmptyPayload,
640            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
641        >(
642            (),
643            0x7aad8e525738b946,
644            fidl::encoding::DynamicFlags::empty(),
645            ___deadline,
646        )?;
647        Ok(_response.map(|x| x))
648    }
649
650    pub fn r#reset(
651        &self,
652        ___deadline: zx::MonotonicInstant,
653    ) -> Result<PhyResetResult, fidl::Error> {
654        let _response = self.client.send_query::<
655            fidl::encoding::EmptyPayload,
656            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
657        >(
658            (),
659            0x647cdcc9def3db87,
660            fidl::encoding::DynamicFlags::empty(),
661            ___deadline,
662        )?;
663        Ok(_response.map(|x| x))
664    }
665
666    pub fn r#get_power_state(
667        &self,
668        ___deadline: zx::MonotonicInstant,
669    ) -> Result<PhyGetPowerStateResult, fidl::Error> {
670        let _response = self.client.send_query::<
671            fidl::encoding::EmptyPayload,
672            fidl::encoding::ResultType<PhyGetPowerStateResponse, i32>,
673        >(
674            (),
675            0xcddef2b16c7f00f,
676            fidl::encoding::DynamicFlags::empty(),
677            ___deadline,
678        )?;
679        Ok(_response.map(|x| x.power_on))
680    }
681}
682
683#[cfg(target_os = "fuchsia")]
684impl From<PhySynchronousProxy> for zx::Handle {
685    fn from(value: PhySynchronousProxy) -> Self {
686        value.into_channel().into()
687    }
688}
689
690#[cfg(target_os = "fuchsia")]
691impl From<fidl::Channel> for PhySynchronousProxy {
692    fn from(value: fidl::Channel) -> Self {
693        Self::new(value)
694    }
695}
696
697#[cfg(target_os = "fuchsia")]
698impl fidl::endpoints::FromClient for PhySynchronousProxy {
699    type Protocol = PhyMarker;
700
701    fn from_client(value: fidl::endpoints::ClientEnd<PhyMarker>) -> Self {
702        Self::new(value.into_channel())
703    }
704}
705
706#[derive(Debug, Clone)]
707pub struct PhyProxy {
708    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
709}
710
711impl fidl::endpoints::Proxy for PhyProxy {
712    type Protocol = PhyMarker;
713
714    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
715        Self::new(inner)
716    }
717
718    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
719        self.client.into_channel().map_err(|client| Self { client })
720    }
721
722    fn as_channel(&self) -> &::fidl::AsyncChannel {
723        self.client.as_channel()
724    }
725}
726
727impl PhyProxy {
728    /// Create a new Proxy for fuchsia.wlan.device/Phy.
729    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
730        let protocol_name = <PhyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
731        Self { client: fidl::client::Client::new(channel, protocol_name) }
732    }
733
734    /// Get a Stream of events from the remote end of the protocol.
735    ///
736    /// # Panics
737    ///
738    /// Panics if the event stream was already taken.
739    pub fn take_event_stream(&self) -> PhyEventStream {
740        PhyEventStream { event_receiver: self.client.take_event_receiver() }
741    }
742
743    pub fn r#get_supported_mac_roles(
744        &self,
745    ) -> fidl::client::QueryResponseFut<
746        PhyGetSupportedMacRolesResult,
747        fidl::encoding::DefaultFuchsiaResourceDialect,
748    > {
749        PhyProxyInterface::r#get_supported_mac_roles(self)
750    }
751
752    pub fn r#create_iface(
753        &self,
754        mut req: CreateIfaceRequest,
755    ) -> fidl::client::QueryResponseFut<
756        PhyCreateIfaceResult,
757        fidl::encoding::DefaultFuchsiaResourceDialect,
758    > {
759        PhyProxyInterface::r#create_iface(self, req)
760    }
761
762    pub fn r#destroy_iface(
763        &self,
764        mut req: &DestroyIfaceRequest,
765    ) -> fidl::client::QueryResponseFut<
766        PhyDestroyIfaceResult,
767        fidl::encoding::DefaultFuchsiaResourceDialect,
768    > {
769        PhyProxyInterface::r#destroy_iface(self, req)
770    }
771
772    pub fn r#set_country(
773        &self,
774        mut req: &CountryCode,
775    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
776        PhyProxyInterface::r#set_country(self, req)
777    }
778
779    pub fn r#get_country(
780        &self,
781    ) -> fidl::client::QueryResponseFut<
782        PhyGetCountryResult,
783        fidl::encoding::DefaultFuchsiaResourceDialect,
784    > {
785        PhyProxyInterface::r#get_country(self)
786    }
787
788    pub fn r#clear_country(
789        &self,
790    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
791        PhyProxyInterface::r#clear_country(self)
792    }
793
794    pub fn r#set_power_save_mode(
795        &self,
796        mut req: fidl_fuchsia_wlan_common::PowerSaveType,
797    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
798        PhyProxyInterface::r#set_power_save_mode(self, req)
799    }
800
801    pub fn r#get_power_save_mode(
802        &self,
803    ) -> fidl::client::QueryResponseFut<
804        PhyGetPowerSaveModeResult,
805        fidl::encoding::DefaultFuchsiaResourceDialect,
806    > {
807        PhyProxyInterface::r#get_power_save_mode(self)
808    }
809
810    pub fn r#power_down(
811        &self,
812    ) -> fidl::client::QueryResponseFut<
813        PhyPowerDownResult,
814        fidl::encoding::DefaultFuchsiaResourceDialect,
815    > {
816        PhyProxyInterface::r#power_down(self)
817    }
818
819    pub fn r#power_up(
820        &self,
821    ) -> fidl::client::QueryResponseFut<
822        PhyPowerUpResult,
823        fidl::encoding::DefaultFuchsiaResourceDialect,
824    > {
825        PhyProxyInterface::r#power_up(self)
826    }
827
828    pub fn r#reset(
829        &self,
830    ) -> fidl::client::QueryResponseFut<PhyResetResult, fidl::encoding::DefaultFuchsiaResourceDialect>
831    {
832        PhyProxyInterface::r#reset(self)
833    }
834
835    pub fn r#get_power_state(
836        &self,
837    ) -> fidl::client::QueryResponseFut<
838        PhyGetPowerStateResult,
839        fidl::encoding::DefaultFuchsiaResourceDialect,
840    > {
841        PhyProxyInterface::r#get_power_state(self)
842    }
843}
844
845impl PhyProxyInterface for PhyProxy {
846    type GetSupportedMacRolesResponseFut = fidl::client::QueryResponseFut<
847        PhyGetSupportedMacRolesResult,
848        fidl::encoding::DefaultFuchsiaResourceDialect,
849    >;
850    fn r#get_supported_mac_roles(&self) -> Self::GetSupportedMacRolesResponseFut {
851        fn _decode(
852            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
853        ) -> Result<PhyGetSupportedMacRolesResult, fidl::Error> {
854            let _response = fidl::client::decode_transaction_body::<
855                fidl::encoding::ResultType<PhyGetSupportedMacRolesResponse, i32>,
856                fidl::encoding::DefaultFuchsiaResourceDialect,
857                0x18f6b9091aa8a44,
858            >(_buf?)?;
859            Ok(_response.map(|x| x.supported_mac_roles))
860        }
861        self.client
862            .send_query_and_decode::<fidl::encoding::EmptyPayload, PhyGetSupportedMacRolesResult>(
863                (),
864                0x18f6b9091aa8a44,
865                fidl::encoding::DynamicFlags::empty(),
866                _decode,
867            )
868    }
869
870    type CreateIfaceResponseFut = fidl::client::QueryResponseFut<
871        PhyCreateIfaceResult,
872        fidl::encoding::DefaultFuchsiaResourceDialect,
873    >;
874    fn r#create_iface(&self, mut req: CreateIfaceRequest) -> Self::CreateIfaceResponseFut {
875        fn _decode(
876            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
877        ) -> Result<PhyCreateIfaceResult, fidl::Error> {
878            let _response = fidl::client::decode_transaction_body::<
879                fidl::encoding::ResultType<PhyCreateIfaceResponse, i32>,
880                fidl::encoding::DefaultFuchsiaResourceDialect,
881                0x665940c7aa4b9785,
882            >(_buf?)?;
883            Ok(_response.map(|x| x.iface_id))
884        }
885        self.client.send_query_and_decode::<PhyCreateIfaceRequest, PhyCreateIfaceResult>(
886            (&mut req,),
887            0x665940c7aa4b9785,
888            fidl::encoding::DynamicFlags::empty(),
889            _decode,
890        )
891    }
892
893    type DestroyIfaceResponseFut = fidl::client::QueryResponseFut<
894        PhyDestroyIfaceResult,
895        fidl::encoding::DefaultFuchsiaResourceDialect,
896    >;
897    fn r#destroy_iface(&self, mut req: &DestroyIfaceRequest) -> Self::DestroyIfaceResponseFut {
898        fn _decode(
899            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
900        ) -> Result<PhyDestroyIfaceResult, fidl::Error> {
901            let _response = fidl::client::decode_transaction_body::<
902                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
903                fidl::encoding::DefaultFuchsiaResourceDialect,
904                0x75a3048ae01942e8,
905            >(_buf?)?;
906            Ok(_response.map(|x| x))
907        }
908        self.client.send_query_and_decode::<PhyDestroyIfaceRequest, PhyDestroyIfaceResult>(
909            (req,),
910            0x75a3048ae01942e8,
911            fidl::encoding::DynamicFlags::empty(),
912            _decode,
913        )
914    }
915
916    type SetCountryResponseFut =
917        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
918    fn r#set_country(&self, mut req: &CountryCode) -> Self::SetCountryResponseFut {
919        fn _decode(
920            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
921        ) -> Result<i32, fidl::Error> {
922            let _response = fidl::client::decode_transaction_body::<
923                PhySetCountryResponse,
924                fidl::encoding::DefaultFuchsiaResourceDialect,
925                0x1367e9997ba00806,
926            >(_buf?)?;
927            Ok(_response.status)
928        }
929        self.client.send_query_and_decode::<PhySetCountryRequest, i32>(
930            (req,),
931            0x1367e9997ba00806,
932            fidl::encoding::DynamicFlags::empty(),
933            _decode,
934        )
935    }
936
937    type GetCountryResponseFut = fidl::client::QueryResponseFut<
938        PhyGetCountryResult,
939        fidl::encoding::DefaultFuchsiaResourceDialect,
940    >;
941    fn r#get_country(&self) -> Self::GetCountryResponseFut {
942        fn _decode(
943            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
944        ) -> Result<PhyGetCountryResult, fidl::Error> {
945            let _response = fidl::client::decode_transaction_body::<
946                fidl::encoding::ResultType<PhyGetCountryResponse, i32>,
947                fidl::encoding::DefaultFuchsiaResourceDialect,
948                0x3ed3281ce6feab3e,
949            >(_buf?)?;
950            Ok(_response.map(|x| x.resp))
951        }
952        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PhyGetCountryResult>(
953            (),
954            0x3ed3281ce6feab3e,
955            fidl::encoding::DynamicFlags::empty(),
956            _decode,
957        )
958    }
959
960    type ClearCountryResponseFut =
961        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
962    fn r#clear_country(&self) -> Self::ClearCountryResponseFut {
963        fn _decode(
964            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
965        ) -> Result<i32, fidl::Error> {
966            let _response = fidl::client::decode_transaction_body::<
967                PhyClearCountryResponse,
968                fidl::encoding::DefaultFuchsiaResourceDialect,
969                0x4ea9b83a9c494c95,
970            >(_buf?)?;
971            Ok(_response.status)
972        }
973        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, i32>(
974            (),
975            0x4ea9b83a9c494c95,
976            fidl::encoding::DynamicFlags::empty(),
977            _decode,
978        )
979    }
980
981    type SetPowerSaveModeResponseFut =
982        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
983    fn r#set_power_save_mode(
984        &self,
985        mut req: fidl_fuchsia_wlan_common::PowerSaveType,
986    ) -> Self::SetPowerSaveModeResponseFut {
987        fn _decode(
988            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
989        ) -> Result<i32, fidl::Error> {
990            let _response = fidl::client::decode_transaction_body::<
991                PhySetPowerSaveModeResponse,
992                fidl::encoding::DefaultFuchsiaResourceDialect,
993                0x56be34b2f3abe17f,
994            >(_buf?)?;
995            Ok(_response.status)
996        }
997        self.client.send_query_and_decode::<PhySetPowerSaveModeRequest, i32>(
998            (req,),
999            0x56be34b2f3abe17f,
1000            fidl::encoding::DynamicFlags::empty(),
1001            _decode,
1002        )
1003    }
1004
1005    type GetPowerSaveModeResponseFut = fidl::client::QueryResponseFut<
1006        PhyGetPowerSaveModeResult,
1007        fidl::encoding::DefaultFuchsiaResourceDialect,
1008    >;
1009    fn r#get_power_save_mode(&self) -> Self::GetPowerSaveModeResponseFut {
1010        fn _decode(
1011            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1012        ) -> Result<PhyGetPowerSaveModeResult, fidl::Error> {
1013            let _response = fidl::client::decode_transaction_body::<
1014                fidl::encoding::ResultType<PhyGetPowerSaveModeResponse, i32>,
1015                fidl::encoding::DefaultFuchsiaResourceDialect,
1016                0x3f7019c3672bc798,
1017            >(_buf?)?;
1018            Ok(_response.map(|x| x.resp))
1019        }
1020        self.client
1021            .send_query_and_decode::<fidl::encoding::EmptyPayload, PhyGetPowerSaveModeResult>(
1022                (),
1023                0x3f7019c3672bc798,
1024                fidl::encoding::DynamicFlags::empty(),
1025                _decode,
1026            )
1027    }
1028
1029    type PowerDownResponseFut = fidl::client::QueryResponseFut<
1030        PhyPowerDownResult,
1031        fidl::encoding::DefaultFuchsiaResourceDialect,
1032    >;
1033    fn r#power_down(&self) -> Self::PowerDownResponseFut {
1034        fn _decode(
1035            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1036        ) -> Result<PhyPowerDownResult, fidl::Error> {
1037            let _response = fidl::client::decode_transaction_body::<
1038                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1039                fidl::encoding::DefaultFuchsiaResourceDialect,
1040                0x56bcae4b27a564d2,
1041            >(_buf?)?;
1042            Ok(_response.map(|x| x))
1043        }
1044        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PhyPowerDownResult>(
1045            (),
1046            0x56bcae4b27a564d2,
1047            fidl::encoding::DynamicFlags::empty(),
1048            _decode,
1049        )
1050    }
1051
1052    type PowerUpResponseFut = fidl::client::QueryResponseFut<
1053        PhyPowerUpResult,
1054        fidl::encoding::DefaultFuchsiaResourceDialect,
1055    >;
1056    fn r#power_up(&self) -> Self::PowerUpResponseFut {
1057        fn _decode(
1058            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1059        ) -> Result<PhyPowerUpResult, fidl::Error> {
1060            let _response = fidl::client::decode_transaction_body::<
1061                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1062                fidl::encoding::DefaultFuchsiaResourceDialect,
1063                0x7aad8e525738b946,
1064            >(_buf?)?;
1065            Ok(_response.map(|x| x))
1066        }
1067        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PhyPowerUpResult>(
1068            (),
1069            0x7aad8e525738b946,
1070            fidl::encoding::DynamicFlags::empty(),
1071            _decode,
1072        )
1073    }
1074
1075    type ResetResponseFut = fidl::client::QueryResponseFut<
1076        PhyResetResult,
1077        fidl::encoding::DefaultFuchsiaResourceDialect,
1078    >;
1079    fn r#reset(&self) -> Self::ResetResponseFut {
1080        fn _decode(
1081            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1082        ) -> Result<PhyResetResult, fidl::Error> {
1083            let _response = fidl::client::decode_transaction_body::<
1084                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1085                fidl::encoding::DefaultFuchsiaResourceDialect,
1086                0x647cdcc9def3db87,
1087            >(_buf?)?;
1088            Ok(_response.map(|x| x))
1089        }
1090        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PhyResetResult>(
1091            (),
1092            0x647cdcc9def3db87,
1093            fidl::encoding::DynamicFlags::empty(),
1094            _decode,
1095        )
1096    }
1097
1098    type GetPowerStateResponseFut = fidl::client::QueryResponseFut<
1099        PhyGetPowerStateResult,
1100        fidl::encoding::DefaultFuchsiaResourceDialect,
1101    >;
1102    fn r#get_power_state(&self) -> Self::GetPowerStateResponseFut {
1103        fn _decode(
1104            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1105        ) -> Result<PhyGetPowerStateResult, fidl::Error> {
1106            let _response = fidl::client::decode_transaction_body::<
1107                fidl::encoding::ResultType<PhyGetPowerStateResponse, i32>,
1108                fidl::encoding::DefaultFuchsiaResourceDialect,
1109                0xcddef2b16c7f00f,
1110            >(_buf?)?;
1111            Ok(_response.map(|x| x.power_on))
1112        }
1113        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PhyGetPowerStateResult>(
1114            (),
1115            0xcddef2b16c7f00f,
1116            fidl::encoding::DynamicFlags::empty(),
1117            _decode,
1118        )
1119    }
1120}
1121
1122pub struct PhyEventStream {
1123    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1124}
1125
1126impl std::marker::Unpin for PhyEventStream {}
1127
1128impl futures::stream::FusedStream for PhyEventStream {
1129    fn is_terminated(&self) -> bool {
1130        self.event_receiver.is_terminated()
1131    }
1132}
1133
1134impl futures::Stream for PhyEventStream {
1135    type Item = Result<PhyEvent, fidl::Error>;
1136
1137    fn poll_next(
1138        mut self: std::pin::Pin<&mut Self>,
1139        cx: &mut std::task::Context<'_>,
1140    ) -> std::task::Poll<Option<Self::Item>> {
1141        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1142            &mut self.event_receiver,
1143            cx
1144        )?) {
1145            Some(buf) => std::task::Poll::Ready(Some(PhyEvent::decode(buf))),
1146            None => std::task::Poll::Ready(None),
1147        }
1148    }
1149}
1150
1151#[derive(Debug)]
1152pub enum PhyEvent {}
1153
1154impl PhyEvent {
1155    /// Decodes a message buffer as a [`PhyEvent`].
1156    fn decode(
1157        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1158    ) -> Result<PhyEvent, fidl::Error> {
1159        let (bytes, _handles) = buf.split_mut();
1160        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1161        debug_assert_eq!(tx_header.tx_id, 0);
1162        match tx_header.ordinal {
1163            _ => Err(fidl::Error::UnknownOrdinal {
1164                ordinal: tx_header.ordinal,
1165                protocol_name: <PhyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1166            }),
1167        }
1168    }
1169}
1170
1171/// A Stream of incoming requests for fuchsia.wlan.device/Phy.
1172pub struct PhyRequestStream {
1173    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1174    is_terminated: bool,
1175}
1176
1177impl std::marker::Unpin for PhyRequestStream {}
1178
1179impl futures::stream::FusedStream for PhyRequestStream {
1180    fn is_terminated(&self) -> bool {
1181        self.is_terminated
1182    }
1183}
1184
1185impl fidl::endpoints::RequestStream for PhyRequestStream {
1186    type Protocol = PhyMarker;
1187    type ControlHandle = PhyControlHandle;
1188
1189    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1190        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1191    }
1192
1193    fn control_handle(&self) -> Self::ControlHandle {
1194        PhyControlHandle { inner: self.inner.clone() }
1195    }
1196
1197    fn into_inner(
1198        self,
1199    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1200    {
1201        (self.inner, self.is_terminated)
1202    }
1203
1204    fn from_inner(
1205        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1206        is_terminated: bool,
1207    ) -> Self {
1208        Self { inner, is_terminated }
1209    }
1210}
1211
1212impl futures::Stream for PhyRequestStream {
1213    type Item = Result<PhyRequest, fidl::Error>;
1214
1215    fn poll_next(
1216        mut self: std::pin::Pin<&mut Self>,
1217        cx: &mut std::task::Context<'_>,
1218    ) -> std::task::Poll<Option<Self::Item>> {
1219        let this = &mut *self;
1220        if this.inner.check_shutdown(cx) {
1221            this.is_terminated = true;
1222            return std::task::Poll::Ready(None);
1223        }
1224        if this.is_terminated {
1225            panic!("polled PhyRequestStream after completion");
1226        }
1227        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1228            |bytes, handles| {
1229                match this.inner.channel().read_etc(cx, bytes, handles) {
1230                    std::task::Poll::Ready(Ok(())) => {}
1231                    std::task::Poll::Pending => return std::task::Poll::Pending,
1232                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1233                        this.is_terminated = true;
1234                        return std::task::Poll::Ready(None);
1235                    }
1236                    std::task::Poll::Ready(Err(e)) => {
1237                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1238                            e.into(),
1239                        ))));
1240                    }
1241                }
1242
1243                // A message has been received from the channel
1244                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1245
1246                std::task::Poll::Ready(Some(match header.ordinal {
1247                    0x18f6b9091aa8a44 => {
1248                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1249                        let mut req = fidl::new_empty!(
1250                            fidl::encoding::EmptyPayload,
1251                            fidl::encoding::DefaultFuchsiaResourceDialect
1252                        );
1253                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1254                        let control_handle = PhyControlHandle { inner: this.inner.clone() };
1255                        Ok(PhyRequest::GetSupportedMacRoles {
1256                            responder: PhyGetSupportedMacRolesResponder {
1257                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1258                                tx_id: header.tx_id,
1259                            },
1260                        })
1261                    }
1262                    0x665940c7aa4b9785 => {
1263                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1264                        let mut req = fidl::new_empty!(
1265                            PhyCreateIfaceRequest,
1266                            fidl::encoding::DefaultFuchsiaResourceDialect
1267                        );
1268                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PhyCreateIfaceRequest>(&header, _body_bytes, handles, &mut req)?;
1269                        let control_handle = PhyControlHandle { inner: this.inner.clone() };
1270                        Ok(PhyRequest::CreateIface {
1271                            req: req.req,
1272
1273                            responder: PhyCreateIfaceResponder {
1274                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1275                                tx_id: header.tx_id,
1276                            },
1277                        })
1278                    }
1279                    0x75a3048ae01942e8 => {
1280                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1281                        let mut req = fidl::new_empty!(
1282                            PhyDestroyIfaceRequest,
1283                            fidl::encoding::DefaultFuchsiaResourceDialect
1284                        );
1285                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PhyDestroyIfaceRequest>(&header, _body_bytes, handles, &mut req)?;
1286                        let control_handle = PhyControlHandle { inner: this.inner.clone() };
1287                        Ok(PhyRequest::DestroyIface {
1288                            req: req.req,
1289
1290                            responder: PhyDestroyIfaceResponder {
1291                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1292                                tx_id: header.tx_id,
1293                            },
1294                        })
1295                    }
1296                    0x1367e9997ba00806 => {
1297                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1298                        let mut req = fidl::new_empty!(
1299                            PhySetCountryRequest,
1300                            fidl::encoding::DefaultFuchsiaResourceDialect
1301                        );
1302                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PhySetCountryRequest>(&header, _body_bytes, handles, &mut req)?;
1303                        let control_handle = PhyControlHandle { inner: this.inner.clone() };
1304                        Ok(PhyRequest::SetCountry {
1305                            req: req.req,
1306
1307                            responder: PhySetCountryResponder {
1308                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1309                                tx_id: header.tx_id,
1310                            },
1311                        })
1312                    }
1313                    0x3ed3281ce6feab3e => {
1314                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1315                        let mut req = fidl::new_empty!(
1316                            fidl::encoding::EmptyPayload,
1317                            fidl::encoding::DefaultFuchsiaResourceDialect
1318                        );
1319                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1320                        let control_handle = PhyControlHandle { inner: this.inner.clone() };
1321                        Ok(PhyRequest::GetCountry {
1322                            responder: PhyGetCountryResponder {
1323                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1324                                tx_id: header.tx_id,
1325                            },
1326                        })
1327                    }
1328                    0x4ea9b83a9c494c95 => {
1329                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1330                        let mut req = fidl::new_empty!(
1331                            fidl::encoding::EmptyPayload,
1332                            fidl::encoding::DefaultFuchsiaResourceDialect
1333                        );
1334                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1335                        let control_handle = PhyControlHandle { inner: this.inner.clone() };
1336                        Ok(PhyRequest::ClearCountry {
1337                            responder: PhyClearCountryResponder {
1338                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1339                                tx_id: header.tx_id,
1340                            },
1341                        })
1342                    }
1343                    0x56be34b2f3abe17f => {
1344                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1345                        let mut req = fidl::new_empty!(
1346                            PhySetPowerSaveModeRequest,
1347                            fidl::encoding::DefaultFuchsiaResourceDialect
1348                        );
1349                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PhySetPowerSaveModeRequest>(&header, _body_bytes, handles, &mut req)?;
1350                        let control_handle = PhyControlHandle { inner: this.inner.clone() };
1351                        Ok(PhyRequest::SetPowerSaveMode {
1352                            req: req.req,
1353
1354                            responder: PhySetPowerSaveModeResponder {
1355                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1356                                tx_id: header.tx_id,
1357                            },
1358                        })
1359                    }
1360                    0x3f7019c3672bc798 => {
1361                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1362                        let mut req = fidl::new_empty!(
1363                            fidl::encoding::EmptyPayload,
1364                            fidl::encoding::DefaultFuchsiaResourceDialect
1365                        );
1366                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1367                        let control_handle = PhyControlHandle { inner: this.inner.clone() };
1368                        Ok(PhyRequest::GetPowerSaveMode {
1369                            responder: PhyGetPowerSaveModeResponder {
1370                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1371                                tx_id: header.tx_id,
1372                            },
1373                        })
1374                    }
1375                    0x56bcae4b27a564d2 => {
1376                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1377                        let mut req = fidl::new_empty!(
1378                            fidl::encoding::EmptyPayload,
1379                            fidl::encoding::DefaultFuchsiaResourceDialect
1380                        );
1381                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1382                        let control_handle = PhyControlHandle { inner: this.inner.clone() };
1383                        Ok(PhyRequest::PowerDown {
1384                            responder: PhyPowerDownResponder {
1385                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1386                                tx_id: header.tx_id,
1387                            },
1388                        })
1389                    }
1390                    0x7aad8e525738b946 => {
1391                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1392                        let mut req = fidl::new_empty!(
1393                            fidl::encoding::EmptyPayload,
1394                            fidl::encoding::DefaultFuchsiaResourceDialect
1395                        );
1396                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1397                        let control_handle = PhyControlHandle { inner: this.inner.clone() };
1398                        Ok(PhyRequest::PowerUp {
1399                            responder: PhyPowerUpResponder {
1400                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1401                                tx_id: header.tx_id,
1402                            },
1403                        })
1404                    }
1405                    0x647cdcc9def3db87 => {
1406                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1407                        let mut req = fidl::new_empty!(
1408                            fidl::encoding::EmptyPayload,
1409                            fidl::encoding::DefaultFuchsiaResourceDialect
1410                        );
1411                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1412                        let control_handle = PhyControlHandle { inner: this.inner.clone() };
1413                        Ok(PhyRequest::Reset {
1414                            responder: PhyResetResponder {
1415                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1416                                tx_id: header.tx_id,
1417                            },
1418                        })
1419                    }
1420                    0xcddef2b16c7f00f => {
1421                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1422                        let mut req = fidl::new_empty!(
1423                            fidl::encoding::EmptyPayload,
1424                            fidl::encoding::DefaultFuchsiaResourceDialect
1425                        );
1426                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1427                        let control_handle = PhyControlHandle { inner: this.inner.clone() };
1428                        Ok(PhyRequest::GetPowerState {
1429                            responder: PhyGetPowerStateResponder {
1430                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1431                                tx_id: header.tx_id,
1432                            },
1433                        })
1434                    }
1435                    _ => Err(fidl::Error::UnknownOrdinal {
1436                        ordinal: header.ordinal,
1437                        protocol_name: <PhyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1438                    }),
1439                }))
1440            },
1441        )
1442    }
1443}
1444
1445#[derive(Debug)]
1446pub enum PhyRequest {
1447    GetSupportedMacRoles {
1448        responder: PhyGetSupportedMacRolesResponder,
1449    },
1450    CreateIface {
1451        req: CreateIfaceRequest,
1452        responder: PhyCreateIfaceResponder,
1453    },
1454    DestroyIface {
1455        req: DestroyIfaceRequest,
1456        responder: PhyDestroyIfaceResponder,
1457    },
1458    SetCountry {
1459        req: CountryCode,
1460        responder: PhySetCountryResponder,
1461    },
1462    GetCountry {
1463        responder: PhyGetCountryResponder,
1464    },
1465    ClearCountry {
1466        responder: PhyClearCountryResponder,
1467    },
1468    SetPowerSaveMode {
1469        req: fidl_fuchsia_wlan_common::PowerSaveType,
1470        responder: PhySetPowerSaveModeResponder,
1471    },
1472    GetPowerSaveMode {
1473        responder: PhyGetPowerSaveModeResponder,
1474    },
1475    PowerDown {
1476        responder: PhyPowerDownResponder,
1477    },
1478    PowerUp {
1479        responder: PhyPowerUpResponder,
1480    },
1481    Reset {
1482        responder: PhyResetResponder,
1483    },
1484    GetPowerState {
1485        responder: PhyGetPowerStateResponder,
1486    },
1487}
1488
1489impl PhyRequest {
1490    #[allow(irrefutable_let_patterns)]
1491    pub fn into_get_supported_mac_roles(self) -> Option<(PhyGetSupportedMacRolesResponder)> {
1492        if let PhyRequest::GetSupportedMacRoles { responder } = self {
1493            Some((responder))
1494        } else {
1495            None
1496        }
1497    }
1498
1499    #[allow(irrefutable_let_patterns)]
1500    pub fn into_create_iface(self) -> Option<(CreateIfaceRequest, PhyCreateIfaceResponder)> {
1501        if let PhyRequest::CreateIface { req, responder } = self {
1502            Some((req, responder))
1503        } else {
1504            None
1505        }
1506    }
1507
1508    #[allow(irrefutable_let_patterns)]
1509    pub fn into_destroy_iface(self) -> Option<(DestroyIfaceRequest, PhyDestroyIfaceResponder)> {
1510        if let PhyRequest::DestroyIface { req, responder } = self {
1511            Some((req, responder))
1512        } else {
1513            None
1514        }
1515    }
1516
1517    #[allow(irrefutable_let_patterns)]
1518    pub fn into_set_country(self) -> Option<(CountryCode, PhySetCountryResponder)> {
1519        if let PhyRequest::SetCountry { req, responder } = self {
1520            Some((req, responder))
1521        } else {
1522            None
1523        }
1524    }
1525
1526    #[allow(irrefutable_let_patterns)]
1527    pub fn into_get_country(self) -> Option<(PhyGetCountryResponder)> {
1528        if let PhyRequest::GetCountry { responder } = self { Some((responder)) } else { None }
1529    }
1530
1531    #[allow(irrefutable_let_patterns)]
1532    pub fn into_clear_country(self) -> Option<(PhyClearCountryResponder)> {
1533        if let PhyRequest::ClearCountry { responder } = self { Some((responder)) } else { None }
1534    }
1535
1536    #[allow(irrefutable_let_patterns)]
1537    pub fn into_set_power_save_mode(
1538        self,
1539    ) -> Option<(fidl_fuchsia_wlan_common::PowerSaveType, PhySetPowerSaveModeResponder)> {
1540        if let PhyRequest::SetPowerSaveMode { req, responder } = self {
1541            Some((req, responder))
1542        } else {
1543            None
1544        }
1545    }
1546
1547    #[allow(irrefutable_let_patterns)]
1548    pub fn into_get_power_save_mode(self) -> Option<(PhyGetPowerSaveModeResponder)> {
1549        if let PhyRequest::GetPowerSaveMode { responder } = self { Some((responder)) } else { None }
1550    }
1551
1552    #[allow(irrefutable_let_patterns)]
1553    pub fn into_power_down(self) -> Option<(PhyPowerDownResponder)> {
1554        if let PhyRequest::PowerDown { responder } = self { Some((responder)) } else { None }
1555    }
1556
1557    #[allow(irrefutable_let_patterns)]
1558    pub fn into_power_up(self) -> Option<(PhyPowerUpResponder)> {
1559        if let PhyRequest::PowerUp { responder } = self { Some((responder)) } else { None }
1560    }
1561
1562    #[allow(irrefutable_let_patterns)]
1563    pub fn into_reset(self) -> Option<(PhyResetResponder)> {
1564        if let PhyRequest::Reset { responder } = self { Some((responder)) } else { None }
1565    }
1566
1567    #[allow(irrefutable_let_patterns)]
1568    pub fn into_get_power_state(self) -> Option<(PhyGetPowerStateResponder)> {
1569        if let PhyRequest::GetPowerState { responder } = self { Some((responder)) } else { None }
1570    }
1571
1572    /// Name of the method defined in FIDL
1573    pub fn method_name(&self) -> &'static str {
1574        match *self {
1575            PhyRequest::GetSupportedMacRoles { .. } => "get_supported_mac_roles",
1576            PhyRequest::CreateIface { .. } => "create_iface",
1577            PhyRequest::DestroyIface { .. } => "destroy_iface",
1578            PhyRequest::SetCountry { .. } => "set_country",
1579            PhyRequest::GetCountry { .. } => "get_country",
1580            PhyRequest::ClearCountry { .. } => "clear_country",
1581            PhyRequest::SetPowerSaveMode { .. } => "set_power_save_mode",
1582            PhyRequest::GetPowerSaveMode { .. } => "get_power_save_mode",
1583            PhyRequest::PowerDown { .. } => "power_down",
1584            PhyRequest::PowerUp { .. } => "power_up",
1585            PhyRequest::Reset { .. } => "reset",
1586            PhyRequest::GetPowerState { .. } => "get_power_state",
1587        }
1588    }
1589}
1590
1591#[derive(Debug, Clone)]
1592pub struct PhyControlHandle {
1593    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1594}
1595
1596impl fidl::endpoints::ControlHandle for PhyControlHandle {
1597    fn shutdown(&self) {
1598        self.inner.shutdown()
1599    }
1600    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1601        self.inner.shutdown_with_epitaph(status)
1602    }
1603
1604    fn is_closed(&self) -> bool {
1605        self.inner.channel().is_closed()
1606    }
1607    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1608        self.inner.channel().on_closed()
1609    }
1610
1611    #[cfg(target_os = "fuchsia")]
1612    fn signal_peer(
1613        &self,
1614        clear_mask: zx::Signals,
1615        set_mask: zx::Signals,
1616    ) -> Result<(), zx_status::Status> {
1617        use fidl::Peered;
1618        self.inner.channel().signal_peer(clear_mask, set_mask)
1619    }
1620}
1621
1622impl PhyControlHandle {}
1623
1624#[must_use = "FIDL methods require a response to be sent"]
1625#[derive(Debug)]
1626pub struct PhyGetSupportedMacRolesResponder {
1627    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
1628    tx_id: u32,
1629}
1630
1631/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
1632/// if the responder is dropped without sending a response, so that the client
1633/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1634impl std::ops::Drop for PhyGetSupportedMacRolesResponder {
1635    fn drop(&mut self) {
1636        self.control_handle.shutdown();
1637        // Safety: drops once, never accessed again
1638        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1639    }
1640}
1641
1642impl fidl::endpoints::Responder for PhyGetSupportedMacRolesResponder {
1643    type ControlHandle = PhyControlHandle;
1644
1645    fn control_handle(&self) -> &PhyControlHandle {
1646        &self.control_handle
1647    }
1648
1649    fn drop_without_shutdown(mut self) {
1650        // Safety: drops once, never accessed again due to mem::forget
1651        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1652        // Prevent Drop from running (which would shut down the channel)
1653        std::mem::forget(self);
1654    }
1655}
1656
1657impl PhyGetSupportedMacRolesResponder {
1658    /// Sends a response to the FIDL transaction.
1659    ///
1660    /// Sets the channel to shutdown if an error occurs.
1661    pub fn send(
1662        self,
1663        mut result: Result<&[fidl_fuchsia_wlan_common::WlanMacRole], i32>,
1664    ) -> Result<(), fidl::Error> {
1665        let _result = self.send_raw(result);
1666        if _result.is_err() {
1667            self.control_handle.shutdown();
1668        }
1669        self.drop_without_shutdown();
1670        _result
1671    }
1672
1673    /// Similar to "send" but does not shutdown the channel if an error occurs.
1674    pub fn send_no_shutdown_on_err(
1675        self,
1676        mut result: Result<&[fidl_fuchsia_wlan_common::WlanMacRole], i32>,
1677    ) -> Result<(), fidl::Error> {
1678        let _result = self.send_raw(result);
1679        self.drop_without_shutdown();
1680        _result
1681    }
1682
1683    fn send_raw(
1684        &self,
1685        mut result: Result<&[fidl_fuchsia_wlan_common::WlanMacRole], i32>,
1686    ) -> Result<(), fidl::Error> {
1687        self.control_handle
1688            .inner
1689            .send::<fidl::encoding::ResultType<PhyGetSupportedMacRolesResponse, i32>>(
1690                result.map(|supported_mac_roles| (supported_mac_roles,)),
1691                self.tx_id,
1692                0x18f6b9091aa8a44,
1693                fidl::encoding::DynamicFlags::empty(),
1694            )
1695    }
1696}
1697
1698#[must_use = "FIDL methods require a response to be sent"]
1699#[derive(Debug)]
1700pub struct PhyCreateIfaceResponder {
1701    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
1702    tx_id: u32,
1703}
1704
1705/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
1706/// if the responder is dropped without sending a response, so that the client
1707/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1708impl std::ops::Drop for PhyCreateIfaceResponder {
1709    fn drop(&mut self) {
1710        self.control_handle.shutdown();
1711        // Safety: drops once, never accessed again
1712        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1713    }
1714}
1715
1716impl fidl::endpoints::Responder for PhyCreateIfaceResponder {
1717    type ControlHandle = PhyControlHandle;
1718
1719    fn control_handle(&self) -> &PhyControlHandle {
1720        &self.control_handle
1721    }
1722
1723    fn drop_without_shutdown(mut self) {
1724        // Safety: drops once, never accessed again due to mem::forget
1725        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1726        // Prevent Drop from running (which would shut down the channel)
1727        std::mem::forget(self);
1728    }
1729}
1730
1731impl PhyCreateIfaceResponder {
1732    /// Sends a response to the FIDL transaction.
1733    ///
1734    /// Sets the channel to shutdown if an error occurs.
1735    pub fn send(self, mut result: Result<u16, i32>) -> Result<(), fidl::Error> {
1736        let _result = self.send_raw(result);
1737        if _result.is_err() {
1738            self.control_handle.shutdown();
1739        }
1740        self.drop_without_shutdown();
1741        _result
1742    }
1743
1744    /// Similar to "send" but does not shutdown the channel if an error occurs.
1745    pub fn send_no_shutdown_on_err(self, mut result: Result<u16, i32>) -> Result<(), fidl::Error> {
1746        let _result = self.send_raw(result);
1747        self.drop_without_shutdown();
1748        _result
1749    }
1750
1751    fn send_raw(&self, mut result: Result<u16, i32>) -> Result<(), fidl::Error> {
1752        self.control_handle.inner.send::<fidl::encoding::ResultType<PhyCreateIfaceResponse, i32>>(
1753            result.map(|iface_id| (iface_id,)),
1754            self.tx_id,
1755            0x665940c7aa4b9785,
1756            fidl::encoding::DynamicFlags::empty(),
1757        )
1758    }
1759}
1760
1761#[must_use = "FIDL methods require a response to be sent"]
1762#[derive(Debug)]
1763pub struct PhyDestroyIfaceResponder {
1764    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
1765    tx_id: u32,
1766}
1767
1768/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
1769/// if the responder is dropped without sending a response, so that the client
1770/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1771impl std::ops::Drop for PhyDestroyIfaceResponder {
1772    fn drop(&mut self) {
1773        self.control_handle.shutdown();
1774        // Safety: drops once, never accessed again
1775        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1776    }
1777}
1778
1779impl fidl::endpoints::Responder for PhyDestroyIfaceResponder {
1780    type ControlHandle = PhyControlHandle;
1781
1782    fn control_handle(&self) -> &PhyControlHandle {
1783        &self.control_handle
1784    }
1785
1786    fn drop_without_shutdown(mut self) {
1787        // Safety: drops once, never accessed again due to mem::forget
1788        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1789        // Prevent Drop from running (which would shut down the channel)
1790        std::mem::forget(self);
1791    }
1792}
1793
1794impl PhyDestroyIfaceResponder {
1795    /// Sends a response to the FIDL transaction.
1796    ///
1797    /// Sets the channel to shutdown if an error occurs.
1798    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1799        let _result = self.send_raw(result);
1800        if _result.is_err() {
1801            self.control_handle.shutdown();
1802        }
1803        self.drop_without_shutdown();
1804        _result
1805    }
1806
1807    /// Similar to "send" but does not shutdown the channel if an error occurs.
1808    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1809        let _result = self.send_raw(result);
1810        self.drop_without_shutdown();
1811        _result
1812    }
1813
1814    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1815        self.control_handle
1816            .inner
1817            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1818                result,
1819                self.tx_id,
1820                0x75a3048ae01942e8,
1821                fidl::encoding::DynamicFlags::empty(),
1822            )
1823    }
1824}
1825
1826#[must_use = "FIDL methods require a response to be sent"]
1827#[derive(Debug)]
1828pub struct PhySetCountryResponder {
1829    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
1830    tx_id: u32,
1831}
1832
1833/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
1834/// if the responder is dropped without sending a response, so that the client
1835/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1836impl std::ops::Drop for PhySetCountryResponder {
1837    fn drop(&mut self) {
1838        self.control_handle.shutdown();
1839        // Safety: drops once, never accessed again
1840        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1841    }
1842}
1843
1844impl fidl::endpoints::Responder for PhySetCountryResponder {
1845    type ControlHandle = PhyControlHandle;
1846
1847    fn control_handle(&self) -> &PhyControlHandle {
1848        &self.control_handle
1849    }
1850
1851    fn drop_without_shutdown(mut self) {
1852        // Safety: drops once, never accessed again due to mem::forget
1853        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1854        // Prevent Drop from running (which would shut down the channel)
1855        std::mem::forget(self);
1856    }
1857}
1858
1859impl PhySetCountryResponder {
1860    /// Sends a response to the FIDL transaction.
1861    ///
1862    /// Sets the channel to shutdown if an error occurs.
1863    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1864        let _result = self.send_raw(status);
1865        if _result.is_err() {
1866            self.control_handle.shutdown();
1867        }
1868        self.drop_without_shutdown();
1869        _result
1870    }
1871
1872    /// Similar to "send" but does not shutdown the channel if an error occurs.
1873    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1874        let _result = self.send_raw(status);
1875        self.drop_without_shutdown();
1876        _result
1877    }
1878
1879    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1880        self.control_handle.inner.send::<PhySetCountryResponse>(
1881            (status,),
1882            self.tx_id,
1883            0x1367e9997ba00806,
1884            fidl::encoding::DynamicFlags::empty(),
1885        )
1886    }
1887}
1888
1889#[must_use = "FIDL methods require a response to be sent"]
1890#[derive(Debug)]
1891pub struct PhyGetCountryResponder {
1892    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
1893    tx_id: u32,
1894}
1895
1896/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
1897/// if the responder is dropped without sending a response, so that the client
1898/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1899impl std::ops::Drop for PhyGetCountryResponder {
1900    fn drop(&mut self) {
1901        self.control_handle.shutdown();
1902        // Safety: drops once, never accessed again
1903        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1904    }
1905}
1906
1907impl fidl::endpoints::Responder for PhyGetCountryResponder {
1908    type ControlHandle = PhyControlHandle;
1909
1910    fn control_handle(&self) -> &PhyControlHandle {
1911        &self.control_handle
1912    }
1913
1914    fn drop_without_shutdown(mut self) {
1915        // Safety: drops once, never accessed again due to mem::forget
1916        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1917        // Prevent Drop from running (which would shut down the channel)
1918        std::mem::forget(self);
1919    }
1920}
1921
1922impl PhyGetCountryResponder {
1923    /// Sends a response to the FIDL transaction.
1924    ///
1925    /// Sets the channel to shutdown if an error occurs.
1926    pub fn send(self, mut result: Result<&CountryCode, i32>) -> Result<(), fidl::Error> {
1927        let _result = self.send_raw(result);
1928        if _result.is_err() {
1929            self.control_handle.shutdown();
1930        }
1931        self.drop_without_shutdown();
1932        _result
1933    }
1934
1935    /// Similar to "send" but does not shutdown the channel if an error occurs.
1936    pub fn send_no_shutdown_on_err(
1937        self,
1938        mut result: Result<&CountryCode, i32>,
1939    ) -> Result<(), fidl::Error> {
1940        let _result = self.send_raw(result);
1941        self.drop_without_shutdown();
1942        _result
1943    }
1944
1945    fn send_raw(&self, mut result: Result<&CountryCode, i32>) -> Result<(), fidl::Error> {
1946        self.control_handle.inner.send::<fidl::encoding::ResultType<PhyGetCountryResponse, i32>>(
1947            result.map(|resp| (resp,)),
1948            self.tx_id,
1949            0x3ed3281ce6feab3e,
1950            fidl::encoding::DynamicFlags::empty(),
1951        )
1952    }
1953}
1954
1955#[must_use = "FIDL methods require a response to be sent"]
1956#[derive(Debug)]
1957pub struct PhyClearCountryResponder {
1958    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
1959    tx_id: u32,
1960}
1961
1962/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
1963/// if the responder is dropped without sending a response, so that the client
1964/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1965impl std::ops::Drop for PhyClearCountryResponder {
1966    fn drop(&mut self) {
1967        self.control_handle.shutdown();
1968        // Safety: drops once, never accessed again
1969        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1970    }
1971}
1972
1973impl fidl::endpoints::Responder for PhyClearCountryResponder {
1974    type ControlHandle = PhyControlHandle;
1975
1976    fn control_handle(&self) -> &PhyControlHandle {
1977        &self.control_handle
1978    }
1979
1980    fn drop_without_shutdown(mut self) {
1981        // Safety: drops once, never accessed again due to mem::forget
1982        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1983        // Prevent Drop from running (which would shut down the channel)
1984        std::mem::forget(self);
1985    }
1986}
1987
1988impl PhyClearCountryResponder {
1989    /// Sends a response to the FIDL transaction.
1990    ///
1991    /// Sets the channel to shutdown if an error occurs.
1992    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1993        let _result = self.send_raw(status);
1994        if _result.is_err() {
1995            self.control_handle.shutdown();
1996        }
1997        self.drop_without_shutdown();
1998        _result
1999    }
2000
2001    /// Similar to "send" but does not shutdown the channel if an error occurs.
2002    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2003        let _result = self.send_raw(status);
2004        self.drop_without_shutdown();
2005        _result
2006    }
2007
2008    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2009        self.control_handle.inner.send::<PhyClearCountryResponse>(
2010            (status,),
2011            self.tx_id,
2012            0x4ea9b83a9c494c95,
2013            fidl::encoding::DynamicFlags::empty(),
2014        )
2015    }
2016}
2017
2018#[must_use = "FIDL methods require a response to be sent"]
2019#[derive(Debug)]
2020pub struct PhySetPowerSaveModeResponder {
2021    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
2022    tx_id: u32,
2023}
2024
2025/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
2026/// if the responder is dropped without sending a response, so that the client
2027/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2028impl std::ops::Drop for PhySetPowerSaveModeResponder {
2029    fn drop(&mut self) {
2030        self.control_handle.shutdown();
2031        // Safety: drops once, never accessed again
2032        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2033    }
2034}
2035
2036impl fidl::endpoints::Responder for PhySetPowerSaveModeResponder {
2037    type ControlHandle = PhyControlHandle;
2038
2039    fn control_handle(&self) -> &PhyControlHandle {
2040        &self.control_handle
2041    }
2042
2043    fn drop_without_shutdown(mut self) {
2044        // Safety: drops once, never accessed again due to mem::forget
2045        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2046        // Prevent Drop from running (which would shut down the channel)
2047        std::mem::forget(self);
2048    }
2049}
2050
2051impl PhySetPowerSaveModeResponder {
2052    /// Sends a response to the FIDL transaction.
2053    ///
2054    /// Sets the channel to shutdown if an error occurs.
2055    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2056        let _result = self.send_raw(status);
2057        if _result.is_err() {
2058            self.control_handle.shutdown();
2059        }
2060        self.drop_without_shutdown();
2061        _result
2062    }
2063
2064    /// Similar to "send" but does not shutdown the channel if an error occurs.
2065    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2066        let _result = self.send_raw(status);
2067        self.drop_without_shutdown();
2068        _result
2069    }
2070
2071    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2072        self.control_handle.inner.send::<PhySetPowerSaveModeResponse>(
2073            (status,),
2074            self.tx_id,
2075            0x56be34b2f3abe17f,
2076            fidl::encoding::DynamicFlags::empty(),
2077        )
2078    }
2079}
2080
2081#[must_use = "FIDL methods require a response to be sent"]
2082#[derive(Debug)]
2083pub struct PhyGetPowerSaveModeResponder {
2084    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
2085    tx_id: u32,
2086}
2087
2088/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
2089/// if the responder is dropped without sending a response, so that the client
2090/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2091impl std::ops::Drop for PhyGetPowerSaveModeResponder {
2092    fn drop(&mut self) {
2093        self.control_handle.shutdown();
2094        // Safety: drops once, never accessed again
2095        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2096    }
2097}
2098
2099impl fidl::endpoints::Responder for PhyGetPowerSaveModeResponder {
2100    type ControlHandle = PhyControlHandle;
2101
2102    fn control_handle(&self) -> &PhyControlHandle {
2103        &self.control_handle
2104    }
2105
2106    fn drop_without_shutdown(mut self) {
2107        // Safety: drops once, never accessed again due to mem::forget
2108        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2109        // Prevent Drop from running (which would shut down the channel)
2110        std::mem::forget(self);
2111    }
2112}
2113
2114impl PhyGetPowerSaveModeResponder {
2115    /// Sends a response to the FIDL transaction.
2116    ///
2117    /// Sets the channel to shutdown if an error occurs.
2118    pub fn send(
2119        self,
2120        mut result: Result<fidl_fuchsia_wlan_common::PowerSaveType, i32>,
2121    ) -> Result<(), fidl::Error> {
2122        let _result = self.send_raw(result);
2123        if _result.is_err() {
2124            self.control_handle.shutdown();
2125        }
2126        self.drop_without_shutdown();
2127        _result
2128    }
2129
2130    /// Similar to "send" but does not shutdown the channel if an error occurs.
2131    pub fn send_no_shutdown_on_err(
2132        self,
2133        mut result: Result<fidl_fuchsia_wlan_common::PowerSaveType, i32>,
2134    ) -> Result<(), fidl::Error> {
2135        let _result = self.send_raw(result);
2136        self.drop_without_shutdown();
2137        _result
2138    }
2139
2140    fn send_raw(
2141        &self,
2142        mut result: Result<fidl_fuchsia_wlan_common::PowerSaveType, i32>,
2143    ) -> Result<(), fidl::Error> {
2144        self.control_handle
2145            .inner
2146            .send::<fidl::encoding::ResultType<PhyGetPowerSaveModeResponse, i32>>(
2147                result.map(|resp| (resp,)),
2148                self.tx_id,
2149                0x3f7019c3672bc798,
2150                fidl::encoding::DynamicFlags::empty(),
2151            )
2152    }
2153}
2154
2155#[must_use = "FIDL methods require a response to be sent"]
2156#[derive(Debug)]
2157pub struct PhyPowerDownResponder {
2158    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
2159    tx_id: u32,
2160}
2161
2162/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
2163/// if the responder is dropped without sending a response, so that the client
2164/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2165impl std::ops::Drop for PhyPowerDownResponder {
2166    fn drop(&mut self) {
2167        self.control_handle.shutdown();
2168        // Safety: drops once, never accessed again
2169        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2170    }
2171}
2172
2173impl fidl::endpoints::Responder for PhyPowerDownResponder {
2174    type ControlHandle = PhyControlHandle;
2175
2176    fn control_handle(&self) -> &PhyControlHandle {
2177        &self.control_handle
2178    }
2179
2180    fn drop_without_shutdown(mut self) {
2181        // Safety: drops once, never accessed again due to mem::forget
2182        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2183        // Prevent Drop from running (which would shut down the channel)
2184        std::mem::forget(self);
2185    }
2186}
2187
2188impl PhyPowerDownResponder {
2189    /// Sends a response to the FIDL transaction.
2190    ///
2191    /// Sets the channel to shutdown if an error occurs.
2192    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2193        let _result = self.send_raw(result);
2194        if _result.is_err() {
2195            self.control_handle.shutdown();
2196        }
2197        self.drop_without_shutdown();
2198        _result
2199    }
2200
2201    /// Similar to "send" but does not shutdown the channel if an error occurs.
2202    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2203        let _result = self.send_raw(result);
2204        self.drop_without_shutdown();
2205        _result
2206    }
2207
2208    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2209        self.control_handle
2210            .inner
2211            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2212                result,
2213                self.tx_id,
2214                0x56bcae4b27a564d2,
2215                fidl::encoding::DynamicFlags::empty(),
2216            )
2217    }
2218}
2219
2220#[must_use = "FIDL methods require a response to be sent"]
2221#[derive(Debug)]
2222pub struct PhyPowerUpResponder {
2223    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
2224    tx_id: u32,
2225}
2226
2227/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
2228/// if the responder is dropped without sending a response, so that the client
2229/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2230impl std::ops::Drop for PhyPowerUpResponder {
2231    fn drop(&mut self) {
2232        self.control_handle.shutdown();
2233        // Safety: drops once, never accessed again
2234        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2235    }
2236}
2237
2238impl fidl::endpoints::Responder for PhyPowerUpResponder {
2239    type ControlHandle = PhyControlHandle;
2240
2241    fn control_handle(&self) -> &PhyControlHandle {
2242        &self.control_handle
2243    }
2244
2245    fn drop_without_shutdown(mut self) {
2246        // Safety: drops once, never accessed again due to mem::forget
2247        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2248        // Prevent Drop from running (which would shut down the channel)
2249        std::mem::forget(self);
2250    }
2251}
2252
2253impl PhyPowerUpResponder {
2254    /// Sends a response to the FIDL transaction.
2255    ///
2256    /// Sets the channel to shutdown if an error occurs.
2257    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2258        let _result = self.send_raw(result);
2259        if _result.is_err() {
2260            self.control_handle.shutdown();
2261        }
2262        self.drop_without_shutdown();
2263        _result
2264    }
2265
2266    /// Similar to "send" but does not shutdown the channel if an error occurs.
2267    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2268        let _result = self.send_raw(result);
2269        self.drop_without_shutdown();
2270        _result
2271    }
2272
2273    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2274        self.control_handle
2275            .inner
2276            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2277                result,
2278                self.tx_id,
2279                0x7aad8e525738b946,
2280                fidl::encoding::DynamicFlags::empty(),
2281            )
2282    }
2283}
2284
2285#[must_use = "FIDL methods require a response to be sent"]
2286#[derive(Debug)]
2287pub struct PhyResetResponder {
2288    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
2289    tx_id: u32,
2290}
2291
2292/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
2293/// if the responder is dropped without sending a response, so that the client
2294/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2295impl std::ops::Drop for PhyResetResponder {
2296    fn drop(&mut self) {
2297        self.control_handle.shutdown();
2298        // Safety: drops once, never accessed again
2299        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2300    }
2301}
2302
2303impl fidl::endpoints::Responder for PhyResetResponder {
2304    type ControlHandle = PhyControlHandle;
2305
2306    fn control_handle(&self) -> &PhyControlHandle {
2307        &self.control_handle
2308    }
2309
2310    fn drop_without_shutdown(mut self) {
2311        // Safety: drops once, never accessed again due to mem::forget
2312        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2313        // Prevent Drop from running (which would shut down the channel)
2314        std::mem::forget(self);
2315    }
2316}
2317
2318impl PhyResetResponder {
2319    /// Sends a response to the FIDL transaction.
2320    ///
2321    /// Sets the channel to shutdown if an error occurs.
2322    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2323        let _result = self.send_raw(result);
2324        if _result.is_err() {
2325            self.control_handle.shutdown();
2326        }
2327        self.drop_without_shutdown();
2328        _result
2329    }
2330
2331    /// Similar to "send" but does not shutdown the channel if an error occurs.
2332    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2333        let _result = self.send_raw(result);
2334        self.drop_without_shutdown();
2335        _result
2336    }
2337
2338    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2339        self.control_handle
2340            .inner
2341            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2342                result,
2343                self.tx_id,
2344                0x647cdcc9def3db87,
2345                fidl::encoding::DynamicFlags::empty(),
2346            )
2347    }
2348}
2349
2350#[must_use = "FIDL methods require a response to be sent"]
2351#[derive(Debug)]
2352pub struct PhyGetPowerStateResponder {
2353    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
2354    tx_id: u32,
2355}
2356
2357/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
2358/// if the responder is dropped without sending a response, so that the client
2359/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2360impl std::ops::Drop for PhyGetPowerStateResponder {
2361    fn drop(&mut self) {
2362        self.control_handle.shutdown();
2363        // Safety: drops once, never accessed again
2364        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2365    }
2366}
2367
2368impl fidl::endpoints::Responder for PhyGetPowerStateResponder {
2369    type ControlHandle = PhyControlHandle;
2370
2371    fn control_handle(&self) -> &PhyControlHandle {
2372        &self.control_handle
2373    }
2374
2375    fn drop_without_shutdown(mut self) {
2376        // Safety: drops once, never accessed again due to mem::forget
2377        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2378        // Prevent Drop from running (which would shut down the channel)
2379        std::mem::forget(self);
2380    }
2381}
2382
2383impl PhyGetPowerStateResponder {
2384    /// Sends a response to the FIDL transaction.
2385    ///
2386    /// Sets the channel to shutdown if an error occurs.
2387    pub fn send(self, mut result: Result<bool, i32>) -> Result<(), fidl::Error> {
2388        let _result = self.send_raw(result);
2389        if _result.is_err() {
2390            self.control_handle.shutdown();
2391        }
2392        self.drop_without_shutdown();
2393        _result
2394    }
2395
2396    /// Similar to "send" but does not shutdown the channel if an error occurs.
2397    pub fn send_no_shutdown_on_err(self, mut result: Result<bool, i32>) -> Result<(), fidl::Error> {
2398        let _result = self.send_raw(result);
2399        self.drop_without_shutdown();
2400        _result
2401    }
2402
2403    fn send_raw(&self, mut result: Result<bool, i32>) -> Result<(), fidl::Error> {
2404        self.control_handle.inner.send::<fidl::encoding::ResultType<PhyGetPowerStateResponse, i32>>(
2405            result.map(|power_on| (power_on,)),
2406            self.tx_id,
2407            0xcddef2b16c7f00f,
2408            fidl::encoding::DynamicFlags::empty(),
2409        )
2410    }
2411}
2412
2413#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2414pub struct ServiceMarker;
2415
2416#[cfg(target_os = "fuchsia")]
2417impl fidl::endpoints::ServiceMarker for ServiceMarker {
2418    type Proxy = ServiceProxy;
2419    type Request = ServiceRequest;
2420    const SERVICE_NAME: &'static str = "fuchsia.wlan.device.Service";
2421}
2422
2423/// A request for one of the member protocols of Service.
2424///
2425#[cfg(target_os = "fuchsia")]
2426pub enum ServiceRequest {
2427    Device(ConnectorRequestStream),
2428}
2429
2430#[cfg(target_os = "fuchsia")]
2431impl fidl::endpoints::ServiceRequest for ServiceRequest {
2432    type Service = ServiceMarker;
2433
2434    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
2435        match name {
2436            "device" => Self::Device(
2437                <ConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2438            ),
2439            _ => panic!("no such member protocol name for service Service"),
2440        }
2441    }
2442
2443    fn member_names() -> &'static [&'static str] {
2444        &["device"]
2445    }
2446}
2447#[cfg(target_os = "fuchsia")]
2448pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
2449
2450#[cfg(target_os = "fuchsia")]
2451impl fidl::endpoints::ServiceProxy for ServiceProxy {
2452    type Service = ServiceMarker;
2453
2454    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
2455        Self(opener)
2456    }
2457}
2458
2459#[cfg(target_os = "fuchsia")]
2460impl ServiceProxy {
2461    pub fn connect_to_device(&self) -> Result<ConnectorProxy, fidl::Error> {
2462        let (proxy, server_end) = fidl::endpoints::create_proxy::<ConnectorMarker>();
2463        self.connect_channel_to_device(server_end)?;
2464        Ok(proxy)
2465    }
2466
2467    /// Like `connect_to_device`, but returns a sync proxy.
2468    /// See [`Self::connect_to_device`] for more details.
2469    pub fn connect_to_device_sync(&self) -> Result<ConnectorSynchronousProxy, fidl::Error> {
2470        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<ConnectorMarker>();
2471        self.connect_channel_to_device(server_end)?;
2472        Ok(proxy)
2473    }
2474
2475    /// Like `connect_to_device`, but accepts a server end.
2476    /// See [`Self::connect_to_device`] for more details.
2477    pub fn connect_channel_to_device(
2478        &self,
2479        server_end: fidl::endpoints::ServerEnd<ConnectorMarker>,
2480    ) -> Result<(), fidl::Error> {
2481        self.0.open_member("device", server_end.into_channel())
2482    }
2483
2484    pub fn instance_name(&self) -> &str {
2485        self.0.instance_name()
2486    }
2487}
2488
2489mod internal {
2490    use super::*;
2491
2492    impl fidl::encoding::ResourceTypeMarker for ConnectorConnectRequest {
2493        type Borrowed<'a> = &'a mut Self;
2494        fn take_or_borrow<'a>(
2495            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2496        ) -> Self::Borrowed<'a> {
2497            value
2498        }
2499    }
2500
2501    unsafe impl fidl::encoding::TypeMarker for ConnectorConnectRequest {
2502        type Owned = Self;
2503
2504        #[inline(always)]
2505        fn inline_align(_context: fidl::encoding::Context) -> usize {
2506            4
2507        }
2508
2509        #[inline(always)]
2510        fn inline_size(_context: fidl::encoding::Context) -> usize {
2511            4
2512        }
2513    }
2514
2515    unsafe impl
2516        fidl::encoding::Encode<
2517            ConnectorConnectRequest,
2518            fidl::encoding::DefaultFuchsiaResourceDialect,
2519        > for &mut ConnectorConnectRequest
2520    {
2521        #[inline]
2522        unsafe fn encode(
2523            self,
2524            encoder: &mut fidl::encoding::Encoder<
2525                '_,
2526                fidl::encoding::DefaultFuchsiaResourceDialect,
2527            >,
2528            offset: usize,
2529            _depth: fidl::encoding::Depth,
2530        ) -> fidl::Result<()> {
2531            encoder.debug_check_bounds::<ConnectorConnectRequest>(offset);
2532            // Delegate to tuple encoding.
2533            fidl::encoding::Encode::<ConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2534                (
2535                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PhyMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
2536                ),
2537                encoder, offset, _depth
2538            )
2539        }
2540    }
2541    unsafe impl<
2542        T0: fidl::encoding::Encode<
2543                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PhyMarker>>,
2544                fidl::encoding::DefaultFuchsiaResourceDialect,
2545            >,
2546    >
2547        fidl::encoding::Encode<
2548            ConnectorConnectRequest,
2549            fidl::encoding::DefaultFuchsiaResourceDialect,
2550        > for (T0,)
2551    {
2552        #[inline]
2553        unsafe fn encode(
2554            self,
2555            encoder: &mut fidl::encoding::Encoder<
2556                '_,
2557                fidl::encoding::DefaultFuchsiaResourceDialect,
2558            >,
2559            offset: usize,
2560            depth: fidl::encoding::Depth,
2561        ) -> fidl::Result<()> {
2562            encoder.debug_check_bounds::<ConnectorConnectRequest>(offset);
2563            // Zero out padding regions. There's no need to apply masks
2564            // because the unmasked parts will be overwritten by fields.
2565            // Write the fields.
2566            self.0.encode(encoder, offset + 0, depth)?;
2567            Ok(())
2568        }
2569    }
2570
2571    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2572        for ConnectorConnectRequest
2573    {
2574        #[inline(always)]
2575        fn new_empty() -> Self {
2576            Self {
2577                request: fidl::new_empty!(
2578                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PhyMarker>>,
2579                    fidl::encoding::DefaultFuchsiaResourceDialect
2580                ),
2581            }
2582        }
2583
2584        #[inline]
2585        unsafe fn decode(
2586            &mut self,
2587            decoder: &mut fidl::encoding::Decoder<
2588                '_,
2589                fidl::encoding::DefaultFuchsiaResourceDialect,
2590            >,
2591            offset: usize,
2592            _depth: fidl::encoding::Depth,
2593        ) -> fidl::Result<()> {
2594            decoder.debug_check_bounds::<Self>(offset);
2595            // Verify that padding bytes are zero.
2596            fidl::decode!(
2597                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PhyMarker>>,
2598                fidl::encoding::DefaultFuchsiaResourceDialect,
2599                &mut self.request,
2600                decoder,
2601                offset + 0,
2602                _depth
2603            )?;
2604            Ok(())
2605        }
2606    }
2607
2608    impl fidl::encoding::ResourceTypeMarker for CreateIfaceRequest {
2609        type Borrowed<'a> = &'a mut Self;
2610        fn take_or_borrow<'a>(
2611            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2612        ) -> Self::Borrowed<'a> {
2613            value
2614        }
2615    }
2616
2617    unsafe impl fidl::encoding::TypeMarker for CreateIfaceRequest {
2618        type Owned = Self;
2619
2620        #[inline(always)]
2621        fn inline_align(_context: fidl::encoding::Context) -> usize {
2622            4
2623        }
2624
2625        #[inline(always)]
2626        fn inline_size(_context: fidl::encoding::Context) -> usize {
2627            16
2628        }
2629    }
2630
2631    unsafe impl
2632        fidl::encoding::Encode<CreateIfaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2633        for &mut CreateIfaceRequest
2634    {
2635        #[inline]
2636        unsafe fn encode(
2637            self,
2638            encoder: &mut fidl::encoding::Encoder<
2639                '_,
2640                fidl::encoding::DefaultFuchsiaResourceDialect,
2641            >,
2642            offset: usize,
2643            _depth: fidl::encoding::Depth,
2644        ) -> fidl::Result<()> {
2645            encoder.debug_check_bounds::<CreateIfaceRequest>(offset);
2646            // Delegate to tuple encoding.
2647            fidl::encoding::Encode::<CreateIfaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2648                (
2649                    <fidl_fuchsia_wlan_common::WlanMacRole as fidl::encoding::ValueTypeMarker>::borrow(&self.role),
2650                    <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),
2651                    <fidl::encoding::Array<u8, 6> as fidl::encoding::ValueTypeMarker>::borrow(&self.init_sta_addr),
2652                ),
2653                encoder, offset, _depth
2654            )
2655        }
2656    }
2657    unsafe impl<
2658        T0: fidl::encoding::Encode<
2659                fidl_fuchsia_wlan_common::WlanMacRole,
2660                fidl::encoding::DefaultFuchsiaResourceDialect,
2661            >,
2662        T1: fidl::encoding::Encode<
2663                fidl::encoding::Optional<
2664                    fidl::encoding::HandleType<
2665                        fidl::Channel,
2666                        { fidl::ObjectType::CHANNEL.into_raw() },
2667                        2147483648,
2668                    >,
2669                >,
2670                fidl::encoding::DefaultFuchsiaResourceDialect,
2671            >,
2672        T2: fidl::encoding::Encode<
2673                fidl::encoding::Array<u8, 6>,
2674                fidl::encoding::DefaultFuchsiaResourceDialect,
2675            >,
2676    > fidl::encoding::Encode<CreateIfaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2677        for (T0, T1, T2)
2678    {
2679        #[inline]
2680        unsafe fn encode(
2681            self,
2682            encoder: &mut fidl::encoding::Encoder<
2683                '_,
2684                fidl::encoding::DefaultFuchsiaResourceDialect,
2685            >,
2686            offset: usize,
2687            depth: fidl::encoding::Depth,
2688        ) -> fidl::Result<()> {
2689            encoder.debug_check_bounds::<CreateIfaceRequest>(offset);
2690            // Zero out padding regions. There's no need to apply masks
2691            // because the unmasked parts will be overwritten by fields.
2692            unsafe {
2693                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(12);
2694                (ptr as *mut u32).write_unaligned(0);
2695            }
2696            // Write the fields.
2697            self.0.encode(encoder, offset + 0, depth)?;
2698            self.1.encode(encoder, offset + 4, depth)?;
2699            self.2.encode(encoder, offset + 8, depth)?;
2700            Ok(())
2701        }
2702    }
2703
2704    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2705        for CreateIfaceRequest
2706    {
2707        #[inline(always)]
2708        fn new_empty() -> Self {
2709            Self {
2710                role: fidl::new_empty!(
2711                    fidl_fuchsia_wlan_common::WlanMacRole,
2712                    fidl::encoding::DefaultFuchsiaResourceDialect
2713                ),
2714                mlme_channel: fidl::new_empty!(
2715                    fidl::encoding::Optional<
2716                        fidl::encoding::HandleType<
2717                            fidl::Channel,
2718                            { fidl::ObjectType::CHANNEL.into_raw() },
2719                            2147483648,
2720                        >,
2721                    >,
2722                    fidl::encoding::DefaultFuchsiaResourceDialect
2723                ),
2724                init_sta_addr: fidl::new_empty!(fidl::encoding::Array<u8, 6>, fidl::encoding::DefaultFuchsiaResourceDialect),
2725            }
2726        }
2727
2728        #[inline]
2729        unsafe fn decode(
2730            &mut self,
2731            decoder: &mut fidl::encoding::Decoder<
2732                '_,
2733                fidl::encoding::DefaultFuchsiaResourceDialect,
2734            >,
2735            offset: usize,
2736            _depth: fidl::encoding::Depth,
2737        ) -> fidl::Result<()> {
2738            decoder.debug_check_bounds::<Self>(offset);
2739            // Verify that padding bytes are zero.
2740            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(12) };
2741            let padval = unsafe { (ptr as *const u32).read_unaligned() };
2742            let mask = 0xffff0000u32;
2743            let maskedval = padval & mask;
2744            if maskedval != 0 {
2745                return Err(fidl::Error::NonZeroPadding {
2746                    padding_start: offset + 12 + ((mask as u64).trailing_zeros() / 8) as usize,
2747                });
2748            }
2749            fidl::decode!(
2750                fidl_fuchsia_wlan_common::WlanMacRole,
2751                fidl::encoding::DefaultFuchsiaResourceDialect,
2752                &mut self.role,
2753                decoder,
2754                offset + 0,
2755                _depth
2756            )?;
2757            fidl::decode!(
2758                fidl::encoding::Optional<
2759                    fidl::encoding::HandleType<
2760                        fidl::Channel,
2761                        { fidl::ObjectType::CHANNEL.into_raw() },
2762                        2147483648,
2763                    >,
2764                >,
2765                fidl::encoding::DefaultFuchsiaResourceDialect,
2766                &mut self.mlme_channel,
2767                decoder,
2768                offset + 4,
2769                _depth
2770            )?;
2771            fidl::decode!(fidl::encoding::Array<u8, 6>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.init_sta_addr, decoder, offset + 8, _depth)?;
2772            Ok(())
2773        }
2774    }
2775
2776    impl fidl::encoding::ResourceTypeMarker for PhyCreateIfaceRequest {
2777        type Borrowed<'a> = &'a mut Self;
2778        fn take_or_borrow<'a>(
2779            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2780        ) -> Self::Borrowed<'a> {
2781            value
2782        }
2783    }
2784
2785    unsafe impl fidl::encoding::TypeMarker for PhyCreateIfaceRequest {
2786        type Owned = Self;
2787
2788        #[inline(always)]
2789        fn inline_align(_context: fidl::encoding::Context) -> usize {
2790            4
2791        }
2792
2793        #[inline(always)]
2794        fn inline_size(_context: fidl::encoding::Context) -> usize {
2795            16
2796        }
2797    }
2798
2799    unsafe impl
2800        fidl::encoding::Encode<PhyCreateIfaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2801        for &mut PhyCreateIfaceRequest
2802    {
2803        #[inline]
2804        unsafe fn encode(
2805            self,
2806            encoder: &mut fidl::encoding::Encoder<
2807                '_,
2808                fidl::encoding::DefaultFuchsiaResourceDialect,
2809            >,
2810            offset: usize,
2811            _depth: fidl::encoding::Depth,
2812        ) -> fidl::Result<()> {
2813            encoder.debug_check_bounds::<PhyCreateIfaceRequest>(offset);
2814            // Delegate to tuple encoding.
2815            fidl::encoding::Encode::<
2816                PhyCreateIfaceRequest,
2817                fidl::encoding::DefaultFuchsiaResourceDialect,
2818            >::encode(
2819                (<CreateIfaceRequest as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2820                    &mut self.req,
2821                ),),
2822                encoder,
2823                offset,
2824                _depth,
2825            )
2826        }
2827    }
2828    unsafe impl<
2829        T0: fidl::encoding::Encode<CreateIfaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>,
2830    >
2831        fidl::encoding::Encode<PhyCreateIfaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2832        for (T0,)
2833    {
2834        #[inline]
2835        unsafe fn encode(
2836            self,
2837            encoder: &mut fidl::encoding::Encoder<
2838                '_,
2839                fidl::encoding::DefaultFuchsiaResourceDialect,
2840            >,
2841            offset: usize,
2842            depth: fidl::encoding::Depth,
2843        ) -> fidl::Result<()> {
2844            encoder.debug_check_bounds::<PhyCreateIfaceRequest>(offset);
2845            // Zero out padding regions. There's no need to apply masks
2846            // because the unmasked parts will be overwritten by fields.
2847            // Write the fields.
2848            self.0.encode(encoder, offset + 0, depth)?;
2849            Ok(())
2850        }
2851    }
2852
2853    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2854        for PhyCreateIfaceRequest
2855    {
2856        #[inline(always)]
2857        fn new_empty() -> Self {
2858            Self {
2859                req: fidl::new_empty!(
2860                    CreateIfaceRequest,
2861                    fidl::encoding::DefaultFuchsiaResourceDialect
2862                ),
2863            }
2864        }
2865
2866        #[inline]
2867        unsafe fn decode(
2868            &mut self,
2869            decoder: &mut fidl::encoding::Decoder<
2870                '_,
2871                fidl::encoding::DefaultFuchsiaResourceDialect,
2872            >,
2873            offset: usize,
2874            _depth: fidl::encoding::Depth,
2875        ) -> fidl::Result<()> {
2876            decoder.debug_check_bounds::<Self>(offset);
2877            // Verify that padding bytes are zero.
2878            fidl::decode!(
2879                CreateIfaceRequest,
2880                fidl::encoding::DefaultFuchsiaResourceDialect,
2881                &mut self.req,
2882                decoder,
2883                offset + 0,
2884                _depth
2885            )?;
2886            Ok(())
2887        }
2888    }
2889}