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 {
1529            Some((responder))
1530        } else {
1531            None
1532        }
1533    }
1534
1535    #[allow(irrefutable_let_patterns)]
1536    pub fn into_clear_country(self) -> Option<(PhyClearCountryResponder)> {
1537        if let PhyRequest::ClearCountry { responder } = self {
1538            Some((responder))
1539        } else {
1540            None
1541        }
1542    }
1543
1544    #[allow(irrefutable_let_patterns)]
1545    pub fn into_set_power_save_mode(
1546        self,
1547    ) -> Option<(fidl_fuchsia_wlan_common::PowerSaveType, PhySetPowerSaveModeResponder)> {
1548        if let PhyRequest::SetPowerSaveMode { req, responder } = self {
1549            Some((req, responder))
1550        } else {
1551            None
1552        }
1553    }
1554
1555    #[allow(irrefutable_let_patterns)]
1556    pub fn into_get_power_save_mode(self) -> Option<(PhyGetPowerSaveModeResponder)> {
1557        if let PhyRequest::GetPowerSaveMode { responder } = self {
1558            Some((responder))
1559        } else {
1560            None
1561        }
1562    }
1563
1564    #[allow(irrefutable_let_patterns)]
1565    pub fn into_power_down(self) -> Option<(PhyPowerDownResponder)> {
1566        if let PhyRequest::PowerDown { responder } = self {
1567            Some((responder))
1568        } else {
1569            None
1570        }
1571    }
1572
1573    #[allow(irrefutable_let_patterns)]
1574    pub fn into_power_up(self) -> Option<(PhyPowerUpResponder)> {
1575        if let PhyRequest::PowerUp { responder } = self {
1576            Some((responder))
1577        } else {
1578            None
1579        }
1580    }
1581
1582    #[allow(irrefutable_let_patterns)]
1583    pub fn into_reset(self) -> Option<(PhyResetResponder)> {
1584        if let PhyRequest::Reset { responder } = self {
1585            Some((responder))
1586        } else {
1587            None
1588        }
1589    }
1590
1591    #[allow(irrefutable_let_patterns)]
1592    pub fn into_get_power_state(self) -> Option<(PhyGetPowerStateResponder)> {
1593        if let PhyRequest::GetPowerState { responder } = self {
1594            Some((responder))
1595        } else {
1596            None
1597        }
1598    }
1599
1600    /// Name of the method defined in FIDL
1601    pub fn method_name(&self) -> &'static str {
1602        match *self {
1603            PhyRequest::GetSupportedMacRoles { .. } => "get_supported_mac_roles",
1604            PhyRequest::CreateIface { .. } => "create_iface",
1605            PhyRequest::DestroyIface { .. } => "destroy_iface",
1606            PhyRequest::SetCountry { .. } => "set_country",
1607            PhyRequest::GetCountry { .. } => "get_country",
1608            PhyRequest::ClearCountry { .. } => "clear_country",
1609            PhyRequest::SetPowerSaveMode { .. } => "set_power_save_mode",
1610            PhyRequest::GetPowerSaveMode { .. } => "get_power_save_mode",
1611            PhyRequest::PowerDown { .. } => "power_down",
1612            PhyRequest::PowerUp { .. } => "power_up",
1613            PhyRequest::Reset { .. } => "reset",
1614            PhyRequest::GetPowerState { .. } => "get_power_state",
1615        }
1616    }
1617}
1618
1619#[derive(Debug, Clone)]
1620pub struct PhyControlHandle {
1621    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1622}
1623
1624impl fidl::endpoints::ControlHandle for PhyControlHandle {
1625    fn shutdown(&self) {
1626        self.inner.shutdown()
1627    }
1628    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1629        self.inner.shutdown_with_epitaph(status)
1630    }
1631
1632    fn is_closed(&self) -> bool {
1633        self.inner.channel().is_closed()
1634    }
1635    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1636        self.inner.channel().on_closed()
1637    }
1638
1639    #[cfg(target_os = "fuchsia")]
1640    fn signal_peer(
1641        &self,
1642        clear_mask: zx::Signals,
1643        set_mask: zx::Signals,
1644    ) -> Result<(), zx_status::Status> {
1645        use fidl::Peered;
1646        self.inner.channel().signal_peer(clear_mask, set_mask)
1647    }
1648}
1649
1650impl PhyControlHandle {}
1651
1652#[must_use = "FIDL methods require a response to be sent"]
1653#[derive(Debug)]
1654pub struct PhyGetSupportedMacRolesResponder {
1655    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
1656    tx_id: u32,
1657}
1658
1659/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
1660/// if the responder is dropped without sending a response, so that the client
1661/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1662impl std::ops::Drop for PhyGetSupportedMacRolesResponder {
1663    fn drop(&mut self) {
1664        self.control_handle.shutdown();
1665        // Safety: drops once, never accessed again
1666        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1667    }
1668}
1669
1670impl fidl::endpoints::Responder for PhyGetSupportedMacRolesResponder {
1671    type ControlHandle = PhyControlHandle;
1672
1673    fn control_handle(&self) -> &PhyControlHandle {
1674        &self.control_handle
1675    }
1676
1677    fn drop_without_shutdown(mut self) {
1678        // Safety: drops once, never accessed again due to mem::forget
1679        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1680        // Prevent Drop from running (which would shut down the channel)
1681        std::mem::forget(self);
1682    }
1683}
1684
1685impl PhyGetSupportedMacRolesResponder {
1686    /// Sends a response to the FIDL transaction.
1687    ///
1688    /// Sets the channel to shutdown if an error occurs.
1689    pub fn send(
1690        self,
1691        mut result: Result<&[fidl_fuchsia_wlan_common::WlanMacRole], i32>,
1692    ) -> Result<(), fidl::Error> {
1693        let _result = self.send_raw(result);
1694        if _result.is_err() {
1695            self.control_handle.shutdown();
1696        }
1697        self.drop_without_shutdown();
1698        _result
1699    }
1700
1701    /// Similar to "send" but does not shutdown the channel if an error occurs.
1702    pub fn send_no_shutdown_on_err(
1703        self,
1704        mut result: Result<&[fidl_fuchsia_wlan_common::WlanMacRole], i32>,
1705    ) -> Result<(), fidl::Error> {
1706        let _result = self.send_raw(result);
1707        self.drop_without_shutdown();
1708        _result
1709    }
1710
1711    fn send_raw(
1712        &self,
1713        mut result: Result<&[fidl_fuchsia_wlan_common::WlanMacRole], i32>,
1714    ) -> Result<(), fidl::Error> {
1715        self.control_handle
1716            .inner
1717            .send::<fidl::encoding::ResultType<PhyGetSupportedMacRolesResponse, i32>>(
1718                result.map(|supported_mac_roles| (supported_mac_roles,)),
1719                self.tx_id,
1720                0x18f6b9091aa8a44,
1721                fidl::encoding::DynamicFlags::empty(),
1722            )
1723    }
1724}
1725
1726#[must_use = "FIDL methods require a response to be sent"]
1727#[derive(Debug)]
1728pub struct PhyCreateIfaceResponder {
1729    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
1730    tx_id: u32,
1731}
1732
1733/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
1734/// if the responder is dropped without sending a response, so that the client
1735/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1736impl std::ops::Drop for PhyCreateIfaceResponder {
1737    fn drop(&mut self) {
1738        self.control_handle.shutdown();
1739        // Safety: drops once, never accessed again
1740        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1741    }
1742}
1743
1744impl fidl::endpoints::Responder for PhyCreateIfaceResponder {
1745    type ControlHandle = PhyControlHandle;
1746
1747    fn control_handle(&self) -> &PhyControlHandle {
1748        &self.control_handle
1749    }
1750
1751    fn drop_without_shutdown(mut self) {
1752        // Safety: drops once, never accessed again due to mem::forget
1753        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1754        // Prevent Drop from running (which would shut down the channel)
1755        std::mem::forget(self);
1756    }
1757}
1758
1759impl PhyCreateIfaceResponder {
1760    /// Sends a response to the FIDL transaction.
1761    ///
1762    /// Sets the channel to shutdown if an error occurs.
1763    pub fn send(self, mut result: Result<u16, i32>) -> Result<(), fidl::Error> {
1764        let _result = self.send_raw(result);
1765        if _result.is_err() {
1766            self.control_handle.shutdown();
1767        }
1768        self.drop_without_shutdown();
1769        _result
1770    }
1771
1772    /// Similar to "send" but does not shutdown the channel if an error occurs.
1773    pub fn send_no_shutdown_on_err(self, mut result: Result<u16, i32>) -> Result<(), fidl::Error> {
1774        let _result = self.send_raw(result);
1775        self.drop_without_shutdown();
1776        _result
1777    }
1778
1779    fn send_raw(&self, mut result: Result<u16, i32>) -> Result<(), fidl::Error> {
1780        self.control_handle.inner.send::<fidl::encoding::ResultType<PhyCreateIfaceResponse, i32>>(
1781            result.map(|iface_id| (iface_id,)),
1782            self.tx_id,
1783            0x665940c7aa4b9785,
1784            fidl::encoding::DynamicFlags::empty(),
1785        )
1786    }
1787}
1788
1789#[must_use = "FIDL methods require a response to be sent"]
1790#[derive(Debug)]
1791pub struct PhyDestroyIfaceResponder {
1792    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
1793    tx_id: u32,
1794}
1795
1796/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
1797/// if the responder is dropped without sending a response, so that the client
1798/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1799impl std::ops::Drop for PhyDestroyIfaceResponder {
1800    fn drop(&mut self) {
1801        self.control_handle.shutdown();
1802        // Safety: drops once, never accessed again
1803        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1804    }
1805}
1806
1807impl fidl::endpoints::Responder for PhyDestroyIfaceResponder {
1808    type ControlHandle = PhyControlHandle;
1809
1810    fn control_handle(&self) -> &PhyControlHandle {
1811        &self.control_handle
1812    }
1813
1814    fn drop_without_shutdown(mut self) {
1815        // Safety: drops once, never accessed again due to mem::forget
1816        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1817        // Prevent Drop from running (which would shut down the channel)
1818        std::mem::forget(self);
1819    }
1820}
1821
1822impl PhyDestroyIfaceResponder {
1823    /// Sends a response to the FIDL transaction.
1824    ///
1825    /// Sets the channel to shutdown if an error occurs.
1826    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1827        let _result = self.send_raw(result);
1828        if _result.is_err() {
1829            self.control_handle.shutdown();
1830        }
1831        self.drop_without_shutdown();
1832        _result
1833    }
1834
1835    /// Similar to "send" but does not shutdown the channel if an error occurs.
1836    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1837        let _result = self.send_raw(result);
1838        self.drop_without_shutdown();
1839        _result
1840    }
1841
1842    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1843        self.control_handle
1844            .inner
1845            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1846                result,
1847                self.tx_id,
1848                0x75a3048ae01942e8,
1849                fidl::encoding::DynamicFlags::empty(),
1850            )
1851    }
1852}
1853
1854#[must_use = "FIDL methods require a response to be sent"]
1855#[derive(Debug)]
1856pub struct PhySetCountryResponder {
1857    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
1858    tx_id: u32,
1859}
1860
1861/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
1862/// if the responder is dropped without sending a response, so that the client
1863/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1864impl std::ops::Drop for PhySetCountryResponder {
1865    fn drop(&mut self) {
1866        self.control_handle.shutdown();
1867        // Safety: drops once, never accessed again
1868        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1869    }
1870}
1871
1872impl fidl::endpoints::Responder for PhySetCountryResponder {
1873    type ControlHandle = PhyControlHandle;
1874
1875    fn control_handle(&self) -> &PhyControlHandle {
1876        &self.control_handle
1877    }
1878
1879    fn drop_without_shutdown(mut self) {
1880        // Safety: drops once, never accessed again due to mem::forget
1881        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1882        // Prevent Drop from running (which would shut down the channel)
1883        std::mem::forget(self);
1884    }
1885}
1886
1887impl PhySetCountryResponder {
1888    /// Sends a response to the FIDL transaction.
1889    ///
1890    /// Sets the channel to shutdown if an error occurs.
1891    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
1892        let _result = self.send_raw(status);
1893        if _result.is_err() {
1894            self.control_handle.shutdown();
1895        }
1896        self.drop_without_shutdown();
1897        _result
1898    }
1899
1900    /// Similar to "send" but does not shutdown the channel if an error occurs.
1901    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
1902        let _result = self.send_raw(status);
1903        self.drop_without_shutdown();
1904        _result
1905    }
1906
1907    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
1908        self.control_handle.inner.send::<PhySetCountryResponse>(
1909            (status,),
1910            self.tx_id,
1911            0x1367e9997ba00806,
1912            fidl::encoding::DynamicFlags::empty(),
1913        )
1914    }
1915}
1916
1917#[must_use = "FIDL methods require a response to be sent"]
1918#[derive(Debug)]
1919pub struct PhyGetCountryResponder {
1920    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
1921    tx_id: u32,
1922}
1923
1924/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
1925/// if the responder is dropped without sending a response, so that the client
1926/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1927impl std::ops::Drop for PhyGetCountryResponder {
1928    fn drop(&mut self) {
1929        self.control_handle.shutdown();
1930        // Safety: drops once, never accessed again
1931        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1932    }
1933}
1934
1935impl fidl::endpoints::Responder for PhyGetCountryResponder {
1936    type ControlHandle = PhyControlHandle;
1937
1938    fn control_handle(&self) -> &PhyControlHandle {
1939        &self.control_handle
1940    }
1941
1942    fn drop_without_shutdown(mut self) {
1943        // Safety: drops once, never accessed again due to mem::forget
1944        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1945        // Prevent Drop from running (which would shut down the channel)
1946        std::mem::forget(self);
1947    }
1948}
1949
1950impl PhyGetCountryResponder {
1951    /// Sends a response to the FIDL transaction.
1952    ///
1953    /// Sets the channel to shutdown if an error occurs.
1954    pub fn send(self, mut result: Result<&CountryCode, i32>) -> Result<(), fidl::Error> {
1955        let _result = self.send_raw(result);
1956        if _result.is_err() {
1957            self.control_handle.shutdown();
1958        }
1959        self.drop_without_shutdown();
1960        _result
1961    }
1962
1963    /// Similar to "send" but does not shutdown the channel if an error occurs.
1964    pub fn send_no_shutdown_on_err(
1965        self,
1966        mut result: Result<&CountryCode, i32>,
1967    ) -> Result<(), fidl::Error> {
1968        let _result = self.send_raw(result);
1969        self.drop_without_shutdown();
1970        _result
1971    }
1972
1973    fn send_raw(&self, mut result: Result<&CountryCode, i32>) -> Result<(), fidl::Error> {
1974        self.control_handle.inner.send::<fidl::encoding::ResultType<PhyGetCountryResponse, i32>>(
1975            result.map(|resp| (resp,)),
1976            self.tx_id,
1977            0x3ed3281ce6feab3e,
1978            fidl::encoding::DynamicFlags::empty(),
1979        )
1980    }
1981}
1982
1983#[must_use = "FIDL methods require a response to be sent"]
1984#[derive(Debug)]
1985pub struct PhyClearCountryResponder {
1986    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
1987    tx_id: u32,
1988}
1989
1990/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
1991/// if the responder is dropped without sending a response, so that the client
1992/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1993impl std::ops::Drop for PhyClearCountryResponder {
1994    fn drop(&mut self) {
1995        self.control_handle.shutdown();
1996        // Safety: drops once, never accessed again
1997        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1998    }
1999}
2000
2001impl fidl::endpoints::Responder for PhyClearCountryResponder {
2002    type ControlHandle = PhyControlHandle;
2003
2004    fn control_handle(&self) -> &PhyControlHandle {
2005        &self.control_handle
2006    }
2007
2008    fn drop_without_shutdown(mut self) {
2009        // Safety: drops once, never accessed again due to mem::forget
2010        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2011        // Prevent Drop from running (which would shut down the channel)
2012        std::mem::forget(self);
2013    }
2014}
2015
2016impl PhyClearCountryResponder {
2017    /// Sends a response to the FIDL transaction.
2018    ///
2019    /// Sets the channel to shutdown if an error occurs.
2020    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2021        let _result = self.send_raw(status);
2022        if _result.is_err() {
2023            self.control_handle.shutdown();
2024        }
2025        self.drop_without_shutdown();
2026        _result
2027    }
2028
2029    /// Similar to "send" but does not shutdown the channel if an error occurs.
2030    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2031        let _result = self.send_raw(status);
2032        self.drop_without_shutdown();
2033        _result
2034    }
2035
2036    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2037        self.control_handle.inner.send::<PhyClearCountryResponse>(
2038            (status,),
2039            self.tx_id,
2040            0x4ea9b83a9c494c95,
2041            fidl::encoding::DynamicFlags::empty(),
2042        )
2043    }
2044}
2045
2046#[must_use = "FIDL methods require a response to be sent"]
2047#[derive(Debug)]
2048pub struct PhySetPowerSaveModeResponder {
2049    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
2050    tx_id: u32,
2051}
2052
2053/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
2054/// if the responder is dropped without sending a response, so that the client
2055/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2056impl std::ops::Drop for PhySetPowerSaveModeResponder {
2057    fn drop(&mut self) {
2058        self.control_handle.shutdown();
2059        // Safety: drops once, never accessed again
2060        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2061    }
2062}
2063
2064impl fidl::endpoints::Responder for PhySetPowerSaveModeResponder {
2065    type ControlHandle = PhyControlHandle;
2066
2067    fn control_handle(&self) -> &PhyControlHandle {
2068        &self.control_handle
2069    }
2070
2071    fn drop_without_shutdown(mut self) {
2072        // Safety: drops once, never accessed again due to mem::forget
2073        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2074        // Prevent Drop from running (which would shut down the channel)
2075        std::mem::forget(self);
2076    }
2077}
2078
2079impl PhySetPowerSaveModeResponder {
2080    /// Sends a response to the FIDL transaction.
2081    ///
2082    /// Sets the channel to shutdown if an error occurs.
2083    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
2084        let _result = self.send_raw(status);
2085        if _result.is_err() {
2086            self.control_handle.shutdown();
2087        }
2088        self.drop_without_shutdown();
2089        _result
2090    }
2091
2092    /// Similar to "send" but does not shutdown the channel if an error occurs.
2093    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
2094        let _result = self.send_raw(status);
2095        self.drop_without_shutdown();
2096        _result
2097    }
2098
2099    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
2100        self.control_handle.inner.send::<PhySetPowerSaveModeResponse>(
2101            (status,),
2102            self.tx_id,
2103            0x56be34b2f3abe17f,
2104            fidl::encoding::DynamicFlags::empty(),
2105        )
2106    }
2107}
2108
2109#[must_use = "FIDL methods require a response to be sent"]
2110#[derive(Debug)]
2111pub struct PhyGetPowerSaveModeResponder {
2112    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
2113    tx_id: u32,
2114}
2115
2116/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
2117/// if the responder is dropped without sending a response, so that the client
2118/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2119impl std::ops::Drop for PhyGetPowerSaveModeResponder {
2120    fn drop(&mut self) {
2121        self.control_handle.shutdown();
2122        // Safety: drops once, never accessed again
2123        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2124    }
2125}
2126
2127impl fidl::endpoints::Responder for PhyGetPowerSaveModeResponder {
2128    type ControlHandle = PhyControlHandle;
2129
2130    fn control_handle(&self) -> &PhyControlHandle {
2131        &self.control_handle
2132    }
2133
2134    fn drop_without_shutdown(mut self) {
2135        // Safety: drops once, never accessed again due to mem::forget
2136        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2137        // Prevent Drop from running (which would shut down the channel)
2138        std::mem::forget(self);
2139    }
2140}
2141
2142impl PhyGetPowerSaveModeResponder {
2143    /// Sends a response to the FIDL transaction.
2144    ///
2145    /// Sets the channel to shutdown if an error occurs.
2146    pub fn send(
2147        self,
2148        mut result: Result<fidl_fuchsia_wlan_common::PowerSaveType, i32>,
2149    ) -> Result<(), fidl::Error> {
2150        let _result = self.send_raw(result);
2151        if _result.is_err() {
2152            self.control_handle.shutdown();
2153        }
2154        self.drop_without_shutdown();
2155        _result
2156    }
2157
2158    /// Similar to "send" but does not shutdown the channel if an error occurs.
2159    pub fn send_no_shutdown_on_err(
2160        self,
2161        mut result: Result<fidl_fuchsia_wlan_common::PowerSaveType, i32>,
2162    ) -> Result<(), fidl::Error> {
2163        let _result = self.send_raw(result);
2164        self.drop_without_shutdown();
2165        _result
2166    }
2167
2168    fn send_raw(
2169        &self,
2170        mut result: Result<fidl_fuchsia_wlan_common::PowerSaveType, i32>,
2171    ) -> Result<(), fidl::Error> {
2172        self.control_handle
2173            .inner
2174            .send::<fidl::encoding::ResultType<PhyGetPowerSaveModeResponse, i32>>(
2175                result.map(|resp| (resp,)),
2176                self.tx_id,
2177                0x3f7019c3672bc798,
2178                fidl::encoding::DynamicFlags::empty(),
2179            )
2180    }
2181}
2182
2183#[must_use = "FIDL methods require a response to be sent"]
2184#[derive(Debug)]
2185pub struct PhyPowerDownResponder {
2186    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
2187    tx_id: u32,
2188}
2189
2190/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
2191/// if the responder is dropped without sending a response, so that the client
2192/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2193impl std::ops::Drop for PhyPowerDownResponder {
2194    fn drop(&mut self) {
2195        self.control_handle.shutdown();
2196        // Safety: drops once, never accessed again
2197        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2198    }
2199}
2200
2201impl fidl::endpoints::Responder for PhyPowerDownResponder {
2202    type ControlHandle = PhyControlHandle;
2203
2204    fn control_handle(&self) -> &PhyControlHandle {
2205        &self.control_handle
2206    }
2207
2208    fn drop_without_shutdown(mut self) {
2209        // Safety: drops once, never accessed again due to mem::forget
2210        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2211        // Prevent Drop from running (which would shut down the channel)
2212        std::mem::forget(self);
2213    }
2214}
2215
2216impl PhyPowerDownResponder {
2217    /// Sends a response to the FIDL transaction.
2218    ///
2219    /// Sets the channel to shutdown if an error occurs.
2220    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2221        let _result = self.send_raw(result);
2222        if _result.is_err() {
2223            self.control_handle.shutdown();
2224        }
2225        self.drop_without_shutdown();
2226        _result
2227    }
2228
2229    /// Similar to "send" but does not shutdown the channel if an error occurs.
2230    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2231        let _result = self.send_raw(result);
2232        self.drop_without_shutdown();
2233        _result
2234    }
2235
2236    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2237        self.control_handle
2238            .inner
2239            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2240                result,
2241                self.tx_id,
2242                0x56bcae4b27a564d2,
2243                fidl::encoding::DynamicFlags::empty(),
2244            )
2245    }
2246}
2247
2248#[must_use = "FIDL methods require a response to be sent"]
2249#[derive(Debug)]
2250pub struct PhyPowerUpResponder {
2251    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
2252    tx_id: u32,
2253}
2254
2255/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
2256/// if the responder is dropped without sending a response, so that the client
2257/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2258impl std::ops::Drop for PhyPowerUpResponder {
2259    fn drop(&mut self) {
2260        self.control_handle.shutdown();
2261        // Safety: drops once, never accessed again
2262        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2263    }
2264}
2265
2266impl fidl::endpoints::Responder for PhyPowerUpResponder {
2267    type ControlHandle = PhyControlHandle;
2268
2269    fn control_handle(&self) -> &PhyControlHandle {
2270        &self.control_handle
2271    }
2272
2273    fn drop_without_shutdown(mut self) {
2274        // Safety: drops once, never accessed again due to mem::forget
2275        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2276        // Prevent Drop from running (which would shut down the channel)
2277        std::mem::forget(self);
2278    }
2279}
2280
2281impl PhyPowerUpResponder {
2282    /// Sends a response to the FIDL transaction.
2283    ///
2284    /// Sets the channel to shutdown if an error occurs.
2285    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2286        let _result = self.send_raw(result);
2287        if _result.is_err() {
2288            self.control_handle.shutdown();
2289        }
2290        self.drop_without_shutdown();
2291        _result
2292    }
2293
2294    /// Similar to "send" but does not shutdown the channel if an error occurs.
2295    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2296        let _result = self.send_raw(result);
2297        self.drop_without_shutdown();
2298        _result
2299    }
2300
2301    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2302        self.control_handle
2303            .inner
2304            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2305                result,
2306                self.tx_id,
2307                0x7aad8e525738b946,
2308                fidl::encoding::DynamicFlags::empty(),
2309            )
2310    }
2311}
2312
2313#[must_use = "FIDL methods require a response to be sent"]
2314#[derive(Debug)]
2315pub struct PhyResetResponder {
2316    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
2317    tx_id: u32,
2318}
2319
2320/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
2321/// if the responder is dropped without sending a response, so that the client
2322/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2323impl std::ops::Drop for PhyResetResponder {
2324    fn drop(&mut self) {
2325        self.control_handle.shutdown();
2326        // Safety: drops once, never accessed again
2327        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2328    }
2329}
2330
2331impl fidl::endpoints::Responder for PhyResetResponder {
2332    type ControlHandle = PhyControlHandle;
2333
2334    fn control_handle(&self) -> &PhyControlHandle {
2335        &self.control_handle
2336    }
2337
2338    fn drop_without_shutdown(mut self) {
2339        // Safety: drops once, never accessed again due to mem::forget
2340        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2341        // Prevent Drop from running (which would shut down the channel)
2342        std::mem::forget(self);
2343    }
2344}
2345
2346impl PhyResetResponder {
2347    /// Sends a response to the FIDL transaction.
2348    ///
2349    /// Sets the channel to shutdown if an error occurs.
2350    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2351        let _result = self.send_raw(result);
2352        if _result.is_err() {
2353            self.control_handle.shutdown();
2354        }
2355        self.drop_without_shutdown();
2356        _result
2357    }
2358
2359    /// Similar to "send" but does not shutdown the channel if an error occurs.
2360    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2361        let _result = self.send_raw(result);
2362        self.drop_without_shutdown();
2363        _result
2364    }
2365
2366    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2367        self.control_handle
2368            .inner
2369            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2370                result,
2371                self.tx_id,
2372                0x647cdcc9def3db87,
2373                fidl::encoding::DynamicFlags::empty(),
2374            )
2375    }
2376}
2377
2378#[must_use = "FIDL methods require a response to be sent"]
2379#[derive(Debug)]
2380pub struct PhyGetPowerStateResponder {
2381    control_handle: std::mem::ManuallyDrop<PhyControlHandle>,
2382    tx_id: u32,
2383}
2384
2385/// Set the the channel to be shutdown (see [`PhyControlHandle::shutdown`])
2386/// if the responder is dropped without sending a response, so that the client
2387/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2388impl std::ops::Drop for PhyGetPowerStateResponder {
2389    fn drop(&mut self) {
2390        self.control_handle.shutdown();
2391        // Safety: drops once, never accessed again
2392        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2393    }
2394}
2395
2396impl fidl::endpoints::Responder for PhyGetPowerStateResponder {
2397    type ControlHandle = PhyControlHandle;
2398
2399    fn control_handle(&self) -> &PhyControlHandle {
2400        &self.control_handle
2401    }
2402
2403    fn drop_without_shutdown(mut self) {
2404        // Safety: drops once, never accessed again due to mem::forget
2405        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2406        // Prevent Drop from running (which would shut down the channel)
2407        std::mem::forget(self);
2408    }
2409}
2410
2411impl PhyGetPowerStateResponder {
2412    /// Sends a response to the FIDL transaction.
2413    ///
2414    /// Sets the channel to shutdown if an error occurs.
2415    pub fn send(self, mut result: Result<bool, i32>) -> Result<(), fidl::Error> {
2416        let _result = self.send_raw(result);
2417        if _result.is_err() {
2418            self.control_handle.shutdown();
2419        }
2420        self.drop_without_shutdown();
2421        _result
2422    }
2423
2424    /// Similar to "send" but does not shutdown the channel if an error occurs.
2425    pub fn send_no_shutdown_on_err(self, mut result: Result<bool, i32>) -> Result<(), fidl::Error> {
2426        let _result = self.send_raw(result);
2427        self.drop_without_shutdown();
2428        _result
2429    }
2430
2431    fn send_raw(&self, mut result: Result<bool, i32>) -> Result<(), fidl::Error> {
2432        self.control_handle.inner.send::<fidl::encoding::ResultType<PhyGetPowerStateResponse, i32>>(
2433            result.map(|power_on| (power_on,)),
2434            self.tx_id,
2435            0xcddef2b16c7f00f,
2436            fidl::encoding::DynamicFlags::empty(),
2437        )
2438    }
2439}
2440
2441#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2442pub struct ServiceMarker;
2443
2444#[cfg(target_os = "fuchsia")]
2445impl fidl::endpoints::ServiceMarker for ServiceMarker {
2446    type Proxy = ServiceProxy;
2447    type Request = ServiceRequest;
2448    const SERVICE_NAME: &'static str = "fuchsia.wlan.device.Service";
2449}
2450
2451/// A request for one of the member protocols of Service.
2452///
2453#[cfg(target_os = "fuchsia")]
2454pub enum ServiceRequest {
2455    Device(ConnectorRequestStream),
2456}
2457
2458#[cfg(target_os = "fuchsia")]
2459impl fidl::endpoints::ServiceRequest for ServiceRequest {
2460    type Service = ServiceMarker;
2461
2462    fn dispatch(name: &str, _channel: fidl::AsyncChannel) -> Self {
2463        match name {
2464            "device" => Self::Device(
2465                <ConnectorRequestStream as fidl::endpoints::RequestStream>::from_channel(_channel),
2466            ),
2467            _ => panic!("no such member protocol name for service Service"),
2468        }
2469    }
2470
2471    fn member_names() -> &'static [&'static str] {
2472        &["device"]
2473    }
2474}
2475#[cfg(target_os = "fuchsia")]
2476pub struct ServiceProxy(#[allow(dead_code)] Box<dyn fidl::endpoints::MemberOpener>);
2477
2478#[cfg(target_os = "fuchsia")]
2479impl fidl::endpoints::ServiceProxy for ServiceProxy {
2480    type Service = ServiceMarker;
2481
2482    fn from_member_opener(opener: Box<dyn fidl::endpoints::MemberOpener>) -> Self {
2483        Self(opener)
2484    }
2485}
2486
2487#[cfg(target_os = "fuchsia")]
2488impl ServiceProxy {
2489    pub fn connect_to_device(&self) -> Result<ConnectorProxy, fidl::Error> {
2490        let (proxy, server_end) = fidl::endpoints::create_proxy::<ConnectorMarker>();
2491        self.connect_channel_to_device(server_end)?;
2492        Ok(proxy)
2493    }
2494
2495    /// Like `connect_to_device`, but returns a sync proxy.
2496    /// See [`Self::connect_to_device`] for more details.
2497    pub fn connect_to_device_sync(&self) -> Result<ConnectorSynchronousProxy, fidl::Error> {
2498        let (proxy, server_end) = fidl::endpoints::create_sync_proxy::<ConnectorMarker>();
2499        self.connect_channel_to_device(server_end)?;
2500        Ok(proxy)
2501    }
2502
2503    /// Like `connect_to_device`, but accepts a server end.
2504    /// See [`Self::connect_to_device`] for more details.
2505    pub fn connect_channel_to_device(
2506        &self,
2507        server_end: fidl::endpoints::ServerEnd<ConnectorMarker>,
2508    ) -> Result<(), fidl::Error> {
2509        self.0.open_member("device", server_end.into_channel())
2510    }
2511
2512    pub fn instance_name(&self) -> &str {
2513        self.0.instance_name()
2514    }
2515}
2516
2517mod internal {
2518    use super::*;
2519
2520    impl fidl::encoding::ResourceTypeMarker for ConnectorConnectRequest {
2521        type Borrowed<'a> = &'a mut Self;
2522        fn take_or_borrow<'a>(
2523            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2524        ) -> Self::Borrowed<'a> {
2525            value
2526        }
2527    }
2528
2529    unsafe impl fidl::encoding::TypeMarker for ConnectorConnectRequest {
2530        type Owned = Self;
2531
2532        #[inline(always)]
2533        fn inline_align(_context: fidl::encoding::Context) -> usize {
2534            4
2535        }
2536
2537        #[inline(always)]
2538        fn inline_size(_context: fidl::encoding::Context) -> usize {
2539            4
2540        }
2541    }
2542
2543    unsafe impl
2544        fidl::encoding::Encode<
2545            ConnectorConnectRequest,
2546            fidl::encoding::DefaultFuchsiaResourceDialect,
2547        > for &mut ConnectorConnectRequest
2548    {
2549        #[inline]
2550        unsafe fn encode(
2551            self,
2552            encoder: &mut fidl::encoding::Encoder<
2553                '_,
2554                fidl::encoding::DefaultFuchsiaResourceDialect,
2555            >,
2556            offset: usize,
2557            _depth: fidl::encoding::Depth,
2558        ) -> fidl::Result<()> {
2559            encoder.debug_check_bounds::<ConnectorConnectRequest>(offset);
2560            // Delegate to tuple encoding.
2561            fidl::encoding::Encode::<ConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2562                (
2563                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PhyMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
2564                ),
2565                encoder, offset, _depth
2566            )
2567        }
2568    }
2569    unsafe impl<
2570            T0: fidl::encoding::Encode<
2571                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PhyMarker>>,
2572                fidl::encoding::DefaultFuchsiaResourceDialect,
2573            >,
2574        >
2575        fidl::encoding::Encode<
2576            ConnectorConnectRequest,
2577            fidl::encoding::DefaultFuchsiaResourceDialect,
2578        > for (T0,)
2579    {
2580        #[inline]
2581        unsafe fn encode(
2582            self,
2583            encoder: &mut fidl::encoding::Encoder<
2584                '_,
2585                fidl::encoding::DefaultFuchsiaResourceDialect,
2586            >,
2587            offset: usize,
2588            depth: fidl::encoding::Depth,
2589        ) -> fidl::Result<()> {
2590            encoder.debug_check_bounds::<ConnectorConnectRequest>(offset);
2591            // Zero out padding regions. There's no need to apply masks
2592            // because the unmasked parts will be overwritten by fields.
2593            // Write the fields.
2594            self.0.encode(encoder, offset + 0, depth)?;
2595            Ok(())
2596        }
2597    }
2598
2599    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2600        for ConnectorConnectRequest
2601    {
2602        #[inline(always)]
2603        fn new_empty() -> Self {
2604            Self {
2605                request: fidl::new_empty!(
2606                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PhyMarker>>,
2607                    fidl::encoding::DefaultFuchsiaResourceDialect
2608                ),
2609            }
2610        }
2611
2612        #[inline]
2613        unsafe fn decode(
2614            &mut self,
2615            decoder: &mut fidl::encoding::Decoder<
2616                '_,
2617                fidl::encoding::DefaultFuchsiaResourceDialect,
2618            >,
2619            offset: usize,
2620            _depth: fidl::encoding::Depth,
2621        ) -> fidl::Result<()> {
2622            decoder.debug_check_bounds::<Self>(offset);
2623            // Verify that padding bytes are zero.
2624            fidl::decode!(
2625                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PhyMarker>>,
2626                fidl::encoding::DefaultFuchsiaResourceDialect,
2627                &mut self.request,
2628                decoder,
2629                offset + 0,
2630                _depth
2631            )?;
2632            Ok(())
2633        }
2634    }
2635
2636    impl fidl::encoding::ResourceTypeMarker for CreateIfaceRequest {
2637        type Borrowed<'a> = &'a mut Self;
2638        fn take_or_borrow<'a>(
2639            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2640        ) -> Self::Borrowed<'a> {
2641            value
2642        }
2643    }
2644
2645    unsafe impl fidl::encoding::TypeMarker for CreateIfaceRequest {
2646        type Owned = Self;
2647
2648        #[inline(always)]
2649        fn inline_align(_context: fidl::encoding::Context) -> usize {
2650            4
2651        }
2652
2653        #[inline(always)]
2654        fn inline_size(_context: fidl::encoding::Context) -> usize {
2655            16
2656        }
2657    }
2658
2659    unsafe impl
2660        fidl::encoding::Encode<CreateIfaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2661        for &mut CreateIfaceRequest
2662    {
2663        #[inline]
2664        unsafe fn encode(
2665            self,
2666            encoder: &mut fidl::encoding::Encoder<
2667                '_,
2668                fidl::encoding::DefaultFuchsiaResourceDialect,
2669            >,
2670            offset: usize,
2671            _depth: fidl::encoding::Depth,
2672        ) -> fidl::Result<()> {
2673            encoder.debug_check_bounds::<CreateIfaceRequest>(offset);
2674            // Delegate to tuple encoding.
2675            fidl::encoding::Encode::<CreateIfaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2676                (
2677                    <fidl_fuchsia_wlan_common::WlanMacRole as fidl::encoding::ValueTypeMarker>::borrow(&self.role),
2678                    <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),
2679                    <fidl::encoding::Array<u8, 6> as fidl::encoding::ValueTypeMarker>::borrow(&self.init_sta_addr),
2680                ),
2681                encoder, offset, _depth
2682            )
2683        }
2684    }
2685    unsafe impl<
2686            T0: fidl::encoding::Encode<
2687                fidl_fuchsia_wlan_common::WlanMacRole,
2688                fidl::encoding::DefaultFuchsiaResourceDialect,
2689            >,
2690            T1: fidl::encoding::Encode<
2691                fidl::encoding::Optional<
2692                    fidl::encoding::HandleType<
2693                        fidl::Channel,
2694                        { fidl::ObjectType::CHANNEL.into_raw() },
2695                        2147483648,
2696                    >,
2697                >,
2698                fidl::encoding::DefaultFuchsiaResourceDialect,
2699            >,
2700            T2: fidl::encoding::Encode<
2701                fidl::encoding::Array<u8, 6>,
2702                fidl::encoding::DefaultFuchsiaResourceDialect,
2703            >,
2704        >
2705        fidl::encoding::Encode<CreateIfaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2706        for (T0, T1, T2)
2707    {
2708        #[inline]
2709        unsafe fn encode(
2710            self,
2711            encoder: &mut fidl::encoding::Encoder<
2712                '_,
2713                fidl::encoding::DefaultFuchsiaResourceDialect,
2714            >,
2715            offset: usize,
2716            depth: fidl::encoding::Depth,
2717        ) -> fidl::Result<()> {
2718            encoder.debug_check_bounds::<CreateIfaceRequest>(offset);
2719            // Zero out padding regions. There's no need to apply masks
2720            // because the unmasked parts will be overwritten by fields.
2721            unsafe {
2722                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(12);
2723                (ptr as *mut u32).write_unaligned(0);
2724            }
2725            // Write the fields.
2726            self.0.encode(encoder, offset + 0, depth)?;
2727            self.1.encode(encoder, offset + 4, depth)?;
2728            self.2.encode(encoder, offset + 8, depth)?;
2729            Ok(())
2730        }
2731    }
2732
2733    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2734        for CreateIfaceRequest
2735    {
2736        #[inline(always)]
2737        fn new_empty() -> Self {
2738            Self {
2739                role: fidl::new_empty!(
2740                    fidl_fuchsia_wlan_common::WlanMacRole,
2741                    fidl::encoding::DefaultFuchsiaResourceDialect
2742                ),
2743                mlme_channel: fidl::new_empty!(
2744                    fidl::encoding::Optional<
2745                        fidl::encoding::HandleType<
2746                            fidl::Channel,
2747                            { fidl::ObjectType::CHANNEL.into_raw() },
2748                            2147483648,
2749                        >,
2750                    >,
2751                    fidl::encoding::DefaultFuchsiaResourceDialect
2752                ),
2753                init_sta_addr: fidl::new_empty!(fidl::encoding::Array<u8, 6>, fidl::encoding::DefaultFuchsiaResourceDialect),
2754            }
2755        }
2756
2757        #[inline]
2758        unsafe fn decode(
2759            &mut self,
2760            decoder: &mut fidl::encoding::Decoder<
2761                '_,
2762                fidl::encoding::DefaultFuchsiaResourceDialect,
2763            >,
2764            offset: usize,
2765            _depth: fidl::encoding::Depth,
2766        ) -> fidl::Result<()> {
2767            decoder.debug_check_bounds::<Self>(offset);
2768            // Verify that padding bytes are zero.
2769            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(12) };
2770            let padval = unsafe { (ptr as *const u32).read_unaligned() };
2771            let mask = 0xffff0000u32;
2772            let maskedval = padval & mask;
2773            if maskedval != 0 {
2774                return Err(fidl::Error::NonZeroPadding {
2775                    padding_start: offset + 12 + ((mask as u64).trailing_zeros() / 8) as usize,
2776                });
2777            }
2778            fidl::decode!(
2779                fidl_fuchsia_wlan_common::WlanMacRole,
2780                fidl::encoding::DefaultFuchsiaResourceDialect,
2781                &mut self.role,
2782                decoder,
2783                offset + 0,
2784                _depth
2785            )?;
2786            fidl::decode!(
2787                fidl::encoding::Optional<
2788                    fidl::encoding::HandleType<
2789                        fidl::Channel,
2790                        { fidl::ObjectType::CHANNEL.into_raw() },
2791                        2147483648,
2792                    >,
2793                >,
2794                fidl::encoding::DefaultFuchsiaResourceDialect,
2795                &mut self.mlme_channel,
2796                decoder,
2797                offset + 4,
2798                _depth
2799            )?;
2800            fidl::decode!(fidl::encoding::Array<u8, 6>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.init_sta_addr, decoder, offset + 8, _depth)?;
2801            Ok(())
2802        }
2803    }
2804
2805    impl fidl::encoding::ResourceTypeMarker for PhyCreateIfaceRequest {
2806        type Borrowed<'a> = &'a mut Self;
2807        fn take_or_borrow<'a>(
2808            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2809        ) -> Self::Borrowed<'a> {
2810            value
2811        }
2812    }
2813
2814    unsafe impl fidl::encoding::TypeMarker for PhyCreateIfaceRequest {
2815        type Owned = Self;
2816
2817        #[inline(always)]
2818        fn inline_align(_context: fidl::encoding::Context) -> usize {
2819            4
2820        }
2821
2822        #[inline(always)]
2823        fn inline_size(_context: fidl::encoding::Context) -> usize {
2824            16
2825        }
2826    }
2827
2828    unsafe impl
2829        fidl::encoding::Encode<PhyCreateIfaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2830        for &mut PhyCreateIfaceRequest
2831    {
2832        #[inline]
2833        unsafe fn encode(
2834            self,
2835            encoder: &mut fidl::encoding::Encoder<
2836                '_,
2837                fidl::encoding::DefaultFuchsiaResourceDialect,
2838            >,
2839            offset: usize,
2840            _depth: fidl::encoding::Depth,
2841        ) -> fidl::Result<()> {
2842            encoder.debug_check_bounds::<PhyCreateIfaceRequest>(offset);
2843            // Delegate to tuple encoding.
2844            fidl::encoding::Encode::<
2845                PhyCreateIfaceRequest,
2846                fidl::encoding::DefaultFuchsiaResourceDialect,
2847            >::encode(
2848                (<CreateIfaceRequest as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2849                    &mut self.req,
2850                ),),
2851                encoder,
2852                offset,
2853                _depth,
2854            )
2855        }
2856    }
2857    unsafe impl<
2858            T0: fidl::encoding::Encode<
2859                CreateIfaceRequest,
2860                fidl::encoding::DefaultFuchsiaResourceDialect,
2861            >,
2862        >
2863        fidl::encoding::Encode<PhyCreateIfaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>
2864        for (T0,)
2865    {
2866        #[inline]
2867        unsafe fn encode(
2868            self,
2869            encoder: &mut fidl::encoding::Encoder<
2870                '_,
2871                fidl::encoding::DefaultFuchsiaResourceDialect,
2872            >,
2873            offset: usize,
2874            depth: fidl::encoding::Depth,
2875        ) -> fidl::Result<()> {
2876            encoder.debug_check_bounds::<PhyCreateIfaceRequest>(offset);
2877            // Zero out padding regions. There's no need to apply masks
2878            // because the unmasked parts will be overwritten by fields.
2879            // Write the fields.
2880            self.0.encode(encoder, offset + 0, depth)?;
2881            Ok(())
2882        }
2883    }
2884
2885    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2886        for PhyCreateIfaceRequest
2887    {
2888        #[inline(always)]
2889        fn new_empty() -> Self {
2890            Self {
2891                req: fidl::new_empty!(
2892                    CreateIfaceRequest,
2893                    fidl::encoding::DefaultFuchsiaResourceDialect
2894                ),
2895            }
2896        }
2897
2898        #[inline]
2899        unsafe fn decode(
2900            &mut self,
2901            decoder: &mut fidl::encoding::Decoder<
2902                '_,
2903                fidl::encoding::DefaultFuchsiaResourceDialect,
2904            >,
2905            offset: usize,
2906            _depth: fidl::encoding::Depth,
2907        ) -> fidl::Result<()> {
2908            decoder.debug_check_bounds::<Self>(offset);
2909            // Verify that padding bytes are zero.
2910            fidl::decode!(
2911                CreateIfaceRequest,
2912                fidl::encoding::DefaultFuchsiaResourceDialect,
2913                &mut self.req,
2914                decoder,
2915                offset + 0,
2916                _depth
2917            )?;
2918            Ok(())
2919        }
2920    }
2921}