1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_wlan_tap__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct WlantapCtlCreatePhyRequest {
16 pub config: WlantapPhyConfig,
17 pub proxy: fidl::endpoints::ServerEnd<WlantapPhyMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for WlantapCtlCreatePhyRequest
22{
23}
24
25#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
26pub struct WlantapCtlMarker;
27
28impl fidl::endpoints::ProtocolMarker for WlantapCtlMarker {
29 type Proxy = WlantapCtlProxy;
30 type RequestStream = WlantapCtlRequestStream;
31 #[cfg(target_os = "fuchsia")]
32 type SynchronousProxy = WlantapCtlSynchronousProxy;
33
34 const DEBUG_NAME: &'static str = "(anonymous) WlantapCtl";
35}
36
37pub trait WlantapCtlProxyInterface: Send + Sync {
38 type CreatePhyResponseFut: std::future::Future<Output = Result<i32, fidl::Error>> + Send;
39 fn r#create_phy(
40 &self,
41 config: &WlantapPhyConfig,
42 proxy: fidl::endpoints::ServerEnd<WlantapPhyMarker>,
43 ) -> Self::CreatePhyResponseFut;
44}
45#[derive(Debug)]
46#[cfg(target_os = "fuchsia")]
47pub struct WlantapCtlSynchronousProxy {
48 client: fidl::client::sync::Client,
49}
50
51#[cfg(target_os = "fuchsia")]
52impl fidl::endpoints::SynchronousProxy for WlantapCtlSynchronousProxy {
53 type Proxy = WlantapCtlProxy;
54 type Protocol = WlantapCtlMarker;
55
56 fn from_channel(inner: fidl::Channel) -> Self {
57 Self::new(inner)
58 }
59
60 fn into_channel(self) -> fidl::Channel {
61 self.client.into_channel()
62 }
63
64 fn as_channel(&self) -> &fidl::Channel {
65 self.client.as_channel()
66 }
67}
68
69#[cfg(target_os = "fuchsia")]
70impl WlantapCtlSynchronousProxy {
71 pub fn new(channel: fidl::Channel) -> Self {
72 let protocol_name = <WlantapCtlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
73 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
74 }
75
76 pub fn into_channel(self) -> fidl::Channel {
77 self.client.into_channel()
78 }
79
80 pub fn wait_for_event(
83 &self,
84 deadline: zx::MonotonicInstant,
85 ) -> Result<WlantapCtlEvent, fidl::Error> {
86 WlantapCtlEvent::decode(self.client.wait_for_event(deadline)?)
87 }
88
89 pub fn r#create_phy(
90 &self,
91 mut config: &WlantapPhyConfig,
92 mut proxy: fidl::endpoints::ServerEnd<WlantapPhyMarker>,
93 ___deadline: zx::MonotonicInstant,
94 ) -> Result<i32, fidl::Error> {
95 let _response =
96 self.client.send_query::<WlantapCtlCreatePhyRequest, WlantapCtlCreatePhyResponse>(
97 (config, proxy),
98 0x50273d8f10ceb35d,
99 fidl::encoding::DynamicFlags::empty(),
100 ___deadline,
101 )?;
102 Ok(_response.status)
103 }
104}
105
106#[cfg(target_os = "fuchsia")]
107impl From<WlantapCtlSynchronousProxy> for zx::Handle {
108 fn from(value: WlantapCtlSynchronousProxy) -> Self {
109 value.into_channel().into()
110 }
111}
112
113#[cfg(target_os = "fuchsia")]
114impl From<fidl::Channel> for WlantapCtlSynchronousProxy {
115 fn from(value: fidl::Channel) -> Self {
116 Self::new(value)
117 }
118}
119
120#[cfg(target_os = "fuchsia")]
121impl fidl::endpoints::FromClient for WlantapCtlSynchronousProxy {
122 type Protocol = WlantapCtlMarker;
123
124 fn from_client(value: fidl::endpoints::ClientEnd<WlantapCtlMarker>) -> Self {
125 Self::new(value.into_channel())
126 }
127}
128
129#[derive(Debug, Clone)]
130pub struct WlantapCtlProxy {
131 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
132}
133
134impl fidl::endpoints::Proxy for WlantapCtlProxy {
135 type Protocol = WlantapCtlMarker;
136
137 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
138 Self::new(inner)
139 }
140
141 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
142 self.client.into_channel().map_err(|client| Self { client })
143 }
144
145 fn as_channel(&self) -> &::fidl::AsyncChannel {
146 self.client.as_channel()
147 }
148}
149
150impl WlantapCtlProxy {
151 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
153 let protocol_name = <WlantapCtlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
154 Self { client: fidl::client::Client::new(channel, protocol_name) }
155 }
156
157 pub fn take_event_stream(&self) -> WlantapCtlEventStream {
163 WlantapCtlEventStream { event_receiver: self.client.take_event_receiver() }
164 }
165
166 pub fn r#create_phy(
167 &self,
168 mut config: &WlantapPhyConfig,
169 mut proxy: fidl::endpoints::ServerEnd<WlantapPhyMarker>,
170 ) -> fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect> {
171 WlantapCtlProxyInterface::r#create_phy(self, config, proxy)
172 }
173}
174
175impl WlantapCtlProxyInterface for WlantapCtlProxy {
176 type CreatePhyResponseFut =
177 fidl::client::QueryResponseFut<i32, fidl::encoding::DefaultFuchsiaResourceDialect>;
178 fn r#create_phy(
179 &self,
180 mut config: &WlantapPhyConfig,
181 mut proxy: fidl::endpoints::ServerEnd<WlantapPhyMarker>,
182 ) -> Self::CreatePhyResponseFut {
183 fn _decode(
184 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
185 ) -> Result<i32, fidl::Error> {
186 let _response = fidl::client::decode_transaction_body::<
187 WlantapCtlCreatePhyResponse,
188 fidl::encoding::DefaultFuchsiaResourceDialect,
189 0x50273d8f10ceb35d,
190 >(_buf?)?;
191 Ok(_response.status)
192 }
193 self.client.send_query_and_decode::<WlantapCtlCreatePhyRequest, i32>(
194 (config, proxy),
195 0x50273d8f10ceb35d,
196 fidl::encoding::DynamicFlags::empty(),
197 _decode,
198 )
199 }
200}
201
202pub struct WlantapCtlEventStream {
203 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
204}
205
206impl std::marker::Unpin for WlantapCtlEventStream {}
207
208impl futures::stream::FusedStream for WlantapCtlEventStream {
209 fn is_terminated(&self) -> bool {
210 self.event_receiver.is_terminated()
211 }
212}
213
214impl futures::Stream for WlantapCtlEventStream {
215 type Item = Result<WlantapCtlEvent, fidl::Error>;
216
217 fn poll_next(
218 mut self: std::pin::Pin<&mut Self>,
219 cx: &mut std::task::Context<'_>,
220 ) -> std::task::Poll<Option<Self::Item>> {
221 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
222 &mut self.event_receiver,
223 cx
224 )?) {
225 Some(buf) => std::task::Poll::Ready(Some(WlantapCtlEvent::decode(buf))),
226 None => std::task::Poll::Ready(None),
227 }
228 }
229}
230
231#[derive(Debug)]
232pub enum WlantapCtlEvent {}
233
234impl WlantapCtlEvent {
235 fn decode(
237 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
238 ) -> Result<WlantapCtlEvent, fidl::Error> {
239 let (bytes, _handles) = buf.split_mut();
240 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
241 debug_assert_eq!(tx_header.tx_id, 0);
242 match tx_header.ordinal {
243 _ => Err(fidl::Error::UnknownOrdinal {
244 ordinal: tx_header.ordinal,
245 protocol_name: <WlantapCtlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
246 }),
247 }
248 }
249}
250
251pub struct WlantapCtlRequestStream {
253 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
254 is_terminated: bool,
255}
256
257impl std::marker::Unpin for WlantapCtlRequestStream {}
258
259impl futures::stream::FusedStream for WlantapCtlRequestStream {
260 fn is_terminated(&self) -> bool {
261 self.is_terminated
262 }
263}
264
265impl fidl::endpoints::RequestStream for WlantapCtlRequestStream {
266 type Protocol = WlantapCtlMarker;
267 type ControlHandle = WlantapCtlControlHandle;
268
269 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
270 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
271 }
272
273 fn control_handle(&self) -> Self::ControlHandle {
274 WlantapCtlControlHandle { inner: self.inner.clone() }
275 }
276
277 fn into_inner(
278 self,
279 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
280 {
281 (self.inner, self.is_terminated)
282 }
283
284 fn from_inner(
285 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
286 is_terminated: bool,
287 ) -> Self {
288 Self { inner, is_terminated }
289 }
290}
291
292impl futures::Stream for WlantapCtlRequestStream {
293 type Item = Result<WlantapCtlRequest, fidl::Error>;
294
295 fn poll_next(
296 mut self: std::pin::Pin<&mut Self>,
297 cx: &mut std::task::Context<'_>,
298 ) -> std::task::Poll<Option<Self::Item>> {
299 let this = &mut *self;
300 if this.inner.check_shutdown(cx) {
301 this.is_terminated = true;
302 return std::task::Poll::Ready(None);
303 }
304 if this.is_terminated {
305 panic!("polled WlantapCtlRequestStream after completion");
306 }
307 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
308 |bytes, handles| {
309 match this.inner.channel().read_etc(cx, bytes, handles) {
310 std::task::Poll::Ready(Ok(())) => {}
311 std::task::Poll::Pending => return std::task::Poll::Pending,
312 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
313 this.is_terminated = true;
314 return std::task::Poll::Ready(None);
315 }
316 std::task::Poll::Ready(Err(e)) => {
317 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
318 e.into(),
319 ))));
320 }
321 }
322
323 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
325
326 std::task::Poll::Ready(Some(match header.ordinal {
327 0x50273d8f10ceb35d => {
328 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
329 let mut req = fidl::new_empty!(
330 WlantapCtlCreatePhyRequest,
331 fidl::encoding::DefaultFuchsiaResourceDialect
332 );
333 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlantapCtlCreatePhyRequest>(&header, _body_bytes, handles, &mut req)?;
334 let control_handle = WlantapCtlControlHandle { inner: this.inner.clone() };
335 Ok(WlantapCtlRequest::CreatePhy {
336 config: req.config,
337 proxy: req.proxy,
338
339 responder: WlantapCtlCreatePhyResponder {
340 control_handle: std::mem::ManuallyDrop::new(control_handle),
341 tx_id: header.tx_id,
342 },
343 })
344 }
345 _ => Err(fidl::Error::UnknownOrdinal {
346 ordinal: header.ordinal,
347 protocol_name:
348 <WlantapCtlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
349 }),
350 }))
351 },
352 )
353 }
354}
355
356#[derive(Debug)]
360pub enum WlantapCtlRequest {
361 CreatePhy {
362 config: WlantapPhyConfig,
363 proxy: fidl::endpoints::ServerEnd<WlantapPhyMarker>,
364 responder: WlantapCtlCreatePhyResponder,
365 },
366}
367
368impl WlantapCtlRequest {
369 #[allow(irrefutable_let_patterns)]
370 pub fn into_create_phy(
371 self,
372 ) -> Option<(
373 WlantapPhyConfig,
374 fidl::endpoints::ServerEnd<WlantapPhyMarker>,
375 WlantapCtlCreatePhyResponder,
376 )> {
377 if let WlantapCtlRequest::CreatePhy { config, proxy, responder } = self {
378 Some((config, proxy, responder))
379 } else {
380 None
381 }
382 }
383
384 pub fn method_name(&self) -> &'static str {
386 match *self {
387 WlantapCtlRequest::CreatePhy { .. } => "create_phy",
388 }
389 }
390}
391
392#[derive(Debug, Clone)]
393pub struct WlantapCtlControlHandle {
394 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
395}
396
397impl fidl::endpoints::ControlHandle for WlantapCtlControlHandle {
398 fn shutdown(&self) {
399 self.inner.shutdown()
400 }
401 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
402 self.inner.shutdown_with_epitaph(status)
403 }
404
405 fn is_closed(&self) -> bool {
406 self.inner.channel().is_closed()
407 }
408 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
409 self.inner.channel().on_closed()
410 }
411
412 #[cfg(target_os = "fuchsia")]
413 fn signal_peer(
414 &self,
415 clear_mask: zx::Signals,
416 set_mask: zx::Signals,
417 ) -> Result<(), zx_status::Status> {
418 use fidl::Peered;
419 self.inner.channel().signal_peer(clear_mask, set_mask)
420 }
421}
422
423impl WlantapCtlControlHandle {}
424
425#[must_use = "FIDL methods require a response to be sent"]
426#[derive(Debug)]
427pub struct WlantapCtlCreatePhyResponder {
428 control_handle: std::mem::ManuallyDrop<WlantapCtlControlHandle>,
429 tx_id: u32,
430}
431
432impl std::ops::Drop for WlantapCtlCreatePhyResponder {
436 fn drop(&mut self) {
437 self.control_handle.shutdown();
438 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
440 }
441}
442
443impl fidl::endpoints::Responder for WlantapCtlCreatePhyResponder {
444 type ControlHandle = WlantapCtlControlHandle;
445
446 fn control_handle(&self) -> &WlantapCtlControlHandle {
447 &self.control_handle
448 }
449
450 fn drop_without_shutdown(mut self) {
451 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
453 std::mem::forget(self);
455 }
456}
457
458impl WlantapCtlCreatePhyResponder {
459 pub fn send(self, mut status: i32) -> Result<(), fidl::Error> {
463 let _result = self.send_raw(status);
464 if _result.is_err() {
465 self.control_handle.shutdown();
466 }
467 self.drop_without_shutdown();
468 _result
469 }
470
471 pub fn send_no_shutdown_on_err(self, mut status: i32) -> Result<(), fidl::Error> {
473 let _result = self.send_raw(status);
474 self.drop_without_shutdown();
475 _result
476 }
477
478 fn send_raw(&self, mut status: i32) -> Result<(), fidl::Error> {
479 self.control_handle.inner.send::<WlantapCtlCreatePhyResponse>(
480 (status,),
481 self.tx_id,
482 0x50273d8f10ceb35d,
483 fidl::encoding::DynamicFlags::empty(),
484 )
485 }
486}
487
488#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
489pub struct WlantapPhyMarker;
490
491impl fidl::endpoints::ProtocolMarker for WlantapPhyMarker {
492 type Proxy = WlantapPhyProxy;
493 type RequestStream = WlantapPhyRequestStream;
494 #[cfg(target_os = "fuchsia")]
495 type SynchronousProxy = WlantapPhySynchronousProxy;
496
497 const DEBUG_NAME: &'static str = "(anonymous) WlantapPhy";
498}
499
500pub trait WlantapPhyProxyInterface: Send + Sync {
501 type ShutdownResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
502 fn r#shutdown(&self) -> Self::ShutdownResponseFut;
503 fn r#rx(&self, data: &[u8], info: &WlanRxInfo) -> Result<(), fidl::Error>;
504 fn r#report_tx_result(
505 &self,
506 txr: &fidl_fuchsia_wlan_common::WlanTxResult,
507 ) -> Result<(), fidl::Error>;
508 fn r#scan_complete(&self, scan_id: u64, status: i32) -> Result<(), fidl::Error>;
509}
510#[derive(Debug)]
511#[cfg(target_os = "fuchsia")]
512pub struct WlantapPhySynchronousProxy {
513 client: fidl::client::sync::Client,
514}
515
516#[cfg(target_os = "fuchsia")]
517impl fidl::endpoints::SynchronousProxy for WlantapPhySynchronousProxy {
518 type Proxy = WlantapPhyProxy;
519 type Protocol = WlantapPhyMarker;
520
521 fn from_channel(inner: fidl::Channel) -> Self {
522 Self::new(inner)
523 }
524
525 fn into_channel(self) -> fidl::Channel {
526 self.client.into_channel()
527 }
528
529 fn as_channel(&self) -> &fidl::Channel {
530 self.client.as_channel()
531 }
532}
533
534#[cfg(target_os = "fuchsia")]
535impl WlantapPhySynchronousProxy {
536 pub fn new(channel: fidl::Channel) -> Self {
537 let protocol_name = <WlantapPhyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
538 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
539 }
540
541 pub fn into_channel(self) -> fidl::Channel {
542 self.client.into_channel()
543 }
544
545 pub fn wait_for_event(
548 &self,
549 deadline: zx::MonotonicInstant,
550 ) -> Result<WlantapPhyEvent, fidl::Error> {
551 WlantapPhyEvent::decode(self.client.wait_for_event(deadline)?)
552 }
553
554 pub fn r#shutdown(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
558 let _response =
559 self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
560 (),
561 0x1df8087c49fa9a5e,
562 fidl::encoding::DynamicFlags::empty(),
563 ___deadline,
564 )?;
565 Ok(_response)
566 }
567
568 pub fn r#rx(&self, mut data: &[u8], mut info: &WlanRxInfo) -> Result<(), fidl::Error> {
570 self.client.send::<WlantapPhyRxRequest>(
571 (data, info),
572 0x165a656419ab3b41,
573 fidl::encoding::DynamicFlags::empty(),
574 )
575 }
576
577 pub fn r#report_tx_result(
580 &self,
581 mut txr: &fidl_fuchsia_wlan_common::WlanTxResult,
582 ) -> Result<(), fidl::Error> {
583 self.client.send::<WlantapPhyReportTxResultRequest>(
584 (txr,),
585 0x2c27ed678c1e7eb4,
586 fidl::encoding::DynamicFlags::empty(),
587 )
588 }
589
590 pub fn r#scan_complete(&self, mut scan_id: u64, mut status: i32) -> Result<(), fidl::Error> {
591 self.client.send::<WlantapPhyScanCompleteRequest>(
592 (scan_id, status),
593 0x61a579015cff7674,
594 fidl::encoding::DynamicFlags::empty(),
595 )
596 }
597}
598
599#[cfg(target_os = "fuchsia")]
600impl From<WlantapPhySynchronousProxy> for zx::Handle {
601 fn from(value: WlantapPhySynchronousProxy) -> Self {
602 value.into_channel().into()
603 }
604}
605
606#[cfg(target_os = "fuchsia")]
607impl From<fidl::Channel> for WlantapPhySynchronousProxy {
608 fn from(value: fidl::Channel) -> Self {
609 Self::new(value)
610 }
611}
612
613#[cfg(target_os = "fuchsia")]
614impl fidl::endpoints::FromClient for WlantapPhySynchronousProxy {
615 type Protocol = WlantapPhyMarker;
616
617 fn from_client(value: fidl::endpoints::ClientEnd<WlantapPhyMarker>) -> Self {
618 Self::new(value.into_channel())
619 }
620}
621
622#[derive(Debug, Clone)]
623pub struct WlantapPhyProxy {
624 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
625}
626
627impl fidl::endpoints::Proxy for WlantapPhyProxy {
628 type Protocol = WlantapPhyMarker;
629
630 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
631 Self::new(inner)
632 }
633
634 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
635 self.client.into_channel().map_err(|client| Self { client })
636 }
637
638 fn as_channel(&self) -> &::fidl::AsyncChannel {
639 self.client.as_channel()
640 }
641}
642
643impl WlantapPhyProxy {
644 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
646 let protocol_name = <WlantapPhyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
647 Self { client: fidl::client::Client::new(channel, protocol_name) }
648 }
649
650 pub fn take_event_stream(&self) -> WlantapPhyEventStream {
656 WlantapPhyEventStream { event_receiver: self.client.take_event_receiver() }
657 }
658
659 pub fn r#shutdown(
663 &self,
664 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
665 WlantapPhyProxyInterface::r#shutdown(self)
666 }
667
668 pub fn r#rx(&self, mut data: &[u8], mut info: &WlanRxInfo) -> Result<(), fidl::Error> {
670 WlantapPhyProxyInterface::r#rx(self, data, info)
671 }
672
673 pub fn r#report_tx_result(
676 &self,
677 mut txr: &fidl_fuchsia_wlan_common::WlanTxResult,
678 ) -> Result<(), fidl::Error> {
679 WlantapPhyProxyInterface::r#report_tx_result(self, txr)
680 }
681
682 pub fn r#scan_complete(&self, mut scan_id: u64, mut status: i32) -> Result<(), fidl::Error> {
683 WlantapPhyProxyInterface::r#scan_complete(self, scan_id, status)
684 }
685}
686
687impl WlantapPhyProxyInterface for WlantapPhyProxy {
688 type ShutdownResponseFut =
689 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
690 fn r#shutdown(&self) -> Self::ShutdownResponseFut {
691 fn _decode(
692 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
693 ) -> Result<(), fidl::Error> {
694 let _response = fidl::client::decode_transaction_body::<
695 fidl::encoding::EmptyPayload,
696 fidl::encoding::DefaultFuchsiaResourceDialect,
697 0x1df8087c49fa9a5e,
698 >(_buf?)?;
699 Ok(_response)
700 }
701 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
702 (),
703 0x1df8087c49fa9a5e,
704 fidl::encoding::DynamicFlags::empty(),
705 _decode,
706 )
707 }
708
709 fn r#rx(&self, mut data: &[u8], mut info: &WlanRxInfo) -> Result<(), fidl::Error> {
710 self.client.send::<WlantapPhyRxRequest>(
711 (data, info),
712 0x165a656419ab3b41,
713 fidl::encoding::DynamicFlags::empty(),
714 )
715 }
716
717 fn r#report_tx_result(
718 &self,
719 mut txr: &fidl_fuchsia_wlan_common::WlanTxResult,
720 ) -> Result<(), fidl::Error> {
721 self.client.send::<WlantapPhyReportTxResultRequest>(
722 (txr,),
723 0x2c27ed678c1e7eb4,
724 fidl::encoding::DynamicFlags::empty(),
725 )
726 }
727
728 fn r#scan_complete(&self, mut scan_id: u64, mut status: i32) -> Result<(), fidl::Error> {
729 self.client.send::<WlantapPhyScanCompleteRequest>(
730 (scan_id, status),
731 0x61a579015cff7674,
732 fidl::encoding::DynamicFlags::empty(),
733 )
734 }
735}
736
737pub struct WlantapPhyEventStream {
738 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
739}
740
741impl std::marker::Unpin for WlantapPhyEventStream {}
742
743impl futures::stream::FusedStream for WlantapPhyEventStream {
744 fn is_terminated(&self) -> bool {
745 self.event_receiver.is_terminated()
746 }
747}
748
749impl futures::Stream for WlantapPhyEventStream {
750 type Item = Result<WlantapPhyEvent, fidl::Error>;
751
752 fn poll_next(
753 mut self: std::pin::Pin<&mut Self>,
754 cx: &mut std::task::Context<'_>,
755 ) -> std::task::Poll<Option<Self::Item>> {
756 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
757 &mut self.event_receiver,
758 cx
759 )?) {
760 Some(buf) => std::task::Poll::Ready(Some(WlantapPhyEvent::decode(buf))),
761 None => std::task::Poll::Ready(None),
762 }
763 }
764}
765
766#[derive(Debug)]
767pub enum WlantapPhyEvent {
768 Tx { args: TxArgs },
769 WlanSoftmacStart {},
770 SetChannel { args: SetChannelArgs },
771 JoinBss { args: JoinBssArgs },
772 StartScan { args: StartScanArgs },
773 SetKey { args: SetKeyArgs },
774 SetCountry { args: SetCountryArgs },
775}
776
777impl WlantapPhyEvent {
778 #[allow(irrefutable_let_patterns)]
779 pub fn into_tx(self) -> Option<TxArgs> {
780 if let WlantapPhyEvent::Tx { args } = self { Some((args)) } else { None }
781 }
782 #[allow(irrefutable_let_patterns)]
783 pub fn into_wlan_softmac_start(self) -> Option<()> {
784 if let WlantapPhyEvent::WlanSoftmacStart {} = self { Some(()) } else { None }
785 }
786 #[allow(irrefutable_let_patterns)]
787 pub fn into_set_channel(self) -> Option<SetChannelArgs> {
788 if let WlantapPhyEvent::SetChannel { args } = self { Some((args)) } else { None }
789 }
790 #[allow(irrefutable_let_patterns)]
791 pub fn into_join_bss(self) -> Option<JoinBssArgs> {
792 if let WlantapPhyEvent::JoinBss { args } = self { Some((args)) } else { None }
793 }
794 #[allow(irrefutable_let_patterns)]
795 pub fn into_start_scan(self) -> Option<StartScanArgs> {
796 if let WlantapPhyEvent::StartScan { args } = self { Some((args)) } else { None }
797 }
798 #[allow(irrefutable_let_patterns)]
799 pub fn into_set_key(self) -> Option<SetKeyArgs> {
800 if let WlantapPhyEvent::SetKey { args } = self { Some((args)) } else { None }
801 }
802 #[allow(irrefutable_let_patterns)]
803 pub fn into_set_country(self) -> Option<SetCountryArgs> {
804 if let WlantapPhyEvent::SetCountry { args } = self { Some((args)) } else { None }
805 }
806
807 fn decode(
809 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
810 ) -> Result<WlantapPhyEvent, fidl::Error> {
811 let (bytes, _handles) = buf.split_mut();
812 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
813 debug_assert_eq!(tx_header.tx_id, 0);
814 match tx_header.ordinal {
815 0x3ccc6c207280b569 => {
816 let mut out = fidl::new_empty!(
817 WlantapPhyTxRequest,
818 fidl::encoding::DefaultFuchsiaResourceDialect
819 );
820 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlantapPhyTxRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
821 Ok((WlantapPhyEvent::Tx { args: out.args }))
822 }
823 0x328bcae20dec2b88 => {
824 let mut out = fidl::new_empty!(
825 fidl::encoding::EmptyPayload,
826 fidl::encoding::DefaultFuchsiaResourceDialect
827 );
828 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
829 Ok((WlantapPhyEvent::WlanSoftmacStart {}))
830 }
831 0x60eb9a607f96a948 => {
832 let mut out = fidl::new_empty!(
833 WlantapPhySetChannelRequest,
834 fidl::encoding::DefaultFuchsiaResourceDialect
835 );
836 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlantapPhySetChannelRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
837 Ok((WlantapPhyEvent::SetChannel { args: out.args }))
838 }
839 0xef930e871dbf2f9 => {
840 let mut out = fidl::new_empty!(
841 WlantapPhyJoinBssRequest,
842 fidl::encoding::DefaultFuchsiaResourceDialect
843 );
844 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlantapPhyJoinBssRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
845 Ok((WlantapPhyEvent::JoinBss { args: out.args }))
846 }
847 0x75ed87321e05cdbb => {
848 let mut out = fidl::new_empty!(
849 WlantapPhyStartScanRequest,
850 fidl::encoding::DefaultFuchsiaResourceDialect
851 );
852 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlantapPhyStartScanRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
853 Ok((WlantapPhyEvent::StartScan { args: out.args }))
854 }
855 0xff7bf591b026267 => {
856 let mut out = fidl::new_empty!(
857 WlantapPhySetKeyRequest,
858 fidl::encoding::DefaultFuchsiaResourceDialect
859 );
860 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlantapPhySetKeyRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
861 Ok((WlantapPhyEvent::SetKey { args: out.args }))
862 }
863 0x4cd2f84e3ccfcd14 => {
864 let mut out = fidl::new_empty!(
865 WlantapPhySetCountryRequest,
866 fidl::encoding::DefaultFuchsiaResourceDialect
867 );
868 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlantapPhySetCountryRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
869 Ok((WlantapPhyEvent::SetCountry { args: out.args }))
870 }
871 _ => Err(fidl::Error::UnknownOrdinal {
872 ordinal: tx_header.ordinal,
873 protocol_name: <WlantapPhyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
874 }),
875 }
876 }
877}
878
879pub struct WlantapPhyRequestStream {
881 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
882 is_terminated: bool,
883}
884
885impl std::marker::Unpin for WlantapPhyRequestStream {}
886
887impl futures::stream::FusedStream for WlantapPhyRequestStream {
888 fn is_terminated(&self) -> bool {
889 self.is_terminated
890 }
891}
892
893impl fidl::endpoints::RequestStream for WlantapPhyRequestStream {
894 type Protocol = WlantapPhyMarker;
895 type ControlHandle = WlantapPhyControlHandle;
896
897 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
898 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
899 }
900
901 fn control_handle(&self) -> Self::ControlHandle {
902 WlantapPhyControlHandle { inner: self.inner.clone() }
903 }
904
905 fn into_inner(
906 self,
907 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
908 {
909 (self.inner, self.is_terminated)
910 }
911
912 fn from_inner(
913 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
914 is_terminated: bool,
915 ) -> Self {
916 Self { inner, is_terminated }
917 }
918}
919
920impl futures::Stream for WlantapPhyRequestStream {
921 type Item = Result<WlantapPhyRequest, fidl::Error>;
922
923 fn poll_next(
924 mut self: std::pin::Pin<&mut Self>,
925 cx: &mut std::task::Context<'_>,
926 ) -> std::task::Poll<Option<Self::Item>> {
927 let this = &mut *self;
928 if this.inner.check_shutdown(cx) {
929 this.is_terminated = true;
930 return std::task::Poll::Ready(None);
931 }
932 if this.is_terminated {
933 panic!("polled WlantapPhyRequestStream after completion");
934 }
935 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
936 |bytes, handles| {
937 match this.inner.channel().read_etc(cx, bytes, handles) {
938 std::task::Poll::Ready(Ok(())) => {}
939 std::task::Poll::Pending => return std::task::Poll::Pending,
940 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
941 this.is_terminated = true;
942 return std::task::Poll::Ready(None);
943 }
944 std::task::Poll::Ready(Err(e)) => {
945 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
946 e.into(),
947 ))));
948 }
949 }
950
951 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
953
954 std::task::Poll::Ready(Some(match header.ordinal {
955 0x1df8087c49fa9a5e => {
956 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
957 let mut req = fidl::new_empty!(
958 fidl::encoding::EmptyPayload,
959 fidl::encoding::DefaultFuchsiaResourceDialect
960 );
961 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
962 let control_handle = WlantapPhyControlHandle { inner: this.inner.clone() };
963 Ok(WlantapPhyRequest::Shutdown {
964 responder: WlantapPhyShutdownResponder {
965 control_handle: std::mem::ManuallyDrop::new(control_handle),
966 tx_id: header.tx_id,
967 },
968 })
969 }
970 0x165a656419ab3b41 => {
971 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
972 let mut req = fidl::new_empty!(
973 WlantapPhyRxRequest,
974 fidl::encoding::DefaultFuchsiaResourceDialect
975 );
976 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlantapPhyRxRequest>(&header, _body_bytes, handles, &mut req)?;
977 let control_handle = WlantapPhyControlHandle { inner: this.inner.clone() };
978 Ok(WlantapPhyRequest::Rx { data: req.data, info: req.info, control_handle })
979 }
980 0x2c27ed678c1e7eb4 => {
981 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
982 let mut req = fidl::new_empty!(
983 WlantapPhyReportTxResultRequest,
984 fidl::encoding::DefaultFuchsiaResourceDialect
985 );
986 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlantapPhyReportTxResultRequest>(&header, _body_bytes, handles, &mut req)?;
987 let control_handle = WlantapPhyControlHandle { inner: this.inner.clone() };
988 Ok(WlantapPhyRequest::ReportTxResult { txr: req.txr, control_handle })
989 }
990 0x61a579015cff7674 => {
991 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
992 let mut req = fidl::new_empty!(
993 WlantapPhyScanCompleteRequest,
994 fidl::encoding::DefaultFuchsiaResourceDialect
995 );
996 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<WlantapPhyScanCompleteRequest>(&header, _body_bytes, handles, &mut req)?;
997 let control_handle = WlantapPhyControlHandle { inner: this.inner.clone() };
998 Ok(WlantapPhyRequest::ScanComplete {
999 scan_id: req.scan_id,
1000 status: req.status,
1001
1002 control_handle,
1003 })
1004 }
1005 _ => Err(fidl::Error::UnknownOrdinal {
1006 ordinal: header.ordinal,
1007 protocol_name:
1008 <WlantapPhyMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1009 }),
1010 }))
1011 },
1012 )
1013 }
1014}
1015
1016#[derive(Debug)]
1024pub enum WlantapPhyRequest {
1025 Shutdown {
1029 responder: WlantapPhyShutdownResponder,
1030 },
1031 Rx {
1033 data: Vec<u8>,
1034 info: WlanRxInfo,
1035 control_handle: WlantapPhyControlHandle,
1036 },
1037 ReportTxResult {
1040 txr: fidl_fuchsia_wlan_common::WlanTxResult,
1041 control_handle: WlantapPhyControlHandle,
1042 },
1043 ScanComplete {
1044 scan_id: u64,
1045 status: i32,
1046 control_handle: WlantapPhyControlHandle,
1047 },
1048}
1049
1050impl WlantapPhyRequest {
1051 #[allow(irrefutable_let_patterns)]
1052 pub fn into_shutdown(self) -> Option<(WlantapPhyShutdownResponder)> {
1053 if let WlantapPhyRequest::Shutdown { responder } = self { Some((responder)) } else { None }
1054 }
1055
1056 #[allow(irrefutable_let_patterns)]
1057 pub fn into_rx(self) -> Option<(Vec<u8>, WlanRxInfo, WlantapPhyControlHandle)> {
1058 if let WlantapPhyRequest::Rx { data, info, control_handle } = self {
1059 Some((data, info, control_handle))
1060 } else {
1061 None
1062 }
1063 }
1064
1065 #[allow(irrefutable_let_patterns)]
1066 pub fn into_report_tx_result(
1067 self,
1068 ) -> Option<(fidl_fuchsia_wlan_common::WlanTxResult, WlantapPhyControlHandle)> {
1069 if let WlantapPhyRequest::ReportTxResult { txr, control_handle } = self {
1070 Some((txr, control_handle))
1071 } else {
1072 None
1073 }
1074 }
1075
1076 #[allow(irrefutable_let_patterns)]
1077 pub fn into_scan_complete(self) -> Option<(u64, i32, WlantapPhyControlHandle)> {
1078 if let WlantapPhyRequest::ScanComplete { scan_id, status, control_handle } = self {
1079 Some((scan_id, status, control_handle))
1080 } else {
1081 None
1082 }
1083 }
1084
1085 pub fn method_name(&self) -> &'static str {
1087 match *self {
1088 WlantapPhyRequest::Shutdown { .. } => "shutdown",
1089 WlantapPhyRequest::Rx { .. } => "rx",
1090 WlantapPhyRequest::ReportTxResult { .. } => "report_tx_result",
1091 WlantapPhyRequest::ScanComplete { .. } => "scan_complete",
1092 }
1093 }
1094}
1095
1096#[derive(Debug, Clone)]
1097pub struct WlantapPhyControlHandle {
1098 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1099}
1100
1101impl fidl::endpoints::ControlHandle for WlantapPhyControlHandle {
1102 fn shutdown(&self) {
1103 self.inner.shutdown()
1104 }
1105 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1106 self.inner.shutdown_with_epitaph(status)
1107 }
1108
1109 fn is_closed(&self) -> bool {
1110 self.inner.channel().is_closed()
1111 }
1112 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1113 self.inner.channel().on_closed()
1114 }
1115
1116 #[cfg(target_os = "fuchsia")]
1117 fn signal_peer(
1118 &self,
1119 clear_mask: zx::Signals,
1120 set_mask: zx::Signals,
1121 ) -> Result<(), zx_status::Status> {
1122 use fidl::Peered;
1123 self.inner.channel().signal_peer(clear_mask, set_mask)
1124 }
1125}
1126
1127impl WlantapPhyControlHandle {
1128 pub fn send_tx(&self, mut args: &TxArgs) -> Result<(), fidl::Error> {
1129 self.inner.send::<WlantapPhyTxRequest>(
1130 (args,),
1131 0,
1132 0x3ccc6c207280b569,
1133 fidl::encoding::DynamicFlags::empty(),
1134 )
1135 }
1136
1137 pub fn send_wlan_softmac_start(&self) -> Result<(), fidl::Error> {
1138 self.inner.send::<fidl::encoding::EmptyPayload>(
1139 (),
1140 0,
1141 0x328bcae20dec2b88,
1142 fidl::encoding::DynamicFlags::empty(),
1143 )
1144 }
1145
1146 pub fn send_set_channel(&self, mut args: &SetChannelArgs) -> Result<(), fidl::Error> {
1147 self.inner.send::<WlantapPhySetChannelRequest>(
1148 (args,),
1149 0,
1150 0x60eb9a607f96a948,
1151 fidl::encoding::DynamicFlags::empty(),
1152 )
1153 }
1154
1155 pub fn send_join_bss(&self, mut args: &JoinBssArgs) -> Result<(), fidl::Error> {
1156 self.inner.send::<WlantapPhyJoinBssRequest>(
1157 (args,),
1158 0,
1159 0xef930e871dbf2f9,
1160 fidl::encoding::DynamicFlags::empty(),
1161 )
1162 }
1163
1164 pub fn send_start_scan(&self, mut args: &StartScanArgs) -> Result<(), fidl::Error> {
1165 self.inner.send::<WlantapPhyStartScanRequest>(
1166 (args,),
1167 0,
1168 0x75ed87321e05cdbb,
1169 fidl::encoding::DynamicFlags::empty(),
1170 )
1171 }
1172
1173 pub fn send_set_key(&self, mut args: &SetKeyArgs) -> Result<(), fidl::Error> {
1174 self.inner.send::<WlantapPhySetKeyRequest>(
1175 (args,),
1176 0,
1177 0xff7bf591b026267,
1178 fidl::encoding::DynamicFlags::empty(),
1179 )
1180 }
1181
1182 pub fn send_set_country(&self, mut args: &SetCountryArgs) -> Result<(), fidl::Error> {
1183 self.inner.send::<WlantapPhySetCountryRequest>(
1184 (args,),
1185 0,
1186 0x4cd2f84e3ccfcd14,
1187 fidl::encoding::DynamicFlags::empty(),
1188 )
1189 }
1190}
1191
1192#[must_use = "FIDL methods require a response to be sent"]
1193#[derive(Debug)]
1194pub struct WlantapPhyShutdownResponder {
1195 control_handle: std::mem::ManuallyDrop<WlantapPhyControlHandle>,
1196 tx_id: u32,
1197}
1198
1199impl std::ops::Drop for WlantapPhyShutdownResponder {
1203 fn drop(&mut self) {
1204 self.control_handle.shutdown();
1205 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1207 }
1208}
1209
1210impl fidl::endpoints::Responder for WlantapPhyShutdownResponder {
1211 type ControlHandle = WlantapPhyControlHandle;
1212
1213 fn control_handle(&self) -> &WlantapPhyControlHandle {
1214 &self.control_handle
1215 }
1216
1217 fn drop_without_shutdown(mut self) {
1218 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1220 std::mem::forget(self);
1222 }
1223}
1224
1225impl WlantapPhyShutdownResponder {
1226 pub fn send(self) -> Result<(), fidl::Error> {
1230 let _result = self.send_raw();
1231 if _result.is_err() {
1232 self.control_handle.shutdown();
1233 }
1234 self.drop_without_shutdown();
1235 _result
1236 }
1237
1238 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1240 let _result = self.send_raw();
1241 self.drop_without_shutdown();
1242 _result
1243 }
1244
1245 fn send_raw(&self) -> Result<(), fidl::Error> {
1246 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1247 (),
1248 self.tx_id,
1249 0x1df8087c49fa9a5e,
1250 fidl::encoding::DynamicFlags::empty(),
1251 )
1252 }
1253}
1254
1255mod internal {
1256 use super::*;
1257
1258 impl fidl::encoding::ResourceTypeMarker for WlantapCtlCreatePhyRequest {
1259 type Borrowed<'a> = &'a mut Self;
1260 fn take_or_borrow<'a>(
1261 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1262 ) -> Self::Borrowed<'a> {
1263 value
1264 }
1265 }
1266
1267 unsafe impl fidl::encoding::TypeMarker for WlantapCtlCreatePhyRequest {
1268 type Owned = Self;
1269
1270 #[inline(always)]
1271 fn inline_align(_context: fidl::encoding::Context) -> usize {
1272 8
1273 }
1274
1275 #[inline(always)]
1276 fn inline_size(_context: fidl::encoding::Context) -> usize {
1277 96
1278 }
1279 }
1280
1281 unsafe impl
1282 fidl::encoding::Encode<
1283 WlantapCtlCreatePhyRequest,
1284 fidl::encoding::DefaultFuchsiaResourceDialect,
1285 > for &mut WlantapCtlCreatePhyRequest
1286 {
1287 #[inline]
1288 unsafe fn encode(
1289 self,
1290 encoder: &mut fidl::encoding::Encoder<
1291 '_,
1292 fidl::encoding::DefaultFuchsiaResourceDialect,
1293 >,
1294 offset: usize,
1295 _depth: fidl::encoding::Depth,
1296 ) -> fidl::Result<()> {
1297 encoder.debug_check_bounds::<WlantapCtlCreatePhyRequest>(offset);
1298 fidl::encoding::Encode::<WlantapCtlCreatePhyRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1300 (
1301 <WlantapPhyConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
1302 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WlantapPhyMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.proxy),
1303 ),
1304 encoder, offset, _depth
1305 )
1306 }
1307 }
1308 unsafe impl<
1309 T0: fidl::encoding::Encode<WlantapPhyConfig, fidl::encoding::DefaultFuchsiaResourceDialect>,
1310 T1: fidl::encoding::Encode<
1311 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WlantapPhyMarker>>,
1312 fidl::encoding::DefaultFuchsiaResourceDialect,
1313 >,
1314 >
1315 fidl::encoding::Encode<
1316 WlantapCtlCreatePhyRequest,
1317 fidl::encoding::DefaultFuchsiaResourceDialect,
1318 > for (T0, T1)
1319 {
1320 #[inline]
1321 unsafe fn encode(
1322 self,
1323 encoder: &mut fidl::encoding::Encoder<
1324 '_,
1325 fidl::encoding::DefaultFuchsiaResourceDialect,
1326 >,
1327 offset: usize,
1328 depth: fidl::encoding::Depth,
1329 ) -> fidl::Result<()> {
1330 encoder.debug_check_bounds::<WlantapCtlCreatePhyRequest>(offset);
1331 unsafe {
1334 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(88);
1335 (ptr as *mut u64).write_unaligned(0);
1336 }
1337 self.0.encode(encoder, offset + 0, depth)?;
1339 self.1.encode(encoder, offset + 88, depth)?;
1340 Ok(())
1341 }
1342 }
1343
1344 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1345 for WlantapCtlCreatePhyRequest
1346 {
1347 #[inline(always)]
1348 fn new_empty() -> Self {
1349 Self {
1350 config: fidl::new_empty!(
1351 WlantapPhyConfig,
1352 fidl::encoding::DefaultFuchsiaResourceDialect
1353 ),
1354 proxy: fidl::new_empty!(
1355 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WlantapPhyMarker>>,
1356 fidl::encoding::DefaultFuchsiaResourceDialect
1357 ),
1358 }
1359 }
1360
1361 #[inline]
1362 unsafe fn decode(
1363 &mut self,
1364 decoder: &mut fidl::encoding::Decoder<
1365 '_,
1366 fidl::encoding::DefaultFuchsiaResourceDialect,
1367 >,
1368 offset: usize,
1369 _depth: fidl::encoding::Depth,
1370 ) -> fidl::Result<()> {
1371 decoder.debug_check_bounds::<Self>(offset);
1372 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(88) };
1374 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1375 let mask = 0xffffffff00000000u64;
1376 let maskedval = padval & mask;
1377 if maskedval != 0 {
1378 return Err(fidl::Error::NonZeroPadding {
1379 padding_start: offset + 88 + ((mask as u64).trailing_zeros() / 8) as usize,
1380 });
1381 }
1382 fidl::decode!(
1383 WlantapPhyConfig,
1384 fidl::encoding::DefaultFuchsiaResourceDialect,
1385 &mut self.config,
1386 decoder,
1387 offset + 0,
1388 _depth
1389 )?;
1390 fidl::decode!(
1391 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<WlantapPhyMarker>>,
1392 fidl::encoding::DefaultFuchsiaResourceDialect,
1393 &mut self.proxy,
1394 decoder,
1395 offset + 88,
1396 _depth
1397 )?;
1398 Ok(())
1399 }
1400 }
1401}