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