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