fidl_fuchsia_wlan_tap/
fidl_fuchsia_wlan_tap.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 _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Clone, Debug, PartialEq)]
14pub struct JoinBssArgs {
15    pub wlan_softmac_id: u16,
16    pub config: fidl_fuchsia_wlan_common::JoinBssRequest,
17}
18
19impl fidl::Persistable for JoinBssArgs {}
20
21#[derive(Clone, Debug, PartialEq)]
22pub struct SetChannelArgs {
23    pub wlan_softmac_id: u16,
24    pub channel: fidl_fuchsia_wlan_common::WlanChannel,
25}
26
27impl fidl::Persistable for SetChannelArgs {}
28
29/// Country code the device is to switch to.
30/// These values are populated by the wlantap driver and should not be specified manually.
31/// See also phy.fidl CountryCode.
32#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
33#[repr(C)]
34pub struct SetCountryArgs {
35    pub alpha2: [u8; 2],
36}
37
38impl fidl::Persistable for SetCountryArgs {}
39
40#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
41pub struct SetKeyArgs {
42    pub wlan_softmac_id: u16,
43    pub config: WlanKeyConfig,
44}
45
46impl fidl::Persistable for SetKeyArgs {}
47
48#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
49#[repr(C)]
50pub struct StartScanArgs {
51    pub wlan_softmac_id: u16,
52    pub scan_id: u64,
53}
54
55impl fidl::Persistable for StartScanArgs {}
56
57#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
58pub struct TxArgs {
59    pub wlan_softmac_id: u16,
60    pub packet: WlanTxPacket,
61}
62
63impl fidl::Persistable for TxArgs {}
64
65/// Configuration pertaining to security keys, often used by RSN and other secure authentication.
66/// These values are populated by the wlantap driver and should not be specified manually.
67/// See wlan_key_config_t for details about each field.
68#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
69pub struct WlanKeyConfig {
70    pub protection: u8,
71    pub cipher_oui: [u8; 3],
72    pub cipher_type: u8,
73    pub key_type: u8,
74    pub peer_addr: [u8; 6],
75    pub key_idx: u8,
76    pub key: Vec<u8>,
77}
78
79impl fidl::Persistable for WlanKeyConfig {}
80
81/// Information pertaining to incoming packets. One WlanRxInfo is associated with each packet.
82/// You are encouraged to use the default value in //src/connectivity/wlan/testing/hw-sim/src/lib.rs
83/// See wlan_rx_info_t for details about each field.
84#[derive(Clone, Debug, PartialEq)]
85pub struct WlanRxInfo {
86    pub rx_flags: u32,
87    pub valid_fields: u32,
88    pub phy: fidl_fuchsia_wlan_common::WlanPhyType,
89    pub data_rate: u32,
90    pub channel: fidl_fuchsia_wlan_common::WlanChannel,
91    pub mcs: u8,
92    pub rssi_dbm: i8,
93    pub snr_dbh: i16,
94}
95
96impl fidl::Persistable for WlanRxInfo {}
97
98/// Instruction from generic WLAN driver on how to send a packet. One WlanTxInfo per packet.
99/// These values are populated by the wlantap driver and should not be specified manually.
100/// See wlan_tx_info_t for details about each field.
101#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
102pub struct WlanTxInfo {
103    pub tx_flags: u32,
104    pub valid_fields: u32,
105    pub tx_vector_idx: u16,
106    pub phy: fidl_fuchsia_wlan_common::WlanPhyType,
107    pub cbw: u8,
108    pub mcs: u8,
109}
110
111impl fidl::Persistable for WlanTxInfo {}
112
113/// An outgoing packet that is to be "sent" by the wlantap device. `data` contains the packet
114/// in its wire format.
115#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
116pub struct WlanTxPacket {
117    pub data: Vec<u8>,
118    pub info: WlanTxInfo,
119}
120
121impl fidl::Persistable for WlanTxPacket {}
122
123#[derive(Debug, PartialEq)]
124pub struct WlantapCtlCreatePhyRequest {
125    pub config: WlantapPhyConfig,
126    pub proxy: fidl::endpoints::ServerEnd<WlantapPhyMarker>,
127}
128
129impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
130    for WlantapCtlCreatePhyRequest
131{
132}
133
134#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
135#[repr(C)]
136pub struct WlantapCtlCreatePhyResponse {
137    pub status: i32,
138}
139
140impl fidl::Persistable for WlantapCtlCreatePhyResponse {}
141
142/// Describes the capabilities of the fake wlantap-phy device to be created.
143#[derive(Clone, Debug, PartialEq)]
144pub struct WlantapPhyConfig {
145    pub sta_addr: [u8; 6],
146    pub mac_role: fidl_fuchsia_wlan_common::WlanMacRole,
147    pub supported_phys: Vec<fidl_fuchsia_wlan_common::WlanPhyType>,
148    pub hardware_capability: u32,
149    pub bands: Vec<fidl_fuchsia_wlan_device::BandInfo>,
150    pub name: String,
151    pub quiet: bool,
152    pub discovery_support: fidl_fuchsia_wlan_common::DiscoverySupport,
153    pub mac_sublayer_support: fidl_fuchsia_wlan_common::MacSublayerSupport,
154    pub security_support: fidl_fuchsia_wlan_common::SecuritySupport,
155    pub spectrum_management_support: fidl_fuchsia_wlan_common::SpectrumManagementSupport,
156}
157
158impl fidl::Persistable for WlantapPhyConfig {}
159
160#[derive(Clone, Debug, PartialEq)]
161pub struct WlantapPhyJoinBssRequest {
162    pub args: JoinBssArgs,
163}
164
165impl fidl::Persistable for WlantapPhyJoinBssRequest {}
166
167#[derive(Clone, Debug, PartialEq)]
168pub struct WlantapPhyReportTxResultRequest {
169    pub txr: fidl_fuchsia_wlan_common::WlanTxResult,
170}
171
172impl fidl::Persistable for WlantapPhyReportTxResultRequest {}
173
174#[derive(Clone, Debug, PartialEq)]
175pub struct WlantapPhyRxRequest {
176    pub data: Vec<u8>,
177    pub info: WlanRxInfo,
178}
179
180impl fidl::Persistable for WlantapPhyRxRequest {}
181
182#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
183#[repr(C)]
184pub struct WlantapPhyScanCompleteRequest {
185    pub scan_id: u64,
186    pub status: i32,
187}
188
189impl fidl::Persistable for WlantapPhyScanCompleteRequest {}
190
191#[derive(Clone, Debug, PartialEq)]
192pub struct WlantapPhySetChannelRequest {
193    pub args: SetChannelArgs,
194}
195
196impl fidl::Persistable for WlantapPhySetChannelRequest {}
197
198#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
199#[repr(C)]
200pub struct WlantapPhySetCountryRequest {
201    pub args: SetCountryArgs,
202}
203
204impl fidl::Persistable for WlantapPhySetCountryRequest {}
205
206#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
207pub struct WlantapPhySetKeyRequest {
208    pub args: SetKeyArgs,
209}
210
211impl fidl::Persistable for WlantapPhySetKeyRequest {}
212
213#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
214#[repr(C)]
215pub struct WlantapPhyStartScanRequest {
216    pub args: StartScanArgs,
217}
218
219impl fidl::Persistable for WlantapPhyStartScanRequest {}
220
221#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
222pub struct WlantapPhyTxRequest {
223    pub args: TxArgs,
224}
225
226impl fidl::Persistable for WlantapPhyTxRequest {}
227
228#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
229pub struct WlantapCtlMarker;
230
231impl fidl::endpoints::ProtocolMarker for WlantapCtlMarker {
232    type Proxy = WlantapCtlProxy;
233    type RequestStream = WlantapCtlRequestStream;
234    #[cfg(target_os = "fuchsia")]
235    type SynchronousProxy = WlantapCtlSynchronousProxy;
236
237    const DEBUG_NAME: &'static str = "(anonymous) WlantapCtl";
238}
239
240pub trait WlantapCtlProxyInterface: Send + Sync {
241    type CreatePhyResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
242    fn r#create_phy(
243        &self,
244        config: &WlantapPhyConfig,
245        proxy: fidl::endpoints::ServerEnd<WlantapPhyMarker>,
246    ) -> Self::CreatePhyResponseFut;
247}
248#[derive(Debug)]
249#[cfg(target_os = "fuchsia")]
250pub struct WlantapCtlSynchronousProxy {
251    client: fidl::client::sync::Client,
252}
253
254#[cfg(target_os = "fuchsia")]
255impl fidl::endpoints::SynchronousProxy for WlantapCtlSynchronousProxy {
256    type Proxy = WlantapCtlProxy;
257    type Protocol = WlantapCtlMarker;
258
259    fn from_channel(inner: fidl::Channel) -> Self {
260        Self::new(inner)
261    }
262
263    fn into_channel(self) -> fidl::Channel {
264        self.client.into_channel()
265    }
266
267    fn as_channel(&self) -> &fidl::Channel {
268        self.client.as_channel()
269    }
270}
271
272#[cfg(target_os = "fuchsia")]
273impl WlantapCtlSynchronousProxy {
274    pub fn new(channel: fidl::Channel) -> Self {
275        let protocol_name = <WlantapCtlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
276        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
277    }
278
279    pub fn into_channel(self) -> fidl::Channel {
280        self.client.into_channel()
281    }
282
283    /// Waits until an event arrives and returns it. It is safe for other
284    /// threads to make concurrent requests while waiting for an event.
285    pub fn wait_for_event(
286        &self,
287        deadline: zx::MonotonicInstant,
288    ) -> Result<WlantapCtlEvent, fidl::Error> {
289        WlantapCtlEvent::decode(self.client.wait_for_event(deadline)?)
290    }
291
292    pub fn r#create_phy(
293        &self,
294        mut config: &WlantapPhyConfig,
295        mut proxy: fidl::endpoints::ServerEnd<WlantapPhyMarker>,
296        ___deadline: zx::MonotonicInstant,
297    ) -> Result<i32, fidl::Error> {
298        let _response =
299            self.client.send_query::<WlantapCtlCreatePhyRequest, WlantapCtlCreatePhyResponse>(
300                (config, proxy),
301                0x50273d8f10ceb35d,
302                fidl::encoding::DynamicFlags::empty(),
303                ___deadline,
304            )?;
305        Ok(_response.status)
306    }
307}
308
309#[derive(Debug, Clone)]
310pub struct WlantapCtlProxy {
311    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
312}
313
314impl fidl::endpoints::Proxy for WlantapCtlProxy {
315    type Protocol = WlantapCtlMarker;
316
317    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
318        Self::new(inner)
319    }
320
321    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
322        self.client.into_channel().map_err(|client| Self { client })
323    }
324
325    fn as_channel(&self) -> &::fidl::AsyncChannel {
326        self.client.as_channel()
327    }
328}
329
330impl WlantapCtlProxy {
331    /// Create a new Proxy for fuchsia.wlan.tap/WlantapCtl.
332    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
333        let protocol_name = <WlantapCtlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
334        Self { client: fidl::client::Client::new(channel, protocol_name) }
335    }
336
337    /// Get a Stream of events from the remote end of the protocol.
338    ///
339    /// # Panics
340    ///
341    /// Panics if the event stream was already taken.
342    pub fn take_event_stream(&self) -> WlantapCtlEventStream {
343        WlantapCtlEventStream { event_receiver: self.client.take_event_receiver() }
344    }
345
346    pub fn r#create_phy(
347        &self,
348        mut config: &WlantapPhyConfig,
349        mut proxy: fidl::endpoints::ServerEnd<WlantapPhyMarker>,
350    ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
351        WlantapCtlProxyInterface::r#create_phy(self, config, proxy)
352    }
353}
354
355impl WlantapCtlProxyInterface for WlantapCtlProxy {
356    type CreatePhyResponseFut =
357        fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
358    fn r#create_phy(
359        &self,
360        mut config: &WlantapPhyConfig,
361        mut proxy: fidl::endpoints::ServerEnd<WlantapPhyMarker>,
362    ) -> Self::CreatePhyResponseFut {
363        fn _decode(
364            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
365        ) -> Result<i32, fidl::Error> {
366            let _response = fidl::client::decode_transaction_body::<
367                WlantapCtlCreatePhyResponse,
368                fidl::encoding::DefaultFuchsiaResourceDialect,
369                0x50273d8f10ceb35d,
370            >(_buf?)?;
371            Ok(_response.status)
372        }
373        self.client.send_query_and_decode::<WlantapCtlCreatePhyRequest, i32>(
374            (config, proxy),
375            0x50273d8f10ceb35d,
376            fidl::encoding::DynamicFlags::empty(),
377            _decode,
378        )
379    }
380}
381
382pub struct WlantapCtlEventStream {
383    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
384}
385
386impl std::marker::Unpin for WlantapCtlEventStream {}
387
388impl futures::stream::FusedStream for WlantapCtlEventStream {
389    fn is_terminated(&self) -> bool {
390        self.event_receiver.is_terminated()
391    }
392}
393
394impl futures::Stream for WlantapCtlEventStream {
395    type Item = Result<WlantapCtlEvent, fidl::Error>;
396
397    fn poll_next(
398        mut self: std::pin::Pin<&mut Self>,
399        cx: &mut std::task::Context<'_>,
400    ) -> std::task::Poll<Option<Self::Item>> {
401        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
402            &mut self.event_receiver,
403            cx
404        )?) {
405            Some(buf) => std::task::Poll::Ready(Some(WlantapCtlEvent::decode(buf))),
406            None => std::task::Poll::Ready(None),
407        }
408    }
409}
410
411#[derive(Debug)]
412pub enum WlantapCtlEvent {}
413
414impl WlantapCtlEvent {
415    /// Decodes a message buffer as a [`WlantapCtlEvent`].
416    fn decode(
417        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
418    ) -> Result<WlantapCtlEvent, fidl::Error> {
419        let (bytes, _handles) = buf.split_mut();
420        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
421        debug_assert_eq!(tx_header.tx_id, 0);
422        match tx_header.ordinal {
423            _ => Err(fidl::Error::UnknownOrdinal {
424                ordinal: tx_header.ordinal,
425                protocol_name: <WlantapCtlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
426            }),
427        }
428    }
429}
430
431/// A Stream of incoming requests for fuchsia.wlan.tap/WlantapCtl.
432pub struct WlantapCtlRequestStream {
433    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
434    is_terminated: bool,
435}
436
437impl std::marker::Unpin for WlantapCtlRequestStream {}
438
439impl futures::stream::FusedStream for WlantapCtlRequestStream {
440    fn is_terminated(&self) -> bool {
441        self.is_terminated
442    }
443}
444
445impl fidl::endpoints::RequestStream for WlantapCtlRequestStream {
446    type Protocol = WlantapCtlMarker;
447    type ControlHandle = WlantapCtlControlHandle;
448
449    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
450        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
451    }
452
453    fn control_handle(&self) -> Self::ControlHandle {
454        WlantapCtlControlHandle { inner: self.inner.clone() }
455    }
456
457    fn into_inner(
458        self,
459    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
460    {
461        (self.inner, self.is_terminated)
462    }
463
464    fn from_inner(
465        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
466        is_terminated: bool,
467    ) -> Self {
468        Self { inner, is_terminated }
469    }
470}
471
472impl futures::Stream for WlantapCtlRequestStream {
473    type Item = Result<WlantapCtlRequest, fidl::Error>;
474
475    fn poll_next(
476        mut self: std::pin::Pin<&mut Self>,
477        cx: &mut std::task::Context<'_>,
478    ) -> std::task::Poll<Option<Self::Item>> {
479        let this = &mut *self;
480        if this.inner.check_shutdown(cx) {
481            this.is_terminated = true;
482            return std::task::Poll::Ready(None);
483        }
484        if this.is_terminated {
485            panic!("polled WlantapCtlRequestStream after completion");
486        }
487        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
488            |bytes, handles| {
489                match this.inner.channel().read_etc(cx, bytes, handles) {
490                    std::task::Poll::Ready(Ok(())) => {}
491                    std::task::Poll::Pending => return std::task::Poll::Pending,
492                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
493                        this.is_terminated = true;
494                        return std::task::Poll::Ready(None);
495                    }
496                    std::task::Poll::Ready(Err(e)) => {
497                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
498                            e.into(),
499                        ))))
500                    }
501                }
502
503                // A message has been received from the channel
504                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
505
506                std::task::Poll::Ready(Some(match header.ordinal {
507                    0x50273d8f10ceb35d => {
508                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
509                        let mut req = fidl::new_empty!(
510                            WlantapCtlCreatePhyRequest,
511                            fidl::encoding::DefaultFuchsiaResourceDialect
512                        );
513                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlantapCtlCreatePhyRequest>(&header, _body_bytes, handles, &mut req)?;
514                        let control_handle = WlantapCtlControlHandle { inner: this.inner.clone() };
515                        Ok(WlantapCtlRequest::CreatePhy {
516                            config: req.config,
517                            proxy: req.proxy,
518
519                            responder: WlantapCtlCreatePhyResponder {
520                                control_handle: std::mem::ManuallyDrop::new(control_handle),
521                                tx_id: header.tx_id,
522                            },
523                        })
524                    }
525                    _ => Err(fidl::Error::UnknownOrdinal {
526                        ordinal: header.ordinal,
527                        protocol_name:
528                            <WlantapCtlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
529                    }),
530                }))
531            },
532        )
533    }
534}
535
536/// Instruct the wlantap-ctl device to creates a fake wlantap-phy device based on the
537/// `WlantapPhyConfig` passed in. The newly created wlantap-phy device will use the channel to
538/// allow a `WlantapPhy` client to observe and control its behavior.
539#[derive(Debug)]
540pub enum WlantapCtlRequest {
541    CreatePhy {
542        config: WlantapPhyConfig,
543        proxy: fidl::endpoints::ServerEnd<WlantapPhyMarker>,
544        responder: WlantapCtlCreatePhyResponder,
545    },
546}
547
548impl WlantapCtlRequest {
549    #[allow(irrefutable_let_patterns)]
550    pub fn into_create_phy(
551        self,
552    ) -> Option<(
553        WlantapPhyConfig,
554        fidl::endpoints::ServerEnd<WlantapPhyMarker>,
555        WlantapCtlCreatePhyResponder,
556    )> {
557        if let WlantapCtlRequest::CreatePhy { config, proxy, responder } = self {
558            Some((config, proxy, responder))
559        } else {
560            None
561        }
562    }
563
564    /// Name of the method defined in FIDL
565    pub fn method_name(&self) -> &'static str {
566        match *self {
567            WlantapCtlRequest::CreatePhy { .. } => "create_phy",
568        }
569    }
570}
571
572#[derive(Debug, Clone)]
573pub struct WlantapCtlControlHandle {
574    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
575}
576
577impl fidl::endpoints::ControlHandle for WlantapCtlControlHandle {
578    fn shutdown(&self) {
579        self.inner.shutdown()
580    }
581    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
582        self.inner.shutdown_with_epitaph(status)
583    }
584
585    fn is_closed(&self) -> bool {
586        self.inner.channel().is_closed()
587    }
588    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
589        self.inner.channel().on_closed()
590    }
591
592    #[cfg(target_os = "fuchsia")]
593    fn signal_peer(
594        &self,
595        clear_mask: zx::Signals,
596        set_mask: zx::Signals,
597    ) -> Result<(), zx_status::Status> {
598        use fidl::Peered;
599        self.inner.channel().signal_peer(clear_mask, set_mask)
600    }
601}
602
603impl WlantapCtlControlHandle {}
604
605#[must_use = "FIDL methods require a response to be sent"]
606#[derive(Debug)]
607pub struct WlantapCtlCreatePhyResponder {
608    control_handle: std::mem::ManuallyDrop<WlantapCtlControlHandle>,
609    tx_id: u32,
610}
611
612/// Set the the channel to be shutdown (see [`WlantapCtlControlHandle::shutdown`])
613/// if the responder is dropped without sending a response, so that the client
614/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
615impl std::ops::Drop for WlantapCtlCreatePhyResponder {
616    fn drop(&mut self) {
617        self.control_handle.shutdown();
618        // Safety: drops once, never accessed again
619        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
620    }
621}
622
623impl fidl::endpoints::Responder for WlantapCtlCreatePhyResponder {
624    type ControlHandle = WlantapCtlControlHandle;
625
626    fn control_handle(&self) -> &WlantapCtlControlHandle {
627        &self.control_handle
628    }
629
630    fn drop_without_shutdown(mut self) {
631        // Safety: drops once, never accessed again due to mem::forget
632        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
633        // Prevent Drop from running (which would shut down the channel)
634        std::mem::forget(self);
635    }
636}
637
638impl WlantapCtlCreatePhyResponder {
639    /// Sends a response to the FIDL transaction.
640    ///
641    /// Sets the channel to shutdown if an error occurs.
642    pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
643        let _result = self.send_raw(status);
644        if _result.is_err() {
645            self.control_handle.shutdown();
646        }
647        self.drop_without_shutdown();
648        _result
649    }
650
651    /// Similar to "send" but does not shutdown the channel if an error occurs.
652    pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
653        let _result = self.send_raw(status);
654        self.drop_without_shutdown();
655        _result
656    }
657
658    fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
659        self.control_handle.inner.send::<WlantapCtlCreatePhyResponse>(
660            (status,),
661            self.tx_id,
662            0x50273d8f10ceb35d,
663            fidl::encoding::DynamicFlags::empty(),
664        )
665    }
666}
667
668#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
669pub struct WlantapPhyMarker;
670
671impl fidl::endpoints::ProtocolMarker for WlantapPhyMarker {
672    type Proxy = WlantapPhyProxy;
673    type RequestStream = WlantapPhyRequestStream;
674    #[cfg(target_os = "fuchsia")]
675    type SynchronousProxy = WlantapPhySynchronousProxy;
676
677    const DEBUG_NAME: &'static str = "(anonymous) WlantapPhy";
678}
679
680pub trait WlantapPhyProxyInterface: Send + Sync {
681    type ShutdownResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
682    fn r#shutdown(&self) -> Self::ShutdownResponseFut;
683    fn r#rx(&self, data: &[u8], info: &WlanRxInfo) -> Result<(), fidl::Error>;
684    fn r#report_tx_result(
685        &self,
686        txr: &fidl_fuchsia_wlan_common::WlanTxResult,
687    ) -> Result<(), fidl::Error>;
688    fn r#scan_complete(&self, scan_id: u64, status: i32) -> Result<(), fidl::Error>;
689}
690#[derive(Debug)]
691#[cfg(target_os = "fuchsia")]
692pub struct WlantapPhySynchronousProxy {
693    client: fidl::client::sync::Client,
694}
695
696#[cfg(target_os = "fuchsia")]
697impl fidl::endpoints::SynchronousProxy for WlantapPhySynchronousProxy {
698    type Proxy = WlantapPhyProxy;
699    type Protocol = WlantapPhyMarker;
700
701    fn from_channel(inner: fidl::Channel) -> Self {
702        Self::new(inner)
703    }
704
705    fn into_channel(self) -> fidl::Channel {
706        self.client.into_channel()
707    }
708
709    fn as_channel(&self) -> &fidl::Channel {
710        self.client.as_channel()
711    }
712}
713
714#[cfg(target_os = "fuchsia")]
715impl WlantapPhySynchronousProxy {
716    pub fn new(channel: fidl::Channel) -> Self {
717        let protocol_name = <WlantapPhyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
718        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
719    }
720
721    pub fn into_channel(self) -> fidl::Channel {
722        self.client.into_channel()
723    }
724
725    /// Waits until an event arrives and returns it. It is safe for other
726    /// threads to make concurrent requests while waiting for an event.
727    pub fn wait_for_event(
728        &self,
729        deadline: zx::MonotonicInstant,
730    ) -> Result<WlantapPhyEvent, fidl::Error> {
731        WlantapPhyEvent::decode(self.client.wait_for_event(deadline)?)
732    }
733
734    /// Shutdown the phy device so that it does not respond to any further calls.
735    /// Once shutdown, there is no way to restart the device.
736    /// It can only be called at the end of a test.
737    pub fn r#shutdown(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
738        let _response =
739            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
740                (),
741                0x1df8087c49fa9a5e,
742                fidl::encoding::DynamicFlags::empty(),
743                ___deadline,
744            )?;
745        Ok(_response)
746    }
747
748    /// The device "receives" a frame "over the air" and pass it up to driver.
749    pub fn r#rx(&self, mut data: &[u8], mut info: &WlanRxInfo) -> Result<(), fidl::Error> {
750        self.client.send::<WlantapPhyRxRequest>(
751            (data, info),
752            0x165a656419ab3b41,
753            fidl::encoding::DynamicFlags::empty(),
754        )
755    }
756
757    /// For rate selection (Minstrel), the device's last frame transmission is a success/failure,
758    /// with a certain number of retries.
759    pub fn r#report_tx_result(
760        &self,
761        mut txr: &fidl_fuchsia_wlan_common::WlanTxResult,
762    ) -> Result<(), fidl::Error> {
763        self.client.send::<WlantapPhyReportTxResultRequest>(
764            (txr,),
765            0x2c27ed678c1e7eb4,
766            fidl::encoding::DynamicFlags::empty(),
767        )
768    }
769
770    pub fn r#scan_complete(&self, mut scan_id: u64, mut status: i32) -> Result<(), fidl::Error> {
771        self.client.send::<WlantapPhyScanCompleteRequest>(
772            (scan_id, status),
773            0x61a579015cff7674,
774            fidl::encoding::DynamicFlags::empty(),
775        )
776    }
777}
778
779#[derive(Debug, Clone)]
780pub struct WlantapPhyProxy {
781    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
782}
783
784impl fidl::endpoints::Proxy for WlantapPhyProxy {
785    type Protocol = WlantapPhyMarker;
786
787    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
788        Self::new(inner)
789    }
790
791    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
792        self.client.into_channel().map_err(|client| Self { client })
793    }
794
795    fn as_channel(&self) -> &::fidl::AsyncChannel {
796        self.client.as_channel()
797    }
798}
799
800impl WlantapPhyProxy {
801    /// Create a new Proxy for fuchsia.wlan.tap/WlantapPhy.
802    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
803        let protocol_name = <WlantapPhyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
804        Self { client: fidl::client::Client::new(channel, protocol_name) }
805    }
806
807    /// Get a Stream of events from the remote end of the protocol.
808    ///
809    /// # Panics
810    ///
811    /// Panics if the event stream was already taken.
812    pub fn take_event_stream(&self) -> WlantapPhyEventStream {
813        WlantapPhyEventStream { event_receiver: self.client.take_event_receiver() }
814    }
815
816    /// Shutdown the phy device so that it does not respond to any further calls.
817    /// Once shutdown, there is no way to restart the device.
818    /// It can only be called at the end of a test.
819    pub fn r#shutdown(
820        &self,
821    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
822        WlantapPhyProxyInterface::r#shutdown(self)
823    }
824
825    /// The device "receives" a frame "over the air" and pass it up to driver.
826    pub fn r#rx(&self, mut data: &[u8], mut info: &WlanRxInfo) -> Result<(), fidl::Error> {
827        WlantapPhyProxyInterface::r#rx(self, data, info)
828    }
829
830    /// For rate selection (Minstrel), the device's last frame transmission is a success/failure,
831    /// with a certain number of retries.
832    pub fn r#report_tx_result(
833        &self,
834        mut txr: &fidl_fuchsia_wlan_common::WlanTxResult,
835    ) -> Result<(), fidl::Error> {
836        WlantapPhyProxyInterface::r#report_tx_result(self, txr)
837    }
838
839    pub fn r#scan_complete(&self, mut scan_id: u64, mut status: i32) -> Result<(), fidl::Error> {
840        WlantapPhyProxyInterface::r#scan_complete(self, scan_id, status)
841    }
842}
843
844impl WlantapPhyProxyInterface for WlantapPhyProxy {
845    type ShutdownResponseFut =
846        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
847    fn r#shutdown(&self) -> Self::ShutdownResponseFut {
848        fn _decode(
849            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
850        ) -> Result<(), fidl::Error> {
851            let _response = fidl::client::decode_transaction_body::<
852                fidl::encoding::EmptyPayload,
853                fidl::encoding::DefaultFuchsiaResourceDialect,
854                0x1df8087c49fa9a5e,
855            >(_buf?)?;
856            Ok(_response)
857        }
858        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
859            (),
860            0x1df8087c49fa9a5e,
861            fidl::encoding::DynamicFlags::empty(),
862            _decode,
863        )
864    }
865
866    fn r#rx(&self, mut data: &[u8], mut info: &WlanRxInfo) -> Result<(), fidl::Error> {
867        self.client.send::<WlantapPhyRxRequest>(
868            (data, info),
869            0x165a656419ab3b41,
870            fidl::encoding::DynamicFlags::empty(),
871        )
872    }
873
874    fn r#report_tx_result(
875        &self,
876        mut txr: &fidl_fuchsia_wlan_common::WlanTxResult,
877    ) -> Result<(), fidl::Error> {
878        self.client.send::<WlantapPhyReportTxResultRequest>(
879            (txr,),
880            0x2c27ed678c1e7eb4,
881            fidl::encoding::DynamicFlags::empty(),
882        )
883    }
884
885    fn r#scan_complete(&self, mut scan_id: u64, mut status: i32) -> Result<(), fidl::Error> {
886        self.client.send::<WlantapPhyScanCompleteRequest>(
887            (scan_id, status),
888            0x61a579015cff7674,
889            fidl::encoding::DynamicFlags::empty(),
890        )
891    }
892}
893
894pub struct WlantapPhyEventStream {
895    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
896}
897
898impl std::marker::Unpin for WlantapPhyEventStream {}
899
900impl futures::stream::FusedStream for WlantapPhyEventStream {
901    fn is_terminated(&self) -> bool {
902        self.event_receiver.is_terminated()
903    }
904}
905
906impl futures::Stream for WlantapPhyEventStream {
907    type Item = Result<WlantapPhyEvent, fidl::Error>;
908
909    fn poll_next(
910        mut self: std::pin::Pin<&mut Self>,
911        cx: &mut std::task::Context<'_>,
912    ) -> std::task::Poll<Option<Self::Item>> {
913        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
914            &mut self.event_receiver,
915            cx
916        )?) {
917            Some(buf) => std::task::Poll::Ready(Some(WlantapPhyEvent::decode(buf))),
918            None => std::task::Poll::Ready(None),
919        }
920    }
921}
922
923#[derive(Debug)]
924pub enum WlantapPhyEvent {
925    Tx { args: TxArgs },
926    WlanSoftmacStart {},
927    SetChannel { args: SetChannelArgs },
928    JoinBss { args: JoinBssArgs },
929    StartScan { args: StartScanArgs },
930    SetKey { args: SetKeyArgs },
931    SetCountry { args: SetCountryArgs },
932}
933
934impl WlantapPhyEvent {
935    #[allow(irrefutable_let_patterns)]
936    pub fn into_tx(self) -> Option<TxArgs> {
937        if let WlantapPhyEvent::Tx { args } = self {
938            Some((args))
939        } else {
940            None
941        }
942    }
943    #[allow(irrefutable_let_patterns)]
944    pub fn into_wlan_softmac_start(self) -> Option<()> {
945        if let WlantapPhyEvent::WlanSoftmacStart {} = self {
946            Some(())
947        } else {
948            None
949        }
950    }
951    #[allow(irrefutable_let_patterns)]
952    pub fn into_set_channel(self) -> Option<SetChannelArgs> {
953        if let WlantapPhyEvent::SetChannel { args } = self {
954            Some((args))
955        } else {
956            None
957        }
958    }
959    #[allow(irrefutable_let_patterns)]
960    pub fn into_join_bss(self) -> Option<JoinBssArgs> {
961        if let WlantapPhyEvent::JoinBss { args } = self {
962            Some((args))
963        } else {
964            None
965        }
966    }
967    #[allow(irrefutable_let_patterns)]
968    pub fn into_start_scan(self) -> Option<StartScanArgs> {
969        if let WlantapPhyEvent::StartScan { args } = self {
970            Some((args))
971        } else {
972            None
973        }
974    }
975    #[allow(irrefutable_let_patterns)]
976    pub fn into_set_key(self) -> Option<SetKeyArgs> {
977        if let WlantapPhyEvent::SetKey { args } = self {
978            Some((args))
979        } else {
980            None
981        }
982    }
983    #[allow(irrefutable_let_patterns)]
984    pub fn into_set_country(self) -> Option<SetCountryArgs> {
985        if let WlantapPhyEvent::SetCountry { args } = self {
986            Some((args))
987        } else {
988            None
989        }
990    }
991
992    /// Decodes a message buffer as a [`WlantapPhyEvent`].
993    fn decode(
994        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
995    ) -> Result<WlantapPhyEvent, fidl::Error> {
996        let (bytes, _handles) = buf.split_mut();
997        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
998        debug_assert_eq!(tx_header.tx_id, 0);
999        match tx_header.ordinal {
1000            0x3ccc6c207280b569 => {
1001                let mut out = fidl::new_empty!(
1002                    WlantapPhyTxRequest,
1003                    fidl::encoding::DefaultFuchsiaResourceDialect
1004                );
1005                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlantapPhyTxRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1006                Ok((WlantapPhyEvent::Tx { args: out.args }))
1007            }
1008            0x328bcae20dec2b88 => {
1009                let mut out = fidl::new_empty!(
1010                    fidl::encoding::EmptyPayload,
1011                    fidl::encoding::DefaultFuchsiaResourceDialect
1012                );
1013                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
1014                Ok((WlantapPhyEvent::WlanSoftmacStart {}))
1015            }
1016            0x60eb9a607f96a948 => {
1017                let mut out = fidl::new_empty!(
1018                    WlantapPhySetChannelRequest,
1019                    fidl::encoding::DefaultFuchsiaResourceDialect
1020                );
1021                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlantapPhySetChannelRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1022                Ok((WlantapPhyEvent::SetChannel { args: out.args }))
1023            }
1024            0xef930e871dbf2f9 => {
1025                let mut out = fidl::new_empty!(
1026                    WlantapPhyJoinBssRequest,
1027                    fidl::encoding::DefaultFuchsiaResourceDialect
1028                );
1029                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlantapPhyJoinBssRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1030                Ok((WlantapPhyEvent::JoinBss { args: out.args }))
1031            }
1032            0x75ed87321e05cdbb => {
1033                let mut out = fidl::new_empty!(
1034                    WlantapPhyStartScanRequest,
1035                    fidl::encoding::DefaultFuchsiaResourceDialect
1036                );
1037                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlantapPhyStartScanRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1038                Ok((WlantapPhyEvent::StartScan { args: out.args }))
1039            }
1040            0xff7bf591b026267 => {
1041                let mut out = fidl::new_empty!(
1042                    WlantapPhySetKeyRequest,
1043                    fidl::encoding::DefaultFuchsiaResourceDialect
1044                );
1045                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlantapPhySetKeyRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1046                Ok((WlantapPhyEvent::SetKey { args: out.args }))
1047            }
1048            0x4cd2f84e3ccfcd14 => {
1049                let mut out = fidl::new_empty!(
1050                    WlantapPhySetCountryRequest,
1051                    fidl::encoding::DefaultFuchsiaResourceDialect
1052                );
1053                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlantapPhySetCountryRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1054                Ok((WlantapPhyEvent::SetCountry { args: out.args }))
1055            }
1056            _ => Err(fidl::Error::UnknownOrdinal {
1057                ordinal: tx_header.ordinal,
1058                protocol_name: <WlantapPhyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1059            }),
1060        }
1061    }
1062}
1063
1064/// A Stream of incoming requests for fuchsia.wlan.tap/WlantapPhy.
1065pub struct WlantapPhyRequestStream {
1066    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1067    is_terminated: bool,
1068}
1069
1070impl std::marker::Unpin for WlantapPhyRequestStream {}
1071
1072impl futures::stream::FusedStream for WlantapPhyRequestStream {
1073    fn is_terminated(&self) -> bool {
1074        self.is_terminated
1075    }
1076}
1077
1078impl fidl::endpoints::RequestStream for WlantapPhyRequestStream {
1079    type Protocol = WlantapPhyMarker;
1080    type ControlHandle = WlantapPhyControlHandle;
1081
1082    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1083        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1084    }
1085
1086    fn control_handle(&self) -> Self::ControlHandle {
1087        WlantapPhyControlHandle { inner: self.inner.clone() }
1088    }
1089
1090    fn into_inner(
1091        self,
1092    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1093    {
1094        (self.inner, self.is_terminated)
1095    }
1096
1097    fn from_inner(
1098        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1099        is_terminated: bool,
1100    ) -> Self {
1101        Self { inner, is_terminated }
1102    }
1103}
1104
1105impl futures::Stream for WlantapPhyRequestStream {
1106    type Item = Result<WlantapPhyRequest, fidl::Error>;
1107
1108    fn poll_next(
1109        mut self: std::pin::Pin<&mut Self>,
1110        cx: &mut std::task::Context<'_>,
1111    ) -> std::task::Poll<Option<Self::Item>> {
1112        let this = &mut *self;
1113        if this.inner.check_shutdown(cx) {
1114            this.is_terminated = true;
1115            return std::task::Poll::Ready(None);
1116        }
1117        if this.is_terminated {
1118            panic!("polled WlantapPhyRequestStream after completion");
1119        }
1120        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1121            |bytes, handles| {
1122                match this.inner.channel().read_etc(cx, bytes, handles) {
1123                    std::task::Poll::Ready(Ok(())) => {}
1124                    std::task::Poll::Pending => return std::task::Poll::Pending,
1125                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1126                        this.is_terminated = true;
1127                        return std::task::Poll::Ready(None);
1128                    }
1129                    std::task::Poll::Ready(Err(e)) => {
1130                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1131                            e.into(),
1132                        ))))
1133                    }
1134                }
1135
1136                // A message has been received from the channel
1137                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1138
1139                std::task::Poll::Ready(Some(match header.ordinal {
1140                    0x1df8087c49fa9a5e => {
1141                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1142                        let mut req = fidl::new_empty!(
1143                            fidl::encoding::EmptyPayload,
1144                            fidl::encoding::DefaultFuchsiaResourceDialect
1145                        );
1146                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1147                        let control_handle = WlantapPhyControlHandle { inner: this.inner.clone() };
1148                        Ok(WlantapPhyRequest::Shutdown {
1149                            responder: WlantapPhyShutdownResponder {
1150                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1151                                tx_id: header.tx_id,
1152                            },
1153                        })
1154                    }
1155                    0x165a656419ab3b41 => {
1156                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1157                        let mut req = fidl::new_empty!(
1158                            WlantapPhyRxRequest,
1159                            fidl::encoding::DefaultFuchsiaResourceDialect
1160                        );
1161                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlantapPhyRxRequest>(&header, _body_bytes, handles, &mut req)?;
1162                        let control_handle = WlantapPhyControlHandle { inner: this.inner.clone() };
1163                        Ok(WlantapPhyRequest::Rx { data: req.data, info: req.info, control_handle })
1164                    }
1165                    0x2c27ed678c1e7eb4 => {
1166                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1167                        let mut req = fidl::new_empty!(
1168                            WlantapPhyReportTxResultRequest,
1169                            fidl::encoding::DefaultFuchsiaResourceDialect
1170                        );
1171                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlantapPhyReportTxResultRequest>(&header, _body_bytes, handles, &mut req)?;
1172                        let control_handle = WlantapPhyControlHandle { inner: this.inner.clone() };
1173                        Ok(WlantapPhyRequest::ReportTxResult { txr: req.txr, control_handle })
1174                    }
1175                    0x61a579015cff7674 => {
1176                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1177                        let mut req = fidl::new_empty!(
1178                            WlantapPhyScanCompleteRequest,
1179                            fidl::encoding::DefaultFuchsiaResourceDialect
1180                        );
1181                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlantapPhyScanCompleteRequest>(&header, _body_bytes, handles, &mut req)?;
1182                        let control_handle = WlantapPhyControlHandle { inner: this.inner.clone() };
1183                        Ok(WlantapPhyRequest::ScanComplete {
1184                            scan_id: req.scan_id,
1185                            status: req.status,
1186
1187                            control_handle,
1188                        })
1189                    }
1190                    _ => Err(fidl::Error::UnknownOrdinal {
1191                        ordinal: header.ordinal,
1192                        protocol_name:
1193                            <WlantapPhyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1194                    }),
1195                }))
1196            },
1197        )
1198    }
1199}
1200
1201/// Allow the test program to observe and control the behavior of the wlantap-phy device.
1202/// A wlantap-phy device is a special vendor device and its driver (Fuchsia being the vendor)
1203/// used for testing purpose.
1204/// Implements a subset of `wlan_softmac_ifc_t` and `wlan_softmac_protocol_ops_t` defined in
1205/// fuchsia.wlan.softmac/softmac.fidl
1206/// Implements a subset of `WlanPhyImpl` protocol defined in
1207/// fuchsia.hardware.phyimpl/wlanphy-impl.fidl
1208#[derive(Debug)]
1209pub enum WlantapPhyRequest {
1210    /// Shutdown the phy device so that it does not respond to any further calls.
1211    /// Once shutdown, there is no way to restart the device.
1212    /// It can only be called at the end of a test.
1213    Shutdown {
1214        responder: WlantapPhyShutdownResponder,
1215    },
1216    /// The device "receives" a frame "over the air" and pass it up to driver.
1217    Rx {
1218        data: Vec<u8>,
1219        info: WlanRxInfo,
1220        control_handle: WlantapPhyControlHandle,
1221    },
1222    /// For rate selection (Minstrel), the device's last frame transmission is a success/failure,
1223    /// with a certain number of retries.
1224    ReportTxResult {
1225        txr: fidl_fuchsia_wlan_common::WlanTxResult,
1226        control_handle: WlantapPhyControlHandle,
1227    },
1228    ScanComplete {
1229        scan_id: u64,
1230        status: i32,
1231        control_handle: WlantapPhyControlHandle,
1232    },
1233}
1234
1235impl WlantapPhyRequest {
1236    #[allow(irrefutable_let_patterns)]
1237    pub fn into_shutdown(self) -> Option<(WlantapPhyShutdownResponder)> {
1238        if let WlantapPhyRequest::Shutdown { responder } = self {
1239            Some((responder))
1240        } else {
1241            None
1242        }
1243    }
1244
1245    #[allow(irrefutable_let_patterns)]
1246    pub fn into_rx(self) -> Option<(Vec<u8>, WlanRxInfo, WlantapPhyControlHandle)> {
1247        if let WlantapPhyRequest::Rx { data, info, control_handle } = self {
1248            Some((data, info, control_handle))
1249        } else {
1250            None
1251        }
1252    }
1253
1254    #[allow(irrefutable_let_patterns)]
1255    pub fn into_report_tx_result(
1256        self,
1257    ) -> Option<(fidl_fuchsia_wlan_common::WlanTxResult, WlantapPhyControlHandle)> {
1258        if let WlantapPhyRequest::ReportTxResult { txr, control_handle } = self {
1259            Some((txr, control_handle))
1260        } else {
1261            None
1262        }
1263    }
1264
1265    #[allow(irrefutable_let_patterns)]
1266    pub fn into_scan_complete(self) -> Option<(u64, i32, WlantapPhyControlHandle)> {
1267        if let WlantapPhyRequest::ScanComplete { scan_id, status, control_handle } = self {
1268            Some((scan_id, status, control_handle))
1269        } else {
1270            None
1271        }
1272    }
1273
1274    /// Name of the method defined in FIDL
1275    pub fn method_name(&self) -> &'static str {
1276        match *self {
1277            WlantapPhyRequest::Shutdown { .. } => "shutdown",
1278            WlantapPhyRequest::Rx { .. } => "rx",
1279            WlantapPhyRequest::ReportTxResult { .. } => "report_tx_result",
1280            WlantapPhyRequest::ScanComplete { .. } => "scan_complete",
1281        }
1282    }
1283}
1284
1285#[derive(Debug, Clone)]
1286pub struct WlantapPhyControlHandle {
1287    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1288}
1289
1290impl fidl::endpoints::ControlHandle for WlantapPhyControlHandle {
1291    fn shutdown(&self) {
1292        self.inner.shutdown()
1293    }
1294    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1295        self.inner.shutdown_with_epitaph(status)
1296    }
1297
1298    fn is_closed(&self) -> bool {
1299        self.inner.channel().is_closed()
1300    }
1301    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1302        self.inner.channel().on_closed()
1303    }
1304
1305    #[cfg(target_os = "fuchsia")]
1306    fn signal_peer(
1307        &self,
1308        clear_mask: zx::Signals,
1309        set_mask: zx::Signals,
1310    ) -> Result<(), zx_status::Status> {
1311        use fidl::Peered;
1312        self.inner.channel().signal_peer(clear_mask, set_mask)
1313    }
1314}
1315
1316impl WlantapPhyControlHandle {
1317    pub fn send_tx(&self, mut args: &TxArgs) -> Result<(), fidl::Error> {
1318        self.inner.send::<WlantapPhyTxRequest>(
1319            (args,),
1320            0,
1321            0x3ccc6c207280b569,
1322            fidl::encoding::DynamicFlags::empty(),
1323        )
1324    }
1325
1326    pub fn send_wlan_softmac_start(&self) -> Result<(), fidl::Error> {
1327        self.inner.send::<fidl::encoding::EmptyPayload>(
1328            (),
1329            0,
1330            0x328bcae20dec2b88,
1331            fidl::encoding::DynamicFlags::empty(),
1332        )
1333    }
1334
1335    pub fn send_set_channel(&self, mut args: &SetChannelArgs) -> Result<(), fidl::Error> {
1336        self.inner.send::<WlantapPhySetChannelRequest>(
1337            (args,),
1338            0,
1339            0x60eb9a607f96a948,
1340            fidl::encoding::DynamicFlags::empty(),
1341        )
1342    }
1343
1344    pub fn send_join_bss(&self, mut args: &JoinBssArgs) -> Result<(), fidl::Error> {
1345        self.inner.send::<WlantapPhyJoinBssRequest>(
1346            (args,),
1347            0,
1348            0xef930e871dbf2f9,
1349            fidl::encoding::DynamicFlags::empty(),
1350        )
1351    }
1352
1353    pub fn send_start_scan(&self, mut args: &StartScanArgs) -> Result<(), fidl::Error> {
1354        self.inner.send::<WlantapPhyStartScanRequest>(
1355            (args,),
1356            0,
1357            0x75ed87321e05cdbb,
1358            fidl::encoding::DynamicFlags::empty(),
1359        )
1360    }
1361
1362    pub fn send_set_key(&self, mut args: &SetKeyArgs) -> Result<(), fidl::Error> {
1363        self.inner.send::<WlantapPhySetKeyRequest>(
1364            (args,),
1365            0,
1366            0xff7bf591b026267,
1367            fidl::encoding::DynamicFlags::empty(),
1368        )
1369    }
1370
1371    pub fn send_set_country(&self, mut args: &SetCountryArgs) -> Result<(), fidl::Error> {
1372        self.inner.send::<WlantapPhySetCountryRequest>(
1373            (args,),
1374            0,
1375            0x4cd2f84e3ccfcd14,
1376            fidl::encoding::DynamicFlags::empty(),
1377        )
1378    }
1379}
1380
1381#[must_use = "FIDL methods require a response to be sent"]
1382#[derive(Debug)]
1383pub struct WlantapPhyShutdownResponder {
1384    control_handle: std::mem::ManuallyDrop<WlantapPhyControlHandle>,
1385    tx_id: u32,
1386}
1387
1388/// Set the the channel to be shutdown (see [`WlantapPhyControlHandle::shutdown`])
1389/// if the responder is dropped without sending a response, so that the client
1390/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1391impl std::ops::Drop for WlantapPhyShutdownResponder {
1392    fn drop(&mut self) {
1393        self.control_handle.shutdown();
1394        // Safety: drops once, never accessed again
1395        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1396    }
1397}
1398
1399impl fidl::endpoints::Responder for WlantapPhyShutdownResponder {
1400    type ControlHandle = WlantapPhyControlHandle;
1401
1402    fn control_handle(&self) -> &WlantapPhyControlHandle {
1403        &self.control_handle
1404    }
1405
1406    fn drop_without_shutdown(mut self) {
1407        // Safety: drops once, never accessed again due to mem::forget
1408        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1409        // Prevent Drop from running (which would shut down the channel)
1410        std::mem::forget(self);
1411    }
1412}
1413
1414impl WlantapPhyShutdownResponder {
1415    /// Sends a response to the FIDL transaction.
1416    ///
1417    /// Sets the channel to shutdown if an error occurs.
1418    pub fn send(self) -> Result<(), fidl::Error> {
1419        let _result = self.send_raw();
1420        if _result.is_err() {
1421            self.control_handle.shutdown();
1422        }
1423        self.drop_without_shutdown();
1424        _result
1425    }
1426
1427    /// Similar to "send" but does not shutdown the channel if an error occurs.
1428    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1429        let _result = self.send_raw();
1430        self.drop_without_shutdown();
1431        _result
1432    }
1433
1434    fn send_raw(&self) -> Result<(), fidl::Error> {
1435        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1436            (),
1437            self.tx_id,
1438            0x1df8087c49fa9a5e,
1439            fidl::encoding::DynamicFlags::empty(),
1440        )
1441    }
1442}
1443
1444mod internal {
1445    use super::*;
1446
1447    impl fidl::encoding::ValueTypeMarker for JoinBssArgs {
1448        type Borrowed<'a> = &'a Self;
1449        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1450            value
1451        }
1452    }
1453
1454    unsafe impl fidl::encoding::TypeMarker for JoinBssArgs {
1455        type Owned = Self;
1456
1457        #[inline(always)]
1458        fn inline_align(_context: fidl::encoding::Context) -> usize {
1459            8
1460        }
1461
1462        #[inline(always)]
1463        fn inline_size(_context: fidl::encoding::Context) -> usize {
1464            24
1465        }
1466    }
1467
1468    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<JoinBssArgs, D>
1469        for &JoinBssArgs
1470    {
1471        #[inline]
1472        unsafe fn encode(
1473            self,
1474            encoder: &mut fidl::encoding::Encoder<'_, D>,
1475            offset: usize,
1476            _depth: fidl::encoding::Depth,
1477        ) -> fidl::Result<()> {
1478            encoder.debug_check_bounds::<JoinBssArgs>(offset);
1479            // Delegate to tuple encoding.
1480            fidl::encoding::Encode::<JoinBssArgs, D>::encode(
1481                (
1482                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.wlan_softmac_id),
1483                    <fidl_fuchsia_wlan_common::JoinBssRequest as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
1484                ),
1485                encoder, offset, _depth
1486            )
1487        }
1488    }
1489    unsafe impl<
1490            D: fidl::encoding::ResourceDialect,
1491            T0: fidl::encoding::Encode<u16, D>,
1492            T1: fidl::encoding::Encode<fidl_fuchsia_wlan_common::JoinBssRequest, D>,
1493        > fidl::encoding::Encode<JoinBssArgs, D> for (T0, T1)
1494    {
1495        #[inline]
1496        unsafe fn encode(
1497            self,
1498            encoder: &mut fidl::encoding::Encoder<'_, D>,
1499            offset: usize,
1500            depth: fidl::encoding::Depth,
1501        ) -> fidl::Result<()> {
1502            encoder.debug_check_bounds::<JoinBssArgs>(offset);
1503            // Zero out padding regions. There's no need to apply masks
1504            // because the unmasked parts will be overwritten by fields.
1505            unsafe {
1506                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1507                (ptr as *mut u64).write_unaligned(0);
1508            }
1509            // Write the fields.
1510            self.0.encode(encoder, offset + 0, depth)?;
1511            self.1.encode(encoder, offset + 8, depth)?;
1512            Ok(())
1513        }
1514    }
1515
1516    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for JoinBssArgs {
1517        #[inline(always)]
1518        fn new_empty() -> Self {
1519            Self {
1520                wlan_softmac_id: fidl::new_empty!(u16, D),
1521                config: fidl::new_empty!(fidl_fuchsia_wlan_common::JoinBssRequest, D),
1522            }
1523        }
1524
1525        #[inline]
1526        unsafe fn decode(
1527            &mut self,
1528            decoder: &mut fidl::encoding::Decoder<'_, D>,
1529            offset: usize,
1530            _depth: fidl::encoding::Depth,
1531        ) -> fidl::Result<()> {
1532            decoder.debug_check_bounds::<Self>(offset);
1533            // Verify that padding bytes are zero.
1534            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1535            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1536            let mask = 0xffffffffffff0000u64;
1537            let maskedval = padval & mask;
1538            if maskedval != 0 {
1539                return Err(fidl::Error::NonZeroPadding {
1540                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1541                });
1542            }
1543            fidl::decode!(u16, D, &mut self.wlan_softmac_id, decoder, offset + 0, _depth)?;
1544            fidl::decode!(
1545                fidl_fuchsia_wlan_common::JoinBssRequest,
1546                D,
1547                &mut self.config,
1548                decoder,
1549                offset + 8,
1550                _depth
1551            )?;
1552            Ok(())
1553        }
1554    }
1555
1556    impl fidl::encoding::ValueTypeMarker for SetChannelArgs {
1557        type Borrowed<'a> = &'a Self;
1558        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1559            value
1560        }
1561    }
1562
1563    unsafe impl fidl::encoding::TypeMarker for SetChannelArgs {
1564        type Owned = Self;
1565
1566        #[inline(always)]
1567        fn inline_align(_context: fidl::encoding::Context) -> usize {
1568            4
1569        }
1570
1571        #[inline(always)]
1572        fn inline_size(_context: fidl::encoding::Context) -> usize {
1573            16
1574        }
1575    }
1576
1577    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SetChannelArgs, D>
1578        for &SetChannelArgs
1579    {
1580        #[inline]
1581        unsafe fn encode(
1582            self,
1583            encoder: &mut fidl::encoding::Encoder<'_, D>,
1584            offset: usize,
1585            _depth: fidl::encoding::Depth,
1586        ) -> fidl::Result<()> {
1587            encoder.debug_check_bounds::<SetChannelArgs>(offset);
1588            // Delegate to tuple encoding.
1589            fidl::encoding::Encode::<SetChannelArgs, D>::encode(
1590                (
1591                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.wlan_softmac_id),
1592                    <fidl_fuchsia_wlan_common::WlanChannel as fidl::encoding::ValueTypeMarker>::borrow(&self.channel),
1593                ),
1594                encoder, offset, _depth
1595            )
1596        }
1597    }
1598    unsafe impl<
1599            D: fidl::encoding::ResourceDialect,
1600            T0: fidl::encoding::Encode<u16, D>,
1601            T1: fidl::encoding::Encode<fidl_fuchsia_wlan_common::WlanChannel, D>,
1602        > fidl::encoding::Encode<SetChannelArgs, D> for (T0, T1)
1603    {
1604        #[inline]
1605        unsafe fn encode(
1606            self,
1607            encoder: &mut fidl::encoding::Encoder<'_, D>,
1608            offset: usize,
1609            depth: fidl::encoding::Depth,
1610        ) -> fidl::Result<()> {
1611            encoder.debug_check_bounds::<SetChannelArgs>(offset);
1612            // Zero out padding regions. There's no need to apply masks
1613            // because the unmasked parts will be overwritten by fields.
1614            unsafe {
1615                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1616                (ptr as *mut u32).write_unaligned(0);
1617            }
1618            // Write the fields.
1619            self.0.encode(encoder, offset + 0, depth)?;
1620            self.1.encode(encoder, offset + 4, depth)?;
1621            Ok(())
1622        }
1623    }
1624
1625    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SetChannelArgs {
1626        #[inline(always)]
1627        fn new_empty() -> Self {
1628            Self {
1629                wlan_softmac_id: fidl::new_empty!(u16, D),
1630                channel: fidl::new_empty!(fidl_fuchsia_wlan_common::WlanChannel, D),
1631            }
1632        }
1633
1634        #[inline]
1635        unsafe fn decode(
1636            &mut self,
1637            decoder: &mut fidl::encoding::Decoder<'_, D>,
1638            offset: usize,
1639            _depth: fidl::encoding::Depth,
1640        ) -> fidl::Result<()> {
1641            decoder.debug_check_bounds::<Self>(offset);
1642            // Verify that padding bytes are zero.
1643            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1644            let padval = unsafe { (ptr as *const u32).read_unaligned() };
1645            let mask = 0xffff0000u32;
1646            let maskedval = padval & mask;
1647            if maskedval != 0 {
1648                return Err(fidl::Error::NonZeroPadding {
1649                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1650                });
1651            }
1652            fidl::decode!(u16, D, &mut self.wlan_softmac_id, decoder, offset + 0, _depth)?;
1653            fidl::decode!(
1654                fidl_fuchsia_wlan_common::WlanChannel,
1655                D,
1656                &mut self.channel,
1657                decoder,
1658                offset + 4,
1659                _depth
1660            )?;
1661            Ok(())
1662        }
1663    }
1664
1665    impl fidl::encoding::ValueTypeMarker for SetCountryArgs {
1666        type Borrowed<'a> = &'a Self;
1667        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1668            value
1669        }
1670    }
1671
1672    unsafe impl fidl::encoding::TypeMarker for SetCountryArgs {
1673        type Owned = Self;
1674
1675        #[inline(always)]
1676        fn inline_align(_context: fidl::encoding::Context) -> usize {
1677            1
1678        }
1679
1680        #[inline(always)]
1681        fn inline_size(_context: fidl::encoding::Context) -> usize {
1682            2
1683        }
1684        #[inline(always)]
1685        fn encode_is_copy() -> bool {
1686            true
1687        }
1688
1689        #[inline(always)]
1690        fn decode_is_copy() -> bool {
1691            true
1692        }
1693    }
1694
1695    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SetCountryArgs, D>
1696        for &SetCountryArgs
1697    {
1698        #[inline]
1699        unsafe fn encode(
1700            self,
1701            encoder: &mut fidl::encoding::Encoder<'_, D>,
1702            offset: usize,
1703            _depth: fidl::encoding::Depth,
1704        ) -> fidl::Result<()> {
1705            encoder.debug_check_bounds::<SetCountryArgs>(offset);
1706            unsafe {
1707                // Copy the object into the buffer.
1708                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1709                (buf_ptr as *mut SetCountryArgs)
1710                    .write_unaligned((self as *const SetCountryArgs).read());
1711                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1712                // done second because the memcpy will write garbage to these bytes.
1713            }
1714            Ok(())
1715        }
1716    }
1717    unsafe impl<
1718            D: fidl::encoding::ResourceDialect,
1719            T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 2>, D>,
1720        > fidl::encoding::Encode<SetCountryArgs, D> for (T0,)
1721    {
1722        #[inline]
1723        unsafe fn encode(
1724            self,
1725            encoder: &mut fidl::encoding::Encoder<'_, D>,
1726            offset: usize,
1727            depth: fidl::encoding::Depth,
1728        ) -> fidl::Result<()> {
1729            encoder.debug_check_bounds::<SetCountryArgs>(offset);
1730            // Zero out padding regions. There's no need to apply masks
1731            // because the unmasked parts will be overwritten by fields.
1732            // Write the fields.
1733            self.0.encode(encoder, offset + 0, depth)?;
1734            Ok(())
1735        }
1736    }
1737
1738    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SetCountryArgs {
1739        #[inline(always)]
1740        fn new_empty() -> Self {
1741            Self { alpha2: fidl::new_empty!(fidl::encoding::Array<u8, 2>, D) }
1742        }
1743
1744        #[inline]
1745        unsafe fn decode(
1746            &mut self,
1747            decoder: &mut fidl::encoding::Decoder<'_, D>,
1748            offset: usize,
1749            _depth: fidl::encoding::Depth,
1750        ) -> fidl::Result<()> {
1751            decoder.debug_check_bounds::<Self>(offset);
1752            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1753            // Verify that padding bytes are zero.
1754            // Copy from the buffer into the object.
1755            unsafe {
1756                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
1757            }
1758            Ok(())
1759        }
1760    }
1761
1762    impl fidl::encoding::ValueTypeMarker for SetKeyArgs {
1763        type Borrowed<'a> = &'a Self;
1764        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1765            value
1766        }
1767    }
1768
1769    unsafe impl fidl::encoding::TypeMarker for SetKeyArgs {
1770        type Owned = Self;
1771
1772        #[inline(always)]
1773        fn inline_align(_context: fidl::encoding::Context) -> usize {
1774            8
1775        }
1776
1777        #[inline(always)]
1778        fn inline_size(_context: fidl::encoding::Context) -> usize {
1779            40
1780        }
1781    }
1782
1783    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SetKeyArgs, D>
1784        for &SetKeyArgs
1785    {
1786        #[inline]
1787        unsafe fn encode(
1788            self,
1789            encoder: &mut fidl::encoding::Encoder<'_, D>,
1790            offset: usize,
1791            _depth: fidl::encoding::Depth,
1792        ) -> fidl::Result<()> {
1793            encoder.debug_check_bounds::<SetKeyArgs>(offset);
1794            // Delegate to tuple encoding.
1795            fidl::encoding::Encode::<SetKeyArgs, D>::encode(
1796                (
1797                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.wlan_softmac_id),
1798                    <WlanKeyConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
1799                ),
1800                encoder,
1801                offset,
1802                _depth,
1803            )
1804        }
1805    }
1806    unsafe impl<
1807            D: fidl::encoding::ResourceDialect,
1808            T0: fidl::encoding::Encode<u16, D>,
1809            T1: fidl::encoding::Encode<WlanKeyConfig, D>,
1810        > fidl::encoding::Encode<SetKeyArgs, D> for (T0, T1)
1811    {
1812        #[inline]
1813        unsafe fn encode(
1814            self,
1815            encoder: &mut fidl::encoding::Encoder<'_, D>,
1816            offset: usize,
1817            depth: fidl::encoding::Depth,
1818        ) -> fidl::Result<()> {
1819            encoder.debug_check_bounds::<SetKeyArgs>(offset);
1820            // Zero out padding regions. There's no need to apply masks
1821            // because the unmasked parts will be overwritten by fields.
1822            unsafe {
1823                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1824                (ptr as *mut u64).write_unaligned(0);
1825            }
1826            // Write the fields.
1827            self.0.encode(encoder, offset + 0, depth)?;
1828            self.1.encode(encoder, offset + 8, depth)?;
1829            Ok(())
1830        }
1831    }
1832
1833    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SetKeyArgs {
1834        #[inline(always)]
1835        fn new_empty() -> Self {
1836            Self {
1837                wlan_softmac_id: fidl::new_empty!(u16, D),
1838                config: fidl::new_empty!(WlanKeyConfig, D),
1839            }
1840        }
1841
1842        #[inline]
1843        unsafe fn decode(
1844            &mut self,
1845            decoder: &mut fidl::encoding::Decoder<'_, D>,
1846            offset: usize,
1847            _depth: fidl::encoding::Depth,
1848        ) -> fidl::Result<()> {
1849            decoder.debug_check_bounds::<Self>(offset);
1850            // Verify that padding bytes are zero.
1851            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1852            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1853            let mask = 0xffffffffffff0000u64;
1854            let maskedval = padval & mask;
1855            if maskedval != 0 {
1856                return Err(fidl::Error::NonZeroPadding {
1857                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1858                });
1859            }
1860            fidl::decode!(u16, D, &mut self.wlan_softmac_id, decoder, offset + 0, _depth)?;
1861            fidl::decode!(WlanKeyConfig, D, &mut self.config, decoder, offset + 8, _depth)?;
1862            Ok(())
1863        }
1864    }
1865
1866    impl fidl::encoding::ValueTypeMarker for StartScanArgs {
1867        type Borrowed<'a> = &'a Self;
1868        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1869            value
1870        }
1871    }
1872
1873    unsafe impl fidl::encoding::TypeMarker for StartScanArgs {
1874        type Owned = Self;
1875
1876        #[inline(always)]
1877        fn inline_align(_context: fidl::encoding::Context) -> usize {
1878            8
1879        }
1880
1881        #[inline(always)]
1882        fn inline_size(_context: fidl::encoding::Context) -> usize {
1883            16
1884        }
1885    }
1886
1887    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StartScanArgs, D>
1888        for &StartScanArgs
1889    {
1890        #[inline]
1891        unsafe fn encode(
1892            self,
1893            encoder: &mut fidl::encoding::Encoder<'_, D>,
1894            offset: usize,
1895            _depth: fidl::encoding::Depth,
1896        ) -> fidl::Result<()> {
1897            encoder.debug_check_bounds::<StartScanArgs>(offset);
1898            unsafe {
1899                // Copy the object into the buffer.
1900                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1901                (buf_ptr as *mut StartScanArgs)
1902                    .write_unaligned((self as *const StartScanArgs).read());
1903                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1904                // done second because the memcpy will write garbage to these bytes.
1905                let padding_ptr = buf_ptr.offset(0) as *mut u64;
1906                let padding_mask = 0xffffffffffff0000u64;
1907                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
1908            }
1909            Ok(())
1910        }
1911    }
1912    unsafe impl<
1913            D: fidl::encoding::ResourceDialect,
1914            T0: fidl::encoding::Encode<u16, D>,
1915            T1: fidl::encoding::Encode<u64, D>,
1916        > fidl::encoding::Encode<StartScanArgs, D> for (T0, T1)
1917    {
1918        #[inline]
1919        unsafe fn encode(
1920            self,
1921            encoder: &mut fidl::encoding::Encoder<'_, D>,
1922            offset: usize,
1923            depth: fidl::encoding::Depth,
1924        ) -> fidl::Result<()> {
1925            encoder.debug_check_bounds::<StartScanArgs>(offset);
1926            // Zero out padding regions. There's no need to apply masks
1927            // because the unmasked parts will be overwritten by fields.
1928            unsafe {
1929                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1930                (ptr as *mut u64).write_unaligned(0);
1931            }
1932            // Write the fields.
1933            self.0.encode(encoder, offset + 0, depth)?;
1934            self.1.encode(encoder, offset + 8, depth)?;
1935            Ok(())
1936        }
1937    }
1938
1939    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StartScanArgs {
1940        #[inline(always)]
1941        fn new_empty() -> Self {
1942            Self { wlan_softmac_id: fidl::new_empty!(u16, D), scan_id: fidl::new_empty!(u64, D) }
1943        }
1944
1945        #[inline]
1946        unsafe fn decode(
1947            &mut self,
1948            decoder: &mut fidl::encoding::Decoder<'_, D>,
1949            offset: usize,
1950            _depth: fidl::encoding::Depth,
1951        ) -> fidl::Result<()> {
1952            decoder.debug_check_bounds::<Self>(offset);
1953            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1954            // Verify that padding bytes are zero.
1955            let ptr = unsafe { buf_ptr.offset(0) };
1956            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1957            let mask = 0xffffffffffff0000u64;
1958            let maskedval = padval & mask;
1959            if maskedval != 0 {
1960                return Err(fidl::Error::NonZeroPadding {
1961                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1962                });
1963            }
1964            // Copy from the buffer into the object.
1965            unsafe {
1966                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1967            }
1968            Ok(())
1969        }
1970    }
1971
1972    impl fidl::encoding::ValueTypeMarker for TxArgs {
1973        type Borrowed<'a> = &'a Self;
1974        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1975            value
1976        }
1977    }
1978
1979    unsafe impl fidl::encoding::TypeMarker for TxArgs {
1980        type Owned = Self;
1981
1982        #[inline(always)]
1983        fn inline_align(_context: fidl::encoding::Context) -> usize {
1984            8
1985        }
1986
1987        #[inline(always)]
1988        fn inline_size(_context: fidl::encoding::Context) -> usize {
1989            48
1990        }
1991    }
1992
1993    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TxArgs, D> for &TxArgs {
1994        #[inline]
1995        unsafe fn encode(
1996            self,
1997            encoder: &mut fidl::encoding::Encoder<'_, D>,
1998            offset: usize,
1999            _depth: fidl::encoding::Depth,
2000        ) -> fidl::Result<()> {
2001            encoder.debug_check_bounds::<TxArgs>(offset);
2002            // Delegate to tuple encoding.
2003            fidl::encoding::Encode::<TxArgs, D>::encode(
2004                (
2005                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.wlan_softmac_id),
2006                    <WlanTxPacket as fidl::encoding::ValueTypeMarker>::borrow(&self.packet),
2007                ),
2008                encoder,
2009                offset,
2010                _depth,
2011            )
2012        }
2013    }
2014    unsafe impl<
2015            D: fidl::encoding::ResourceDialect,
2016            T0: fidl::encoding::Encode<u16, D>,
2017            T1: fidl::encoding::Encode<WlanTxPacket, D>,
2018        > fidl::encoding::Encode<TxArgs, D> for (T0, T1)
2019    {
2020        #[inline]
2021        unsafe fn encode(
2022            self,
2023            encoder: &mut fidl::encoding::Encoder<'_, D>,
2024            offset: usize,
2025            depth: fidl::encoding::Depth,
2026        ) -> fidl::Result<()> {
2027            encoder.debug_check_bounds::<TxArgs>(offset);
2028            // Zero out padding regions. There's no need to apply masks
2029            // because the unmasked parts will be overwritten by fields.
2030            unsafe {
2031                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2032                (ptr as *mut u64).write_unaligned(0);
2033            }
2034            // Write the fields.
2035            self.0.encode(encoder, offset + 0, depth)?;
2036            self.1.encode(encoder, offset + 8, depth)?;
2037            Ok(())
2038        }
2039    }
2040
2041    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TxArgs {
2042        #[inline(always)]
2043        fn new_empty() -> Self {
2044            Self {
2045                wlan_softmac_id: fidl::new_empty!(u16, D),
2046                packet: fidl::new_empty!(WlanTxPacket, D),
2047            }
2048        }
2049
2050        #[inline]
2051        unsafe fn decode(
2052            &mut self,
2053            decoder: &mut fidl::encoding::Decoder<'_, D>,
2054            offset: usize,
2055            _depth: fidl::encoding::Depth,
2056        ) -> fidl::Result<()> {
2057            decoder.debug_check_bounds::<Self>(offset);
2058            // Verify that padding bytes are zero.
2059            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2060            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2061            let mask = 0xffffffffffff0000u64;
2062            let maskedval = padval & mask;
2063            if maskedval != 0 {
2064                return Err(fidl::Error::NonZeroPadding {
2065                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2066                });
2067            }
2068            fidl::decode!(u16, D, &mut self.wlan_softmac_id, decoder, offset + 0, _depth)?;
2069            fidl::decode!(WlanTxPacket, D, &mut self.packet, decoder, offset + 8, _depth)?;
2070            Ok(())
2071        }
2072    }
2073
2074    impl fidl::encoding::ValueTypeMarker for WlanKeyConfig {
2075        type Borrowed<'a> = &'a Self;
2076        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2077            value
2078        }
2079    }
2080
2081    unsafe impl fidl::encoding::TypeMarker for WlanKeyConfig {
2082        type Owned = Self;
2083
2084        #[inline(always)]
2085        fn inline_align(_context: fidl::encoding::Context) -> usize {
2086            8
2087        }
2088
2089        #[inline(always)]
2090        fn inline_size(_context: fidl::encoding::Context) -> usize {
2091            32
2092        }
2093    }
2094
2095    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WlanKeyConfig, D>
2096        for &WlanKeyConfig
2097    {
2098        #[inline]
2099        unsafe fn encode(
2100            self,
2101            encoder: &mut fidl::encoding::Encoder<'_, D>,
2102            offset: usize,
2103            _depth: fidl::encoding::Depth,
2104        ) -> fidl::Result<()> {
2105            encoder.debug_check_bounds::<WlanKeyConfig>(offset);
2106            // Delegate to tuple encoding.
2107            fidl::encoding::Encode::<WlanKeyConfig, D>::encode(
2108                (
2109                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.protection),
2110                    <fidl::encoding::Array<u8, 3> as fidl::encoding::ValueTypeMarker>::borrow(
2111                        &self.cipher_oui,
2112                    ),
2113                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.cipher_type),
2114                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.key_type),
2115                    <fidl::encoding::Array<u8, 6> as fidl::encoding::ValueTypeMarker>::borrow(
2116                        &self.peer_addr,
2117                    ),
2118                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.key_idx),
2119                    <fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow(
2120                        &self.key,
2121                    ),
2122                ),
2123                encoder,
2124                offset,
2125                _depth,
2126            )
2127        }
2128    }
2129    unsafe impl<
2130            D: fidl::encoding::ResourceDialect,
2131            T0: fidl::encoding::Encode<u8, D>,
2132            T1: fidl::encoding::Encode<fidl::encoding::Array<u8, 3>, D>,
2133            T2: fidl::encoding::Encode<u8, D>,
2134            T3: fidl::encoding::Encode<u8, D>,
2135            T4: fidl::encoding::Encode<fidl::encoding::Array<u8, 6>, D>,
2136            T5: fidl::encoding::Encode<u8, D>,
2137            T6: fidl::encoding::Encode<fidl::encoding::Vector<u8, 32>, D>,
2138        > fidl::encoding::Encode<WlanKeyConfig, D> for (T0, T1, T2, T3, T4, T5, T6)
2139    {
2140        #[inline]
2141        unsafe fn encode(
2142            self,
2143            encoder: &mut fidl::encoding::Encoder<'_, D>,
2144            offset: usize,
2145            depth: fidl::encoding::Depth,
2146        ) -> fidl::Result<()> {
2147            encoder.debug_check_bounds::<WlanKeyConfig>(offset);
2148            // Zero out padding regions. There's no need to apply masks
2149            // because the unmasked parts will be overwritten by fields.
2150            unsafe {
2151                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
2152                (ptr as *mut u64).write_unaligned(0);
2153            }
2154            // Write the fields.
2155            self.0.encode(encoder, offset + 0, depth)?;
2156            self.1.encode(encoder, offset + 1, depth)?;
2157            self.2.encode(encoder, offset + 4, depth)?;
2158            self.3.encode(encoder, offset + 5, depth)?;
2159            self.4.encode(encoder, offset + 6, depth)?;
2160            self.5.encode(encoder, offset + 12, depth)?;
2161            self.6.encode(encoder, offset + 16, depth)?;
2162            Ok(())
2163        }
2164    }
2165
2166    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WlanKeyConfig {
2167        #[inline(always)]
2168        fn new_empty() -> Self {
2169            Self {
2170                protection: fidl::new_empty!(u8, D),
2171                cipher_oui: fidl::new_empty!(fidl::encoding::Array<u8, 3>, D),
2172                cipher_type: fidl::new_empty!(u8, D),
2173                key_type: fidl::new_empty!(u8, D),
2174                peer_addr: fidl::new_empty!(fidl::encoding::Array<u8, 6>, D),
2175                key_idx: fidl::new_empty!(u8, D),
2176                key: fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D),
2177            }
2178        }
2179
2180        #[inline]
2181        unsafe fn decode(
2182            &mut self,
2183            decoder: &mut fidl::encoding::Decoder<'_, D>,
2184            offset: usize,
2185            _depth: fidl::encoding::Depth,
2186        ) -> fidl::Result<()> {
2187            decoder.debug_check_bounds::<Self>(offset);
2188            // Verify that padding bytes are zero.
2189            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
2190            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2191            let mask = 0xffffff0000000000u64;
2192            let maskedval = padval & mask;
2193            if maskedval != 0 {
2194                return Err(fidl::Error::NonZeroPadding {
2195                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2196                });
2197            }
2198            fidl::decode!(u8, D, &mut self.protection, decoder, offset + 0, _depth)?;
2199            fidl::decode!(fidl::encoding::Array<u8, 3>, D, &mut self.cipher_oui, decoder, offset + 1, _depth)?;
2200            fidl::decode!(u8, D, &mut self.cipher_type, decoder, offset + 4, _depth)?;
2201            fidl::decode!(u8, D, &mut self.key_type, decoder, offset + 5, _depth)?;
2202            fidl::decode!(fidl::encoding::Array<u8, 6>, D, &mut self.peer_addr, decoder, offset + 6, _depth)?;
2203            fidl::decode!(u8, D, &mut self.key_idx, decoder, offset + 12, _depth)?;
2204            fidl::decode!(fidl::encoding::Vector<u8, 32>, D, &mut self.key, decoder, offset + 16, _depth)?;
2205            Ok(())
2206        }
2207    }
2208
2209    impl fidl::encoding::ValueTypeMarker for WlanRxInfo {
2210        type Borrowed<'a> = &'a Self;
2211        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2212            value
2213        }
2214    }
2215
2216    unsafe impl fidl::encoding::TypeMarker for WlanRxInfo {
2217        type Owned = Self;
2218
2219        #[inline(always)]
2220        fn inline_align(_context: fidl::encoding::Context) -> usize {
2221            4
2222        }
2223
2224        #[inline(always)]
2225        fn inline_size(_context: fidl::encoding::Context) -> usize {
2226            32
2227        }
2228    }
2229
2230    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WlanRxInfo, D>
2231        for &WlanRxInfo
2232    {
2233        #[inline]
2234        unsafe fn encode(
2235            self,
2236            encoder: &mut fidl::encoding::Encoder<'_, D>,
2237            offset: usize,
2238            _depth: fidl::encoding::Depth,
2239        ) -> fidl::Result<()> {
2240            encoder.debug_check_bounds::<WlanRxInfo>(offset);
2241            // Delegate to tuple encoding.
2242            fidl::encoding::Encode::<WlanRxInfo, D>::encode(
2243                (
2244                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.rx_flags),
2245                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.valid_fields),
2246                    <fidl_fuchsia_wlan_common::WlanPhyType as fidl::encoding::ValueTypeMarker>::borrow(&self.phy),
2247                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.data_rate),
2248                    <fidl_fuchsia_wlan_common::WlanChannel as fidl::encoding::ValueTypeMarker>::borrow(&self.channel),
2249                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.mcs),
2250                    <i8 as fidl::encoding::ValueTypeMarker>::borrow(&self.rssi_dbm),
2251                    <i16 as fidl::encoding::ValueTypeMarker>::borrow(&self.snr_dbh),
2252                ),
2253                encoder, offset, _depth
2254            )
2255        }
2256    }
2257    unsafe impl<
2258            D: fidl::encoding::ResourceDialect,
2259            T0: fidl::encoding::Encode<u32, D>,
2260            T1: fidl::encoding::Encode<u32, D>,
2261            T2: fidl::encoding::Encode<fidl_fuchsia_wlan_common::WlanPhyType, D>,
2262            T3: fidl::encoding::Encode<u32, D>,
2263            T4: fidl::encoding::Encode<fidl_fuchsia_wlan_common::WlanChannel, D>,
2264            T5: fidl::encoding::Encode<u8, D>,
2265            T6: fidl::encoding::Encode<i8, D>,
2266            T7: fidl::encoding::Encode<i16, D>,
2267        > fidl::encoding::Encode<WlanRxInfo, D> for (T0, T1, T2, T3, T4, T5, T6, T7)
2268    {
2269        #[inline]
2270        unsafe fn encode(
2271            self,
2272            encoder: &mut fidl::encoding::Encoder<'_, D>,
2273            offset: usize,
2274            depth: fidl::encoding::Depth,
2275        ) -> fidl::Result<()> {
2276            encoder.debug_check_bounds::<WlanRxInfo>(offset);
2277            // Zero out padding regions. There's no need to apply masks
2278            // because the unmasked parts will be overwritten by fields.
2279            // Write the fields.
2280            self.0.encode(encoder, offset + 0, depth)?;
2281            self.1.encode(encoder, offset + 4, depth)?;
2282            self.2.encode(encoder, offset + 8, depth)?;
2283            self.3.encode(encoder, offset + 12, depth)?;
2284            self.4.encode(encoder, offset + 16, depth)?;
2285            self.5.encode(encoder, offset + 28, depth)?;
2286            self.6.encode(encoder, offset + 29, depth)?;
2287            self.7.encode(encoder, offset + 30, depth)?;
2288            Ok(())
2289        }
2290    }
2291
2292    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WlanRxInfo {
2293        #[inline(always)]
2294        fn new_empty() -> Self {
2295            Self {
2296                rx_flags: fidl::new_empty!(u32, D),
2297                valid_fields: fidl::new_empty!(u32, D),
2298                phy: fidl::new_empty!(fidl_fuchsia_wlan_common::WlanPhyType, D),
2299                data_rate: fidl::new_empty!(u32, D),
2300                channel: fidl::new_empty!(fidl_fuchsia_wlan_common::WlanChannel, D),
2301                mcs: fidl::new_empty!(u8, D),
2302                rssi_dbm: fidl::new_empty!(i8, D),
2303                snr_dbh: fidl::new_empty!(i16, D),
2304            }
2305        }
2306
2307        #[inline]
2308        unsafe fn decode(
2309            &mut self,
2310            decoder: &mut fidl::encoding::Decoder<'_, D>,
2311            offset: usize,
2312            _depth: fidl::encoding::Depth,
2313        ) -> fidl::Result<()> {
2314            decoder.debug_check_bounds::<Self>(offset);
2315            // Verify that padding bytes are zero.
2316            fidl::decode!(u32, D, &mut self.rx_flags, decoder, offset + 0, _depth)?;
2317            fidl::decode!(u32, D, &mut self.valid_fields, decoder, offset + 4, _depth)?;
2318            fidl::decode!(
2319                fidl_fuchsia_wlan_common::WlanPhyType,
2320                D,
2321                &mut self.phy,
2322                decoder,
2323                offset + 8,
2324                _depth
2325            )?;
2326            fidl::decode!(u32, D, &mut self.data_rate, decoder, offset + 12, _depth)?;
2327            fidl::decode!(
2328                fidl_fuchsia_wlan_common::WlanChannel,
2329                D,
2330                &mut self.channel,
2331                decoder,
2332                offset + 16,
2333                _depth
2334            )?;
2335            fidl::decode!(u8, D, &mut self.mcs, decoder, offset + 28, _depth)?;
2336            fidl::decode!(i8, D, &mut self.rssi_dbm, decoder, offset + 29, _depth)?;
2337            fidl::decode!(i16, D, &mut self.snr_dbh, decoder, offset + 30, _depth)?;
2338            Ok(())
2339        }
2340    }
2341
2342    impl fidl::encoding::ValueTypeMarker for WlanTxInfo {
2343        type Borrowed<'a> = &'a Self;
2344        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2345            value
2346        }
2347    }
2348
2349    unsafe impl fidl::encoding::TypeMarker for WlanTxInfo {
2350        type Owned = Self;
2351
2352        #[inline(always)]
2353        fn inline_align(_context: fidl::encoding::Context) -> usize {
2354            4
2355        }
2356
2357        #[inline(always)]
2358        fn inline_size(_context: fidl::encoding::Context) -> usize {
2359            20
2360        }
2361    }
2362
2363    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WlanTxInfo, D>
2364        for &WlanTxInfo
2365    {
2366        #[inline]
2367        unsafe fn encode(
2368            self,
2369            encoder: &mut fidl::encoding::Encoder<'_, D>,
2370            offset: usize,
2371            _depth: fidl::encoding::Depth,
2372        ) -> fidl::Result<()> {
2373            encoder.debug_check_bounds::<WlanTxInfo>(offset);
2374            // Delegate to tuple encoding.
2375            fidl::encoding::Encode::<WlanTxInfo, D>::encode(
2376                (
2377                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.tx_flags),
2378                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.valid_fields),
2379                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.tx_vector_idx),
2380                    <fidl_fuchsia_wlan_common::WlanPhyType as fidl::encoding::ValueTypeMarker>::borrow(&self.phy),
2381                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.cbw),
2382                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.mcs),
2383                ),
2384                encoder, offset, _depth
2385            )
2386        }
2387    }
2388    unsafe impl<
2389            D: fidl::encoding::ResourceDialect,
2390            T0: fidl::encoding::Encode<u32, D>,
2391            T1: fidl::encoding::Encode<u32, D>,
2392            T2: fidl::encoding::Encode<u16, D>,
2393            T3: fidl::encoding::Encode<fidl_fuchsia_wlan_common::WlanPhyType, D>,
2394            T4: fidl::encoding::Encode<u8, D>,
2395            T5: fidl::encoding::Encode<u8, D>,
2396        > fidl::encoding::Encode<WlanTxInfo, D> for (T0, T1, T2, T3, T4, T5)
2397    {
2398        #[inline]
2399        unsafe fn encode(
2400            self,
2401            encoder: &mut fidl::encoding::Encoder<'_, D>,
2402            offset: usize,
2403            depth: fidl::encoding::Depth,
2404        ) -> fidl::Result<()> {
2405            encoder.debug_check_bounds::<WlanTxInfo>(offset);
2406            // Zero out padding regions. There's no need to apply masks
2407            // because the unmasked parts will be overwritten by fields.
2408            unsafe {
2409                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
2410                (ptr as *mut u32).write_unaligned(0);
2411            }
2412            unsafe {
2413                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2414                (ptr as *mut u32).write_unaligned(0);
2415            }
2416            // Write the fields.
2417            self.0.encode(encoder, offset + 0, depth)?;
2418            self.1.encode(encoder, offset + 4, depth)?;
2419            self.2.encode(encoder, offset + 8, depth)?;
2420            self.3.encode(encoder, offset + 12, depth)?;
2421            self.4.encode(encoder, offset + 16, depth)?;
2422            self.5.encode(encoder, offset + 17, depth)?;
2423            Ok(())
2424        }
2425    }
2426
2427    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WlanTxInfo {
2428        #[inline(always)]
2429        fn new_empty() -> Self {
2430            Self {
2431                tx_flags: fidl::new_empty!(u32, D),
2432                valid_fields: fidl::new_empty!(u32, D),
2433                tx_vector_idx: fidl::new_empty!(u16, D),
2434                phy: fidl::new_empty!(fidl_fuchsia_wlan_common::WlanPhyType, D),
2435                cbw: fidl::new_empty!(u8, D),
2436                mcs: fidl::new_empty!(u8, D),
2437            }
2438        }
2439
2440        #[inline]
2441        unsafe fn decode(
2442            &mut self,
2443            decoder: &mut fidl::encoding::Decoder<'_, D>,
2444            offset: usize,
2445            _depth: fidl::encoding::Depth,
2446        ) -> fidl::Result<()> {
2447            decoder.debug_check_bounds::<Self>(offset);
2448            // Verify that padding bytes are zero.
2449            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
2450            let padval = unsafe { (ptr as *const u32).read_unaligned() };
2451            let mask = 0xffff0000u32;
2452            let maskedval = padval & mask;
2453            if maskedval != 0 {
2454                return Err(fidl::Error::NonZeroPadding {
2455                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2456                });
2457            }
2458            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2459            let padval = unsafe { (ptr as *const u32).read_unaligned() };
2460            let mask = 0xffff0000u32;
2461            let maskedval = padval & mask;
2462            if maskedval != 0 {
2463                return Err(fidl::Error::NonZeroPadding {
2464                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2465                });
2466            }
2467            fidl::decode!(u32, D, &mut self.tx_flags, decoder, offset + 0, _depth)?;
2468            fidl::decode!(u32, D, &mut self.valid_fields, decoder, offset + 4, _depth)?;
2469            fidl::decode!(u16, D, &mut self.tx_vector_idx, decoder, offset + 8, _depth)?;
2470            fidl::decode!(
2471                fidl_fuchsia_wlan_common::WlanPhyType,
2472                D,
2473                &mut self.phy,
2474                decoder,
2475                offset + 12,
2476                _depth
2477            )?;
2478            fidl::decode!(u8, D, &mut self.cbw, decoder, offset + 16, _depth)?;
2479            fidl::decode!(u8, D, &mut self.mcs, decoder, offset + 17, _depth)?;
2480            Ok(())
2481        }
2482    }
2483
2484    impl fidl::encoding::ValueTypeMarker for WlanTxPacket {
2485        type Borrowed<'a> = &'a Self;
2486        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2487            value
2488        }
2489    }
2490
2491    unsafe impl fidl::encoding::TypeMarker for WlanTxPacket {
2492        type Owned = Self;
2493
2494        #[inline(always)]
2495        fn inline_align(_context: fidl::encoding::Context) -> usize {
2496            8
2497        }
2498
2499        #[inline(always)]
2500        fn inline_size(_context: fidl::encoding::Context) -> usize {
2501            40
2502        }
2503    }
2504
2505    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WlanTxPacket, D>
2506        for &WlanTxPacket
2507    {
2508        #[inline]
2509        unsafe fn encode(
2510            self,
2511            encoder: &mut fidl::encoding::Encoder<'_, D>,
2512            offset: usize,
2513            _depth: fidl::encoding::Depth,
2514        ) -> fidl::Result<()> {
2515            encoder.debug_check_bounds::<WlanTxPacket>(offset);
2516            // Delegate to tuple encoding.
2517            fidl::encoding::Encode::<WlanTxPacket, D>::encode(
2518                (
2519                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.data),
2520                    <WlanTxInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),
2521                ),
2522                encoder, offset, _depth
2523            )
2524        }
2525    }
2526    unsafe impl<
2527            D: fidl::encoding::ResourceDialect,
2528            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
2529            T1: fidl::encoding::Encode<WlanTxInfo, D>,
2530        > fidl::encoding::Encode<WlanTxPacket, D> for (T0, T1)
2531    {
2532        #[inline]
2533        unsafe fn encode(
2534            self,
2535            encoder: &mut fidl::encoding::Encoder<'_, D>,
2536            offset: usize,
2537            depth: fidl::encoding::Depth,
2538        ) -> fidl::Result<()> {
2539            encoder.debug_check_bounds::<WlanTxPacket>(offset);
2540            // Zero out padding regions. There's no need to apply masks
2541            // because the unmasked parts will be overwritten by fields.
2542            unsafe {
2543                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
2544                (ptr as *mut u64).write_unaligned(0);
2545            }
2546            // Write the fields.
2547            self.0.encode(encoder, offset + 0, depth)?;
2548            self.1.encode(encoder, offset + 16, depth)?;
2549            Ok(())
2550        }
2551    }
2552
2553    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WlanTxPacket {
2554        #[inline(always)]
2555        fn new_empty() -> Self {
2556            Self {
2557                data: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
2558                info: fidl::new_empty!(WlanTxInfo, D),
2559            }
2560        }
2561
2562        #[inline]
2563        unsafe fn decode(
2564            &mut self,
2565            decoder: &mut fidl::encoding::Decoder<'_, D>,
2566            offset: usize,
2567            _depth: fidl::encoding::Depth,
2568        ) -> fidl::Result<()> {
2569            decoder.debug_check_bounds::<Self>(offset);
2570            // Verify that padding bytes are zero.
2571            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
2572            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2573            let mask = 0xffffffff00000000u64;
2574            let maskedval = padval & mask;
2575            if maskedval != 0 {
2576                return Err(fidl::Error::NonZeroPadding {
2577                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
2578                });
2579            }
2580            fidl::decode!(
2581                fidl::encoding::UnboundedVector<u8>,
2582                D,
2583                &mut self.data,
2584                decoder,
2585                offset + 0,
2586                _depth
2587            )?;
2588            fidl::decode!(WlanTxInfo, D, &mut self.info, decoder, offset + 16, _depth)?;
2589            Ok(())
2590        }
2591    }
2592
2593    impl fidl::encoding::ResourceTypeMarker for WlantapCtlCreatePhyRequest {
2594        type Borrowed<'a> = &'a mut Self;
2595        fn take_or_borrow<'a>(
2596            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2597        ) -> Self::Borrowed<'a> {
2598            value
2599        }
2600    }
2601
2602    unsafe impl fidl::encoding::TypeMarker for WlantapCtlCreatePhyRequest {
2603        type Owned = Self;
2604
2605        #[inline(always)]
2606        fn inline_align(_context: fidl::encoding::Context) -> usize {
2607            8
2608        }
2609
2610        #[inline(always)]
2611        fn inline_size(_context: fidl::encoding::Context) -> usize {
2612            96
2613        }
2614    }
2615
2616    unsafe impl
2617        fidl::encoding::Encode<
2618            WlantapCtlCreatePhyRequest,
2619            fidl::encoding::DefaultFuchsiaResourceDialect,
2620        > for &mut WlantapCtlCreatePhyRequest
2621    {
2622        #[inline]
2623        unsafe fn encode(
2624            self,
2625            encoder: &mut fidl::encoding::Encoder<
2626                '_,
2627                fidl::encoding::DefaultFuchsiaResourceDialect,
2628            >,
2629            offset: usize,
2630            _depth: fidl::encoding::Depth,
2631        ) -> fidl::Result<()> {
2632            encoder.debug_check_bounds::<WlantapCtlCreatePhyRequest>(offset);
2633            // Delegate to tuple encoding.
2634            fidl::encoding::Encode::<WlantapCtlCreatePhyRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2635                (
2636                    <WlantapPhyConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
2637                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WlantapPhyMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.proxy),
2638                ),
2639                encoder, offset, _depth
2640            )
2641        }
2642    }
2643    unsafe impl<
2644            T0: fidl::encoding::Encode<WlantapPhyConfig, fidl::encoding::DefaultFuchsiaResourceDialect>,
2645            T1: fidl::encoding::Encode<
2646                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WlantapPhyMarker>>,
2647                fidl::encoding::DefaultFuchsiaResourceDialect,
2648            >,
2649        >
2650        fidl::encoding::Encode<
2651            WlantapCtlCreatePhyRequest,
2652            fidl::encoding::DefaultFuchsiaResourceDialect,
2653        > for (T0, T1)
2654    {
2655        #[inline]
2656        unsafe fn encode(
2657            self,
2658            encoder: &mut fidl::encoding::Encoder<
2659                '_,
2660                fidl::encoding::DefaultFuchsiaResourceDialect,
2661            >,
2662            offset: usize,
2663            depth: fidl::encoding::Depth,
2664        ) -> fidl::Result<()> {
2665            encoder.debug_check_bounds::<WlantapCtlCreatePhyRequest>(offset);
2666            // Zero out padding regions. There's no need to apply masks
2667            // because the unmasked parts will be overwritten by fields.
2668            unsafe {
2669                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(88);
2670                (ptr as *mut u64).write_unaligned(0);
2671            }
2672            // Write the fields.
2673            self.0.encode(encoder, offset + 0, depth)?;
2674            self.1.encode(encoder, offset + 88, depth)?;
2675            Ok(())
2676        }
2677    }
2678
2679    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2680        for WlantapCtlCreatePhyRequest
2681    {
2682        #[inline(always)]
2683        fn new_empty() -> Self {
2684            Self {
2685                config: fidl::new_empty!(
2686                    WlantapPhyConfig,
2687                    fidl::encoding::DefaultFuchsiaResourceDialect
2688                ),
2689                proxy: fidl::new_empty!(
2690                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WlantapPhyMarker>>,
2691                    fidl::encoding::DefaultFuchsiaResourceDialect
2692                ),
2693            }
2694        }
2695
2696        #[inline]
2697        unsafe fn decode(
2698            &mut self,
2699            decoder: &mut fidl::encoding::Decoder<
2700                '_,
2701                fidl::encoding::DefaultFuchsiaResourceDialect,
2702            >,
2703            offset: usize,
2704            _depth: fidl::encoding::Depth,
2705        ) -> fidl::Result<()> {
2706            decoder.debug_check_bounds::<Self>(offset);
2707            // Verify that padding bytes are zero.
2708            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(88) };
2709            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2710            let mask = 0xffffffff00000000u64;
2711            let maskedval = padval & mask;
2712            if maskedval != 0 {
2713                return Err(fidl::Error::NonZeroPadding {
2714                    padding_start: offset + 88 + ((mask as u64).trailing_zeros() / 8) as usize,
2715                });
2716            }
2717            fidl::decode!(
2718                WlantapPhyConfig,
2719                fidl::encoding::DefaultFuchsiaResourceDialect,
2720                &mut self.config,
2721                decoder,
2722                offset + 0,
2723                _depth
2724            )?;
2725            fidl::decode!(
2726                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WlantapPhyMarker>>,
2727                fidl::encoding::DefaultFuchsiaResourceDialect,
2728                &mut self.proxy,
2729                decoder,
2730                offset + 88,
2731                _depth
2732            )?;
2733            Ok(())
2734        }
2735    }
2736
2737    impl fidl::encoding::ValueTypeMarker for WlantapCtlCreatePhyResponse {
2738        type Borrowed<'a> = &'a Self;
2739        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2740            value
2741        }
2742    }
2743
2744    unsafe impl fidl::encoding::TypeMarker for WlantapCtlCreatePhyResponse {
2745        type Owned = Self;
2746
2747        #[inline(always)]
2748        fn inline_align(_context: fidl::encoding::Context) -> usize {
2749            4
2750        }
2751
2752        #[inline(always)]
2753        fn inline_size(_context: fidl::encoding::Context) -> usize {
2754            4
2755        }
2756        #[inline(always)]
2757        fn encode_is_copy() -> bool {
2758            true
2759        }
2760
2761        #[inline(always)]
2762        fn decode_is_copy() -> bool {
2763            true
2764        }
2765    }
2766
2767    unsafe impl<D: fidl::encoding::ResourceDialect>
2768        fidl::encoding::Encode<WlantapCtlCreatePhyResponse, D> for &WlantapCtlCreatePhyResponse
2769    {
2770        #[inline]
2771        unsafe fn encode(
2772            self,
2773            encoder: &mut fidl::encoding::Encoder<'_, D>,
2774            offset: usize,
2775            _depth: fidl::encoding::Depth,
2776        ) -> fidl::Result<()> {
2777            encoder.debug_check_bounds::<WlantapCtlCreatePhyResponse>(offset);
2778            unsafe {
2779                // Copy the object into the buffer.
2780                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2781                (buf_ptr as *mut WlantapCtlCreatePhyResponse)
2782                    .write_unaligned((self as *const WlantapCtlCreatePhyResponse).read());
2783                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2784                // done second because the memcpy will write garbage to these bytes.
2785            }
2786            Ok(())
2787        }
2788    }
2789    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<i32, D>>
2790        fidl::encoding::Encode<WlantapCtlCreatePhyResponse, D> for (T0,)
2791    {
2792        #[inline]
2793        unsafe fn encode(
2794            self,
2795            encoder: &mut fidl::encoding::Encoder<'_, D>,
2796            offset: usize,
2797            depth: fidl::encoding::Depth,
2798        ) -> fidl::Result<()> {
2799            encoder.debug_check_bounds::<WlantapCtlCreatePhyResponse>(offset);
2800            // Zero out padding regions. There's no need to apply masks
2801            // because the unmasked parts will be overwritten by fields.
2802            // Write the fields.
2803            self.0.encode(encoder, offset + 0, depth)?;
2804            Ok(())
2805        }
2806    }
2807
2808    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2809        for WlantapCtlCreatePhyResponse
2810    {
2811        #[inline(always)]
2812        fn new_empty() -> Self {
2813            Self { status: fidl::new_empty!(i32, D) }
2814        }
2815
2816        #[inline]
2817        unsafe fn decode(
2818            &mut self,
2819            decoder: &mut fidl::encoding::Decoder<'_, D>,
2820            offset: usize,
2821            _depth: fidl::encoding::Depth,
2822        ) -> fidl::Result<()> {
2823            decoder.debug_check_bounds::<Self>(offset);
2824            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2825            // Verify that padding bytes are zero.
2826            // Copy from the buffer into the object.
2827            unsafe {
2828                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2829            }
2830            Ok(())
2831        }
2832    }
2833
2834    impl fidl::encoding::ValueTypeMarker for WlantapPhyConfig {
2835        type Borrowed<'a> = &'a Self;
2836        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2837            value
2838        }
2839    }
2840
2841    unsafe impl fidl::encoding::TypeMarker for WlantapPhyConfig {
2842        type Owned = Self;
2843
2844        #[inline(always)]
2845        fn inline_align(_context: fidl::encoding::Context) -> usize {
2846            8
2847        }
2848
2849        #[inline(always)]
2850        fn inline_size(_context: fidl::encoding::Context) -> usize {
2851            88
2852        }
2853    }
2854
2855    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WlantapPhyConfig, D>
2856        for &WlantapPhyConfig
2857    {
2858        #[inline]
2859        unsafe fn encode(
2860            self,
2861            encoder: &mut fidl::encoding::Encoder<'_, D>,
2862            offset: usize,
2863            _depth: fidl::encoding::Depth,
2864        ) -> fidl::Result<()> {
2865            encoder.debug_check_bounds::<WlantapPhyConfig>(offset);
2866            // Delegate to tuple encoding.
2867            fidl::encoding::Encode::<WlantapPhyConfig, D>::encode(
2868                (
2869                    <fidl::encoding::Array<u8, 6> as fidl::encoding::ValueTypeMarker>::borrow(&self.sta_addr),
2870                    <fidl_fuchsia_wlan_common::WlanMacRole as fidl::encoding::ValueTypeMarker>::borrow(&self.mac_role),
2871                    <fidl::encoding::Vector<fidl_fuchsia_wlan_common::WlanPhyType, 64> as fidl::encoding::ValueTypeMarker>::borrow(&self.supported_phys),
2872                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.hardware_capability),
2873                    <fidl::encoding::Vector<fidl_fuchsia_wlan_device::BandInfo, 8> as fidl::encoding::ValueTypeMarker>::borrow(&self.bands),
2874                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
2875                    <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.quiet),
2876                    <fidl_fuchsia_wlan_common::DiscoverySupport as fidl::encoding::ValueTypeMarker>::borrow(&self.discovery_support),
2877                    <fidl_fuchsia_wlan_common::MacSublayerSupport as fidl::encoding::ValueTypeMarker>::borrow(&self.mac_sublayer_support),
2878                    <fidl_fuchsia_wlan_common::SecuritySupport as fidl::encoding::ValueTypeMarker>::borrow(&self.security_support),
2879                    <fidl_fuchsia_wlan_common::SpectrumManagementSupport as fidl::encoding::ValueTypeMarker>::borrow(&self.spectrum_management_support),
2880                ),
2881                encoder, offset, _depth
2882            )
2883        }
2884    }
2885    unsafe impl<
2886            D: fidl::encoding::ResourceDialect,
2887            T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 6>, D>,
2888            T1: fidl::encoding::Encode<fidl_fuchsia_wlan_common::WlanMacRole, D>,
2889            T2: fidl::encoding::Encode<
2890                fidl::encoding::Vector<fidl_fuchsia_wlan_common::WlanPhyType, 64>,
2891                D,
2892            >,
2893            T3: fidl::encoding::Encode<u32, D>,
2894            T4: fidl::encoding::Encode<
2895                fidl::encoding::Vector<fidl_fuchsia_wlan_device::BandInfo, 8>,
2896                D,
2897            >,
2898            T5: fidl::encoding::Encode<fidl::encoding::BoundedString<32>, D>,
2899            T6: fidl::encoding::Encode<bool, D>,
2900            T7: fidl::encoding::Encode<fidl_fuchsia_wlan_common::DiscoverySupport, D>,
2901            T8: fidl::encoding::Encode<fidl_fuchsia_wlan_common::MacSublayerSupport, D>,
2902            T9: fidl::encoding::Encode<fidl_fuchsia_wlan_common::SecuritySupport, D>,
2903            T10: fidl::encoding::Encode<fidl_fuchsia_wlan_common::SpectrumManagementSupport, D>,
2904        > fidl::encoding::Encode<WlantapPhyConfig, D>
2905        for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10)
2906    {
2907        #[inline]
2908        unsafe fn encode(
2909            self,
2910            encoder: &mut fidl::encoding::Encoder<'_, D>,
2911            offset: usize,
2912            depth: fidl::encoding::Depth,
2913        ) -> fidl::Result<()> {
2914            encoder.debug_check_bounds::<WlantapPhyConfig>(offset);
2915            // Zero out padding regions. There's no need to apply masks
2916            // because the unmasked parts will be overwritten by fields.
2917            unsafe {
2918                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2919                (ptr as *mut u64).write_unaligned(0);
2920            }
2921            unsafe {
2922                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
2923                (ptr as *mut u64).write_unaligned(0);
2924            }
2925            unsafe {
2926                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
2927                (ptr as *mut u64).write_unaligned(0);
2928            }
2929            unsafe {
2930                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(80);
2931                (ptr as *mut u64).write_unaligned(0);
2932            }
2933            // Write the fields.
2934            self.0.encode(encoder, offset + 0, depth)?;
2935            self.1.encode(encoder, offset + 8, depth)?;
2936            self.2.encode(encoder, offset + 16, depth)?;
2937            self.3.encode(encoder, offset + 32, depth)?;
2938            self.4.encode(encoder, offset + 40, depth)?;
2939            self.5.encode(encoder, offset + 56, depth)?;
2940            self.6.encode(encoder, offset + 72, depth)?;
2941            self.7.encode(encoder, offset + 73, depth)?;
2942            self.8.encode(encoder, offset + 76, depth)?;
2943            self.9.encode(encoder, offset + 81, depth)?;
2944            self.10.encode(encoder, offset + 84, depth)?;
2945            Ok(())
2946        }
2947    }
2948
2949    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WlantapPhyConfig {
2950        #[inline(always)]
2951        fn new_empty() -> Self {
2952            Self {
2953                sta_addr: fidl::new_empty!(fidl::encoding::Array<u8, 6>, D),
2954                mac_role: fidl::new_empty!(fidl_fuchsia_wlan_common::WlanMacRole, D),
2955                supported_phys: fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_wlan_common::WlanPhyType, 64>, D),
2956                hardware_capability: fidl::new_empty!(u32, D),
2957                bands: fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_wlan_device::BandInfo, 8>, D),
2958                name: fidl::new_empty!(fidl::encoding::BoundedString<32>, D),
2959                quiet: fidl::new_empty!(bool, D),
2960                discovery_support: fidl::new_empty!(fidl_fuchsia_wlan_common::DiscoverySupport, D),
2961                mac_sublayer_support: fidl::new_empty!(
2962                    fidl_fuchsia_wlan_common::MacSublayerSupport,
2963                    D
2964                ),
2965                security_support: fidl::new_empty!(fidl_fuchsia_wlan_common::SecuritySupport, D),
2966                spectrum_management_support: fidl::new_empty!(
2967                    fidl_fuchsia_wlan_common::SpectrumManagementSupport,
2968                    D
2969                ),
2970            }
2971        }
2972
2973        #[inline]
2974        unsafe fn decode(
2975            &mut self,
2976            decoder: &mut fidl::encoding::Decoder<'_, D>,
2977            offset: usize,
2978            _depth: fidl::encoding::Depth,
2979        ) -> fidl::Result<()> {
2980            decoder.debug_check_bounds::<Self>(offset);
2981            // Verify that padding bytes are zero.
2982            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2983            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2984            let mask = 0xffff000000000000u64;
2985            let maskedval = padval & mask;
2986            if maskedval != 0 {
2987                return Err(fidl::Error::NonZeroPadding {
2988                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2989                });
2990            }
2991            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
2992            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2993            let mask = 0xffffffff00000000u64;
2994            let maskedval = padval & mask;
2995            if maskedval != 0 {
2996                return Err(fidl::Error::NonZeroPadding {
2997                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2998                });
2999            }
3000            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
3001            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3002            let mask = 0xffffffff00000000u64;
3003            let maskedval = padval & mask;
3004            if maskedval != 0 {
3005                return Err(fidl::Error::NonZeroPadding {
3006                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
3007                });
3008            }
3009            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(80) };
3010            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3011            let mask = 0xffffff0000000000u64;
3012            let maskedval = padval & mask;
3013            if maskedval != 0 {
3014                return Err(fidl::Error::NonZeroPadding {
3015                    padding_start: offset + 80 + ((mask as u64).trailing_zeros() / 8) as usize,
3016                });
3017            }
3018            fidl::decode!(fidl::encoding::Array<u8, 6>, D, &mut self.sta_addr, decoder, offset + 0, _depth)?;
3019            fidl::decode!(
3020                fidl_fuchsia_wlan_common::WlanMacRole,
3021                D,
3022                &mut self.mac_role,
3023                decoder,
3024                offset + 8,
3025                _depth
3026            )?;
3027            fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_wlan_common::WlanPhyType, 64>, D, &mut self.supported_phys, decoder, offset + 16, _depth)?;
3028            fidl::decode!(u32, D, &mut self.hardware_capability, decoder, offset + 32, _depth)?;
3029            fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_wlan_device::BandInfo, 8>, D, &mut self.bands, decoder, offset + 40, _depth)?;
3030            fidl::decode!(
3031                fidl::encoding::BoundedString<32>,
3032                D,
3033                &mut self.name,
3034                decoder,
3035                offset + 56,
3036                _depth
3037            )?;
3038            fidl::decode!(bool, D, &mut self.quiet, decoder, offset + 72, _depth)?;
3039            fidl::decode!(
3040                fidl_fuchsia_wlan_common::DiscoverySupport,
3041                D,
3042                &mut self.discovery_support,
3043                decoder,
3044                offset + 73,
3045                _depth
3046            )?;
3047            fidl::decode!(
3048                fidl_fuchsia_wlan_common::MacSublayerSupport,
3049                D,
3050                &mut self.mac_sublayer_support,
3051                decoder,
3052                offset + 76,
3053                _depth
3054            )?;
3055            fidl::decode!(
3056                fidl_fuchsia_wlan_common::SecuritySupport,
3057                D,
3058                &mut self.security_support,
3059                decoder,
3060                offset + 81,
3061                _depth
3062            )?;
3063            fidl::decode!(
3064                fidl_fuchsia_wlan_common::SpectrumManagementSupport,
3065                D,
3066                &mut self.spectrum_management_support,
3067                decoder,
3068                offset + 84,
3069                _depth
3070            )?;
3071            Ok(())
3072        }
3073    }
3074
3075    impl fidl::encoding::ValueTypeMarker for WlantapPhyJoinBssRequest {
3076        type Borrowed<'a> = &'a Self;
3077        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3078            value
3079        }
3080    }
3081
3082    unsafe impl fidl::encoding::TypeMarker for WlantapPhyJoinBssRequest {
3083        type Owned = Self;
3084
3085        #[inline(always)]
3086        fn inline_align(_context: fidl::encoding::Context) -> usize {
3087            8
3088        }
3089
3090        #[inline(always)]
3091        fn inline_size(_context: fidl::encoding::Context) -> usize {
3092            24
3093        }
3094    }
3095
3096    unsafe impl<D: fidl::encoding::ResourceDialect>
3097        fidl::encoding::Encode<WlantapPhyJoinBssRequest, D> for &WlantapPhyJoinBssRequest
3098    {
3099        #[inline]
3100        unsafe fn encode(
3101            self,
3102            encoder: &mut fidl::encoding::Encoder<'_, D>,
3103            offset: usize,
3104            _depth: fidl::encoding::Depth,
3105        ) -> fidl::Result<()> {
3106            encoder.debug_check_bounds::<WlantapPhyJoinBssRequest>(offset);
3107            // Delegate to tuple encoding.
3108            fidl::encoding::Encode::<WlantapPhyJoinBssRequest, D>::encode(
3109                (<JoinBssArgs as fidl::encoding::ValueTypeMarker>::borrow(&self.args),),
3110                encoder,
3111                offset,
3112                _depth,
3113            )
3114        }
3115    }
3116    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<JoinBssArgs, D>>
3117        fidl::encoding::Encode<WlantapPhyJoinBssRequest, D> for (T0,)
3118    {
3119        #[inline]
3120        unsafe fn encode(
3121            self,
3122            encoder: &mut fidl::encoding::Encoder<'_, D>,
3123            offset: usize,
3124            depth: fidl::encoding::Depth,
3125        ) -> fidl::Result<()> {
3126            encoder.debug_check_bounds::<WlantapPhyJoinBssRequest>(offset);
3127            // Zero out padding regions. There's no need to apply masks
3128            // because the unmasked parts will be overwritten by fields.
3129            // Write the fields.
3130            self.0.encode(encoder, offset + 0, depth)?;
3131            Ok(())
3132        }
3133    }
3134
3135    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3136        for WlantapPhyJoinBssRequest
3137    {
3138        #[inline(always)]
3139        fn new_empty() -> Self {
3140            Self { args: fidl::new_empty!(JoinBssArgs, D) }
3141        }
3142
3143        #[inline]
3144        unsafe fn decode(
3145            &mut self,
3146            decoder: &mut fidl::encoding::Decoder<'_, D>,
3147            offset: usize,
3148            _depth: fidl::encoding::Depth,
3149        ) -> fidl::Result<()> {
3150            decoder.debug_check_bounds::<Self>(offset);
3151            // Verify that padding bytes are zero.
3152            fidl::decode!(JoinBssArgs, D, &mut self.args, decoder, offset + 0, _depth)?;
3153            Ok(())
3154        }
3155    }
3156
3157    impl fidl::encoding::ValueTypeMarker for WlantapPhyReportTxResultRequest {
3158        type Borrowed<'a> = &'a Self;
3159        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3160            value
3161        }
3162    }
3163
3164    unsafe impl fidl::encoding::TypeMarker for WlantapPhyReportTxResultRequest {
3165        type Owned = Self;
3166
3167        #[inline(always)]
3168        fn inline_align(_context: fidl::encoding::Context) -> usize {
3169            2
3170        }
3171
3172        #[inline(always)]
3173        fn inline_size(_context: fidl::encoding::Context) -> usize {
3174            40
3175        }
3176    }
3177
3178    unsafe impl<D: fidl::encoding::ResourceDialect>
3179        fidl::encoding::Encode<WlantapPhyReportTxResultRequest, D>
3180        for &WlantapPhyReportTxResultRequest
3181    {
3182        #[inline]
3183        unsafe fn encode(
3184            self,
3185            encoder: &mut fidl::encoding::Encoder<'_, D>,
3186            offset: usize,
3187            _depth: fidl::encoding::Depth,
3188        ) -> fidl::Result<()> {
3189            encoder.debug_check_bounds::<WlantapPhyReportTxResultRequest>(offset);
3190            // Delegate to tuple encoding.
3191            fidl::encoding::Encode::<WlantapPhyReportTxResultRequest, D>::encode(
3192                (
3193                    <fidl_fuchsia_wlan_common::WlanTxResult as fidl::encoding::ValueTypeMarker>::borrow(&self.txr),
3194                ),
3195                encoder, offset, _depth
3196            )
3197        }
3198    }
3199    unsafe impl<
3200            D: fidl::encoding::ResourceDialect,
3201            T0: fidl::encoding::Encode<fidl_fuchsia_wlan_common::WlanTxResult, D>,
3202        > fidl::encoding::Encode<WlantapPhyReportTxResultRequest, D> for (T0,)
3203    {
3204        #[inline]
3205        unsafe fn encode(
3206            self,
3207            encoder: &mut fidl::encoding::Encoder<'_, D>,
3208            offset: usize,
3209            depth: fidl::encoding::Depth,
3210        ) -> fidl::Result<()> {
3211            encoder.debug_check_bounds::<WlantapPhyReportTxResultRequest>(offset);
3212            // Zero out padding regions. There's no need to apply masks
3213            // because the unmasked parts will be overwritten by fields.
3214            // Write the fields.
3215            self.0.encode(encoder, offset + 0, depth)?;
3216            Ok(())
3217        }
3218    }
3219
3220    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3221        for WlantapPhyReportTxResultRequest
3222    {
3223        #[inline(always)]
3224        fn new_empty() -> Self {
3225            Self { txr: fidl::new_empty!(fidl_fuchsia_wlan_common::WlanTxResult, D) }
3226        }
3227
3228        #[inline]
3229        unsafe fn decode(
3230            &mut self,
3231            decoder: &mut fidl::encoding::Decoder<'_, D>,
3232            offset: usize,
3233            _depth: fidl::encoding::Depth,
3234        ) -> fidl::Result<()> {
3235            decoder.debug_check_bounds::<Self>(offset);
3236            // Verify that padding bytes are zero.
3237            fidl::decode!(
3238                fidl_fuchsia_wlan_common::WlanTxResult,
3239                D,
3240                &mut self.txr,
3241                decoder,
3242                offset + 0,
3243                _depth
3244            )?;
3245            Ok(())
3246        }
3247    }
3248
3249    impl fidl::encoding::ValueTypeMarker for WlantapPhyRxRequest {
3250        type Borrowed<'a> = &'a Self;
3251        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3252            value
3253        }
3254    }
3255
3256    unsafe impl fidl::encoding::TypeMarker for WlantapPhyRxRequest {
3257        type Owned = Self;
3258
3259        #[inline(always)]
3260        fn inline_align(_context: fidl::encoding::Context) -> usize {
3261            8
3262        }
3263
3264        #[inline(always)]
3265        fn inline_size(_context: fidl::encoding::Context) -> usize {
3266            48
3267        }
3268    }
3269
3270    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WlantapPhyRxRequest, D>
3271        for &WlantapPhyRxRequest
3272    {
3273        #[inline]
3274        unsafe fn encode(
3275            self,
3276            encoder: &mut fidl::encoding::Encoder<'_, D>,
3277            offset: usize,
3278            _depth: fidl::encoding::Depth,
3279        ) -> fidl::Result<()> {
3280            encoder.debug_check_bounds::<WlantapPhyRxRequest>(offset);
3281            // Delegate to tuple encoding.
3282            fidl::encoding::Encode::<WlantapPhyRxRequest, D>::encode(
3283                (
3284                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.data),
3285                    <WlanRxInfo as fidl::encoding::ValueTypeMarker>::borrow(&self.info),
3286                ),
3287                encoder, offset, _depth
3288            )
3289        }
3290    }
3291    unsafe impl<
3292            D: fidl::encoding::ResourceDialect,
3293            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
3294            T1: fidl::encoding::Encode<WlanRxInfo, D>,
3295        > fidl::encoding::Encode<WlantapPhyRxRequest, D> for (T0, T1)
3296    {
3297        #[inline]
3298        unsafe fn encode(
3299            self,
3300            encoder: &mut fidl::encoding::Encoder<'_, D>,
3301            offset: usize,
3302            depth: fidl::encoding::Depth,
3303        ) -> fidl::Result<()> {
3304            encoder.debug_check_bounds::<WlantapPhyRxRequest>(offset);
3305            // Zero out padding regions. There's no need to apply masks
3306            // because the unmasked parts will be overwritten by fields.
3307            // Write the fields.
3308            self.0.encode(encoder, offset + 0, depth)?;
3309            self.1.encode(encoder, offset + 16, depth)?;
3310            Ok(())
3311        }
3312    }
3313
3314    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WlantapPhyRxRequest {
3315        #[inline(always)]
3316        fn new_empty() -> Self {
3317            Self {
3318                data: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
3319                info: fidl::new_empty!(WlanRxInfo, D),
3320            }
3321        }
3322
3323        #[inline]
3324        unsafe fn decode(
3325            &mut self,
3326            decoder: &mut fidl::encoding::Decoder<'_, D>,
3327            offset: usize,
3328            _depth: fidl::encoding::Depth,
3329        ) -> fidl::Result<()> {
3330            decoder.debug_check_bounds::<Self>(offset);
3331            // Verify that padding bytes are zero.
3332            fidl::decode!(
3333                fidl::encoding::UnboundedVector<u8>,
3334                D,
3335                &mut self.data,
3336                decoder,
3337                offset + 0,
3338                _depth
3339            )?;
3340            fidl::decode!(WlanRxInfo, D, &mut self.info, decoder, offset + 16, _depth)?;
3341            Ok(())
3342        }
3343    }
3344
3345    impl fidl::encoding::ValueTypeMarker for WlantapPhyScanCompleteRequest {
3346        type Borrowed<'a> = &'a Self;
3347        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3348            value
3349        }
3350    }
3351
3352    unsafe impl fidl::encoding::TypeMarker for WlantapPhyScanCompleteRequest {
3353        type Owned = Self;
3354
3355        #[inline(always)]
3356        fn inline_align(_context: fidl::encoding::Context) -> usize {
3357            8
3358        }
3359
3360        #[inline(always)]
3361        fn inline_size(_context: fidl::encoding::Context) -> usize {
3362            16
3363        }
3364    }
3365
3366    unsafe impl<D: fidl::encoding::ResourceDialect>
3367        fidl::encoding::Encode<WlantapPhyScanCompleteRequest, D>
3368        for &WlantapPhyScanCompleteRequest
3369    {
3370        #[inline]
3371        unsafe fn encode(
3372            self,
3373            encoder: &mut fidl::encoding::Encoder<'_, D>,
3374            offset: usize,
3375            _depth: fidl::encoding::Depth,
3376        ) -> fidl::Result<()> {
3377            encoder.debug_check_bounds::<WlantapPhyScanCompleteRequest>(offset);
3378            unsafe {
3379                // Copy the object into the buffer.
3380                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3381                (buf_ptr as *mut WlantapPhyScanCompleteRequest)
3382                    .write_unaligned((self as *const WlantapPhyScanCompleteRequest).read());
3383                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3384                // done second because the memcpy will write garbage to these bytes.
3385                let padding_ptr = buf_ptr.offset(8) as *mut u64;
3386                let padding_mask = 0xffffffff00000000u64;
3387                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
3388            }
3389            Ok(())
3390        }
3391    }
3392    unsafe impl<
3393            D: fidl::encoding::ResourceDialect,
3394            T0: fidl::encoding::Encode<u64, D>,
3395            T1: fidl::encoding::Encode<i32, D>,
3396        > fidl::encoding::Encode<WlantapPhyScanCompleteRequest, D> for (T0, T1)
3397    {
3398        #[inline]
3399        unsafe fn encode(
3400            self,
3401            encoder: &mut fidl::encoding::Encoder<'_, D>,
3402            offset: usize,
3403            depth: fidl::encoding::Depth,
3404        ) -> fidl::Result<()> {
3405            encoder.debug_check_bounds::<WlantapPhyScanCompleteRequest>(offset);
3406            // Zero out padding regions. There's no need to apply masks
3407            // because the unmasked parts will be overwritten by fields.
3408            unsafe {
3409                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
3410                (ptr as *mut u64).write_unaligned(0);
3411            }
3412            // Write the fields.
3413            self.0.encode(encoder, offset + 0, depth)?;
3414            self.1.encode(encoder, offset + 8, depth)?;
3415            Ok(())
3416        }
3417    }
3418
3419    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3420        for WlantapPhyScanCompleteRequest
3421    {
3422        #[inline(always)]
3423        fn new_empty() -> Self {
3424            Self { scan_id: fidl::new_empty!(u64, D), status: fidl::new_empty!(i32, D) }
3425        }
3426
3427        #[inline]
3428        unsafe fn decode(
3429            &mut self,
3430            decoder: &mut fidl::encoding::Decoder<'_, D>,
3431            offset: usize,
3432            _depth: fidl::encoding::Depth,
3433        ) -> fidl::Result<()> {
3434            decoder.debug_check_bounds::<Self>(offset);
3435            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3436            // Verify that padding bytes are zero.
3437            let ptr = unsafe { buf_ptr.offset(8) };
3438            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3439            let mask = 0xffffffff00000000u64;
3440            let maskedval = padval & mask;
3441            if maskedval != 0 {
3442                return Err(fidl::Error::NonZeroPadding {
3443                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
3444                });
3445            }
3446            // Copy from the buffer into the object.
3447            unsafe {
3448                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
3449            }
3450            Ok(())
3451        }
3452    }
3453
3454    impl fidl::encoding::ValueTypeMarker for WlantapPhySetChannelRequest {
3455        type Borrowed<'a> = &'a Self;
3456        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3457            value
3458        }
3459    }
3460
3461    unsafe impl fidl::encoding::TypeMarker for WlantapPhySetChannelRequest {
3462        type Owned = Self;
3463
3464        #[inline(always)]
3465        fn inline_align(_context: fidl::encoding::Context) -> usize {
3466            4
3467        }
3468
3469        #[inline(always)]
3470        fn inline_size(_context: fidl::encoding::Context) -> usize {
3471            16
3472        }
3473    }
3474
3475    unsafe impl<D: fidl::encoding::ResourceDialect>
3476        fidl::encoding::Encode<WlantapPhySetChannelRequest, D> for &WlantapPhySetChannelRequest
3477    {
3478        #[inline]
3479        unsafe fn encode(
3480            self,
3481            encoder: &mut fidl::encoding::Encoder<'_, D>,
3482            offset: usize,
3483            _depth: fidl::encoding::Depth,
3484        ) -> fidl::Result<()> {
3485            encoder.debug_check_bounds::<WlantapPhySetChannelRequest>(offset);
3486            // Delegate to tuple encoding.
3487            fidl::encoding::Encode::<WlantapPhySetChannelRequest, D>::encode(
3488                (<SetChannelArgs as fidl::encoding::ValueTypeMarker>::borrow(&self.args),),
3489                encoder,
3490                offset,
3491                _depth,
3492            )
3493        }
3494    }
3495    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<SetChannelArgs, D>>
3496        fidl::encoding::Encode<WlantapPhySetChannelRequest, D> for (T0,)
3497    {
3498        #[inline]
3499        unsafe fn encode(
3500            self,
3501            encoder: &mut fidl::encoding::Encoder<'_, D>,
3502            offset: usize,
3503            depth: fidl::encoding::Depth,
3504        ) -> fidl::Result<()> {
3505            encoder.debug_check_bounds::<WlantapPhySetChannelRequest>(offset);
3506            // Zero out padding regions. There's no need to apply masks
3507            // because the unmasked parts will be overwritten by fields.
3508            // Write the fields.
3509            self.0.encode(encoder, offset + 0, depth)?;
3510            Ok(())
3511        }
3512    }
3513
3514    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3515        for WlantapPhySetChannelRequest
3516    {
3517        #[inline(always)]
3518        fn new_empty() -> Self {
3519            Self { args: fidl::new_empty!(SetChannelArgs, D) }
3520        }
3521
3522        #[inline]
3523        unsafe fn decode(
3524            &mut self,
3525            decoder: &mut fidl::encoding::Decoder<'_, D>,
3526            offset: usize,
3527            _depth: fidl::encoding::Depth,
3528        ) -> fidl::Result<()> {
3529            decoder.debug_check_bounds::<Self>(offset);
3530            // Verify that padding bytes are zero.
3531            fidl::decode!(SetChannelArgs, D, &mut self.args, decoder, offset + 0, _depth)?;
3532            Ok(())
3533        }
3534    }
3535
3536    impl fidl::encoding::ValueTypeMarker for WlantapPhySetCountryRequest {
3537        type Borrowed<'a> = &'a Self;
3538        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3539            value
3540        }
3541    }
3542
3543    unsafe impl fidl::encoding::TypeMarker for WlantapPhySetCountryRequest {
3544        type Owned = Self;
3545
3546        #[inline(always)]
3547        fn inline_align(_context: fidl::encoding::Context) -> usize {
3548            1
3549        }
3550
3551        #[inline(always)]
3552        fn inline_size(_context: fidl::encoding::Context) -> usize {
3553            2
3554        }
3555        #[inline(always)]
3556        fn encode_is_copy() -> bool {
3557            true
3558        }
3559
3560        #[inline(always)]
3561        fn decode_is_copy() -> bool {
3562            true
3563        }
3564    }
3565
3566    unsafe impl<D: fidl::encoding::ResourceDialect>
3567        fidl::encoding::Encode<WlantapPhySetCountryRequest, D> for &WlantapPhySetCountryRequest
3568    {
3569        #[inline]
3570        unsafe fn encode(
3571            self,
3572            encoder: &mut fidl::encoding::Encoder<'_, D>,
3573            offset: usize,
3574            _depth: fidl::encoding::Depth,
3575        ) -> fidl::Result<()> {
3576            encoder.debug_check_bounds::<WlantapPhySetCountryRequest>(offset);
3577            unsafe {
3578                // Copy the object into the buffer.
3579                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3580                (buf_ptr as *mut WlantapPhySetCountryRequest)
3581                    .write_unaligned((self as *const WlantapPhySetCountryRequest).read());
3582                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3583                // done second because the memcpy will write garbage to these bytes.
3584            }
3585            Ok(())
3586        }
3587    }
3588    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<SetCountryArgs, D>>
3589        fidl::encoding::Encode<WlantapPhySetCountryRequest, D> for (T0,)
3590    {
3591        #[inline]
3592        unsafe fn encode(
3593            self,
3594            encoder: &mut fidl::encoding::Encoder<'_, D>,
3595            offset: usize,
3596            depth: fidl::encoding::Depth,
3597        ) -> fidl::Result<()> {
3598            encoder.debug_check_bounds::<WlantapPhySetCountryRequest>(offset);
3599            // Zero out padding regions. There's no need to apply masks
3600            // because the unmasked parts will be overwritten by fields.
3601            // Write the fields.
3602            self.0.encode(encoder, offset + 0, depth)?;
3603            Ok(())
3604        }
3605    }
3606
3607    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3608        for WlantapPhySetCountryRequest
3609    {
3610        #[inline(always)]
3611        fn new_empty() -> Self {
3612            Self { args: fidl::new_empty!(SetCountryArgs, D) }
3613        }
3614
3615        #[inline]
3616        unsafe fn decode(
3617            &mut self,
3618            decoder: &mut fidl::encoding::Decoder<'_, D>,
3619            offset: usize,
3620            _depth: fidl::encoding::Depth,
3621        ) -> fidl::Result<()> {
3622            decoder.debug_check_bounds::<Self>(offset);
3623            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3624            // Verify that padding bytes are zero.
3625            // Copy from the buffer into the object.
3626            unsafe {
3627                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 2);
3628            }
3629            Ok(())
3630        }
3631    }
3632
3633    impl fidl::encoding::ValueTypeMarker for WlantapPhySetKeyRequest {
3634        type Borrowed<'a> = &'a Self;
3635        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3636            value
3637        }
3638    }
3639
3640    unsafe impl fidl::encoding::TypeMarker for WlantapPhySetKeyRequest {
3641        type Owned = Self;
3642
3643        #[inline(always)]
3644        fn inline_align(_context: fidl::encoding::Context) -> usize {
3645            8
3646        }
3647
3648        #[inline(always)]
3649        fn inline_size(_context: fidl::encoding::Context) -> usize {
3650            40
3651        }
3652    }
3653
3654    unsafe impl<D: fidl::encoding::ResourceDialect>
3655        fidl::encoding::Encode<WlantapPhySetKeyRequest, D> for &WlantapPhySetKeyRequest
3656    {
3657        #[inline]
3658        unsafe fn encode(
3659            self,
3660            encoder: &mut fidl::encoding::Encoder<'_, D>,
3661            offset: usize,
3662            _depth: fidl::encoding::Depth,
3663        ) -> fidl::Result<()> {
3664            encoder.debug_check_bounds::<WlantapPhySetKeyRequest>(offset);
3665            // Delegate to tuple encoding.
3666            fidl::encoding::Encode::<WlantapPhySetKeyRequest, D>::encode(
3667                (<SetKeyArgs as fidl::encoding::ValueTypeMarker>::borrow(&self.args),),
3668                encoder,
3669                offset,
3670                _depth,
3671            )
3672        }
3673    }
3674    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<SetKeyArgs, D>>
3675        fidl::encoding::Encode<WlantapPhySetKeyRequest, D> for (T0,)
3676    {
3677        #[inline]
3678        unsafe fn encode(
3679            self,
3680            encoder: &mut fidl::encoding::Encoder<'_, D>,
3681            offset: usize,
3682            depth: fidl::encoding::Depth,
3683        ) -> fidl::Result<()> {
3684            encoder.debug_check_bounds::<WlantapPhySetKeyRequest>(offset);
3685            // Zero out padding regions. There's no need to apply masks
3686            // because the unmasked parts will be overwritten by fields.
3687            // Write the fields.
3688            self.0.encode(encoder, offset + 0, depth)?;
3689            Ok(())
3690        }
3691    }
3692
3693    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3694        for WlantapPhySetKeyRequest
3695    {
3696        #[inline(always)]
3697        fn new_empty() -> Self {
3698            Self { args: fidl::new_empty!(SetKeyArgs, D) }
3699        }
3700
3701        #[inline]
3702        unsafe fn decode(
3703            &mut self,
3704            decoder: &mut fidl::encoding::Decoder<'_, D>,
3705            offset: usize,
3706            _depth: fidl::encoding::Depth,
3707        ) -> fidl::Result<()> {
3708            decoder.debug_check_bounds::<Self>(offset);
3709            // Verify that padding bytes are zero.
3710            fidl::decode!(SetKeyArgs, D, &mut self.args, decoder, offset + 0, _depth)?;
3711            Ok(())
3712        }
3713    }
3714
3715    impl fidl::encoding::ValueTypeMarker for WlantapPhyStartScanRequest {
3716        type Borrowed<'a> = &'a Self;
3717        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3718            value
3719        }
3720    }
3721
3722    unsafe impl fidl::encoding::TypeMarker for WlantapPhyStartScanRequest {
3723        type Owned = Self;
3724
3725        #[inline(always)]
3726        fn inline_align(_context: fidl::encoding::Context) -> usize {
3727            8
3728        }
3729
3730        #[inline(always)]
3731        fn inline_size(_context: fidl::encoding::Context) -> usize {
3732            16
3733        }
3734    }
3735
3736    unsafe impl<D: fidl::encoding::ResourceDialect>
3737        fidl::encoding::Encode<WlantapPhyStartScanRequest, D> for &WlantapPhyStartScanRequest
3738    {
3739        #[inline]
3740        unsafe fn encode(
3741            self,
3742            encoder: &mut fidl::encoding::Encoder<'_, D>,
3743            offset: usize,
3744            _depth: fidl::encoding::Depth,
3745        ) -> fidl::Result<()> {
3746            encoder.debug_check_bounds::<WlantapPhyStartScanRequest>(offset);
3747            unsafe {
3748                // Copy the object into the buffer.
3749                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3750                (buf_ptr as *mut WlantapPhyStartScanRequest)
3751                    .write_unaligned((self as *const WlantapPhyStartScanRequest).read());
3752                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3753                // done second because the memcpy will write garbage to these bytes.
3754                let padding_ptr = buf_ptr.offset(0) as *mut u64;
3755                let padding_mask = 0xffffffffffff0000u64;
3756                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
3757            }
3758            Ok(())
3759        }
3760    }
3761    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<StartScanArgs, D>>
3762        fidl::encoding::Encode<WlantapPhyStartScanRequest, D> for (T0,)
3763    {
3764        #[inline]
3765        unsafe fn encode(
3766            self,
3767            encoder: &mut fidl::encoding::Encoder<'_, D>,
3768            offset: usize,
3769            depth: fidl::encoding::Depth,
3770        ) -> fidl::Result<()> {
3771            encoder.debug_check_bounds::<WlantapPhyStartScanRequest>(offset);
3772            // Zero out padding regions. There's no need to apply masks
3773            // because the unmasked parts will be overwritten by fields.
3774            // Write the fields.
3775            self.0.encode(encoder, offset + 0, depth)?;
3776            Ok(())
3777        }
3778    }
3779
3780    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3781        for WlantapPhyStartScanRequest
3782    {
3783        #[inline(always)]
3784        fn new_empty() -> Self {
3785            Self { args: fidl::new_empty!(StartScanArgs, D) }
3786        }
3787
3788        #[inline]
3789        unsafe fn decode(
3790            &mut self,
3791            decoder: &mut fidl::encoding::Decoder<'_, D>,
3792            offset: usize,
3793            _depth: fidl::encoding::Depth,
3794        ) -> fidl::Result<()> {
3795            decoder.debug_check_bounds::<Self>(offset);
3796            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3797            // Verify that padding bytes are zero.
3798            let ptr = unsafe { buf_ptr.offset(0) };
3799            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3800            let mask = 0xffffffffffff0000u64;
3801            let maskedval = padval & mask;
3802            if maskedval != 0 {
3803                return Err(fidl::Error::NonZeroPadding {
3804                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3805                });
3806            }
3807            // Copy from the buffer into the object.
3808            unsafe {
3809                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
3810            }
3811            Ok(())
3812        }
3813    }
3814
3815    impl fidl::encoding::ValueTypeMarker for WlantapPhyTxRequest {
3816        type Borrowed<'a> = &'a Self;
3817        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3818            value
3819        }
3820    }
3821
3822    unsafe impl fidl::encoding::TypeMarker for WlantapPhyTxRequest {
3823        type Owned = Self;
3824
3825        #[inline(always)]
3826        fn inline_align(_context: fidl::encoding::Context) -> usize {
3827            8
3828        }
3829
3830        #[inline(always)]
3831        fn inline_size(_context: fidl::encoding::Context) -> usize {
3832            48
3833        }
3834    }
3835
3836    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WlantapPhyTxRequest, D>
3837        for &WlantapPhyTxRequest
3838    {
3839        #[inline]
3840        unsafe fn encode(
3841            self,
3842            encoder: &mut fidl::encoding::Encoder<'_, D>,
3843            offset: usize,
3844            _depth: fidl::encoding::Depth,
3845        ) -> fidl::Result<()> {
3846            encoder.debug_check_bounds::<WlantapPhyTxRequest>(offset);
3847            // Delegate to tuple encoding.
3848            fidl::encoding::Encode::<WlantapPhyTxRequest, D>::encode(
3849                (<TxArgs as fidl::encoding::ValueTypeMarker>::borrow(&self.args),),
3850                encoder,
3851                offset,
3852                _depth,
3853            )
3854        }
3855    }
3856    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<TxArgs, D>>
3857        fidl::encoding::Encode<WlantapPhyTxRequest, D> for (T0,)
3858    {
3859        #[inline]
3860        unsafe fn encode(
3861            self,
3862            encoder: &mut fidl::encoding::Encoder<'_, D>,
3863            offset: usize,
3864            depth: fidl::encoding::Depth,
3865        ) -> fidl::Result<()> {
3866            encoder.debug_check_bounds::<WlantapPhyTxRequest>(offset);
3867            // Zero out padding regions. There's no need to apply masks
3868            // because the unmasked parts will be overwritten by fields.
3869            // Write the fields.
3870            self.0.encode(encoder, offset + 0, depth)?;
3871            Ok(())
3872        }
3873    }
3874
3875    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WlantapPhyTxRequest {
3876        #[inline(always)]
3877        fn new_empty() -> Self {
3878            Self { args: fidl::new_empty!(TxArgs, D) }
3879        }
3880
3881        #[inline]
3882        unsafe fn decode(
3883            &mut self,
3884            decoder: &mut fidl::encoding::Decoder<'_, D>,
3885            offset: usize,
3886            _depth: fidl::encoding::Depth,
3887        ) -> fidl::Result<()> {
3888            decoder.debug_check_bounds::<Self>(offset);
3889            // Verify that padding bytes are zero.
3890            fidl::decode!(TxArgs, D, &mut self.args, decoder, offset + 0, _depth)?;
3891            Ok(())
3892        }
3893    }
3894}