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