fidl_fuchsia_lowpan_device/
fidl_fuchsia_lowpan_device.rs

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