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