Skip to main content

fidl_fuchsia_wlan_policy/
fidl_fuchsia_wlan_policy.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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_policy__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct AccessPointListenerGetListenerRequest {
16    pub updates: fidl::endpoints::ClientEnd<AccessPointStateUpdatesMarker>,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
20    for AccessPointListenerGetListenerRequest
21{
22}
23
24#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
25pub struct AccessPointProviderGetControllerRequest {
26    pub requests: fidl::endpoints::ServerEnd<AccessPointControllerMarker>,
27    pub updates: fidl::endpoints::ClientEnd<AccessPointStateUpdatesMarker>,
28}
29
30impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
31    for AccessPointProviderGetControllerRequest
32{
33}
34
35#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
36pub struct ClientControllerGetSavedNetworksRequest {
37    pub iterator: fidl::endpoints::ServerEnd<NetworkConfigIteratorMarker>,
38}
39
40impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
41    for ClientControllerGetSavedNetworksRequest
42{
43}
44
45#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
46pub struct ClientControllerScanForNetworksRequest {
47    pub iterator: fidl::endpoints::ServerEnd<ScanResultIteratorMarker>,
48}
49
50impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
51    for ClientControllerScanForNetworksRequest
52{
53}
54
55#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
56pub struct ClientListenerGetListenerRequest {
57    pub updates: fidl::endpoints::ClientEnd<ClientStateUpdatesMarker>,
58}
59
60impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
61    for ClientListenerGetListenerRequest
62{
63}
64
65#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
66pub struct ClientProviderGetControllerRequest {
67    pub requests: fidl::endpoints::ServerEnd<ClientControllerMarker>,
68    pub updates: fidl::endpoints::ClientEnd<ClientStateUpdatesMarker>,
69}
70
71impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
72    for ClientProviderGetControllerRequest
73{
74}
75
76#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
77pub struct AccessPointControllerMarker;
78
79impl fidl::endpoints::ProtocolMarker for AccessPointControllerMarker {
80    type Proxy = AccessPointControllerProxy;
81    type RequestStream = AccessPointControllerRequestStream;
82    #[cfg(target_os = "fuchsia")]
83    type SynchronousProxy = AccessPointControllerSynchronousProxy;
84
85    const DEBUG_NAME: &'static str = "(anonymous) AccessPointController";
86}
87
88pub trait AccessPointControllerProxyInterface: Send + Sync {
89    type StartAccessPointResponseFut: std::future::Future<Output = Result<RequestStatus, fidl::Error>>
90        + Send;
91    fn r#start_access_point(
92        &self,
93        config: &NetworkConfig,
94        mode: ConnectivityMode,
95        band: OperatingBand,
96    ) -> Self::StartAccessPointResponseFut;
97    type StopAccessPointResponseFut: std::future::Future<Output = Result<RequestStatus, fidl::Error>>
98        + Send;
99    fn r#stop_access_point(&self, config: &NetworkConfig) -> Self::StopAccessPointResponseFut;
100    fn r#stop_all_access_points(&self) -> Result<(), fidl::Error>;
101}
102#[derive(Debug)]
103#[cfg(target_os = "fuchsia")]
104pub struct AccessPointControllerSynchronousProxy {
105    client: fidl::client::sync::Client,
106}
107
108#[cfg(target_os = "fuchsia")]
109impl fidl::endpoints::SynchronousProxy for AccessPointControllerSynchronousProxy {
110    type Proxy = AccessPointControllerProxy;
111    type Protocol = AccessPointControllerMarker;
112
113    fn from_channel(inner: fidl::Channel) -> Self {
114        Self::new(inner)
115    }
116
117    fn into_channel(self) -> fidl::Channel {
118        self.client.into_channel()
119    }
120
121    fn as_channel(&self) -> &fidl::Channel {
122        self.client.as_channel()
123    }
124}
125
126#[cfg(target_os = "fuchsia")]
127impl AccessPointControllerSynchronousProxy {
128    pub fn new(channel: fidl::Channel) -> Self {
129        Self { client: fidl::client::sync::Client::new(channel) }
130    }
131
132    pub fn into_channel(self) -> fidl::Channel {
133        self.client.into_channel()
134    }
135
136    /// Waits until an event arrives and returns it. It is safe for other
137    /// threads to make concurrent requests while waiting for an event.
138    pub fn wait_for_event(
139        &self,
140        deadline: zx::MonotonicInstant,
141    ) -> Result<AccessPointControllerEvent, fidl::Error> {
142        AccessPointControllerEvent::decode(
143            self.client.wait_for_event::<AccessPointControllerMarker>(deadline)?,
144        )
145    }
146
147    /// Enables wlan to initiate AccessPoint operation using the provided network
148    /// configuration, connectivity mode and band.
149    pub fn r#start_access_point(
150        &self,
151        mut config: &NetworkConfig,
152        mut mode: ConnectivityMode,
153        mut band: OperatingBand,
154        ___deadline: zx::MonotonicInstant,
155    ) -> Result<RequestStatus, fidl::Error> {
156        let _response = self.client.send_query::<
157            AccessPointControllerStartAccessPointRequest,
158            AccessPointControllerStartAccessPointResponse,
159            AccessPointControllerMarker,
160        >(
161            (config, mode, band,),
162            0x76bcb0fcf04571e7,
163            fidl::encoding::DynamicFlags::empty(),
164            ___deadline,
165        )?;
166        Ok(_response.status)
167    }
168
169    /// Deactivate AccessPoint operation for a specified network configuration.
170    pub fn r#stop_access_point(
171        &self,
172        mut config: &NetworkConfig,
173        ___deadline: zx::MonotonicInstant,
174    ) -> Result<RequestStatus, fidl::Error> {
175        let _response = self.client.send_query::<
176            AccessPointControllerStopAccessPointRequest,
177            AccessPointControllerStopAccessPointResponse,
178            AccessPointControllerMarker,
179        >(
180            (config,),
181            0xb3af7e469672bad,
182            fidl::encoding::DynamicFlags::empty(),
183            ___deadline,
184        )?;
185        Ok(_response.status)
186    }
187
188    /// Deactivates all AccessPoints currently operating on the device.
189    pub fn r#stop_all_access_points(&self) -> Result<(), fidl::Error> {
190        self.client.send::<fidl::encoding::EmptyPayload>(
191            (),
192            0x28b34d49d327cc0d,
193            fidl::encoding::DynamicFlags::empty(),
194        )
195    }
196}
197
198#[cfg(target_os = "fuchsia")]
199impl From<AccessPointControllerSynchronousProxy> for zx::NullableHandle {
200    fn from(value: AccessPointControllerSynchronousProxy) -> Self {
201        value.into_channel().into()
202    }
203}
204
205#[cfg(target_os = "fuchsia")]
206impl From<fidl::Channel> for AccessPointControllerSynchronousProxy {
207    fn from(value: fidl::Channel) -> Self {
208        Self::new(value)
209    }
210}
211
212#[cfg(target_os = "fuchsia")]
213impl fidl::endpoints::FromClient for AccessPointControllerSynchronousProxy {
214    type Protocol = AccessPointControllerMarker;
215
216    fn from_client(value: fidl::endpoints::ClientEnd<AccessPointControllerMarker>) -> Self {
217        Self::new(value.into_channel())
218    }
219}
220
221#[derive(Debug, Clone)]
222pub struct AccessPointControllerProxy {
223    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
224}
225
226impl fidl::endpoints::Proxy for AccessPointControllerProxy {
227    type Protocol = AccessPointControllerMarker;
228
229    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
230        Self::new(inner)
231    }
232
233    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
234        self.client.into_channel().map_err(|client| Self { client })
235    }
236
237    fn as_channel(&self) -> &::fidl::AsyncChannel {
238        self.client.as_channel()
239    }
240}
241
242impl AccessPointControllerProxy {
243    /// Create a new Proxy for fuchsia.wlan.policy/AccessPointController.
244    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
245        let protocol_name =
246            <AccessPointControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
247        Self { client: fidl::client::Client::new(channel, protocol_name) }
248    }
249
250    /// Get a Stream of events from the remote end of the protocol.
251    ///
252    /// # Panics
253    ///
254    /// Panics if the event stream was already taken.
255    pub fn take_event_stream(&self) -> AccessPointControllerEventStream {
256        AccessPointControllerEventStream { event_receiver: self.client.take_event_receiver() }
257    }
258
259    /// Enables wlan to initiate AccessPoint operation using the provided network
260    /// configuration, connectivity mode and band.
261    pub fn r#start_access_point(
262        &self,
263        mut config: &NetworkConfig,
264        mut mode: ConnectivityMode,
265        mut band: OperatingBand,
266    ) -> fidl::client::QueryResponseFut<RequestStatus, fidl::encoding::DefaultFuchsiaResourceDialect>
267    {
268        AccessPointControllerProxyInterface::r#start_access_point(self, config, mode, band)
269    }
270
271    /// Deactivate AccessPoint operation for a specified network configuration.
272    pub fn r#stop_access_point(
273        &self,
274        mut config: &NetworkConfig,
275    ) -> fidl::client::QueryResponseFut<RequestStatus, fidl::encoding::DefaultFuchsiaResourceDialect>
276    {
277        AccessPointControllerProxyInterface::r#stop_access_point(self, config)
278    }
279
280    /// Deactivates all AccessPoints currently operating on the device.
281    pub fn r#stop_all_access_points(&self) -> Result<(), fidl::Error> {
282        AccessPointControllerProxyInterface::r#stop_all_access_points(self)
283    }
284}
285
286impl AccessPointControllerProxyInterface for AccessPointControllerProxy {
287    type StartAccessPointResponseFut = fidl::client::QueryResponseFut<
288        RequestStatus,
289        fidl::encoding::DefaultFuchsiaResourceDialect,
290    >;
291    fn r#start_access_point(
292        &self,
293        mut config: &NetworkConfig,
294        mut mode: ConnectivityMode,
295        mut band: OperatingBand,
296    ) -> Self::StartAccessPointResponseFut {
297        fn _decode(
298            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
299        ) -> Result<RequestStatus, fidl::Error> {
300            let _response = fidl::client::decode_transaction_body::<
301                AccessPointControllerStartAccessPointResponse,
302                fidl::encoding::DefaultFuchsiaResourceDialect,
303                0x76bcb0fcf04571e7,
304            >(_buf?)?;
305            Ok(_response.status)
306        }
307        self.client
308            .send_query_and_decode::<AccessPointControllerStartAccessPointRequest, RequestStatus>(
309                (config, mode, band),
310                0x76bcb0fcf04571e7,
311                fidl::encoding::DynamicFlags::empty(),
312                _decode,
313            )
314    }
315
316    type StopAccessPointResponseFut = fidl::client::QueryResponseFut<
317        RequestStatus,
318        fidl::encoding::DefaultFuchsiaResourceDialect,
319    >;
320    fn r#stop_access_point(&self, mut config: &NetworkConfig) -> Self::StopAccessPointResponseFut {
321        fn _decode(
322            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
323        ) -> Result<RequestStatus, fidl::Error> {
324            let _response = fidl::client::decode_transaction_body::<
325                AccessPointControllerStopAccessPointResponse,
326                fidl::encoding::DefaultFuchsiaResourceDialect,
327                0xb3af7e469672bad,
328            >(_buf?)?;
329            Ok(_response.status)
330        }
331        self.client
332            .send_query_and_decode::<AccessPointControllerStopAccessPointRequest, RequestStatus>(
333                (config,),
334                0xb3af7e469672bad,
335                fidl::encoding::DynamicFlags::empty(),
336                _decode,
337            )
338    }
339
340    fn r#stop_all_access_points(&self) -> Result<(), fidl::Error> {
341        self.client.send::<fidl::encoding::EmptyPayload>(
342            (),
343            0x28b34d49d327cc0d,
344            fidl::encoding::DynamicFlags::empty(),
345        )
346    }
347}
348
349pub struct AccessPointControllerEventStream {
350    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
351}
352
353impl std::marker::Unpin for AccessPointControllerEventStream {}
354
355impl futures::stream::FusedStream for AccessPointControllerEventStream {
356    fn is_terminated(&self) -> bool {
357        self.event_receiver.is_terminated()
358    }
359}
360
361impl futures::Stream for AccessPointControllerEventStream {
362    type Item = Result<AccessPointControllerEvent, fidl::Error>;
363
364    fn poll_next(
365        mut self: std::pin::Pin<&mut Self>,
366        cx: &mut std::task::Context<'_>,
367    ) -> std::task::Poll<Option<Self::Item>> {
368        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
369            &mut self.event_receiver,
370            cx
371        )?) {
372            Some(buf) => std::task::Poll::Ready(Some(AccessPointControllerEvent::decode(buf))),
373            None => std::task::Poll::Ready(None),
374        }
375    }
376}
377
378#[derive(Debug)]
379pub enum AccessPointControllerEvent {}
380
381impl AccessPointControllerEvent {
382    /// Decodes a message buffer as a [`AccessPointControllerEvent`].
383    fn decode(
384        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
385    ) -> Result<AccessPointControllerEvent, fidl::Error> {
386        let (bytes, _handles) = buf.split_mut();
387        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
388        debug_assert_eq!(tx_header.tx_id, 0);
389        match tx_header.ordinal {
390            _ => Err(fidl::Error::UnknownOrdinal {
391                ordinal: tx_header.ordinal,
392                protocol_name:
393                    <AccessPointControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
394            }),
395        }
396    }
397}
398
399/// A Stream of incoming requests for fuchsia.wlan.policy/AccessPointController.
400pub struct AccessPointControllerRequestStream {
401    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
402    is_terminated: bool,
403}
404
405impl std::marker::Unpin for AccessPointControllerRequestStream {}
406
407impl futures::stream::FusedStream for AccessPointControllerRequestStream {
408    fn is_terminated(&self) -> bool {
409        self.is_terminated
410    }
411}
412
413impl fidl::endpoints::RequestStream for AccessPointControllerRequestStream {
414    type Protocol = AccessPointControllerMarker;
415    type ControlHandle = AccessPointControllerControlHandle;
416
417    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
418        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
419    }
420
421    fn control_handle(&self) -> Self::ControlHandle {
422        AccessPointControllerControlHandle { inner: self.inner.clone() }
423    }
424
425    fn into_inner(
426        self,
427    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
428    {
429        (self.inner, self.is_terminated)
430    }
431
432    fn from_inner(
433        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
434        is_terminated: bool,
435    ) -> Self {
436        Self { inner, is_terminated }
437    }
438}
439
440impl futures::Stream for AccessPointControllerRequestStream {
441    type Item = Result<AccessPointControllerRequest, fidl::Error>;
442
443    fn poll_next(
444        mut self: std::pin::Pin<&mut Self>,
445        cx: &mut std::task::Context<'_>,
446    ) -> std::task::Poll<Option<Self::Item>> {
447        let this = &mut *self;
448        if this.inner.check_shutdown(cx) {
449            this.is_terminated = true;
450            return std::task::Poll::Ready(None);
451        }
452        if this.is_terminated {
453            panic!("polled AccessPointControllerRequestStream after completion");
454        }
455        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
456            |bytes, handles| {
457                match this.inner.channel().read_etc(cx, bytes, handles) {
458                    std::task::Poll::Ready(Ok(())) => {}
459                    std::task::Poll::Pending => return std::task::Poll::Pending,
460                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
461                        this.is_terminated = true;
462                        return std::task::Poll::Ready(None);
463                    }
464                    std::task::Poll::Ready(Err(e)) => {
465                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
466                            e.into(),
467                        ))));
468                    }
469                }
470
471                // A message has been received from the channel
472                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
473
474                std::task::Poll::Ready(Some(match header.ordinal {
475                0x76bcb0fcf04571e7 => {
476                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
477                    let mut req = fidl::new_empty!(AccessPointControllerStartAccessPointRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
478                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessPointControllerStartAccessPointRequest>(&header, _body_bytes, handles, &mut req)?;
479                    let control_handle = AccessPointControllerControlHandle {
480                        inner: this.inner.clone(),
481                    };
482                    Ok(AccessPointControllerRequest::StartAccessPoint {config: req.config,
483mode: req.mode,
484band: req.band,
485
486                        responder: AccessPointControllerStartAccessPointResponder {
487                            control_handle: std::mem::ManuallyDrop::new(control_handle),
488                            tx_id: header.tx_id,
489                        },
490                    })
491                }
492                0xb3af7e469672bad => {
493                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
494                    let mut req = fidl::new_empty!(AccessPointControllerStopAccessPointRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
495                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessPointControllerStopAccessPointRequest>(&header, _body_bytes, handles, &mut req)?;
496                    let control_handle = AccessPointControllerControlHandle {
497                        inner: this.inner.clone(),
498                    };
499                    Ok(AccessPointControllerRequest::StopAccessPoint {config: req.config,
500
501                        responder: AccessPointControllerStopAccessPointResponder {
502                            control_handle: std::mem::ManuallyDrop::new(control_handle),
503                            tx_id: header.tx_id,
504                        },
505                    })
506                }
507                0x28b34d49d327cc0d => {
508                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
509                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
510                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
511                    let control_handle = AccessPointControllerControlHandle {
512                        inner: this.inner.clone(),
513                    };
514                    Ok(AccessPointControllerRequest::StopAllAccessPoints {
515                        control_handle,
516                    })
517                }
518                _ => Err(fidl::Error::UnknownOrdinal {
519                    ordinal: header.ordinal,
520                    protocol_name: <AccessPointControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
521                }),
522            }))
523            },
524        )
525    }
526}
527
528/// AccessPointControllers allow the caller to trigger wlan state changes.  This
529/// includes whether the device will act as an access point and provide a wlan
530/// network for other co-located devices.
531#[derive(Debug)]
532pub enum AccessPointControllerRequest {
533    /// Enables wlan to initiate AccessPoint operation using the provided network
534    /// configuration, connectivity mode and band.
535    StartAccessPoint {
536        config: NetworkConfig,
537        mode: ConnectivityMode,
538        band: OperatingBand,
539        responder: AccessPointControllerStartAccessPointResponder,
540    },
541    /// Deactivate AccessPoint operation for a specified network configuration.
542    StopAccessPoint {
543        config: NetworkConfig,
544        responder: AccessPointControllerStopAccessPointResponder,
545    },
546    /// Deactivates all AccessPoints currently operating on the device.
547    StopAllAccessPoints { control_handle: AccessPointControllerControlHandle },
548}
549
550impl AccessPointControllerRequest {
551    #[allow(irrefutable_let_patterns)]
552    pub fn into_start_access_point(
553        self,
554    ) -> Option<(
555        NetworkConfig,
556        ConnectivityMode,
557        OperatingBand,
558        AccessPointControllerStartAccessPointResponder,
559    )> {
560        if let AccessPointControllerRequest::StartAccessPoint { config, mode, band, responder } =
561            self
562        {
563            Some((config, mode, band, responder))
564        } else {
565            None
566        }
567    }
568
569    #[allow(irrefutable_let_patterns)]
570    pub fn into_stop_access_point(
571        self,
572    ) -> Option<(NetworkConfig, AccessPointControllerStopAccessPointResponder)> {
573        if let AccessPointControllerRequest::StopAccessPoint { config, responder } = self {
574            Some((config, responder))
575        } else {
576            None
577        }
578    }
579
580    #[allow(irrefutable_let_patterns)]
581    pub fn into_stop_all_access_points(self) -> Option<(AccessPointControllerControlHandle)> {
582        if let AccessPointControllerRequest::StopAllAccessPoints { control_handle } = self {
583            Some((control_handle))
584        } else {
585            None
586        }
587    }
588
589    /// Name of the method defined in FIDL
590    pub fn method_name(&self) -> &'static str {
591        match *self {
592            AccessPointControllerRequest::StartAccessPoint { .. } => "start_access_point",
593            AccessPointControllerRequest::StopAccessPoint { .. } => "stop_access_point",
594            AccessPointControllerRequest::StopAllAccessPoints { .. } => "stop_all_access_points",
595        }
596    }
597}
598
599#[derive(Debug, Clone)]
600pub struct AccessPointControllerControlHandle {
601    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
602}
603
604impl fidl::endpoints::ControlHandle for AccessPointControllerControlHandle {
605    fn shutdown(&self) {
606        self.inner.shutdown()
607    }
608
609    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
610        self.inner.shutdown_with_epitaph(status)
611    }
612
613    fn is_closed(&self) -> bool {
614        self.inner.channel().is_closed()
615    }
616    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
617        self.inner.channel().on_closed()
618    }
619
620    #[cfg(target_os = "fuchsia")]
621    fn signal_peer(
622        &self,
623        clear_mask: zx::Signals,
624        set_mask: zx::Signals,
625    ) -> Result<(), zx_status::Status> {
626        use fidl::Peered;
627        self.inner.channel().signal_peer(clear_mask, set_mask)
628    }
629}
630
631impl AccessPointControllerControlHandle {}
632
633#[must_use = "FIDL methods require a response to be sent"]
634#[derive(Debug)]
635pub struct AccessPointControllerStartAccessPointResponder {
636    control_handle: std::mem::ManuallyDrop<AccessPointControllerControlHandle>,
637    tx_id: u32,
638}
639
640/// Set the the channel to be shutdown (see [`AccessPointControllerControlHandle::shutdown`])
641/// if the responder is dropped without sending a response, so that the client
642/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
643impl std::ops::Drop for AccessPointControllerStartAccessPointResponder {
644    fn drop(&mut self) {
645        self.control_handle.shutdown();
646        // Safety: drops once, never accessed again
647        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
648    }
649}
650
651impl fidl::endpoints::Responder for AccessPointControllerStartAccessPointResponder {
652    type ControlHandle = AccessPointControllerControlHandle;
653
654    fn control_handle(&self) -> &AccessPointControllerControlHandle {
655        &self.control_handle
656    }
657
658    fn drop_without_shutdown(mut self) {
659        // Safety: drops once, never accessed again due to mem::forget
660        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
661        // Prevent Drop from running (which would shut down the channel)
662        std::mem::forget(self);
663    }
664}
665
666impl AccessPointControllerStartAccessPointResponder {
667    /// Sends a response to the FIDL transaction.
668    ///
669    /// Sets the channel to shutdown if an error occurs.
670    pub fn send(self, mut status: RequestStatus) -> Result<(), fidl::Error> {
671        let _result = self.send_raw(status);
672        if _result.is_err() {
673            self.control_handle.shutdown();
674        }
675        self.drop_without_shutdown();
676        _result
677    }
678
679    /// Similar to "send" but does not shutdown the channel if an error occurs.
680    pub fn send_no_shutdown_on_err(self, mut status: RequestStatus) -> Result<(), fidl::Error> {
681        let _result = self.send_raw(status);
682        self.drop_without_shutdown();
683        _result
684    }
685
686    fn send_raw(&self, mut status: RequestStatus) -> Result<(), fidl::Error> {
687        self.control_handle.inner.send::<AccessPointControllerStartAccessPointResponse>(
688            (status,),
689            self.tx_id,
690            0x76bcb0fcf04571e7,
691            fidl::encoding::DynamicFlags::empty(),
692        )
693    }
694}
695
696#[must_use = "FIDL methods require a response to be sent"]
697#[derive(Debug)]
698pub struct AccessPointControllerStopAccessPointResponder {
699    control_handle: std::mem::ManuallyDrop<AccessPointControllerControlHandle>,
700    tx_id: u32,
701}
702
703/// Set the the channel to be shutdown (see [`AccessPointControllerControlHandle::shutdown`])
704/// if the responder is dropped without sending a response, so that the client
705/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
706impl std::ops::Drop for AccessPointControllerStopAccessPointResponder {
707    fn drop(&mut self) {
708        self.control_handle.shutdown();
709        // Safety: drops once, never accessed again
710        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
711    }
712}
713
714impl fidl::endpoints::Responder for AccessPointControllerStopAccessPointResponder {
715    type ControlHandle = AccessPointControllerControlHandle;
716
717    fn control_handle(&self) -> &AccessPointControllerControlHandle {
718        &self.control_handle
719    }
720
721    fn drop_without_shutdown(mut self) {
722        // Safety: drops once, never accessed again due to mem::forget
723        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
724        // Prevent Drop from running (which would shut down the channel)
725        std::mem::forget(self);
726    }
727}
728
729impl AccessPointControllerStopAccessPointResponder {
730    /// Sends a response to the FIDL transaction.
731    ///
732    /// Sets the channel to shutdown if an error occurs.
733    pub fn send(self, mut status: RequestStatus) -> Result<(), fidl::Error> {
734        let _result = self.send_raw(status);
735        if _result.is_err() {
736            self.control_handle.shutdown();
737        }
738        self.drop_without_shutdown();
739        _result
740    }
741
742    /// Similar to "send" but does not shutdown the channel if an error occurs.
743    pub fn send_no_shutdown_on_err(self, mut status: RequestStatus) -> Result<(), fidl::Error> {
744        let _result = self.send_raw(status);
745        self.drop_without_shutdown();
746        _result
747    }
748
749    fn send_raw(&self, mut status: RequestStatus) -> Result<(), fidl::Error> {
750        self.control_handle.inner.send::<AccessPointControllerStopAccessPointResponse>(
751            (status,),
752            self.tx_id,
753            0xb3af7e469672bad,
754            fidl::encoding::DynamicFlags::empty(),
755        )
756    }
757}
758
759#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
760pub struct AccessPointListenerMarker;
761
762impl fidl::endpoints::ProtocolMarker for AccessPointListenerMarker {
763    type Proxy = AccessPointListenerProxy;
764    type RequestStream = AccessPointListenerRequestStream;
765    #[cfg(target_os = "fuchsia")]
766    type SynchronousProxy = AccessPointListenerSynchronousProxy;
767
768    const DEBUG_NAME: &'static str = "fuchsia.wlan.policy.AccessPointListener";
769}
770impl fidl::endpoints::DiscoverableProtocolMarker for AccessPointListenerMarker {}
771
772pub trait AccessPointListenerProxyInterface: Send + Sync {
773    fn r#get_listener(
774        &self,
775        updates: fidl::endpoints::ClientEnd<AccessPointStateUpdatesMarker>,
776    ) -> Result<(), fidl::Error>;
777}
778#[derive(Debug)]
779#[cfg(target_os = "fuchsia")]
780pub struct AccessPointListenerSynchronousProxy {
781    client: fidl::client::sync::Client,
782}
783
784#[cfg(target_os = "fuchsia")]
785impl fidl::endpoints::SynchronousProxy for AccessPointListenerSynchronousProxy {
786    type Proxy = AccessPointListenerProxy;
787    type Protocol = AccessPointListenerMarker;
788
789    fn from_channel(inner: fidl::Channel) -> Self {
790        Self::new(inner)
791    }
792
793    fn into_channel(self) -> fidl::Channel {
794        self.client.into_channel()
795    }
796
797    fn as_channel(&self) -> &fidl::Channel {
798        self.client.as_channel()
799    }
800}
801
802#[cfg(target_os = "fuchsia")]
803impl AccessPointListenerSynchronousProxy {
804    pub fn new(channel: fidl::Channel) -> Self {
805        Self { client: fidl::client::sync::Client::new(channel) }
806    }
807
808    pub fn into_channel(self) -> fidl::Channel {
809        self.client.into_channel()
810    }
811
812    /// Waits until an event arrives and returns it. It is safe for other
813    /// threads to make concurrent requests while waiting for an event.
814    pub fn wait_for_event(
815        &self,
816        deadline: zx::MonotonicInstant,
817    ) -> Result<AccessPointListenerEvent, fidl::Error> {
818        AccessPointListenerEvent::decode(
819            self.client.wait_for_event::<AccessPointListenerMarker>(deadline)?,
820        )
821    }
822
823    /// Registration for callers to receive wlan access point (ap) mode state updates.
824    pub fn r#get_listener(
825        &self,
826        mut updates: fidl::endpoints::ClientEnd<AccessPointStateUpdatesMarker>,
827    ) -> Result<(), fidl::Error> {
828        self.client.send::<AccessPointListenerGetListenerRequest>(
829            (updates,),
830            0xdcb327043db0ff5,
831            fidl::encoding::DynamicFlags::empty(),
832        )
833    }
834}
835
836#[cfg(target_os = "fuchsia")]
837impl From<AccessPointListenerSynchronousProxy> for zx::NullableHandle {
838    fn from(value: AccessPointListenerSynchronousProxy) -> Self {
839        value.into_channel().into()
840    }
841}
842
843#[cfg(target_os = "fuchsia")]
844impl From<fidl::Channel> for AccessPointListenerSynchronousProxy {
845    fn from(value: fidl::Channel) -> Self {
846        Self::new(value)
847    }
848}
849
850#[cfg(target_os = "fuchsia")]
851impl fidl::endpoints::FromClient for AccessPointListenerSynchronousProxy {
852    type Protocol = AccessPointListenerMarker;
853
854    fn from_client(value: fidl::endpoints::ClientEnd<AccessPointListenerMarker>) -> Self {
855        Self::new(value.into_channel())
856    }
857}
858
859#[derive(Debug, Clone)]
860pub struct AccessPointListenerProxy {
861    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
862}
863
864impl fidl::endpoints::Proxy for AccessPointListenerProxy {
865    type Protocol = AccessPointListenerMarker;
866
867    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
868        Self::new(inner)
869    }
870
871    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
872        self.client.into_channel().map_err(|client| Self { client })
873    }
874
875    fn as_channel(&self) -> &::fidl::AsyncChannel {
876        self.client.as_channel()
877    }
878}
879
880impl AccessPointListenerProxy {
881    /// Create a new Proxy for fuchsia.wlan.policy/AccessPointListener.
882    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
883        let protocol_name =
884            <AccessPointListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
885        Self { client: fidl::client::Client::new(channel, protocol_name) }
886    }
887
888    /// Get a Stream of events from the remote end of the protocol.
889    ///
890    /// # Panics
891    ///
892    /// Panics if the event stream was already taken.
893    pub fn take_event_stream(&self) -> AccessPointListenerEventStream {
894        AccessPointListenerEventStream { event_receiver: self.client.take_event_receiver() }
895    }
896
897    /// Registration for callers to receive wlan access point (ap) mode state updates.
898    pub fn r#get_listener(
899        &self,
900        mut updates: fidl::endpoints::ClientEnd<AccessPointStateUpdatesMarker>,
901    ) -> Result<(), fidl::Error> {
902        AccessPointListenerProxyInterface::r#get_listener(self, updates)
903    }
904}
905
906impl AccessPointListenerProxyInterface for AccessPointListenerProxy {
907    fn r#get_listener(
908        &self,
909        mut updates: fidl::endpoints::ClientEnd<AccessPointStateUpdatesMarker>,
910    ) -> Result<(), fidl::Error> {
911        self.client.send::<AccessPointListenerGetListenerRequest>(
912            (updates,),
913            0xdcb327043db0ff5,
914            fidl::encoding::DynamicFlags::empty(),
915        )
916    }
917}
918
919pub struct AccessPointListenerEventStream {
920    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
921}
922
923impl std::marker::Unpin for AccessPointListenerEventStream {}
924
925impl futures::stream::FusedStream for AccessPointListenerEventStream {
926    fn is_terminated(&self) -> bool {
927        self.event_receiver.is_terminated()
928    }
929}
930
931impl futures::Stream for AccessPointListenerEventStream {
932    type Item = Result<AccessPointListenerEvent, fidl::Error>;
933
934    fn poll_next(
935        mut self: std::pin::Pin<&mut Self>,
936        cx: &mut std::task::Context<'_>,
937    ) -> std::task::Poll<Option<Self::Item>> {
938        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
939            &mut self.event_receiver,
940            cx
941        )?) {
942            Some(buf) => std::task::Poll::Ready(Some(AccessPointListenerEvent::decode(buf))),
943            None => std::task::Poll::Ready(None),
944        }
945    }
946}
947
948#[derive(Debug)]
949pub enum AccessPointListenerEvent {}
950
951impl AccessPointListenerEvent {
952    /// Decodes a message buffer as a [`AccessPointListenerEvent`].
953    fn decode(
954        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
955    ) -> Result<AccessPointListenerEvent, fidl::Error> {
956        let (bytes, _handles) = buf.split_mut();
957        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
958        debug_assert_eq!(tx_header.tx_id, 0);
959        match tx_header.ordinal {
960            _ => Err(fidl::Error::UnknownOrdinal {
961                ordinal: tx_header.ordinal,
962                protocol_name:
963                    <AccessPointListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
964            }),
965        }
966    }
967}
968
969/// A Stream of incoming requests for fuchsia.wlan.policy/AccessPointListener.
970pub struct AccessPointListenerRequestStream {
971    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
972    is_terminated: bool,
973}
974
975impl std::marker::Unpin for AccessPointListenerRequestStream {}
976
977impl futures::stream::FusedStream for AccessPointListenerRequestStream {
978    fn is_terminated(&self) -> bool {
979        self.is_terminated
980    }
981}
982
983impl fidl::endpoints::RequestStream for AccessPointListenerRequestStream {
984    type Protocol = AccessPointListenerMarker;
985    type ControlHandle = AccessPointListenerControlHandle;
986
987    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
988        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
989    }
990
991    fn control_handle(&self) -> Self::ControlHandle {
992        AccessPointListenerControlHandle { inner: self.inner.clone() }
993    }
994
995    fn into_inner(
996        self,
997    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
998    {
999        (self.inner, self.is_terminated)
1000    }
1001
1002    fn from_inner(
1003        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1004        is_terminated: bool,
1005    ) -> Self {
1006        Self { inner, is_terminated }
1007    }
1008}
1009
1010impl futures::Stream for AccessPointListenerRequestStream {
1011    type Item = Result<AccessPointListenerRequest, fidl::Error>;
1012
1013    fn poll_next(
1014        mut self: std::pin::Pin<&mut Self>,
1015        cx: &mut std::task::Context<'_>,
1016    ) -> std::task::Poll<Option<Self::Item>> {
1017        let this = &mut *self;
1018        if this.inner.check_shutdown(cx) {
1019            this.is_terminated = true;
1020            return std::task::Poll::Ready(None);
1021        }
1022        if this.is_terminated {
1023            panic!("polled AccessPointListenerRequestStream after completion");
1024        }
1025        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1026            |bytes, handles| {
1027                match this.inner.channel().read_etc(cx, bytes, handles) {
1028                    std::task::Poll::Ready(Ok(())) => {}
1029                    std::task::Poll::Pending => return std::task::Poll::Pending,
1030                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1031                        this.is_terminated = true;
1032                        return std::task::Poll::Ready(None);
1033                    }
1034                    std::task::Poll::Ready(Err(e)) => {
1035                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1036                            e.into(),
1037                        ))));
1038                    }
1039                }
1040
1041                // A message has been received from the channel
1042                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1043
1044                std::task::Poll::Ready(Some(match header.ordinal {
1045                0xdcb327043db0ff5 => {
1046                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1047                    let mut req = fidl::new_empty!(AccessPointListenerGetListenerRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1048                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessPointListenerGetListenerRequest>(&header, _body_bytes, handles, &mut req)?;
1049                    let control_handle = AccessPointListenerControlHandle {
1050                        inner: this.inner.clone(),
1051                    };
1052                    Ok(AccessPointListenerRequest::GetListener {updates: req.updates,
1053
1054                        control_handle,
1055                    })
1056                }
1057                _ => Err(fidl::Error::UnknownOrdinal {
1058                    ordinal: header.ordinal,
1059                    protocol_name: <AccessPointListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1060                }),
1061            }))
1062            },
1063        )
1064    }
1065}
1066
1067/// The AccessPointListener API provides a mechanism for callers to receive state change
1068/// updates about wlan access point operation.
1069#[derive(Debug)]
1070pub enum AccessPointListenerRequest {
1071    /// Registration for callers to receive wlan access point (ap) mode state updates.
1072    GetListener {
1073        updates: fidl::endpoints::ClientEnd<AccessPointStateUpdatesMarker>,
1074        control_handle: AccessPointListenerControlHandle,
1075    },
1076}
1077
1078impl AccessPointListenerRequest {
1079    #[allow(irrefutable_let_patterns)]
1080    pub fn into_get_listener(
1081        self,
1082    ) -> Option<(
1083        fidl::endpoints::ClientEnd<AccessPointStateUpdatesMarker>,
1084        AccessPointListenerControlHandle,
1085    )> {
1086        if let AccessPointListenerRequest::GetListener { updates, control_handle } = self {
1087            Some((updates, control_handle))
1088        } else {
1089            None
1090        }
1091    }
1092
1093    /// Name of the method defined in FIDL
1094    pub fn method_name(&self) -> &'static str {
1095        match *self {
1096            AccessPointListenerRequest::GetListener { .. } => "get_listener",
1097        }
1098    }
1099}
1100
1101#[derive(Debug, Clone)]
1102pub struct AccessPointListenerControlHandle {
1103    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1104}
1105
1106impl fidl::endpoints::ControlHandle for AccessPointListenerControlHandle {
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 AccessPointListenerControlHandle {}
1134
1135#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1136pub struct AccessPointProviderMarker;
1137
1138impl fidl::endpoints::ProtocolMarker for AccessPointProviderMarker {
1139    type Proxy = AccessPointProviderProxy;
1140    type RequestStream = AccessPointProviderRequestStream;
1141    #[cfg(target_os = "fuchsia")]
1142    type SynchronousProxy = AccessPointProviderSynchronousProxy;
1143
1144    const DEBUG_NAME: &'static str = "fuchsia.wlan.policy.AccessPointProvider";
1145}
1146impl fidl::endpoints::DiscoverableProtocolMarker for AccessPointProviderMarker {}
1147
1148pub trait AccessPointProviderProxyInterface: Send + Sync {
1149    fn r#get_controller(
1150        &self,
1151        requests: fidl::endpoints::ServerEnd<AccessPointControllerMarker>,
1152        updates: fidl::endpoints::ClientEnd<AccessPointStateUpdatesMarker>,
1153    ) -> Result<(), fidl::Error>;
1154}
1155#[derive(Debug)]
1156#[cfg(target_os = "fuchsia")]
1157pub struct AccessPointProviderSynchronousProxy {
1158    client: fidl::client::sync::Client,
1159}
1160
1161#[cfg(target_os = "fuchsia")]
1162impl fidl::endpoints::SynchronousProxy for AccessPointProviderSynchronousProxy {
1163    type Proxy = AccessPointProviderProxy;
1164    type Protocol = AccessPointProviderMarker;
1165
1166    fn from_channel(inner: fidl::Channel) -> Self {
1167        Self::new(inner)
1168    }
1169
1170    fn into_channel(self) -> fidl::Channel {
1171        self.client.into_channel()
1172    }
1173
1174    fn as_channel(&self) -> &fidl::Channel {
1175        self.client.as_channel()
1176    }
1177}
1178
1179#[cfg(target_os = "fuchsia")]
1180impl AccessPointProviderSynchronousProxy {
1181    pub fn new(channel: fidl::Channel) -> Self {
1182        Self { client: fidl::client::sync::Client::new(channel) }
1183    }
1184
1185    pub fn into_channel(self) -> fidl::Channel {
1186        self.client.into_channel()
1187    }
1188
1189    /// Waits until an event arrives and returns it. It is safe for other
1190    /// threads to make concurrent requests while waiting for an event.
1191    pub fn wait_for_event(
1192        &self,
1193        deadline: zx::MonotonicInstant,
1194    ) -> Result<AccessPointProviderEvent, fidl::Error> {
1195        AccessPointProviderEvent::decode(
1196            self.client.wait_for_event::<AccessPointProviderMarker>(deadline)?,
1197        )
1198    }
1199
1200    /// Control channel used by a single caller to trigger wlan access point (ap) mode
1201    /// state changes.  The caller also provides a channel to receive wlan ap updates.
1202    /// Only one caller can have the control channel open at a time.  Attempts to
1203    /// register as a controller while there is an active control registration
1204    /// will result in the new caller's provided channel being closed.
1205    pub fn r#get_controller(
1206        &self,
1207        mut requests: fidl::endpoints::ServerEnd<AccessPointControllerMarker>,
1208        mut updates: fidl::endpoints::ClientEnd<AccessPointStateUpdatesMarker>,
1209    ) -> Result<(), fidl::Error> {
1210        self.client.send::<AccessPointProviderGetControllerRequest>(
1211            (requests, updates),
1212            0x3359994735e906fc,
1213            fidl::encoding::DynamicFlags::empty(),
1214        )
1215    }
1216}
1217
1218#[cfg(target_os = "fuchsia")]
1219impl From<AccessPointProviderSynchronousProxy> for zx::NullableHandle {
1220    fn from(value: AccessPointProviderSynchronousProxy) -> Self {
1221        value.into_channel().into()
1222    }
1223}
1224
1225#[cfg(target_os = "fuchsia")]
1226impl From<fidl::Channel> for AccessPointProviderSynchronousProxy {
1227    fn from(value: fidl::Channel) -> Self {
1228        Self::new(value)
1229    }
1230}
1231
1232#[cfg(target_os = "fuchsia")]
1233impl fidl::endpoints::FromClient for AccessPointProviderSynchronousProxy {
1234    type Protocol = AccessPointProviderMarker;
1235
1236    fn from_client(value: fidl::endpoints::ClientEnd<AccessPointProviderMarker>) -> Self {
1237        Self::new(value.into_channel())
1238    }
1239}
1240
1241#[derive(Debug, Clone)]
1242pub struct AccessPointProviderProxy {
1243    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1244}
1245
1246impl fidl::endpoints::Proxy for AccessPointProviderProxy {
1247    type Protocol = AccessPointProviderMarker;
1248
1249    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1250        Self::new(inner)
1251    }
1252
1253    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1254        self.client.into_channel().map_err(|client| Self { client })
1255    }
1256
1257    fn as_channel(&self) -> &::fidl::AsyncChannel {
1258        self.client.as_channel()
1259    }
1260}
1261
1262impl AccessPointProviderProxy {
1263    /// Create a new Proxy for fuchsia.wlan.policy/AccessPointProvider.
1264    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1265        let protocol_name =
1266            <AccessPointProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1267        Self { client: fidl::client::Client::new(channel, protocol_name) }
1268    }
1269
1270    /// Get a Stream of events from the remote end of the protocol.
1271    ///
1272    /// # Panics
1273    ///
1274    /// Panics if the event stream was already taken.
1275    pub fn take_event_stream(&self) -> AccessPointProviderEventStream {
1276        AccessPointProviderEventStream { event_receiver: self.client.take_event_receiver() }
1277    }
1278
1279    /// Control channel used by a single caller to trigger wlan access point (ap) mode
1280    /// state changes.  The caller also provides a channel to receive wlan ap updates.
1281    /// Only one caller can have the control channel open at a time.  Attempts to
1282    /// register as a controller while there is an active control registration
1283    /// will result in the new caller's provided channel being closed.
1284    pub fn r#get_controller(
1285        &self,
1286        mut requests: fidl::endpoints::ServerEnd<AccessPointControllerMarker>,
1287        mut updates: fidl::endpoints::ClientEnd<AccessPointStateUpdatesMarker>,
1288    ) -> Result<(), fidl::Error> {
1289        AccessPointProviderProxyInterface::r#get_controller(self, requests, updates)
1290    }
1291}
1292
1293impl AccessPointProviderProxyInterface for AccessPointProviderProxy {
1294    fn r#get_controller(
1295        &self,
1296        mut requests: fidl::endpoints::ServerEnd<AccessPointControllerMarker>,
1297        mut updates: fidl::endpoints::ClientEnd<AccessPointStateUpdatesMarker>,
1298    ) -> Result<(), fidl::Error> {
1299        self.client.send::<AccessPointProviderGetControllerRequest>(
1300            (requests, updates),
1301            0x3359994735e906fc,
1302            fidl::encoding::DynamicFlags::empty(),
1303        )
1304    }
1305}
1306
1307pub struct AccessPointProviderEventStream {
1308    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1309}
1310
1311impl std::marker::Unpin for AccessPointProviderEventStream {}
1312
1313impl futures::stream::FusedStream for AccessPointProviderEventStream {
1314    fn is_terminated(&self) -> bool {
1315        self.event_receiver.is_terminated()
1316    }
1317}
1318
1319impl futures::Stream for AccessPointProviderEventStream {
1320    type Item = Result<AccessPointProviderEvent, fidl::Error>;
1321
1322    fn poll_next(
1323        mut self: std::pin::Pin<&mut Self>,
1324        cx: &mut std::task::Context<'_>,
1325    ) -> std::task::Poll<Option<Self::Item>> {
1326        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1327            &mut self.event_receiver,
1328            cx
1329        )?) {
1330            Some(buf) => std::task::Poll::Ready(Some(AccessPointProviderEvent::decode(buf))),
1331            None => std::task::Poll::Ready(None),
1332        }
1333    }
1334}
1335
1336#[derive(Debug)]
1337pub enum AccessPointProviderEvent {}
1338
1339impl AccessPointProviderEvent {
1340    /// Decodes a message buffer as a [`AccessPointProviderEvent`].
1341    fn decode(
1342        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1343    ) -> Result<AccessPointProviderEvent, fidl::Error> {
1344        let (bytes, _handles) = buf.split_mut();
1345        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1346        debug_assert_eq!(tx_header.tx_id, 0);
1347        match tx_header.ordinal {
1348            _ => Err(fidl::Error::UnknownOrdinal {
1349                ordinal: tx_header.ordinal,
1350                protocol_name:
1351                    <AccessPointProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1352            }),
1353        }
1354    }
1355}
1356
1357/// A Stream of incoming requests for fuchsia.wlan.policy/AccessPointProvider.
1358pub struct AccessPointProviderRequestStream {
1359    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1360    is_terminated: bool,
1361}
1362
1363impl std::marker::Unpin for AccessPointProviderRequestStream {}
1364
1365impl futures::stream::FusedStream for AccessPointProviderRequestStream {
1366    fn is_terminated(&self) -> bool {
1367        self.is_terminated
1368    }
1369}
1370
1371impl fidl::endpoints::RequestStream for AccessPointProviderRequestStream {
1372    type Protocol = AccessPointProviderMarker;
1373    type ControlHandle = AccessPointProviderControlHandle;
1374
1375    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1376        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1377    }
1378
1379    fn control_handle(&self) -> Self::ControlHandle {
1380        AccessPointProviderControlHandle { inner: self.inner.clone() }
1381    }
1382
1383    fn into_inner(
1384        self,
1385    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1386    {
1387        (self.inner, self.is_terminated)
1388    }
1389
1390    fn from_inner(
1391        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1392        is_terminated: bool,
1393    ) -> Self {
1394        Self { inner, is_terminated }
1395    }
1396}
1397
1398impl futures::Stream for AccessPointProviderRequestStream {
1399    type Item = Result<AccessPointProviderRequest, fidl::Error>;
1400
1401    fn poll_next(
1402        mut self: std::pin::Pin<&mut Self>,
1403        cx: &mut std::task::Context<'_>,
1404    ) -> std::task::Poll<Option<Self::Item>> {
1405        let this = &mut *self;
1406        if this.inner.check_shutdown(cx) {
1407            this.is_terminated = true;
1408            return std::task::Poll::Ready(None);
1409        }
1410        if this.is_terminated {
1411            panic!("polled AccessPointProviderRequestStream after completion");
1412        }
1413        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1414            |bytes, handles| {
1415                match this.inner.channel().read_etc(cx, bytes, handles) {
1416                    std::task::Poll::Ready(Ok(())) => {}
1417                    std::task::Poll::Pending => return std::task::Poll::Pending,
1418                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1419                        this.is_terminated = true;
1420                        return std::task::Poll::Ready(None);
1421                    }
1422                    std::task::Poll::Ready(Err(e)) => {
1423                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1424                            e.into(),
1425                        ))));
1426                    }
1427                }
1428
1429                // A message has been received from the channel
1430                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1431
1432                std::task::Poll::Ready(Some(match header.ordinal {
1433                0x3359994735e906fc => {
1434                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1435                    let mut req = fidl::new_empty!(AccessPointProviderGetControllerRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1436                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessPointProviderGetControllerRequest>(&header, _body_bytes, handles, &mut req)?;
1437                    let control_handle = AccessPointProviderControlHandle {
1438                        inner: this.inner.clone(),
1439                    };
1440                    Ok(AccessPointProviderRequest::GetController {requests: req.requests,
1441updates: req.updates,
1442
1443                        control_handle,
1444                    })
1445                }
1446                _ => Err(fidl::Error::UnknownOrdinal {
1447                    ordinal: header.ordinal,
1448                    protocol_name: <AccessPointProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1449                }),
1450            }))
1451            },
1452        )
1453    }
1454}
1455
1456/// The AccessPointProvider API provides a mechanism for access point
1457/// control and is intended to be called by applications or entities representing
1458/// the user (ex, Settings). This API is not intended to be called by other
1459/// applications to change wlan state without explicit user control.
1460///
1461/// The second aim of this API design is to eliminate the "last-caller wins"
1462/// paradigm by limiting the number of controlling applications.  A single caller
1463/// at a time is permitted to make API calls that impact wlan state.
1464#[derive(Debug)]
1465pub enum AccessPointProviderRequest {
1466    /// Control channel used by a single caller to trigger wlan access point (ap) mode
1467    /// state changes.  The caller also provides a channel to receive wlan ap updates.
1468    /// Only one caller can have the control channel open at a time.  Attempts to
1469    /// register as a controller while there is an active control registration
1470    /// will result in the new caller's provided channel being closed.
1471    GetController {
1472        requests: fidl::endpoints::ServerEnd<AccessPointControllerMarker>,
1473        updates: fidl::endpoints::ClientEnd<AccessPointStateUpdatesMarker>,
1474        control_handle: AccessPointProviderControlHandle,
1475    },
1476}
1477
1478impl AccessPointProviderRequest {
1479    #[allow(irrefutable_let_patterns)]
1480    pub fn into_get_controller(
1481        self,
1482    ) -> Option<(
1483        fidl::endpoints::ServerEnd<AccessPointControllerMarker>,
1484        fidl::endpoints::ClientEnd<AccessPointStateUpdatesMarker>,
1485        AccessPointProviderControlHandle,
1486    )> {
1487        if let AccessPointProviderRequest::GetController { requests, updates, control_handle } =
1488            self
1489        {
1490            Some((requests, updates, control_handle))
1491        } else {
1492            None
1493        }
1494    }
1495
1496    /// Name of the method defined in FIDL
1497    pub fn method_name(&self) -> &'static str {
1498        match *self {
1499            AccessPointProviderRequest::GetController { .. } => "get_controller",
1500        }
1501    }
1502}
1503
1504#[derive(Debug, Clone)]
1505pub struct AccessPointProviderControlHandle {
1506    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1507}
1508
1509impl fidl::endpoints::ControlHandle for AccessPointProviderControlHandle {
1510    fn shutdown(&self) {
1511        self.inner.shutdown()
1512    }
1513
1514    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1515        self.inner.shutdown_with_epitaph(status)
1516    }
1517
1518    fn is_closed(&self) -> bool {
1519        self.inner.channel().is_closed()
1520    }
1521    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1522        self.inner.channel().on_closed()
1523    }
1524
1525    #[cfg(target_os = "fuchsia")]
1526    fn signal_peer(
1527        &self,
1528        clear_mask: zx::Signals,
1529        set_mask: zx::Signals,
1530    ) -> Result<(), zx_status::Status> {
1531        use fidl::Peered;
1532        self.inner.channel().signal_peer(clear_mask, set_mask)
1533    }
1534}
1535
1536impl AccessPointProviderControlHandle {}
1537
1538#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1539pub struct AccessPointStateUpdatesMarker;
1540
1541impl fidl::endpoints::ProtocolMarker for AccessPointStateUpdatesMarker {
1542    type Proxy = AccessPointStateUpdatesProxy;
1543    type RequestStream = AccessPointStateUpdatesRequestStream;
1544    #[cfg(target_os = "fuchsia")]
1545    type SynchronousProxy = AccessPointStateUpdatesSynchronousProxy;
1546
1547    const DEBUG_NAME: &'static str = "(anonymous) AccessPointStateUpdates";
1548}
1549
1550pub trait AccessPointStateUpdatesProxyInterface: Send + Sync {
1551    type OnAccessPointStateUpdateResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
1552        + Send;
1553    fn r#on_access_point_state_update(
1554        &self,
1555        access_points: &[AccessPointState],
1556    ) -> Self::OnAccessPointStateUpdateResponseFut;
1557}
1558#[derive(Debug)]
1559#[cfg(target_os = "fuchsia")]
1560pub struct AccessPointStateUpdatesSynchronousProxy {
1561    client: fidl::client::sync::Client,
1562}
1563
1564#[cfg(target_os = "fuchsia")]
1565impl fidl::endpoints::SynchronousProxy for AccessPointStateUpdatesSynchronousProxy {
1566    type Proxy = AccessPointStateUpdatesProxy;
1567    type Protocol = AccessPointStateUpdatesMarker;
1568
1569    fn from_channel(inner: fidl::Channel) -> Self {
1570        Self::new(inner)
1571    }
1572
1573    fn into_channel(self) -> fidl::Channel {
1574        self.client.into_channel()
1575    }
1576
1577    fn as_channel(&self) -> &fidl::Channel {
1578        self.client.as_channel()
1579    }
1580}
1581
1582#[cfg(target_os = "fuchsia")]
1583impl AccessPointStateUpdatesSynchronousProxy {
1584    pub fn new(channel: fidl::Channel) -> Self {
1585        Self { client: fidl::client::sync::Client::new(channel) }
1586    }
1587
1588    pub fn into_channel(self) -> fidl::Channel {
1589        self.client.into_channel()
1590    }
1591
1592    /// Waits until an event arrives and returns it. It is safe for other
1593    /// threads to make concurrent requests while waiting for an event.
1594    pub fn wait_for_event(
1595        &self,
1596        deadline: zx::MonotonicInstant,
1597    ) -> Result<AccessPointStateUpdatesEvent, fidl::Error> {
1598        AccessPointStateUpdatesEvent::decode(
1599            self.client.wait_for_event::<AccessPointStateUpdatesMarker>(deadline)?,
1600        )
1601    }
1602
1603    /// Updates registered listeners with the current summary of wlan access point
1604    /// operating states.  This will be called when there are changes with active
1605    /// access point networks - both the number of access points and their
1606    /// individual activity.  Registered listeners are responsible for deciding
1607    /// what information has changed (this is dependent on when they last
1608    /// acknowledged the update).
1609    pub fn r#on_access_point_state_update(
1610        &self,
1611        mut access_points: &[AccessPointState],
1612        ___deadline: zx::MonotonicInstant,
1613    ) -> Result<(), fidl::Error> {
1614        let _response = self.client.send_query::<
1615            AccessPointStateUpdatesOnAccessPointStateUpdateRequest,
1616            fidl::encoding::EmptyPayload,
1617            AccessPointStateUpdatesMarker,
1618        >(
1619            (access_points,),
1620            0x116bf900a0216f4c,
1621            fidl::encoding::DynamicFlags::empty(),
1622            ___deadline,
1623        )?;
1624        Ok(_response)
1625    }
1626}
1627
1628#[cfg(target_os = "fuchsia")]
1629impl From<AccessPointStateUpdatesSynchronousProxy> for zx::NullableHandle {
1630    fn from(value: AccessPointStateUpdatesSynchronousProxy) -> Self {
1631        value.into_channel().into()
1632    }
1633}
1634
1635#[cfg(target_os = "fuchsia")]
1636impl From<fidl::Channel> for AccessPointStateUpdatesSynchronousProxy {
1637    fn from(value: fidl::Channel) -> Self {
1638        Self::new(value)
1639    }
1640}
1641
1642#[cfg(target_os = "fuchsia")]
1643impl fidl::endpoints::FromClient for AccessPointStateUpdatesSynchronousProxy {
1644    type Protocol = AccessPointStateUpdatesMarker;
1645
1646    fn from_client(value: fidl::endpoints::ClientEnd<AccessPointStateUpdatesMarker>) -> Self {
1647        Self::new(value.into_channel())
1648    }
1649}
1650
1651#[derive(Debug, Clone)]
1652pub struct AccessPointStateUpdatesProxy {
1653    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1654}
1655
1656impl fidl::endpoints::Proxy for AccessPointStateUpdatesProxy {
1657    type Protocol = AccessPointStateUpdatesMarker;
1658
1659    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1660        Self::new(inner)
1661    }
1662
1663    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1664        self.client.into_channel().map_err(|client| Self { client })
1665    }
1666
1667    fn as_channel(&self) -> &::fidl::AsyncChannel {
1668        self.client.as_channel()
1669    }
1670}
1671
1672impl AccessPointStateUpdatesProxy {
1673    /// Create a new Proxy for fuchsia.wlan.policy/AccessPointStateUpdates.
1674    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1675        let protocol_name =
1676            <AccessPointStateUpdatesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1677        Self { client: fidl::client::Client::new(channel, protocol_name) }
1678    }
1679
1680    /// Get a Stream of events from the remote end of the protocol.
1681    ///
1682    /// # Panics
1683    ///
1684    /// Panics if the event stream was already taken.
1685    pub fn take_event_stream(&self) -> AccessPointStateUpdatesEventStream {
1686        AccessPointStateUpdatesEventStream { event_receiver: self.client.take_event_receiver() }
1687    }
1688
1689    /// Updates registered listeners with the current summary of wlan access point
1690    /// operating states.  This will be called when there are changes with active
1691    /// access point networks - both the number of access points and their
1692    /// individual activity.  Registered listeners are responsible for deciding
1693    /// what information has changed (this is dependent on when they last
1694    /// acknowledged the update).
1695    pub fn r#on_access_point_state_update(
1696        &self,
1697        mut access_points: &[AccessPointState],
1698    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1699        AccessPointStateUpdatesProxyInterface::r#on_access_point_state_update(self, access_points)
1700    }
1701}
1702
1703impl AccessPointStateUpdatesProxyInterface for AccessPointStateUpdatesProxy {
1704    type OnAccessPointStateUpdateResponseFut =
1705        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1706    fn r#on_access_point_state_update(
1707        &self,
1708        mut access_points: &[AccessPointState],
1709    ) -> Self::OnAccessPointStateUpdateResponseFut {
1710        fn _decode(
1711            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1712        ) -> Result<(), fidl::Error> {
1713            let _response = fidl::client::decode_transaction_body::<
1714                fidl::encoding::EmptyPayload,
1715                fidl::encoding::DefaultFuchsiaResourceDialect,
1716                0x116bf900a0216f4c,
1717            >(_buf?)?;
1718            Ok(_response)
1719        }
1720        self.client
1721            .send_query_and_decode::<AccessPointStateUpdatesOnAccessPointStateUpdateRequest, ()>(
1722                (access_points,),
1723                0x116bf900a0216f4c,
1724                fidl::encoding::DynamicFlags::empty(),
1725                _decode,
1726            )
1727    }
1728}
1729
1730pub struct AccessPointStateUpdatesEventStream {
1731    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1732}
1733
1734impl std::marker::Unpin for AccessPointStateUpdatesEventStream {}
1735
1736impl futures::stream::FusedStream for AccessPointStateUpdatesEventStream {
1737    fn is_terminated(&self) -> bool {
1738        self.event_receiver.is_terminated()
1739    }
1740}
1741
1742impl futures::Stream for AccessPointStateUpdatesEventStream {
1743    type Item = Result<AccessPointStateUpdatesEvent, fidl::Error>;
1744
1745    fn poll_next(
1746        mut self: std::pin::Pin<&mut Self>,
1747        cx: &mut std::task::Context<'_>,
1748    ) -> std::task::Poll<Option<Self::Item>> {
1749        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1750            &mut self.event_receiver,
1751            cx
1752        )?) {
1753            Some(buf) => std::task::Poll::Ready(Some(AccessPointStateUpdatesEvent::decode(buf))),
1754            None => std::task::Poll::Ready(None),
1755        }
1756    }
1757}
1758
1759#[derive(Debug)]
1760pub enum AccessPointStateUpdatesEvent {}
1761
1762impl AccessPointStateUpdatesEvent {
1763    /// Decodes a message buffer as a [`AccessPointStateUpdatesEvent`].
1764    fn decode(
1765        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1766    ) -> Result<AccessPointStateUpdatesEvent, fidl::Error> {
1767        let (bytes, _handles) = buf.split_mut();
1768        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1769        debug_assert_eq!(tx_header.tx_id, 0);
1770        match tx_header.ordinal {
1771            _ => Err(fidl::Error::UnknownOrdinal {
1772                ordinal: tx_header.ordinal,
1773                protocol_name:
1774                    <AccessPointStateUpdatesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1775            }),
1776        }
1777    }
1778}
1779
1780/// A Stream of incoming requests for fuchsia.wlan.policy/AccessPointStateUpdates.
1781pub struct AccessPointStateUpdatesRequestStream {
1782    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1783    is_terminated: bool,
1784}
1785
1786impl std::marker::Unpin for AccessPointStateUpdatesRequestStream {}
1787
1788impl futures::stream::FusedStream for AccessPointStateUpdatesRequestStream {
1789    fn is_terminated(&self) -> bool {
1790        self.is_terminated
1791    }
1792}
1793
1794impl fidl::endpoints::RequestStream for AccessPointStateUpdatesRequestStream {
1795    type Protocol = AccessPointStateUpdatesMarker;
1796    type ControlHandle = AccessPointStateUpdatesControlHandle;
1797
1798    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1799        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1800    }
1801
1802    fn control_handle(&self) -> Self::ControlHandle {
1803        AccessPointStateUpdatesControlHandle { inner: self.inner.clone() }
1804    }
1805
1806    fn into_inner(
1807        self,
1808    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1809    {
1810        (self.inner, self.is_terminated)
1811    }
1812
1813    fn from_inner(
1814        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1815        is_terminated: bool,
1816    ) -> Self {
1817        Self { inner, is_terminated }
1818    }
1819}
1820
1821impl futures::Stream for AccessPointStateUpdatesRequestStream {
1822    type Item = Result<AccessPointStateUpdatesRequest, fidl::Error>;
1823
1824    fn poll_next(
1825        mut self: std::pin::Pin<&mut Self>,
1826        cx: &mut std::task::Context<'_>,
1827    ) -> std::task::Poll<Option<Self::Item>> {
1828        let this = &mut *self;
1829        if this.inner.check_shutdown(cx) {
1830            this.is_terminated = true;
1831            return std::task::Poll::Ready(None);
1832        }
1833        if this.is_terminated {
1834            panic!("polled AccessPointStateUpdatesRequestStream after completion");
1835        }
1836        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1837            |bytes, handles| {
1838                match this.inner.channel().read_etc(cx, bytes, handles) {
1839                    std::task::Poll::Ready(Ok(())) => {}
1840                    std::task::Poll::Pending => return std::task::Poll::Pending,
1841                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1842                        this.is_terminated = true;
1843                        return std::task::Poll::Ready(None);
1844                    }
1845                    std::task::Poll::Ready(Err(e)) => {
1846                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1847                            e.into(),
1848                        ))));
1849                    }
1850                }
1851
1852                // A message has been received from the channel
1853                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1854
1855                std::task::Poll::Ready(Some(match header.ordinal {
1856                0x116bf900a0216f4c => {
1857                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1858                    let mut req = fidl::new_empty!(AccessPointStateUpdatesOnAccessPointStateUpdateRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1859                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AccessPointStateUpdatesOnAccessPointStateUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
1860                    let control_handle = AccessPointStateUpdatesControlHandle {
1861                        inner: this.inner.clone(),
1862                    };
1863                    Ok(AccessPointStateUpdatesRequest::OnAccessPointStateUpdate {access_points: req.access_points,
1864
1865                        responder: AccessPointStateUpdatesOnAccessPointStateUpdateResponder {
1866                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1867                            tx_id: header.tx_id,
1868                        },
1869                    })
1870                }
1871                _ => Err(fidl::Error::UnknownOrdinal {
1872                    ordinal: header.ordinal,
1873                    protocol_name: <AccessPointStateUpdatesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1874                }),
1875            }))
1876            },
1877        )
1878    }
1879}
1880
1881/// AccessPoint operation status changes along with associated connection status.
1882#[derive(Debug)]
1883pub enum AccessPointStateUpdatesRequest {
1884    /// Updates registered listeners with the current summary of wlan access point
1885    /// operating states.  This will be called when there are changes with active
1886    /// access point networks - both the number of access points and their
1887    /// individual activity.  Registered listeners are responsible for deciding
1888    /// what information has changed (this is dependent on when they last
1889    /// acknowledged the update).
1890    OnAccessPointStateUpdate {
1891        access_points: Vec<AccessPointState>,
1892        responder: AccessPointStateUpdatesOnAccessPointStateUpdateResponder,
1893    },
1894}
1895
1896impl AccessPointStateUpdatesRequest {
1897    #[allow(irrefutable_let_patterns)]
1898    pub fn into_on_access_point_state_update(
1899        self,
1900    ) -> Option<(Vec<AccessPointState>, AccessPointStateUpdatesOnAccessPointStateUpdateResponder)>
1901    {
1902        if let AccessPointStateUpdatesRequest::OnAccessPointStateUpdate {
1903            access_points,
1904            responder,
1905        } = self
1906        {
1907            Some((access_points, responder))
1908        } else {
1909            None
1910        }
1911    }
1912
1913    /// Name of the method defined in FIDL
1914    pub fn method_name(&self) -> &'static str {
1915        match *self {
1916            AccessPointStateUpdatesRequest::OnAccessPointStateUpdate { .. } => {
1917                "on_access_point_state_update"
1918            }
1919        }
1920    }
1921}
1922
1923#[derive(Debug, Clone)]
1924pub struct AccessPointStateUpdatesControlHandle {
1925    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1926}
1927
1928impl fidl::endpoints::ControlHandle for AccessPointStateUpdatesControlHandle {
1929    fn shutdown(&self) {
1930        self.inner.shutdown()
1931    }
1932
1933    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1934        self.inner.shutdown_with_epitaph(status)
1935    }
1936
1937    fn is_closed(&self) -> bool {
1938        self.inner.channel().is_closed()
1939    }
1940    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1941        self.inner.channel().on_closed()
1942    }
1943
1944    #[cfg(target_os = "fuchsia")]
1945    fn signal_peer(
1946        &self,
1947        clear_mask: zx::Signals,
1948        set_mask: zx::Signals,
1949    ) -> Result<(), zx_status::Status> {
1950        use fidl::Peered;
1951        self.inner.channel().signal_peer(clear_mask, set_mask)
1952    }
1953}
1954
1955impl AccessPointStateUpdatesControlHandle {}
1956
1957#[must_use = "FIDL methods require a response to be sent"]
1958#[derive(Debug)]
1959pub struct AccessPointStateUpdatesOnAccessPointStateUpdateResponder {
1960    control_handle: std::mem::ManuallyDrop<AccessPointStateUpdatesControlHandle>,
1961    tx_id: u32,
1962}
1963
1964/// Set the the channel to be shutdown (see [`AccessPointStateUpdatesControlHandle::shutdown`])
1965/// if the responder is dropped without sending a response, so that the client
1966/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1967impl std::ops::Drop for AccessPointStateUpdatesOnAccessPointStateUpdateResponder {
1968    fn drop(&mut self) {
1969        self.control_handle.shutdown();
1970        // Safety: drops once, never accessed again
1971        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1972    }
1973}
1974
1975impl fidl::endpoints::Responder for AccessPointStateUpdatesOnAccessPointStateUpdateResponder {
1976    type ControlHandle = AccessPointStateUpdatesControlHandle;
1977
1978    fn control_handle(&self) -> &AccessPointStateUpdatesControlHandle {
1979        &self.control_handle
1980    }
1981
1982    fn drop_without_shutdown(mut self) {
1983        // Safety: drops once, never accessed again due to mem::forget
1984        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1985        // Prevent Drop from running (which would shut down the channel)
1986        std::mem::forget(self);
1987    }
1988}
1989
1990impl AccessPointStateUpdatesOnAccessPointStateUpdateResponder {
1991    /// Sends a response to the FIDL transaction.
1992    ///
1993    /// Sets the channel to shutdown if an error occurs.
1994    pub fn send(self) -> Result<(), fidl::Error> {
1995        let _result = self.send_raw();
1996        if _result.is_err() {
1997            self.control_handle.shutdown();
1998        }
1999        self.drop_without_shutdown();
2000        _result
2001    }
2002
2003    /// Similar to "send" but does not shutdown the channel if an error occurs.
2004    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2005        let _result = self.send_raw();
2006        self.drop_without_shutdown();
2007        _result
2008    }
2009
2010    fn send_raw(&self) -> Result<(), fidl::Error> {
2011        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2012            (),
2013            self.tx_id,
2014            0x116bf900a0216f4c,
2015            fidl::encoding::DynamicFlags::empty(),
2016        )
2017    }
2018}
2019
2020#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2021pub struct ClientControllerMarker;
2022
2023impl fidl::endpoints::ProtocolMarker for ClientControllerMarker {
2024    type Proxy = ClientControllerProxy;
2025    type RequestStream = ClientControllerRequestStream;
2026    #[cfg(target_os = "fuchsia")]
2027    type SynchronousProxy = ClientControllerSynchronousProxy;
2028
2029    const DEBUG_NAME: &'static str = "(anonymous) ClientController";
2030}
2031pub type ClientControllerSaveNetworkResult = Result<(), NetworkConfigChangeError>;
2032pub type ClientControllerRemoveNetworkResult = Result<(), NetworkConfigChangeError>;
2033
2034pub trait ClientControllerProxyInterface: Send + Sync {
2035    type StartClientConnectionsResponseFut: std::future::Future<Output = Result<RequestStatus, fidl::Error>>
2036        + Send;
2037    fn r#start_client_connections(&self) -> Self::StartClientConnectionsResponseFut;
2038    type StopClientConnectionsResponseFut: std::future::Future<Output = Result<RequestStatus, fidl::Error>>
2039        + Send;
2040    fn r#stop_client_connections(&self) -> Self::StopClientConnectionsResponseFut;
2041    fn r#scan_for_networks(
2042        &self,
2043        iterator: fidl::endpoints::ServerEnd<ScanResultIteratorMarker>,
2044    ) -> Result<(), fidl::Error>;
2045    type SaveNetworkResponseFut: std::future::Future<Output = Result<ClientControllerSaveNetworkResult, fidl::Error>>
2046        + Send;
2047    fn r#save_network(&self, config: &NetworkConfig) -> Self::SaveNetworkResponseFut;
2048    type RemoveNetworkResponseFut: std::future::Future<Output = Result<ClientControllerRemoveNetworkResult, fidl::Error>>
2049        + Send;
2050    fn r#remove_network(&self, config: &NetworkConfig) -> Self::RemoveNetworkResponseFut;
2051    fn r#get_saved_networks(
2052        &self,
2053        iterator: fidl::endpoints::ServerEnd<NetworkConfigIteratorMarker>,
2054    ) -> Result<(), fidl::Error>;
2055    type ConnectResponseFut: std::future::Future<Output = Result<RequestStatus, fidl::Error>> + Send;
2056    fn r#connect(&self, id: &NetworkIdentifier) -> Self::ConnectResponseFut;
2057}
2058#[derive(Debug)]
2059#[cfg(target_os = "fuchsia")]
2060pub struct ClientControllerSynchronousProxy {
2061    client: fidl::client::sync::Client,
2062}
2063
2064#[cfg(target_os = "fuchsia")]
2065impl fidl::endpoints::SynchronousProxy for ClientControllerSynchronousProxy {
2066    type Proxy = ClientControllerProxy;
2067    type Protocol = ClientControllerMarker;
2068
2069    fn from_channel(inner: fidl::Channel) -> Self {
2070        Self::new(inner)
2071    }
2072
2073    fn into_channel(self) -> fidl::Channel {
2074        self.client.into_channel()
2075    }
2076
2077    fn as_channel(&self) -> &fidl::Channel {
2078        self.client.as_channel()
2079    }
2080}
2081
2082#[cfg(target_os = "fuchsia")]
2083impl ClientControllerSynchronousProxy {
2084    pub fn new(channel: fidl::Channel) -> Self {
2085        Self { client: fidl::client::sync::Client::new(channel) }
2086    }
2087
2088    pub fn into_channel(self) -> fidl::Channel {
2089        self.client.into_channel()
2090    }
2091
2092    /// Waits until an event arrives and returns it. It is safe for other
2093    /// threads to make concurrent requests while waiting for an event.
2094    pub fn wait_for_event(
2095        &self,
2096        deadline: zx::MonotonicInstant,
2097    ) -> Result<ClientControllerEvent, fidl::Error> {
2098        ClientControllerEvent::decode(
2099            self.client.wait_for_event::<ClientControllerMarker>(deadline)?,
2100        )
2101    }
2102
2103    /// Enables WLAN client functionality. Once enabled, automatic connections will be
2104    /// attempted for saved networks, and callers can initiate operations via the
2105    /// ScanForNetworks() and Connect() APIs.
2106    /// Depending on the underlying capabilities of the device, this call may impact
2107    /// other device operation (for example, acting as an access point).
2108    /// The returned status represents acknowledgement of the request.  The
2109    /// ClientListener protocol should be monitored to learn when client functionality
2110    /// has been enabled.
2111    pub fn r#start_client_connections(
2112        &self,
2113        ___deadline: zx::MonotonicInstant,
2114    ) -> Result<RequestStatus, fidl::Error> {
2115        let _response = self.client.send_query::<
2116            fidl::encoding::EmptyPayload,
2117            ClientControllerStartClientConnectionsResponse,
2118            ClientControllerMarker,
2119        >(
2120            (),
2121            0x7e128a21ebe53e30,
2122            fidl::encoding::DynamicFlags::empty(),
2123            ___deadline,
2124        )?;
2125        Ok(_response.status)
2126    }
2127
2128    /// Tears down any existing connections to wlan networks and disables initiation of
2129    /// new connections.
2130    /// The returned status represents acknowledgements of the request.  The
2131    /// ClientListener protocol should be monitored to learn when client functionality
2132    /// has been disabled.
2133    pub fn r#stop_client_connections(
2134        &self,
2135        ___deadline: zx::MonotonicInstant,
2136    ) -> Result<RequestStatus, fidl::Error> {
2137        let _response = self.client.send_query::<
2138            fidl::encoding::EmptyPayload,
2139            ClientControllerStopClientConnectionsResponse,
2140            ClientControllerMarker,
2141        >(
2142            (),
2143            0x2b1d6dec002789e9,
2144            fidl::encoding::DynamicFlags::empty(),
2145            ___deadline,
2146        )?;
2147        Ok(_response.status)
2148    }
2149
2150    /// Triggers a network scan.  Note, even in normal operation, some scan requests
2151    /// may be rejected due to timing with connection establishment or other critical
2152    /// connection maintenance.  If the scan is cancelled or errors, the caller is
2153    /// notified via a status update in the ScanResultIterator.
2154    /// In the current implementation, client connections must be started for a scan
2155    /// to be performed.
2156    pub fn r#scan_for_networks(
2157        &self,
2158        mut iterator: fidl::endpoints::ServerEnd<ScanResultIteratorMarker>,
2159    ) -> Result<(), fidl::Error> {
2160        self.client.send::<ClientControllerScanForNetworksRequest>(
2161            (iterator,),
2162            0x1a504b9c17efb993,
2163            fidl::encoding::DynamicFlags::empty(),
2164        )
2165    }
2166
2167    /// Saves a network and any credential information needed to connect.  Multiple
2168    /// entries for the same NetworkIdentifier can exist if the credentials are
2169    /// different.  If a caller attempts to save a NetworkConfig with the same
2170    /// NetworkIdentifier and same Credentials as a previously saved network
2171    /// the method will effectively be a no-op. Saved networks will be used to
2172    /// autoconnect, and are also available to use with the Connect() API.
2173    pub fn r#save_network(
2174        &self,
2175        mut config: &NetworkConfig,
2176        ___deadline: zx::MonotonicInstant,
2177    ) -> Result<ClientControllerSaveNetworkResult, fidl::Error> {
2178        let _response = self.client.send_query::<
2179            ClientControllerSaveNetworkRequest,
2180            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, NetworkConfigChangeError>,
2181            ClientControllerMarker,
2182        >(
2183            (config,),
2184            0x7e0f216194795aa6,
2185            fidl::encoding::DynamicFlags::empty(),
2186            ___deadline,
2187        )?;
2188        Ok(_response.map(|x| x))
2189    }
2190
2191    /// Removes a saved network configuration, if one exists.  This method will
2192    /// automatically trigger a disconnection if the NetworkConfig was used to
2193    /// establish the connection.
2194    pub fn r#remove_network(
2195        &self,
2196        mut config: &NetworkConfig,
2197        ___deadline: zx::MonotonicInstant,
2198    ) -> Result<ClientControllerRemoveNetworkResult, fidl::Error> {
2199        let _response = self.client.send_query::<
2200            ClientControllerRemoveNetworkRequest,
2201            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, NetworkConfigChangeError>,
2202            ClientControllerMarker,
2203        >(
2204            (config,),
2205            0x549a99b877062cf5,
2206            fidl::encoding::DynamicFlags::empty(),
2207            ___deadline,
2208        )?;
2209        Ok(_response.map(|x| x))
2210    }
2211
2212    /// Retrieve the currently saved networks using the provided iterator.
2213    pub fn r#get_saved_networks(
2214        &self,
2215        mut iterator: fidl::endpoints::ServerEnd<NetworkConfigIteratorMarker>,
2216    ) -> Result<(), fidl::Error> {
2217        self.client.send::<ClientControllerGetSavedNetworksRequest>(
2218            (iterator,),
2219            0x3ae5ff975b891276,
2220            fidl::encoding::DynamicFlags::empty(),
2221        )
2222    }
2223
2224    /// Request to attempt a connection to the specified network.  The target of the
2225    /// connect call must already be a saved network.  This call is not a
2226    /// blocking call for the duration of the connection attempt.  If the call cannot
2227    /// be immediately attempted, a failure status will be returned.  If the connection
2228    /// request will be attempted, an acknowledgment status will be returned.  Updates
2229    /// to the connection status are disseminated via the ClientStateUpdates protocol.
2230    /// If the connect attempt fails, the service will fall back to default behavior
2231    /// with scanning and connecting via network selection.
2232    pub fn r#connect(
2233        &self,
2234        mut id: &NetworkIdentifier,
2235        ___deadline: zx::MonotonicInstant,
2236    ) -> Result<RequestStatus, fidl::Error> {
2237        let _response = self.client.send_query::<
2238            ClientControllerConnectRequest,
2239            ClientControllerConnectResponse,
2240            ClientControllerMarker,
2241        >(
2242            (id,),
2243            0x3e1496753cd4b68a,
2244            fidl::encoding::DynamicFlags::empty(),
2245            ___deadline,
2246        )?;
2247        Ok(_response.status)
2248    }
2249}
2250
2251#[cfg(target_os = "fuchsia")]
2252impl From<ClientControllerSynchronousProxy> for zx::NullableHandle {
2253    fn from(value: ClientControllerSynchronousProxy) -> Self {
2254        value.into_channel().into()
2255    }
2256}
2257
2258#[cfg(target_os = "fuchsia")]
2259impl From<fidl::Channel> for ClientControllerSynchronousProxy {
2260    fn from(value: fidl::Channel) -> Self {
2261        Self::new(value)
2262    }
2263}
2264
2265#[cfg(target_os = "fuchsia")]
2266impl fidl::endpoints::FromClient for ClientControllerSynchronousProxy {
2267    type Protocol = ClientControllerMarker;
2268
2269    fn from_client(value: fidl::endpoints::ClientEnd<ClientControllerMarker>) -> Self {
2270        Self::new(value.into_channel())
2271    }
2272}
2273
2274#[derive(Debug, Clone)]
2275pub struct ClientControllerProxy {
2276    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2277}
2278
2279impl fidl::endpoints::Proxy for ClientControllerProxy {
2280    type Protocol = ClientControllerMarker;
2281
2282    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2283        Self::new(inner)
2284    }
2285
2286    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2287        self.client.into_channel().map_err(|client| Self { client })
2288    }
2289
2290    fn as_channel(&self) -> &::fidl::AsyncChannel {
2291        self.client.as_channel()
2292    }
2293}
2294
2295impl ClientControllerProxy {
2296    /// Create a new Proxy for fuchsia.wlan.policy/ClientController.
2297    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2298        let protocol_name = <ClientControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2299        Self { client: fidl::client::Client::new(channel, protocol_name) }
2300    }
2301
2302    /// Get a Stream of events from the remote end of the protocol.
2303    ///
2304    /// # Panics
2305    ///
2306    /// Panics if the event stream was already taken.
2307    pub fn take_event_stream(&self) -> ClientControllerEventStream {
2308        ClientControllerEventStream { event_receiver: self.client.take_event_receiver() }
2309    }
2310
2311    /// Enables WLAN client functionality. Once enabled, automatic connections will be
2312    /// attempted for saved networks, and callers can initiate operations via the
2313    /// ScanForNetworks() and Connect() APIs.
2314    /// Depending on the underlying capabilities of the device, this call may impact
2315    /// other device operation (for example, acting as an access point).
2316    /// The returned status represents acknowledgement of the request.  The
2317    /// ClientListener protocol should be monitored to learn when client functionality
2318    /// has been enabled.
2319    pub fn r#start_client_connections(
2320        &self,
2321    ) -> fidl::client::QueryResponseFut<RequestStatus, fidl::encoding::DefaultFuchsiaResourceDialect>
2322    {
2323        ClientControllerProxyInterface::r#start_client_connections(self)
2324    }
2325
2326    /// Tears down any existing connections to wlan networks and disables initiation of
2327    /// new connections.
2328    /// The returned status represents acknowledgements of the request.  The
2329    /// ClientListener protocol should be monitored to learn when client functionality
2330    /// has been disabled.
2331    pub fn r#stop_client_connections(
2332        &self,
2333    ) -> fidl::client::QueryResponseFut<RequestStatus, fidl::encoding::DefaultFuchsiaResourceDialect>
2334    {
2335        ClientControllerProxyInterface::r#stop_client_connections(self)
2336    }
2337
2338    /// Triggers a network scan.  Note, even in normal operation, some scan requests
2339    /// may be rejected due to timing with connection establishment or other critical
2340    /// connection maintenance.  If the scan is cancelled or errors, the caller is
2341    /// notified via a status update in the ScanResultIterator.
2342    /// In the current implementation, client connections must be started for a scan
2343    /// to be performed.
2344    pub fn r#scan_for_networks(
2345        &self,
2346        mut iterator: fidl::endpoints::ServerEnd<ScanResultIteratorMarker>,
2347    ) -> Result<(), fidl::Error> {
2348        ClientControllerProxyInterface::r#scan_for_networks(self, iterator)
2349    }
2350
2351    /// Saves a network and any credential information needed to connect.  Multiple
2352    /// entries for the same NetworkIdentifier can exist if the credentials are
2353    /// different.  If a caller attempts to save a NetworkConfig with the same
2354    /// NetworkIdentifier and same Credentials as a previously saved network
2355    /// the method will effectively be a no-op. Saved networks will be used to
2356    /// autoconnect, and are also available to use with the Connect() API.
2357    pub fn r#save_network(
2358        &self,
2359        mut config: &NetworkConfig,
2360    ) -> fidl::client::QueryResponseFut<
2361        ClientControllerSaveNetworkResult,
2362        fidl::encoding::DefaultFuchsiaResourceDialect,
2363    > {
2364        ClientControllerProxyInterface::r#save_network(self, config)
2365    }
2366
2367    /// Removes a saved network configuration, if one exists.  This method will
2368    /// automatically trigger a disconnection if the NetworkConfig was used to
2369    /// establish the connection.
2370    pub fn r#remove_network(
2371        &self,
2372        mut config: &NetworkConfig,
2373    ) -> fidl::client::QueryResponseFut<
2374        ClientControllerRemoveNetworkResult,
2375        fidl::encoding::DefaultFuchsiaResourceDialect,
2376    > {
2377        ClientControllerProxyInterface::r#remove_network(self, config)
2378    }
2379
2380    /// Retrieve the currently saved networks using the provided iterator.
2381    pub fn r#get_saved_networks(
2382        &self,
2383        mut iterator: fidl::endpoints::ServerEnd<NetworkConfigIteratorMarker>,
2384    ) -> Result<(), fidl::Error> {
2385        ClientControllerProxyInterface::r#get_saved_networks(self, iterator)
2386    }
2387
2388    /// Request to attempt a connection to the specified network.  The target of the
2389    /// connect call must already be a saved network.  This call is not a
2390    /// blocking call for the duration of the connection attempt.  If the call cannot
2391    /// be immediately attempted, a failure status will be returned.  If the connection
2392    /// request will be attempted, an acknowledgment status will be returned.  Updates
2393    /// to the connection status are disseminated via the ClientStateUpdates protocol.
2394    /// If the connect attempt fails, the service will fall back to default behavior
2395    /// with scanning and connecting via network selection.
2396    pub fn r#connect(
2397        &self,
2398        mut id: &NetworkIdentifier,
2399    ) -> fidl::client::QueryResponseFut<RequestStatus, fidl::encoding::DefaultFuchsiaResourceDialect>
2400    {
2401        ClientControllerProxyInterface::r#connect(self, id)
2402    }
2403}
2404
2405impl ClientControllerProxyInterface for ClientControllerProxy {
2406    type StartClientConnectionsResponseFut = fidl::client::QueryResponseFut<
2407        RequestStatus,
2408        fidl::encoding::DefaultFuchsiaResourceDialect,
2409    >;
2410    fn r#start_client_connections(&self) -> Self::StartClientConnectionsResponseFut {
2411        fn _decode(
2412            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2413        ) -> Result<RequestStatus, fidl::Error> {
2414            let _response = fidl::client::decode_transaction_body::<
2415                ClientControllerStartClientConnectionsResponse,
2416                fidl::encoding::DefaultFuchsiaResourceDialect,
2417                0x7e128a21ebe53e30,
2418            >(_buf?)?;
2419            Ok(_response.status)
2420        }
2421        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RequestStatus>(
2422            (),
2423            0x7e128a21ebe53e30,
2424            fidl::encoding::DynamicFlags::empty(),
2425            _decode,
2426        )
2427    }
2428
2429    type StopClientConnectionsResponseFut = fidl::client::QueryResponseFut<
2430        RequestStatus,
2431        fidl::encoding::DefaultFuchsiaResourceDialect,
2432    >;
2433    fn r#stop_client_connections(&self) -> Self::StopClientConnectionsResponseFut {
2434        fn _decode(
2435            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2436        ) -> Result<RequestStatus, fidl::Error> {
2437            let _response = fidl::client::decode_transaction_body::<
2438                ClientControllerStopClientConnectionsResponse,
2439                fidl::encoding::DefaultFuchsiaResourceDialect,
2440                0x2b1d6dec002789e9,
2441            >(_buf?)?;
2442            Ok(_response.status)
2443        }
2444        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, RequestStatus>(
2445            (),
2446            0x2b1d6dec002789e9,
2447            fidl::encoding::DynamicFlags::empty(),
2448            _decode,
2449        )
2450    }
2451
2452    fn r#scan_for_networks(
2453        &self,
2454        mut iterator: fidl::endpoints::ServerEnd<ScanResultIteratorMarker>,
2455    ) -> Result<(), fidl::Error> {
2456        self.client.send::<ClientControllerScanForNetworksRequest>(
2457            (iterator,),
2458            0x1a504b9c17efb993,
2459            fidl::encoding::DynamicFlags::empty(),
2460        )
2461    }
2462
2463    type SaveNetworkResponseFut = fidl::client::QueryResponseFut<
2464        ClientControllerSaveNetworkResult,
2465        fidl::encoding::DefaultFuchsiaResourceDialect,
2466    >;
2467    fn r#save_network(&self, mut config: &NetworkConfig) -> Self::SaveNetworkResponseFut {
2468        fn _decode(
2469            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2470        ) -> Result<ClientControllerSaveNetworkResult, fidl::Error> {
2471            let _response = fidl::client::decode_transaction_body::<
2472                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, NetworkConfigChangeError>,
2473                fidl::encoding::DefaultFuchsiaResourceDialect,
2474                0x7e0f216194795aa6,
2475            >(_buf?)?;
2476            Ok(_response.map(|x| x))
2477        }
2478        self.client.send_query_and_decode::<
2479            ClientControllerSaveNetworkRequest,
2480            ClientControllerSaveNetworkResult,
2481        >(
2482            (config,),
2483            0x7e0f216194795aa6,
2484            fidl::encoding::DynamicFlags::empty(),
2485            _decode,
2486        )
2487    }
2488
2489    type RemoveNetworkResponseFut = fidl::client::QueryResponseFut<
2490        ClientControllerRemoveNetworkResult,
2491        fidl::encoding::DefaultFuchsiaResourceDialect,
2492    >;
2493    fn r#remove_network(&self, mut config: &NetworkConfig) -> Self::RemoveNetworkResponseFut {
2494        fn _decode(
2495            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2496        ) -> Result<ClientControllerRemoveNetworkResult, fidl::Error> {
2497            let _response = fidl::client::decode_transaction_body::<
2498                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, NetworkConfigChangeError>,
2499                fidl::encoding::DefaultFuchsiaResourceDialect,
2500                0x549a99b877062cf5,
2501            >(_buf?)?;
2502            Ok(_response.map(|x| x))
2503        }
2504        self.client.send_query_and_decode::<
2505            ClientControllerRemoveNetworkRequest,
2506            ClientControllerRemoveNetworkResult,
2507        >(
2508            (config,),
2509            0x549a99b877062cf5,
2510            fidl::encoding::DynamicFlags::empty(),
2511            _decode,
2512        )
2513    }
2514
2515    fn r#get_saved_networks(
2516        &self,
2517        mut iterator: fidl::endpoints::ServerEnd<NetworkConfigIteratorMarker>,
2518    ) -> Result<(), fidl::Error> {
2519        self.client.send::<ClientControllerGetSavedNetworksRequest>(
2520            (iterator,),
2521            0x3ae5ff975b891276,
2522            fidl::encoding::DynamicFlags::empty(),
2523        )
2524    }
2525
2526    type ConnectResponseFut = fidl::client::QueryResponseFut<
2527        RequestStatus,
2528        fidl::encoding::DefaultFuchsiaResourceDialect,
2529    >;
2530    fn r#connect(&self, mut id: &NetworkIdentifier) -> Self::ConnectResponseFut {
2531        fn _decode(
2532            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2533        ) -> Result<RequestStatus, fidl::Error> {
2534            let _response = fidl::client::decode_transaction_body::<
2535                ClientControllerConnectResponse,
2536                fidl::encoding::DefaultFuchsiaResourceDialect,
2537                0x3e1496753cd4b68a,
2538            >(_buf?)?;
2539            Ok(_response.status)
2540        }
2541        self.client.send_query_and_decode::<ClientControllerConnectRequest, RequestStatus>(
2542            (id,),
2543            0x3e1496753cd4b68a,
2544            fidl::encoding::DynamicFlags::empty(),
2545            _decode,
2546        )
2547    }
2548}
2549
2550pub struct ClientControllerEventStream {
2551    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2552}
2553
2554impl std::marker::Unpin for ClientControllerEventStream {}
2555
2556impl futures::stream::FusedStream for ClientControllerEventStream {
2557    fn is_terminated(&self) -> bool {
2558        self.event_receiver.is_terminated()
2559    }
2560}
2561
2562impl futures::Stream for ClientControllerEventStream {
2563    type Item = Result<ClientControllerEvent, fidl::Error>;
2564
2565    fn poll_next(
2566        mut self: std::pin::Pin<&mut Self>,
2567        cx: &mut std::task::Context<'_>,
2568    ) -> std::task::Poll<Option<Self::Item>> {
2569        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2570            &mut self.event_receiver,
2571            cx
2572        )?) {
2573            Some(buf) => std::task::Poll::Ready(Some(ClientControllerEvent::decode(buf))),
2574            None => std::task::Poll::Ready(None),
2575        }
2576    }
2577}
2578
2579#[derive(Debug)]
2580pub enum ClientControllerEvent {}
2581
2582impl ClientControllerEvent {
2583    /// Decodes a message buffer as a [`ClientControllerEvent`].
2584    fn decode(
2585        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2586    ) -> Result<ClientControllerEvent, fidl::Error> {
2587        let (bytes, _handles) = buf.split_mut();
2588        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2589        debug_assert_eq!(tx_header.tx_id, 0);
2590        match tx_header.ordinal {
2591            _ => Err(fidl::Error::UnknownOrdinal {
2592                ordinal: tx_header.ordinal,
2593                protocol_name:
2594                    <ClientControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2595            }),
2596        }
2597    }
2598}
2599
2600/// A Stream of incoming requests for fuchsia.wlan.policy/ClientController.
2601pub struct ClientControllerRequestStream {
2602    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2603    is_terminated: bool,
2604}
2605
2606impl std::marker::Unpin for ClientControllerRequestStream {}
2607
2608impl futures::stream::FusedStream for ClientControllerRequestStream {
2609    fn is_terminated(&self) -> bool {
2610        self.is_terminated
2611    }
2612}
2613
2614impl fidl::endpoints::RequestStream for ClientControllerRequestStream {
2615    type Protocol = ClientControllerMarker;
2616    type ControlHandle = ClientControllerControlHandle;
2617
2618    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2619        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2620    }
2621
2622    fn control_handle(&self) -> Self::ControlHandle {
2623        ClientControllerControlHandle { inner: self.inner.clone() }
2624    }
2625
2626    fn into_inner(
2627        self,
2628    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2629    {
2630        (self.inner, self.is_terminated)
2631    }
2632
2633    fn from_inner(
2634        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2635        is_terminated: bool,
2636    ) -> Self {
2637        Self { inner, is_terminated }
2638    }
2639}
2640
2641impl futures::Stream for ClientControllerRequestStream {
2642    type Item = Result<ClientControllerRequest, fidl::Error>;
2643
2644    fn poll_next(
2645        mut self: std::pin::Pin<&mut Self>,
2646        cx: &mut std::task::Context<'_>,
2647    ) -> std::task::Poll<Option<Self::Item>> {
2648        let this = &mut *self;
2649        if this.inner.check_shutdown(cx) {
2650            this.is_terminated = true;
2651            return std::task::Poll::Ready(None);
2652        }
2653        if this.is_terminated {
2654            panic!("polled ClientControllerRequestStream after completion");
2655        }
2656        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2657            |bytes, handles| {
2658                match this.inner.channel().read_etc(cx, bytes, handles) {
2659                    std::task::Poll::Ready(Ok(())) => {}
2660                    std::task::Poll::Pending => return std::task::Poll::Pending,
2661                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2662                        this.is_terminated = true;
2663                        return std::task::Poll::Ready(None);
2664                    }
2665                    std::task::Poll::Ready(Err(e)) => {
2666                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2667                            e.into(),
2668                        ))));
2669                    }
2670                }
2671
2672                // A message has been received from the channel
2673                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2674
2675                std::task::Poll::Ready(Some(match header.ordinal {
2676                    0x7e128a21ebe53e30 => {
2677                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2678                        let mut req = fidl::new_empty!(
2679                            fidl::encoding::EmptyPayload,
2680                            fidl::encoding::DefaultFuchsiaResourceDialect
2681                        );
2682                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2683                        let control_handle =
2684                            ClientControllerControlHandle { inner: this.inner.clone() };
2685                        Ok(ClientControllerRequest::StartClientConnections {
2686                            responder: ClientControllerStartClientConnectionsResponder {
2687                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2688                                tx_id: header.tx_id,
2689                            },
2690                        })
2691                    }
2692                    0x2b1d6dec002789e9 => {
2693                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2694                        let mut req = fidl::new_empty!(
2695                            fidl::encoding::EmptyPayload,
2696                            fidl::encoding::DefaultFuchsiaResourceDialect
2697                        );
2698                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2699                        let control_handle =
2700                            ClientControllerControlHandle { inner: this.inner.clone() };
2701                        Ok(ClientControllerRequest::StopClientConnections {
2702                            responder: ClientControllerStopClientConnectionsResponder {
2703                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2704                                tx_id: header.tx_id,
2705                            },
2706                        })
2707                    }
2708                    0x1a504b9c17efb993 => {
2709                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2710                        let mut req = fidl::new_empty!(
2711                            ClientControllerScanForNetworksRequest,
2712                            fidl::encoding::DefaultFuchsiaResourceDialect
2713                        );
2714                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ClientControllerScanForNetworksRequest>(&header, _body_bytes, handles, &mut req)?;
2715                        let control_handle =
2716                            ClientControllerControlHandle { inner: this.inner.clone() };
2717                        Ok(ClientControllerRequest::ScanForNetworks {
2718                            iterator: req.iterator,
2719
2720                            control_handle,
2721                        })
2722                    }
2723                    0x7e0f216194795aa6 => {
2724                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2725                        let mut req = fidl::new_empty!(
2726                            ClientControllerSaveNetworkRequest,
2727                            fidl::encoding::DefaultFuchsiaResourceDialect
2728                        );
2729                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ClientControllerSaveNetworkRequest>(&header, _body_bytes, handles, &mut req)?;
2730                        let control_handle =
2731                            ClientControllerControlHandle { inner: this.inner.clone() };
2732                        Ok(ClientControllerRequest::SaveNetwork {
2733                            config: req.config,
2734
2735                            responder: ClientControllerSaveNetworkResponder {
2736                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2737                                tx_id: header.tx_id,
2738                            },
2739                        })
2740                    }
2741                    0x549a99b877062cf5 => {
2742                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2743                        let mut req = fidl::new_empty!(
2744                            ClientControllerRemoveNetworkRequest,
2745                            fidl::encoding::DefaultFuchsiaResourceDialect
2746                        );
2747                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ClientControllerRemoveNetworkRequest>(&header, _body_bytes, handles, &mut req)?;
2748                        let control_handle =
2749                            ClientControllerControlHandle { inner: this.inner.clone() };
2750                        Ok(ClientControllerRequest::RemoveNetwork {
2751                            config: req.config,
2752
2753                            responder: ClientControllerRemoveNetworkResponder {
2754                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2755                                tx_id: header.tx_id,
2756                            },
2757                        })
2758                    }
2759                    0x3ae5ff975b891276 => {
2760                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2761                        let mut req = fidl::new_empty!(
2762                            ClientControllerGetSavedNetworksRequest,
2763                            fidl::encoding::DefaultFuchsiaResourceDialect
2764                        );
2765                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ClientControllerGetSavedNetworksRequest>(&header, _body_bytes, handles, &mut req)?;
2766                        let control_handle =
2767                            ClientControllerControlHandle { inner: this.inner.clone() };
2768                        Ok(ClientControllerRequest::GetSavedNetworks {
2769                            iterator: req.iterator,
2770
2771                            control_handle,
2772                        })
2773                    }
2774                    0x3e1496753cd4b68a => {
2775                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2776                        let mut req = fidl::new_empty!(
2777                            ClientControllerConnectRequest,
2778                            fidl::encoding::DefaultFuchsiaResourceDialect
2779                        );
2780                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ClientControllerConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2781                        let control_handle =
2782                            ClientControllerControlHandle { inner: this.inner.clone() };
2783                        Ok(ClientControllerRequest::Connect {
2784                            id: req.id,
2785
2786                            responder: ClientControllerConnectResponder {
2787                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2788                                tx_id: header.tx_id,
2789                            },
2790                        })
2791                    }
2792                    _ => Err(fidl::Error::UnknownOrdinal {
2793                        ordinal: header.ordinal,
2794                        protocol_name:
2795                            <ClientControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2796                    }),
2797                }))
2798            },
2799        )
2800    }
2801}
2802
2803/// ClientControllers allow the caller to trigger wlan state changes.  This includes
2804/// whether connections will be attempted, scan triggers and saved network
2805/// configuration changes.
2806///
2807/// Individual calls provided by the API are triggered after registering with
2808/// the wlan ClientProvider via the OpenControlChannel call.
2809#[derive(Debug)]
2810pub enum ClientControllerRequest {
2811    /// Enables WLAN client functionality. Once enabled, automatic connections will be
2812    /// attempted for saved networks, and callers can initiate operations via the
2813    /// ScanForNetworks() and Connect() APIs.
2814    /// Depending on the underlying capabilities of the device, this call may impact
2815    /// other device operation (for example, acting as an access point).
2816    /// The returned status represents acknowledgement of the request.  The
2817    /// ClientListener protocol should be monitored to learn when client functionality
2818    /// has been enabled.
2819    StartClientConnections { responder: ClientControllerStartClientConnectionsResponder },
2820    /// Tears down any existing connections to wlan networks and disables initiation of
2821    /// new connections.
2822    /// The returned status represents acknowledgements of the request.  The
2823    /// ClientListener protocol should be monitored to learn when client functionality
2824    /// has been disabled.
2825    StopClientConnections { responder: ClientControllerStopClientConnectionsResponder },
2826    /// Triggers a network scan.  Note, even in normal operation, some scan requests
2827    /// may be rejected due to timing with connection establishment or other critical
2828    /// connection maintenance.  If the scan is cancelled or errors, the caller is
2829    /// notified via a status update in the ScanResultIterator.
2830    /// In the current implementation, client connections must be started for a scan
2831    /// to be performed.
2832    ScanForNetworks {
2833        iterator: fidl::endpoints::ServerEnd<ScanResultIteratorMarker>,
2834        control_handle: ClientControllerControlHandle,
2835    },
2836    /// Saves a network and any credential information needed to connect.  Multiple
2837    /// entries for the same NetworkIdentifier can exist if the credentials are
2838    /// different.  If a caller attempts to save a NetworkConfig with the same
2839    /// NetworkIdentifier and same Credentials as a previously saved network
2840    /// the method will effectively be a no-op. Saved networks will be used to
2841    /// autoconnect, and are also available to use with the Connect() API.
2842    SaveNetwork { config: NetworkConfig, responder: ClientControllerSaveNetworkResponder },
2843    /// Removes a saved network configuration, if one exists.  This method will
2844    /// automatically trigger a disconnection if the NetworkConfig was used to
2845    /// establish the connection.
2846    RemoveNetwork { config: NetworkConfig, responder: ClientControllerRemoveNetworkResponder },
2847    /// Retrieve the currently saved networks using the provided iterator.
2848    GetSavedNetworks {
2849        iterator: fidl::endpoints::ServerEnd<NetworkConfigIteratorMarker>,
2850        control_handle: ClientControllerControlHandle,
2851    },
2852    /// Request to attempt a connection to the specified network.  The target of the
2853    /// connect call must already be a saved network.  This call is not a
2854    /// blocking call for the duration of the connection attempt.  If the call cannot
2855    /// be immediately attempted, a failure status will be returned.  If the connection
2856    /// request will be attempted, an acknowledgment status will be returned.  Updates
2857    /// to the connection status are disseminated via the ClientStateUpdates protocol.
2858    /// If the connect attempt fails, the service will fall back to default behavior
2859    /// with scanning and connecting via network selection.
2860    Connect { id: NetworkIdentifier, responder: ClientControllerConnectResponder },
2861}
2862
2863impl ClientControllerRequest {
2864    #[allow(irrefutable_let_patterns)]
2865    pub fn into_start_client_connections(
2866        self,
2867    ) -> Option<(ClientControllerStartClientConnectionsResponder)> {
2868        if let ClientControllerRequest::StartClientConnections { responder } = self {
2869            Some((responder))
2870        } else {
2871            None
2872        }
2873    }
2874
2875    #[allow(irrefutable_let_patterns)]
2876    pub fn into_stop_client_connections(
2877        self,
2878    ) -> Option<(ClientControllerStopClientConnectionsResponder)> {
2879        if let ClientControllerRequest::StopClientConnections { responder } = self {
2880            Some((responder))
2881        } else {
2882            None
2883        }
2884    }
2885
2886    #[allow(irrefutable_let_patterns)]
2887    pub fn into_scan_for_networks(
2888        self,
2889    ) -> Option<(fidl::endpoints::ServerEnd<ScanResultIteratorMarker>, ClientControllerControlHandle)>
2890    {
2891        if let ClientControllerRequest::ScanForNetworks { iterator, control_handle } = self {
2892            Some((iterator, control_handle))
2893        } else {
2894            None
2895        }
2896    }
2897
2898    #[allow(irrefutable_let_patterns)]
2899    pub fn into_save_network(
2900        self,
2901    ) -> Option<(NetworkConfig, ClientControllerSaveNetworkResponder)> {
2902        if let ClientControllerRequest::SaveNetwork { config, responder } = self {
2903            Some((config, responder))
2904        } else {
2905            None
2906        }
2907    }
2908
2909    #[allow(irrefutable_let_patterns)]
2910    pub fn into_remove_network(
2911        self,
2912    ) -> Option<(NetworkConfig, ClientControllerRemoveNetworkResponder)> {
2913        if let ClientControllerRequest::RemoveNetwork { config, responder } = self {
2914            Some((config, responder))
2915        } else {
2916            None
2917        }
2918    }
2919
2920    #[allow(irrefutable_let_patterns)]
2921    pub fn into_get_saved_networks(
2922        self,
2923    ) -> Option<(
2924        fidl::endpoints::ServerEnd<NetworkConfigIteratorMarker>,
2925        ClientControllerControlHandle,
2926    )> {
2927        if let ClientControllerRequest::GetSavedNetworks { iterator, control_handle } = self {
2928            Some((iterator, control_handle))
2929        } else {
2930            None
2931        }
2932    }
2933
2934    #[allow(irrefutable_let_patterns)]
2935    pub fn into_connect(self) -> Option<(NetworkIdentifier, ClientControllerConnectResponder)> {
2936        if let ClientControllerRequest::Connect { id, responder } = self {
2937            Some((id, responder))
2938        } else {
2939            None
2940        }
2941    }
2942
2943    /// Name of the method defined in FIDL
2944    pub fn method_name(&self) -> &'static str {
2945        match *self {
2946            ClientControllerRequest::StartClientConnections { .. } => "start_client_connections",
2947            ClientControllerRequest::StopClientConnections { .. } => "stop_client_connections",
2948            ClientControllerRequest::ScanForNetworks { .. } => "scan_for_networks",
2949            ClientControllerRequest::SaveNetwork { .. } => "save_network",
2950            ClientControllerRequest::RemoveNetwork { .. } => "remove_network",
2951            ClientControllerRequest::GetSavedNetworks { .. } => "get_saved_networks",
2952            ClientControllerRequest::Connect { .. } => "connect",
2953        }
2954    }
2955}
2956
2957#[derive(Debug, Clone)]
2958pub struct ClientControllerControlHandle {
2959    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2960}
2961
2962impl fidl::endpoints::ControlHandle for ClientControllerControlHandle {
2963    fn shutdown(&self) {
2964        self.inner.shutdown()
2965    }
2966
2967    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2968        self.inner.shutdown_with_epitaph(status)
2969    }
2970
2971    fn is_closed(&self) -> bool {
2972        self.inner.channel().is_closed()
2973    }
2974    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2975        self.inner.channel().on_closed()
2976    }
2977
2978    #[cfg(target_os = "fuchsia")]
2979    fn signal_peer(
2980        &self,
2981        clear_mask: zx::Signals,
2982        set_mask: zx::Signals,
2983    ) -> Result<(), zx_status::Status> {
2984        use fidl::Peered;
2985        self.inner.channel().signal_peer(clear_mask, set_mask)
2986    }
2987}
2988
2989impl ClientControllerControlHandle {}
2990
2991#[must_use = "FIDL methods require a response to be sent"]
2992#[derive(Debug)]
2993pub struct ClientControllerStartClientConnectionsResponder {
2994    control_handle: std::mem::ManuallyDrop<ClientControllerControlHandle>,
2995    tx_id: u32,
2996}
2997
2998/// Set the the channel to be shutdown (see [`ClientControllerControlHandle::shutdown`])
2999/// if the responder is dropped without sending a response, so that the client
3000/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3001impl std::ops::Drop for ClientControllerStartClientConnectionsResponder {
3002    fn drop(&mut self) {
3003        self.control_handle.shutdown();
3004        // Safety: drops once, never accessed again
3005        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3006    }
3007}
3008
3009impl fidl::endpoints::Responder for ClientControllerStartClientConnectionsResponder {
3010    type ControlHandle = ClientControllerControlHandle;
3011
3012    fn control_handle(&self) -> &ClientControllerControlHandle {
3013        &self.control_handle
3014    }
3015
3016    fn drop_without_shutdown(mut self) {
3017        // Safety: drops once, never accessed again due to mem::forget
3018        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3019        // Prevent Drop from running (which would shut down the channel)
3020        std::mem::forget(self);
3021    }
3022}
3023
3024impl ClientControllerStartClientConnectionsResponder {
3025    /// Sends a response to the FIDL transaction.
3026    ///
3027    /// Sets the channel to shutdown if an error occurs.
3028    pub fn send(self, mut status: RequestStatus) -> Result<(), fidl::Error> {
3029        let _result = self.send_raw(status);
3030        if _result.is_err() {
3031            self.control_handle.shutdown();
3032        }
3033        self.drop_without_shutdown();
3034        _result
3035    }
3036
3037    /// Similar to "send" but does not shutdown the channel if an error occurs.
3038    pub fn send_no_shutdown_on_err(self, mut status: RequestStatus) -> Result<(), fidl::Error> {
3039        let _result = self.send_raw(status);
3040        self.drop_without_shutdown();
3041        _result
3042    }
3043
3044    fn send_raw(&self, mut status: RequestStatus) -> Result<(), fidl::Error> {
3045        self.control_handle.inner.send::<ClientControllerStartClientConnectionsResponse>(
3046            (status,),
3047            self.tx_id,
3048            0x7e128a21ebe53e30,
3049            fidl::encoding::DynamicFlags::empty(),
3050        )
3051    }
3052}
3053
3054#[must_use = "FIDL methods require a response to be sent"]
3055#[derive(Debug)]
3056pub struct ClientControllerStopClientConnectionsResponder {
3057    control_handle: std::mem::ManuallyDrop<ClientControllerControlHandle>,
3058    tx_id: u32,
3059}
3060
3061/// Set the the channel to be shutdown (see [`ClientControllerControlHandle::shutdown`])
3062/// if the responder is dropped without sending a response, so that the client
3063/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3064impl std::ops::Drop for ClientControllerStopClientConnectionsResponder {
3065    fn drop(&mut self) {
3066        self.control_handle.shutdown();
3067        // Safety: drops once, never accessed again
3068        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3069    }
3070}
3071
3072impl fidl::endpoints::Responder for ClientControllerStopClientConnectionsResponder {
3073    type ControlHandle = ClientControllerControlHandle;
3074
3075    fn control_handle(&self) -> &ClientControllerControlHandle {
3076        &self.control_handle
3077    }
3078
3079    fn drop_without_shutdown(mut self) {
3080        // Safety: drops once, never accessed again due to mem::forget
3081        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3082        // Prevent Drop from running (which would shut down the channel)
3083        std::mem::forget(self);
3084    }
3085}
3086
3087impl ClientControllerStopClientConnectionsResponder {
3088    /// Sends a response to the FIDL transaction.
3089    ///
3090    /// Sets the channel to shutdown if an error occurs.
3091    pub fn send(self, mut status: RequestStatus) -> Result<(), fidl::Error> {
3092        let _result = self.send_raw(status);
3093        if _result.is_err() {
3094            self.control_handle.shutdown();
3095        }
3096        self.drop_without_shutdown();
3097        _result
3098    }
3099
3100    /// Similar to "send" but does not shutdown the channel if an error occurs.
3101    pub fn send_no_shutdown_on_err(self, mut status: RequestStatus) -> Result<(), fidl::Error> {
3102        let _result = self.send_raw(status);
3103        self.drop_without_shutdown();
3104        _result
3105    }
3106
3107    fn send_raw(&self, mut status: RequestStatus) -> Result<(), fidl::Error> {
3108        self.control_handle.inner.send::<ClientControllerStopClientConnectionsResponse>(
3109            (status,),
3110            self.tx_id,
3111            0x2b1d6dec002789e9,
3112            fidl::encoding::DynamicFlags::empty(),
3113        )
3114    }
3115}
3116
3117#[must_use = "FIDL methods require a response to be sent"]
3118#[derive(Debug)]
3119pub struct ClientControllerSaveNetworkResponder {
3120    control_handle: std::mem::ManuallyDrop<ClientControllerControlHandle>,
3121    tx_id: u32,
3122}
3123
3124/// Set the the channel to be shutdown (see [`ClientControllerControlHandle::shutdown`])
3125/// if the responder is dropped without sending a response, so that the client
3126/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3127impl std::ops::Drop for ClientControllerSaveNetworkResponder {
3128    fn drop(&mut self) {
3129        self.control_handle.shutdown();
3130        // Safety: drops once, never accessed again
3131        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3132    }
3133}
3134
3135impl fidl::endpoints::Responder for ClientControllerSaveNetworkResponder {
3136    type ControlHandle = ClientControllerControlHandle;
3137
3138    fn control_handle(&self) -> &ClientControllerControlHandle {
3139        &self.control_handle
3140    }
3141
3142    fn drop_without_shutdown(mut self) {
3143        // Safety: drops once, never accessed again due to mem::forget
3144        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3145        // Prevent Drop from running (which would shut down the channel)
3146        std::mem::forget(self);
3147    }
3148}
3149
3150impl ClientControllerSaveNetworkResponder {
3151    /// Sends a response to the FIDL transaction.
3152    ///
3153    /// Sets the channel to shutdown if an error occurs.
3154    pub fn send(self, mut result: Result<(), NetworkConfigChangeError>) -> Result<(), fidl::Error> {
3155        let _result = self.send_raw(result);
3156        if _result.is_err() {
3157            self.control_handle.shutdown();
3158        }
3159        self.drop_without_shutdown();
3160        _result
3161    }
3162
3163    /// Similar to "send" but does not shutdown the channel if an error occurs.
3164    pub fn send_no_shutdown_on_err(
3165        self,
3166        mut result: Result<(), NetworkConfigChangeError>,
3167    ) -> Result<(), fidl::Error> {
3168        let _result = self.send_raw(result);
3169        self.drop_without_shutdown();
3170        _result
3171    }
3172
3173    fn send_raw(
3174        &self,
3175        mut result: Result<(), NetworkConfigChangeError>,
3176    ) -> Result<(), fidl::Error> {
3177        self.control_handle.inner.send::<fidl::encoding::ResultType<
3178            fidl::encoding::EmptyStruct,
3179            NetworkConfigChangeError,
3180        >>(
3181            result,
3182            self.tx_id,
3183            0x7e0f216194795aa6,
3184            fidl::encoding::DynamicFlags::empty(),
3185        )
3186    }
3187}
3188
3189#[must_use = "FIDL methods require a response to be sent"]
3190#[derive(Debug)]
3191pub struct ClientControllerRemoveNetworkResponder {
3192    control_handle: std::mem::ManuallyDrop<ClientControllerControlHandle>,
3193    tx_id: u32,
3194}
3195
3196/// Set the the channel to be shutdown (see [`ClientControllerControlHandle::shutdown`])
3197/// if the responder is dropped without sending a response, so that the client
3198/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3199impl std::ops::Drop for ClientControllerRemoveNetworkResponder {
3200    fn drop(&mut self) {
3201        self.control_handle.shutdown();
3202        // Safety: drops once, never accessed again
3203        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3204    }
3205}
3206
3207impl fidl::endpoints::Responder for ClientControllerRemoveNetworkResponder {
3208    type ControlHandle = ClientControllerControlHandle;
3209
3210    fn control_handle(&self) -> &ClientControllerControlHandle {
3211        &self.control_handle
3212    }
3213
3214    fn drop_without_shutdown(mut self) {
3215        // Safety: drops once, never accessed again due to mem::forget
3216        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3217        // Prevent Drop from running (which would shut down the channel)
3218        std::mem::forget(self);
3219    }
3220}
3221
3222impl ClientControllerRemoveNetworkResponder {
3223    /// Sends a response to the FIDL transaction.
3224    ///
3225    /// Sets the channel to shutdown if an error occurs.
3226    pub fn send(self, mut result: Result<(), NetworkConfigChangeError>) -> Result<(), fidl::Error> {
3227        let _result = self.send_raw(result);
3228        if _result.is_err() {
3229            self.control_handle.shutdown();
3230        }
3231        self.drop_without_shutdown();
3232        _result
3233    }
3234
3235    /// Similar to "send" but does not shutdown the channel if an error occurs.
3236    pub fn send_no_shutdown_on_err(
3237        self,
3238        mut result: Result<(), NetworkConfigChangeError>,
3239    ) -> Result<(), fidl::Error> {
3240        let _result = self.send_raw(result);
3241        self.drop_without_shutdown();
3242        _result
3243    }
3244
3245    fn send_raw(
3246        &self,
3247        mut result: Result<(), NetworkConfigChangeError>,
3248    ) -> Result<(), fidl::Error> {
3249        self.control_handle.inner.send::<fidl::encoding::ResultType<
3250            fidl::encoding::EmptyStruct,
3251            NetworkConfigChangeError,
3252        >>(
3253            result,
3254            self.tx_id,
3255            0x549a99b877062cf5,
3256            fidl::encoding::DynamicFlags::empty(),
3257        )
3258    }
3259}
3260
3261#[must_use = "FIDL methods require a response to be sent"]
3262#[derive(Debug)]
3263pub struct ClientControllerConnectResponder {
3264    control_handle: std::mem::ManuallyDrop<ClientControllerControlHandle>,
3265    tx_id: u32,
3266}
3267
3268/// Set the the channel to be shutdown (see [`ClientControllerControlHandle::shutdown`])
3269/// if the responder is dropped without sending a response, so that the client
3270/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3271impl std::ops::Drop for ClientControllerConnectResponder {
3272    fn drop(&mut self) {
3273        self.control_handle.shutdown();
3274        // Safety: drops once, never accessed again
3275        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3276    }
3277}
3278
3279impl fidl::endpoints::Responder for ClientControllerConnectResponder {
3280    type ControlHandle = ClientControllerControlHandle;
3281
3282    fn control_handle(&self) -> &ClientControllerControlHandle {
3283        &self.control_handle
3284    }
3285
3286    fn drop_without_shutdown(mut self) {
3287        // Safety: drops once, never accessed again due to mem::forget
3288        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3289        // Prevent Drop from running (which would shut down the channel)
3290        std::mem::forget(self);
3291    }
3292}
3293
3294impl ClientControllerConnectResponder {
3295    /// Sends a response to the FIDL transaction.
3296    ///
3297    /// Sets the channel to shutdown if an error occurs.
3298    pub fn send(self, mut status: RequestStatus) -> Result<(), fidl::Error> {
3299        let _result = self.send_raw(status);
3300        if _result.is_err() {
3301            self.control_handle.shutdown();
3302        }
3303        self.drop_without_shutdown();
3304        _result
3305    }
3306
3307    /// Similar to "send" but does not shutdown the channel if an error occurs.
3308    pub fn send_no_shutdown_on_err(self, mut status: RequestStatus) -> Result<(), fidl::Error> {
3309        let _result = self.send_raw(status);
3310        self.drop_without_shutdown();
3311        _result
3312    }
3313
3314    fn send_raw(&self, mut status: RequestStatus) -> Result<(), fidl::Error> {
3315        self.control_handle.inner.send::<ClientControllerConnectResponse>(
3316            (status,),
3317            self.tx_id,
3318            0x3e1496753cd4b68a,
3319            fidl::encoding::DynamicFlags::empty(),
3320        )
3321    }
3322}
3323
3324#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3325pub struct ClientListenerMarker;
3326
3327impl fidl::endpoints::ProtocolMarker for ClientListenerMarker {
3328    type Proxy = ClientListenerProxy;
3329    type RequestStream = ClientListenerRequestStream;
3330    #[cfg(target_os = "fuchsia")]
3331    type SynchronousProxy = ClientListenerSynchronousProxy;
3332
3333    const DEBUG_NAME: &'static str = "fuchsia.wlan.policy.ClientListener";
3334}
3335impl fidl::endpoints::DiscoverableProtocolMarker for ClientListenerMarker {}
3336
3337pub trait ClientListenerProxyInterface: Send + Sync {
3338    fn r#get_listener(
3339        &self,
3340        updates: fidl::endpoints::ClientEnd<ClientStateUpdatesMarker>,
3341    ) -> Result<(), fidl::Error>;
3342}
3343#[derive(Debug)]
3344#[cfg(target_os = "fuchsia")]
3345pub struct ClientListenerSynchronousProxy {
3346    client: fidl::client::sync::Client,
3347}
3348
3349#[cfg(target_os = "fuchsia")]
3350impl fidl::endpoints::SynchronousProxy for ClientListenerSynchronousProxy {
3351    type Proxy = ClientListenerProxy;
3352    type Protocol = ClientListenerMarker;
3353
3354    fn from_channel(inner: fidl::Channel) -> Self {
3355        Self::new(inner)
3356    }
3357
3358    fn into_channel(self) -> fidl::Channel {
3359        self.client.into_channel()
3360    }
3361
3362    fn as_channel(&self) -> &fidl::Channel {
3363        self.client.as_channel()
3364    }
3365}
3366
3367#[cfg(target_os = "fuchsia")]
3368impl ClientListenerSynchronousProxy {
3369    pub fn new(channel: fidl::Channel) -> Self {
3370        Self { client: fidl::client::sync::Client::new(channel) }
3371    }
3372
3373    pub fn into_channel(self) -> fidl::Channel {
3374        self.client.into_channel()
3375    }
3376
3377    /// Waits until an event arrives and returns it. It is safe for other
3378    /// threads to make concurrent requests while waiting for an event.
3379    pub fn wait_for_event(
3380        &self,
3381        deadline: zx::MonotonicInstant,
3382    ) -> Result<ClientListenerEvent, fidl::Error> {
3383        ClientListenerEvent::decode(self.client.wait_for_event::<ClientListenerMarker>(deadline)?)
3384    }
3385
3386    /// Registration for callers to receive wlan client mode state updates.
3387    pub fn r#get_listener(
3388        &self,
3389        mut updates: fidl::endpoints::ClientEnd<ClientStateUpdatesMarker>,
3390    ) -> Result<(), fidl::Error> {
3391        self.client.send::<ClientListenerGetListenerRequest>(
3392            (updates,),
3393            0x3fe3cd14f701dedd,
3394            fidl::encoding::DynamicFlags::empty(),
3395        )
3396    }
3397}
3398
3399#[cfg(target_os = "fuchsia")]
3400impl From<ClientListenerSynchronousProxy> for zx::NullableHandle {
3401    fn from(value: ClientListenerSynchronousProxy) -> Self {
3402        value.into_channel().into()
3403    }
3404}
3405
3406#[cfg(target_os = "fuchsia")]
3407impl From<fidl::Channel> for ClientListenerSynchronousProxy {
3408    fn from(value: fidl::Channel) -> Self {
3409        Self::new(value)
3410    }
3411}
3412
3413#[cfg(target_os = "fuchsia")]
3414impl fidl::endpoints::FromClient for ClientListenerSynchronousProxy {
3415    type Protocol = ClientListenerMarker;
3416
3417    fn from_client(value: fidl::endpoints::ClientEnd<ClientListenerMarker>) -> Self {
3418        Self::new(value.into_channel())
3419    }
3420}
3421
3422#[derive(Debug, Clone)]
3423pub struct ClientListenerProxy {
3424    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3425}
3426
3427impl fidl::endpoints::Proxy for ClientListenerProxy {
3428    type Protocol = ClientListenerMarker;
3429
3430    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3431        Self::new(inner)
3432    }
3433
3434    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3435        self.client.into_channel().map_err(|client| Self { client })
3436    }
3437
3438    fn as_channel(&self) -> &::fidl::AsyncChannel {
3439        self.client.as_channel()
3440    }
3441}
3442
3443impl ClientListenerProxy {
3444    /// Create a new Proxy for fuchsia.wlan.policy/ClientListener.
3445    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3446        let protocol_name = <ClientListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3447        Self { client: fidl::client::Client::new(channel, protocol_name) }
3448    }
3449
3450    /// Get a Stream of events from the remote end of the protocol.
3451    ///
3452    /// # Panics
3453    ///
3454    /// Panics if the event stream was already taken.
3455    pub fn take_event_stream(&self) -> ClientListenerEventStream {
3456        ClientListenerEventStream { event_receiver: self.client.take_event_receiver() }
3457    }
3458
3459    /// Registration for callers to receive wlan client mode state updates.
3460    pub fn r#get_listener(
3461        &self,
3462        mut updates: fidl::endpoints::ClientEnd<ClientStateUpdatesMarker>,
3463    ) -> Result<(), fidl::Error> {
3464        ClientListenerProxyInterface::r#get_listener(self, updates)
3465    }
3466}
3467
3468impl ClientListenerProxyInterface for ClientListenerProxy {
3469    fn r#get_listener(
3470        &self,
3471        mut updates: fidl::endpoints::ClientEnd<ClientStateUpdatesMarker>,
3472    ) -> Result<(), fidl::Error> {
3473        self.client.send::<ClientListenerGetListenerRequest>(
3474            (updates,),
3475            0x3fe3cd14f701dedd,
3476            fidl::encoding::DynamicFlags::empty(),
3477        )
3478    }
3479}
3480
3481pub struct ClientListenerEventStream {
3482    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3483}
3484
3485impl std::marker::Unpin for ClientListenerEventStream {}
3486
3487impl futures::stream::FusedStream for ClientListenerEventStream {
3488    fn is_terminated(&self) -> bool {
3489        self.event_receiver.is_terminated()
3490    }
3491}
3492
3493impl futures::Stream for ClientListenerEventStream {
3494    type Item = Result<ClientListenerEvent, fidl::Error>;
3495
3496    fn poll_next(
3497        mut self: std::pin::Pin<&mut Self>,
3498        cx: &mut std::task::Context<'_>,
3499    ) -> std::task::Poll<Option<Self::Item>> {
3500        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3501            &mut self.event_receiver,
3502            cx
3503        )?) {
3504            Some(buf) => std::task::Poll::Ready(Some(ClientListenerEvent::decode(buf))),
3505            None => std::task::Poll::Ready(None),
3506        }
3507    }
3508}
3509
3510#[derive(Debug)]
3511pub enum ClientListenerEvent {}
3512
3513impl ClientListenerEvent {
3514    /// Decodes a message buffer as a [`ClientListenerEvent`].
3515    fn decode(
3516        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3517    ) -> Result<ClientListenerEvent, fidl::Error> {
3518        let (bytes, _handles) = buf.split_mut();
3519        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3520        debug_assert_eq!(tx_header.tx_id, 0);
3521        match tx_header.ordinal {
3522            _ => Err(fidl::Error::UnknownOrdinal {
3523                ordinal: tx_header.ordinal,
3524                protocol_name:
3525                    <ClientListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3526            }),
3527        }
3528    }
3529}
3530
3531/// A Stream of incoming requests for fuchsia.wlan.policy/ClientListener.
3532pub struct ClientListenerRequestStream {
3533    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3534    is_terminated: bool,
3535}
3536
3537impl std::marker::Unpin for ClientListenerRequestStream {}
3538
3539impl futures::stream::FusedStream for ClientListenerRequestStream {
3540    fn is_terminated(&self) -> bool {
3541        self.is_terminated
3542    }
3543}
3544
3545impl fidl::endpoints::RequestStream for ClientListenerRequestStream {
3546    type Protocol = ClientListenerMarker;
3547    type ControlHandle = ClientListenerControlHandle;
3548
3549    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3550        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3551    }
3552
3553    fn control_handle(&self) -> Self::ControlHandle {
3554        ClientListenerControlHandle { inner: self.inner.clone() }
3555    }
3556
3557    fn into_inner(
3558        self,
3559    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3560    {
3561        (self.inner, self.is_terminated)
3562    }
3563
3564    fn from_inner(
3565        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3566        is_terminated: bool,
3567    ) -> Self {
3568        Self { inner, is_terminated }
3569    }
3570}
3571
3572impl futures::Stream for ClientListenerRequestStream {
3573    type Item = Result<ClientListenerRequest, fidl::Error>;
3574
3575    fn poll_next(
3576        mut self: std::pin::Pin<&mut Self>,
3577        cx: &mut std::task::Context<'_>,
3578    ) -> std::task::Poll<Option<Self::Item>> {
3579        let this = &mut *self;
3580        if this.inner.check_shutdown(cx) {
3581            this.is_terminated = true;
3582            return std::task::Poll::Ready(None);
3583        }
3584        if this.is_terminated {
3585            panic!("polled ClientListenerRequestStream after completion");
3586        }
3587        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3588            |bytes, handles| {
3589                match this.inner.channel().read_etc(cx, bytes, handles) {
3590                    std::task::Poll::Ready(Ok(())) => {}
3591                    std::task::Poll::Pending => return std::task::Poll::Pending,
3592                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3593                        this.is_terminated = true;
3594                        return std::task::Poll::Ready(None);
3595                    }
3596                    std::task::Poll::Ready(Err(e)) => {
3597                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3598                            e.into(),
3599                        ))));
3600                    }
3601                }
3602
3603                // A message has been received from the channel
3604                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3605
3606                std::task::Poll::Ready(Some(match header.ordinal {
3607                    0x3fe3cd14f701dedd => {
3608                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3609                        let mut req = fidl::new_empty!(
3610                            ClientListenerGetListenerRequest,
3611                            fidl::encoding::DefaultFuchsiaResourceDialect
3612                        );
3613                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ClientListenerGetListenerRequest>(&header, _body_bytes, handles, &mut req)?;
3614                        let control_handle =
3615                            ClientListenerControlHandle { inner: this.inner.clone() };
3616                        Ok(ClientListenerRequest::GetListener {
3617                            updates: req.updates,
3618
3619                            control_handle,
3620                        })
3621                    }
3622                    _ => Err(fidl::Error::UnknownOrdinal {
3623                        ordinal: header.ordinal,
3624                        protocol_name:
3625                            <ClientListenerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3626                    }),
3627                }))
3628            },
3629        )
3630    }
3631}
3632
3633/// The ClientListener API provides a mechanism for callers to receive state change
3634/// updates about wlan operation.
3635#[derive(Debug)]
3636pub enum ClientListenerRequest {
3637    /// Registration for callers to receive wlan client mode state updates.
3638    GetListener {
3639        updates: fidl::endpoints::ClientEnd<ClientStateUpdatesMarker>,
3640        control_handle: ClientListenerControlHandle,
3641    },
3642}
3643
3644impl ClientListenerRequest {
3645    #[allow(irrefutable_let_patterns)]
3646    pub fn into_get_listener(
3647        self,
3648    ) -> Option<(fidl::endpoints::ClientEnd<ClientStateUpdatesMarker>, ClientListenerControlHandle)>
3649    {
3650        if let ClientListenerRequest::GetListener { updates, control_handle } = self {
3651            Some((updates, control_handle))
3652        } else {
3653            None
3654        }
3655    }
3656
3657    /// Name of the method defined in FIDL
3658    pub fn method_name(&self) -> &'static str {
3659        match *self {
3660            ClientListenerRequest::GetListener { .. } => "get_listener",
3661        }
3662    }
3663}
3664
3665#[derive(Debug, Clone)]
3666pub struct ClientListenerControlHandle {
3667    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3668}
3669
3670impl fidl::endpoints::ControlHandle for ClientListenerControlHandle {
3671    fn shutdown(&self) {
3672        self.inner.shutdown()
3673    }
3674
3675    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3676        self.inner.shutdown_with_epitaph(status)
3677    }
3678
3679    fn is_closed(&self) -> bool {
3680        self.inner.channel().is_closed()
3681    }
3682    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3683        self.inner.channel().on_closed()
3684    }
3685
3686    #[cfg(target_os = "fuchsia")]
3687    fn signal_peer(
3688        &self,
3689        clear_mask: zx::Signals,
3690        set_mask: zx::Signals,
3691    ) -> Result<(), zx_status::Status> {
3692        use fidl::Peered;
3693        self.inner.channel().signal_peer(clear_mask, set_mask)
3694    }
3695}
3696
3697impl ClientListenerControlHandle {}
3698
3699#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3700pub struct ClientProviderMarker;
3701
3702impl fidl::endpoints::ProtocolMarker for ClientProviderMarker {
3703    type Proxy = ClientProviderProxy;
3704    type RequestStream = ClientProviderRequestStream;
3705    #[cfg(target_os = "fuchsia")]
3706    type SynchronousProxy = ClientProviderSynchronousProxy;
3707
3708    const DEBUG_NAME: &'static str = "fuchsia.wlan.policy.ClientProvider";
3709}
3710impl fidl::endpoints::DiscoverableProtocolMarker for ClientProviderMarker {}
3711
3712pub trait ClientProviderProxyInterface: Send + Sync {
3713    fn r#get_controller(
3714        &self,
3715        requests: fidl::endpoints::ServerEnd<ClientControllerMarker>,
3716        updates: fidl::endpoints::ClientEnd<ClientStateUpdatesMarker>,
3717    ) -> Result<(), fidl::Error>;
3718}
3719#[derive(Debug)]
3720#[cfg(target_os = "fuchsia")]
3721pub struct ClientProviderSynchronousProxy {
3722    client: fidl::client::sync::Client,
3723}
3724
3725#[cfg(target_os = "fuchsia")]
3726impl fidl::endpoints::SynchronousProxy for ClientProviderSynchronousProxy {
3727    type Proxy = ClientProviderProxy;
3728    type Protocol = ClientProviderMarker;
3729
3730    fn from_channel(inner: fidl::Channel) -> Self {
3731        Self::new(inner)
3732    }
3733
3734    fn into_channel(self) -> fidl::Channel {
3735        self.client.into_channel()
3736    }
3737
3738    fn as_channel(&self) -> &fidl::Channel {
3739        self.client.as_channel()
3740    }
3741}
3742
3743#[cfg(target_os = "fuchsia")]
3744impl ClientProviderSynchronousProxy {
3745    pub fn new(channel: fidl::Channel) -> Self {
3746        Self { client: fidl::client::sync::Client::new(channel) }
3747    }
3748
3749    pub fn into_channel(self) -> fidl::Channel {
3750        self.client.into_channel()
3751    }
3752
3753    /// Waits until an event arrives and returns it. It is safe for other
3754    /// threads to make concurrent requests while waiting for an event.
3755    pub fn wait_for_event(
3756        &self,
3757        deadline: zx::MonotonicInstant,
3758    ) -> Result<ClientProviderEvent, fidl::Error> {
3759        ClientProviderEvent::decode(self.client.wait_for_event::<ClientProviderMarker>(deadline)?)
3760    }
3761
3762    /// Control channel used by a single caller to trigger wlan client mode state
3763    /// changes.  The caller also provides a channel to receive wlan updates.
3764    /// Only one caller can have the control channel open at a time.  Attempts to
3765    /// register as a controller while there is an active control registration
3766    /// will result in the new caller's provided channel being closed.
3767    pub fn r#get_controller(
3768        &self,
3769        mut requests: fidl::endpoints::ServerEnd<ClientControllerMarker>,
3770        mut updates: fidl::endpoints::ClientEnd<ClientStateUpdatesMarker>,
3771    ) -> Result<(), fidl::Error> {
3772        self.client.send::<ClientProviderGetControllerRequest>(
3773            (requests, updates),
3774            0x7559282e8bf18fd6,
3775            fidl::encoding::DynamicFlags::empty(),
3776        )
3777    }
3778}
3779
3780#[cfg(target_os = "fuchsia")]
3781impl From<ClientProviderSynchronousProxy> for zx::NullableHandle {
3782    fn from(value: ClientProviderSynchronousProxy) -> Self {
3783        value.into_channel().into()
3784    }
3785}
3786
3787#[cfg(target_os = "fuchsia")]
3788impl From<fidl::Channel> for ClientProviderSynchronousProxy {
3789    fn from(value: fidl::Channel) -> Self {
3790        Self::new(value)
3791    }
3792}
3793
3794#[cfg(target_os = "fuchsia")]
3795impl fidl::endpoints::FromClient for ClientProviderSynchronousProxy {
3796    type Protocol = ClientProviderMarker;
3797
3798    fn from_client(value: fidl::endpoints::ClientEnd<ClientProviderMarker>) -> Self {
3799        Self::new(value.into_channel())
3800    }
3801}
3802
3803#[derive(Debug, Clone)]
3804pub struct ClientProviderProxy {
3805    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3806}
3807
3808impl fidl::endpoints::Proxy for ClientProviderProxy {
3809    type Protocol = ClientProviderMarker;
3810
3811    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3812        Self::new(inner)
3813    }
3814
3815    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3816        self.client.into_channel().map_err(|client| Self { client })
3817    }
3818
3819    fn as_channel(&self) -> &::fidl::AsyncChannel {
3820        self.client.as_channel()
3821    }
3822}
3823
3824impl ClientProviderProxy {
3825    /// Create a new Proxy for fuchsia.wlan.policy/ClientProvider.
3826    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3827        let protocol_name = <ClientProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3828        Self { client: fidl::client::Client::new(channel, protocol_name) }
3829    }
3830
3831    /// Get a Stream of events from the remote end of the protocol.
3832    ///
3833    /// # Panics
3834    ///
3835    /// Panics if the event stream was already taken.
3836    pub fn take_event_stream(&self) -> ClientProviderEventStream {
3837        ClientProviderEventStream { event_receiver: self.client.take_event_receiver() }
3838    }
3839
3840    /// Control channel used by a single caller to trigger wlan client mode state
3841    /// changes.  The caller also provides a channel to receive wlan updates.
3842    /// Only one caller can have the control channel open at a time.  Attempts to
3843    /// register as a controller while there is an active control registration
3844    /// will result in the new caller's provided channel being closed.
3845    pub fn r#get_controller(
3846        &self,
3847        mut requests: fidl::endpoints::ServerEnd<ClientControllerMarker>,
3848        mut updates: fidl::endpoints::ClientEnd<ClientStateUpdatesMarker>,
3849    ) -> Result<(), fidl::Error> {
3850        ClientProviderProxyInterface::r#get_controller(self, requests, updates)
3851    }
3852}
3853
3854impl ClientProviderProxyInterface for ClientProviderProxy {
3855    fn r#get_controller(
3856        &self,
3857        mut requests: fidl::endpoints::ServerEnd<ClientControllerMarker>,
3858        mut updates: fidl::endpoints::ClientEnd<ClientStateUpdatesMarker>,
3859    ) -> Result<(), fidl::Error> {
3860        self.client.send::<ClientProviderGetControllerRequest>(
3861            (requests, updates),
3862            0x7559282e8bf18fd6,
3863            fidl::encoding::DynamicFlags::empty(),
3864        )
3865    }
3866}
3867
3868pub struct ClientProviderEventStream {
3869    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3870}
3871
3872impl std::marker::Unpin for ClientProviderEventStream {}
3873
3874impl futures::stream::FusedStream for ClientProviderEventStream {
3875    fn is_terminated(&self) -> bool {
3876        self.event_receiver.is_terminated()
3877    }
3878}
3879
3880impl futures::Stream for ClientProviderEventStream {
3881    type Item = Result<ClientProviderEvent, fidl::Error>;
3882
3883    fn poll_next(
3884        mut self: std::pin::Pin<&mut Self>,
3885        cx: &mut std::task::Context<'_>,
3886    ) -> std::task::Poll<Option<Self::Item>> {
3887        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3888            &mut self.event_receiver,
3889            cx
3890        )?) {
3891            Some(buf) => std::task::Poll::Ready(Some(ClientProviderEvent::decode(buf))),
3892            None => std::task::Poll::Ready(None),
3893        }
3894    }
3895}
3896
3897#[derive(Debug)]
3898pub enum ClientProviderEvent {}
3899
3900impl ClientProviderEvent {
3901    /// Decodes a message buffer as a [`ClientProviderEvent`].
3902    fn decode(
3903        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3904    ) -> Result<ClientProviderEvent, fidl::Error> {
3905        let (bytes, _handles) = buf.split_mut();
3906        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3907        debug_assert_eq!(tx_header.tx_id, 0);
3908        match tx_header.ordinal {
3909            _ => Err(fidl::Error::UnknownOrdinal {
3910                ordinal: tx_header.ordinal,
3911                protocol_name:
3912                    <ClientProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3913            }),
3914        }
3915    }
3916}
3917
3918/// A Stream of incoming requests for fuchsia.wlan.policy/ClientProvider.
3919pub struct ClientProviderRequestStream {
3920    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3921    is_terminated: bool,
3922}
3923
3924impl std::marker::Unpin for ClientProviderRequestStream {}
3925
3926impl futures::stream::FusedStream for ClientProviderRequestStream {
3927    fn is_terminated(&self) -> bool {
3928        self.is_terminated
3929    }
3930}
3931
3932impl fidl::endpoints::RequestStream for ClientProviderRequestStream {
3933    type Protocol = ClientProviderMarker;
3934    type ControlHandle = ClientProviderControlHandle;
3935
3936    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3937        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3938    }
3939
3940    fn control_handle(&self) -> Self::ControlHandle {
3941        ClientProviderControlHandle { inner: self.inner.clone() }
3942    }
3943
3944    fn into_inner(
3945        self,
3946    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3947    {
3948        (self.inner, self.is_terminated)
3949    }
3950
3951    fn from_inner(
3952        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3953        is_terminated: bool,
3954    ) -> Self {
3955        Self { inner, is_terminated }
3956    }
3957}
3958
3959impl futures::Stream for ClientProviderRequestStream {
3960    type Item = Result<ClientProviderRequest, fidl::Error>;
3961
3962    fn poll_next(
3963        mut self: std::pin::Pin<&mut Self>,
3964        cx: &mut std::task::Context<'_>,
3965    ) -> std::task::Poll<Option<Self::Item>> {
3966        let this = &mut *self;
3967        if this.inner.check_shutdown(cx) {
3968            this.is_terminated = true;
3969            return std::task::Poll::Ready(None);
3970        }
3971        if this.is_terminated {
3972            panic!("polled ClientProviderRequestStream after completion");
3973        }
3974        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3975            |bytes, handles| {
3976                match this.inner.channel().read_etc(cx, bytes, handles) {
3977                    std::task::Poll::Ready(Ok(())) => {}
3978                    std::task::Poll::Pending => return std::task::Poll::Pending,
3979                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3980                        this.is_terminated = true;
3981                        return std::task::Poll::Ready(None);
3982                    }
3983                    std::task::Poll::Ready(Err(e)) => {
3984                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3985                            e.into(),
3986                        ))));
3987                    }
3988                }
3989
3990                // A message has been received from the channel
3991                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3992
3993                std::task::Poll::Ready(Some(match header.ordinal {
3994                    0x7559282e8bf18fd6 => {
3995                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3996                        let mut req = fidl::new_empty!(
3997                            ClientProviderGetControllerRequest,
3998                            fidl::encoding::DefaultFuchsiaResourceDialect
3999                        );
4000                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ClientProviderGetControllerRequest>(&header, _body_bytes, handles, &mut req)?;
4001                        let control_handle =
4002                            ClientProviderControlHandle { inner: this.inner.clone() };
4003                        Ok(ClientProviderRequest::GetController {
4004                            requests: req.requests,
4005                            updates: req.updates,
4006
4007                            control_handle,
4008                        })
4009                    }
4010                    _ => Err(fidl::Error::UnknownOrdinal {
4011                        ordinal: header.ordinal,
4012                        protocol_name:
4013                            <ClientProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4014                    }),
4015                }))
4016            },
4017        )
4018    }
4019}
4020
4021/// The ClientProvider API provides a mechanism for wlan control and is intended
4022/// to be called by applications or entities representing the user (ex, Settings).
4023/// This API is not intended to be called by other applications to change wlan
4024/// state without explicit user control.
4025///
4026/// The second aim of this API design is to eliminate the "last-caller wins"
4027/// paradigm by limiting the number of controlling applications.  A single caller
4028/// at a time is permitted to make API calls that impact wlan state.
4029#[derive(Debug)]
4030pub enum ClientProviderRequest {
4031    /// Control channel used by a single caller to trigger wlan client mode state
4032    /// changes.  The caller also provides a channel to receive wlan updates.
4033    /// Only one caller can have the control channel open at a time.  Attempts to
4034    /// register as a controller while there is an active control registration
4035    /// will result in the new caller's provided channel being closed.
4036    GetController {
4037        requests: fidl::endpoints::ServerEnd<ClientControllerMarker>,
4038        updates: fidl::endpoints::ClientEnd<ClientStateUpdatesMarker>,
4039        control_handle: ClientProviderControlHandle,
4040    },
4041}
4042
4043impl ClientProviderRequest {
4044    #[allow(irrefutable_let_patterns)]
4045    pub fn into_get_controller(
4046        self,
4047    ) -> Option<(
4048        fidl::endpoints::ServerEnd<ClientControllerMarker>,
4049        fidl::endpoints::ClientEnd<ClientStateUpdatesMarker>,
4050        ClientProviderControlHandle,
4051    )> {
4052        if let ClientProviderRequest::GetController { requests, updates, control_handle } = self {
4053            Some((requests, updates, control_handle))
4054        } else {
4055            None
4056        }
4057    }
4058
4059    /// Name of the method defined in FIDL
4060    pub fn method_name(&self) -> &'static str {
4061        match *self {
4062            ClientProviderRequest::GetController { .. } => "get_controller",
4063        }
4064    }
4065}
4066
4067#[derive(Debug, Clone)]
4068pub struct ClientProviderControlHandle {
4069    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4070}
4071
4072impl fidl::endpoints::ControlHandle for ClientProviderControlHandle {
4073    fn shutdown(&self) {
4074        self.inner.shutdown()
4075    }
4076
4077    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4078        self.inner.shutdown_with_epitaph(status)
4079    }
4080
4081    fn is_closed(&self) -> bool {
4082        self.inner.channel().is_closed()
4083    }
4084    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4085        self.inner.channel().on_closed()
4086    }
4087
4088    #[cfg(target_os = "fuchsia")]
4089    fn signal_peer(
4090        &self,
4091        clear_mask: zx::Signals,
4092        set_mask: zx::Signals,
4093    ) -> Result<(), zx_status::Status> {
4094        use fidl::Peered;
4095        self.inner.channel().signal_peer(clear_mask, set_mask)
4096    }
4097}
4098
4099impl ClientProviderControlHandle {}
4100
4101#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4102pub struct ClientStateUpdatesMarker;
4103
4104impl fidl::endpoints::ProtocolMarker for ClientStateUpdatesMarker {
4105    type Proxy = ClientStateUpdatesProxy;
4106    type RequestStream = ClientStateUpdatesRequestStream;
4107    #[cfg(target_os = "fuchsia")]
4108    type SynchronousProxy = ClientStateUpdatesSynchronousProxy;
4109
4110    const DEBUG_NAME: &'static str = "(anonymous) ClientStateUpdates";
4111}
4112
4113pub trait ClientStateUpdatesProxyInterface: Send + Sync {
4114    type OnClientStateUpdateResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
4115        + Send;
4116    fn r#on_client_state_update(
4117        &self,
4118        summary: &ClientStateSummary,
4119    ) -> Self::OnClientStateUpdateResponseFut;
4120}
4121#[derive(Debug)]
4122#[cfg(target_os = "fuchsia")]
4123pub struct ClientStateUpdatesSynchronousProxy {
4124    client: fidl::client::sync::Client,
4125}
4126
4127#[cfg(target_os = "fuchsia")]
4128impl fidl::endpoints::SynchronousProxy for ClientStateUpdatesSynchronousProxy {
4129    type Proxy = ClientStateUpdatesProxy;
4130    type Protocol = ClientStateUpdatesMarker;
4131
4132    fn from_channel(inner: fidl::Channel) -> Self {
4133        Self::new(inner)
4134    }
4135
4136    fn into_channel(self) -> fidl::Channel {
4137        self.client.into_channel()
4138    }
4139
4140    fn as_channel(&self) -> &fidl::Channel {
4141        self.client.as_channel()
4142    }
4143}
4144
4145#[cfg(target_os = "fuchsia")]
4146impl ClientStateUpdatesSynchronousProxy {
4147    pub fn new(channel: fidl::Channel) -> Self {
4148        Self { client: fidl::client::sync::Client::new(channel) }
4149    }
4150
4151    pub fn into_channel(self) -> fidl::Channel {
4152        self.client.into_channel()
4153    }
4154
4155    /// Waits until an event arrives and returns it. It is safe for other
4156    /// threads to make concurrent requests while waiting for an event.
4157    pub fn wait_for_event(
4158        &self,
4159        deadline: zx::MonotonicInstant,
4160    ) -> Result<ClientStateUpdatesEvent, fidl::Error> {
4161        ClientStateUpdatesEvent::decode(
4162            self.client.wait_for_event::<ClientStateUpdatesMarker>(deadline)?,
4163        )
4164    }
4165
4166    /// Updates registered listeners with the current summary of wlan client state.
4167    /// This will be called when there is any change to the state and the
4168    /// registered listeners are responsible for deciding what information has
4169    /// changed (since this is dependent on when they last acknowledged the update).
4170    pub fn r#on_client_state_update(
4171        &self,
4172        mut summary: &ClientStateSummary,
4173        ___deadline: zx::MonotonicInstant,
4174    ) -> Result<(), fidl::Error> {
4175        let _response = self.client.send_query::<
4176            ClientStateUpdatesOnClientStateUpdateRequest,
4177            fidl::encoding::EmptyPayload,
4178            ClientStateUpdatesMarker,
4179        >(
4180            (summary,),
4181            0x2a41c1993e122b85,
4182            fidl::encoding::DynamicFlags::empty(),
4183            ___deadline,
4184        )?;
4185        Ok(_response)
4186    }
4187}
4188
4189#[cfg(target_os = "fuchsia")]
4190impl From<ClientStateUpdatesSynchronousProxy> for zx::NullableHandle {
4191    fn from(value: ClientStateUpdatesSynchronousProxy) -> Self {
4192        value.into_channel().into()
4193    }
4194}
4195
4196#[cfg(target_os = "fuchsia")]
4197impl From<fidl::Channel> for ClientStateUpdatesSynchronousProxy {
4198    fn from(value: fidl::Channel) -> Self {
4199        Self::new(value)
4200    }
4201}
4202
4203#[cfg(target_os = "fuchsia")]
4204impl fidl::endpoints::FromClient for ClientStateUpdatesSynchronousProxy {
4205    type Protocol = ClientStateUpdatesMarker;
4206
4207    fn from_client(value: fidl::endpoints::ClientEnd<ClientStateUpdatesMarker>) -> Self {
4208        Self::new(value.into_channel())
4209    }
4210}
4211
4212#[derive(Debug, Clone)]
4213pub struct ClientStateUpdatesProxy {
4214    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4215}
4216
4217impl fidl::endpoints::Proxy for ClientStateUpdatesProxy {
4218    type Protocol = ClientStateUpdatesMarker;
4219
4220    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4221        Self::new(inner)
4222    }
4223
4224    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4225        self.client.into_channel().map_err(|client| Self { client })
4226    }
4227
4228    fn as_channel(&self) -> &::fidl::AsyncChannel {
4229        self.client.as_channel()
4230    }
4231}
4232
4233impl ClientStateUpdatesProxy {
4234    /// Create a new Proxy for fuchsia.wlan.policy/ClientStateUpdates.
4235    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4236        let protocol_name =
4237            <ClientStateUpdatesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4238        Self { client: fidl::client::Client::new(channel, protocol_name) }
4239    }
4240
4241    /// Get a Stream of events from the remote end of the protocol.
4242    ///
4243    /// # Panics
4244    ///
4245    /// Panics if the event stream was already taken.
4246    pub fn take_event_stream(&self) -> ClientStateUpdatesEventStream {
4247        ClientStateUpdatesEventStream { event_receiver: self.client.take_event_receiver() }
4248    }
4249
4250    /// Updates registered listeners with the current summary of wlan client state.
4251    /// This will be called when there is any change to the state and the
4252    /// registered listeners are responsible for deciding what information has
4253    /// changed (since this is dependent on when they last acknowledged the update).
4254    pub fn r#on_client_state_update(
4255        &self,
4256        mut summary: &ClientStateSummary,
4257    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
4258        ClientStateUpdatesProxyInterface::r#on_client_state_update(self, summary)
4259    }
4260}
4261
4262impl ClientStateUpdatesProxyInterface for ClientStateUpdatesProxy {
4263    type OnClientStateUpdateResponseFut =
4264        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
4265    fn r#on_client_state_update(
4266        &self,
4267        mut summary: &ClientStateSummary,
4268    ) -> Self::OnClientStateUpdateResponseFut {
4269        fn _decode(
4270            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4271        ) -> Result<(), fidl::Error> {
4272            let _response = fidl::client::decode_transaction_body::<
4273                fidl::encoding::EmptyPayload,
4274                fidl::encoding::DefaultFuchsiaResourceDialect,
4275                0x2a41c1993e122b85,
4276            >(_buf?)?;
4277            Ok(_response)
4278        }
4279        self.client.send_query_and_decode::<ClientStateUpdatesOnClientStateUpdateRequest, ()>(
4280            (summary,),
4281            0x2a41c1993e122b85,
4282            fidl::encoding::DynamicFlags::empty(),
4283            _decode,
4284        )
4285    }
4286}
4287
4288pub struct ClientStateUpdatesEventStream {
4289    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4290}
4291
4292impl std::marker::Unpin for ClientStateUpdatesEventStream {}
4293
4294impl futures::stream::FusedStream for ClientStateUpdatesEventStream {
4295    fn is_terminated(&self) -> bool {
4296        self.event_receiver.is_terminated()
4297    }
4298}
4299
4300impl futures::Stream for ClientStateUpdatesEventStream {
4301    type Item = Result<ClientStateUpdatesEvent, fidl::Error>;
4302
4303    fn poll_next(
4304        mut self: std::pin::Pin<&mut Self>,
4305        cx: &mut std::task::Context<'_>,
4306    ) -> std::task::Poll<Option<Self::Item>> {
4307        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4308            &mut self.event_receiver,
4309            cx
4310        )?) {
4311            Some(buf) => std::task::Poll::Ready(Some(ClientStateUpdatesEvent::decode(buf))),
4312            None => std::task::Poll::Ready(None),
4313        }
4314    }
4315}
4316
4317#[derive(Debug)]
4318pub enum ClientStateUpdatesEvent {}
4319
4320impl ClientStateUpdatesEvent {
4321    /// Decodes a message buffer as a [`ClientStateUpdatesEvent`].
4322    fn decode(
4323        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4324    ) -> Result<ClientStateUpdatesEvent, fidl::Error> {
4325        let (bytes, _handles) = buf.split_mut();
4326        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4327        debug_assert_eq!(tx_header.tx_id, 0);
4328        match tx_header.ordinal {
4329            _ => Err(fidl::Error::UnknownOrdinal {
4330                ordinal: tx_header.ordinal,
4331                protocol_name:
4332                    <ClientStateUpdatesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4333            }),
4334        }
4335    }
4336}
4337
4338/// A Stream of incoming requests for fuchsia.wlan.policy/ClientStateUpdates.
4339pub struct ClientStateUpdatesRequestStream {
4340    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4341    is_terminated: bool,
4342}
4343
4344impl std::marker::Unpin for ClientStateUpdatesRequestStream {}
4345
4346impl futures::stream::FusedStream for ClientStateUpdatesRequestStream {
4347    fn is_terminated(&self) -> bool {
4348        self.is_terminated
4349    }
4350}
4351
4352impl fidl::endpoints::RequestStream for ClientStateUpdatesRequestStream {
4353    type Protocol = ClientStateUpdatesMarker;
4354    type ControlHandle = ClientStateUpdatesControlHandle;
4355
4356    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4357        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4358    }
4359
4360    fn control_handle(&self) -> Self::ControlHandle {
4361        ClientStateUpdatesControlHandle { inner: self.inner.clone() }
4362    }
4363
4364    fn into_inner(
4365        self,
4366    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4367    {
4368        (self.inner, self.is_terminated)
4369    }
4370
4371    fn from_inner(
4372        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4373        is_terminated: bool,
4374    ) -> Self {
4375        Self { inner, is_terminated }
4376    }
4377}
4378
4379impl futures::Stream for ClientStateUpdatesRequestStream {
4380    type Item = Result<ClientStateUpdatesRequest, fidl::Error>;
4381
4382    fn poll_next(
4383        mut self: std::pin::Pin<&mut Self>,
4384        cx: &mut std::task::Context<'_>,
4385    ) -> std::task::Poll<Option<Self::Item>> {
4386        let this = &mut *self;
4387        if this.inner.check_shutdown(cx) {
4388            this.is_terminated = true;
4389            return std::task::Poll::Ready(None);
4390        }
4391        if this.is_terminated {
4392            panic!("polled ClientStateUpdatesRequestStream after completion");
4393        }
4394        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4395            |bytes, handles| {
4396                match this.inner.channel().read_etc(cx, bytes, handles) {
4397                    std::task::Poll::Ready(Ok(())) => {}
4398                    std::task::Poll::Pending => return std::task::Poll::Pending,
4399                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4400                        this.is_terminated = true;
4401                        return std::task::Poll::Ready(None);
4402                    }
4403                    std::task::Poll::Ready(Err(e)) => {
4404                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4405                            e.into(),
4406                        ))));
4407                    }
4408                }
4409
4410                // A message has been received from the channel
4411                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4412
4413                std::task::Poll::Ready(Some(match header.ordinal {
4414                0x2a41c1993e122b85 => {
4415                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4416                    let mut req = fidl::new_empty!(ClientStateUpdatesOnClientStateUpdateRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4417                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ClientStateUpdatesOnClientStateUpdateRequest>(&header, _body_bytes, handles, &mut req)?;
4418                    let control_handle = ClientStateUpdatesControlHandle {
4419                        inner: this.inner.clone(),
4420                    };
4421                    Ok(ClientStateUpdatesRequest::OnClientStateUpdate {summary: req.summary,
4422
4423                        responder: ClientStateUpdatesOnClientStateUpdateResponder {
4424                            control_handle: std::mem::ManuallyDrop::new(control_handle),
4425                            tx_id: header.tx_id,
4426                        },
4427                    })
4428                }
4429                _ => Err(fidl::Error::UnknownOrdinal {
4430                    ordinal: header.ordinal,
4431                    protocol_name: <ClientStateUpdatesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4432                }),
4433            }))
4434            },
4435        )
4436    }
4437}
4438
4439/// Wlan status changes for client connections and the associated network state.
4440/// These updates contain information about whether or not the device will attempt
4441/// to connect to networks, saved network configuration change information,
4442/// individual connection state information by NetworkIdentifier and connection
4443/// attempt information.  The connection and network related calls are based on
4444/// NetworkIdentifier to allow multiple simultaneous connections on supporting
4445/// devices.
4446#[derive(Debug)]
4447pub enum ClientStateUpdatesRequest {
4448    /// Updates registered listeners with the current summary of wlan client state.
4449    /// This will be called when there is any change to the state and the
4450    /// registered listeners are responsible for deciding what information has
4451    /// changed (since this is dependent on when they last acknowledged the update).
4452    OnClientStateUpdate {
4453        summary: ClientStateSummary,
4454        responder: ClientStateUpdatesOnClientStateUpdateResponder,
4455    },
4456}
4457
4458impl ClientStateUpdatesRequest {
4459    #[allow(irrefutable_let_patterns)]
4460    pub fn into_on_client_state_update(
4461        self,
4462    ) -> Option<(ClientStateSummary, ClientStateUpdatesOnClientStateUpdateResponder)> {
4463        if let ClientStateUpdatesRequest::OnClientStateUpdate { summary, responder } = self {
4464            Some((summary, responder))
4465        } else {
4466            None
4467        }
4468    }
4469
4470    /// Name of the method defined in FIDL
4471    pub fn method_name(&self) -> &'static str {
4472        match *self {
4473            ClientStateUpdatesRequest::OnClientStateUpdate { .. } => "on_client_state_update",
4474        }
4475    }
4476}
4477
4478#[derive(Debug, Clone)]
4479pub struct ClientStateUpdatesControlHandle {
4480    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4481}
4482
4483impl fidl::endpoints::ControlHandle for ClientStateUpdatesControlHandle {
4484    fn shutdown(&self) {
4485        self.inner.shutdown()
4486    }
4487
4488    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4489        self.inner.shutdown_with_epitaph(status)
4490    }
4491
4492    fn is_closed(&self) -> bool {
4493        self.inner.channel().is_closed()
4494    }
4495    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4496        self.inner.channel().on_closed()
4497    }
4498
4499    #[cfg(target_os = "fuchsia")]
4500    fn signal_peer(
4501        &self,
4502        clear_mask: zx::Signals,
4503        set_mask: zx::Signals,
4504    ) -> Result<(), zx_status::Status> {
4505        use fidl::Peered;
4506        self.inner.channel().signal_peer(clear_mask, set_mask)
4507    }
4508}
4509
4510impl ClientStateUpdatesControlHandle {}
4511
4512#[must_use = "FIDL methods require a response to be sent"]
4513#[derive(Debug)]
4514pub struct ClientStateUpdatesOnClientStateUpdateResponder {
4515    control_handle: std::mem::ManuallyDrop<ClientStateUpdatesControlHandle>,
4516    tx_id: u32,
4517}
4518
4519/// Set the the channel to be shutdown (see [`ClientStateUpdatesControlHandle::shutdown`])
4520/// if the responder is dropped without sending a response, so that the client
4521/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4522impl std::ops::Drop for ClientStateUpdatesOnClientStateUpdateResponder {
4523    fn drop(&mut self) {
4524        self.control_handle.shutdown();
4525        // Safety: drops once, never accessed again
4526        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4527    }
4528}
4529
4530impl fidl::endpoints::Responder for ClientStateUpdatesOnClientStateUpdateResponder {
4531    type ControlHandle = ClientStateUpdatesControlHandle;
4532
4533    fn control_handle(&self) -> &ClientStateUpdatesControlHandle {
4534        &self.control_handle
4535    }
4536
4537    fn drop_without_shutdown(mut self) {
4538        // Safety: drops once, never accessed again due to mem::forget
4539        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4540        // Prevent Drop from running (which would shut down the channel)
4541        std::mem::forget(self);
4542    }
4543}
4544
4545impl ClientStateUpdatesOnClientStateUpdateResponder {
4546    /// Sends a response to the FIDL transaction.
4547    ///
4548    /// Sets the channel to shutdown if an error occurs.
4549    pub fn send(self) -> Result<(), fidl::Error> {
4550        let _result = self.send_raw();
4551        if _result.is_err() {
4552            self.control_handle.shutdown();
4553        }
4554        self.drop_without_shutdown();
4555        _result
4556    }
4557
4558    /// Similar to "send" but does not shutdown the channel if an error occurs.
4559    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4560        let _result = self.send_raw();
4561        self.drop_without_shutdown();
4562        _result
4563    }
4564
4565    fn send_raw(&self) -> Result<(), fidl::Error> {
4566        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
4567            (),
4568            self.tx_id,
4569            0x2a41c1993e122b85,
4570            fidl::encoding::DynamicFlags::empty(),
4571        )
4572    }
4573}
4574
4575#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4576pub struct NetworkConfigIteratorMarker;
4577
4578impl fidl::endpoints::ProtocolMarker for NetworkConfigIteratorMarker {
4579    type Proxy = NetworkConfigIteratorProxy;
4580    type RequestStream = NetworkConfigIteratorRequestStream;
4581    #[cfg(target_os = "fuchsia")]
4582    type SynchronousProxy = NetworkConfigIteratorSynchronousProxy;
4583
4584    const DEBUG_NAME: &'static str = "(anonymous) NetworkConfigIterator";
4585}
4586
4587pub trait NetworkConfigIteratorProxyInterface: Send + Sync {
4588    type GetNextResponseFut: std::future::Future<Output = Result<Vec<NetworkConfig>, fidl::Error>>
4589        + Send;
4590    fn r#get_next(&self) -> Self::GetNextResponseFut;
4591}
4592#[derive(Debug)]
4593#[cfg(target_os = "fuchsia")]
4594pub struct NetworkConfigIteratorSynchronousProxy {
4595    client: fidl::client::sync::Client,
4596}
4597
4598#[cfg(target_os = "fuchsia")]
4599impl fidl::endpoints::SynchronousProxy for NetworkConfigIteratorSynchronousProxy {
4600    type Proxy = NetworkConfigIteratorProxy;
4601    type Protocol = NetworkConfigIteratorMarker;
4602
4603    fn from_channel(inner: fidl::Channel) -> Self {
4604        Self::new(inner)
4605    }
4606
4607    fn into_channel(self) -> fidl::Channel {
4608        self.client.into_channel()
4609    }
4610
4611    fn as_channel(&self) -> &fidl::Channel {
4612        self.client.as_channel()
4613    }
4614}
4615
4616#[cfg(target_os = "fuchsia")]
4617impl NetworkConfigIteratorSynchronousProxy {
4618    pub fn new(channel: fidl::Channel) -> Self {
4619        Self { client: fidl::client::sync::Client::new(channel) }
4620    }
4621
4622    pub fn into_channel(self) -> fidl::Channel {
4623        self.client.into_channel()
4624    }
4625
4626    /// Waits until an event arrives and returns it. It is safe for other
4627    /// threads to make concurrent requests while waiting for an event.
4628    pub fn wait_for_event(
4629        &self,
4630        deadline: zx::MonotonicInstant,
4631    ) -> Result<NetworkConfigIteratorEvent, fidl::Error> {
4632        NetworkConfigIteratorEvent::decode(
4633            self.client.wait_for_event::<NetworkConfigIteratorMarker>(deadline)?,
4634        )
4635    }
4636
4637    /// Method allowing the next block of saved networks to be handled.
4638    pub fn r#get_next(
4639        &self,
4640        ___deadline: zx::MonotonicInstant,
4641    ) -> Result<Vec<NetworkConfig>, fidl::Error> {
4642        let _response = self.client.send_query::<
4643            fidl::encoding::EmptyPayload,
4644            NetworkConfigIteratorGetNextResponse,
4645            NetworkConfigIteratorMarker,
4646        >(
4647            (),
4648            0x61686c07483bdec0,
4649            fidl::encoding::DynamicFlags::empty(),
4650            ___deadline,
4651        )?;
4652        Ok(_response.configs)
4653    }
4654}
4655
4656#[cfg(target_os = "fuchsia")]
4657impl From<NetworkConfigIteratorSynchronousProxy> for zx::NullableHandle {
4658    fn from(value: NetworkConfigIteratorSynchronousProxy) -> Self {
4659        value.into_channel().into()
4660    }
4661}
4662
4663#[cfg(target_os = "fuchsia")]
4664impl From<fidl::Channel> for NetworkConfigIteratorSynchronousProxy {
4665    fn from(value: fidl::Channel) -> Self {
4666        Self::new(value)
4667    }
4668}
4669
4670#[cfg(target_os = "fuchsia")]
4671impl fidl::endpoints::FromClient for NetworkConfigIteratorSynchronousProxy {
4672    type Protocol = NetworkConfigIteratorMarker;
4673
4674    fn from_client(value: fidl::endpoints::ClientEnd<NetworkConfigIteratorMarker>) -> Self {
4675        Self::new(value.into_channel())
4676    }
4677}
4678
4679#[derive(Debug, Clone)]
4680pub struct NetworkConfigIteratorProxy {
4681    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4682}
4683
4684impl fidl::endpoints::Proxy for NetworkConfigIteratorProxy {
4685    type Protocol = NetworkConfigIteratorMarker;
4686
4687    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4688        Self::new(inner)
4689    }
4690
4691    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4692        self.client.into_channel().map_err(|client| Self { client })
4693    }
4694
4695    fn as_channel(&self) -> &::fidl::AsyncChannel {
4696        self.client.as_channel()
4697    }
4698}
4699
4700impl NetworkConfigIteratorProxy {
4701    /// Create a new Proxy for fuchsia.wlan.policy/NetworkConfigIterator.
4702    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4703        let protocol_name =
4704            <NetworkConfigIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4705        Self { client: fidl::client::Client::new(channel, protocol_name) }
4706    }
4707
4708    /// Get a Stream of events from the remote end of the protocol.
4709    ///
4710    /// # Panics
4711    ///
4712    /// Panics if the event stream was already taken.
4713    pub fn take_event_stream(&self) -> NetworkConfigIteratorEventStream {
4714        NetworkConfigIteratorEventStream { event_receiver: self.client.take_event_receiver() }
4715    }
4716
4717    /// Method allowing the next block of saved networks to be handled.
4718    pub fn r#get_next(
4719        &self,
4720    ) -> fidl::client::QueryResponseFut<
4721        Vec<NetworkConfig>,
4722        fidl::encoding::DefaultFuchsiaResourceDialect,
4723    > {
4724        NetworkConfigIteratorProxyInterface::r#get_next(self)
4725    }
4726}
4727
4728impl NetworkConfigIteratorProxyInterface for NetworkConfigIteratorProxy {
4729    type GetNextResponseFut = fidl::client::QueryResponseFut<
4730        Vec<NetworkConfig>,
4731        fidl::encoding::DefaultFuchsiaResourceDialect,
4732    >;
4733    fn r#get_next(&self) -> Self::GetNextResponseFut {
4734        fn _decode(
4735            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4736        ) -> Result<Vec<NetworkConfig>, fidl::Error> {
4737            let _response = fidl::client::decode_transaction_body::<
4738                NetworkConfigIteratorGetNextResponse,
4739                fidl::encoding::DefaultFuchsiaResourceDialect,
4740                0x61686c07483bdec0,
4741            >(_buf?)?;
4742            Ok(_response.configs)
4743        }
4744        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<NetworkConfig>>(
4745            (),
4746            0x61686c07483bdec0,
4747            fidl::encoding::DynamicFlags::empty(),
4748            _decode,
4749        )
4750    }
4751}
4752
4753pub struct NetworkConfigIteratorEventStream {
4754    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4755}
4756
4757impl std::marker::Unpin for NetworkConfigIteratorEventStream {}
4758
4759impl futures::stream::FusedStream for NetworkConfigIteratorEventStream {
4760    fn is_terminated(&self) -> bool {
4761        self.event_receiver.is_terminated()
4762    }
4763}
4764
4765impl futures::Stream for NetworkConfigIteratorEventStream {
4766    type Item = Result<NetworkConfigIteratorEvent, fidl::Error>;
4767
4768    fn poll_next(
4769        mut self: std::pin::Pin<&mut Self>,
4770        cx: &mut std::task::Context<'_>,
4771    ) -> std::task::Poll<Option<Self::Item>> {
4772        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4773            &mut self.event_receiver,
4774            cx
4775        )?) {
4776            Some(buf) => std::task::Poll::Ready(Some(NetworkConfigIteratorEvent::decode(buf))),
4777            None => std::task::Poll::Ready(None),
4778        }
4779    }
4780}
4781
4782#[derive(Debug)]
4783pub enum NetworkConfigIteratorEvent {}
4784
4785impl NetworkConfigIteratorEvent {
4786    /// Decodes a message buffer as a [`NetworkConfigIteratorEvent`].
4787    fn decode(
4788        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4789    ) -> Result<NetworkConfigIteratorEvent, fidl::Error> {
4790        let (bytes, _handles) = buf.split_mut();
4791        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4792        debug_assert_eq!(tx_header.tx_id, 0);
4793        match tx_header.ordinal {
4794            _ => Err(fidl::Error::UnknownOrdinal {
4795                ordinal: tx_header.ordinal,
4796                protocol_name:
4797                    <NetworkConfigIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4798            }),
4799        }
4800    }
4801}
4802
4803/// A Stream of incoming requests for fuchsia.wlan.policy/NetworkConfigIterator.
4804pub struct NetworkConfigIteratorRequestStream {
4805    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4806    is_terminated: bool,
4807}
4808
4809impl std::marker::Unpin for NetworkConfigIteratorRequestStream {}
4810
4811impl futures::stream::FusedStream for NetworkConfigIteratorRequestStream {
4812    fn is_terminated(&self) -> bool {
4813        self.is_terminated
4814    }
4815}
4816
4817impl fidl::endpoints::RequestStream for NetworkConfigIteratorRequestStream {
4818    type Protocol = NetworkConfigIteratorMarker;
4819    type ControlHandle = NetworkConfigIteratorControlHandle;
4820
4821    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4822        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4823    }
4824
4825    fn control_handle(&self) -> Self::ControlHandle {
4826        NetworkConfigIteratorControlHandle { inner: self.inner.clone() }
4827    }
4828
4829    fn into_inner(
4830        self,
4831    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4832    {
4833        (self.inner, self.is_terminated)
4834    }
4835
4836    fn from_inner(
4837        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4838        is_terminated: bool,
4839    ) -> Self {
4840        Self { inner, is_terminated }
4841    }
4842}
4843
4844impl futures::Stream for NetworkConfigIteratorRequestStream {
4845    type Item = Result<NetworkConfigIteratorRequest, fidl::Error>;
4846
4847    fn poll_next(
4848        mut self: std::pin::Pin<&mut Self>,
4849        cx: &mut std::task::Context<'_>,
4850    ) -> std::task::Poll<Option<Self::Item>> {
4851        let this = &mut *self;
4852        if this.inner.check_shutdown(cx) {
4853            this.is_terminated = true;
4854            return std::task::Poll::Ready(None);
4855        }
4856        if this.is_terminated {
4857            panic!("polled NetworkConfigIteratorRequestStream after completion");
4858        }
4859        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4860            |bytes, handles| {
4861                match this.inner.channel().read_etc(cx, bytes, handles) {
4862                    std::task::Poll::Ready(Ok(())) => {}
4863                    std::task::Poll::Pending => return std::task::Poll::Pending,
4864                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4865                        this.is_terminated = true;
4866                        return std::task::Poll::Ready(None);
4867                    }
4868                    std::task::Poll::Ready(Err(e)) => {
4869                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4870                            e.into(),
4871                        ))));
4872                    }
4873                }
4874
4875                // A message has been received from the channel
4876                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4877
4878                std::task::Poll::Ready(Some(match header.ordinal {
4879                0x61686c07483bdec0 => {
4880                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4881                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
4882                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4883                    let control_handle = NetworkConfigIteratorControlHandle {
4884                        inner: this.inner.clone(),
4885                    };
4886                    Ok(NetworkConfigIteratorRequest::GetNext {
4887                        responder: NetworkConfigIteratorGetNextResponder {
4888                            control_handle: std::mem::ManuallyDrop::new(control_handle),
4889                            tx_id: header.tx_id,
4890                        },
4891                    })
4892                }
4893                _ => Err(fidl::Error::UnknownOrdinal {
4894                    ordinal: header.ordinal,
4895                    protocol_name: <NetworkConfigIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4896                }),
4897            }))
4898            },
4899        )
4900    }
4901}
4902
4903/// Iterator used by callers to retrieve saved network information.
4904#[derive(Debug)]
4905pub enum NetworkConfigIteratorRequest {
4906    /// Method allowing the next block of saved networks to be handled.
4907    GetNext { responder: NetworkConfigIteratorGetNextResponder },
4908}
4909
4910impl NetworkConfigIteratorRequest {
4911    #[allow(irrefutable_let_patterns)]
4912    pub fn into_get_next(self) -> Option<(NetworkConfigIteratorGetNextResponder)> {
4913        if let NetworkConfigIteratorRequest::GetNext { responder } = self {
4914            Some((responder))
4915        } else {
4916            None
4917        }
4918    }
4919
4920    /// Name of the method defined in FIDL
4921    pub fn method_name(&self) -> &'static str {
4922        match *self {
4923            NetworkConfigIteratorRequest::GetNext { .. } => "get_next",
4924        }
4925    }
4926}
4927
4928#[derive(Debug, Clone)]
4929pub struct NetworkConfigIteratorControlHandle {
4930    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4931}
4932
4933impl fidl::endpoints::ControlHandle for NetworkConfigIteratorControlHandle {
4934    fn shutdown(&self) {
4935        self.inner.shutdown()
4936    }
4937
4938    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4939        self.inner.shutdown_with_epitaph(status)
4940    }
4941
4942    fn is_closed(&self) -> bool {
4943        self.inner.channel().is_closed()
4944    }
4945    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4946        self.inner.channel().on_closed()
4947    }
4948
4949    #[cfg(target_os = "fuchsia")]
4950    fn signal_peer(
4951        &self,
4952        clear_mask: zx::Signals,
4953        set_mask: zx::Signals,
4954    ) -> Result<(), zx_status::Status> {
4955        use fidl::Peered;
4956        self.inner.channel().signal_peer(clear_mask, set_mask)
4957    }
4958}
4959
4960impl NetworkConfigIteratorControlHandle {}
4961
4962#[must_use = "FIDL methods require a response to be sent"]
4963#[derive(Debug)]
4964pub struct NetworkConfigIteratorGetNextResponder {
4965    control_handle: std::mem::ManuallyDrop<NetworkConfigIteratorControlHandle>,
4966    tx_id: u32,
4967}
4968
4969/// Set the the channel to be shutdown (see [`NetworkConfigIteratorControlHandle::shutdown`])
4970/// if the responder is dropped without sending a response, so that the client
4971/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4972impl std::ops::Drop for NetworkConfigIteratorGetNextResponder {
4973    fn drop(&mut self) {
4974        self.control_handle.shutdown();
4975        // Safety: drops once, never accessed again
4976        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4977    }
4978}
4979
4980impl fidl::endpoints::Responder for NetworkConfigIteratorGetNextResponder {
4981    type ControlHandle = NetworkConfigIteratorControlHandle;
4982
4983    fn control_handle(&self) -> &NetworkConfigIteratorControlHandle {
4984        &self.control_handle
4985    }
4986
4987    fn drop_without_shutdown(mut self) {
4988        // Safety: drops once, never accessed again due to mem::forget
4989        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4990        // Prevent Drop from running (which would shut down the channel)
4991        std::mem::forget(self);
4992    }
4993}
4994
4995impl NetworkConfigIteratorGetNextResponder {
4996    /// Sends a response to the FIDL transaction.
4997    ///
4998    /// Sets the channel to shutdown if an error occurs.
4999    pub fn send(self, mut configs: &[NetworkConfig]) -> Result<(), fidl::Error> {
5000        let _result = self.send_raw(configs);
5001        if _result.is_err() {
5002            self.control_handle.shutdown();
5003        }
5004        self.drop_without_shutdown();
5005        _result
5006    }
5007
5008    /// Similar to "send" but does not shutdown the channel if an error occurs.
5009    pub fn send_no_shutdown_on_err(self, mut configs: &[NetworkConfig]) -> Result<(), fidl::Error> {
5010        let _result = self.send_raw(configs);
5011        self.drop_without_shutdown();
5012        _result
5013    }
5014
5015    fn send_raw(&self, mut configs: &[NetworkConfig]) -> Result<(), fidl::Error> {
5016        self.control_handle.inner.send::<NetworkConfigIteratorGetNextResponse>(
5017            (configs,),
5018            self.tx_id,
5019            0x61686c07483bdec0,
5020            fidl::encoding::DynamicFlags::empty(),
5021        )
5022    }
5023}
5024
5025#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5026pub struct ScanResultIteratorMarker;
5027
5028impl fidl::endpoints::ProtocolMarker for ScanResultIteratorMarker {
5029    type Proxy = ScanResultIteratorProxy;
5030    type RequestStream = ScanResultIteratorRequestStream;
5031    #[cfg(target_os = "fuchsia")]
5032    type SynchronousProxy = ScanResultIteratorSynchronousProxy;
5033
5034    const DEBUG_NAME: &'static str = "(anonymous) ScanResultIterator";
5035}
5036pub type ScanResultIteratorGetNextResult = Result<Vec<ScanResult>, ScanErrorCode>;
5037
5038pub trait ScanResultIteratorProxyInterface: Send + Sync {
5039    type GetNextResponseFut: std::future::Future<Output = Result<ScanResultIteratorGetNextResult, fidl::Error>>
5040        + Send;
5041    fn r#get_next(&self) -> Self::GetNextResponseFut;
5042}
5043#[derive(Debug)]
5044#[cfg(target_os = "fuchsia")]
5045pub struct ScanResultIteratorSynchronousProxy {
5046    client: fidl::client::sync::Client,
5047}
5048
5049#[cfg(target_os = "fuchsia")]
5050impl fidl::endpoints::SynchronousProxy for ScanResultIteratorSynchronousProxy {
5051    type Proxy = ScanResultIteratorProxy;
5052    type Protocol = ScanResultIteratorMarker;
5053
5054    fn from_channel(inner: fidl::Channel) -> Self {
5055        Self::new(inner)
5056    }
5057
5058    fn into_channel(self) -> fidl::Channel {
5059        self.client.into_channel()
5060    }
5061
5062    fn as_channel(&self) -> &fidl::Channel {
5063        self.client.as_channel()
5064    }
5065}
5066
5067#[cfg(target_os = "fuchsia")]
5068impl ScanResultIteratorSynchronousProxy {
5069    pub fn new(channel: fidl::Channel) -> Self {
5070        Self { client: fidl::client::sync::Client::new(channel) }
5071    }
5072
5073    pub fn into_channel(self) -> fidl::Channel {
5074        self.client.into_channel()
5075    }
5076
5077    /// Waits until an event arrives and returns it. It is safe for other
5078    /// threads to make concurrent requests while waiting for an event.
5079    pub fn wait_for_event(
5080        &self,
5081        deadline: zx::MonotonicInstant,
5082    ) -> Result<ScanResultIteratorEvent, fidl::Error> {
5083        ScanResultIteratorEvent::decode(
5084            self.client.wait_for_event::<ScanResultIteratorMarker>(deadline)?,
5085        )
5086    }
5087
5088    /// Allows caller to request the next set of scan results.
5089    /// After all scan results have been sent, the next call to GetNext will return
5090    /// an empty vector and the channel will be closed.
5091    /// If an error is encountered during the scan, the error will be returned and
5092    /// the channel will be closed. No scan results will be provided.
5093    pub fn r#get_next(
5094        &self,
5095        ___deadline: zx::MonotonicInstant,
5096    ) -> Result<ScanResultIteratorGetNextResult, fidl::Error> {
5097        let _response =
5098            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
5099                ScanResultIteratorGetNextResponse,
5100                ScanErrorCode,
5101            >, ScanResultIteratorMarker>(
5102                (),
5103                0x29cb4912ab2dc51f,
5104                fidl::encoding::DynamicFlags::empty(),
5105                ___deadline,
5106            )?;
5107        Ok(_response.map(|x| x.scan_results))
5108    }
5109}
5110
5111#[cfg(target_os = "fuchsia")]
5112impl From<ScanResultIteratorSynchronousProxy> for zx::NullableHandle {
5113    fn from(value: ScanResultIteratorSynchronousProxy) -> Self {
5114        value.into_channel().into()
5115    }
5116}
5117
5118#[cfg(target_os = "fuchsia")]
5119impl From<fidl::Channel> for ScanResultIteratorSynchronousProxy {
5120    fn from(value: fidl::Channel) -> Self {
5121        Self::new(value)
5122    }
5123}
5124
5125#[cfg(target_os = "fuchsia")]
5126impl fidl::endpoints::FromClient for ScanResultIteratorSynchronousProxy {
5127    type Protocol = ScanResultIteratorMarker;
5128
5129    fn from_client(value: fidl::endpoints::ClientEnd<ScanResultIteratorMarker>) -> Self {
5130        Self::new(value.into_channel())
5131    }
5132}
5133
5134#[derive(Debug, Clone)]
5135pub struct ScanResultIteratorProxy {
5136    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5137}
5138
5139impl fidl::endpoints::Proxy for ScanResultIteratorProxy {
5140    type Protocol = ScanResultIteratorMarker;
5141
5142    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5143        Self::new(inner)
5144    }
5145
5146    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5147        self.client.into_channel().map_err(|client| Self { client })
5148    }
5149
5150    fn as_channel(&self) -> &::fidl::AsyncChannel {
5151        self.client.as_channel()
5152    }
5153}
5154
5155impl ScanResultIteratorProxy {
5156    /// Create a new Proxy for fuchsia.wlan.policy/ScanResultIterator.
5157    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5158        let protocol_name =
5159            <ScanResultIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5160        Self { client: fidl::client::Client::new(channel, protocol_name) }
5161    }
5162
5163    /// Get a Stream of events from the remote end of the protocol.
5164    ///
5165    /// # Panics
5166    ///
5167    /// Panics if the event stream was already taken.
5168    pub fn take_event_stream(&self) -> ScanResultIteratorEventStream {
5169        ScanResultIteratorEventStream { event_receiver: self.client.take_event_receiver() }
5170    }
5171
5172    /// Allows caller to request the next set of scan results.
5173    /// After all scan results have been sent, the next call to GetNext will return
5174    /// an empty vector and the channel will be closed.
5175    /// If an error is encountered during the scan, the error will be returned and
5176    /// the channel will be closed. No scan results will be provided.
5177    pub fn r#get_next(
5178        &self,
5179    ) -> fidl::client::QueryResponseFut<
5180        ScanResultIteratorGetNextResult,
5181        fidl::encoding::DefaultFuchsiaResourceDialect,
5182    > {
5183        ScanResultIteratorProxyInterface::r#get_next(self)
5184    }
5185}
5186
5187impl ScanResultIteratorProxyInterface for ScanResultIteratorProxy {
5188    type GetNextResponseFut = fidl::client::QueryResponseFut<
5189        ScanResultIteratorGetNextResult,
5190        fidl::encoding::DefaultFuchsiaResourceDialect,
5191    >;
5192    fn r#get_next(&self) -> Self::GetNextResponseFut {
5193        fn _decode(
5194            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5195        ) -> Result<ScanResultIteratorGetNextResult, fidl::Error> {
5196            let _response = fidl::client::decode_transaction_body::<
5197                fidl::encoding::ResultType<ScanResultIteratorGetNextResponse, ScanErrorCode>,
5198                fidl::encoding::DefaultFuchsiaResourceDialect,
5199                0x29cb4912ab2dc51f,
5200            >(_buf?)?;
5201            Ok(_response.map(|x| x.scan_results))
5202        }
5203        self.client
5204            .send_query_and_decode::<fidl::encoding::EmptyPayload, ScanResultIteratorGetNextResult>(
5205                (),
5206                0x29cb4912ab2dc51f,
5207                fidl::encoding::DynamicFlags::empty(),
5208                _decode,
5209            )
5210    }
5211}
5212
5213pub struct ScanResultIteratorEventStream {
5214    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5215}
5216
5217impl std::marker::Unpin for ScanResultIteratorEventStream {}
5218
5219impl futures::stream::FusedStream for ScanResultIteratorEventStream {
5220    fn is_terminated(&self) -> bool {
5221        self.event_receiver.is_terminated()
5222    }
5223}
5224
5225impl futures::Stream for ScanResultIteratorEventStream {
5226    type Item = Result<ScanResultIteratorEvent, fidl::Error>;
5227
5228    fn poll_next(
5229        mut self: std::pin::Pin<&mut Self>,
5230        cx: &mut std::task::Context<'_>,
5231    ) -> std::task::Poll<Option<Self::Item>> {
5232        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5233            &mut self.event_receiver,
5234            cx
5235        )?) {
5236            Some(buf) => std::task::Poll::Ready(Some(ScanResultIteratorEvent::decode(buf))),
5237            None => std::task::Poll::Ready(None),
5238        }
5239    }
5240}
5241
5242#[derive(Debug)]
5243pub enum ScanResultIteratorEvent {}
5244
5245impl ScanResultIteratorEvent {
5246    /// Decodes a message buffer as a [`ScanResultIteratorEvent`].
5247    fn decode(
5248        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5249    ) -> Result<ScanResultIteratorEvent, fidl::Error> {
5250        let (bytes, _handles) = buf.split_mut();
5251        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5252        debug_assert_eq!(tx_header.tx_id, 0);
5253        match tx_header.ordinal {
5254            _ => Err(fidl::Error::UnknownOrdinal {
5255                ordinal: tx_header.ordinal,
5256                protocol_name:
5257                    <ScanResultIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5258            }),
5259        }
5260    }
5261}
5262
5263/// A Stream of incoming requests for fuchsia.wlan.policy/ScanResultIterator.
5264pub struct ScanResultIteratorRequestStream {
5265    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5266    is_terminated: bool,
5267}
5268
5269impl std::marker::Unpin for ScanResultIteratorRequestStream {}
5270
5271impl futures::stream::FusedStream for ScanResultIteratorRequestStream {
5272    fn is_terminated(&self) -> bool {
5273        self.is_terminated
5274    }
5275}
5276
5277impl fidl::endpoints::RequestStream for ScanResultIteratorRequestStream {
5278    type Protocol = ScanResultIteratorMarker;
5279    type ControlHandle = ScanResultIteratorControlHandle;
5280
5281    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5282        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5283    }
5284
5285    fn control_handle(&self) -> Self::ControlHandle {
5286        ScanResultIteratorControlHandle { inner: self.inner.clone() }
5287    }
5288
5289    fn into_inner(
5290        self,
5291    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5292    {
5293        (self.inner, self.is_terminated)
5294    }
5295
5296    fn from_inner(
5297        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5298        is_terminated: bool,
5299    ) -> Self {
5300        Self { inner, is_terminated }
5301    }
5302}
5303
5304impl futures::Stream for ScanResultIteratorRequestStream {
5305    type Item = Result<ScanResultIteratorRequest, fidl::Error>;
5306
5307    fn poll_next(
5308        mut self: std::pin::Pin<&mut Self>,
5309        cx: &mut std::task::Context<'_>,
5310    ) -> std::task::Poll<Option<Self::Item>> {
5311        let this = &mut *self;
5312        if this.inner.check_shutdown(cx) {
5313            this.is_terminated = true;
5314            return std::task::Poll::Ready(None);
5315        }
5316        if this.is_terminated {
5317            panic!("polled ScanResultIteratorRequestStream after completion");
5318        }
5319        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5320            |bytes, handles| {
5321                match this.inner.channel().read_etc(cx, bytes, handles) {
5322                    std::task::Poll::Ready(Ok(())) => {}
5323                    std::task::Poll::Pending => return std::task::Poll::Pending,
5324                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5325                        this.is_terminated = true;
5326                        return std::task::Poll::Ready(None);
5327                    }
5328                    std::task::Poll::Ready(Err(e)) => {
5329                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5330                            e.into(),
5331                        ))));
5332                    }
5333                }
5334
5335                // A message has been received from the channel
5336                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5337
5338                std::task::Poll::Ready(Some(match header.ordinal {
5339                0x29cb4912ab2dc51f => {
5340                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5341                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
5342                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5343                    let control_handle = ScanResultIteratorControlHandle {
5344                        inner: this.inner.clone(),
5345                    };
5346                    Ok(ScanResultIteratorRequest::GetNext {
5347                        responder: ScanResultIteratorGetNextResponder {
5348                            control_handle: std::mem::ManuallyDrop::new(control_handle),
5349                            tx_id: header.tx_id,
5350                        },
5351                    })
5352                }
5353                _ => Err(fidl::Error::UnknownOrdinal {
5354                    ordinal: header.ordinal,
5355                    protocol_name: <ScanResultIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5356                }),
5357            }))
5358            },
5359        )
5360    }
5361}
5362
5363/// Iterator used to send back scan results to the caller.  The corresponding channel
5364/// will be closed after the scan is complete and results are returned or fails due
5365/// to an error.
5366#[derive(Debug)]
5367pub enum ScanResultIteratorRequest {
5368    /// Allows caller to request the next set of scan results.
5369    /// After all scan results have been sent, the next call to GetNext will return
5370    /// an empty vector and the channel will be closed.
5371    /// If an error is encountered during the scan, the error will be returned and
5372    /// the channel will be closed. No scan results will be provided.
5373    GetNext { responder: ScanResultIteratorGetNextResponder },
5374}
5375
5376impl ScanResultIteratorRequest {
5377    #[allow(irrefutable_let_patterns)]
5378    pub fn into_get_next(self) -> Option<(ScanResultIteratorGetNextResponder)> {
5379        if let ScanResultIteratorRequest::GetNext { responder } = self {
5380            Some((responder))
5381        } else {
5382            None
5383        }
5384    }
5385
5386    /// Name of the method defined in FIDL
5387    pub fn method_name(&self) -> &'static str {
5388        match *self {
5389            ScanResultIteratorRequest::GetNext { .. } => "get_next",
5390        }
5391    }
5392}
5393
5394#[derive(Debug, Clone)]
5395pub struct ScanResultIteratorControlHandle {
5396    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5397}
5398
5399impl fidl::endpoints::ControlHandle for ScanResultIteratorControlHandle {
5400    fn shutdown(&self) {
5401        self.inner.shutdown()
5402    }
5403
5404    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5405        self.inner.shutdown_with_epitaph(status)
5406    }
5407
5408    fn is_closed(&self) -> bool {
5409        self.inner.channel().is_closed()
5410    }
5411    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5412        self.inner.channel().on_closed()
5413    }
5414
5415    #[cfg(target_os = "fuchsia")]
5416    fn signal_peer(
5417        &self,
5418        clear_mask: zx::Signals,
5419        set_mask: zx::Signals,
5420    ) -> Result<(), zx_status::Status> {
5421        use fidl::Peered;
5422        self.inner.channel().signal_peer(clear_mask, set_mask)
5423    }
5424}
5425
5426impl ScanResultIteratorControlHandle {}
5427
5428#[must_use = "FIDL methods require a response to be sent"]
5429#[derive(Debug)]
5430pub struct ScanResultIteratorGetNextResponder {
5431    control_handle: std::mem::ManuallyDrop<ScanResultIteratorControlHandle>,
5432    tx_id: u32,
5433}
5434
5435/// Set the the channel to be shutdown (see [`ScanResultIteratorControlHandle::shutdown`])
5436/// if the responder is dropped without sending a response, so that the client
5437/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5438impl std::ops::Drop for ScanResultIteratorGetNextResponder {
5439    fn drop(&mut self) {
5440        self.control_handle.shutdown();
5441        // Safety: drops once, never accessed again
5442        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5443    }
5444}
5445
5446impl fidl::endpoints::Responder for ScanResultIteratorGetNextResponder {
5447    type ControlHandle = ScanResultIteratorControlHandle;
5448
5449    fn control_handle(&self) -> &ScanResultIteratorControlHandle {
5450        &self.control_handle
5451    }
5452
5453    fn drop_without_shutdown(mut self) {
5454        // Safety: drops once, never accessed again due to mem::forget
5455        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5456        // Prevent Drop from running (which would shut down the channel)
5457        std::mem::forget(self);
5458    }
5459}
5460
5461impl ScanResultIteratorGetNextResponder {
5462    /// Sends a response to the FIDL transaction.
5463    ///
5464    /// Sets the channel to shutdown if an error occurs.
5465    pub fn send(self, mut result: Result<&[ScanResult], ScanErrorCode>) -> Result<(), fidl::Error> {
5466        let _result = self.send_raw(result);
5467        if _result.is_err() {
5468            self.control_handle.shutdown();
5469        }
5470        self.drop_without_shutdown();
5471        _result
5472    }
5473
5474    /// Similar to "send" but does not shutdown the channel if an error occurs.
5475    pub fn send_no_shutdown_on_err(
5476        self,
5477        mut result: Result<&[ScanResult], ScanErrorCode>,
5478    ) -> Result<(), fidl::Error> {
5479        let _result = self.send_raw(result);
5480        self.drop_without_shutdown();
5481        _result
5482    }
5483
5484    fn send_raw(
5485        &self,
5486        mut result: Result<&[ScanResult], ScanErrorCode>,
5487    ) -> Result<(), fidl::Error> {
5488        self.control_handle.inner.send::<fidl::encoding::ResultType<
5489            ScanResultIteratorGetNextResponse,
5490            ScanErrorCode,
5491        >>(
5492            result.map(|scan_results| (scan_results,)),
5493            self.tx_id,
5494            0x29cb4912ab2dc51f,
5495            fidl::encoding::DynamicFlags::empty(),
5496        )
5497    }
5498}
5499
5500mod internal {
5501    use super::*;
5502
5503    impl fidl::encoding::ResourceTypeMarker for AccessPointListenerGetListenerRequest {
5504        type Borrowed<'a> = &'a mut Self;
5505        fn take_or_borrow<'a>(
5506            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5507        ) -> Self::Borrowed<'a> {
5508            value
5509        }
5510    }
5511
5512    unsafe impl fidl::encoding::TypeMarker for AccessPointListenerGetListenerRequest {
5513        type Owned = Self;
5514
5515        #[inline(always)]
5516        fn inline_align(_context: fidl::encoding::Context) -> usize {
5517            4
5518        }
5519
5520        #[inline(always)]
5521        fn inline_size(_context: fidl::encoding::Context) -> usize {
5522            4
5523        }
5524    }
5525
5526    unsafe impl
5527        fidl::encoding::Encode<
5528            AccessPointListenerGetListenerRequest,
5529            fidl::encoding::DefaultFuchsiaResourceDialect,
5530        > for &mut AccessPointListenerGetListenerRequest
5531    {
5532        #[inline]
5533        unsafe fn encode(
5534            self,
5535            encoder: &mut fidl::encoding::Encoder<
5536                '_,
5537                fidl::encoding::DefaultFuchsiaResourceDialect,
5538            >,
5539            offset: usize,
5540            _depth: fidl::encoding::Depth,
5541        ) -> fidl::Result<()> {
5542            encoder.debug_check_bounds::<AccessPointListenerGetListenerRequest>(offset);
5543            // Delegate to tuple encoding.
5544            fidl::encoding::Encode::<
5545                AccessPointListenerGetListenerRequest,
5546                fidl::encoding::DefaultFuchsiaResourceDialect,
5547            >::encode(
5548                (<fidl::encoding::Endpoint<
5549                    fidl::endpoints::ClientEnd<AccessPointStateUpdatesMarker>,
5550                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5551                    &mut self.updates
5552                ),),
5553                encoder,
5554                offset,
5555                _depth,
5556            )
5557        }
5558    }
5559    unsafe impl<
5560        T0: fidl::encoding::Encode<
5561                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AccessPointStateUpdatesMarker>>,
5562                fidl::encoding::DefaultFuchsiaResourceDialect,
5563            >,
5564    >
5565        fidl::encoding::Encode<
5566            AccessPointListenerGetListenerRequest,
5567            fidl::encoding::DefaultFuchsiaResourceDialect,
5568        > for (T0,)
5569    {
5570        #[inline]
5571        unsafe fn encode(
5572            self,
5573            encoder: &mut fidl::encoding::Encoder<
5574                '_,
5575                fidl::encoding::DefaultFuchsiaResourceDialect,
5576            >,
5577            offset: usize,
5578            depth: fidl::encoding::Depth,
5579        ) -> fidl::Result<()> {
5580            encoder.debug_check_bounds::<AccessPointListenerGetListenerRequest>(offset);
5581            // Zero out padding regions. There's no need to apply masks
5582            // because the unmasked parts will be overwritten by fields.
5583            // Write the fields.
5584            self.0.encode(encoder, offset + 0, depth)?;
5585            Ok(())
5586        }
5587    }
5588
5589    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5590        for AccessPointListenerGetListenerRequest
5591    {
5592        #[inline(always)]
5593        fn new_empty() -> Self {
5594            Self {
5595                updates: fidl::new_empty!(
5596                    fidl::encoding::Endpoint<
5597                        fidl::endpoints::ClientEnd<AccessPointStateUpdatesMarker>,
5598                    >,
5599                    fidl::encoding::DefaultFuchsiaResourceDialect
5600                ),
5601            }
5602        }
5603
5604        #[inline]
5605        unsafe fn decode(
5606            &mut self,
5607            decoder: &mut fidl::encoding::Decoder<
5608                '_,
5609                fidl::encoding::DefaultFuchsiaResourceDialect,
5610            >,
5611            offset: usize,
5612            _depth: fidl::encoding::Depth,
5613        ) -> fidl::Result<()> {
5614            decoder.debug_check_bounds::<Self>(offset);
5615            // Verify that padding bytes are zero.
5616            fidl::decode!(
5617                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AccessPointStateUpdatesMarker>>,
5618                fidl::encoding::DefaultFuchsiaResourceDialect,
5619                &mut self.updates,
5620                decoder,
5621                offset + 0,
5622                _depth
5623            )?;
5624            Ok(())
5625        }
5626    }
5627
5628    impl fidl::encoding::ResourceTypeMarker for AccessPointProviderGetControllerRequest {
5629        type Borrowed<'a> = &'a mut Self;
5630        fn take_or_borrow<'a>(
5631            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5632        ) -> Self::Borrowed<'a> {
5633            value
5634        }
5635    }
5636
5637    unsafe impl fidl::encoding::TypeMarker for AccessPointProviderGetControllerRequest {
5638        type Owned = Self;
5639
5640        #[inline(always)]
5641        fn inline_align(_context: fidl::encoding::Context) -> usize {
5642            4
5643        }
5644
5645        #[inline(always)]
5646        fn inline_size(_context: fidl::encoding::Context) -> usize {
5647            8
5648        }
5649    }
5650
5651    unsafe impl
5652        fidl::encoding::Encode<
5653            AccessPointProviderGetControllerRequest,
5654            fidl::encoding::DefaultFuchsiaResourceDialect,
5655        > for &mut AccessPointProviderGetControllerRequest
5656    {
5657        #[inline]
5658        unsafe fn encode(
5659            self,
5660            encoder: &mut fidl::encoding::Encoder<
5661                '_,
5662                fidl::encoding::DefaultFuchsiaResourceDialect,
5663            >,
5664            offset: usize,
5665            _depth: fidl::encoding::Depth,
5666        ) -> fidl::Result<()> {
5667            encoder.debug_check_bounds::<AccessPointProviderGetControllerRequest>(offset);
5668            // Delegate to tuple encoding.
5669            fidl::encoding::Encode::<
5670                AccessPointProviderGetControllerRequest,
5671                fidl::encoding::DefaultFuchsiaResourceDialect,
5672            >::encode(
5673                (
5674                    <fidl::encoding::Endpoint<
5675                        fidl::endpoints::ServerEnd<AccessPointControllerMarker>,
5676                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5677                        &mut self.requests
5678                    ),
5679                    <fidl::encoding::Endpoint<
5680                        fidl::endpoints::ClientEnd<AccessPointStateUpdatesMarker>,
5681                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5682                        &mut self.updates
5683                    ),
5684                ),
5685                encoder,
5686                offset,
5687                _depth,
5688            )
5689        }
5690    }
5691    unsafe impl<
5692        T0: fidl::encoding::Encode<
5693                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AccessPointControllerMarker>>,
5694                fidl::encoding::DefaultFuchsiaResourceDialect,
5695            >,
5696        T1: fidl::encoding::Encode<
5697                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AccessPointStateUpdatesMarker>>,
5698                fidl::encoding::DefaultFuchsiaResourceDialect,
5699            >,
5700    >
5701        fidl::encoding::Encode<
5702            AccessPointProviderGetControllerRequest,
5703            fidl::encoding::DefaultFuchsiaResourceDialect,
5704        > for (T0, T1)
5705    {
5706        #[inline]
5707        unsafe fn encode(
5708            self,
5709            encoder: &mut fidl::encoding::Encoder<
5710                '_,
5711                fidl::encoding::DefaultFuchsiaResourceDialect,
5712            >,
5713            offset: usize,
5714            depth: fidl::encoding::Depth,
5715        ) -> fidl::Result<()> {
5716            encoder.debug_check_bounds::<AccessPointProviderGetControllerRequest>(offset);
5717            // Zero out padding regions. There's no need to apply masks
5718            // because the unmasked parts will be overwritten by fields.
5719            // Write the fields.
5720            self.0.encode(encoder, offset + 0, depth)?;
5721            self.1.encode(encoder, offset + 4, depth)?;
5722            Ok(())
5723        }
5724    }
5725
5726    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5727        for AccessPointProviderGetControllerRequest
5728    {
5729        #[inline(always)]
5730        fn new_empty() -> Self {
5731            Self {
5732                requests: fidl::new_empty!(
5733                    fidl::encoding::Endpoint<
5734                        fidl::endpoints::ServerEnd<AccessPointControllerMarker>,
5735                    >,
5736                    fidl::encoding::DefaultFuchsiaResourceDialect
5737                ),
5738                updates: fidl::new_empty!(
5739                    fidl::encoding::Endpoint<
5740                        fidl::endpoints::ClientEnd<AccessPointStateUpdatesMarker>,
5741                    >,
5742                    fidl::encoding::DefaultFuchsiaResourceDialect
5743                ),
5744            }
5745        }
5746
5747        #[inline]
5748        unsafe fn decode(
5749            &mut self,
5750            decoder: &mut fidl::encoding::Decoder<
5751                '_,
5752                fidl::encoding::DefaultFuchsiaResourceDialect,
5753            >,
5754            offset: usize,
5755            _depth: fidl::encoding::Depth,
5756        ) -> fidl::Result<()> {
5757            decoder.debug_check_bounds::<Self>(offset);
5758            // Verify that padding bytes are zero.
5759            fidl::decode!(
5760                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AccessPointControllerMarker>>,
5761                fidl::encoding::DefaultFuchsiaResourceDialect,
5762                &mut self.requests,
5763                decoder,
5764                offset + 0,
5765                _depth
5766            )?;
5767            fidl::decode!(
5768                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<AccessPointStateUpdatesMarker>>,
5769                fidl::encoding::DefaultFuchsiaResourceDialect,
5770                &mut self.updates,
5771                decoder,
5772                offset + 4,
5773                _depth
5774            )?;
5775            Ok(())
5776        }
5777    }
5778
5779    impl fidl::encoding::ResourceTypeMarker for ClientControllerGetSavedNetworksRequest {
5780        type Borrowed<'a> = &'a mut Self;
5781        fn take_or_borrow<'a>(
5782            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5783        ) -> Self::Borrowed<'a> {
5784            value
5785        }
5786    }
5787
5788    unsafe impl fidl::encoding::TypeMarker for ClientControllerGetSavedNetworksRequest {
5789        type Owned = Self;
5790
5791        #[inline(always)]
5792        fn inline_align(_context: fidl::encoding::Context) -> usize {
5793            4
5794        }
5795
5796        #[inline(always)]
5797        fn inline_size(_context: fidl::encoding::Context) -> usize {
5798            4
5799        }
5800    }
5801
5802    unsafe impl
5803        fidl::encoding::Encode<
5804            ClientControllerGetSavedNetworksRequest,
5805            fidl::encoding::DefaultFuchsiaResourceDialect,
5806        > for &mut ClientControllerGetSavedNetworksRequest
5807    {
5808        #[inline]
5809        unsafe fn encode(
5810            self,
5811            encoder: &mut fidl::encoding::Encoder<
5812                '_,
5813                fidl::encoding::DefaultFuchsiaResourceDialect,
5814            >,
5815            offset: usize,
5816            _depth: fidl::encoding::Depth,
5817        ) -> fidl::Result<()> {
5818            encoder.debug_check_bounds::<ClientControllerGetSavedNetworksRequest>(offset);
5819            // Delegate to tuple encoding.
5820            fidl::encoding::Encode::<
5821                ClientControllerGetSavedNetworksRequest,
5822                fidl::encoding::DefaultFuchsiaResourceDialect,
5823            >::encode(
5824                (
5825                    <fidl::encoding::Endpoint<
5826                        fidl::endpoints::ServerEnd<NetworkConfigIteratorMarker>,
5827                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
5828                        &mut self.iterator
5829                    ),
5830                ),
5831                encoder,
5832                offset,
5833                _depth,
5834            )
5835        }
5836    }
5837    unsafe impl<
5838        T0: fidl::encoding::Encode<
5839                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NetworkConfigIteratorMarker>>,
5840                fidl::encoding::DefaultFuchsiaResourceDialect,
5841            >,
5842    >
5843        fidl::encoding::Encode<
5844            ClientControllerGetSavedNetworksRequest,
5845            fidl::encoding::DefaultFuchsiaResourceDialect,
5846        > for (T0,)
5847    {
5848        #[inline]
5849        unsafe fn encode(
5850            self,
5851            encoder: &mut fidl::encoding::Encoder<
5852                '_,
5853                fidl::encoding::DefaultFuchsiaResourceDialect,
5854            >,
5855            offset: usize,
5856            depth: fidl::encoding::Depth,
5857        ) -> fidl::Result<()> {
5858            encoder.debug_check_bounds::<ClientControllerGetSavedNetworksRequest>(offset);
5859            // Zero out padding regions. There's no need to apply masks
5860            // because the unmasked parts will be overwritten by fields.
5861            // Write the fields.
5862            self.0.encode(encoder, offset + 0, depth)?;
5863            Ok(())
5864        }
5865    }
5866
5867    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5868        for ClientControllerGetSavedNetworksRequest
5869    {
5870        #[inline(always)]
5871        fn new_empty() -> Self {
5872            Self {
5873                iterator: fidl::new_empty!(
5874                    fidl::encoding::Endpoint<
5875                        fidl::endpoints::ServerEnd<NetworkConfigIteratorMarker>,
5876                    >,
5877                    fidl::encoding::DefaultFuchsiaResourceDialect
5878                ),
5879            }
5880        }
5881
5882        #[inline]
5883        unsafe fn decode(
5884            &mut self,
5885            decoder: &mut fidl::encoding::Decoder<
5886                '_,
5887                fidl::encoding::DefaultFuchsiaResourceDialect,
5888            >,
5889            offset: usize,
5890            _depth: fidl::encoding::Depth,
5891        ) -> fidl::Result<()> {
5892            decoder.debug_check_bounds::<Self>(offset);
5893            // Verify that padding bytes are zero.
5894            fidl::decode!(
5895                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<NetworkConfigIteratorMarker>>,
5896                fidl::encoding::DefaultFuchsiaResourceDialect,
5897                &mut self.iterator,
5898                decoder,
5899                offset + 0,
5900                _depth
5901            )?;
5902            Ok(())
5903        }
5904    }
5905
5906    impl fidl::encoding::ResourceTypeMarker for ClientControllerScanForNetworksRequest {
5907        type Borrowed<'a> = &'a mut Self;
5908        fn take_or_borrow<'a>(
5909            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5910        ) -> Self::Borrowed<'a> {
5911            value
5912        }
5913    }
5914
5915    unsafe impl fidl::encoding::TypeMarker for ClientControllerScanForNetworksRequest {
5916        type Owned = Self;
5917
5918        #[inline(always)]
5919        fn inline_align(_context: fidl::encoding::Context) -> usize {
5920            4
5921        }
5922
5923        #[inline(always)]
5924        fn inline_size(_context: fidl::encoding::Context) -> usize {
5925            4
5926        }
5927    }
5928
5929    unsafe impl
5930        fidl::encoding::Encode<
5931            ClientControllerScanForNetworksRequest,
5932            fidl::encoding::DefaultFuchsiaResourceDialect,
5933        > for &mut ClientControllerScanForNetworksRequest
5934    {
5935        #[inline]
5936        unsafe fn encode(
5937            self,
5938            encoder: &mut fidl::encoding::Encoder<
5939                '_,
5940                fidl::encoding::DefaultFuchsiaResourceDialect,
5941            >,
5942            offset: usize,
5943            _depth: fidl::encoding::Depth,
5944        ) -> fidl::Result<()> {
5945            encoder.debug_check_bounds::<ClientControllerScanForNetworksRequest>(offset);
5946            // Delegate to tuple encoding.
5947            fidl::encoding::Encode::<ClientControllerScanForNetworksRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5948                (
5949                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScanResultIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.iterator),
5950                ),
5951                encoder, offset, _depth
5952            )
5953        }
5954    }
5955    unsafe impl<
5956        T0: fidl::encoding::Encode<
5957                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScanResultIteratorMarker>>,
5958                fidl::encoding::DefaultFuchsiaResourceDialect,
5959            >,
5960    >
5961        fidl::encoding::Encode<
5962            ClientControllerScanForNetworksRequest,
5963            fidl::encoding::DefaultFuchsiaResourceDialect,
5964        > for (T0,)
5965    {
5966        #[inline]
5967        unsafe fn encode(
5968            self,
5969            encoder: &mut fidl::encoding::Encoder<
5970                '_,
5971                fidl::encoding::DefaultFuchsiaResourceDialect,
5972            >,
5973            offset: usize,
5974            depth: fidl::encoding::Depth,
5975        ) -> fidl::Result<()> {
5976            encoder.debug_check_bounds::<ClientControllerScanForNetworksRequest>(offset);
5977            // Zero out padding regions. There's no need to apply masks
5978            // because the unmasked parts will be overwritten by fields.
5979            // Write the fields.
5980            self.0.encode(encoder, offset + 0, depth)?;
5981            Ok(())
5982        }
5983    }
5984
5985    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5986        for ClientControllerScanForNetworksRequest
5987    {
5988        #[inline(always)]
5989        fn new_empty() -> Self {
5990            Self {
5991                iterator: fidl::new_empty!(
5992                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScanResultIteratorMarker>>,
5993                    fidl::encoding::DefaultFuchsiaResourceDialect
5994                ),
5995            }
5996        }
5997
5998        #[inline]
5999        unsafe fn decode(
6000            &mut self,
6001            decoder: &mut fidl::encoding::Decoder<
6002                '_,
6003                fidl::encoding::DefaultFuchsiaResourceDialect,
6004            >,
6005            offset: usize,
6006            _depth: fidl::encoding::Depth,
6007        ) -> fidl::Result<()> {
6008            decoder.debug_check_bounds::<Self>(offset);
6009            // Verify that padding bytes are zero.
6010            fidl::decode!(
6011                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ScanResultIteratorMarker>>,
6012                fidl::encoding::DefaultFuchsiaResourceDialect,
6013                &mut self.iterator,
6014                decoder,
6015                offset + 0,
6016                _depth
6017            )?;
6018            Ok(())
6019        }
6020    }
6021
6022    impl fidl::encoding::ResourceTypeMarker for ClientListenerGetListenerRequest {
6023        type Borrowed<'a> = &'a mut Self;
6024        fn take_or_borrow<'a>(
6025            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6026        ) -> Self::Borrowed<'a> {
6027            value
6028        }
6029    }
6030
6031    unsafe impl fidl::encoding::TypeMarker for ClientListenerGetListenerRequest {
6032        type Owned = Self;
6033
6034        #[inline(always)]
6035        fn inline_align(_context: fidl::encoding::Context) -> usize {
6036            4
6037        }
6038
6039        #[inline(always)]
6040        fn inline_size(_context: fidl::encoding::Context) -> usize {
6041            4
6042        }
6043    }
6044
6045    unsafe impl
6046        fidl::encoding::Encode<
6047            ClientListenerGetListenerRequest,
6048            fidl::encoding::DefaultFuchsiaResourceDialect,
6049        > for &mut ClientListenerGetListenerRequest
6050    {
6051        #[inline]
6052        unsafe fn encode(
6053            self,
6054            encoder: &mut fidl::encoding::Encoder<
6055                '_,
6056                fidl::encoding::DefaultFuchsiaResourceDialect,
6057            >,
6058            offset: usize,
6059            _depth: fidl::encoding::Depth,
6060        ) -> fidl::Result<()> {
6061            encoder.debug_check_bounds::<ClientListenerGetListenerRequest>(offset);
6062            // Delegate to tuple encoding.
6063            fidl::encoding::Encode::<ClientListenerGetListenerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6064                (
6065                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ClientStateUpdatesMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.updates),
6066                ),
6067                encoder, offset, _depth
6068            )
6069        }
6070    }
6071    unsafe impl<
6072        T0: fidl::encoding::Encode<
6073                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ClientStateUpdatesMarker>>,
6074                fidl::encoding::DefaultFuchsiaResourceDialect,
6075            >,
6076    >
6077        fidl::encoding::Encode<
6078            ClientListenerGetListenerRequest,
6079            fidl::encoding::DefaultFuchsiaResourceDialect,
6080        > for (T0,)
6081    {
6082        #[inline]
6083        unsafe fn encode(
6084            self,
6085            encoder: &mut fidl::encoding::Encoder<
6086                '_,
6087                fidl::encoding::DefaultFuchsiaResourceDialect,
6088            >,
6089            offset: usize,
6090            depth: fidl::encoding::Depth,
6091        ) -> fidl::Result<()> {
6092            encoder.debug_check_bounds::<ClientListenerGetListenerRequest>(offset);
6093            // Zero out padding regions. There's no need to apply masks
6094            // because the unmasked parts will be overwritten by fields.
6095            // Write the fields.
6096            self.0.encode(encoder, offset + 0, depth)?;
6097            Ok(())
6098        }
6099    }
6100
6101    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6102        for ClientListenerGetListenerRequest
6103    {
6104        #[inline(always)]
6105        fn new_empty() -> Self {
6106            Self {
6107                updates: fidl::new_empty!(
6108                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ClientStateUpdatesMarker>>,
6109                    fidl::encoding::DefaultFuchsiaResourceDialect
6110                ),
6111            }
6112        }
6113
6114        #[inline]
6115        unsafe fn decode(
6116            &mut self,
6117            decoder: &mut fidl::encoding::Decoder<
6118                '_,
6119                fidl::encoding::DefaultFuchsiaResourceDialect,
6120            >,
6121            offset: usize,
6122            _depth: fidl::encoding::Depth,
6123        ) -> fidl::Result<()> {
6124            decoder.debug_check_bounds::<Self>(offset);
6125            // Verify that padding bytes are zero.
6126            fidl::decode!(
6127                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ClientStateUpdatesMarker>>,
6128                fidl::encoding::DefaultFuchsiaResourceDialect,
6129                &mut self.updates,
6130                decoder,
6131                offset + 0,
6132                _depth
6133            )?;
6134            Ok(())
6135        }
6136    }
6137
6138    impl fidl::encoding::ResourceTypeMarker for ClientProviderGetControllerRequest {
6139        type Borrowed<'a> = &'a mut Self;
6140        fn take_or_borrow<'a>(
6141            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6142        ) -> Self::Borrowed<'a> {
6143            value
6144        }
6145    }
6146
6147    unsafe impl fidl::encoding::TypeMarker for ClientProviderGetControllerRequest {
6148        type Owned = Self;
6149
6150        #[inline(always)]
6151        fn inline_align(_context: fidl::encoding::Context) -> usize {
6152            4
6153        }
6154
6155        #[inline(always)]
6156        fn inline_size(_context: fidl::encoding::Context) -> usize {
6157            8
6158        }
6159    }
6160
6161    unsafe impl
6162        fidl::encoding::Encode<
6163            ClientProviderGetControllerRequest,
6164            fidl::encoding::DefaultFuchsiaResourceDialect,
6165        > for &mut ClientProviderGetControllerRequest
6166    {
6167        #[inline]
6168        unsafe fn encode(
6169            self,
6170            encoder: &mut fidl::encoding::Encoder<
6171                '_,
6172                fidl::encoding::DefaultFuchsiaResourceDialect,
6173            >,
6174            offset: usize,
6175            _depth: fidl::encoding::Depth,
6176        ) -> fidl::Result<()> {
6177            encoder.debug_check_bounds::<ClientProviderGetControllerRequest>(offset);
6178            // Delegate to tuple encoding.
6179            fidl::encoding::Encode::<ClientProviderGetControllerRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6180                (
6181                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ClientControllerMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.requests),
6182                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ClientStateUpdatesMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.updates),
6183                ),
6184                encoder, offset, _depth
6185            )
6186        }
6187    }
6188    unsafe impl<
6189        T0: fidl::encoding::Encode<
6190                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ClientControllerMarker>>,
6191                fidl::encoding::DefaultFuchsiaResourceDialect,
6192            >,
6193        T1: fidl::encoding::Encode<
6194                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ClientStateUpdatesMarker>>,
6195                fidl::encoding::DefaultFuchsiaResourceDialect,
6196            >,
6197    >
6198        fidl::encoding::Encode<
6199            ClientProviderGetControllerRequest,
6200            fidl::encoding::DefaultFuchsiaResourceDialect,
6201        > for (T0, T1)
6202    {
6203        #[inline]
6204        unsafe fn encode(
6205            self,
6206            encoder: &mut fidl::encoding::Encoder<
6207                '_,
6208                fidl::encoding::DefaultFuchsiaResourceDialect,
6209            >,
6210            offset: usize,
6211            depth: fidl::encoding::Depth,
6212        ) -> fidl::Result<()> {
6213            encoder.debug_check_bounds::<ClientProviderGetControllerRequest>(offset);
6214            // Zero out padding regions. There's no need to apply masks
6215            // because the unmasked parts will be overwritten by fields.
6216            // Write the fields.
6217            self.0.encode(encoder, offset + 0, depth)?;
6218            self.1.encode(encoder, offset + 4, depth)?;
6219            Ok(())
6220        }
6221    }
6222
6223    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6224        for ClientProviderGetControllerRequest
6225    {
6226        #[inline(always)]
6227        fn new_empty() -> Self {
6228            Self {
6229                requests: fidl::new_empty!(
6230                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ClientControllerMarker>>,
6231                    fidl::encoding::DefaultFuchsiaResourceDialect
6232                ),
6233                updates: fidl::new_empty!(
6234                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ClientStateUpdatesMarker>>,
6235                    fidl::encoding::DefaultFuchsiaResourceDialect
6236                ),
6237            }
6238        }
6239
6240        #[inline]
6241        unsafe fn decode(
6242            &mut self,
6243            decoder: &mut fidl::encoding::Decoder<
6244                '_,
6245                fidl::encoding::DefaultFuchsiaResourceDialect,
6246            >,
6247            offset: usize,
6248            _depth: fidl::encoding::Depth,
6249        ) -> fidl::Result<()> {
6250            decoder.debug_check_bounds::<Self>(offset);
6251            // Verify that padding bytes are zero.
6252            fidl::decode!(
6253                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ClientControllerMarker>>,
6254                fidl::encoding::DefaultFuchsiaResourceDialect,
6255                &mut self.requests,
6256                decoder,
6257                offset + 0,
6258                _depth
6259            )?;
6260            fidl::decode!(
6261                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<ClientStateUpdatesMarker>>,
6262                fidl::encoding::DefaultFuchsiaResourceDialect,
6263                &mut self.updates,
6264                decoder,
6265                offset + 4,
6266                _depth
6267            )?;
6268            Ok(())
6269        }
6270    }
6271}