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