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