fidl_fuchsia_wlan_product_deprecatedconfiguration/
fidl_fuchsia_wlan_product_deprecatedconfiguration.rs1#![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_product_deprecatedconfiguration__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct DeprecatedConfiguratorMarker;
16
17impl fidl::endpoints::ProtocolMarker for DeprecatedConfiguratorMarker {
18 type Proxy = DeprecatedConfiguratorProxy;
19 type RequestStream = DeprecatedConfiguratorRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = DeprecatedConfiguratorSynchronousProxy;
22
23 const DEBUG_NAME: &'static str =
24 "fuchsia.wlan.product.deprecatedconfiguration.DeprecatedConfigurator";
25}
26impl fidl::endpoints::DiscoverableProtocolMarker for DeprecatedConfiguratorMarker {}
27pub type DeprecatedConfiguratorSuggestAccessPointMacAddressResult =
28 Result<(), SuggestMacAddressError>;
29
30pub trait DeprecatedConfiguratorProxyInterface: Send + Sync {
31 type SuggestAccessPointMacAddressResponseFut: std::future::Future<
32 Output = Result<DeprecatedConfiguratorSuggestAccessPointMacAddressResult, fidl::Error>,
33 > + Send;
34 fn r#suggest_access_point_mac_address(
35 &self,
36 mac: &fidl_fuchsia_net::MacAddress,
37 ) -> Self::SuggestAccessPointMacAddressResponseFut;
38}
39#[derive(Debug)]
40#[cfg(target_os = "fuchsia")]
41pub struct DeprecatedConfiguratorSynchronousProxy {
42 client: fidl::client::sync::Client,
43}
44
45#[cfg(target_os = "fuchsia")]
46impl fidl::endpoints::SynchronousProxy for DeprecatedConfiguratorSynchronousProxy {
47 type Proxy = DeprecatedConfiguratorProxy;
48 type Protocol = DeprecatedConfiguratorMarker;
49
50 fn from_channel(inner: fidl::Channel) -> Self {
51 Self::new(inner)
52 }
53
54 fn into_channel(self) -> fidl::Channel {
55 self.client.into_channel()
56 }
57
58 fn as_channel(&self) -> &fidl::Channel {
59 self.client.as_channel()
60 }
61}
62
63#[cfg(target_os = "fuchsia")]
64impl DeprecatedConfiguratorSynchronousProxy {
65 pub fn new(channel: fidl::Channel) -> Self {
66 let protocol_name =
67 <DeprecatedConfiguratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
68 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
69 }
70
71 pub fn into_channel(self) -> fidl::Channel {
72 self.client.into_channel()
73 }
74
75 pub fn wait_for_event(
78 &self,
79 deadline: zx::MonotonicInstant,
80 ) -> Result<DeprecatedConfiguratorEvent, fidl::Error> {
81 DeprecatedConfiguratorEvent::decode(self.client.wait_for_event(deadline)?)
82 }
83
84 pub fn r#suggest_access_point_mac_address(
87 &self,
88 mut mac: &fidl_fuchsia_net::MacAddress,
89 ___deadline: zx::MonotonicInstant,
90 ) -> Result<DeprecatedConfiguratorSuggestAccessPointMacAddressResult, fidl::Error> {
91 let _response = self.client.send_query::<
92 DeprecatedConfiguratorSuggestAccessPointMacAddressRequest,
93 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, SuggestMacAddressError>,
94 >(
95 (mac,),
96 0x4dedf25064024f8c,
97 fidl::encoding::DynamicFlags::empty(),
98 ___deadline,
99 )?;
100 Ok(_response.map(|x| x))
101 }
102}
103
104#[cfg(target_os = "fuchsia")]
105impl From<DeprecatedConfiguratorSynchronousProxy> for zx::Handle {
106 fn from(value: DeprecatedConfiguratorSynchronousProxy) -> Self {
107 value.into_channel().into()
108 }
109}
110
111#[cfg(target_os = "fuchsia")]
112impl From<fidl::Channel> for DeprecatedConfiguratorSynchronousProxy {
113 fn from(value: fidl::Channel) -> Self {
114 Self::new(value)
115 }
116}
117
118#[cfg(target_os = "fuchsia")]
119impl fidl::endpoints::FromClient for DeprecatedConfiguratorSynchronousProxy {
120 type Protocol = DeprecatedConfiguratorMarker;
121
122 fn from_client(value: fidl::endpoints::ClientEnd<DeprecatedConfiguratorMarker>) -> Self {
123 Self::new(value.into_channel())
124 }
125}
126
127#[derive(Debug, Clone)]
128pub struct DeprecatedConfiguratorProxy {
129 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
130}
131
132impl fidl::endpoints::Proxy for DeprecatedConfiguratorProxy {
133 type Protocol = DeprecatedConfiguratorMarker;
134
135 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
136 Self::new(inner)
137 }
138
139 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
140 self.client.into_channel().map_err(|client| Self { client })
141 }
142
143 fn as_channel(&self) -> &::fidl::AsyncChannel {
144 self.client.as_channel()
145 }
146}
147
148impl DeprecatedConfiguratorProxy {
149 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
151 let protocol_name =
152 <DeprecatedConfiguratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
153 Self { client: fidl::client::Client::new(channel, protocol_name) }
154 }
155
156 pub fn take_event_stream(&self) -> DeprecatedConfiguratorEventStream {
162 DeprecatedConfiguratorEventStream { event_receiver: self.client.take_event_receiver() }
163 }
164
165 pub fn r#suggest_access_point_mac_address(
168 &self,
169 mut mac: &fidl_fuchsia_net::MacAddress,
170 ) -> fidl::client::QueryResponseFut<
171 DeprecatedConfiguratorSuggestAccessPointMacAddressResult,
172 fidl::encoding::DefaultFuchsiaResourceDialect,
173 > {
174 DeprecatedConfiguratorProxyInterface::r#suggest_access_point_mac_address(self, mac)
175 }
176}
177
178impl DeprecatedConfiguratorProxyInterface for DeprecatedConfiguratorProxy {
179 type SuggestAccessPointMacAddressResponseFut = fidl::client::QueryResponseFut<
180 DeprecatedConfiguratorSuggestAccessPointMacAddressResult,
181 fidl::encoding::DefaultFuchsiaResourceDialect,
182 >;
183 fn r#suggest_access_point_mac_address(
184 &self,
185 mut mac: &fidl_fuchsia_net::MacAddress,
186 ) -> Self::SuggestAccessPointMacAddressResponseFut {
187 fn _decode(
188 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
189 ) -> Result<DeprecatedConfiguratorSuggestAccessPointMacAddressResult, fidl::Error> {
190 let _response = fidl::client::decode_transaction_body::<
191 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, SuggestMacAddressError>,
192 fidl::encoding::DefaultFuchsiaResourceDialect,
193 0x4dedf25064024f8c,
194 >(_buf?)?;
195 Ok(_response.map(|x| x))
196 }
197 self.client.send_query_and_decode::<
198 DeprecatedConfiguratorSuggestAccessPointMacAddressRequest,
199 DeprecatedConfiguratorSuggestAccessPointMacAddressResult,
200 >(
201 (mac,),
202 0x4dedf25064024f8c,
203 fidl::encoding::DynamicFlags::empty(),
204 _decode,
205 )
206 }
207}
208
209pub struct DeprecatedConfiguratorEventStream {
210 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
211}
212
213impl std::marker::Unpin for DeprecatedConfiguratorEventStream {}
214
215impl futures::stream::FusedStream for DeprecatedConfiguratorEventStream {
216 fn is_terminated(&self) -> bool {
217 self.event_receiver.is_terminated()
218 }
219}
220
221impl futures::Stream for DeprecatedConfiguratorEventStream {
222 type Item = Result<DeprecatedConfiguratorEvent, fidl::Error>;
223
224 fn poll_next(
225 mut self: std::pin::Pin<&mut Self>,
226 cx: &mut std::task::Context<'_>,
227 ) -> std::task::Poll<Option<Self::Item>> {
228 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
229 &mut self.event_receiver,
230 cx
231 )?) {
232 Some(buf) => std::task::Poll::Ready(Some(DeprecatedConfiguratorEvent::decode(buf))),
233 None => std::task::Poll::Ready(None),
234 }
235 }
236}
237
238#[derive(Debug)]
239pub enum DeprecatedConfiguratorEvent {}
240
241impl DeprecatedConfiguratorEvent {
242 fn decode(
244 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
245 ) -> Result<DeprecatedConfiguratorEvent, fidl::Error> {
246 let (bytes, _handles) = buf.split_mut();
247 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
248 debug_assert_eq!(tx_header.tx_id, 0);
249 match tx_header.ordinal {
250 _ => Err(fidl::Error::UnknownOrdinal {
251 ordinal: tx_header.ordinal,
252 protocol_name:
253 <DeprecatedConfiguratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
254 }),
255 }
256 }
257}
258
259pub struct DeprecatedConfiguratorRequestStream {
261 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
262 is_terminated: bool,
263}
264
265impl std::marker::Unpin for DeprecatedConfiguratorRequestStream {}
266
267impl futures::stream::FusedStream for DeprecatedConfiguratorRequestStream {
268 fn is_terminated(&self) -> bool {
269 self.is_terminated
270 }
271}
272
273impl fidl::endpoints::RequestStream for DeprecatedConfiguratorRequestStream {
274 type Protocol = DeprecatedConfiguratorMarker;
275 type ControlHandle = DeprecatedConfiguratorControlHandle;
276
277 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
278 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
279 }
280
281 fn control_handle(&self) -> Self::ControlHandle {
282 DeprecatedConfiguratorControlHandle { inner: self.inner.clone() }
283 }
284
285 fn into_inner(
286 self,
287 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
288 {
289 (self.inner, self.is_terminated)
290 }
291
292 fn from_inner(
293 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
294 is_terminated: bool,
295 ) -> Self {
296 Self { inner, is_terminated }
297 }
298}
299
300impl futures::Stream for DeprecatedConfiguratorRequestStream {
301 type Item = Result<DeprecatedConfiguratorRequest, fidl::Error>;
302
303 fn poll_next(
304 mut self: std::pin::Pin<&mut Self>,
305 cx: &mut std::task::Context<'_>,
306 ) -> std::task::Poll<Option<Self::Item>> {
307 let this = &mut *self;
308 if this.inner.check_shutdown(cx) {
309 this.is_terminated = true;
310 return std::task::Poll::Ready(None);
311 }
312 if this.is_terminated {
313 panic!("polled DeprecatedConfiguratorRequestStream after completion");
314 }
315 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
316 |bytes, handles| {
317 match this.inner.channel().read_etc(cx, bytes, handles) {
318 std::task::Poll::Ready(Ok(())) => {}
319 std::task::Poll::Pending => return std::task::Poll::Pending,
320 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
321 this.is_terminated = true;
322 return std::task::Poll::Ready(None);
323 }
324 std::task::Poll::Ready(Err(e)) => {
325 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
326 e.into(),
327 ))))
328 }
329 }
330
331 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
333
334 std::task::Poll::Ready(Some(match header.ordinal {
335 0x4dedf25064024f8c => {
336 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
337 let mut req = fidl::new_empty!(DeprecatedConfiguratorSuggestAccessPointMacAddressRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
338 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeprecatedConfiguratorSuggestAccessPointMacAddressRequest>(&header, _body_bytes, handles, &mut req)?;
339 let control_handle = DeprecatedConfiguratorControlHandle {
340 inner: this.inner.clone(),
341 };
342 Ok(DeprecatedConfiguratorRequest::SuggestAccessPointMacAddress {mac: req.mac,
343
344 responder: DeprecatedConfiguratorSuggestAccessPointMacAddressResponder {
345 control_handle: std::mem::ManuallyDrop::new(control_handle),
346 tx_id: header.tx_id,
347 },
348 })
349 }
350 _ => Err(fidl::Error::UnknownOrdinal {
351 ordinal: header.ordinal,
352 protocol_name: <DeprecatedConfiguratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
353 }),
354 }))
355 },
356 )
357 }
358}
359
360#[derive(Debug)]
362pub enum DeprecatedConfiguratorRequest {
363 SuggestAccessPointMacAddress {
366 mac: fidl_fuchsia_net::MacAddress,
367 responder: DeprecatedConfiguratorSuggestAccessPointMacAddressResponder,
368 },
369}
370
371impl DeprecatedConfiguratorRequest {
372 #[allow(irrefutable_let_patterns)]
373 pub fn into_suggest_access_point_mac_address(
374 self,
375 ) -> Option<(
376 fidl_fuchsia_net::MacAddress,
377 DeprecatedConfiguratorSuggestAccessPointMacAddressResponder,
378 )> {
379 if let DeprecatedConfiguratorRequest::SuggestAccessPointMacAddress { mac, responder } = self
380 {
381 Some((mac, responder))
382 } else {
383 None
384 }
385 }
386
387 pub fn method_name(&self) -> &'static str {
389 match *self {
390 DeprecatedConfiguratorRequest::SuggestAccessPointMacAddress { .. } => {
391 "suggest_access_point_mac_address"
392 }
393 }
394 }
395}
396
397#[derive(Debug, Clone)]
398pub struct DeprecatedConfiguratorControlHandle {
399 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
400}
401
402impl fidl::endpoints::ControlHandle for DeprecatedConfiguratorControlHandle {
403 fn shutdown(&self) {
404 self.inner.shutdown()
405 }
406 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
407 self.inner.shutdown_with_epitaph(status)
408 }
409
410 fn is_closed(&self) -> bool {
411 self.inner.channel().is_closed()
412 }
413 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
414 self.inner.channel().on_closed()
415 }
416
417 #[cfg(target_os = "fuchsia")]
418 fn signal_peer(
419 &self,
420 clear_mask: zx::Signals,
421 set_mask: zx::Signals,
422 ) -> Result<(), zx_status::Status> {
423 use fidl::Peered;
424 self.inner.channel().signal_peer(clear_mask, set_mask)
425 }
426}
427
428impl DeprecatedConfiguratorControlHandle {}
429
430#[must_use = "FIDL methods require a response to be sent"]
431#[derive(Debug)]
432pub struct DeprecatedConfiguratorSuggestAccessPointMacAddressResponder {
433 control_handle: std::mem::ManuallyDrop<DeprecatedConfiguratorControlHandle>,
434 tx_id: u32,
435}
436
437impl std::ops::Drop for DeprecatedConfiguratorSuggestAccessPointMacAddressResponder {
441 fn drop(&mut self) {
442 self.control_handle.shutdown();
443 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
445 }
446}
447
448impl fidl::endpoints::Responder for DeprecatedConfiguratorSuggestAccessPointMacAddressResponder {
449 type ControlHandle = DeprecatedConfiguratorControlHandle;
450
451 fn control_handle(&self) -> &DeprecatedConfiguratorControlHandle {
452 &self.control_handle
453 }
454
455 fn drop_without_shutdown(mut self) {
456 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
458 std::mem::forget(self);
460 }
461}
462
463impl DeprecatedConfiguratorSuggestAccessPointMacAddressResponder {
464 pub fn send(self, mut result: Result<(), SuggestMacAddressError>) -> Result<(), fidl::Error> {
468 let _result = self.send_raw(result);
469 if _result.is_err() {
470 self.control_handle.shutdown();
471 }
472 self.drop_without_shutdown();
473 _result
474 }
475
476 pub fn send_no_shutdown_on_err(
478 self,
479 mut result: Result<(), SuggestMacAddressError>,
480 ) -> Result<(), fidl::Error> {
481 let _result = self.send_raw(result);
482 self.drop_without_shutdown();
483 _result
484 }
485
486 fn send_raw(&self, mut result: Result<(), SuggestMacAddressError>) -> Result<(), fidl::Error> {
487 self.control_handle.inner.send::<fidl::encoding::ResultType<
488 fidl::encoding::EmptyStruct,
489 SuggestMacAddressError,
490 >>(
491 result,
492 self.tx_id,
493 0x4dedf25064024f8c,
494 fidl::encoding::DynamicFlags::empty(),
495 )
496 }
497}
498
499mod internal {
500 use super::*;
501}