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