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