fidl_fuchsia_wlan_product_deprecatedclient/
fidl_fuchsia_wlan_product_deprecatedclient.rs
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_product_deprecatedclient_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct DeprecatedClientMarker;
16
17impl fidl::endpoints::ProtocolMarker for DeprecatedClientMarker {
18 type Proxy = DeprecatedClientProxy;
19 type RequestStream = DeprecatedClientRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = DeprecatedClientSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "fuchsia.wlan.product.deprecatedclient.DeprecatedClient";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for DeprecatedClientMarker {}
26
27pub trait DeprecatedClientProxyInterface: Send + Sync {
28 type StatusResponseFut: std::future::Future<Output = Result<WlanStatus, fidl::Error>> + Send;
29 fn r#status(&self) -> Self::StatusResponseFut;
30}
31#[derive(Debug)]
32#[cfg(target_os = "fuchsia")]
33pub struct DeprecatedClientSynchronousProxy {
34 client: fidl::client::sync::Client,
35}
36
37#[cfg(target_os = "fuchsia")]
38impl fidl::endpoints::SynchronousProxy for DeprecatedClientSynchronousProxy {
39 type Proxy = DeprecatedClientProxy;
40 type Protocol = DeprecatedClientMarker;
41
42 fn from_channel(inner: fidl::Channel) -> Self {
43 Self::new(inner)
44 }
45
46 fn into_channel(self) -> fidl::Channel {
47 self.client.into_channel()
48 }
49
50 fn as_channel(&self) -> &fidl::Channel {
51 self.client.as_channel()
52 }
53}
54
55#[cfg(target_os = "fuchsia")]
56impl DeprecatedClientSynchronousProxy {
57 pub fn new(channel: fidl::Channel) -> Self {
58 let protocol_name = <DeprecatedClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
59 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
60 }
61
62 pub fn into_channel(self) -> fidl::Channel {
63 self.client.into_channel()
64 }
65
66 pub fn wait_for_event(
69 &self,
70 deadline: zx::MonotonicInstant,
71 ) -> Result<DeprecatedClientEvent, fidl::Error> {
72 DeprecatedClientEvent::decode(self.client.wait_for_event(deadline)?)
73 }
74
75 pub fn r#status(&self, ___deadline: zx::MonotonicInstant) -> Result<WlanStatus, fidl::Error> {
77 let _response = self
78 .client
79 .send_query::<fidl::encoding::EmptyPayload, DeprecatedClientStatusResponse>(
80 (),
81 0x7c81599d3ecccfef,
82 fidl::encoding::DynamicFlags::empty(),
83 ___deadline,
84 )?;
85 Ok(_response.status)
86 }
87}
88
89#[derive(Debug, Clone)]
90pub struct DeprecatedClientProxy {
91 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
92}
93
94impl fidl::endpoints::Proxy for DeprecatedClientProxy {
95 type Protocol = DeprecatedClientMarker;
96
97 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
98 Self::new(inner)
99 }
100
101 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
102 self.client.into_channel().map_err(|client| Self { client })
103 }
104
105 fn as_channel(&self) -> &::fidl::AsyncChannel {
106 self.client.as_channel()
107 }
108}
109
110impl DeprecatedClientProxy {
111 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
113 let protocol_name = <DeprecatedClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
114 Self { client: fidl::client::Client::new(channel, protocol_name) }
115 }
116
117 pub fn take_event_stream(&self) -> DeprecatedClientEventStream {
123 DeprecatedClientEventStream { event_receiver: self.client.take_event_receiver() }
124 }
125
126 pub fn r#status(
128 &self,
129 ) -> fidl::client::QueryResponseFut<WlanStatus, fidl::encoding::DefaultFuchsiaResourceDialect>
130 {
131 DeprecatedClientProxyInterface::r#status(self)
132 }
133}
134
135impl DeprecatedClientProxyInterface for DeprecatedClientProxy {
136 type StatusResponseFut =
137 fidl::client::QueryResponseFut<WlanStatus, fidl::encoding::DefaultFuchsiaResourceDialect>;
138 fn r#status(&self) -> Self::StatusResponseFut {
139 fn _decode(
140 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
141 ) -> Result<WlanStatus, fidl::Error> {
142 let _response = fidl::client::decode_transaction_body::<
143 DeprecatedClientStatusResponse,
144 fidl::encoding::DefaultFuchsiaResourceDialect,
145 0x7c81599d3ecccfef,
146 >(_buf?)?;
147 Ok(_response.status)
148 }
149 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, WlanStatus>(
150 (),
151 0x7c81599d3ecccfef,
152 fidl::encoding::DynamicFlags::empty(),
153 _decode,
154 )
155 }
156}
157
158pub struct DeprecatedClientEventStream {
159 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
160}
161
162impl std::marker::Unpin for DeprecatedClientEventStream {}
163
164impl futures::stream::FusedStream for DeprecatedClientEventStream {
165 fn is_terminated(&self) -> bool {
166 self.event_receiver.is_terminated()
167 }
168}
169
170impl futures::Stream for DeprecatedClientEventStream {
171 type Item = Result<DeprecatedClientEvent, fidl::Error>;
172
173 fn poll_next(
174 mut self: std::pin::Pin<&mut Self>,
175 cx: &mut std::task::Context<'_>,
176 ) -> std::task::Poll<Option<Self::Item>> {
177 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
178 &mut self.event_receiver,
179 cx
180 )?) {
181 Some(buf) => std::task::Poll::Ready(Some(DeprecatedClientEvent::decode(buf))),
182 None => std::task::Poll::Ready(None),
183 }
184 }
185}
186
187#[derive(Debug)]
188pub enum DeprecatedClientEvent {}
189
190impl DeprecatedClientEvent {
191 fn decode(
193 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
194 ) -> Result<DeprecatedClientEvent, fidl::Error> {
195 let (bytes, _handles) = buf.split_mut();
196 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
197 debug_assert_eq!(tx_header.tx_id, 0);
198 match tx_header.ordinal {
199 _ => Err(fidl::Error::UnknownOrdinal {
200 ordinal: tx_header.ordinal,
201 protocol_name:
202 <DeprecatedClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
203 }),
204 }
205 }
206}
207
208pub struct DeprecatedClientRequestStream {
210 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
211 is_terminated: bool,
212}
213
214impl std::marker::Unpin for DeprecatedClientRequestStream {}
215
216impl futures::stream::FusedStream for DeprecatedClientRequestStream {
217 fn is_terminated(&self) -> bool {
218 self.is_terminated
219 }
220}
221
222impl fidl::endpoints::RequestStream for DeprecatedClientRequestStream {
223 type Protocol = DeprecatedClientMarker;
224 type ControlHandle = DeprecatedClientControlHandle;
225
226 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
227 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
228 }
229
230 fn control_handle(&self) -> Self::ControlHandle {
231 DeprecatedClientControlHandle { inner: self.inner.clone() }
232 }
233
234 fn into_inner(
235 self,
236 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
237 {
238 (self.inner, self.is_terminated)
239 }
240
241 fn from_inner(
242 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
243 is_terminated: bool,
244 ) -> Self {
245 Self { inner, is_terminated }
246 }
247}
248
249impl futures::Stream for DeprecatedClientRequestStream {
250 type Item = Result<DeprecatedClientRequest, fidl::Error>;
251
252 fn poll_next(
253 mut self: std::pin::Pin<&mut Self>,
254 cx: &mut std::task::Context<'_>,
255 ) -> std::task::Poll<Option<Self::Item>> {
256 let this = &mut *self;
257 if this.inner.check_shutdown(cx) {
258 this.is_terminated = true;
259 return std::task::Poll::Ready(None);
260 }
261 if this.is_terminated {
262 panic!("polled DeprecatedClientRequestStream after completion");
263 }
264 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
265 |bytes, handles| {
266 match this.inner.channel().read_etc(cx, bytes, handles) {
267 std::task::Poll::Ready(Ok(())) => {}
268 std::task::Poll::Pending => return std::task::Poll::Pending,
269 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
270 this.is_terminated = true;
271 return std::task::Poll::Ready(None);
272 }
273 std::task::Poll::Ready(Err(e)) => {
274 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
275 e.into(),
276 ))))
277 }
278 }
279
280 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
282
283 std::task::Poll::Ready(Some(match header.ordinal {
284 0x7c81599d3ecccfef => {
285 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
286 let mut req = fidl::new_empty!(
287 fidl::encoding::EmptyPayload,
288 fidl::encoding::DefaultFuchsiaResourceDialect
289 );
290 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
291 let control_handle =
292 DeprecatedClientControlHandle { inner: this.inner.clone() };
293 Ok(DeprecatedClientRequest::Status {
294 responder: DeprecatedClientStatusResponder {
295 control_handle: std::mem::ManuallyDrop::new(control_handle),
296 tx_id: header.tx_id,
297 },
298 })
299 }
300 _ => Err(fidl::Error::UnknownOrdinal {
301 ordinal: header.ordinal,
302 protocol_name:
303 <DeprecatedClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
304 }),
305 }))
306 },
307 )
308 }
309}
310
311#[derive(Debug)]
313pub enum DeprecatedClientRequest {
314 Status { responder: DeprecatedClientStatusResponder },
316}
317
318impl DeprecatedClientRequest {
319 #[allow(irrefutable_let_patterns)]
320 pub fn into_status(self) -> Option<(DeprecatedClientStatusResponder)> {
321 if let DeprecatedClientRequest::Status { responder } = self {
322 Some((responder))
323 } else {
324 None
325 }
326 }
327
328 pub fn method_name(&self) -> &'static str {
330 match *self {
331 DeprecatedClientRequest::Status { .. } => "status",
332 }
333 }
334}
335
336#[derive(Debug, Clone)]
337pub struct DeprecatedClientControlHandle {
338 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
339}
340
341impl fidl::endpoints::ControlHandle for DeprecatedClientControlHandle {
342 fn shutdown(&self) {
343 self.inner.shutdown()
344 }
345 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
346 self.inner.shutdown_with_epitaph(status)
347 }
348
349 fn is_closed(&self) -> bool {
350 self.inner.channel().is_closed()
351 }
352 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
353 self.inner.channel().on_closed()
354 }
355
356 #[cfg(target_os = "fuchsia")]
357 fn signal_peer(
358 &self,
359 clear_mask: zx::Signals,
360 set_mask: zx::Signals,
361 ) -> Result<(), zx_status::Status> {
362 use fidl::Peered;
363 self.inner.channel().signal_peer(clear_mask, set_mask)
364 }
365}
366
367impl DeprecatedClientControlHandle {}
368
369#[must_use = "FIDL methods require a response to be sent"]
370#[derive(Debug)]
371pub struct DeprecatedClientStatusResponder {
372 control_handle: std::mem::ManuallyDrop<DeprecatedClientControlHandle>,
373 tx_id: u32,
374}
375
376impl std::ops::Drop for DeprecatedClientStatusResponder {
380 fn drop(&mut self) {
381 self.control_handle.shutdown();
382 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
384 }
385}
386
387impl fidl::endpoints::Responder for DeprecatedClientStatusResponder {
388 type ControlHandle = DeprecatedClientControlHandle;
389
390 fn control_handle(&self) -> &DeprecatedClientControlHandle {
391 &self.control_handle
392 }
393
394 fn drop_without_shutdown(mut self) {
395 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
397 std::mem::forget(self);
399 }
400}
401
402impl DeprecatedClientStatusResponder {
403 pub fn send(self, mut status: &WlanStatus) -> Result<(), fidl::Error> {
407 let _result = self.send_raw(status);
408 if _result.is_err() {
409 self.control_handle.shutdown();
410 }
411 self.drop_without_shutdown();
412 _result
413 }
414
415 pub fn send_no_shutdown_on_err(self, mut status: &WlanStatus) -> Result<(), fidl::Error> {
417 let _result = self.send_raw(status);
418 self.drop_without_shutdown();
419 _result
420 }
421
422 fn send_raw(&self, mut status: &WlanStatus) -> Result<(), fidl::Error> {
423 self.control_handle.inner.send::<DeprecatedClientStatusResponse>(
424 (status,),
425 self.tx_id,
426 0x7c81599d3ecccfef,
427 fidl::encoding::DynamicFlags::empty(),
428 )
429 }
430}
431
432mod internal {
433 use super::*;
434}