Skip to main content

fidl_fuchsia_lowpan_experimental/
fidl_fuchsia_lowpan_experimental.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_experimental__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct DeviceConnectorConnectRequest {
16    pub name: String,
17    pub server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21    for DeviceConnectorConnectRequest
22{
23}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct DeviceExtraConnectorConnectRequest {
27    pub name: String,
28    pub server_end: fidl::endpoints::ServerEnd<DeviceExtraMarker>,
29}
30
31impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
32    for DeviceExtraConnectorConnectRequest
33{
34}
35
36#[derive(Debug, PartialEq)]
37pub struct DeviceExtraFormNetworkRequest {
38    pub params: fidl_fuchsia_lowpan_device::ProvisioningParams,
39    pub progress: fidl::endpoints::ServerEnd<ProvisioningMonitorMarker>,
40}
41
42impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
43    for DeviceExtraFormNetworkRequest
44{
45}
46
47#[derive(Debug, PartialEq)]
48pub struct DeviceExtraJoinNetworkRequest {
49    pub params: JoinParams,
50    pub progress: fidl::endpoints::ServerEnd<ProvisioningMonitorMarker>,
51}
52
53impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
54    for DeviceExtraJoinNetworkRequest
55{
56}
57
58#[derive(Debug, PartialEq)]
59pub struct DeviceExtraStartNetworkScanRequest {
60    pub params: NetworkScanParameters,
61    pub stream: fidl::endpoints::ServerEnd<BeaconInfoStreamMarker>,
62}
63
64impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
65    for DeviceExtraStartNetworkScanRequest
66{
67}
68
69#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
70pub struct DeviceRouteConnectorConnectRequest {
71    pub name: String,
72    pub server_end: fidl::endpoints::ServerEnd<DeviceRouteMarker>,
73}
74
75impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
76    for DeviceRouteConnectorConnectRequest
77{
78}
79
80#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
81pub struct DeviceRouteExtraConnectorConnectRequest {
82    pub name: String,
83    pub server_end: fidl::endpoints::ServerEnd<DeviceRouteExtraMarker>,
84}
85
86impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
87    for DeviceRouteExtraConnectorConnectRequest
88{
89}
90
91#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
92pub struct LegacyJoiningConnectorConnectRequest {
93    pub name: String,
94    pub server_end: fidl::endpoints::ServerEnd<LegacyJoiningMarker>,
95}
96
97impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
98    for LegacyJoiningConnectorConnectRequest
99{
100}
101
102#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
103pub struct TelemetryProviderConnectorConnectRequest {
104    pub name: String,
105    pub server_end: fidl::endpoints::ServerEnd<TelemetryProviderMarker>,
106}
107
108impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
109    for TelemetryProviderConnectorConnectRequest
110{
111}
112
113#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
114pub struct BeaconInfoStreamMarker;
115
116impl fidl::endpoints::ProtocolMarker for BeaconInfoStreamMarker {
117    type Proxy = BeaconInfoStreamProxy;
118    type RequestStream = BeaconInfoStreamRequestStream;
119    #[cfg(target_os = "fuchsia")]
120    type SynchronousProxy = BeaconInfoStreamSynchronousProxy;
121
122    const DEBUG_NAME: &'static str = "(anonymous) BeaconInfoStream";
123}
124
125pub trait BeaconInfoStreamProxyInterface: Send + Sync {
126    type NextResponseFut: std::future::Future<Output = Result<Vec<BeaconInfo>, fidl::Error>> + Send;
127    fn r#next(&self) -> Self::NextResponseFut;
128}
129#[derive(Debug)]
130#[cfg(target_os = "fuchsia")]
131pub struct BeaconInfoStreamSynchronousProxy {
132    client: fidl::client::sync::Client,
133}
134
135#[cfg(target_os = "fuchsia")]
136impl fidl::endpoints::SynchronousProxy for BeaconInfoStreamSynchronousProxy {
137    type Proxy = BeaconInfoStreamProxy;
138    type Protocol = BeaconInfoStreamMarker;
139
140    fn from_channel(inner: fidl::Channel) -> Self {
141        Self::new(inner)
142    }
143
144    fn into_channel(self) -> fidl::Channel {
145        self.client.into_channel()
146    }
147
148    fn as_channel(&self) -> &fidl::Channel {
149        self.client.as_channel()
150    }
151}
152
153#[cfg(target_os = "fuchsia")]
154impl BeaconInfoStreamSynchronousProxy {
155    pub fn new(channel: fidl::Channel) -> Self {
156        Self { client: fidl::client::sync::Client::new(channel) }
157    }
158
159    pub fn into_channel(self) -> fidl::Channel {
160        self.client.into_channel()
161    }
162
163    /// Waits until an event arrives and returns it. It is safe for other
164    /// threads to make concurrent requests while waiting for an event.
165    pub fn wait_for_event(
166        &self,
167        deadline: zx::MonotonicInstant,
168    ) -> Result<BeaconInfoStreamEvent, fidl::Error> {
169        BeaconInfoStreamEvent::decode(
170            self.client.wait_for_event::<BeaconInfoStreamMarker>(deadline)?,
171        )
172    }
173
174    /// Called to fetch the next set of received beacons.
175    ///
176    /// The last set will have zero items. Once all received
177    /// beacons have been returned, this channel will close.
178    pub fn r#next(
179        &self,
180        ___deadline: zx::MonotonicInstant,
181    ) -> Result<Vec<BeaconInfo>, fidl::Error> {
182        let _response = self.client.send_query::<
183            fidl::encoding::EmptyPayload,
184            BeaconInfoStreamNextResponse,
185            BeaconInfoStreamMarker,
186        >(
187            (),
188            0x367a557363a340b6,
189            fidl::encoding::DynamicFlags::empty(),
190            ___deadline,
191        )?;
192        Ok(_response.beacons)
193    }
194}
195
196#[cfg(target_os = "fuchsia")]
197impl From<BeaconInfoStreamSynchronousProxy> for zx::NullableHandle {
198    fn from(value: BeaconInfoStreamSynchronousProxy) -> Self {
199        value.into_channel().into()
200    }
201}
202
203#[cfg(target_os = "fuchsia")]
204impl From<fidl::Channel> for BeaconInfoStreamSynchronousProxy {
205    fn from(value: fidl::Channel) -> Self {
206        Self::new(value)
207    }
208}
209
210#[cfg(target_os = "fuchsia")]
211impl fidl::endpoints::FromClient for BeaconInfoStreamSynchronousProxy {
212    type Protocol = BeaconInfoStreamMarker;
213
214    fn from_client(value: fidl::endpoints::ClientEnd<BeaconInfoStreamMarker>) -> Self {
215        Self::new(value.into_channel())
216    }
217}
218
219#[derive(Debug, Clone)]
220pub struct BeaconInfoStreamProxy {
221    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
222}
223
224impl fidl::endpoints::Proxy for BeaconInfoStreamProxy {
225    type Protocol = BeaconInfoStreamMarker;
226
227    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
228        Self::new(inner)
229    }
230
231    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
232        self.client.into_channel().map_err(|client| Self { client })
233    }
234
235    fn as_channel(&self) -> &::fidl::AsyncChannel {
236        self.client.as_channel()
237    }
238}
239
240impl BeaconInfoStreamProxy {
241    /// Create a new Proxy for fuchsia.lowpan.experimental/BeaconInfoStream.
242    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
243        let protocol_name = <BeaconInfoStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
244        Self { client: fidl::client::Client::new(channel, protocol_name) }
245    }
246
247    /// Get a Stream of events from the remote end of the protocol.
248    ///
249    /// # Panics
250    ///
251    /// Panics if the event stream was already taken.
252    pub fn take_event_stream(&self) -> BeaconInfoStreamEventStream {
253        BeaconInfoStreamEventStream { event_receiver: self.client.take_event_receiver() }
254    }
255
256    /// Called to fetch the next set of received beacons.
257    ///
258    /// The last set will have zero items. Once all received
259    /// beacons have been returned, this channel will close.
260    pub fn r#next(
261        &self,
262    ) -> fidl::client::QueryResponseFut<
263        Vec<BeaconInfo>,
264        fidl::encoding::DefaultFuchsiaResourceDialect,
265    > {
266        BeaconInfoStreamProxyInterface::r#next(self)
267    }
268}
269
270impl BeaconInfoStreamProxyInterface for BeaconInfoStreamProxy {
271    type NextResponseFut = fidl::client::QueryResponseFut<
272        Vec<BeaconInfo>,
273        fidl::encoding::DefaultFuchsiaResourceDialect,
274    >;
275    fn r#next(&self) -> Self::NextResponseFut {
276        fn _decode(
277            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
278        ) -> Result<Vec<BeaconInfo>, fidl::Error> {
279            let _response = fidl::client::decode_transaction_body::<
280                BeaconInfoStreamNextResponse,
281                fidl::encoding::DefaultFuchsiaResourceDialect,
282                0x367a557363a340b6,
283            >(_buf?)?;
284            Ok(_response.beacons)
285        }
286        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<BeaconInfo>>(
287            (),
288            0x367a557363a340b6,
289            fidl::encoding::DynamicFlags::empty(),
290            _decode,
291        )
292    }
293}
294
295pub struct BeaconInfoStreamEventStream {
296    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
297}
298
299impl std::marker::Unpin for BeaconInfoStreamEventStream {}
300
301impl futures::stream::FusedStream for BeaconInfoStreamEventStream {
302    fn is_terminated(&self) -> bool {
303        self.event_receiver.is_terminated()
304    }
305}
306
307impl futures::Stream for BeaconInfoStreamEventStream {
308    type Item = Result<BeaconInfoStreamEvent, fidl::Error>;
309
310    fn poll_next(
311        mut self: std::pin::Pin<&mut Self>,
312        cx: &mut std::task::Context<'_>,
313    ) -> std::task::Poll<Option<Self::Item>> {
314        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
315            &mut self.event_receiver,
316            cx
317        )?) {
318            Some(buf) => std::task::Poll::Ready(Some(BeaconInfoStreamEvent::decode(buf))),
319            None => std::task::Poll::Ready(None),
320        }
321    }
322}
323
324#[derive(Debug)]
325pub enum BeaconInfoStreamEvent {}
326
327impl BeaconInfoStreamEvent {
328    /// Decodes a message buffer as a [`BeaconInfoStreamEvent`].
329    fn decode(
330        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
331    ) -> Result<BeaconInfoStreamEvent, fidl::Error> {
332        let (bytes, _handles) = buf.split_mut();
333        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
334        debug_assert_eq!(tx_header.tx_id, 0);
335        match tx_header.ordinal {
336            _ => Err(fidl::Error::UnknownOrdinal {
337                ordinal: tx_header.ordinal,
338                protocol_name:
339                    <BeaconInfoStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
340            }),
341        }
342    }
343}
344
345/// A Stream of incoming requests for fuchsia.lowpan.experimental/BeaconInfoStream.
346pub struct BeaconInfoStreamRequestStream {
347    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
348    is_terminated: bool,
349}
350
351impl std::marker::Unpin for BeaconInfoStreamRequestStream {}
352
353impl futures::stream::FusedStream for BeaconInfoStreamRequestStream {
354    fn is_terminated(&self) -> bool {
355        self.is_terminated
356    }
357}
358
359impl fidl::endpoints::RequestStream for BeaconInfoStreamRequestStream {
360    type Protocol = BeaconInfoStreamMarker;
361    type ControlHandle = BeaconInfoStreamControlHandle;
362
363    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
364        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
365    }
366
367    fn control_handle(&self) -> Self::ControlHandle {
368        BeaconInfoStreamControlHandle { inner: self.inner.clone() }
369    }
370
371    fn into_inner(
372        self,
373    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
374    {
375        (self.inner, self.is_terminated)
376    }
377
378    fn from_inner(
379        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
380        is_terminated: bool,
381    ) -> Self {
382        Self { inner, is_terminated }
383    }
384}
385
386impl futures::Stream for BeaconInfoStreamRequestStream {
387    type Item = Result<BeaconInfoStreamRequest, fidl::Error>;
388
389    fn poll_next(
390        mut self: std::pin::Pin<&mut Self>,
391        cx: &mut std::task::Context<'_>,
392    ) -> std::task::Poll<Option<Self::Item>> {
393        let this = &mut *self;
394        if this.inner.check_shutdown(cx) {
395            this.is_terminated = true;
396            return std::task::Poll::Ready(None);
397        }
398        if this.is_terminated {
399            panic!("polled BeaconInfoStreamRequestStream after completion");
400        }
401        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
402            |bytes, handles| {
403                match this.inner.channel().read_etc(cx, bytes, handles) {
404                    std::task::Poll::Ready(Ok(())) => {}
405                    std::task::Poll::Pending => return std::task::Poll::Pending,
406                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
407                        this.is_terminated = true;
408                        return std::task::Poll::Ready(None);
409                    }
410                    std::task::Poll::Ready(Err(e)) => {
411                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
412                            e.into(),
413                        ))));
414                    }
415                }
416
417                // A message has been received from the channel
418                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
419
420                std::task::Poll::Ready(Some(match header.ordinal {
421                    0x367a557363a340b6 => {
422                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
423                        let mut req = fidl::new_empty!(
424                            fidl::encoding::EmptyPayload,
425                            fidl::encoding::DefaultFuchsiaResourceDialect
426                        );
427                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
428                        let control_handle =
429                            BeaconInfoStreamControlHandle { inner: this.inner.clone() };
430                        Ok(BeaconInfoStreamRequest::Next {
431                            responder: BeaconInfoStreamNextResponder {
432                                control_handle: std::mem::ManuallyDrop::new(control_handle),
433                                tx_id: header.tx_id,
434                            },
435                        })
436                    }
437                    _ => Err(fidl::Error::UnknownOrdinal {
438                        ordinal: header.ordinal,
439                        protocol_name:
440                            <BeaconInfoStreamMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
441                    }),
442                }))
443            },
444        )
445    }
446}
447
448/// Protocol for returning the results of a network scan operation.
449///
450/// Closing the client end of an instance of this protocol will effectively
451/// cancel the scan operation.
452#[derive(Debug)]
453pub enum BeaconInfoStreamRequest {
454    /// Called to fetch the next set of received beacons.
455    ///
456    /// The last set will have zero items. Once all received
457    /// beacons have been returned, this channel will close.
458    Next { responder: BeaconInfoStreamNextResponder },
459}
460
461impl BeaconInfoStreamRequest {
462    #[allow(irrefutable_let_patterns)]
463    pub fn into_next(self) -> Option<(BeaconInfoStreamNextResponder)> {
464        if let BeaconInfoStreamRequest::Next { responder } = self {
465            Some((responder))
466        } else {
467            None
468        }
469    }
470
471    /// Name of the method defined in FIDL
472    pub fn method_name(&self) -> &'static str {
473        match *self {
474            BeaconInfoStreamRequest::Next { .. } => "next",
475        }
476    }
477}
478
479#[derive(Debug, Clone)]
480pub struct BeaconInfoStreamControlHandle {
481    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
482}
483
484impl fidl::endpoints::ControlHandle for BeaconInfoStreamControlHandle {
485    fn shutdown(&self) {
486        self.inner.shutdown()
487    }
488
489    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
490        self.inner.shutdown_with_epitaph(status)
491    }
492
493    fn is_closed(&self) -> bool {
494        self.inner.channel().is_closed()
495    }
496    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
497        self.inner.channel().on_closed()
498    }
499
500    #[cfg(target_os = "fuchsia")]
501    fn signal_peer(
502        &self,
503        clear_mask: zx::Signals,
504        set_mask: zx::Signals,
505    ) -> Result<(), zx_status::Status> {
506        use fidl::Peered;
507        self.inner.channel().signal_peer(clear_mask, set_mask)
508    }
509}
510
511impl BeaconInfoStreamControlHandle {}
512
513#[must_use = "FIDL methods require a response to be sent"]
514#[derive(Debug)]
515pub struct BeaconInfoStreamNextResponder {
516    control_handle: std::mem::ManuallyDrop<BeaconInfoStreamControlHandle>,
517    tx_id: u32,
518}
519
520/// Set the the channel to be shutdown (see [`BeaconInfoStreamControlHandle::shutdown`])
521/// if the responder is dropped without sending a response, so that the client
522/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
523impl std::ops::Drop for BeaconInfoStreamNextResponder {
524    fn drop(&mut self) {
525        self.control_handle.shutdown();
526        // Safety: drops once, never accessed again
527        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
528    }
529}
530
531impl fidl::endpoints::Responder for BeaconInfoStreamNextResponder {
532    type ControlHandle = BeaconInfoStreamControlHandle;
533
534    fn control_handle(&self) -> &BeaconInfoStreamControlHandle {
535        &self.control_handle
536    }
537
538    fn drop_without_shutdown(mut self) {
539        // Safety: drops once, never accessed again due to mem::forget
540        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
541        // Prevent Drop from running (which would shut down the channel)
542        std::mem::forget(self);
543    }
544}
545
546impl BeaconInfoStreamNextResponder {
547    /// Sends a response to the FIDL transaction.
548    ///
549    /// Sets the channel to shutdown if an error occurs.
550    pub fn send(self, mut beacons: &[BeaconInfo]) -> Result<(), fidl::Error> {
551        let _result = self.send_raw(beacons);
552        if _result.is_err() {
553            self.control_handle.shutdown();
554        }
555        self.drop_without_shutdown();
556        _result
557    }
558
559    /// Similar to "send" but does not shutdown the channel if an error occurs.
560    pub fn send_no_shutdown_on_err(self, mut beacons: &[BeaconInfo]) -> Result<(), fidl::Error> {
561        let _result = self.send_raw(beacons);
562        self.drop_without_shutdown();
563        _result
564    }
565
566    fn send_raw(&self, mut beacons: &[BeaconInfo]) -> Result<(), fidl::Error> {
567        self.control_handle.inner.send::<BeaconInfoStreamNextResponse>(
568            (beacons,),
569            self.tx_id,
570            0x367a557363a340b6,
571            fidl::encoding::DynamicFlags::empty(),
572        )
573    }
574}
575
576#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
577pub struct DeviceMarker;
578
579impl fidl::endpoints::ProtocolMarker for DeviceMarker {
580    type Proxy = DeviceProxy;
581    type RequestStream = DeviceRequestStream;
582    #[cfg(target_os = "fuchsia")]
583    type SynchronousProxy = DeviceSynchronousProxy;
584
585    const DEBUG_NAME: &'static str = "(anonymous) Device";
586}
587
588pub trait DeviceProxyInterface: Send + Sync {
589    type GetSupportedChannelsResponseFut: std::future::Future<Output = Result<Vec<ChannelInfo>, fidl::Error>>
590        + Send;
591    fn r#get_supported_channels(&self) -> Self::GetSupportedChannelsResponseFut;
592}
593#[derive(Debug)]
594#[cfg(target_os = "fuchsia")]
595pub struct DeviceSynchronousProxy {
596    client: fidl::client::sync::Client,
597}
598
599#[cfg(target_os = "fuchsia")]
600impl fidl::endpoints::SynchronousProxy for DeviceSynchronousProxy {
601    type Proxy = DeviceProxy;
602    type Protocol = DeviceMarker;
603
604    fn from_channel(inner: fidl::Channel) -> Self {
605        Self::new(inner)
606    }
607
608    fn into_channel(self) -> fidl::Channel {
609        self.client.into_channel()
610    }
611
612    fn as_channel(&self) -> &fidl::Channel {
613        self.client.as_channel()
614    }
615}
616
617#[cfg(target_os = "fuchsia")]
618impl DeviceSynchronousProxy {
619    pub fn new(channel: fidl::Channel) -> Self {
620        Self { client: fidl::client::sync::Client::new(channel) }
621    }
622
623    pub fn into_channel(self) -> fidl::Channel {
624        self.client.into_channel()
625    }
626
627    /// Waits until an event arrives and returns it. It is safe for other
628    /// threads to make concurrent requests while waiting for an event.
629    pub fn wait_for_event(
630        &self,
631        deadline: zx::MonotonicInstant,
632    ) -> Result<DeviceEvent, fidl::Error> {
633        DeviceEvent::decode(self.client.wait_for_event::<DeviceMarker>(deadline)?)
634    }
635
636    /// Returns a vector of information about the
637    /// channels supported by this interface.
638    pub fn r#get_supported_channels(
639        &self,
640        ___deadline: zx::MonotonicInstant,
641    ) -> Result<Vec<ChannelInfo>, fidl::Error> {
642        let _response = self.client.send_query::<
643            fidl::encoding::EmptyPayload,
644            DeviceGetSupportedChannelsResponse,
645            DeviceMarker,
646        >(
647            (),
648            0x2d8b969a9bd70f23,
649            fidl::encoding::DynamicFlags::empty(),
650            ___deadline,
651        )?;
652        Ok(_response.channels_info)
653    }
654}
655
656#[cfg(target_os = "fuchsia")]
657impl From<DeviceSynchronousProxy> for zx::NullableHandle {
658    fn from(value: DeviceSynchronousProxy) -> Self {
659        value.into_channel().into()
660    }
661}
662
663#[cfg(target_os = "fuchsia")]
664impl From<fidl::Channel> for DeviceSynchronousProxy {
665    fn from(value: fidl::Channel) -> Self {
666        Self::new(value)
667    }
668}
669
670#[cfg(target_os = "fuchsia")]
671impl fidl::endpoints::FromClient for DeviceSynchronousProxy {
672    type Protocol = DeviceMarker;
673
674    fn from_client(value: fidl::endpoints::ClientEnd<DeviceMarker>) -> Self {
675        Self::new(value.into_channel())
676    }
677}
678
679#[derive(Debug, Clone)]
680pub struct DeviceProxy {
681    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
682}
683
684impl fidl::endpoints::Proxy for DeviceProxy {
685    type Protocol = DeviceMarker;
686
687    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
688        Self::new(inner)
689    }
690
691    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
692        self.client.into_channel().map_err(|client| Self { client })
693    }
694
695    fn as_channel(&self) -> &::fidl::AsyncChannel {
696        self.client.as_channel()
697    }
698}
699
700impl DeviceProxy {
701    /// Create a new Proxy for fuchsia.lowpan.experimental/Device.
702    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
703        let protocol_name = <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
704        Self { client: fidl::client::Client::new(channel, protocol_name) }
705    }
706
707    /// Get a Stream of events from the remote end of the protocol.
708    ///
709    /// # Panics
710    ///
711    /// Panics if the event stream was already taken.
712    pub fn take_event_stream(&self) -> DeviceEventStream {
713        DeviceEventStream { event_receiver: self.client.take_event_receiver() }
714    }
715
716    /// Returns a vector of information about the
717    /// channels supported by this interface.
718    pub fn r#get_supported_channels(
719        &self,
720    ) -> fidl::client::QueryResponseFut<
721        Vec<ChannelInfo>,
722        fidl::encoding::DefaultFuchsiaResourceDialect,
723    > {
724        DeviceProxyInterface::r#get_supported_channels(self)
725    }
726}
727
728impl DeviceProxyInterface for DeviceProxy {
729    type GetSupportedChannelsResponseFut = fidl::client::QueryResponseFut<
730        Vec<ChannelInfo>,
731        fidl::encoding::DefaultFuchsiaResourceDialect,
732    >;
733    fn r#get_supported_channels(&self) -> Self::GetSupportedChannelsResponseFut {
734        fn _decode(
735            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
736        ) -> Result<Vec<ChannelInfo>, fidl::Error> {
737            let _response = fidl::client::decode_transaction_body::<
738                DeviceGetSupportedChannelsResponse,
739                fidl::encoding::DefaultFuchsiaResourceDialect,
740                0x2d8b969a9bd70f23,
741            >(_buf?)?;
742            Ok(_response.channels_info)
743        }
744        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<ChannelInfo>>(
745            (),
746            0x2d8b969a9bd70f23,
747            fidl::encoding::DynamicFlags::empty(),
748            _decode,
749        )
750    }
751}
752
753pub struct DeviceEventStream {
754    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
755}
756
757impl std::marker::Unpin for DeviceEventStream {}
758
759impl futures::stream::FusedStream for DeviceEventStream {
760    fn is_terminated(&self) -> bool {
761        self.event_receiver.is_terminated()
762    }
763}
764
765impl futures::Stream for DeviceEventStream {
766    type Item = Result<DeviceEvent, fidl::Error>;
767
768    fn poll_next(
769        mut self: std::pin::Pin<&mut Self>,
770        cx: &mut std::task::Context<'_>,
771    ) -> std::task::Poll<Option<Self::Item>> {
772        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
773            &mut self.event_receiver,
774            cx
775        )?) {
776            Some(buf) => std::task::Poll::Ready(Some(DeviceEvent::decode(buf))),
777            None => std::task::Poll::Ready(None),
778        }
779    }
780}
781
782#[derive(Debug)]
783pub enum DeviceEvent {}
784
785impl DeviceEvent {
786    /// Decodes a message buffer as a [`DeviceEvent`].
787    fn decode(
788        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
789    ) -> Result<DeviceEvent, fidl::Error> {
790        let (bytes, _handles) = buf.split_mut();
791        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
792        debug_assert_eq!(tx_header.tx_id, 0);
793        match tx_header.ordinal {
794            _ => Err(fidl::Error::UnknownOrdinal {
795                ordinal: tx_header.ordinal,
796                protocol_name: <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
797            }),
798        }
799    }
800}
801
802/// A Stream of incoming requests for fuchsia.lowpan.experimental/Device.
803pub struct DeviceRequestStream {
804    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
805    is_terminated: bool,
806}
807
808impl std::marker::Unpin for DeviceRequestStream {}
809
810impl futures::stream::FusedStream for DeviceRequestStream {
811    fn is_terminated(&self) -> bool {
812        self.is_terminated
813    }
814}
815
816impl fidl::endpoints::RequestStream for DeviceRequestStream {
817    type Protocol = DeviceMarker;
818    type ControlHandle = DeviceControlHandle;
819
820    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
821        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
822    }
823
824    fn control_handle(&self) -> Self::ControlHandle {
825        DeviceControlHandle { inner: self.inner.clone() }
826    }
827
828    fn into_inner(
829        self,
830    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
831    {
832        (self.inner, self.is_terminated)
833    }
834
835    fn from_inner(
836        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
837        is_terminated: bool,
838    ) -> Self {
839        Self { inner, is_terminated }
840    }
841}
842
843impl futures::Stream for DeviceRequestStream {
844    type Item = Result<DeviceRequest, fidl::Error>;
845
846    fn poll_next(
847        mut self: std::pin::Pin<&mut Self>,
848        cx: &mut std::task::Context<'_>,
849    ) -> std::task::Poll<Option<Self::Item>> {
850        let this = &mut *self;
851        if this.inner.check_shutdown(cx) {
852            this.is_terminated = true;
853            return std::task::Poll::Ready(None);
854        }
855        if this.is_terminated {
856            panic!("polled DeviceRequestStream after completion");
857        }
858        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
859            |bytes, handles| {
860                match this.inner.channel().read_etc(cx, bytes, handles) {
861                    std::task::Poll::Ready(Ok(())) => {}
862                    std::task::Poll::Pending => return std::task::Poll::Pending,
863                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
864                        this.is_terminated = true;
865                        return std::task::Poll::Ready(None);
866                    }
867                    std::task::Poll::Ready(Err(e)) => {
868                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
869                            e.into(),
870                        ))));
871                    }
872                }
873
874                // A message has been received from the channel
875                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
876
877                std::task::Poll::Ready(Some(match header.ordinal {
878                    0x2d8b969a9bd70f23 => {
879                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
880                        let mut req = fidl::new_empty!(
881                            fidl::encoding::EmptyPayload,
882                            fidl::encoding::DefaultFuchsiaResourceDialect
883                        );
884                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
885                        let control_handle = DeviceControlHandle { inner: this.inner.clone() };
886                        Ok(DeviceRequest::GetSupportedChannels {
887                            responder: DeviceGetSupportedChannelsResponder {
888                                control_handle: std::mem::ManuallyDrop::new(control_handle),
889                                tx_id: header.tx_id,
890                            },
891                        })
892                    }
893                    _ => Err(fidl::Error::UnknownOrdinal {
894                        ordinal: header.ordinal,
895                        protocol_name:
896                            <DeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
897                    }),
898                }))
899            },
900        )
901    }
902}
903
904/// LoWPAN Device Protocol, Experimental Methods.
905///
906/// This protocol provides clients with a way to control and
907/// monitor the device.
908///
909/// Note that aspects of the device that deal with PII must
910/// be monitored and controlled via the [`DeviceExtra`] protocol.
911#[derive(Debug)]
912pub enum DeviceRequest {
913    /// Returns a vector of information about the
914    /// channels supported by this interface.
915    GetSupportedChannels { responder: DeviceGetSupportedChannelsResponder },
916}
917
918impl DeviceRequest {
919    #[allow(irrefutable_let_patterns)]
920    pub fn into_get_supported_channels(self) -> Option<(DeviceGetSupportedChannelsResponder)> {
921        if let DeviceRequest::GetSupportedChannels { responder } = self {
922            Some((responder))
923        } else {
924            None
925        }
926    }
927
928    /// Name of the method defined in FIDL
929    pub fn method_name(&self) -> &'static str {
930        match *self {
931            DeviceRequest::GetSupportedChannels { .. } => "get_supported_channels",
932        }
933    }
934}
935
936#[derive(Debug, Clone)]
937pub struct DeviceControlHandle {
938    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
939}
940
941impl fidl::endpoints::ControlHandle for DeviceControlHandle {
942    fn shutdown(&self) {
943        self.inner.shutdown()
944    }
945
946    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
947        self.inner.shutdown_with_epitaph(status)
948    }
949
950    fn is_closed(&self) -> bool {
951        self.inner.channel().is_closed()
952    }
953    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
954        self.inner.channel().on_closed()
955    }
956
957    #[cfg(target_os = "fuchsia")]
958    fn signal_peer(
959        &self,
960        clear_mask: zx::Signals,
961        set_mask: zx::Signals,
962    ) -> Result<(), zx_status::Status> {
963        use fidl::Peered;
964        self.inner.channel().signal_peer(clear_mask, set_mask)
965    }
966}
967
968impl DeviceControlHandle {}
969
970#[must_use = "FIDL methods require a response to be sent"]
971#[derive(Debug)]
972pub struct DeviceGetSupportedChannelsResponder {
973    control_handle: std::mem::ManuallyDrop<DeviceControlHandle>,
974    tx_id: u32,
975}
976
977/// Set the the channel to be shutdown (see [`DeviceControlHandle::shutdown`])
978/// if the responder is dropped without sending a response, so that the client
979/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
980impl std::ops::Drop for DeviceGetSupportedChannelsResponder {
981    fn drop(&mut self) {
982        self.control_handle.shutdown();
983        // Safety: drops once, never accessed again
984        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
985    }
986}
987
988impl fidl::endpoints::Responder for DeviceGetSupportedChannelsResponder {
989    type ControlHandle = DeviceControlHandle;
990
991    fn control_handle(&self) -> &DeviceControlHandle {
992        &self.control_handle
993    }
994
995    fn drop_without_shutdown(mut self) {
996        // Safety: drops once, never accessed again due to mem::forget
997        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
998        // Prevent Drop from running (which would shut down the channel)
999        std::mem::forget(self);
1000    }
1001}
1002
1003impl DeviceGetSupportedChannelsResponder {
1004    /// Sends a response to the FIDL transaction.
1005    ///
1006    /// Sets the channel to shutdown if an error occurs.
1007    pub fn send(self, mut channels_info: &[ChannelInfo]) -> Result<(), fidl::Error> {
1008        let _result = self.send_raw(channels_info);
1009        if _result.is_err() {
1010            self.control_handle.shutdown();
1011        }
1012        self.drop_without_shutdown();
1013        _result
1014    }
1015
1016    /// Similar to "send" but does not shutdown the channel if an error occurs.
1017    pub fn send_no_shutdown_on_err(
1018        self,
1019        mut channels_info: &[ChannelInfo],
1020    ) -> Result<(), fidl::Error> {
1021        let _result = self.send_raw(channels_info);
1022        self.drop_without_shutdown();
1023        _result
1024    }
1025
1026    fn send_raw(&self, mut channels_info: &[ChannelInfo]) -> Result<(), fidl::Error> {
1027        self.control_handle.inner.send::<DeviceGetSupportedChannelsResponse>(
1028            (channels_info,),
1029            self.tx_id,
1030            0x2d8b969a9bd70f23,
1031            fidl::encoding::DynamicFlags::empty(),
1032        )
1033    }
1034}
1035
1036#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1037pub struct DeviceConnectorMarker;
1038
1039impl fidl::endpoints::ProtocolMarker for DeviceConnectorMarker {
1040    type Proxy = DeviceConnectorProxy;
1041    type RequestStream = DeviceConnectorRequestStream;
1042    #[cfg(target_os = "fuchsia")]
1043    type SynchronousProxy = DeviceConnectorSynchronousProxy;
1044
1045    const DEBUG_NAME: &'static str = "fuchsia.lowpan.experimental.DeviceConnector";
1046}
1047impl fidl::endpoints::DiscoverableProtocolMarker for DeviceConnectorMarker {}
1048
1049pub trait DeviceConnectorProxyInterface: Send + Sync {
1050    fn r#connect(
1051        &self,
1052        name: &str,
1053        server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
1054    ) -> Result<(), fidl::Error>;
1055}
1056#[derive(Debug)]
1057#[cfg(target_os = "fuchsia")]
1058pub struct DeviceConnectorSynchronousProxy {
1059    client: fidl::client::sync::Client,
1060}
1061
1062#[cfg(target_os = "fuchsia")]
1063impl fidl::endpoints::SynchronousProxy for DeviceConnectorSynchronousProxy {
1064    type Proxy = DeviceConnectorProxy;
1065    type Protocol = DeviceConnectorMarker;
1066
1067    fn from_channel(inner: fidl::Channel) -> Self {
1068        Self::new(inner)
1069    }
1070
1071    fn into_channel(self) -> fidl::Channel {
1072        self.client.into_channel()
1073    }
1074
1075    fn as_channel(&self) -> &fidl::Channel {
1076        self.client.as_channel()
1077    }
1078}
1079
1080#[cfg(target_os = "fuchsia")]
1081impl DeviceConnectorSynchronousProxy {
1082    pub fn new(channel: fidl::Channel) -> Self {
1083        Self { client: fidl::client::sync::Client::new(channel) }
1084    }
1085
1086    pub fn into_channel(self) -> fidl::Channel {
1087        self.client.into_channel()
1088    }
1089
1090    /// Waits until an event arrives and returns it. It is safe for other
1091    /// threads to make concurrent requests while waiting for an event.
1092    pub fn wait_for_event(
1093        &self,
1094        deadline: zx::MonotonicInstant,
1095    ) -> Result<DeviceConnectorEvent, fidl::Error> {
1096        DeviceConnectorEvent::decode(self.client.wait_for_event::<DeviceConnectorMarker>(deadline)?)
1097    }
1098
1099    /// Connects to the [`Device`] protocol on the
1100    /// named LoWPAN interface.
1101    ///
1102    /// The name of the interface can be learned by calling
1103    /// [`fuchsia.lowpan/Lookup.GetDevices()`].
1104    ///
1105    /// If there is an error in processing this request
1106    /// the given channel is closed and an epitaph code used
1107    /// to describe the reason for the failure:
1108    ///
1109    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
1110    ///   was not formatted correctly or otherwise invalid.
1111    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
1112    ///   given name.
1113    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
1114    ///   does not support this protocol.
1115    pub fn r#connect(
1116        &self,
1117        mut name: &str,
1118        mut server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
1119    ) -> Result<(), fidl::Error> {
1120        self.client.send::<DeviceConnectorConnectRequest>(
1121            (name, server_end),
1122            0x296896c9304836cd,
1123            fidl::encoding::DynamicFlags::empty(),
1124        )
1125    }
1126}
1127
1128#[cfg(target_os = "fuchsia")]
1129impl From<DeviceConnectorSynchronousProxy> for zx::NullableHandle {
1130    fn from(value: DeviceConnectorSynchronousProxy) -> Self {
1131        value.into_channel().into()
1132    }
1133}
1134
1135#[cfg(target_os = "fuchsia")]
1136impl From<fidl::Channel> for DeviceConnectorSynchronousProxy {
1137    fn from(value: fidl::Channel) -> Self {
1138        Self::new(value)
1139    }
1140}
1141
1142#[cfg(target_os = "fuchsia")]
1143impl fidl::endpoints::FromClient for DeviceConnectorSynchronousProxy {
1144    type Protocol = DeviceConnectorMarker;
1145
1146    fn from_client(value: fidl::endpoints::ClientEnd<DeviceConnectorMarker>) -> Self {
1147        Self::new(value.into_channel())
1148    }
1149}
1150
1151#[derive(Debug, Clone)]
1152pub struct DeviceConnectorProxy {
1153    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1154}
1155
1156impl fidl::endpoints::Proxy for DeviceConnectorProxy {
1157    type Protocol = DeviceConnectorMarker;
1158
1159    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1160        Self::new(inner)
1161    }
1162
1163    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1164        self.client.into_channel().map_err(|client| Self { client })
1165    }
1166
1167    fn as_channel(&self) -> &::fidl::AsyncChannel {
1168        self.client.as_channel()
1169    }
1170}
1171
1172impl DeviceConnectorProxy {
1173    /// Create a new Proxy for fuchsia.lowpan.experimental/DeviceConnector.
1174    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1175        let protocol_name = <DeviceConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1176        Self { client: fidl::client::Client::new(channel, protocol_name) }
1177    }
1178
1179    /// Get a Stream of events from the remote end of the protocol.
1180    ///
1181    /// # Panics
1182    ///
1183    /// Panics if the event stream was already taken.
1184    pub fn take_event_stream(&self) -> DeviceConnectorEventStream {
1185        DeviceConnectorEventStream { event_receiver: self.client.take_event_receiver() }
1186    }
1187
1188    /// Connects to the [`Device`] protocol on the
1189    /// named LoWPAN interface.
1190    ///
1191    /// The name of the interface can be learned by calling
1192    /// [`fuchsia.lowpan/Lookup.GetDevices()`].
1193    ///
1194    /// If there is an error in processing this request
1195    /// the given channel is closed and an epitaph code used
1196    /// to describe the reason for the failure:
1197    ///
1198    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
1199    ///   was not formatted correctly or otherwise invalid.
1200    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
1201    ///   given name.
1202    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
1203    ///   does not support this protocol.
1204    pub fn r#connect(
1205        &self,
1206        mut name: &str,
1207        mut server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
1208    ) -> Result<(), fidl::Error> {
1209        DeviceConnectorProxyInterface::r#connect(self, name, server_end)
1210    }
1211}
1212
1213impl DeviceConnectorProxyInterface for DeviceConnectorProxy {
1214    fn r#connect(
1215        &self,
1216        mut name: &str,
1217        mut server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
1218    ) -> Result<(), fidl::Error> {
1219        self.client.send::<DeviceConnectorConnectRequest>(
1220            (name, server_end),
1221            0x296896c9304836cd,
1222            fidl::encoding::DynamicFlags::empty(),
1223        )
1224    }
1225}
1226
1227pub struct DeviceConnectorEventStream {
1228    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1229}
1230
1231impl std::marker::Unpin for DeviceConnectorEventStream {}
1232
1233impl futures::stream::FusedStream for DeviceConnectorEventStream {
1234    fn is_terminated(&self) -> bool {
1235        self.event_receiver.is_terminated()
1236    }
1237}
1238
1239impl futures::Stream for DeviceConnectorEventStream {
1240    type Item = Result<DeviceConnectorEvent, fidl::Error>;
1241
1242    fn poll_next(
1243        mut self: std::pin::Pin<&mut Self>,
1244        cx: &mut std::task::Context<'_>,
1245    ) -> std::task::Poll<Option<Self::Item>> {
1246        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1247            &mut self.event_receiver,
1248            cx
1249        )?) {
1250            Some(buf) => std::task::Poll::Ready(Some(DeviceConnectorEvent::decode(buf))),
1251            None => std::task::Poll::Ready(None),
1252        }
1253    }
1254}
1255
1256#[derive(Debug)]
1257pub enum DeviceConnectorEvent {}
1258
1259impl DeviceConnectorEvent {
1260    /// Decodes a message buffer as a [`DeviceConnectorEvent`].
1261    fn decode(
1262        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1263    ) -> Result<DeviceConnectorEvent, fidl::Error> {
1264        let (bytes, _handles) = buf.split_mut();
1265        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1266        debug_assert_eq!(tx_header.tx_id, 0);
1267        match tx_header.ordinal {
1268            _ => Err(fidl::Error::UnknownOrdinal {
1269                ordinal: tx_header.ordinal,
1270                protocol_name:
1271                    <DeviceConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1272            }),
1273        }
1274    }
1275}
1276
1277/// A Stream of incoming requests for fuchsia.lowpan.experimental/DeviceConnector.
1278pub struct DeviceConnectorRequestStream {
1279    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1280    is_terminated: bool,
1281}
1282
1283impl std::marker::Unpin for DeviceConnectorRequestStream {}
1284
1285impl futures::stream::FusedStream for DeviceConnectorRequestStream {
1286    fn is_terminated(&self) -> bool {
1287        self.is_terminated
1288    }
1289}
1290
1291impl fidl::endpoints::RequestStream for DeviceConnectorRequestStream {
1292    type Protocol = DeviceConnectorMarker;
1293    type ControlHandle = DeviceConnectorControlHandle;
1294
1295    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1296        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1297    }
1298
1299    fn control_handle(&self) -> Self::ControlHandle {
1300        DeviceConnectorControlHandle { inner: self.inner.clone() }
1301    }
1302
1303    fn into_inner(
1304        self,
1305    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1306    {
1307        (self.inner, self.is_terminated)
1308    }
1309
1310    fn from_inner(
1311        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1312        is_terminated: bool,
1313    ) -> Self {
1314        Self { inner, is_terminated }
1315    }
1316}
1317
1318impl futures::Stream for DeviceConnectorRequestStream {
1319    type Item = Result<DeviceConnectorRequest, fidl::Error>;
1320
1321    fn poll_next(
1322        mut self: std::pin::Pin<&mut Self>,
1323        cx: &mut std::task::Context<'_>,
1324    ) -> std::task::Poll<Option<Self::Item>> {
1325        let this = &mut *self;
1326        if this.inner.check_shutdown(cx) {
1327            this.is_terminated = true;
1328            return std::task::Poll::Ready(None);
1329        }
1330        if this.is_terminated {
1331            panic!("polled DeviceConnectorRequestStream after completion");
1332        }
1333        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1334            |bytes, handles| {
1335                match this.inner.channel().read_etc(cx, bytes, handles) {
1336                    std::task::Poll::Ready(Ok(())) => {}
1337                    std::task::Poll::Pending => return std::task::Poll::Pending,
1338                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1339                        this.is_terminated = true;
1340                        return std::task::Poll::Ready(None);
1341                    }
1342                    std::task::Poll::Ready(Err(e)) => {
1343                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1344                            e.into(),
1345                        ))));
1346                    }
1347                }
1348
1349                // A message has been received from the channel
1350                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1351
1352                std::task::Poll::Ready(Some(match header.ordinal {
1353                    0x296896c9304836cd => {
1354                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1355                        let mut req = fidl::new_empty!(
1356                            DeviceConnectorConnectRequest,
1357                            fidl::encoding::DefaultFuchsiaResourceDialect
1358                        );
1359                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
1360                        let control_handle =
1361                            DeviceConnectorControlHandle { inner: this.inner.clone() };
1362                        Ok(DeviceConnectorRequest::Connect {
1363                            name: req.name,
1364                            server_end: req.server_end,
1365
1366                            control_handle,
1367                        })
1368                    }
1369                    _ => Err(fidl::Error::UnknownOrdinal {
1370                        ordinal: header.ordinal,
1371                        protocol_name:
1372                            <DeviceConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1373                    }),
1374                }))
1375            },
1376        )
1377    }
1378}
1379
1380/// Protocol for connecting to [`Device`] on a LoWPAN
1381/// interface.
1382#[derive(Debug)]
1383pub enum DeviceConnectorRequest {
1384    /// Connects to the [`Device`] protocol on the
1385    /// named LoWPAN interface.
1386    ///
1387    /// The name of the interface can be learned by calling
1388    /// [`fuchsia.lowpan/Lookup.GetDevices()`].
1389    ///
1390    /// If there is an error in processing this request
1391    /// the given channel is closed and an epitaph code used
1392    /// to describe the reason for the failure:
1393    ///
1394    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
1395    ///   was not formatted correctly or otherwise invalid.
1396    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
1397    ///   given name.
1398    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
1399    ///   does not support this protocol.
1400    Connect {
1401        name: String,
1402        server_end: fidl::endpoints::ServerEnd<DeviceMarker>,
1403        control_handle: DeviceConnectorControlHandle,
1404    },
1405}
1406
1407impl DeviceConnectorRequest {
1408    #[allow(irrefutable_let_patterns)]
1409    pub fn into_connect(
1410        self,
1411    ) -> Option<(String, fidl::endpoints::ServerEnd<DeviceMarker>, DeviceConnectorControlHandle)>
1412    {
1413        if let DeviceConnectorRequest::Connect { name, server_end, control_handle } = self {
1414            Some((name, server_end, control_handle))
1415        } else {
1416            None
1417        }
1418    }
1419
1420    /// Name of the method defined in FIDL
1421    pub fn method_name(&self) -> &'static str {
1422        match *self {
1423            DeviceConnectorRequest::Connect { .. } => "connect",
1424        }
1425    }
1426}
1427
1428#[derive(Debug, Clone)]
1429pub struct DeviceConnectorControlHandle {
1430    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1431}
1432
1433impl fidl::endpoints::ControlHandle for DeviceConnectorControlHandle {
1434    fn shutdown(&self) {
1435        self.inner.shutdown()
1436    }
1437
1438    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1439        self.inner.shutdown_with_epitaph(status)
1440    }
1441
1442    fn is_closed(&self) -> bool {
1443        self.inner.channel().is_closed()
1444    }
1445    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1446        self.inner.channel().on_closed()
1447    }
1448
1449    #[cfg(target_os = "fuchsia")]
1450    fn signal_peer(
1451        &self,
1452        clear_mask: zx::Signals,
1453        set_mask: zx::Signals,
1454    ) -> Result<(), zx_status::Status> {
1455        use fidl::Peered;
1456        self.inner.channel().signal_peer(clear_mask, set_mask)
1457    }
1458}
1459
1460impl DeviceConnectorControlHandle {}
1461
1462#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1463pub struct DeviceExtraMarker;
1464
1465impl fidl::endpoints::ProtocolMarker for DeviceExtraMarker {
1466    type Proxy = DeviceExtraProxy;
1467    type RequestStream = DeviceExtraRequestStream;
1468    #[cfg(target_os = "fuchsia")]
1469    type SynchronousProxy = DeviceExtraSynchronousProxy;
1470
1471    const DEBUG_NAME: &'static str = "(anonymous) DeviceExtra";
1472}
1473
1474pub trait DeviceExtraProxyInterface: Send + Sync {
1475    fn r#form_network(
1476        &self,
1477        params: &fidl_fuchsia_lowpan_device::ProvisioningParams,
1478        progress: fidl::endpoints::ServerEnd<ProvisioningMonitorMarker>,
1479    ) -> Result<(), fidl::Error>;
1480    fn r#join_network(
1481        &self,
1482        params: &JoinParams,
1483        progress: fidl::endpoints::ServerEnd<ProvisioningMonitorMarker>,
1484    ) -> Result<(), fidl::Error>;
1485    fn r#start_network_scan(
1486        &self,
1487        params: &NetworkScanParameters,
1488        stream: fidl::endpoints::ServerEnd<BeaconInfoStreamMarker>,
1489    ) -> Result<(), fidl::Error>;
1490}
1491#[derive(Debug)]
1492#[cfg(target_os = "fuchsia")]
1493pub struct DeviceExtraSynchronousProxy {
1494    client: fidl::client::sync::Client,
1495}
1496
1497#[cfg(target_os = "fuchsia")]
1498impl fidl::endpoints::SynchronousProxy for DeviceExtraSynchronousProxy {
1499    type Proxy = DeviceExtraProxy;
1500    type Protocol = DeviceExtraMarker;
1501
1502    fn from_channel(inner: fidl::Channel) -> Self {
1503        Self::new(inner)
1504    }
1505
1506    fn into_channel(self) -> fidl::Channel {
1507        self.client.into_channel()
1508    }
1509
1510    fn as_channel(&self) -> &fidl::Channel {
1511        self.client.as_channel()
1512    }
1513}
1514
1515#[cfg(target_os = "fuchsia")]
1516impl DeviceExtraSynchronousProxy {
1517    pub fn new(channel: fidl::Channel) -> Self {
1518        Self { client: fidl::client::sync::Client::new(channel) }
1519    }
1520
1521    pub fn into_channel(self) -> fidl::Channel {
1522        self.client.into_channel()
1523    }
1524
1525    /// Waits until an event arrives and returns it. It is safe for other
1526    /// threads to make concurrent requests while waiting for an event.
1527    pub fn wait_for_event(
1528        &self,
1529        deadline: zx::MonotonicInstant,
1530    ) -> Result<DeviceExtraEvent, fidl::Error> {
1531        DeviceExtraEvent::decode(self.client.wait_for_event::<DeviceExtraMarker>(deadline)?)
1532    }
1533
1534    /// Forms a new network with the given provisioning parameters.
1535    ///
1536    /// Any unspecified fields that are required by the underlying
1537    /// device or network type will assigned with default values.
1538    /// If the credential is unspecified, a random one will be
1539    /// generated automatically.
1540    ///
1541    /// This method will cause the device to leave any previously
1542    /// provisioned network.
1543    ///
1544    /// Calling this method while the device is not active will
1545    /// implicitly make the device active.
1546    ///
1547    /// Upon success, the device will be active and provisioned
1548    /// for the newly created network.
1549    ///
1550    /// The progress of the operation can be monitored via
1551    /// the `ProvisioningMonitor` protocol instance. The operation
1552    /// may be cancelled by closing the `ProvisioningMonitor`.
1553    ///
1554    /// Calling this method will cause any current form, join, or
1555    /// commission operation to be canceled.
1556    pub fn r#form_network(
1557        &self,
1558        mut params: &fidl_fuchsia_lowpan_device::ProvisioningParams,
1559        mut progress: fidl::endpoints::ServerEnd<ProvisioningMonitorMarker>,
1560    ) -> Result<(), fidl::Error> {
1561        self.client.send::<DeviceExtraFormNetworkRequest>(
1562            (params, progress),
1563            0x6a8135f84bfc90e,
1564            fidl::encoding::DynamicFlags::empty(),
1565        )
1566    }
1567
1568    /// Attempts to join a pre-existing nearby network
1569    /// with the given provisioning parameters or joiner parameters.
1570    ///
1571    /// In-band commissioning is supported.
1572    ///
1573    /// Upon success, the device will be active and provisioned
1574    /// for the newly created network.
1575    ///
1576    /// The progress of the operation can be monitored via
1577    /// the `ProvisioningMonitor` protocol instance. The operation
1578    /// may be cancelled by closing the `ProvisioningMonitor`.
1579    ///
1580    /// Calling this method will cause any current form, join, or
1581    /// commission operation to be canceled.
1582    pub fn r#join_network(
1583        &self,
1584        mut params: &JoinParams,
1585        mut progress: fidl::endpoints::ServerEnd<ProvisioningMonitorMarker>,
1586    ) -> Result<(), fidl::Error> {
1587        self.client.send::<DeviceExtraJoinNetworkRequest>(
1588            (params, progress),
1589            0x3ea583bab79f81c0,
1590            fidl::encoding::DynamicFlags::empty(),
1591        )
1592    }
1593
1594    /// Starts an active network scan operation.
1595    ///
1596    /// This scan is used to identify other nearby networks in order
1597    /// to identify channels that should be avoided.
1598    ///
1599    /// The scan operation may be cancelled by closing the stream protocol.
1600    ///
1601    /// If a scan is started while another scan is in progress,
1602    /// the previous scan is allowed to complete before
1603    /// the new scan executes and starts returning results.
1604    ///
1605    /// All scans should be expected to completely occupy the
1606    /// LoWPAN device while it is in progress, preventing other operations
1607    /// from completing until the scan has completed. Additionally, all
1608    /// network packets should be expected to be dropped while a scan is
1609    /// in progress.
1610    ///
1611    /// A [`BeaconInfoStream`] instance could be used to expose coarse
1612    /// location information.
1613    pub fn r#start_network_scan(
1614        &self,
1615        mut params: &NetworkScanParameters,
1616        mut stream: fidl::endpoints::ServerEnd<BeaconInfoStreamMarker>,
1617    ) -> Result<(), fidl::Error> {
1618        self.client.send::<DeviceExtraStartNetworkScanRequest>(
1619            (params, stream),
1620            0x6288c73b79188b40,
1621            fidl::encoding::DynamicFlags::empty(),
1622        )
1623    }
1624}
1625
1626#[cfg(target_os = "fuchsia")]
1627impl From<DeviceExtraSynchronousProxy> for zx::NullableHandle {
1628    fn from(value: DeviceExtraSynchronousProxy) -> Self {
1629        value.into_channel().into()
1630    }
1631}
1632
1633#[cfg(target_os = "fuchsia")]
1634impl From<fidl::Channel> for DeviceExtraSynchronousProxy {
1635    fn from(value: fidl::Channel) -> Self {
1636        Self::new(value)
1637    }
1638}
1639
1640#[cfg(target_os = "fuchsia")]
1641impl fidl::endpoints::FromClient for DeviceExtraSynchronousProxy {
1642    type Protocol = DeviceExtraMarker;
1643
1644    fn from_client(value: fidl::endpoints::ClientEnd<DeviceExtraMarker>) -> Self {
1645        Self::new(value.into_channel())
1646    }
1647}
1648
1649#[derive(Debug, Clone)]
1650pub struct DeviceExtraProxy {
1651    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1652}
1653
1654impl fidl::endpoints::Proxy for DeviceExtraProxy {
1655    type Protocol = DeviceExtraMarker;
1656
1657    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1658        Self::new(inner)
1659    }
1660
1661    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1662        self.client.into_channel().map_err(|client| Self { client })
1663    }
1664
1665    fn as_channel(&self) -> &::fidl::AsyncChannel {
1666        self.client.as_channel()
1667    }
1668}
1669
1670impl DeviceExtraProxy {
1671    /// Create a new Proxy for fuchsia.lowpan.experimental/DeviceExtra.
1672    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1673        let protocol_name = <DeviceExtraMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1674        Self { client: fidl::client::Client::new(channel, protocol_name) }
1675    }
1676
1677    /// Get a Stream of events from the remote end of the protocol.
1678    ///
1679    /// # Panics
1680    ///
1681    /// Panics if the event stream was already taken.
1682    pub fn take_event_stream(&self) -> DeviceExtraEventStream {
1683        DeviceExtraEventStream { event_receiver: self.client.take_event_receiver() }
1684    }
1685
1686    /// Forms a new network with the given provisioning parameters.
1687    ///
1688    /// Any unspecified fields that are required by the underlying
1689    /// device or network type will assigned with default values.
1690    /// If the credential is unspecified, a random one will be
1691    /// generated automatically.
1692    ///
1693    /// This method will cause the device to leave any previously
1694    /// provisioned network.
1695    ///
1696    /// Calling this method while the device is not active will
1697    /// implicitly make the device active.
1698    ///
1699    /// Upon success, the device will be active and provisioned
1700    /// for the newly created network.
1701    ///
1702    /// The progress of the operation can be monitored via
1703    /// the `ProvisioningMonitor` protocol instance. The operation
1704    /// may be cancelled by closing the `ProvisioningMonitor`.
1705    ///
1706    /// Calling this method will cause any current form, join, or
1707    /// commission operation to be canceled.
1708    pub fn r#form_network(
1709        &self,
1710        mut params: &fidl_fuchsia_lowpan_device::ProvisioningParams,
1711        mut progress: fidl::endpoints::ServerEnd<ProvisioningMonitorMarker>,
1712    ) -> Result<(), fidl::Error> {
1713        DeviceExtraProxyInterface::r#form_network(self, params, progress)
1714    }
1715
1716    /// Attempts to join a pre-existing nearby network
1717    /// with the given provisioning parameters or joiner parameters.
1718    ///
1719    /// In-band commissioning is supported.
1720    ///
1721    /// Upon success, the device will be active and provisioned
1722    /// for the newly created network.
1723    ///
1724    /// The progress of the operation can be monitored via
1725    /// the `ProvisioningMonitor` protocol instance. The operation
1726    /// may be cancelled by closing the `ProvisioningMonitor`.
1727    ///
1728    /// Calling this method will cause any current form, join, or
1729    /// commission operation to be canceled.
1730    pub fn r#join_network(
1731        &self,
1732        mut params: &JoinParams,
1733        mut progress: fidl::endpoints::ServerEnd<ProvisioningMonitorMarker>,
1734    ) -> Result<(), fidl::Error> {
1735        DeviceExtraProxyInterface::r#join_network(self, params, progress)
1736    }
1737
1738    /// Starts an active network scan operation.
1739    ///
1740    /// This scan is used to identify other nearby networks in order
1741    /// to identify channels that should be avoided.
1742    ///
1743    /// The scan operation may be cancelled by closing the stream protocol.
1744    ///
1745    /// If a scan is started while another scan is in progress,
1746    /// the previous scan is allowed to complete before
1747    /// the new scan executes and starts returning results.
1748    ///
1749    /// All scans should be expected to completely occupy the
1750    /// LoWPAN device while it is in progress, preventing other operations
1751    /// from completing until the scan has completed. Additionally, all
1752    /// network packets should be expected to be dropped while a scan is
1753    /// in progress.
1754    ///
1755    /// A [`BeaconInfoStream`] instance could be used to expose coarse
1756    /// location information.
1757    pub fn r#start_network_scan(
1758        &self,
1759        mut params: &NetworkScanParameters,
1760        mut stream: fidl::endpoints::ServerEnd<BeaconInfoStreamMarker>,
1761    ) -> Result<(), fidl::Error> {
1762        DeviceExtraProxyInterface::r#start_network_scan(self, params, stream)
1763    }
1764}
1765
1766impl DeviceExtraProxyInterface for DeviceExtraProxy {
1767    fn r#form_network(
1768        &self,
1769        mut params: &fidl_fuchsia_lowpan_device::ProvisioningParams,
1770        mut progress: fidl::endpoints::ServerEnd<ProvisioningMonitorMarker>,
1771    ) -> Result<(), fidl::Error> {
1772        self.client.send::<DeviceExtraFormNetworkRequest>(
1773            (params, progress),
1774            0x6a8135f84bfc90e,
1775            fidl::encoding::DynamicFlags::empty(),
1776        )
1777    }
1778
1779    fn r#join_network(
1780        &self,
1781        mut params: &JoinParams,
1782        mut progress: fidl::endpoints::ServerEnd<ProvisioningMonitorMarker>,
1783    ) -> Result<(), fidl::Error> {
1784        self.client.send::<DeviceExtraJoinNetworkRequest>(
1785            (params, progress),
1786            0x3ea583bab79f81c0,
1787            fidl::encoding::DynamicFlags::empty(),
1788        )
1789    }
1790
1791    fn r#start_network_scan(
1792        &self,
1793        mut params: &NetworkScanParameters,
1794        mut stream: fidl::endpoints::ServerEnd<BeaconInfoStreamMarker>,
1795    ) -> Result<(), fidl::Error> {
1796        self.client.send::<DeviceExtraStartNetworkScanRequest>(
1797            (params, stream),
1798            0x6288c73b79188b40,
1799            fidl::encoding::DynamicFlags::empty(),
1800        )
1801    }
1802}
1803
1804pub struct DeviceExtraEventStream {
1805    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1806}
1807
1808impl std::marker::Unpin for DeviceExtraEventStream {}
1809
1810impl futures::stream::FusedStream for DeviceExtraEventStream {
1811    fn is_terminated(&self) -> bool {
1812        self.event_receiver.is_terminated()
1813    }
1814}
1815
1816impl futures::Stream for DeviceExtraEventStream {
1817    type Item = Result<DeviceExtraEvent, fidl::Error>;
1818
1819    fn poll_next(
1820        mut self: std::pin::Pin<&mut Self>,
1821        cx: &mut std::task::Context<'_>,
1822    ) -> std::task::Poll<Option<Self::Item>> {
1823        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1824            &mut self.event_receiver,
1825            cx
1826        )?) {
1827            Some(buf) => std::task::Poll::Ready(Some(DeviceExtraEvent::decode(buf))),
1828            None => std::task::Poll::Ready(None),
1829        }
1830    }
1831}
1832
1833#[derive(Debug)]
1834pub enum DeviceExtraEvent {}
1835
1836impl DeviceExtraEvent {
1837    /// Decodes a message buffer as a [`DeviceExtraEvent`].
1838    fn decode(
1839        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1840    ) -> Result<DeviceExtraEvent, fidl::Error> {
1841        let (bytes, _handles) = buf.split_mut();
1842        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1843        debug_assert_eq!(tx_header.tx_id, 0);
1844        match tx_header.ordinal {
1845            _ => Err(fidl::Error::UnknownOrdinal {
1846                ordinal: tx_header.ordinal,
1847                protocol_name: <DeviceExtraMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1848            }),
1849        }
1850    }
1851}
1852
1853/// A Stream of incoming requests for fuchsia.lowpan.experimental/DeviceExtra.
1854pub struct DeviceExtraRequestStream {
1855    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1856    is_terminated: bool,
1857}
1858
1859impl std::marker::Unpin for DeviceExtraRequestStream {}
1860
1861impl futures::stream::FusedStream for DeviceExtraRequestStream {
1862    fn is_terminated(&self) -> bool {
1863        self.is_terminated
1864    }
1865}
1866
1867impl fidl::endpoints::RequestStream for DeviceExtraRequestStream {
1868    type Protocol = DeviceExtraMarker;
1869    type ControlHandle = DeviceExtraControlHandle;
1870
1871    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1872        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1873    }
1874
1875    fn control_handle(&self) -> Self::ControlHandle {
1876        DeviceExtraControlHandle { inner: self.inner.clone() }
1877    }
1878
1879    fn into_inner(
1880        self,
1881    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1882    {
1883        (self.inner, self.is_terminated)
1884    }
1885
1886    fn from_inner(
1887        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1888        is_terminated: bool,
1889    ) -> Self {
1890        Self { inner, is_terminated }
1891    }
1892}
1893
1894impl futures::Stream for DeviceExtraRequestStream {
1895    type Item = Result<DeviceExtraRequest, fidl::Error>;
1896
1897    fn poll_next(
1898        mut self: std::pin::Pin<&mut Self>,
1899        cx: &mut std::task::Context<'_>,
1900    ) -> std::task::Poll<Option<Self::Item>> {
1901        let this = &mut *self;
1902        if this.inner.check_shutdown(cx) {
1903            this.is_terminated = true;
1904            return std::task::Poll::Ready(None);
1905        }
1906        if this.is_terminated {
1907            panic!("polled DeviceExtraRequestStream after completion");
1908        }
1909        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1910            |bytes, handles| {
1911                match this.inner.channel().read_etc(cx, bytes, handles) {
1912                    std::task::Poll::Ready(Ok(())) => {}
1913                    std::task::Poll::Pending => return std::task::Poll::Pending,
1914                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1915                        this.is_terminated = true;
1916                        return std::task::Poll::Ready(None);
1917                    }
1918                    std::task::Poll::Ready(Err(e)) => {
1919                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1920                            e.into(),
1921                        ))));
1922                    }
1923                }
1924
1925                // A message has been received from the channel
1926                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1927
1928                std::task::Poll::Ready(Some(match header.ordinal {
1929                    0x6a8135f84bfc90e => {
1930                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1931                        let mut req = fidl::new_empty!(
1932                            DeviceExtraFormNetworkRequest,
1933                            fidl::encoding::DefaultFuchsiaResourceDialect
1934                        );
1935                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceExtraFormNetworkRequest>(&header, _body_bytes, handles, &mut req)?;
1936                        let control_handle = DeviceExtraControlHandle { inner: this.inner.clone() };
1937                        Ok(DeviceExtraRequest::FormNetwork {
1938                            params: req.params,
1939                            progress: req.progress,
1940
1941                            control_handle,
1942                        })
1943                    }
1944                    0x3ea583bab79f81c0 => {
1945                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1946                        let mut req = fidl::new_empty!(
1947                            DeviceExtraJoinNetworkRequest,
1948                            fidl::encoding::DefaultFuchsiaResourceDialect
1949                        );
1950                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceExtraJoinNetworkRequest>(&header, _body_bytes, handles, &mut req)?;
1951                        let control_handle = DeviceExtraControlHandle { inner: this.inner.clone() };
1952                        Ok(DeviceExtraRequest::JoinNetwork {
1953                            params: req.params,
1954                            progress: req.progress,
1955
1956                            control_handle,
1957                        })
1958                    }
1959                    0x6288c73b79188b40 => {
1960                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1961                        let mut req = fidl::new_empty!(
1962                            DeviceExtraStartNetworkScanRequest,
1963                            fidl::encoding::DefaultFuchsiaResourceDialect
1964                        );
1965                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceExtraStartNetworkScanRequest>(&header, _body_bytes, handles, &mut req)?;
1966                        let control_handle = DeviceExtraControlHandle { inner: this.inner.clone() };
1967                        Ok(DeviceExtraRequest::StartNetworkScan {
1968                            params: req.params,
1969                            stream: req.stream,
1970
1971                            control_handle,
1972                        })
1973                    }
1974                    _ => Err(fidl::Error::UnknownOrdinal {
1975                        ordinal: header.ordinal,
1976                        protocol_name:
1977                            <DeviceExtraMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1978                    }),
1979                }))
1980            },
1981        )
1982    }
1983}
1984
1985/// LoWPAN Device "Extra" Protocol, Experimental Methods.
1986///
1987/// This protocol provides clients with a way to control and
1988/// monitor aspects of the LoWPAN device that can, either
1989/// directly or indirectly, leak PII or cryptographic keys.
1990#[derive(Debug)]
1991pub enum DeviceExtraRequest {
1992    /// Forms a new network with the given provisioning parameters.
1993    ///
1994    /// Any unspecified fields that are required by the underlying
1995    /// device or network type will assigned with default values.
1996    /// If the credential is unspecified, a random one will be
1997    /// generated automatically.
1998    ///
1999    /// This method will cause the device to leave any previously
2000    /// provisioned network.
2001    ///
2002    /// Calling this method while the device is not active will
2003    /// implicitly make the device active.
2004    ///
2005    /// Upon success, the device will be active and provisioned
2006    /// for the newly created network.
2007    ///
2008    /// The progress of the operation can be monitored via
2009    /// the `ProvisioningMonitor` protocol instance. The operation
2010    /// may be cancelled by closing the `ProvisioningMonitor`.
2011    ///
2012    /// Calling this method will cause any current form, join, or
2013    /// commission operation to be canceled.
2014    FormNetwork {
2015        params: fidl_fuchsia_lowpan_device::ProvisioningParams,
2016        progress: fidl::endpoints::ServerEnd<ProvisioningMonitorMarker>,
2017        control_handle: DeviceExtraControlHandle,
2018    },
2019    /// Attempts to join a pre-existing nearby network
2020    /// with the given provisioning parameters or joiner parameters.
2021    ///
2022    /// In-band commissioning is supported.
2023    ///
2024    /// Upon success, the device will be active and provisioned
2025    /// for the newly created network.
2026    ///
2027    /// The progress of the operation can be monitored via
2028    /// the `ProvisioningMonitor` protocol instance. The operation
2029    /// may be cancelled by closing the `ProvisioningMonitor`.
2030    ///
2031    /// Calling this method will cause any current form, join, or
2032    /// commission operation to be canceled.
2033    JoinNetwork {
2034        params: JoinParams,
2035        progress: fidl::endpoints::ServerEnd<ProvisioningMonitorMarker>,
2036        control_handle: DeviceExtraControlHandle,
2037    },
2038    /// Starts an active network scan operation.
2039    ///
2040    /// This scan is used to identify other nearby networks in order
2041    /// to identify channels that should be avoided.
2042    ///
2043    /// The scan operation may be cancelled by closing the stream protocol.
2044    ///
2045    /// If a scan is started while another scan is in progress,
2046    /// the previous scan is allowed to complete before
2047    /// the new scan executes and starts returning results.
2048    ///
2049    /// All scans should be expected to completely occupy the
2050    /// LoWPAN device while it is in progress, preventing other operations
2051    /// from completing until the scan has completed. Additionally, all
2052    /// network packets should be expected to be dropped while a scan is
2053    /// in progress.
2054    ///
2055    /// A [`BeaconInfoStream`] instance could be used to expose coarse
2056    /// location information.
2057    StartNetworkScan {
2058        params: NetworkScanParameters,
2059        stream: fidl::endpoints::ServerEnd<BeaconInfoStreamMarker>,
2060        control_handle: DeviceExtraControlHandle,
2061    },
2062}
2063
2064impl DeviceExtraRequest {
2065    #[allow(irrefutable_let_patterns)]
2066    pub fn into_form_network(
2067        self,
2068    ) -> Option<(
2069        fidl_fuchsia_lowpan_device::ProvisioningParams,
2070        fidl::endpoints::ServerEnd<ProvisioningMonitorMarker>,
2071        DeviceExtraControlHandle,
2072    )> {
2073        if let DeviceExtraRequest::FormNetwork { params, progress, control_handle } = self {
2074            Some((params, progress, control_handle))
2075        } else {
2076            None
2077        }
2078    }
2079
2080    #[allow(irrefutable_let_patterns)]
2081    pub fn into_join_network(
2082        self,
2083    ) -> Option<(
2084        JoinParams,
2085        fidl::endpoints::ServerEnd<ProvisioningMonitorMarker>,
2086        DeviceExtraControlHandle,
2087    )> {
2088        if let DeviceExtraRequest::JoinNetwork { params, progress, control_handle } = self {
2089            Some((params, progress, control_handle))
2090        } else {
2091            None
2092        }
2093    }
2094
2095    #[allow(irrefutable_let_patterns)]
2096    pub fn into_start_network_scan(
2097        self,
2098    ) -> Option<(
2099        NetworkScanParameters,
2100        fidl::endpoints::ServerEnd<BeaconInfoStreamMarker>,
2101        DeviceExtraControlHandle,
2102    )> {
2103        if let DeviceExtraRequest::StartNetworkScan { params, stream, control_handle } = self {
2104            Some((params, stream, control_handle))
2105        } else {
2106            None
2107        }
2108    }
2109
2110    /// Name of the method defined in FIDL
2111    pub fn method_name(&self) -> &'static str {
2112        match *self {
2113            DeviceExtraRequest::FormNetwork { .. } => "form_network",
2114            DeviceExtraRequest::JoinNetwork { .. } => "join_network",
2115            DeviceExtraRequest::StartNetworkScan { .. } => "start_network_scan",
2116        }
2117    }
2118}
2119
2120#[derive(Debug, Clone)]
2121pub struct DeviceExtraControlHandle {
2122    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2123}
2124
2125impl fidl::endpoints::ControlHandle for DeviceExtraControlHandle {
2126    fn shutdown(&self) {
2127        self.inner.shutdown()
2128    }
2129
2130    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2131        self.inner.shutdown_with_epitaph(status)
2132    }
2133
2134    fn is_closed(&self) -> bool {
2135        self.inner.channel().is_closed()
2136    }
2137    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2138        self.inner.channel().on_closed()
2139    }
2140
2141    #[cfg(target_os = "fuchsia")]
2142    fn signal_peer(
2143        &self,
2144        clear_mask: zx::Signals,
2145        set_mask: zx::Signals,
2146    ) -> Result<(), zx_status::Status> {
2147        use fidl::Peered;
2148        self.inner.channel().signal_peer(clear_mask, set_mask)
2149    }
2150}
2151
2152impl DeviceExtraControlHandle {}
2153
2154#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2155pub struct DeviceExtraConnectorMarker;
2156
2157impl fidl::endpoints::ProtocolMarker for DeviceExtraConnectorMarker {
2158    type Proxy = DeviceExtraConnectorProxy;
2159    type RequestStream = DeviceExtraConnectorRequestStream;
2160    #[cfg(target_os = "fuchsia")]
2161    type SynchronousProxy = DeviceExtraConnectorSynchronousProxy;
2162
2163    const DEBUG_NAME: &'static str = "fuchsia.lowpan.experimental.DeviceExtraConnector";
2164}
2165impl fidl::endpoints::DiscoverableProtocolMarker for DeviceExtraConnectorMarker {}
2166
2167pub trait DeviceExtraConnectorProxyInterface: Send + Sync {
2168    fn r#connect(
2169        &self,
2170        name: &str,
2171        server_end: fidl::endpoints::ServerEnd<DeviceExtraMarker>,
2172    ) -> Result<(), fidl::Error>;
2173}
2174#[derive(Debug)]
2175#[cfg(target_os = "fuchsia")]
2176pub struct DeviceExtraConnectorSynchronousProxy {
2177    client: fidl::client::sync::Client,
2178}
2179
2180#[cfg(target_os = "fuchsia")]
2181impl fidl::endpoints::SynchronousProxy for DeviceExtraConnectorSynchronousProxy {
2182    type Proxy = DeviceExtraConnectorProxy;
2183    type Protocol = DeviceExtraConnectorMarker;
2184
2185    fn from_channel(inner: fidl::Channel) -> Self {
2186        Self::new(inner)
2187    }
2188
2189    fn into_channel(self) -> fidl::Channel {
2190        self.client.into_channel()
2191    }
2192
2193    fn as_channel(&self) -> &fidl::Channel {
2194        self.client.as_channel()
2195    }
2196}
2197
2198#[cfg(target_os = "fuchsia")]
2199impl DeviceExtraConnectorSynchronousProxy {
2200    pub fn new(channel: fidl::Channel) -> Self {
2201        Self { client: fidl::client::sync::Client::new(channel) }
2202    }
2203
2204    pub fn into_channel(self) -> fidl::Channel {
2205        self.client.into_channel()
2206    }
2207
2208    /// Waits until an event arrives and returns it. It is safe for other
2209    /// threads to make concurrent requests while waiting for an event.
2210    pub fn wait_for_event(
2211        &self,
2212        deadline: zx::MonotonicInstant,
2213    ) -> Result<DeviceExtraConnectorEvent, fidl::Error> {
2214        DeviceExtraConnectorEvent::decode(
2215            self.client.wait_for_event::<DeviceExtraConnectorMarker>(deadline)?,
2216        )
2217    }
2218
2219    /// Connects to the [`DeviceExtra`] protocol on the
2220    /// named LoWPAN interface.
2221    ///
2222    /// The name of the interface can be learned by calling
2223    /// [`fuchsia.lowpan/Lookup.GetDevices`].
2224    ///
2225    /// If there is an error in processing this request
2226    /// the given channel is closed and an epitaph code used
2227    /// to describe the reason for the failure:
2228    ///
2229    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
2230    ///   was not formatted correctly or otherwise invalid.
2231    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
2232    ///   given name.
2233    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
2234    ///   does not support this protocol.
2235    pub fn r#connect(
2236        &self,
2237        mut name: &str,
2238        mut server_end: fidl::endpoints::ServerEnd<DeviceExtraMarker>,
2239    ) -> Result<(), fidl::Error> {
2240        self.client.send::<DeviceExtraConnectorConnectRequest>(
2241            (name, server_end),
2242            0x3fcb37e4226c81e9,
2243            fidl::encoding::DynamicFlags::empty(),
2244        )
2245    }
2246}
2247
2248#[cfg(target_os = "fuchsia")]
2249impl From<DeviceExtraConnectorSynchronousProxy> for zx::NullableHandle {
2250    fn from(value: DeviceExtraConnectorSynchronousProxy) -> Self {
2251        value.into_channel().into()
2252    }
2253}
2254
2255#[cfg(target_os = "fuchsia")]
2256impl From<fidl::Channel> for DeviceExtraConnectorSynchronousProxy {
2257    fn from(value: fidl::Channel) -> Self {
2258        Self::new(value)
2259    }
2260}
2261
2262#[cfg(target_os = "fuchsia")]
2263impl fidl::endpoints::FromClient for DeviceExtraConnectorSynchronousProxy {
2264    type Protocol = DeviceExtraConnectorMarker;
2265
2266    fn from_client(value: fidl::endpoints::ClientEnd<DeviceExtraConnectorMarker>) -> Self {
2267        Self::new(value.into_channel())
2268    }
2269}
2270
2271#[derive(Debug, Clone)]
2272pub struct DeviceExtraConnectorProxy {
2273    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2274}
2275
2276impl fidl::endpoints::Proxy for DeviceExtraConnectorProxy {
2277    type Protocol = DeviceExtraConnectorMarker;
2278
2279    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2280        Self::new(inner)
2281    }
2282
2283    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2284        self.client.into_channel().map_err(|client| Self { client })
2285    }
2286
2287    fn as_channel(&self) -> &::fidl::AsyncChannel {
2288        self.client.as_channel()
2289    }
2290}
2291
2292impl DeviceExtraConnectorProxy {
2293    /// Create a new Proxy for fuchsia.lowpan.experimental/DeviceExtraConnector.
2294    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2295        let protocol_name =
2296            <DeviceExtraConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2297        Self { client: fidl::client::Client::new(channel, protocol_name) }
2298    }
2299
2300    /// Get a Stream of events from the remote end of the protocol.
2301    ///
2302    /// # Panics
2303    ///
2304    /// Panics if the event stream was already taken.
2305    pub fn take_event_stream(&self) -> DeviceExtraConnectorEventStream {
2306        DeviceExtraConnectorEventStream { event_receiver: self.client.take_event_receiver() }
2307    }
2308
2309    /// Connects to the [`DeviceExtra`] protocol on the
2310    /// named LoWPAN interface.
2311    ///
2312    /// The name of the interface can be learned by calling
2313    /// [`fuchsia.lowpan/Lookup.GetDevices`].
2314    ///
2315    /// If there is an error in processing this request
2316    /// the given channel is closed and an epitaph code used
2317    /// to describe the reason for the failure:
2318    ///
2319    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
2320    ///   was not formatted correctly or otherwise invalid.
2321    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
2322    ///   given name.
2323    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
2324    ///   does not support this protocol.
2325    pub fn r#connect(
2326        &self,
2327        mut name: &str,
2328        mut server_end: fidl::endpoints::ServerEnd<DeviceExtraMarker>,
2329    ) -> Result<(), fidl::Error> {
2330        DeviceExtraConnectorProxyInterface::r#connect(self, name, server_end)
2331    }
2332}
2333
2334impl DeviceExtraConnectorProxyInterface for DeviceExtraConnectorProxy {
2335    fn r#connect(
2336        &self,
2337        mut name: &str,
2338        mut server_end: fidl::endpoints::ServerEnd<DeviceExtraMarker>,
2339    ) -> Result<(), fidl::Error> {
2340        self.client.send::<DeviceExtraConnectorConnectRequest>(
2341            (name, server_end),
2342            0x3fcb37e4226c81e9,
2343            fidl::encoding::DynamicFlags::empty(),
2344        )
2345    }
2346}
2347
2348pub struct DeviceExtraConnectorEventStream {
2349    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2350}
2351
2352impl std::marker::Unpin for DeviceExtraConnectorEventStream {}
2353
2354impl futures::stream::FusedStream for DeviceExtraConnectorEventStream {
2355    fn is_terminated(&self) -> bool {
2356        self.event_receiver.is_terminated()
2357    }
2358}
2359
2360impl futures::Stream for DeviceExtraConnectorEventStream {
2361    type Item = Result<DeviceExtraConnectorEvent, fidl::Error>;
2362
2363    fn poll_next(
2364        mut self: std::pin::Pin<&mut Self>,
2365        cx: &mut std::task::Context<'_>,
2366    ) -> std::task::Poll<Option<Self::Item>> {
2367        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2368            &mut self.event_receiver,
2369            cx
2370        )?) {
2371            Some(buf) => std::task::Poll::Ready(Some(DeviceExtraConnectorEvent::decode(buf))),
2372            None => std::task::Poll::Ready(None),
2373        }
2374    }
2375}
2376
2377#[derive(Debug)]
2378pub enum DeviceExtraConnectorEvent {}
2379
2380impl DeviceExtraConnectorEvent {
2381    /// Decodes a message buffer as a [`DeviceExtraConnectorEvent`].
2382    fn decode(
2383        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2384    ) -> Result<DeviceExtraConnectorEvent, fidl::Error> {
2385        let (bytes, _handles) = buf.split_mut();
2386        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2387        debug_assert_eq!(tx_header.tx_id, 0);
2388        match tx_header.ordinal {
2389            _ => Err(fidl::Error::UnknownOrdinal {
2390                ordinal: tx_header.ordinal,
2391                protocol_name:
2392                    <DeviceExtraConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2393            }),
2394        }
2395    }
2396}
2397
2398/// A Stream of incoming requests for fuchsia.lowpan.experimental/DeviceExtraConnector.
2399pub struct DeviceExtraConnectorRequestStream {
2400    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2401    is_terminated: bool,
2402}
2403
2404impl std::marker::Unpin for DeviceExtraConnectorRequestStream {}
2405
2406impl futures::stream::FusedStream for DeviceExtraConnectorRequestStream {
2407    fn is_terminated(&self) -> bool {
2408        self.is_terminated
2409    }
2410}
2411
2412impl fidl::endpoints::RequestStream for DeviceExtraConnectorRequestStream {
2413    type Protocol = DeviceExtraConnectorMarker;
2414    type ControlHandle = DeviceExtraConnectorControlHandle;
2415
2416    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2417        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2418    }
2419
2420    fn control_handle(&self) -> Self::ControlHandle {
2421        DeviceExtraConnectorControlHandle { inner: self.inner.clone() }
2422    }
2423
2424    fn into_inner(
2425        self,
2426    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2427    {
2428        (self.inner, self.is_terminated)
2429    }
2430
2431    fn from_inner(
2432        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2433        is_terminated: bool,
2434    ) -> Self {
2435        Self { inner, is_terminated }
2436    }
2437}
2438
2439impl futures::Stream for DeviceExtraConnectorRequestStream {
2440    type Item = Result<DeviceExtraConnectorRequest, fidl::Error>;
2441
2442    fn poll_next(
2443        mut self: std::pin::Pin<&mut Self>,
2444        cx: &mut std::task::Context<'_>,
2445    ) -> std::task::Poll<Option<Self::Item>> {
2446        let this = &mut *self;
2447        if this.inner.check_shutdown(cx) {
2448            this.is_terminated = true;
2449            return std::task::Poll::Ready(None);
2450        }
2451        if this.is_terminated {
2452            panic!("polled DeviceExtraConnectorRequestStream after completion");
2453        }
2454        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2455            |bytes, handles| {
2456                match this.inner.channel().read_etc(cx, bytes, handles) {
2457                    std::task::Poll::Ready(Ok(())) => {}
2458                    std::task::Poll::Pending => return std::task::Poll::Pending,
2459                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2460                        this.is_terminated = true;
2461                        return std::task::Poll::Ready(None);
2462                    }
2463                    std::task::Poll::Ready(Err(e)) => {
2464                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2465                            e.into(),
2466                        ))));
2467                    }
2468                }
2469
2470                // A message has been received from the channel
2471                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2472
2473                std::task::Poll::Ready(Some(match header.ordinal {
2474                0x3fcb37e4226c81e9 => {
2475                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2476                    let mut req = fidl::new_empty!(DeviceExtraConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2477                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceExtraConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2478                    let control_handle = DeviceExtraConnectorControlHandle {
2479                        inner: this.inner.clone(),
2480                    };
2481                    Ok(DeviceExtraConnectorRequest::Connect {name: req.name,
2482server_end: req.server_end,
2483
2484                        control_handle,
2485                    })
2486                }
2487                _ => Err(fidl::Error::UnknownOrdinal {
2488                    ordinal: header.ordinal,
2489                    protocol_name: <DeviceExtraConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2490                }),
2491            }))
2492            },
2493        )
2494    }
2495}
2496
2497/// Protocol for connecting to [`DeviceExtra`] on a LoWPAN
2498/// interface.
2499#[derive(Debug)]
2500pub enum DeviceExtraConnectorRequest {
2501    /// Connects to the [`DeviceExtra`] protocol on the
2502    /// named LoWPAN interface.
2503    ///
2504    /// The name of the interface can be learned by calling
2505    /// [`fuchsia.lowpan/Lookup.GetDevices`].
2506    ///
2507    /// If there is an error in processing this request
2508    /// the given channel is closed and an epitaph code used
2509    /// to describe the reason for the failure:
2510    ///
2511    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
2512    ///   was not formatted correctly or otherwise invalid.
2513    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
2514    ///   given name.
2515    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
2516    ///   does not support this protocol.
2517    Connect {
2518        name: String,
2519        server_end: fidl::endpoints::ServerEnd<DeviceExtraMarker>,
2520        control_handle: DeviceExtraConnectorControlHandle,
2521    },
2522}
2523
2524impl DeviceExtraConnectorRequest {
2525    #[allow(irrefutable_let_patterns)]
2526    pub fn into_connect(
2527        self,
2528    ) -> Option<(
2529        String,
2530        fidl::endpoints::ServerEnd<DeviceExtraMarker>,
2531        DeviceExtraConnectorControlHandle,
2532    )> {
2533        if let DeviceExtraConnectorRequest::Connect { name, server_end, control_handle } = self {
2534            Some((name, server_end, control_handle))
2535        } else {
2536            None
2537        }
2538    }
2539
2540    /// Name of the method defined in FIDL
2541    pub fn method_name(&self) -> &'static str {
2542        match *self {
2543            DeviceExtraConnectorRequest::Connect { .. } => "connect",
2544        }
2545    }
2546}
2547
2548#[derive(Debug, Clone)]
2549pub struct DeviceExtraConnectorControlHandle {
2550    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2551}
2552
2553impl fidl::endpoints::ControlHandle for DeviceExtraConnectorControlHandle {
2554    fn shutdown(&self) {
2555        self.inner.shutdown()
2556    }
2557
2558    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2559        self.inner.shutdown_with_epitaph(status)
2560    }
2561
2562    fn is_closed(&self) -> bool {
2563        self.inner.channel().is_closed()
2564    }
2565    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2566        self.inner.channel().on_closed()
2567    }
2568
2569    #[cfg(target_os = "fuchsia")]
2570    fn signal_peer(
2571        &self,
2572        clear_mask: zx::Signals,
2573        set_mask: zx::Signals,
2574    ) -> Result<(), zx_status::Status> {
2575        use fidl::Peered;
2576        self.inner.channel().signal_peer(clear_mask, set_mask)
2577    }
2578}
2579
2580impl DeviceExtraConnectorControlHandle {}
2581
2582#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2583pub struct DeviceRouteMarker;
2584
2585impl fidl::endpoints::ProtocolMarker for DeviceRouteMarker {
2586    type Proxy = DeviceRouteProxy;
2587    type RequestStream = DeviceRouteRequestStream;
2588    #[cfg(target_os = "fuchsia")]
2589    type SynchronousProxy = DeviceRouteSynchronousProxy;
2590
2591    const DEBUG_NAME: &'static str = "(anonymous) DeviceRoute";
2592}
2593
2594pub trait DeviceRouteProxyInterface: Send + Sync {
2595    type RegisterOnMeshPrefixResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
2596        + Send;
2597    fn r#register_on_mesh_prefix(
2598        &self,
2599        prefix: &OnMeshPrefix,
2600    ) -> Self::RegisterOnMeshPrefixResponseFut;
2601    type UnregisterOnMeshPrefixResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
2602        + Send;
2603    fn r#unregister_on_mesh_prefix(
2604        &self,
2605        subnet: &fidl_fuchsia_net::Ipv6AddressWithPrefix,
2606    ) -> Self::UnregisterOnMeshPrefixResponseFut;
2607    type RegisterExternalRouteResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
2608        + Send;
2609    fn r#register_external_route(
2610        &self,
2611        external_route: &ExternalRoute,
2612    ) -> Self::RegisterExternalRouteResponseFut;
2613    type UnregisterExternalRouteResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
2614        + Send;
2615    fn r#unregister_external_route(
2616        &self,
2617        subnet: &fidl_fuchsia_net::Ipv6AddressWithPrefix,
2618    ) -> Self::UnregisterExternalRouteResponseFut;
2619}
2620#[derive(Debug)]
2621#[cfg(target_os = "fuchsia")]
2622pub struct DeviceRouteSynchronousProxy {
2623    client: fidl::client::sync::Client,
2624}
2625
2626#[cfg(target_os = "fuchsia")]
2627impl fidl::endpoints::SynchronousProxy for DeviceRouteSynchronousProxy {
2628    type Proxy = DeviceRouteProxy;
2629    type Protocol = DeviceRouteMarker;
2630
2631    fn from_channel(inner: fidl::Channel) -> Self {
2632        Self::new(inner)
2633    }
2634
2635    fn into_channel(self) -> fidl::Channel {
2636        self.client.into_channel()
2637    }
2638
2639    fn as_channel(&self) -> &fidl::Channel {
2640        self.client.as_channel()
2641    }
2642}
2643
2644#[cfg(target_os = "fuchsia")]
2645impl DeviceRouteSynchronousProxy {
2646    pub fn new(channel: fidl::Channel) -> Self {
2647        Self { client: fidl::client::sync::Client::new(channel) }
2648    }
2649
2650    pub fn into_channel(self) -> fidl::Channel {
2651        self.client.into_channel()
2652    }
2653
2654    /// Waits until an event arrives and returns it. It is safe for other
2655    /// threads to make concurrent requests while waiting for an event.
2656    pub fn wait_for_event(
2657        &self,
2658        deadline: zx::MonotonicInstant,
2659    ) -> Result<DeviceRouteEvent, fidl::Error> {
2660        DeviceRouteEvent::decode(self.client.wait_for_event::<DeviceRouteMarker>(deadline)?)
2661    }
2662
2663    /// Registers an on-mesh prefix to be advertised on the
2664    /// current network.
2665    ///
2666    /// Subsequent calls with the same value for the `subnet` field will
2667    /// update the properties associated with that on-mesh prefix.
2668    ///
2669    /// These changes persist like adding an IP address would,
2670    /// and will stick around until explicitly removed or
2671    /// the interface component is reset/restarted.
2672    ///
2673    /// If the given `OnMeshPrefix` structure is invalid for some reason
2674    /// (missing required fields, invalid values, etc), the channel will be
2675    /// closed with the epitaph `ZX_ERR_INVALID_ARGS`.
2676    ///
2677    /// If registering a new on-mesh prefix and the maximum number of
2678    /// on-mesh prefixes has already been registered, this channel will
2679    /// be closed with the epitaph `ZX_ERR_NO_RESOURCES`.
2680    pub fn r#register_on_mesh_prefix(
2681        &self,
2682        mut prefix: &OnMeshPrefix,
2683        ___deadline: zx::MonotonicInstant,
2684    ) -> Result<(), fidl::Error> {
2685        let _response = self.client.send_query::<
2686            DeviceRouteRegisterOnMeshPrefixRequest,
2687            fidl::encoding::EmptyPayload,
2688            DeviceRouteMarker,
2689        >(
2690            (prefix,),
2691            0x2c4135231eb97f61,
2692            fidl::encoding::DynamicFlags::empty(),
2693            ___deadline,
2694        )?;
2695        Ok(_response)
2696    }
2697
2698    /// Unregisters any on-mesh prefix that was previously registered with
2699    /// `RegisterOnMeshPrefix`.  It returns once the on-mesh prefix has
2700    /// been removed locally.
2701    ///
2702    /// If the given mesh prefix was not previously registered,
2703    /// no action is taken.
2704    pub fn r#unregister_on_mesh_prefix(
2705        &self,
2706        mut subnet: &fidl_fuchsia_net::Ipv6AddressWithPrefix,
2707        ___deadline: zx::MonotonicInstant,
2708    ) -> Result<(), fidl::Error> {
2709        let _response = self.client.send_query::<
2710            DeviceRouteUnregisterOnMeshPrefixRequest,
2711            fidl::encoding::EmptyPayload,
2712            DeviceRouteMarker,
2713        >(
2714            (subnet,),
2715            0x82d5184028b797f,
2716            fidl::encoding::DynamicFlags::empty(),
2717            ___deadline,
2718        )?;
2719        Ok(_response)
2720    }
2721
2722    /// Registers an external route to be advertised on the
2723    /// current network.
2724    ///
2725    /// Subsequent calls with the same value for the `subnet` field will
2726    /// update the properties associated with that route.
2727    ///
2728    /// These changes persist like adding an IP address would,
2729    /// and will stick around until explicitly removed or
2730    /// the interface component is reset/restarted.
2731    ///
2732    /// If the given `ExternalRoute` structure is invalid for some reason
2733    /// (missing required fields, invalid values, etc), the channel will be
2734    /// closed with the epitaph `ZX_ERR_INVALID_ARGUMENT`.
2735    ///
2736    /// If registering a new external route and the maximum number of
2737    /// external routes has already been registered, this channel will
2738    /// be closed with the epitaph `ZX_ERR_NO_RESOURCES`.
2739    pub fn r#register_external_route(
2740        &self,
2741        mut external_route: &ExternalRoute,
2742        ___deadline: zx::MonotonicInstant,
2743    ) -> Result<(), fidl::Error> {
2744        let _response = self.client.send_query::<
2745            DeviceRouteRegisterExternalRouteRequest,
2746            fidl::encoding::EmptyPayload,
2747            DeviceRouteMarker,
2748        >(
2749            (external_route,),
2750            0x75f70f0fc34a5a73,
2751            fidl::encoding::DynamicFlags::empty(),
2752            ___deadline,
2753        )?;
2754        Ok(_response)
2755    }
2756
2757    /// Unregisters any external route that was previously registered with
2758    /// `RegisterExternalRoute`. It returns once the external route has
2759    /// been removed locally.
2760    ///
2761    /// If the given external route was not previously registered,
2762    /// no action is taken.
2763    pub fn r#unregister_external_route(
2764        &self,
2765        mut subnet: &fidl_fuchsia_net::Ipv6AddressWithPrefix,
2766        ___deadline: zx::MonotonicInstant,
2767    ) -> Result<(), fidl::Error> {
2768        let _response = self.client.send_query::<
2769            DeviceRouteUnregisterExternalRouteRequest,
2770            fidl::encoding::EmptyPayload,
2771            DeviceRouteMarker,
2772        >(
2773            (subnet,),
2774            0x3769be353b1d7088,
2775            fidl::encoding::DynamicFlags::empty(),
2776            ___deadline,
2777        )?;
2778        Ok(_response)
2779    }
2780}
2781
2782#[cfg(target_os = "fuchsia")]
2783impl From<DeviceRouteSynchronousProxy> for zx::NullableHandle {
2784    fn from(value: DeviceRouteSynchronousProxy) -> Self {
2785        value.into_channel().into()
2786    }
2787}
2788
2789#[cfg(target_os = "fuchsia")]
2790impl From<fidl::Channel> for DeviceRouteSynchronousProxy {
2791    fn from(value: fidl::Channel) -> Self {
2792        Self::new(value)
2793    }
2794}
2795
2796#[cfg(target_os = "fuchsia")]
2797impl fidl::endpoints::FromClient for DeviceRouteSynchronousProxy {
2798    type Protocol = DeviceRouteMarker;
2799
2800    fn from_client(value: fidl::endpoints::ClientEnd<DeviceRouteMarker>) -> Self {
2801        Self::new(value.into_channel())
2802    }
2803}
2804
2805#[derive(Debug, Clone)]
2806pub struct DeviceRouteProxy {
2807    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2808}
2809
2810impl fidl::endpoints::Proxy for DeviceRouteProxy {
2811    type Protocol = DeviceRouteMarker;
2812
2813    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2814        Self::new(inner)
2815    }
2816
2817    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2818        self.client.into_channel().map_err(|client| Self { client })
2819    }
2820
2821    fn as_channel(&self) -> &::fidl::AsyncChannel {
2822        self.client.as_channel()
2823    }
2824}
2825
2826impl DeviceRouteProxy {
2827    /// Create a new Proxy for fuchsia.lowpan.experimental/DeviceRoute.
2828    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2829        let protocol_name = <DeviceRouteMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2830        Self { client: fidl::client::Client::new(channel, protocol_name) }
2831    }
2832
2833    /// Get a Stream of events from the remote end of the protocol.
2834    ///
2835    /// # Panics
2836    ///
2837    /// Panics if the event stream was already taken.
2838    pub fn take_event_stream(&self) -> DeviceRouteEventStream {
2839        DeviceRouteEventStream { event_receiver: self.client.take_event_receiver() }
2840    }
2841
2842    /// Registers an on-mesh prefix to be advertised on the
2843    /// current network.
2844    ///
2845    /// Subsequent calls with the same value for the `subnet` field will
2846    /// update the properties associated with that on-mesh prefix.
2847    ///
2848    /// These changes persist like adding an IP address would,
2849    /// and will stick around until explicitly removed or
2850    /// the interface component is reset/restarted.
2851    ///
2852    /// If the given `OnMeshPrefix` structure is invalid for some reason
2853    /// (missing required fields, invalid values, etc), the channel will be
2854    /// closed with the epitaph `ZX_ERR_INVALID_ARGS`.
2855    ///
2856    /// If registering a new on-mesh prefix and the maximum number of
2857    /// on-mesh prefixes has already been registered, this channel will
2858    /// be closed with the epitaph `ZX_ERR_NO_RESOURCES`.
2859    pub fn r#register_on_mesh_prefix(
2860        &self,
2861        mut prefix: &OnMeshPrefix,
2862    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2863        DeviceRouteProxyInterface::r#register_on_mesh_prefix(self, prefix)
2864    }
2865
2866    /// Unregisters any on-mesh prefix that was previously registered with
2867    /// `RegisterOnMeshPrefix`.  It returns once the on-mesh prefix has
2868    /// been removed locally.
2869    ///
2870    /// If the given mesh prefix was not previously registered,
2871    /// no action is taken.
2872    pub fn r#unregister_on_mesh_prefix(
2873        &self,
2874        mut subnet: &fidl_fuchsia_net::Ipv6AddressWithPrefix,
2875    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2876        DeviceRouteProxyInterface::r#unregister_on_mesh_prefix(self, subnet)
2877    }
2878
2879    /// Registers an external route to be advertised on the
2880    /// current network.
2881    ///
2882    /// Subsequent calls with the same value for the `subnet` field will
2883    /// update the properties associated with that route.
2884    ///
2885    /// These changes persist like adding an IP address would,
2886    /// and will stick around until explicitly removed or
2887    /// the interface component is reset/restarted.
2888    ///
2889    /// If the given `ExternalRoute` structure is invalid for some reason
2890    /// (missing required fields, invalid values, etc), the channel will be
2891    /// closed with the epitaph `ZX_ERR_INVALID_ARGUMENT`.
2892    ///
2893    /// If registering a new external route and the maximum number of
2894    /// external routes has already been registered, this channel will
2895    /// be closed with the epitaph `ZX_ERR_NO_RESOURCES`.
2896    pub fn r#register_external_route(
2897        &self,
2898        mut external_route: &ExternalRoute,
2899    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2900        DeviceRouteProxyInterface::r#register_external_route(self, external_route)
2901    }
2902
2903    /// Unregisters any external route that was previously registered with
2904    /// `RegisterExternalRoute`. It returns once the external route has
2905    /// been removed locally.
2906    ///
2907    /// If the given external route was not previously registered,
2908    /// no action is taken.
2909    pub fn r#unregister_external_route(
2910        &self,
2911        mut subnet: &fidl_fuchsia_net::Ipv6AddressWithPrefix,
2912    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2913        DeviceRouteProxyInterface::r#unregister_external_route(self, subnet)
2914    }
2915}
2916
2917impl DeviceRouteProxyInterface for DeviceRouteProxy {
2918    type RegisterOnMeshPrefixResponseFut =
2919        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2920    fn r#register_on_mesh_prefix(
2921        &self,
2922        mut prefix: &OnMeshPrefix,
2923    ) -> Self::RegisterOnMeshPrefixResponseFut {
2924        fn _decode(
2925            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2926        ) -> Result<(), fidl::Error> {
2927            let _response = fidl::client::decode_transaction_body::<
2928                fidl::encoding::EmptyPayload,
2929                fidl::encoding::DefaultFuchsiaResourceDialect,
2930                0x2c4135231eb97f61,
2931            >(_buf?)?;
2932            Ok(_response)
2933        }
2934        self.client.send_query_and_decode::<DeviceRouteRegisterOnMeshPrefixRequest, ()>(
2935            (prefix,),
2936            0x2c4135231eb97f61,
2937            fidl::encoding::DynamicFlags::empty(),
2938            _decode,
2939        )
2940    }
2941
2942    type UnregisterOnMeshPrefixResponseFut =
2943        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2944    fn r#unregister_on_mesh_prefix(
2945        &self,
2946        mut subnet: &fidl_fuchsia_net::Ipv6AddressWithPrefix,
2947    ) -> Self::UnregisterOnMeshPrefixResponseFut {
2948        fn _decode(
2949            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2950        ) -> Result<(), fidl::Error> {
2951            let _response = fidl::client::decode_transaction_body::<
2952                fidl::encoding::EmptyPayload,
2953                fidl::encoding::DefaultFuchsiaResourceDialect,
2954                0x82d5184028b797f,
2955            >(_buf?)?;
2956            Ok(_response)
2957        }
2958        self.client.send_query_and_decode::<DeviceRouteUnregisterOnMeshPrefixRequest, ()>(
2959            (subnet,),
2960            0x82d5184028b797f,
2961            fidl::encoding::DynamicFlags::empty(),
2962            _decode,
2963        )
2964    }
2965
2966    type RegisterExternalRouteResponseFut =
2967        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2968    fn r#register_external_route(
2969        &self,
2970        mut external_route: &ExternalRoute,
2971    ) -> Self::RegisterExternalRouteResponseFut {
2972        fn _decode(
2973            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2974        ) -> Result<(), fidl::Error> {
2975            let _response = fidl::client::decode_transaction_body::<
2976                fidl::encoding::EmptyPayload,
2977                fidl::encoding::DefaultFuchsiaResourceDialect,
2978                0x75f70f0fc34a5a73,
2979            >(_buf?)?;
2980            Ok(_response)
2981        }
2982        self.client.send_query_and_decode::<DeviceRouteRegisterExternalRouteRequest, ()>(
2983            (external_route,),
2984            0x75f70f0fc34a5a73,
2985            fidl::encoding::DynamicFlags::empty(),
2986            _decode,
2987        )
2988    }
2989
2990    type UnregisterExternalRouteResponseFut =
2991        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2992    fn r#unregister_external_route(
2993        &self,
2994        mut subnet: &fidl_fuchsia_net::Ipv6AddressWithPrefix,
2995    ) -> Self::UnregisterExternalRouteResponseFut {
2996        fn _decode(
2997            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2998        ) -> Result<(), fidl::Error> {
2999            let _response = fidl::client::decode_transaction_body::<
3000                fidl::encoding::EmptyPayload,
3001                fidl::encoding::DefaultFuchsiaResourceDialect,
3002                0x3769be353b1d7088,
3003            >(_buf?)?;
3004            Ok(_response)
3005        }
3006        self.client.send_query_and_decode::<DeviceRouteUnregisterExternalRouteRequest, ()>(
3007            (subnet,),
3008            0x3769be353b1d7088,
3009            fidl::encoding::DynamicFlags::empty(),
3010            _decode,
3011        )
3012    }
3013}
3014
3015pub struct DeviceRouteEventStream {
3016    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3017}
3018
3019impl std::marker::Unpin for DeviceRouteEventStream {}
3020
3021impl futures::stream::FusedStream for DeviceRouteEventStream {
3022    fn is_terminated(&self) -> bool {
3023        self.event_receiver.is_terminated()
3024    }
3025}
3026
3027impl futures::Stream for DeviceRouteEventStream {
3028    type Item = Result<DeviceRouteEvent, fidl::Error>;
3029
3030    fn poll_next(
3031        mut self: std::pin::Pin<&mut Self>,
3032        cx: &mut std::task::Context<'_>,
3033    ) -> std::task::Poll<Option<Self::Item>> {
3034        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3035            &mut self.event_receiver,
3036            cx
3037        )?) {
3038            Some(buf) => std::task::Poll::Ready(Some(DeviceRouteEvent::decode(buf))),
3039            None => std::task::Poll::Ready(None),
3040        }
3041    }
3042}
3043
3044#[derive(Debug)]
3045pub enum DeviceRouteEvent {}
3046
3047impl DeviceRouteEvent {
3048    /// Decodes a message buffer as a [`DeviceRouteEvent`].
3049    fn decode(
3050        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3051    ) -> Result<DeviceRouteEvent, fidl::Error> {
3052        let (bytes, _handles) = buf.split_mut();
3053        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3054        debug_assert_eq!(tx_header.tx_id, 0);
3055        match tx_header.ordinal {
3056            _ => Err(fidl::Error::UnknownOrdinal {
3057                ordinal: tx_header.ordinal,
3058                protocol_name: <DeviceRouteMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3059            }),
3060        }
3061    }
3062}
3063
3064/// A Stream of incoming requests for fuchsia.lowpan.experimental/DeviceRoute.
3065pub struct DeviceRouteRequestStream {
3066    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3067    is_terminated: bool,
3068}
3069
3070impl std::marker::Unpin for DeviceRouteRequestStream {}
3071
3072impl futures::stream::FusedStream for DeviceRouteRequestStream {
3073    fn is_terminated(&self) -> bool {
3074        self.is_terminated
3075    }
3076}
3077
3078impl fidl::endpoints::RequestStream for DeviceRouteRequestStream {
3079    type Protocol = DeviceRouteMarker;
3080    type ControlHandle = DeviceRouteControlHandle;
3081
3082    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3083        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3084    }
3085
3086    fn control_handle(&self) -> Self::ControlHandle {
3087        DeviceRouteControlHandle { inner: self.inner.clone() }
3088    }
3089
3090    fn into_inner(
3091        self,
3092    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3093    {
3094        (self.inner, self.is_terminated)
3095    }
3096
3097    fn from_inner(
3098        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3099        is_terminated: bool,
3100    ) -> Self {
3101        Self { inner, is_terminated }
3102    }
3103}
3104
3105impl futures::Stream for DeviceRouteRequestStream {
3106    type Item = Result<DeviceRouteRequest, fidl::Error>;
3107
3108    fn poll_next(
3109        mut self: std::pin::Pin<&mut Self>,
3110        cx: &mut std::task::Context<'_>,
3111    ) -> std::task::Poll<Option<Self::Item>> {
3112        let this = &mut *self;
3113        if this.inner.check_shutdown(cx) {
3114            this.is_terminated = true;
3115            return std::task::Poll::Ready(None);
3116        }
3117        if this.is_terminated {
3118            panic!("polled DeviceRouteRequestStream after completion");
3119        }
3120        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3121            |bytes, handles| {
3122                match this.inner.channel().read_etc(cx, bytes, handles) {
3123                    std::task::Poll::Ready(Ok(())) => {}
3124                    std::task::Poll::Pending => return std::task::Poll::Pending,
3125                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3126                        this.is_terminated = true;
3127                        return std::task::Poll::Ready(None);
3128                    }
3129                    std::task::Poll::Ready(Err(e)) => {
3130                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3131                            e.into(),
3132                        ))));
3133                    }
3134                }
3135
3136                // A message has been received from the channel
3137                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3138
3139                std::task::Poll::Ready(Some(match header.ordinal {
3140                    0x2c4135231eb97f61 => {
3141                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3142                        let mut req = fidl::new_empty!(
3143                            DeviceRouteRegisterOnMeshPrefixRequest,
3144                            fidl::encoding::DefaultFuchsiaResourceDialect
3145                        );
3146                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceRouteRegisterOnMeshPrefixRequest>(&header, _body_bytes, handles, &mut req)?;
3147                        let control_handle = DeviceRouteControlHandle { inner: this.inner.clone() };
3148                        Ok(DeviceRouteRequest::RegisterOnMeshPrefix {
3149                            prefix: req.prefix,
3150
3151                            responder: DeviceRouteRegisterOnMeshPrefixResponder {
3152                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3153                                tx_id: header.tx_id,
3154                            },
3155                        })
3156                    }
3157                    0x82d5184028b797f => {
3158                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3159                        let mut req = fidl::new_empty!(
3160                            DeviceRouteUnregisterOnMeshPrefixRequest,
3161                            fidl::encoding::DefaultFuchsiaResourceDialect
3162                        );
3163                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceRouteUnregisterOnMeshPrefixRequest>(&header, _body_bytes, handles, &mut req)?;
3164                        let control_handle = DeviceRouteControlHandle { inner: this.inner.clone() };
3165                        Ok(DeviceRouteRequest::UnregisterOnMeshPrefix {
3166                            subnet: req.subnet,
3167
3168                            responder: DeviceRouteUnregisterOnMeshPrefixResponder {
3169                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3170                                tx_id: header.tx_id,
3171                            },
3172                        })
3173                    }
3174                    0x75f70f0fc34a5a73 => {
3175                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3176                        let mut req = fidl::new_empty!(
3177                            DeviceRouteRegisterExternalRouteRequest,
3178                            fidl::encoding::DefaultFuchsiaResourceDialect
3179                        );
3180                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceRouteRegisterExternalRouteRequest>(&header, _body_bytes, handles, &mut req)?;
3181                        let control_handle = DeviceRouteControlHandle { inner: this.inner.clone() };
3182                        Ok(DeviceRouteRequest::RegisterExternalRoute {
3183                            external_route: req.external_route,
3184
3185                            responder: DeviceRouteRegisterExternalRouteResponder {
3186                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3187                                tx_id: header.tx_id,
3188                            },
3189                        })
3190                    }
3191                    0x3769be353b1d7088 => {
3192                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3193                        let mut req = fidl::new_empty!(
3194                            DeviceRouteUnregisterExternalRouteRequest,
3195                            fidl::encoding::DefaultFuchsiaResourceDialect
3196                        );
3197                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceRouteUnregisterExternalRouteRequest>(&header, _body_bytes, handles, &mut req)?;
3198                        let control_handle = DeviceRouteControlHandle { inner: this.inner.clone() };
3199                        Ok(DeviceRouteRequest::UnregisterExternalRoute {
3200                            subnet: req.subnet,
3201
3202                            responder: DeviceRouteUnregisterExternalRouteResponder {
3203                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3204                                tx_id: header.tx_id,
3205                            },
3206                        })
3207                    }
3208                    _ => Err(fidl::Error::UnknownOrdinal {
3209                        ordinal: header.ordinal,
3210                        protocol_name:
3211                            <DeviceRouteMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3212                    }),
3213                }))
3214            },
3215        )
3216    }
3217}
3218
3219/// LoWPAN protocol for IPv6 route and prefix management methods that
3220/// do not expose PII.
3221///
3222/// Note that methods that deal with PII are located in the
3223/// `DeviceRouteExtra` protocol.
3224#[derive(Debug)]
3225pub enum DeviceRouteRequest {
3226    /// Registers an on-mesh prefix to be advertised on the
3227    /// current network.
3228    ///
3229    /// Subsequent calls with the same value for the `subnet` field will
3230    /// update the properties associated with that on-mesh prefix.
3231    ///
3232    /// These changes persist like adding an IP address would,
3233    /// and will stick around until explicitly removed or
3234    /// the interface component is reset/restarted.
3235    ///
3236    /// If the given `OnMeshPrefix` structure is invalid for some reason
3237    /// (missing required fields, invalid values, etc), the channel will be
3238    /// closed with the epitaph `ZX_ERR_INVALID_ARGS`.
3239    ///
3240    /// If registering a new on-mesh prefix and the maximum number of
3241    /// on-mesh prefixes has already been registered, this channel will
3242    /// be closed with the epitaph `ZX_ERR_NO_RESOURCES`.
3243    RegisterOnMeshPrefix {
3244        prefix: OnMeshPrefix,
3245        responder: DeviceRouteRegisterOnMeshPrefixResponder,
3246    },
3247    /// Unregisters any on-mesh prefix that was previously registered with
3248    /// `RegisterOnMeshPrefix`.  It returns once the on-mesh prefix has
3249    /// been removed locally.
3250    ///
3251    /// If the given mesh prefix was not previously registered,
3252    /// no action is taken.
3253    UnregisterOnMeshPrefix {
3254        subnet: fidl_fuchsia_net::Ipv6AddressWithPrefix,
3255        responder: DeviceRouteUnregisterOnMeshPrefixResponder,
3256    },
3257    /// Registers an external route to be advertised on the
3258    /// current network.
3259    ///
3260    /// Subsequent calls with the same value for the `subnet` field will
3261    /// update the properties associated with that route.
3262    ///
3263    /// These changes persist like adding an IP address would,
3264    /// and will stick around until explicitly removed or
3265    /// the interface component is reset/restarted.
3266    ///
3267    /// If the given `ExternalRoute` structure is invalid for some reason
3268    /// (missing required fields, invalid values, etc), the channel will be
3269    /// closed with the epitaph `ZX_ERR_INVALID_ARGUMENT`.
3270    ///
3271    /// If registering a new external route and the maximum number of
3272    /// external routes has already been registered, this channel will
3273    /// be closed with the epitaph `ZX_ERR_NO_RESOURCES`.
3274    RegisterExternalRoute {
3275        external_route: ExternalRoute,
3276        responder: DeviceRouteRegisterExternalRouteResponder,
3277    },
3278    /// Unregisters any external route that was previously registered with
3279    /// `RegisterExternalRoute`. It returns once the external route has
3280    /// been removed locally.
3281    ///
3282    /// If the given external route was not previously registered,
3283    /// no action is taken.
3284    UnregisterExternalRoute {
3285        subnet: fidl_fuchsia_net::Ipv6AddressWithPrefix,
3286        responder: DeviceRouteUnregisterExternalRouteResponder,
3287    },
3288}
3289
3290impl DeviceRouteRequest {
3291    #[allow(irrefutable_let_patterns)]
3292    pub fn into_register_on_mesh_prefix(
3293        self,
3294    ) -> Option<(OnMeshPrefix, DeviceRouteRegisterOnMeshPrefixResponder)> {
3295        if let DeviceRouteRequest::RegisterOnMeshPrefix { prefix, responder } = self {
3296            Some((prefix, responder))
3297        } else {
3298            None
3299        }
3300    }
3301
3302    #[allow(irrefutable_let_patterns)]
3303    pub fn into_unregister_on_mesh_prefix(
3304        self,
3305    ) -> Option<(fidl_fuchsia_net::Ipv6AddressWithPrefix, DeviceRouteUnregisterOnMeshPrefixResponder)>
3306    {
3307        if let DeviceRouteRequest::UnregisterOnMeshPrefix { subnet, responder } = self {
3308            Some((subnet, responder))
3309        } else {
3310            None
3311        }
3312    }
3313
3314    #[allow(irrefutable_let_patterns)]
3315    pub fn into_register_external_route(
3316        self,
3317    ) -> Option<(ExternalRoute, DeviceRouteRegisterExternalRouteResponder)> {
3318        if let DeviceRouteRequest::RegisterExternalRoute { external_route, responder } = self {
3319            Some((external_route, responder))
3320        } else {
3321            None
3322        }
3323    }
3324
3325    #[allow(irrefutable_let_patterns)]
3326    pub fn into_unregister_external_route(
3327        self,
3328    ) -> Option<(
3329        fidl_fuchsia_net::Ipv6AddressWithPrefix,
3330        DeviceRouteUnregisterExternalRouteResponder,
3331    )> {
3332        if let DeviceRouteRequest::UnregisterExternalRoute { subnet, responder } = self {
3333            Some((subnet, responder))
3334        } else {
3335            None
3336        }
3337    }
3338
3339    /// Name of the method defined in FIDL
3340    pub fn method_name(&self) -> &'static str {
3341        match *self {
3342            DeviceRouteRequest::RegisterOnMeshPrefix { .. } => "register_on_mesh_prefix",
3343            DeviceRouteRequest::UnregisterOnMeshPrefix { .. } => "unregister_on_mesh_prefix",
3344            DeviceRouteRequest::RegisterExternalRoute { .. } => "register_external_route",
3345            DeviceRouteRequest::UnregisterExternalRoute { .. } => "unregister_external_route",
3346        }
3347    }
3348}
3349
3350#[derive(Debug, Clone)]
3351pub struct DeviceRouteControlHandle {
3352    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3353}
3354
3355impl fidl::endpoints::ControlHandle for DeviceRouteControlHandle {
3356    fn shutdown(&self) {
3357        self.inner.shutdown()
3358    }
3359
3360    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3361        self.inner.shutdown_with_epitaph(status)
3362    }
3363
3364    fn is_closed(&self) -> bool {
3365        self.inner.channel().is_closed()
3366    }
3367    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3368        self.inner.channel().on_closed()
3369    }
3370
3371    #[cfg(target_os = "fuchsia")]
3372    fn signal_peer(
3373        &self,
3374        clear_mask: zx::Signals,
3375        set_mask: zx::Signals,
3376    ) -> Result<(), zx_status::Status> {
3377        use fidl::Peered;
3378        self.inner.channel().signal_peer(clear_mask, set_mask)
3379    }
3380}
3381
3382impl DeviceRouteControlHandle {}
3383
3384#[must_use = "FIDL methods require a response to be sent"]
3385#[derive(Debug)]
3386pub struct DeviceRouteRegisterOnMeshPrefixResponder {
3387    control_handle: std::mem::ManuallyDrop<DeviceRouteControlHandle>,
3388    tx_id: u32,
3389}
3390
3391/// Set the the channel to be shutdown (see [`DeviceRouteControlHandle::shutdown`])
3392/// if the responder is dropped without sending a response, so that the client
3393/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3394impl std::ops::Drop for DeviceRouteRegisterOnMeshPrefixResponder {
3395    fn drop(&mut self) {
3396        self.control_handle.shutdown();
3397        // Safety: drops once, never accessed again
3398        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3399    }
3400}
3401
3402impl fidl::endpoints::Responder for DeviceRouteRegisterOnMeshPrefixResponder {
3403    type ControlHandle = DeviceRouteControlHandle;
3404
3405    fn control_handle(&self) -> &DeviceRouteControlHandle {
3406        &self.control_handle
3407    }
3408
3409    fn drop_without_shutdown(mut self) {
3410        // Safety: drops once, never accessed again due to mem::forget
3411        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3412        // Prevent Drop from running (which would shut down the channel)
3413        std::mem::forget(self);
3414    }
3415}
3416
3417impl DeviceRouteRegisterOnMeshPrefixResponder {
3418    /// Sends a response to the FIDL transaction.
3419    ///
3420    /// Sets the channel to shutdown if an error occurs.
3421    pub fn send(self) -> Result<(), fidl::Error> {
3422        let _result = self.send_raw();
3423        if _result.is_err() {
3424            self.control_handle.shutdown();
3425        }
3426        self.drop_without_shutdown();
3427        _result
3428    }
3429
3430    /// Similar to "send" but does not shutdown the channel if an error occurs.
3431    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3432        let _result = self.send_raw();
3433        self.drop_without_shutdown();
3434        _result
3435    }
3436
3437    fn send_raw(&self) -> Result<(), fidl::Error> {
3438        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
3439            (),
3440            self.tx_id,
3441            0x2c4135231eb97f61,
3442            fidl::encoding::DynamicFlags::empty(),
3443        )
3444    }
3445}
3446
3447#[must_use = "FIDL methods require a response to be sent"]
3448#[derive(Debug)]
3449pub struct DeviceRouteUnregisterOnMeshPrefixResponder {
3450    control_handle: std::mem::ManuallyDrop<DeviceRouteControlHandle>,
3451    tx_id: u32,
3452}
3453
3454/// Set the the channel to be shutdown (see [`DeviceRouteControlHandle::shutdown`])
3455/// if the responder is dropped without sending a response, so that the client
3456/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3457impl std::ops::Drop for DeviceRouteUnregisterOnMeshPrefixResponder {
3458    fn drop(&mut self) {
3459        self.control_handle.shutdown();
3460        // Safety: drops once, never accessed again
3461        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3462    }
3463}
3464
3465impl fidl::endpoints::Responder for DeviceRouteUnregisterOnMeshPrefixResponder {
3466    type ControlHandle = DeviceRouteControlHandle;
3467
3468    fn control_handle(&self) -> &DeviceRouteControlHandle {
3469        &self.control_handle
3470    }
3471
3472    fn drop_without_shutdown(mut self) {
3473        // Safety: drops once, never accessed again due to mem::forget
3474        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3475        // Prevent Drop from running (which would shut down the channel)
3476        std::mem::forget(self);
3477    }
3478}
3479
3480impl DeviceRouteUnregisterOnMeshPrefixResponder {
3481    /// Sends a response to the FIDL transaction.
3482    ///
3483    /// Sets the channel to shutdown if an error occurs.
3484    pub fn send(self) -> Result<(), fidl::Error> {
3485        let _result = self.send_raw();
3486        if _result.is_err() {
3487            self.control_handle.shutdown();
3488        }
3489        self.drop_without_shutdown();
3490        _result
3491    }
3492
3493    /// Similar to "send" but does not shutdown the channel if an error occurs.
3494    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3495        let _result = self.send_raw();
3496        self.drop_without_shutdown();
3497        _result
3498    }
3499
3500    fn send_raw(&self) -> Result<(), fidl::Error> {
3501        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
3502            (),
3503            self.tx_id,
3504            0x82d5184028b797f,
3505            fidl::encoding::DynamicFlags::empty(),
3506        )
3507    }
3508}
3509
3510#[must_use = "FIDL methods require a response to be sent"]
3511#[derive(Debug)]
3512pub struct DeviceRouteRegisterExternalRouteResponder {
3513    control_handle: std::mem::ManuallyDrop<DeviceRouteControlHandle>,
3514    tx_id: u32,
3515}
3516
3517/// Set the the channel to be shutdown (see [`DeviceRouteControlHandle::shutdown`])
3518/// if the responder is dropped without sending a response, so that the client
3519/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3520impl std::ops::Drop for DeviceRouteRegisterExternalRouteResponder {
3521    fn drop(&mut self) {
3522        self.control_handle.shutdown();
3523        // Safety: drops once, never accessed again
3524        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3525    }
3526}
3527
3528impl fidl::endpoints::Responder for DeviceRouteRegisterExternalRouteResponder {
3529    type ControlHandle = DeviceRouteControlHandle;
3530
3531    fn control_handle(&self) -> &DeviceRouteControlHandle {
3532        &self.control_handle
3533    }
3534
3535    fn drop_without_shutdown(mut self) {
3536        // Safety: drops once, never accessed again due to mem::forget
3537        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3538        // Prevent Drop from running (which would shut down the channel)
3539        std::mem::forget(self);
3540    }
3541}
3542
3543impl DeviceRouteRegisterExternalRouteResponder {
3544    /// Sends a response to the FIDL transaction.
3545    ///
3546    /// Sets the channel to shutdown if an error occurs.
3547    pub fn send(self) -> Result<(), fidl::Error> {
3548        let _result = self.send_raw();
3549        if _result.is_err() {
3550            self.control_handle.shutdown();
3551        }
3552        self.drop_without_shutdown();
3553        _result
3554    }
3555
3556    /// Similar to "send" but does not shutdown the channel if an error occurs.
3557    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3558        let _result = self.send_raw();
3559        self.drop_without_shutdown();
3560        _result
3561    }
3562
3563    fn send_raw(&self) -> Result<(), fidl::Error> {
3564        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
3565            (),
3566            self.tx_id,
3567            0x75f70f0fc34a5a73,
3568            fidl::encoding::DynamicFlags::empty(),
3569        )
3570    }
3571}
3572
3573#[must_use = "FIDL methods require a response to be sent"]
3574#[derive(Debug)]
3575pub struct DeviceRouteUnregisterExternalRouteResponder {
3576    control_handle: std::mem::ManuallyDrop<DeviceRouteControlHandle>,
3577    tx_id: u32,
3578}
3579
3580/// Set the the channel to be shutdown (see [`DeviceRouteControlHandle::shutdown`])
3581/// if the responder is dropped without sending a response, so that the client
3582/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3583impl std::ops::Drop for DeviceRouteUnregisterExternalRouteResponder {
3584    fn drop(&mut self) {
3585        self.control_handle.shutdown();
3586        // Safety: drops once, never accessed again
3587        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3588    }
3589}
3590
3591impl fidl::endpoints::Responder for DeviceRouteUnregisterExternalRouteResponder {
3592    type ControlHandle = DeviceRouteControlHandle;
3593
3594    fn control_handle(&self) -> &DeviceRouteControlHandle {
3595        &self.control_handle
3596    }
3597
3598    fn drop_without_shutdown(mut self) {
3599        // Safety: drops once, never accessed again due to mem::forget
3600        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3601        // Prevent Drop from running (which would shut down the channel)
3602        std::mem::forget(self);
3603    }
3604}
3605
3606impl DeviceRouteUnregisterExternalRouteResponder {
3607    /// Sends a response to the FIDL transaction.
3608    ///
3609    /// Sets the channel to shutdown if an error occurs.
3610    pub fn send(self) -> Result<(), fidl::Error> {
3611        let _result = self.send_raw();
3612        if _result.is_err() {
3613            self.control_handle.shutdown();
3614        }
3615        self.drop_without_shutdown();
3616        _result
3617    }
3618
3619    /// Similar to "send" but does not shutdown the channel if an error occurs.
3620    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3621        let _result = self.send_raw();
3622        self.drop_without_shutdown();
3623        _result
3624    }
3625
3626    fn send_raw(&self) -> Result<(), fidl::Error> {
3627        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
3628            (),
3629            self.tx_id,
3630            0x3769be353b1d7088,
3631            fidl::encoding::DynamicFlags::empty(),
3632        )
3633    }
3634}
3635
3636#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3637pub struct DeviceRouteConnectorMarker;
3638
3639impl fidl::endpoints::ProtocolMarker for DeviceRouteConnectorMarker {
3640    type Proxy = DeviceRouteConnectorProxy;
3641    type RequestStream = DeviceRouteConnectorRequestStream;
3642    #[cfg(target_os = "fuchsia")]
3643    type SynchronousProxy = DeviceRouteConnectorSynchronousProxy;
3644
3645    const DEBUG_NAME: &'static str = "fuchsia.lowpan.experimental.DeviceRouteConnector";
3646}
3647impl fidl::endpoints::DiscoverableProtocolMarker for DeviceRouteConnectorMarker {}
3648
3649pub trait DeviceRouteConnectorProxyInterface: Send + Sync {
3650    fn r#connect(
3651        &self,
3652        name: &str,
3653        server_end: fidl::endpoints::ServerEnd<DeviceRouteMarker>,
3654    ) -> Result<(), fidl::Error>;
3655}
3656#[derive(Debug)]
3657#[cfg(target_os = "fuchsia")]
3658pub struct DeviceRouteConnectorSynchronousProxy {
3659    client: fidl::client::sync::Client,
3660}
3661
3662#[cfg(target_os = "fuchsia")]
3663impl fidl::endpoints::SynchronousProxy for DeviceRouteConnectorSynchronousProxy {
3664    type Proxy = DeviceRouteConnectorProxy;
3665    type Protocol = DeviceRouteConnectorMarker;
3666
3667    fn from_channel(inner: fidl::Channel) -> Self {
3668        Self::new(inner)
3669    }
3670
3671    fn into_channel(self) -> fidl::Channel {
3672        self.client.into_channel()
3673    }
3674
3675    fn as_channel(&self) -> &fidl::Channel {
3676        self.client.as_channel()
3677    }
3678}
3679
3680#[cfg(target_os = "fuchsia")]
3681impl DeviceRouteConnectorSynchronousProxy {
3682    pub fn new(channel: fidl::Channel) -> Self {
3683        Self { client: fidl::client::sync::Client::new(channel) }
3684    }
3685
3686    pub fn into_channel(self) -> fidl::Channel {
3687        self.client.into_channel()
3688    }
3689
3690    /// Waits until an event arrives and returns it. It is safe for other
3691    /// threads to make concurrent requests while waiting for an event.
3692    pub fn wait_for_event(
3693        &self,
3694        deadline: zx::MonotonicInstant,
3695    ) -> Result<DeviceRouteConnectorEvent, fidl::Error> {
3696        DeviceRouteConnectorEvent::decode(
3697            self.client.wait_for_event::<DeviceRouteConnectorMarker>(deadline)?,
3698        )
3699    }
3700
3701    /// Connects to the `fuchsia.lowpan.device.DeviceRoute` protocol on the
3702    /// named LoWPAN interface.
3703    ///
3704    /// The name of the interface can be learned by calling
3705    /// `fuchsia.lowpan.Lookup.GetDevices()`.
3706    ///
3707    /// If there is an error in processing this request
3708    /// the given channel is closed and an epitaph code used
3709    /// to describe the reason for the failure:
3710    ///
3711    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
3712    ///   was not formatted correctly or otherwise invalid.
3713    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
3714    ///   given name.
3715    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
3716    ///   does not support this protocol.
3717    pub fn r#connect(
3718        &self,
3719        mut name: &str,
3720        mut server_end: fidl::endpoints::ServerEnd<DeviceRouteMarker>,
3721    ) -> Result<(), fidl::Error> {
3722        self.client.send::<DeviceRouteConnectorConnectRequest>(
3723            (name, server_end),
3724            0x19cd5fdcb971f4ac,
3725            fidl::encoding::DynamicFlags::empty(),
3726        )
3727    }
3728}
3729
3730#[cfg(target_os = "fuchsia")]
3731impl From<DeviceRouteConnectorSynchronousProxy> for zx::NullableHandle {
3732    fn from(value: DeviceRouteConnectorSynchronousProxy) -> Self {
3733        value.into_channel().into()
3734    }
3735}
3736
3737#[cfg(target_os = "fuchsia")]
3738impl From<fidl::Channel> for DeviceRouteConnectorSynchronousProxy {
3739    fn from(value: fidl::Channel) -> Self {
3740        Self::new(value)
3741    }
3742}
3743
3744#[cfg(target_os = "fuchsia")]
3745impl fidl::endpoints::FromClient for DeviceRouteConnectorSynchronousProxy {
3746    type Protocol = DeviceRouteConnectorMarker;
3747
3748    fn from_client(value: fidl::endpoints::ClientEnd<DeviceRouteConnectorMarker>) -> Self {
3749        Self::new(value.into_channel())
3750    }
3751}
3752
3753#[derive(Debug, Clone)]
3754pub struct DeviceRouteConnectorProxy {
3755    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3756}
3757
3758impl fidl::endpoints::Proxy for DeviceRouteConnectorProxy {
3759    type Protocol = DeviceRouteConnectorMarker;
3760
3761    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3762        Self::new(inner)
3763    }
3764
3765    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3766        self.client.into_channel().map_err(|client| Self { client })
3767    }
3768
3769    fn as_channel(&self) -> &::fidl::AsyncChannel {
3770        self.client.as_channel()
3771    }
3772}
3773
3774impl DeviceRouteConnectorProxy {
3775    /// Create a new Proxy for fuchsia.lowpan.experimental/DeviceRouteConnector.
3776    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3777        let protocol_name =
3778            <DeviceRouteConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3779        Self { client: fidl::client::Client::new(channel, protocol_name) }
3780    }
3781
3782    /// Get a Stream of events from the remote end of the protocol.
3783    ///
3784    /// # Panics
3785    ///
3786    /// Panics if the event stream was already taken.
3787    pub fn take_event_stream(&self) -> DeviceRouteConnectorEventStream {
3788        DeviceRouteConnectorEventStream { event_receiver: self.client.take_event_receiver() }
3789    }
3790
3791    /// Connects to the `fuchsia.lowpan.device.DeviceRoute` protocol on the
3792    /// named LoWPAN interface.
3793    ///
3794    /// The name of the interface can be learned by calling
3795    /// `fuchsia.lowpan.Lookup.GetDevices()`.
3796    ///
3797    /// If there is an error in processing this request
3798    /// the given channel is closed and an epitaph code used
3799    /// to describe the reason for the failure:
3800    ///
3801    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
3802    ///   was not formatted correctly or otherwise invalid.
3803    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
3804    ///   given name.
3805    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
3806    ///   does not support this protocol.
3807    pub fn r#connect(
3808        &self,
3809        mut name: &str,
3810        mut server_end: fidl::endpoints::ServerEnd<DeviceRouteMarker>,
3811    ) -> Result<(), fidl::Error> {
3812        DeviceRouteConnectorProxyInterface::r#connect(self, name, server_end)
3813    }
3814}
3815
3816impl DeviceRouteConnectorProxyInterface for DeviceRouteConnectorProxy {
3817    fn r#connect(
3818        &self,
3819        mut name: &str,
3820        mut server_end: fidl::endpoints::ServerEnd<DeviceRouteMarker>,
3821    ) -> Result<(), fidl::Error> {
3822        self.client.send::<DeviceRouteConnectorConnectRequest>(
3823            (name, server_end),
3824            0x19cd5fdcb971f4ac,
3825            fidl::encoding::DynamicFlags::empty(),
3826        )
3827    }
3828}
3829
3830pub struct DeviceRouteConnectorEventStream {
3831    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3832}
3833
3834impl std::marker::Unpin for DeviceRouteConnectorEventStream {}
3835
3836impl futures::stream::FusedStream for DeviceRouteConnectorEventStream {
3837    fn is_terminated(&self) -> bool {
3838        self.event_receiver.is_terminated()
3839    }
3840}
3841
3842impl futures::Stream for DeviceRouteConnectorEventStream {
3843    type Item = Result<DeviceRouteConnectorEvent, fidl::Error>;
3844
3845    fn poll_next(
3846        mut self: std::pin::Pin<&mut Self>,
3847        cx: &mut std::task::Context<'_>,
3848    ) -> std::task::Poll<Option<Self::Item>> {
3849        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3850            &mut self.event_receiver,
3851            cx
3852        )?) {
3853            Some(buf) => std::task::Poll::Ready(Some(DeviceRouteConnectorEvent::decode(buf))),
3854            None => std::task::Poll::Ready(None),
3855        }
3856    }
3857}
3858
3859#[derive(Debug)]
3860pub enum DeviceRouteConnectorEvent {}
3861
3862impl DeviceRouteConnectorEvent {
3863    /// Decodes a message buffer as a [`DeviceRouteConnectorEvent`].
3864    fn decode(
3865        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3866    ) -> Result<DeviceRouteConnectorEvent, fidl::Error> {
3867        let (bytes, _handles) = buf.split_mut();
3868        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3869        debug_assert_eq!(tx_header.tx_id, 0);
3870        match tx_header.ordinal {
3871            _ => Err(fidl::Error::UnknownOrdinal {
3872                ordinal: tx_header.ordinal,
3873                protocol_name:
3874                    <DeviceRouteConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3875            }),
3876        }
3877    }
3878}
3879
3880/// A Stream of incoming requests for fuchsia.lowpan.experimental/DeviceRouteConnector.
3881pub struct DeviceRouteConnectorRequestStream {
3882    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3883    is_terminated: bool,
3884}
3885
3886impl std::marker::Unpin for DeviceRouteConnectorRequestStream {}
3887
3888impl futures::stream::FusedStream for DeviceRouteConnectorRequestStream {
3889    fn is_terminated(&self) -> bool {
3890        self.is_terminated
3891    }
3892}
3893
3894impl fidl::endpoints::RequestStream for DeviceRouteConnectorRequestStream {
3895    type Protocol = DeviceRouteConnectorMarker;
3896    type ControlHandle = DeviceRouteConnectorControlHandle;
3897
3898    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3899        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3900    }
3901
3902    fn control_handle(&self) -> Self::ControlHandle {
3903        DeviceRouteConnectorControlHandle { inner: self.inner.clone() }
3904    }
3905
3906    fn into_inner(
3907        self,
3908    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3909    {
3910        (self.inner, self.is_terminated)
3911    }
3912
3913    fn from_inner(
3914        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3915        is_terminated: bool,
3916    ) -> Self {
3917        Self { inner, is_terminated }
3918    }
3919}
3920
3921impl futures::Stream for DeviceRouteConnectorRequestStream {
3922    type Item = Result<DeviceRouteConnectorRequest, fidl::Error>;
3923
3924    fn poll_next(
3925        mut self: std::pin::Pin<&mut Self>,
3926        cx: &mut std::task::Context<'_>,
3927    ) -> std::task::Poll<Option<Self::Item>> {
3928        let this = &mut *self;
3929        if this.inner.check_shutdown(cx) {
3930            this.is_terminated = true;
3931            return std::task::Poll::Ready(None);
3932        }
3933        if this.is_terminated {
3934            panic!("polled DeviceRouteConnectorRequestStream after completion");
3935        }
3936        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3937            |bytes, handles| {
3938                match this.inner.channel().read_etc(cx, bytes, handles) {
3939                    std::task::Poll::Ready(Ok(())) => {}
3940                    std::task::Poll::Pending => return std::task::Poll::Pending,
3941                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3942                        this.is_terminated = true;
3943                        return std::task::Poll::Ready(None);
3944                    }
3945                    std::task::Poll::Ready(Err(e)) => {
3946                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3947                            e.into(),
3948                        ))));
3949                    }
3950                }
3951
3952                // A message has been received from the channel
3953                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3954
3955                std::task::Poll::Ready(Some(match header.ordinal {
3956                0x19cd5fdcb971f4ac => {
3957                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3958                    let mut req = fidl::new_empty!(DeviceRouteConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
3959                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceRouteConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
3960                    let control_handle = DeviceRouteConnectorControlHandle {
3961                        inner: this.inner.clone(),
3962                    };
3963                    Ok(DeviceRouteConnectorRequest::Connect {name: req.name,
3964server_end: req.server_end,
3965
3966                        control_handle,
3967                    })
3968                }
3969                _ => Err(fidl::Error::UnknownOrdinal {
3970                    ordinal: header.ordinal,
3971                    protocol_name: <DeviceRouteConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3972                }),
3973            }))
3974            },
3975        )
3976    }
3977}
3978
3979/// Protocol for connecting to `fuchsia.lowpan.device.DeviceRoute` on a LoWPAN
3980/// interface.
3981#[derive(Debug)]
3982pub enum DeviceRouteConnectorRequest {
3983    /// Connects to the `fuchsia.lowpan.device.DeviceRoute` protocol on the
3984    /// named LoWPAN interface.
3985    ///
3986    /// The name of the interface can be learned by calling
3987    /// `fuchsia.lowpan.Lookup.GetDevices()`.
3988    ///
3989    /// If there is an error in processing this request
3990    /// the given channel is closed and an epitaph code used
3991    /// to describe the reason for the failure:
3992    ///
3993    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
3994    ///   was not formatted correctly or otherwise invalid.
3995    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
3996    ///   given name.
3997    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
3998    ///   does not support this protocol.
3999    Connect {
4000        name: String,
4001        server_end: fidl::endpoints::ServerEnd<DeviceRouteMarker>,
4002        control_handle: DeviceRouteConnectorControlHandle,
4003    },
4004}
4005
4006impl DeviceRouteConnectorRequest {
4007    #[allow(irrefutable_let_patterns)]
4008    pub fn into_connect(
4009        self,
4010    ) -> Option<(
4011        String,
4012        fidl::endpoints::ServerEnd<DeviceRouteMarker>,
4013        DeviceRouteConnectorControlHandle,
4014    )> {
4015        if let DeviceRouteConnectorRequest::Connect { name, server_end, control_handle } = self {
4016            Some((name, server_end, control_handle))
4017        } else {
4018            None
4019        }
4020    }
4021
4022    /// Name of the method defined in FIDL
4023    pub fn method_name(&self) -> &'static str {
4024        match *self {
4025            DeviceRouteConnectorRequest::Connect { .. } => "connect",
4026        }
4027    }
4028}
4029
4030#[derive(Debug, Clone)]
4031pub struct DeviceRouteConnectorControlHandle {
4032    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4033}
4034
4035impl fidl::endpoints::ControlHandle for DeviceRouteConnectorControlHandle {
4036    fn shutdown(&self) {
4037        self.inner.shutdown()
4038    }
4039
4040    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4041        self.inner.shutdown_with_epitaph(status)
4042    }
4043
4044    fn is_closed(&self) -> bool {
4045        self.inner.channel().is_closed()
4046    }
4047    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4048        self.inner.channel().on_closed()
4049    }
4050
4051    #[cfg(target_os = "fuchsia")]
4052    fn signal_peer(
4053        &self,
4054        clear_mask: zx::Signals,
4055        set_mask: zx::Signals,
4056    ) -> Result<(), zx_status::Status> {
4057        use fidl::Peered;
4058        self.inner.channel().signal_peer(clear_mask, set_mask)
4059    }
4060}
4061
4062impl DeviceRouteConnectorControlHandle {}
4063
4064#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4065pub struct DeviceRouteExtraMarker;
4066
4067impl fidl::endpoints::ProtocolMarker for DeviceRouteExtraMarker {
4068    type Proxy = DeviceRouteExtraProxy;
4069    type RequestStream = DeviceRouteExtraRequestStream;
4070    #[cfg(target_os = "fuchsia")]
4071    type SynchronousProxy = DeviceRouteExtraSynchronousProxy;
4072
4073    const DEBUG_NAME: &'static str = "(anonymous) DeviceRouteExtra";
4074}
4075
4076pub trait DeviceRouteExtraProxyInterface: Send + Sync {
4077    type GetLocalOnMeshPrefixesResponseFut: std::future::Future<Output = Result<Vec<OnMeshPrefix>, fidl::Error>>
4078        + Send;
4079    fn r#get_local_on_mesh_prefixes(&self) -> Self::GetLocalOnMeshPrefixesResponseFut;
4080    type GetLocalExternalRoutesResponseFut: std::future::Future<Output = Result<Vec<ExternalRoute>, fidl::Error>>
4081        + Send;
4082    fn r#get_local_external_routes(&self) -> Self::GetLocalExternalRoutesResponseFut;
4083}
4084#[derive(Debug)]
4085#[cfg(target_os = "fuchsia")]
4086pub struct DeviceRouteExtraSynchronousProxy {
4087    client: fidl::client::sync::Client,
4088}
4089
4090#[cfg(target_os = "fuchsia")]
4091impl fidl::endpoints::SynchronousProxy for DeviceRouteExtraSynchronousProxy {
4092    type Proxy = DeviceRouteExtraProxy;
4093    type Protocol = DeviceRouteExtraMarker;
4094
4095    fn from_channel(inner: fidl::Channel) -> Self {
4096        Self::new(inner)
4097    }
4098
4099    fn into_channel(self) -> fidl::Channel {
4100        self.client.into_channel()
4101    }
4102
4103    fn as_channel(&self) -> &fidl::Channel {
4104        self.client.as_channel()
4105    }
4106}
4107
4108#[cfg(target_os = "fuchsia")]
4109impl DeviceRouteExtraSynchronousProxy {
4110    pub fn new(channel: fidl::Channel) -> Self {
4111        Self { client: fidl::client::sync::Client::new(channel) }
4112    }
4113
4114    pub fn into_channel(self) -> fidl::Channel {
4115        self.client.into_channel()
4116    }
4117
4118    /// Waits until an event arrives and returns it. It is safe for other
4119    /// threads to make concurrent requests while waiting for an event.
4120    pub fn wait_for_event(
4121        &self,
4122        deadline: zx::MonotonicInstant,
4123    ) -> Result<DeviceRouteExtraEvent, fidl::Error> {
4124        DeviceRouteExtraEvent::decode(
4125            self.client.wait_for_event::<DeviceRouteExtraMarker>(deadline)?,
4126        )
4127    }
4128
4129    /// Returns a vector containing all of the locally-added on-mesh prefixes.
4130    ///
4131    /// Locally-added on-mesh prefixes are those that have been registered
4132    /// with a prior call to [`DeviceRoute.RegisterOnMeshPrefix`].
4133    pub fn r#get_local_on_mesh_prefixes(
4134        &self,
4135        ___deadline: zx::MonotonicInstant,
4136    ) -> Result<Vec<OnMeshPrefix>, fidl::Error> {
4137        let _response = self.client.send_query::<
4138            fidl::encoding::EmptyPayload,
4139            DeviceRouteExtraGetLocalOnMeshPrefixesResponse,
4140            DeviceRouteExtraMarker,
4141        >(
4142            (),
4143            0xf192c43311c811,
4144            fidl::encoding::DynamicFlags::empty(),
4145            ___deadline,
4146        )?;
4147        Ok(_response.prefixes)
4148    }
4149
4150    /// Returns a vector containing all of the locally-added external routes.
4151    ///
4152    /// Locally-added external routes are those that have been registered
4153    /// with a prior call to [`DeviceRoute.RegisterExternalRoute`].
4154    pub fn r#get_local_external_routes(
4155        &self,
4156        ___deadline: zx::MonotonicInstant,
4157    ) -> Result<Vec<ExternalRoute>, fidl::Error> {
4158        let _response = self.client.send_query::<
4159            fidl::encoding::EmptyPayload,
4160            DeviceRouteExtraGetLocalExternalRoutesResponse,
4161            DeviceRouteExtraMarker,
4162        >(
4163            (),
4164            0x5a688c2e62c766a6,
4165            fidl::encoding::DynamicFlags::empty(),
4166            ___deadline,
4167        )?;
4168        Ok(_response.external_routes)
4169    }
4170}
4171
4172#[cfg(target_os = "fuchsia")]
4173impl From<DeviceRouteExtraSynchronousProxy> for zx::NullableHandle {
4174    fn from(value: DeviceRouteExtraSynchronousProxy) -> Self {
4175        value.into_channel().into()
4176    }
4177}
4178
4179#[cfg(target_os = "fuchsia")]
4180impl From<fidl::Channel> for DeviceRouteExtraSynchronousProxy {
4181    fn from(value: fidl::Channel) -> Self {
4182        Self::new(value)
4183    }
4184}
4185
4186#[cfg(target_os = "fuchsia")]
4187impl fidl::endpoints::FromClient for DeviceRouteExtraSynchronousProxy {
4188    type Protocol = DeviceRouteExtraMarker;
4189
4190    fn from_client(value: fidl::endpoints::ClientEnd<DeviceRouteExtraMarker>) -> Self {
4191        Self::new(value.into_channel())
4192    }
4193}
4194
4195#[derive(Debug, Clone)]
4196pub struct DeviceRouteExtraProxy {
4197    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4198}
4199
4200impl fidl::endpoints::Proxy for DeviceRouteExtraProxy {
4201    type Protocol = DeviceRouteExtraMarker;
4202
4203    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4204        Self::new(inner)
4205    }
4206
4207    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4208        self.client.into_channel().map_err(|client| Self { client })
4209    }
4210
4211    fn as_channel(&self) -> &::fidl::AsyncChannel {
4212        self.client.as_channel()
4213    }
4214}
4215
4216impl DeviceRouteExtraProxy {
4217    /// Create a new Proxy for fuchsia.lowpan.experimental/DeviceRouteExtra.
4218    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4219        let protocol_name = <DeviceRouteExtraMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4220        Self { client: fidl::client::Client::new(channel, protocol_name) }
4221    }
4222
4223    /// Get a Stream of events from the remote end of the protocol.
4224    ///
4225    /// # Panics
4226    ///
4227    /// Panics if the event stream was already taken.
4228    pub fn take_event_stream(&self) -> DeviceRouteExtraEventStream {
4229        DeviceRouteExtraEventStream { event_receiver: self.client.take_event_receiver() }
4230    }
4231
4232    /// Returns a vector containing all of the locally-added on-mesh prefixes.
4233    ///
4234    /// Locally-added on-mesh prefixes are those that have been registered
4235    /// with a prior call to [`DeviceRoute.RegisterOnMeshPrefix`].
4236    pub fn r#get_local_on_mesh_prefixes(
4237        &self,
4238    ) -> fidl::client::QueryResponseFut<
4239        Vec<OnMeshPrefix>,
4240        fidl::encoding::DefaultFuchsiaResourceDialect,
4241    > {
4242        DeviceRouteExtraProxyInterface::r#get_local_on_mesh_prefixes(self)
4243    }
4244
4245    /// Returns a vector containing all of the locally-added external routes.
4246    ///
4247    /// Locally-added external routes are those that have been registered
4248    /// with a prior call to [`DeviceRoute.RegisterExternalRoute`].
4249    pub fn r#get_local_external_routes(
4250        &self,
4251    ) -> fidl::client::QueryResponseFut<
4252        Vec<ExternalRoute>,
4253        fidl::encoding::DefaultFuchsiaResourceDialect,
4254    > {
4255        DeviceRouteExtraProxyInterface::r#get_local_external_routes(self)
4256    }
4257}
4258
4259impl DeviceRouteExtraProxyInterface for DeviceRouteExtraProxy {
4260    type GetLocalOnMeshPrefixesResponseFut = fidl::client::QueryResponseFut<
4261        Vec<OnMeshPrefix>,
4262        fidl::encoding::DefaultFuchsiaResourceDialect,
4263    >;
4264    fn r#get_local_on_mesh_prefixes(&self) -> Self::GetLocalOnMeshPrefixesResponseFut {
4265        fn _decode(
4266            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4267        ) -> Result<Vec<OnMeshPrefix>, fidl::Error> {
4268            let _response = fidl::client::decode_transaction_body::<
4269                DeviceRouteExtraGetLocalOnMeshPrefixesResponse,
4270                fidl::encoding::DefaultFuchsiaResourceDialect,
4271                0xf192c43311c811,
4272            >(_buf?)?;
4273            Ok(_response.prefixes)
4274        }
4275        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<OnMeshPrefix>>(
4276            (),
4277            0xf192c43311c811,
4278            fidl::encoding::DynamicFlags::empty(),
4279            _decode,
4280        )
4281    }
4282
4283    type GetLocalExternalRoutesResponseFut = fidl::client::QueryResponseFut<
4284        Vec<ExternalRoute>,
4285        fidl::encoding::DefaultFuchsiaResourceDialect,
4286    >;
4287    fn r#get_local_external_routes(&self) -> Self::GetLocalExternalRoutesResponseFut {
4288        fn _decode(
4289            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4290        ) -> Result<Vec<ExternalRoute>, fidl::Error> {
4291            let _response = fidl::client::decode_transaction_body::<
4292                DeviceRouteExtraGetLocalExternalRoutesResponse,
4293                fidl::encoding::DefaultFuchsiaResourceDialect,
4294                0x5a688c2e62c766a6,
4295            >(_buf?)?;
4296            Ok(_response.external_routes)
4297        }
4298        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<ExternalRoute>>(
4299            (),
4300            0x5a688c2e62c766a6,
4301            fidl::encoding::DynamicFlags::empty(),
4302            _decode,
4303        )
4304    }
4305}
4306
4307pub struct DeviceRouteExtraEventStream {
4308    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4309}
4310
4311impl std::marker::Unpin for DeviceRouteExtraEventStream {}
4312
4313impl futures::stream::FusedStream for DeviceRouteExtraEventStream {
4314    fn is_terminated(&self) -> bool {
4315        self.event_receiver.is_terminated()
4316    }
4317}
4318
4319impl futures::Stream for DeviceRouteExtraEventStream {
4320    type Item = Result<DeviceRouteExtraEvent, fidl::Error>;
4321
4322    fn poll_next(
4323        mut self: std::pin::Pin<&mut Self>,
4324        cx: &mut std::task::Context<'_>,
4325    ) -> std::task::Poll<Option<Self::Item>> {
4326        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4327            &mut self.event_receiver,
4328            cx
4329        )?) {
4330            Some(buf) => std::task::Poll::Ready(Some(DeviceRouteExtraEvent::decode(buf))),
4331            None => std::task::Poll::Ready(None),
4332        }
4333    }
4334}
4335
4336#[derive(Debug)]
4337pub enum DeviceRouteExtraEvent {}
4338
4339impl DeviceRouteExtraEvent {
4340    /// Decodes a message buffer as a [`DeviceRouteExtraEvent`].
4341    fn decode(
4342        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4343    ) -> Result<DeviceRouteExtraEvent, fidl::Error> {
4344        let (bytes, _handles) = buf.split_mut();
4345        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4346        debug_assert_eq!(tx_header.tx_id, 0);
4347        match tx_header.ordinal {
4348            _ => Err(fidl::Error::UnknownOrdinal {
4349                ordinal: tx_header.ordinal,
4350                protocol_name:
4351                    <DeviceRouteExtraMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4352            }),
4353        }
4354    }
4355}
4356
4357/// A Stream of incoming requests for fuchsia.lowpan.experimental/DeviceRouteExtra.
4358pub struct DeviceRouteExtraRequestStream {
4359    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4360    is_terminated: bool,
4361}
4362
4363impl std::marker::Unpin for DeviceRouteExtraRequestStream {}
4364
4365impl futures::stream::FusedStream for DeviceRouteExtraRequestStream {
4366    fn is_terminated(&self) -> bool {
4367        self.is_terminated
4368    }
4369}
4370
4371impl fidl::endpoints::RequestStream for DeviceRouteExtraRequestStream {
4372    type Protocol = DeviceRouteExtraMarker;
4373    type ControlHandle = DeviceRouteExtraControlHandle;
4374
4375    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4376        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4377    }
4378
4379    fn control_handle(&self) -> Self::ControlHandle {
4380        DeviceRouteExtraControlHandle { inner: self.inner.clone() }
4381    }
4382
4383    fn into_inner(
4384        self,
4385    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4386    {
4387        (self.inner, self.is_terminated)
4388    }
4389
4390    fn from_inner(
4391        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4392        is_terminated: bool,
4393    ) -> Self {
4394        Self { inner, is_terminated }
4395    }
4396}
4397
4398impl futures::Stream for DeviceRouteExtraRequestStream {
4399    type Item = Result<DeviceRouteExtraRequest, fidl::Error>;
4400
4401    fn poll_next(
4402        mut self: std::pin::Pin<&mut Self>,
4403        cx: &mut std::task::Context<'_>,
4404    ) -> std::task::Poll<Option<Self::Item>> {
4405        let this = &mut *self;
4406        if this.inner.check_shutdown(cx) {
4407            this.is_terminated = true;
4408            return std::task::Poll::Ready(None);
4409        }
4410        if this.is_terminated {
4411            panic!("polled DeviceRouteExtraRequestStream after completion");
4412        }
4413        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4414            |bytes, handles| {
4415                match this.inner.channel().read_etc(cx, bytes, handles) {
4416                    std::task::Poll::Ready(Ok(())) => {}
4417                    std::task::Poll::Pending => return std::task::Poll::Pending,
4418                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4419                        this.is_terminated = true;
4420                        return std::task::Poll::Ready(None);
4421                    }
4422                    std::task::Poll::Ready(Err(e)) => {
4423                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4424                            e.into(),
4425                        ))));
4426                    }
4427                }
4428
4429                // A message has been received from the channel
4430                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4431
4432                std::task::Poll::Ready(Some(match header.ordinal {
4433                    0xf192c43311c811 => {
4434                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4435                        let mut req = fidl::new_empty!(
4436                            fidl::encoding::EmptyPayload,
4437                            fidl::encoding::DefaultFuchsiaResourceDialect
4438                        );
4439                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4440                        let control_handle =
4441                            DeviceRouteExtraControlHandle { inner: this.inner.clone() };
4442                        Ok(DeviceRouteExtraRequest::GetLocalOnMeshPrefixes {
4443                            responder: DeviceRouteExtraGetLocalOnMeshPrefixesResponder {
4444                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4445                                tx_id: header.tx_id,
4446                            },
4447                        })
4448                    }
4449                    0x5a688c2e62c766a6 => {
4450                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4451                        let mut req = fidl::new_empty!(
4452                            fidl::encoding::EmptyPayload,
4453                            fidl::encoding::DefaultFuchsiaResourceDialect
4454                        );
4455                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4456                        let control_handle =
4457                            DeviceRouteExtraControlHandle { inner: this.inner.clone() };
4458                        Ok(DeviceRouteExtraRequest::GetLocalExternalRoutes {
4459                            responder: DeviceRouteExtraGetLocalExternalRoutesResponder {
4460                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4461                                tx_id: header.tx_id,
4462                            },
4463                        })
4464                    }
4465                    _ => Err(fidl::Error::UnknownOrdinal {
4466                        ordinal: header.ordinal,
4467                        protocol_name:
4468                            <DeviceRouteExtraMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4469                    }),
4470                }))
4471            },
4472        )
4473    }
4474}
4475
4476/// LoWPAN protocol for IPv6 route and prefix management methods that
4477/// expose PII.
4478///
4479/// Note that methods that do not deal with PII are located in the
4480/// `DeviceRoute` protocol.
4481#[derive(Debug)]
4482pub enum DeviceRouteExtraRequest {
4483    /// Returns a vector containing all of the locally-added on-mesh prefixes.
4484    ///
4485    /// Locally-added on-mesh prefixes are those that have been registered
4486    /// with a prior call to [`DeviceRoute.RegisterOnMeshPrefix`].
4487    GetLocalOnMeshPrefixes { responder: DeviceRouteExtraGetLocalOnMeshPrefixesResponder },
4488    /// Returns a vector containing all of the locally-added external routes.
4489    ///
4490    /// Locally-added external routes are those that have been registered
4491    /// with a prior call to [`DeviceRoute.RegisterExternalRoute`].
4492    GetLocalExternalRoutes { responder: DeviceRouteExtraGetLocalExternalRoutesResponder },
4493}
4494
4495impl DeviceRouteExtraRequest {
4496    #[allow(irrefutable_let_patterns)]
4497    pub fn into_get_local_on_mesh_prefixes(
4498        self,
4499    ) -> Option<(DeviceRouteExtraGetLocalOnMeshPrefixesResponder)> {
4500        if let DeviceRouteExtraRequest::GetLocalOnMeshPrefixes { responder } = self {
4501            Some((responder))
4502        } else {
4503            None
4504        }
4505    }
4506
4507    #[allow(irrefutable_let_patterns)]
4508    pub fn into_get_local_external_routes(
4509        self,
4510    ) -> Option<(DeviceRouteExtraGetLocalExternalRoutesResponder)> {
4511        if let DeviceRouteExtraRequest::GetLocalExternalRoutes { responder } = self {
4512            Some((responder))
4513        } else {
4514            None
4515        }
4516    }
4517
4518    /// Name of the method defined in FIDL
4519    pub fn method_name(&self) -> &'static str {
4520        match *self {
4521            DeviceRouteExtraRequest::GetLocalOnMeshPrefixes { .. } => "get_local_on_mesh_prefixes",
4522            DeviceRouteExtraRequest::GetLocalExternalRoutes { .. } => "get_local_external_routes",
4523        }
4524    }
4525}
4526
4527#[derive(Debug, Clone)]
4528pub struct DeviceRouteExtraControlHandle {
4529    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4530}
4531
4532impl fidl::endpoints::ControlHandle for DeviceRouteExtraControlHandle {
4533    fn shutdown(&self) {
4534        self.inner.shutdown()
4535    }
4536
4537    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4538        self.inner.shutdown_with_epitaph(status)
4539    }
4540
4541    fn is_closed(&self) -> bool {
4542        self.inner.channel().is_closed()
4543    }
4544    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4545        self.inner.channel().on_closed()
4546    }
4547
4548    #[cfg(target_os = "fuchsia")]
4549    fn signal_peer(
4550        &self,
4551        clear_mask: zx::Signals,
4552        set_mask: zx::Signals,
4553    ) -> Result<(), zx_status::Status> {
4554        use fidl::Peered;
4555        self.inner.channel().signal_peer(clear_mask, set_mask)
4556    }
4557}
4558
4559impl DeviceRouteExtraControlHandle {}
4560
4561#[must_use = "FIDL methods require a response to be sent"]
4562#[derive(Debug)]
4563pub struct DeviceRouteExtraGetLocalOnMeshPrefixesResponder {
4564    control_handle: std::mem::ManuallyDrop<DeviceRouteExtraControlHandle>,
4565    tx_id: u32,
4566}
4567
4568/// Set the the channel to be shutdown (see [`DeviceRouteExtraControlHandle::shutdown`])
4569/// if the responder is dropped without sending a response, so that the client
4570/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4571impl std::ops::Drop for DeviceRouteExtraGetLocalOnMeshPrefixesResponder {
4572    fn drop(&mut self) {
4573        self.control_handle.shutdown();
4574        // Safety: drops once, never accessed again
4575        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4576    }
4577}
4578
4579impl fidl::endpoints::Responder for DeviceRouteExtraGetLocalOnMeshPrefixesResponder {
4580    type ControlHandle = DeviceRouteExtraControlHandle;
4581
4582    fn control_handle(&self) -> &DeviceRouteExtraControlHandle {
4583        &self.control_handle
4584    }
4585
4586    fn drop_without_shutdown(mut self) {
4587        // Safety: drops once, never accessed again due to mem::forget
4588        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4589        // Prevent Drop from running (which would shut down the channel)
4590        std::mem::forget(self);
4591    }
4592}
4593
4594impl DeviceRouteExtraGetLocalOnMeshPrefixesResponder {
4595    /// Sends a response to the FIDL transaction.
4596    ///
4597    /// Sets the channel to shutdown if an error occurs.
4598    pub fn send(self, mut prefixes: &[OnMeshPrefix]) -> Result<(), fidl::Error> {
4599        let _result = self.send_raw(prefixes);
4600        if _result.is_err() {
4601            self.control_handle.shutdown();
4602        }
4603        self.drop_without_shutdown();
4604        _result
4605    }
4606
4607    /// Similar to "send" but does not shutdown the channel if an error occurs.
4608    pub fn send_no_shutdown_on_err(self, mut prefixes: &[OnMeshPrefix]) -> Result<(), fidl::Error> {
4609        let _result = self.send_raw(prefixes);
4610        self.drop_without_shutdown();
4611        _result
4612    }
4613
4614    fn send_raw(&self, mut prefixes: &[OnMeshPrefix]) -> Result<(), fidl::Error> {
4615        self.control_handle.inner.send::<DeviceRouteExtraGetLocalOnMeshPrefixesResponse>(
4616            (prefixes,),
4617            self.tx_id,
4618            0xf192c43311c811,
4619            fidl::encoding::DynamicFlags::empty(),
4620        )
4621    }
4622}
4623
4624#[must_use = "FIDL methods require a response to be sent"]
4625#[derive(Debug)]
4626pub struct DeviceRouteExtraGetLocalExternalRoutesResponder {
4627    control_handle: std::mem::ManuallyDrop<DeviceRouteExtraControlHandle>,
4628    tx_id: u32,
4629}
4630
4631/// Set the the channel to be shutdown (see [`DeviceRouteExtraControlHandle::shutdown`])
4632/// if the responder is dropped without sending a response, so that the client
4633/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4634impl std::ops::Drop for DeviceRouteExtraGetLocalExternalRoutesResponder {
4635    fn drop(&mut self) {
4636        self.control_handle.shutdown();
4637        // Safety: drops once, never accessed again
4638        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4639    }
4640}
4641
4642impl fidl::endpoints::Responder for DeviceRouteExtraGetLocalExternalRoutesResponder {
4643    type ControlHandle = DeviceRouteExtraControlHandle;
4644
4645    fn control_handle(&self) -> &DeviceRouteExtraControlHandle {
4646        &self.control_handle
4647    }
4648
4649    fn drop_without_shutdown(mut self) {
4650        // Safety: drops once, never accessed again due to mem::forget
4651        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4652        // Prevent Drop from running (which would shut down the channel)
4653        std::mem::forget(self);
4654    }
4655}
4656
4657impl DeviceRouteExtraGetLocalExternalRoutesResponder {
4658    /// Sends a response to the FIDL transaction.
4659    ///
4660    /// Sets the channel to shutdown if an error occurs.
4661    pub fn send(self, mut external_routes: &[ExternalRoute]) -> Result<(), fidl::Error> {
4662        let _result = self.send_raw(external_routes);
4663        if _result.is_err() {
4664            self.control_handle.shutdown();
4665        }
4666        self.drop_without_shutdown();
4667        _result
4668    }
4669
4670    /// Similar to "send" but does not shutdown the channel if an error occurs.
4671    pub fn send_no_shutdown_on_err(
4672        self,
4673        mut external_routes: &[ExternalRoute],
4674    ) -> Result<(), fidl::Error> {
4675        let _result = self.send_raw(external_routes);
4676        self.drop_without_shutdown();
4677        _result
4678    }
4679
4680    fn send_raw(&self, mut external_routes: &[ExternalRoute]) -> Result<(), fidl::Error> {
4681        self.control_handle.inner.send::<DeviceRouteExtraGetLocalExternalRoutesResponse>(
4682            (external_routes,),
4683            self.tx_id,
4684            0x5a688c2e62c766a6,
4685            fidl::encoding::DynamicFlags::empty(),
4686        )
4687    }
4688}
4689
4690#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4691pub struct DeviceRouteExtraConnectorMarker;
4692
4693impl fidl::endpoints::ProtocolMarker for DeviceRouteExtraConnectorMarker {
4694    type Proxy = DeviceRouteExtraConnectorProxy;
4695    type RequestStream = DeviceRouteExtraConnectorRequestStream;
4696    #[cfg(target_os = "fuchsia")]
4697    type SynchronousProxy = DeviceRouteExtraConnectorSynchronousProxy;
4698
4699    const DEBUG_NAME: &'static str = "fuchsia.lowpan.experimental.DeviceRouteExtraConnector";
4700}
4701impl fidl::endpoints::DiscoverableProtocolMarker for DeviceRouteExtraConnectorMarker {}
4702
4703pub trait DeviceRouteExtraConnectorProxyInterface: Send + Sync {
4704    fn r#connect(
4705        &self,
4706        name: &str,
4707        server_end: fidl::endpoints::ServerEnd<DeviceRouteExtraMarker>,
4708    ) -> Result<(), fidl::Error>;
4709}
4710#[derive(Debug)]
4711#[cfg(target_os = "fuchsia")]
4712pub struct DeviceRouteExtraConnectorSynchronousProxy {
4713    client: fidl::client::sync::Client,
4714}
4715
4716#[cfg(target_os = "fuchsia")]
4717impl fidl::endpoints::SynchronousProxy for DeviceRouteExtraConnectorSynchronousProxy {
4718    type Proxy = DeviceRouteExtraConnectorProxy;
4719    type Protocol = DeviceRouteExtraConnectorMarker;
4720
4721    fn from_channel(inner: fidl::Channel) -> Self {
4722        Self::new(inner)
4723    }
4724
4725    fn into_channel(self) -> fidl::Channel {
4726        self.client.into_channel()
4727    }
4728
4729    fn as_channel(&self) -> &fidl::Channel {
4730        self.client.as_channel()
4731    }
4732}
4733
4734#[cfg(target_os = "fuchsia")]
4735impl DeviceRouteExtraConnectorSynchronousProxy {
4736    pub fn new(channel: fidl::Channel) -> Self {
4737        Self { client: fidl::client::sync::Client::new(channel) }
4738    }
4739
4740    pub fn into_channel(self) -> fidl::Channel {
4741        self.client.into_channel()
4742    }
4743
4744    /// Waits until an event arrives and returns it. It is safe for other
4745    /// threads to make concurrent requests while waiting for an event.
4746    pub fn wait_for_event(
4747        &self,
4748        deadline: zx::MonotonicInstant,
4749    ) -> Result<DeviceRouteExtraConnectorEvent, fidl::Error> {
4750        DeviceRouteExtraConnectorEvent::decode(
4751            self.client.wait_for_event::<DeviceRouteExtraConnectorMarker>(deadline)?,
4752        )
4753    }
4754
4755    /// Connects to the [`DeviceRouteExtra`] protocol on the
4756    /// named LoWPAN interface.
4757    ///
4758    /// The name of the interface can be learned by calling
4759    /// [`fuchsia.lowpan/Lookup.GetDevices`].
4760    ///
4761    /// If there is an error in processing this request
4762    /// the given channel is closed and an epitaph code used
4763    /// to describe the reason for the failure:
4764    ///
4765    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
4766    ///   was not formatted correctly or otherwise invalid.
4767    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
4768    ///   given name.
4769    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
4770    ///   does not support this protocol.
4771    pub fn r#connect(
4772        &self,
4773        mut name: &str,
4774        mut server_end: fidl::endpoints::ServerEnd<DeviceRouteExtraMarker>,
4775    ) -> Result<(), fidl::Error> {
4776        self.client.send::<DeviceRouteExtraConnectorConnectRequest>(
4777            (name, server_end),
4778            0x12f72df7b1348fe2,
4779            fidl::encoding::DynamicFlags::empty(),
4780        )
4781    }
4782}
4783
4784#[cfg(target_os = "fuchsia")]
4785impl From<DeviceRouteExtraConnectorSynchronousProxy> for zx::NullableHandle {
4786    fn from(value: DeviceRouteExtraConnectorSynchronousProxy) -> Self {
4787        value.into_channel().into()
4788    }
4789}
4790
4791#[cfg(target_os = "fuchsia")]
4792impl From<fidl::Channel> for DeviceRouteExtraConnectorSynchronousProxy {
4793    fn from(value: fidl::Channel) -> Self {
4794        Self::new(value)
4795    }
4796}
4797
4798#[cfg(target_os = "fuchsia")]
4799impl fidl::endpoints::FromClient for DeviceRouteExtraConnectorSynchronousProxy {
4800    type Protocol = DeviceRouteExtraConnectorMarker;
4801
4802    fn from_client(value: fidl::endpoints::ClientEnd<DeviceRouteExtraConnectorMarker>) -> Self {
4803        Self::new(value.into_channel())
4804    }
4805}
4806
4807#[derive(Debug, Clone)]
4808pub struct DeviceRouteExtraConnectorProxy {
4809    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4810}
4811
4812impl fidl::endpoints::Proxy for DeviceRouteExtraConnectorProxy {
4813    type Protocol = DeviceRouteExtraConnectorMarker;
4814
4815    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4816        Self::new(inner)
4817    }
4818
4819    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4820        self.client.into_channel().map_err(|client| Self { client })
4821    }
4822
4823    fn as_channel(&self) -> &::fidl::AsyncChannel {
4824        self.client.as_channel()
4825    }
4826}
4827
4828impl DeviceRouteExtraConnectorProxy {
4829    /// Create a new Proxy for fuchsia.lowpan.experimental/DeviceRouteExtraConnector.
4830    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4831        let protocol_name =
4832            <DeviceRouteExtraConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4833        Self { client: fidl::client::Client::new(channel, protocol_name) }
4834    }
4835
4836    /// Get a Stream of events from the remote end of the protocol.
4837    ///
4838    /// # Panics
4839    ///
4840    /// Panics if the event stream was already taken.
4841    pub fn take_event_stream(&self) -> DeviceRouteExtraConnectorEventStream {
4842        DeviceRouteExtraConnectorEventStream { event_receiver: self.client.take_event_receiver() }
4843    }
4844
4845    /// Connects to the [`DeviceRouteExtra`] protocol on the
4846    /// named LoWPAN interface.
4847    ///
4848    /// The name of the interface can be learned by calling
4849    /// [`fuchsia.lowpan/Lookup.GetDevices`].
4850    ///
4851    /// If there is an error in processing this request
4852    /// the given channel is closed and an epitaph code used
4853    /// to describe the reason for the failure:
4854    ///
4855    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
4856    ///   was not formatted correctly or otherwise invalid.
4857    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
4858    ///   given name.
4859    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
4860    ///   does not support this protocol.
4861    pub fn r#connect(
4862        &self,
4863        mut name: &str,
4864        mut server_end: fidl::endpoints::ServerEnd<DeviceRouteExtraMarker>,
4865    ) -> Result<(), fidl::Error> {
4866        DeviceRouteExtraConnectorProxyInterface::r#connect(self, name, server_end)
4867    }
4868}
4869
4870impl DeviceRouteExtraConnectorProxyInterface for DeviceRouteExtraConnectorProxy {
4871    fn r#connect(
4872        &self,
4873        mut name: &str,
4874        mut server_end: fidl::endpoints::ServerEnd<DeviceRouteExtraMarker>,
4875    ) -> Result<(), fidl::Error> {
4876        self.client.send::<DeviceRouteExtraConnectorConnectRequest>(
4877            (name, server_end),
4878            0x12f72df7b1348fe2,
4879            fidl::encoding::DynamicFlags::empty(),
4880        )
4881    }
4882}
4883
4884pub struct DeviceRouteExtraConnectorEventStream {
4885    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4886}
4887
4888impl std::marker::Unpin for DeviceRouteExtraConnectorEventStream {}
4889
4890impl futures::stream::FusedStream for DeviceRouteExtraConnectorEventStream {
4891    fn is_terminated(&self) -> bool {
4892        self.event_receiver.is_terminated()
4893    }
4894}
4895
4896impl futures::Stream for DeviceRouteExtraConnectorEventStream {
4897    type Item = Result<DeviceRouteExtraConnectorEvent, fidl::Error>;
4898
4899    fn poll_next(
4900        mut self: std::pin::Pin<&mut Self>,
4901        cx: &mut std::task::Context<'_>,
4902    ) -> std::task::Poll<Option<Self::Item>> {
4903        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4904            &mut self.event_receiver,
4905            cx
4906        )?) {
4907            Some(buf) => std::task::Poll::Ready(Some(DeviceRouteExtraConnectorEvent::decode(buf))),
4908            None => std::task::Poll::Ready(None),
4909        }
4910    }
4911}
4912
4913#[derive(Debug)]
4914pub enum DeviceRouteExtraConnectorEvent {}
4915
4916impl DeviceRouteExtraConnectorEvent {
4917    /// Decodes a message buffer as a [`DeviceRouteExtraConnectorEvent`].
4918    fn decode(
4919        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4920    ) -> Result<DeviceRouteExtraConnectorEvent, fidl::Error> {
4921        let (bytes, _handles) = buf.split_mut();
4922        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4923        debug_assert_eq!(tx_header.tx_id, 0);
4924        match tx_header.ordinal {
4925            _ => Err(fidl::Error::UnknownOrdinal {
4926                ordinal: tx_header.ordinal,
4927                protocol_name:
4928                    <DeviceRouteExtraConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4929            }),
4930        }
4931    }
4932}
4933
4934/// A Stream of incoming requests for fuchsia.lowpan.experimental/DeviceRouteExtraConnector.
4935pub struct DeviceRouteExtraConnectorRequestStream {
4936    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4937    is_terminated: bool,
4938}
4939
4940impl std::marker::Unpin for DeviceRouteExtraConnectorRequestStream {}
4941
4942impl futures::stream::FusedStream for DeviceRouteExtraConnectorRequestStream {
4943    fn is_terminated(&self) -> bool {
4944        self.is_terminated
4945    }
4946}
4947
4948impl fidl::endpoints::RequestStream for DeviceRouteExtraConnectorRequestStream {
4949    type Protocol = DeviceRouteExtraConnectorMarker;
4950    type ControlHandle = DeviceRouteExtraConnectorControlHandle;
4951
4952    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4953        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4954    }
4955
4956    fn control_handle(&self) -> Self::ControlHandle {
4957        DeviceRouteExtraConnectorControlHandle { inner: self.inner.clone() }
4958    }
4959
4960    fn into_inner(
4961        self,
4962    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4963    {
4964        (self.inner, self.is_terminated)
4965    }
4966
4967    fn from_inner(
4968        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4969        is_terminated: bool,
4970    ) -> Self {
4971        Self { inner, is_terminated }
4972    }
4973}
4974
4975impl futures::Stream for DeviceRouteExtraConnectorRequestStream {
4976    type Item = Result<DeviceRouteExtraConnectorRequest, fidl::Error>;
4977
4978    fn poll_next(
4979        mut self: std::pin::Pin<&mut Self>,
4980        cx: &mut std::task::Context<'_>,
4981    ) -> std::task::Poll<Option<Self::Item>> {
4982        let this = &mut *self;
4983        if this.inner.check_shutdown(cx) {
4984            this.is_terminated = true;
4985            return std::task::Poll::Ready(None);
4986        }
4987        if this.is_terminated {
4988            panic!("polled DeviceRouteExtraConnectorRequestStream after completion");
4989        }
4990        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4991            |bytes, handles| {
4992                match this.inner.channel().read_etc(cx, bytes, handles) {
4993                    std::task::Poll::Ready(Ok(())) => {}
4994                    std::task::Poll::Pending => return std::task::Poll::Pending,
4995                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4996                        this.is_terminated = true;
4997                        return std::task::Poll::Ready(None);
4998                    }
4999                    std::task::Poll::Ready(Err(e)) => {
5000                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5001                            e.into(),
5002                        ))));
5003                    }
5004                }
5005
5006                // A message has been received from the channel
5007                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5008
5009                std::task::Poll::Ready(Some(match header.ordinal {
5010                0x12f72df7b1348fe2 => {
5011                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5012                    let mut req = fidl::new_empty!(DeviceRouteExtraConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
5013                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceRouteExtraConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
5014                    let control_handle = DeviceRouteExtraConnectorControlHandle {
5015                        inner: this.inner.clone(),
5016                    };
5017                    Ok(DeviceRouteExtraConnectorRequest::Connect {name: req.name,
5018server_end: req.server_end,
5019
5020                        control_handle,
5021                    })
5022                }
5023                _ => Err(fidl::Error::UnknownOrdinal {
5024                    ordinal: header.ordinal,
5025                    protocol_name: <DeviceRouteExtraConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5026                }),
5027            }))
5028            },
5029        )
5030    }
5031}
5032
5033/// Protocol for connecting to [`DeviceRouteExtra`] on a LoWPAN
5034/// interface.
5035#[derive(Debug)]
5036pub enum DeviceRouteExtraConnectorRequest {
5037    /// Connects to the [`DeviceRouteExtra`] protocol on the
5038    /// named LoWPAN interface.
5039    ///
5040    /// The name of the interface can be learned by calling
5041    /// [`fuchsia.lowpan/Lookup.GetDevices`].
5042    ///
5043    /// If there is an error in processing this request
5044    /// the given channel is closed and an epitaph code used
5045    /// to describe the reason for the failure:
5046    ///
5047    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
5048    ///   was not formatted correctly or otherwise invalid.
5049    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
5050    ///   given name.
5051    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
5052    ///   does not support this protocol.
5053    Connect {
5054        name: String,
5055        server_end: fidl::endpoints::ServerEnd<DeviceRouteExtraMarker>,
5056        control_handle: DeviceRouteExtraConnectorControlHandle,
5057    },
5058}
5059
5060impl DeviceRouteExtraConnectorRequest {
5061    #[allow(irrefutable_let_patterns)]
5062    pub fn into_connect(
5063        self,
5064    ) -> Option<(
5065        String,
5066        fidl::endpoints::ServerEnd<DeviceRouteExtraMarker>,
5067        DeviceRouteExtraConnectorControlHandle,
5068    )> {
5069        if let DeviceRouteExtraConnectorRequest::Connect { name, server_end, control_handle } = self
5070        {
5071            Some((name, server_end, control_handle))
5072        } else {
5073            None
5074        }
5075    }
5076
5077    /// Name of the method defined in FIDL
5078    pub fn method_name(&self) -> &'static str {
5079        match *self {
5080            DeviceRouteExtraConnectorRequest::Connect { .. } => "connect",
5081        }
5082    }
5083}
5084
5085#[derive(Debug, Clone)]
5086pub struct DeviceRouteExtraConnectorControlHandle {
5087    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5088}
5089
5090impl fidl::endpoints::ControlHandle for DeviceRouteExtraConnectorControlHandle {
5091    fn shutdown(&self) {
5092        self.inner.shutdown()
5093    }
5094
5095    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5096        self.inner.shutdown_with_epitaph(status)
5097    }
5098
5099    fn is_closed(&self) -> bool {
5100        self.inner.channel().is_closed()
5101    }
5102    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5103        self.inner.channel().on_closed()
5104    }
5105
5106    #[cfg(target_os = "fuchsia")]
5107    fn signal_peer(
5108        &self,
5109        clear_mask: zx::Signals,
5110        set_mask: zx::Signals,
5111    ) -> Result<(), zx_status::Status> {
5112        use fidl::Peered;
5113        self.inner.channel().signal_peer(clear_mask, set_mask)
5114    }
5115}
5116
5117impl DeviceRouteExtraConnectorControlHandle {}
5118
5119#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5120pub struct LegacyJoiningMarker;
5121
5122impl fidl::endpoints::ProtocolMarker for LegacyJoiningMarker {
5123    type Proxy = LegacyJoiningProxy;
5124    type RequestStream = LegacyJoiningRequestStream;
5125    #[cfg(target_os = "fuchsia")]
5126    type SynchronousProxy = LegacyJoiningSynchronousProxy;
5127
5128    const DEBUG_NAME: &'static str = "(anonymous) LegacyJoining";
5129}
5130
5131pub trait LegacyJoiningProxyInterface: Send + Sync {
5132    type MakeJoinableResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
5133    fn r#make_joinable(&self, duration: i64, port: u16) -> Self::MakeJoinableResponseFut;
5134}
5135#[derive(Debug)]
5136#[cfg(target_os = "fuchsia")]
5137pub struct LegacyJoiningSynchronousProxy {
5138    client: fidl::client::sync::Client,
5139}
5140
5141#[cfg(target_os = "fuchsia")]
5142impl fidl::endpoints::SynchronousProxy for LegacyJoiningSynchronousProxy {
5143    type Proxy = LegacyJoiningProxy;
5144    type Protocol = LegacyJoiningMarker;
5145
5146    fn from_channel(inner: fidl::Channel) -> Self {
5147        Self::new(inner)
5148    }
5149
5150    fn into_channel(self) -> fidl::Channel {
5151        self.client.into_channel()
5152    }
5153
5154    fn as_channel(&self) -> &fidl::Channel {
5155        self.client.as_channel()
5156    }
5157}
5158
5159#[cfg(target_os = "fuchsia")]
5160impl LegacyJoiningSynchronousProxy {
5161    pub fn new(channel: fidl::Channel) -> Self {
5162        Self { client: fidl::client::sync::Client::new(channel) }
5163    }
5164
5165    pub fn into_channel(self) -> fidl::Channel {
5166        self.client.into_channel()
5167    }
5168
5169    /// Waits until an event arrives and returns it. It is safe for other
5170    /// threads to make concurrent requests while waiting for an event.
5171    pub fn wait_for_event(
5172        &self,
5173        deadline: zx::MonotonicInstant,
5174    ) -> Result<LegacyJoiningEvent, fidl::Error> {
5175        LegacyJoiningEvent::decode(self.client.wait_for_event::<LegacyJoiningMarker>(deadline)?)
5176    }
5177
5178    /// Makes the interface joinable for Thread devices that need to use a
5179    /// non-standard in-band commissioning protocol. It is not used for
5180    /// standard Thread commissioning.
5181    ///
5182    /// When this call returns, the interface has been made joinable if
5183    /// requested.
5184    ///
5185    /// Subsequent calls to this method will override previous calls.
5186    /// To force the interface to no longer be joinable immediately, call
5187    /// this method with a duration of zero seconds and a port of zero (port
5188    /// is ignored in this case).
5189    ///
5190    /// This method must only be called when the interface is online
5191    /// (Specifically, either attaching, attached, or isolated). If the
5192    /// interface is in any other state, the channel will be closed with
5193    /// `ZX_ERR_BAD_STATE`.
5194    ///
5195    /// `duration` specifies a minimum time the interface should be made
5196    /// joinable, relative to the time the call is received. It may be rounded
5197    /// up to the nearest second.
5198    ///
5199    /// `port` specifies the local port that TCP or UDP commissioning traffic
5200    /// will be directed to.
5201    pub fn r#make_joinable(
5202        &self,
5203        mut duration: i64,
5204        mut port: u16,
5205        ___deadline: zx::MonotonicInstant,
5206    ) -> Result<(), fidl::Error> {
5207        let _response = self.client.send_query::<
5208            LegacyJoiningMakeJoinableRequest,
5209            fidl::encoding::EmptyPayload,
5210            LegacyJoiningMarker,
5211        >(
5212            (duration, port,),
5213            0x1739a6ae36d5c5aa,
5214            fidl::encoding::DynamicFlags::empty(),
5215            ___deadline,
5216        )?;
5217        Ok(_response)
5218    }
5219}
5220
5221#[cfg(target_os = "fuchsia")]
5222impl From<LegacyJoiningSynchronousProxy> for zx::NullableHandle {
5223    fn from(value: LegacyJoiningSynchronousProxy) -> Self {
5224        value.into_channel().into()
5225    }
5226}
5227
5228#[cfg(target_os = "fuchsia")]
5229impl From<fidl::Channel> for LegacyJoiningSynchronousProxy {
5230    fn from(value: fidl::Channel) -> Self {
5231        Self::new(value)
5232    }
5233}
5234
5235#[cfg(target_os = "fuchsia")]
5236impl fidl::endpoints::FromClient for LegacyJoiningSynchronousProxy {
5237    type Protocol = LegacyJoiningMarker;
5238
5239    fn from_client(value: fidl::endpoints::ClientEnd<LegacyJoiningMarker>) -> Self {
5240        Self::new(value.into_channel())
5241    }
5242}
5243
5244#[derive(Debug, Clone)]
5245pub struct LegacyJoiningProxy {
5246    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5247}
5248
5249impl fidl::endpoints::Proxy for LegacyJoiningProxy {
5250    type Protocol = LegacyJoiningMarker;
5251
5252    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5253        Self::new(inner)
5254    }
5255
5256    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5257        self.client.into_channel().map_err(|client| Self { client })
5258    }
5259
5260    fn as_channel(&self) -> &::fidl::AsyncChannel {
5261        self.client.as_channel()
5262    }
5263}
5264
5265impl LegacyJoiningProxy {
5266    /// Create a new Proxy for fuchsia.lowpan.experimental/LegacyJoining.
5267    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5268        let protocol_name = <LegacyJoiningMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5269        Self { client: fidl::client::Client::new(channel, protocol_name) }
5270    }
5271
5272    /// Get a Stream of events from the remote end of the protocol.
5273    ///
5274    /// # Panics
5275    ///
5276    /// Panics if the event stream was already taken.
5277    pub fn take_event_stream(&self) -> LegacyJoiningEventStream {
5278        LegacyJoiningEventStream { event_receiver: self.client.take_event_receiver() }
5279    }
5280
5281    /// Makes the interface joinable for Thread devices that need to use a
5282    /// non-standard in-band commissioning protocol. It is not used for
5283    /// standard Thread commissioning.
5284    ///
5285    /// When this call returns, the interface has been made joinable if
5286    /// requested.
5287    ///
5288    /// Subsequent calls to this method will override previous calls.
5289    /// To force the interface to no longer be joinable immediately, call
5290    /// this method with a duration of zero seconds and a port of zero (port
5291    /// is ignored in this case).
5292    ///
5293    /// This method must only be called when the interface is online
5294    /// (Specifically, either attaching, attached, or isolated). If the
5295    /// interface is in any other state, the channel will be closed with
5296    /// `ZX_ERR_BAD_STATE`.
5297    ///
5298    /// `duration` specifies a minimum time the interface should be made
5299    /// joinable, relative to the time the call is received. It may be rounded
5300    /// up to the nearest second.
5301    ///
5302    /// `port` specifies the local port that TCP or UDP commissioning traffic
5303    /// will be directed to.
5304    pub fn r#make_joinable(
5305        &self,
5306        mut duration: i64,
5307        mut port: u16,
5308    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
5309        LegacyJoiningProxyInterface::r#make_joinable(self, duration, port)
5310    }
5311}
5312
5313impl LegacyJoiningProxyInterface for LegacyJoiningProxy {
5314    type MakeJoinableResponseFut =
5315        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
5316    fn r#make_joinable(&self, mut duration: i64, mut port: u16) -> Self::MakeJoinableResponseFut {
5317        fn _decode(
5318            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5319        ) -> Result<(), fidl::Error> {
5320            let _response = fidl::client::decode_transaction_body::<
5321                fidl::encoding::EmptyPayload,
5322                fidl::encoding::DefaultFuchsiaResourceDialect,
5323                0x1739a6ae36d5c5aa,
5324            >(_buf?)?;
5325            Ok(_response)
5326        }
5327        self.client.send_query_and_decode::<LegacyJoiningMakeJoinableRequest, ()>(
5328            (duration, port),
5329            0x1739a6ae36d5c5aa,
5330            fidl::encoding::DynamicFlags::empty(),
5331            _decode,
5332        )
5333    }
5334}
5335
5336pub struct LegacyJoiningEventStream {
5337    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5338}
5339
5340impl std::marker::Unpin for LegacyJoiningEventStream {}
5341
5342impl futures::stream::FusedStream for LegacyJoiningEventStream {
5343    fn is_terminated(&self) -> bool {
5344        self.event_receiver.is_terminated()
5345    }
5346}
5347
5348impl futures::Stream for LegacyJoiningEventStream {
5349    type Item = Result<LegacyJoiningEvent, fidl::Error>;
5350
5351    fn poll_next(
5352        mut self: std::pin::Pin<&mut Self>,
5353        cx: &mut std::task::Context<'_>,
5354    ) -> std::task::Poll<Option<Self::Item>> {
5355        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5356            &mut self.event_receiver,
5357            cx
5358        )?) {
5359            Some(buf) => std::task::Poll::Ready(Some(LegacyJoiningEvent::decode(buf))),
5360            None => std::task::Poll::Ready(None),
5361        }
5362    }
5363}
5364
5365#[derive(Debug)]
5366pub enum LegacyJoiningEvent {}
5367
5368impl LegacyJoiningEvent {
5369    /// Decodes a message buffer as a [`LegacyJoiningEvent`].
5370    fn decode(
5371        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5372    ) -> Result<LegacyJoiningEvent, fidl::Error> {
5373        let (bytes, _handles) = buf.split_mut();
5374        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5375        debug_assert_eq!(tx_header.tx_id, 0);
5376        match tx_header.ordinal {
5377            _ => Err(fidl::Error::UnknownOrdinal {
5378                ordinal: tx_header.ordinal,
5379                protocol_name: <LegacyJoiningMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5380            }),
5381        }
5382    }
5383}
5384
5385/// A Stream of incoming requests for fuchsia.lowpan.experimental/LegacyJoining.
5386pub struct LegacyJoiningRequestStream {
5387    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5388    is_terminated: bool,
5389}
5390
5391impl std::marker::Unpin for LegacyJoiningRequestStream {}
5392
5393impl futures::stream::FusedStream for LegacyJoiningRequestStream {
5394    fn is_terminated(&self) -> bool {
5395        self.is_terminated
5396    }
5397}
5398
5399impl fidl::endpoints::RequestStream for LegacyJoiningRequestStream {
5400    type Protocol = LegacyJoiningMarker;
5401    type ControlHandle = LegacyJoiningControlHandle;
5402
5403    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5404        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5405    }
5406
5407    fn control_handle(&self) -> Self::ControlHandle {
5408        LegacyJoiningControlHandle { inner: self.inner.clone() }
5409    }
5410
5411    fn into_inner(
5412        self,
5413    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5414    {
5415        (self.inner, self.is_terminated)
5416    }
5417
5418    fn from_inner(
5419        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5420        is_terminated: bool,
5421    ) -> Self {
5422        Self { inner, is_terminated }
5423    }
5424}
5425
5426impl futures::Stream for LegacyJoiningRequestStream {
5427    type Item = Result<LegacyJoiningRequest, fidl::Error>;
5428
5429    fn poll_next(
5430        mut self: std::pin::Pin<&mut Self>,
5431        cx: &mut std::task::Context<'_>,
5432    ) -> std::task::Poll<Option<Self::Item>> {
5433        let this = &mut *self;
5434        if this.inner.check_shutdown(cx) {
5435            this.is_terminated = true;
5436            return std::task::Poll::Ready(None);
5437        }
5438        if this.is_terminated {
5439            panic!("polled LegacyJoiningRequestStream after completion");
5440        }
5441        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5442            |bytes, handles| {
5443                match this.inner.channel().read_etc(cx, bytes, handles) {
5444                    std::task::Poll::Ready(Ok(())) => {}
5445                    std::task::Poll::Pending => return std::task::Poll::Pending,
5446                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5447                        this.is_terminated = true;
5448                        return std::task::Poll::Ready(None);
5449                    }
5450                    std::task::Poll::Ready(Err(e)) => {
5451                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5452                            e.into(),
5453                        ))));
5454                    }
5455                }
5456
5457                // A message has been received from the channel
5458                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5459
5460                std::task::Poll::Ready(Some(match header.ordinal {
5461                    0x1739a6ae36d5c5aa => {
5462                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5463                        let mut req = fidl::new_empty!(
5464                            LegacyJoiningMakeJoinableRequest,
5465                            fidl::encoding::DefaultFuchsiaResourceDialect
5466                        );
5467                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LegacyJoiningMakeJoinableRequest>(&header, _body_bytes, handles, &mut req)?;
5468                        let control_handle =
5469                            LegacyJoiningControlHandle { inner: this.inner.clone() };
5470                        Ok(LegacyJoiningRequest::MakeJoinable {
5471                            duration: req.duration,
5472                            port: req.port,
5473
5474                            responder: LegacyJoiningMakeJoinableResponder {
5475                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5476                                tx_id: header.tx_id,
5477                            },
5478                        })
5479                    }
5480                    _ => Err(fidl::Error::UnknownOrdinal {
5481                        ordinal: header.ordinal,
5482                        protocol_name:
5483                            <LegacyJoiningMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5484                    }),
5485                }))
5486            },
5487        )
5488    }
5489}
5490
5491/// Protocol for supporting non-standard in-band commissioning protocols.
5492/// Only one instance of this protocol may be valid at a time: after the
5493/// first request all subsequent requests for this protocol will fail until
5494/// the first instance is closed.
5495#[derive(Debug)]
5496pub enum LegacyJoiningRequest {
5497    /// Makes the interface joinable for Thread devices that need to use a
5498    /// non-standard in-band commissioning protocol. It is not used for
5499    /// standard Thread commissioning.
5500    ///
5501    /// When this call returns, the interface has been made joinable if
5502    /// requested.
5503    ///
5504    /// Subsequent calls to this method will override previous calls.
5505    /// To force the interface to no longer be joinable immediately, call
5506    /// this method with a duration of zero seconds and a port of zero (port
5507    /// is ignored in this case).
5508    ///
5509    /// This method must only be called when the interface is online
5510    /// (Specifically, either attaching, attached, or isolated). If the
5511    /// interface is in any other state, the channel will be closed with
5512    /// `ZX_ERR_BAD_STATE`.
5513    ///
5514    /// `duration` specifies a minimum time the interface should be made
5515    /// joinable, relative to the time the call is received. It may be rounded
5516    /// up to the nearest second.
5517    ///
5518    /// `port` specifies the local port that TCP or UDP commissioning traffic
5519    /// will be directed to.
5520    MakeJoinable { duration: i64, port: u16, responder: LegacyJoiningMakeJoinableResponder },
5521}
5522
5523impl LegacyJoiningRequest {
5524    #[allow(irrefutable_let_patterns)]
5525    pub fn into_make_joinable(self) -> Option<(i64, u16, LegacyJoiningMakeJoinableResponder)> {
5526        if let LegacyJoiningRequest::MakeJoinable { duration, port, responder } = self {
5527            Some((duration, port, responder))
5528        } else {
5529            None
5530        }
5531    }
5532
5533    /// Name of the method defined in FIDL
5534    pub fn method_name(&self) -> &'static str {
5535        match *self {
5536            LegacyJoiningRequest::MakeJoinable { .. } => "make_joinable",
5537        }
5538    }
5539}
5540
5541#[derive(Debug, Clone)]
5542pub struct LegacyJoiningControlHandle {
5543    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5544}
5545
5546impl fidl::endpoints::ControlHandle for LegacyJoiningControlHandle {
5547    fn shutdown(&self) {
5548        self.inner.shutdown()
5549    }
5550
5551    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5552        self.inner.shutdown_with_epitaph(status)
5553    }
5554
5555    fn is_closed(&self) -> bool {
5556        self.inner.channel().is_closed()
5557    }
5558    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5559        self.inner.channel().on_closed()
5560    }
5561
5562    #[cfg(target_os = "fuchsia")]
5563    fn signal_peer(
5564        &self,
5565        clear_mask: zx::Signals,
5566        set_mask: zx::Signals,
5567    ) -> Result<(), zx_status::Status> {
5568        use fidl::Peered;
5569        self.inner.channel().signal_peer(clear_mask, set_mask)
5570    }
5571}
5572
5573impl LegacyJoiningControlHandle {}
5574
5575#[must_use = "FIDL methods require a response to be sent"]
5576#[derive(Debug)]
5577pub struct LegacyJoiningMakeJoinableResponder {
5578    control_handle: std::mem::ManuallyDrop<LegacyJoiningControlHandle>,
5579    tx_id: u32,
5580}
5581
5582/// Set the the channel to be shutdown (see [`LegacyJoiningControlHandle::shutdown`])
5583/// if the responder is dropped without sending a response, so that the client
5584/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5585impl std::ops::Drop for LegacyJoiningMakeJoinableResponder {
5586    fn drop(&mut self) {
5587        self.control_handle.shutdown();
5588        // Safety: drops once, never accessed again
5589        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5590    }
5591}
5592
5593impl fidl::endpoints::Responder for LegacyJoiningMakeJoinableResponder {
5594    type ControlHandle = LegacyJoiningControlHandle;
5595
5596    fn control_handle(&self) -> &LegacyJoiningControlHandle {
5597        &self.control_handle
5598    }
5599
5600    fn drop_without_shutdown(mut self) {
5601        // Safety: drops once, never accessed again due to mem::forget
5602        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5603        // Prevent Drop from running (which would shut down the channel)
5604        std::mem::forget(self);
5605    }
5606}
5607
5608impl LegacyJoiningMakeJoinableResponder {
5609    /// Sends a response to the FIDL transaction.
5610    ///
5611    /// Sets the channel to shutdown if an error occurs.
5612    pub fn send(self) -> Result<(), fidl::Error> {
5613        let _result = self.send_raw();
5614        if _result.is_err() {
5615            self.control_handle.shutdown();
5616        }
5617        self.drop_without_shutdown();
5618        _result
5619    }
5620
5621    /// Similar to "send" but does not shutdown the channel if an error occurs.
5622    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
5623        let _result = self.send_raw();
5624        self.drop_without_shutdown();
5625        _result
5626    }
5627
5628    fn send_raw(&self) -> Result<(), fidl::Error> {
5629        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
5630            (),
5631            self.tx_id,
5632            0x1739a6ae36d5c5aa,
5633            fidl::encoding::DynamicFlags::empty(),
5634        )
5635    }
5636}
5637
5638#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5639pub struct LegacyJoiningConnectorMarker;
5640
5641impl fidl::endpoints::ProtocolMarker for LegacyJoiningConnectorMarker {
5642    type Proxy = LegacyJoiningConnectorProxy;
5643    type RequestStream = LegacyJoiningConnectorRequestStream;
5644    #[cfg(target_os = "fuchsia")]
5645    type SynchronousProxy = LegacyJoiningConnectorSynchronousProxy;
5646
5647    const DEBUG_NAME: &'static str = "fuchsia.lowpan.experimental.LegacyJoiningConnector";
5648}
5649impl fidl::endpoints::DiscoverableProtocolMarker for LegacyJoiningConnectorMarker {}
5650
5651pub trait LegacyJoiningConnectorProxyInterface: Send + Sync {
5652    fn r#connect(
5653        &self,
5654        name: &str,
5655        server_end: fidl::endpoints::ServerEnd<LegacyJoiningMarker>,
5656    ) -> Result<(), fidl::Error>;
5657}
5658#[derive(Debug)]
5659#[cfg(target_os = "fuchsia")]
5660pub struct LegacyJoiningConnectorSynchronousProxy {
5661    client: fidl::client::sync::Client,
5662}
5663
5664#[cfg(target_os = "fuchsia")]
5665impl fidl::endpoints::SynchronousProxy for LegacyJoiningConnectorSynchronousProxy {
5666    type Proxy = LegacyJoiningConnectorProxy;
5667    type Protocol = LegacyJoiningConnectorMarker;
5668
5669    fn from_channel(inner: fidl::Channel) -> Self {
5670        Self::new(inner)
5671    }
5672
5673    fn into_channel(self) -> fidl::Channel {
5674        self.client.into_channel()
5675    }
5676
5677    fn as_channel(&self) -> &fidl::Channel {
5678        self.client.as_channel()
5679    }
5680}
5681
5682#[cfg(target_os = "fuchsia")]
5683impl LegacyJoiningConnectorSynchronousProxy {
5684    pub fn new(channel: fidl::Channel) -> Self {
5685        Self { client: fidl::client::sync::Client::new(channel) }
5686    }
5687
5688    pub fn into_channel(self) -> fidl::Channel {
5689        self.client.into_channel()
5690    }
5691
5692    /// Waits until an event arrives and returns it. It is safe for other
5693    /// threads to make concurrent requests while waiting for an event.
5694    pub fn wait_for_event(
5695        &self,
5696        deadline: zx::MonotonicInstant,
5697    ) -> Result<LegacyJoiningConnectorEvent, fidl::Error> {
5698        LegacyJoiningConnectorEvent::decode(
5699            self.client.wait_for_event::<LegacyJoiningConnectorMarker>(deadline)?,
5700        )
5701    }
5702
5703    /// Connects to the [`LegacyJoining`] protocol on the
5704    /// named LoWPAN interface.
5705    ///
5706    /// The name of the interface can be learned by calling
5707    /// [`fuchsia.lowpan/Lookup.GetDevices`].
5708    ///
5709    /// If there is an error in processing this request
5710    /// the given channel is closed and an epitaph code used
5711    /// to describe the reason for the failure:
5712    ///
5713    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
5714    ///   was not formatted correctly or otherwise invalid.
5715    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
5716    ///   given name.
5717    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
5718    ///   does not support this protocol.
5719    pub fn r#connect(
5720        &self,
5721        mut name: &str,
5722        mut server_end: fidl::endpoints::ServerEnd<LegacyJoiningMarker>,
5723    ) -> Result<(), fidl::Error> {
5724        self.client.send::<LegacyJoiningConnectorConnectRequest>(
5725            (name, server_end),
5726            0x3c8dfeb943bb8d06,
5727            fidl::encoding::DynamicFlags::empty(),
5728        )
5729    }
5730}
5731
5732#[cfg(target_os = "fuchsia")]
5733impl From<LegacyJoiningConnectorSynchronousProxy> for zx::NullableHandle {
5734    fn from(value: LegacyJoiningConnectorSynchronousProxy) -> Self {
5735        value.into_channel().into()
5736    }
5737}
5738
5739#[cfg(target_os = "fuchsia")]
5740impl From<fidl::Channel> for LegacyJoiningConnectorSynchronousProxy {
5741    fn from(value: fidl::Channel) -> Self {
5742        Self::new(value)
5743    }
5744}
5745
5746#[cfg(target_os = "fuchsia")]
5747impl fidl::endpoints::FromClient for LegacyJoiningConnectorSynchronousProxy {
5748    type Protocol = LegacyJoiningConnectorMarker;
5749
5750    fn from_client(value: fidl::endpoints::ClientEnd<LegacyJoiningConnectorMarker>) -> Self {
5751        Self::new(value.into_channel())
5752    }
5753}
5754
5755#[derive(Debug, Clone)]
5756pub struct LegacyJoiningConnectorProxy {
5757    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5758}
5759
5760impl fidl::endpoints::Proxy for LegacyJoiningConnectorProxy {
5761    type Protocol = LegacyJoiningConnectorMarker;
5762
5763    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5764        Self::new(inner)
5765    }
5766
5767    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5768        self.client.into_channel().map_err(|client| Self { client })
5769    }
5770
5771    fn as_channel(&self) -> &::fidl::AsyncChannel {
5772        self.client.as_channel()
5773    }
5774}
5775
5776impl LegacyJoiningConnectorProxy {
5777    /// Create a new Proxy for fuchsia.lowpan.experimental/LegacyJoiningConnector.
5778    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5779        let protocol_name =
5780            <LegacyJoiningConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5781        Self { client: fidl::client::Client::new(channel, protocol_name) }
5782    }
5783
5784    /// Get a Stream of events from the remote end of the protocol.
5785    ///
5786    /// # Panics
5787    ///
5788    /// Panics if the event stream was already taken.
5789    pub fn take_event_stream(&self) -> LegacyJoiningConnectorEventStream {
5790        LegacyJoiningConnectorEventStream { event_receiver: self.client.take_event_receiver() }
5791    }
5792
5793    /// Connects to the [`LegacyJoining`] protocol on the
5794    /// named LoWPAN interface.
5795    ///
5796    /// The name of the interface can be learned by calling
5797    /// [`fuchsia.lowpan/Lookup.GetDevices`].
5798    ///
5799    /// If there is an error in processing this request
5800    /// the given channel is closed and an epitaph code used
5801    /// to describe the reason for the failure:
5802    ///
5803    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
5804    ///   was not formatted correctly or otherwise invalid.
5805    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
5806    ///   given name.
5807    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
5808    ///   does not support this protocol.
5809    pub fn r#connect(
5810        &self,
5811        mut name: &str,
5812        mut server_end: fidl::endpoints::ServerEnd<LegacyJoiningMarker>,
5813    ) -> Result<(), fidl::Error> {
5814        LegacyJoiningConnectorProxyInterface::r#connect(self, name, server_end)
5815    }
5816}
5817
5818impl LegacyJoiningConnectorProxyInterface for LegacyJoiningConnectorProxy {
5819    fn r#connect(
5820        &self,
5821        mut name: &str,
5822        mut server_end: fidl::endpoints::ServerEnd<LegacyJoiningMarker>,
5823    ) -> Result<(), fidl::Error> {
5824        self.client.send::<LegacyJoiningConnectorConnectRequest>(
5825            (name, server_end),
5826            0x3c8dfeb943bb8d06,
5827            fidl::encoding::DynamicFlags::empty(),
5828        )
5829    }
5830}
5831
5832pub struct LegacyJoiningConnectorEventStream {
5833    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5834}
5835
5836impl std::marker::Unpin for LegacyJoiningConnectorEventStream {}
5837
5838impl futures::stream::FusedStream for LegacyJoiningConnectorEventStream {
5839    fn is_terminated(&self) -> bool {
5840        self.event_receiver.is_terminated()
5841    }
5842}
5843
5844impl futures::Stream for LegacyJoiningConnectorEventStream {
5845    type Item = Result<LegacyJoiningConnectorEvent, fidl::Error>;
5846
5847    fn poll_next(
5848        mut self: std::pin::Pin<&mut Self>,
5849        cx: &mut std::task::Context<'_>,
5850    ) -> std::task::Poll<Option<Self::Item>> {
5851        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5852            &mut self.event_receiver,
5853            cx
5854        )?) {
5855            Some(buf) => std::task::Poll::Ready(Some(LegacyJoiningConnectorEvent::decode(buf))),
5856            None => std::task::Poll::Ready(None),
5857        }
5858    }
5859}
5860
5861#[derive(Debug)]
5862pub enum LegacyJoiningConnectorEvent {}
5863
5864impl LegacyJoiningConnectorEvent {
5865    /// Decodes a message buffer as a [`LegacyJoiningConnectorEvent`].
5866    fn decode(
5867        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5868    ) -> Result<LegacyJoiningConnectorEvent, fidl::Error> {
5869        let (bytes, _handles) = buf.split_mut();
5870        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5871        debug_assert_eq!(tx_header.tx_id, 0);
5872        match tx_header.ordinal {
5873            _ => Err(fidl::Error::UnknownOrdinal {
5874                ordinal: tx_header.ordinal,
5875                protocol_name:
5876                    <LegacyJoiningConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5877            }),
5878        }
5879    }
5880}
5881
5882/// A Stream of incoming requests for fuchsia.lowpan.experimental/LegacyJoiningConnector.
5883pub struct LegacyJoiningConnectorRequestStream {
5884    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5885    is_terminated: bool,
5886}
5887
5888impl std::marker::Unpin for LegacyJoiningConnectorRequestStream {}
5889
5890impl futures::stream::FusedStream for LegacyJoiningConnectorRequestStream {
5891    fn is_terminated(&self) -> bool {
5892        self.is_terminated
5893    }
5894}
5895
5896impl fidl::endpoints::RequestStream for LegacyJoiningConnectorRequestStream {
5897    type Protocol = LegacyJoiningConnectorMarker;
5898    type ControlHandle = LegacyJoiningConnectorControlHandle;
5899
5900    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5901        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5902    }
5903
5904    fn control_handle(&self) -> Self::ControlHandle {
5905        LegacyJoiningConnectorControlHandle { inner: self.inner.clone() }
5906    }
5907
5908    fn into_inner(
5909        self,
5910    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5911    {
5912        (self.inner, self.is_terminated)
5913    }
5914
5915    fn from_inner(
5916        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5917        is_terminated: bool,
5918    ) -> Self {
5919        Self { inner, is_terminated }
5920    }
5921}
5922
5923impl futures::Stream for LegacyJoiningConnectorRequestStream {
5924    type Item = Result<LegacyJoiningConnectorRequest, fidl::Error>;
5925
5926    fn poll_next(
5927        mut self: std::pin::Pin<&mut Self>,
5928        cx: &mut std::task::Context<'_>,
5929    ) -> std::task::Poll<Option<Self::Item>> {
5930        let this = &mut *self;
5931        if this.inner.check_shutdown(cx) {
5932            this.is_terminated = true;
5933            return std::task::Poll::Ready(None);
5934        }
5935        if this.is_terminated {
5936            panic!("polled LegacyJoiningConnectorRequestStream after completion");
5937        }
5938        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5939            |bytes, handles| {
5940                match this.inner.channel().read_etc(cx, bytes, handles) {
5941                    std::task::Poll::Ready(Ok(())) => {}
5942                    std::task::Poll::Pending => return std::task::Poll::Pending,
5943                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5944                        this.is_terminated = true;
5945                        return std::task::Poll::Ready(None);
5946                    }
5947                    std::task::Poll::Ready(Err(e)) => {
5948                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5949                            e.into(),
5950                        ))));
5951                    }
5952                }
5953
5954                // A message has been received from the channel
5955                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5956
5957                std::task::Poll::Ready(Some(match header.ordinal {
5958                0x3c8dfeb943bb8d06 => {
5959                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5960                    let mut req = fidl::new_empty!(LegacyJoiningConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
5961                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LegacyJoiningConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
5962                    let control_handle = LegacyJoiningConnectorControlHandle {
5963                        inner: this.inner.clone(),
5964                    };
5965                    Ok(LegacyJoiningConnectorRequest::Connect {name: req.name,
5966server_end: req.server_end,
5967
5968                        control_handle,
5969                    })
5970                }
5971                _ => Err(fidl::Error::UnknownOrdinal {
5972                    ordinal: header.ordinal,
5973                    protocol_name: <LegacyJoiningConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5974                }),
5975            }))
5976            },
5977        )
5978    }
5979}
5980
5981/// Protocol for connecting to [`LegacyJoining`] on a LoWPAN
5982/// interface.
5983#[derive(Debug)]
5984pub enum LegacyJoiningConnectorRequest {
5985    /// Connects to the [`LegacyJoining`] protocol on the
5986    /// named LoWPAN interface.
5987    ///
5988    /// The name of the interface can be learned by calling
5989    /// [`fuchsia.lowpan/Lookup.GetDevices`].
5990    ///
5991    /// If there is an error in processing this request
5992    /// the given channel is closed and an epitaph code used
5993    /// to describe the reason for the failure:
5994    ///
5995    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
5996    ///   was not formatted correctly or otherwise invalid.
5997    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
5998    ///   given name.
5999    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
6000    ///   does not support this protocol.
6001    Connect {
6002        name: String,
6003        server_end: fidl::endpoints::ServerEnd<LegacyJoiningMarker>,
6004        control_handle: LegacyJoiningConnectorControlHandle,
6005    },
6006}
6007
6008impl LegacyJoiningConnectorRequest {
6009    #[allow(irrefutable_let_patterns)]
6010    pub fn into_connect(
6011        self,
6012    ) -> Option<(
6013        String,
6014        fidl::endpoints::ServerEnd<LegacyJoiningMarker>,
6015        LegacyJoiningConnectorControlHandle,
6016    )> {
6017        if let LegacyJoiningConnectorRequest::Connect { name, server_end, control_handle } = self {
6018            Some((name, server_end, control_handle))
6019        } else {
6020            None
6021        }
6022    }
6023
6024    /// Name of the method defined in FIDL
6025    pub fn method_name(&self) -> &'static str {
6026        match *self {
6027            LegacyJoiningConnectorRequest::Connect { .. } => "connect",
6028        }
6029    }
6030}
6031
6032#[derive(Debug, Clone)]
6033pub struct LegacyJoiningConnectorControlHandle {
6034    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6035}
6036
6037impl fidl::endpoints::ControlHandle for LegacyJoiningConnectorControlHandle {
6038    fn shutdown(&self) {
6039        self.inner.shutdown()
6040    }
6041
6042    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6043        self.inner.shutdown_with_epitaph(status)
6044    }
6045
6046    fn is_closed(&self) -> bool {
6047        self.inner.channel().is_closed()
6048    }
6049    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6050        self.inner.channel().on_closed()
6051    }
6052
6053    #[cfg(target_os = "fuchsia")]
6054    fn signal_peer(
6055        &self,
6056        clear_mask: zx::Signals,
6057        set_mask: zx::Signals,
6058    ) -> Result<(), zx_status::Status> {
6059        use fidl::Peered;
6060        self.inner.channel().signal_peer(clear_mask, set_mask)
6061    }
6062}
6063
6064impl LegacyJoiningConnectorControlHandle {}
6065
6066#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6067pub struct ProvisioningMonitorMarker;
6068
6069impl fidl::endpoints::ProtocolMarker for ProvisioningMonitorMarker {
6070    type Proxy = ProvisioningMonitorProxy;
6071    type RequestStream = ProvisioningMonitorRequestStream;
6072    #[cfg(target_os = "fuchsia")]
6073    type SynchronousProxy = ProvisioningMonitorSynchronousProxy;
6074
6075    const DEBUG_NAME: &'static str = "(anonymous) ProvisioningMonitor";
6076}
6077pub type ProvisioningMonitorWatchProgressResult = Result<ProvisioningProgress, ProvisionError>;
6078
6079pub trait ProvisioningMonitorProxyInterface: Send + Sync {
6080    type WatchProgressResponseFut: std::future::Future<Output = Result<ProvisioningMonitorWatchProgressResult, fidl::Error>>
6081        + Send;
6082    fn r#watch_progress(&self) -> Self::WatchProgressResponseFut;
6083}
6084#[derive(Debug)]
6085#[cfg(target_os = "fuchsia")]
6086pub struct ProvisioningMonitorSynchronousProxy {
6087    client: fidl::client::sync::Client,
6088}
6089
6090#[cfg(target_os = "fuchsia")]
6091impl fidl::endpoints::SynchronousProxy for ProvisioningMonitorSynchronousProxy {
6092    type Proxy = ProvisioningMonitorProxy;
6093    type Protocol = ProvisioningMonitorMarker;
6094
6095    fn from_channel(inner: fidl::Channel) -> Self {
6096        Self::new(inner)
6097    }
6098
6099    fn into_channel(self) -> fidl::Channel {
6100        self.client.into_channel()
6101    }
6102
6103    fn as_channel(&self) -> &fidl::Channel {
6104        self.client.as_channel()
6105    }
6106}
6107
6108#[cfg(target_os = "fuchsia")]
6109impl ProvisioningMonitorSynchronousProxy {
6110    pub fn new(channel: fidl::Channel) -> Self {
6111        Self { client: fidl::client::sync::Client::new(channel) }
6112    }
6113
6114    pub fn into_channel(self) -> fidl::Channel {
6115        self.client.into_channel()
6116    }
6117
6118    /// Waits until an event arrives and returns it. It is safe for other
6119    /// threads to make concurrent requests while waiting for an event.
6120    pub fn wait_for_event(
6121        &self,
6122        deadline: zx::MonotonicInstant,
6123    ) -> Result<ProvisioningMonitorEvent, fidl::Error> {
6124        ProvisioningMonitorEvent::decode(
6125            self.client.wait_for_event::<ProvisioningMonitorMarker>(deadline)?,
6126        )
6127    }
6128
6129    /// Call this method to receive an update on the provisioning progress.
6130    ///
6131    /// When first called, this method will return immediately with the
6132    /// current status. On subsequent calls, it will block until the status
6133    /// changes.
6134    ///
6135    /// If provisioning error is encountered, it is returned as a
6136    /// [`ProvisionError`]. See the documentation for [`ProvisionError`]
6137    /// details on error handling.
6138    ///
6139    /// Once the method has either returned an identity or indicated a
6140    /// [`ProvisionError`], the ProvisioningMonitor will close with `ZX_OK`.
6141    pub fn r#watch_progress(
6142        &self,
6143        ___deadline: zx::MonotonicInstant,
6144    ) -> Result<ProvisioningMonitorWatchProgressResult, fidl::Error> {
6145        let _response =
6146            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
6147                ProvisioningMonitorWatchProgressResponse,
6148                ProvisionError,
6149            >, ProvisioningMonitorMarker>(
6150                (),
6151                0xc35336fc43ac0c,
6152                fidl::encoding::DynamicFlags::empty(),
6153                ___deadline,
6154            )?;
6155        Ok(_response.map(|x| x.progress))
6156    }
6157}
6158
6159#[cfg(target_os = "fuchsia")]
6160impl From<ProvisioningMonitorSynchronousProxy> for zx::NullableHandle {
6161    fn from(value: ProvisioningMonitorSynchronousProxy) -> Self {
6162        value.into_channel().into()
6163    }
6164}
6165
6166#[cfg(target_os = "fuchsia")]
6167impl From<fidl::Channel> for ProvisioningMonitorSynchronousProxy {
6168    fn from(value: fidl::Channel) -> Self {
6169        Self::new(value)
6170    }
6171}
6172
6173#[cfg(target_os = "fuchsia")]
6174impl fidl::endpoints::FromClient for ProvisioningMonitorSynchronousProxy {
6175    type Protocol = ProvisioningMonitorMarker;
6176
6177    fn from_client(value: fidl::endpoints::ClientEnd<ProvisioningMonitorMarker>) -> Self {
6178        Self::new(value.into_channel())
6179    }
6180}
6181
6182#[derive(Debug, Clone)]
6183pub struct ProvisioningMonitorProxy {
6184    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6185}
6186
6187impl fidl::endpoints::Proxy for ProvisioningMonitorProxy {
6188    type Protocol = ProvisioningMonitorMarker;
6189
6190    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6191        Self::new(inner)
6192    }
6193
6194    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6195        self.client.into_channel().map_err(|client| Self { client })
6196    }
6197
6198    fn as_channel(&self) -> &::fidl::AsyncChannel {
6199        self.client.as_channel()
6200    }
6201}
6202
6203impl ProvisioningMonitorProxy {
6204    /// Create a new Proxy for fuchsia.lowpan.experimental/ProvisioningMonitor.
6205    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6206        let protocol_name =
6207            <ProvisioningMonitorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6208        Self { client: fidl::client::Client::new(channel, protocol_name) }
6209    }
6210
6211    /// Get a Stream of events from the remote end of the protocol.
6212    ///
6213    /// # Panics
6214    ///
6215    /// Panics if the event stream was already taken.
6216    pub fn take_event_stream(&self) -> ProvisioningMonitorEventStream {
6217        ProvisioningMonitorEventStream { event_receiver: self.client.take_event_receiver() }
6218    }
6219
6220    /// Call this method to receive an update on the provisioning progress.
6221    ///
6222    /// When first called, this method will return immediately with the
6223    /// current status. On subsequent calls, it will block until the status
6224    /// changes.
6225    ///
6226    /// If provisioning error is encountered, it is returned as a
6227    /// [`ProvisionError`]. See the documentation for [`ProvisionError`]
6228    /// details on error handling.
6229    ///
6230    /// Once the method has either returned an identity or indicated a
6231    /// [`ProvisionError`], the ProvisioningMonitor will close with `ZX_OK`.
6232    pub fn r#watch_progress(
6233        &self,
6234    ) -> fidl::client::QueryResponseFut<
6235        ProvisioningMonitorWatchProgressResult,
6236        fidl::encoding::DefaultFuchsiaResourceDialect,
6237    > {
6238        ProvisioningMonitorProxyInterface::r#watch_progress(self)
6239    }
6240}
6241
6242impl ProvisioningMonitorProxyInterface for ProvisioningMonitorProxy {
6243    type WatchProgressResponseFut = fidl::client::QueryResponseFut<
6244        ProvisioningMonitorWatchProgressResult,
6245        fidl::encoding::DefaultFuchsiaResourceDialect,
6246    >;
6247    fn r#watch_progress(&self) -> Self::WatchProgressResponseFut {
6248        fn _decode(
6249            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6250        ) -> Result<ProvisioningMonitorWatchProgressResult, fidl::Error> {
6251            let _response = fidl::client::decode_transaction_body::<
6252                fidl::encoding::ResultType<
6253                    ProvisioningMonitorWatchProgressResponse,
6254                    ProvisionError,
6255                >,
6256                fidl::encoding::DefaultFuchsiaResourceDialect,
6257                0xc35336fc43ac0c,
6258            >(_buf?)?;
6259            Ok(_response.map(|x| x.progress))
6260        }
6261        self.client.send_query_and_decode::<
6262            fidl::encoding::EmptyPayload,
6263            ProvisioningMonitorWatchProgressResult,
6264        >(
6265            (),
6266            0xc35336fc43ac0c,
6267            fidl::encoding::DynamicFlags::empty(),
6268            _decode,
6269        )
6270    }
6271}
6272
6273pub struct ProvisioningMonitorEventStream {
6274    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6275}
6276
6277impl std::marker::Unpin for ProvisioningMonitorEventStream {}
6278
6279impl futures::stream::FusedStream for ProvisioningMonitorEventStream {
6280    fn is_terminated(&self) -> bool {
6281        self.event_receiver.is_terminated()
6282    }
6283}
6284
6285impl futures::Stream for ProvisioningMonitorEventStream {
6286    type Item = Result<ProvisioningMonitorEvent, fidl::Error>;
6287
6288    fn poll_next(
6289        mut self: std::pin::Pin<&mut Self>,
6290        cx: &mut std::task::Context<'_>,
6291    ) -> std::task::Poll<Option<Self::Item>> {
6292        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6293            &mut self.event_receiver,
6294            cx
6295        )?) {
6296            Some(buf) => std::task::Poll::Ready(Some(ProvisioningMonitorEvent::decode(buf))),
6297            None => std::task::Poll::Ready(None),
6298        }
6299    }
6300}
6301
6302#[derive(Debug)]
6303pub enum ProvisioningMonitorEvent {}
6304
6305impl ProvisioningMonitorEvent {
6306    /// Decodes a message buffer as a [`ProvisioningMonitorEvent`].
6307    fn decode(
6308        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6309    ) -> Result<ProvisioningMonitorEvent, fidl::Error> {
6310        let (bytes, _handles) = buf.split_mut();
6311        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6312        debug_assert_eq!(tx_header.tx_id, 0);
6313        match tx_header.ordinal {
6314            _ => Err(fidl::Error::UnknownOrdinal {
6315                ordinal: tx_header.ordinal,
6316                protocol_name:
6317                    <ProvisioningMonitorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6318            }),
6319        }
6320    }
6321}
6322
6323/// A Stream of incoming requests for fuchsia.lowpan.experimental/ProvisioningMonitor.
6324pub struct ProvisioningMonitorRequestStream {
6325    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6326    is_terminated: bool,
6327}
6328
6329impl std::marker::Unpin for ProvisioningMonitorRequestStream {}
6330
6331impl futures::stream::FusedStream for ProvisioningMonitorRequestStream {
6332    fn is_terminated(&self) -> bool {
6333        self.is_terminated
6334    }
6335}
6336
6337impl fidl::endpoints::RequestStream for ProvisioningMonitorRequestStream {
6338    type Protocol = ProvisioningMonitorMarker;
6339    type ControlHandle = ProvisioningMonitorControlHandle;
6340
6341    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6342        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6343    }
6344
6345    fn control_handle(&self) -> Self::ControlHandle {
6346        ProvisioningMonitorControlHandle { inner: self.inner.clone() }
6347    }
6348
6349    fn into_inner(
6350        self,
6351    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6352    {
6353        (self.inner, self.is_terminated)
6354    }
6355
6356    fn from_inner(
6357        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6358        is_terminated: bool,
6359    ) -> Self {
6360        Self { inner, is_terminated }
6361    }
6362}
6363
6364impl futures::Stream for ProvisioningMonitorRequestStream {
6365    type Item = Result<ProvisioningMonitorRequest, fidl::Error>;
6366
6367    fn poll_next(
6368        mut self: std::pin::Pin<&mut Self>,
6369        cx: &mut std::task::Context<'_>,
6370    ) -> std::task::Poll<Option<Self::Item>> {
6371        let this = &mut *self;
6372        if this.inner.check_shutdown(cx) {
6373            this.is_terminated = true;
6374            return std::task::Poll::Ready(None);
6375        }
6376        if this.is_terminated {
6377            panic!("polled ProvisioningMonitorRequestStream after completion");
6378        }
6379        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6380            |bytes, handles| {
6381                match this.inner.channel().read_etc(cx, bytes, handles) {
6382                    std::task::Poll::Ready(Ok(())) => {}
6383                    std::task::Poll::Pending => return std::task::Poll::Pending,
6384                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6385                        this.is_terminated = true;
6386                        return std::task::Poll::Ready(None);
6387                    }
6388                    std::task::Poll::Ready(Err(e)) => {
6389                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6390                            e.into(),
6391                        ))));
6392                    }
6393                }
6394
6395                // A message has been received from the channel
6396                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6397
6398                std::task::Poll::Ready(Some(match header.ordinal {
6399                0xc35336fc43ac0c => {
6400                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6401                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
6402                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6403                    let control_handle = ProvisioningMonitorControlHandle {
6404                        inner: this.inner.clone(),
6405                    };
6406                    Ok(ProvisioningMonitorRequest::WatchProgress {
6407                        responder: ProvisioningMonitorWatchProgressResponder {
6408                            control_handle: std::mem::ManuallyDrop::new(control_handle),
6409                            tx_id: header.tx_id,
6410                        },
6411                    })
6412                }
6413                _ => Err(fidl::Error::UnknownOrdinal {
6414                    ordinal: header.ordinal,
6415                    protocol_name: <ProvisioningMonitorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6416                }),
6417            }))
6418            },
6419        )
6420    }
6421}
6422
6423/// Reports the progress of a provisioning operation like Join or Form.
6424///
6425/// If there was a problem with the arguments passed to the originating
6426/// function (Join/Form) then the channel will be closed with `ZX_ERR_INVALID_ARGS`.
6427#[derive(Debug)]
6428pub enum ProvisioningMonitorRequest {
6429    /// Call this method to receive an update on the provisioning progress.
6430    ///
6431    /// When first called, this method will return immediately with the
6432    /// current status. On subsequent calls, it will block until the status
6433    /// changes.
6434    ///
6435    /// If provisioning error is encountered, it is returned as a
6436    /// [`ProvisionError`]. See the documentation for [`ProvisionError`]
6437    /// details on error handling.
6438    ///
6439    /// Once the method has either returned an identity or indicated a
6440    /// [`ProvisionError`], the ProvisioningMonitor will close with `ZX_OK`.
6441    WatchProgress { responder: ProvisioningMonitorWatchProgressResponder },
6442}
6443
6444impl ProvisioningMonitorRequest {
6445    #[allow(irrefutable_let_patterns)]
6446    pub fn into_watch_progress(self) -> Option<(ProvisioningMonitorWatchProgressResponder)> {
6447        if let ProvisioningMonitorRequest::WatchProgress { responder } = self {
6448            Some((responder))
6449        } else {
6450            None
6451        }
6452    }
6453
6454    /// Name of the method defined in FIDL
6455    pub fn method_name(&self) -> &'static str {
6456        match *self {
6457            ProvisioningMonitorRequest::WatchProgress { .. } => "watch_progress",
6458        }
6459    }
6460}
6461
6462#[derive(Debug, Clone)]
6463pub struct ProvisioningMonitorControlHandle {
6464    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6465}
6466
6467impl fidl::endpoints::ControlHandle for ProvisioningMonitorControlHandle {
6468    fn shutdown(&self) {
6469        self.inner.shutdown()
6470    }
6471
6472    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6473        self.inner.shutdown_with_epitaph(status)
6474    }
6475
6476    fn is_closed(&self) -> bool {
6477        self.inner.channel().is_closed()
6478    }
6479    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6480        self.inner.channel().on_closed()
6481    }
6482
6483    #[cfg(target_os = "fuchsia")]
6484    fn signal_peer(
6485        &self,
6486        clear_mask: zx::Signals,
6487        set_mask: zx::Signals,
6488    ) -> Result<(), zx_status::Status> {
6489        use fidl::Peered;
6490        self.inner.channel().signal_peer(clear_mask, set_mask)
6491    }
6492}
6493
6494impl ProvisioningMonitorControlHandle {}
6495
6496#[must_use = "FIDL methods require a response to be sent"]
6497#[derive(Debug)]
6498pub struct ProvisioningMonitorWatchProgressResponder {
6499    control_handle: std::mem::ManuallyDrop<ProvisioningMonitorControlHandle>,
6500    tx_id: u32,
6501}
6502
6503/// Set the the channel to be shutdown (see [`ProvisioningMonitorControlHandle::shutdown`])
6504/// if the responder is dropped without sending a response, so that the client
6505/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6506impl std::ops::Drop for ProvisioningMonitorWatchProgressResponder {
6507    fn drop(&mut self) {
6508        self.control_handle.shutdown();
6509        // Safety: drops once, never accessed again
6510        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6511    }
6512}
6513
6514impl fidl::endpoints::Responder for ProvisioningMonitorWatchProgressResponder {
6515    type ControlHandle = ProvisioningMonitorControlHandle;
6516
6517    fn control_handle(&self) -> &ProvisioningMonitorControlHandle {
6518        &self.control_handle
6519    }
6520
6521    fn drop_without_shutdown(mut self) {
6522        // Safety: drops once, never accessed again due to mem::forget
6523        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6524        // Prevent Drop from running (which would shut down the channel)
6525        std::mem::forget(self);
6526    }
6527}
6528
6529impl ProvisioningMonitorWatchProgressResponder {
6530    /// Sends a response to the FIDL transaction.
6531    ///
6532    /// Sets the channel to shutdown if an error occurs.
6533    pub fn send(
6534        self,
6535        mut result: Result<&ProvisioningProgress, ProvisionError>,
6536    ) -> Result<(), fidl::Error> {
6537        let _result = self.send_raw(result);
6538        if _result.is_err() {
6539            self.control_handle.shutdown();
6540        }
6541        self.drop_without_shutdown();
6542        _result
6543    }
6544
6545    /// Similar to "send" but does not shutdown the channel if an error occurs.
6546    pub fn send_no_shutdown_on_err(
6547        self,
6548        mut result: Result<&ProvisioningProgress, ProvisionError>,
6549    ) -> Result<(), fidl::Error> {
6550        let _result = self.send_raw(result);
6551        self.drop_without_shutdown();
6552        _result
6553    }
6554
6555    fn send_raw(
6556        &self,
6557        mut result: Result<&ProvisioningProgress, ProvisionError>,
6558    ) -> Result<(), fidl::Error> {
6559        self.control_handle.inner.send::<fidl::encoding::ResultType<
6560            ProvisioningMonitorWatchProgressResponse,
6561            ProvisionError,
6562        >>(
6563            result.map(|progress| (progress,)),
6564            self.tx_id,
6565            0xc35336fc43ac0c,
6566            fidl::encoding::DynamicFlags::empty(),
6567        )
6568    }
6569}
6570
6571#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6572pub struct TelemetryProviderMarker;
6573
6574impl fidl::endpoints::ProtocolMarker for TelemetryProviderMarker {
6575    type Proxy = TelemetryProviderProxy;
6576    type RequestStream = TelemetryProviderRequestStream;
6577    #[cfg(target_os = "fuchsia")]
6578    type SynchronousProxy = TelemetryProviderSynchronousProxy;
6579
6580    const DEBUG_NAME: &'static str = "(anonymous) TelemetryProvider";
6581}
6582
6583pub trait TelemetryProviderProxyInterface: Send + Sync {
6584    type GetTelemetryResponseFut: std::future::Future<Output = Result<Telemetry, fidl::Error>>
6585        + Send;
6586    fn r#get_telemetry(&self) -> Self::GetTelemetryResponseFut;
6587}
6588#[derive(Debug)]
6589#[cfg(target_os = "fuchsia")]
6590pub struct TelemetryProviderSynchronousProxy {
6591    client: fidl::client::sync::Client,
6592}
6593
6594#[cfg(target_os = "fuchsia")]
6595impl fidl::endpoints::SynchronousProxy for TelemetryProviderSynchronousProxy {
6596    type Proxy = TelemetryProviderProxy;
6597    type Protocol = TelemetryProviderMarker;
6598
6599    fn from_channel(inner: fidl::Channel) -> Self {
6600        Self::new(inner)
6601    }
6602
6603    fn into_channel(self) -> fidl::Channel {
6604        self.client.into_channel()
6605    }
6606
6607    fn as_channel(&self) -> &fidl::Channel {
6608        self.client.as_channel()
6609    }
6610}
6611
6612#[cfg(target_os = "fuchsia")]
6613impl TelemetryProviderSynchronousProxy {
6614    pub fn new(channel: fidl::Channel) -> Self {
6615        Self { client: fidl::client::sync::Client::new(channel) }
6616    }
6617
6618    pub fn into_channel(self) -> fidl::Channel {
6619        self.client.into_channel()
6620    }
6621
6622    /// Waits until an event arrives and returns it. It is safe for other
6623    /// threads to make concurrent requests while waiting for an event.
6624    pub fn wait_for_event(
6625        &self,
6626        deadline: zx::MonotonicInstant,
6627    ) -> Result<TelemetryProviderEvent, fidl::Error> {
6628        TelemetryProviderEvent::decode(
6629            self.client.wait_for_event::<TelemetryProviderMarker>(deadline)?,
6630        )
6631    }
6632
6633    /// Returns a snapshot the telemetry information table.
6634    pub fn r#get_telemetry(
6635        &self,
6636        ___deadline: zx::MonotonicInstant,
6637    ) -> Result<Telemetry, fidl::Error> {
6638        let _response = self.client.send_query::<
6639            fidl::encoding::EmptyPayload,
6640            TelemetryProviderGetTelemetryResponse,
6641            TelemetryProviderMarker,
6642        >(
6643            (),
6644            0xc34f2fff7dacc41,
6645            fidl::encoding::DynamicFlags::empty(),
6646            ___deadline,
6647        )?;
6648        Ok(_response.telemetry)
6649    }
6650}
6651
6652#[cfg(target_os = "fuchsia")]
6653impl From<TelemetryProviderSynchronousProxy> for zx::NullableHandle {
6654    fn from(value: TelemetryProviderSynchronousProxy) -> Self {
6655        value.into_channel().into()
6656    }
6657}
6658
6659#[cfg(target_os = "fuchsia")]
6660impl From<fidl::Channel> for TelemetryProviderSynchronousProxy {
6661    fn from(value: fidl::Channel) -> Self {
6662        Self::new(value)
6663    }
6664}
6665
6666#[cfg(target_os = "fuchsia")]
6667impl fidl::endpoints::FromClient for TelemetryProviderSynchronousProxy {
6668    type Protocol = TelemetryProviderMarker;
6669
6670    fn from_client(value: fidl::endpoints::ClientEnd<TelemetryProviderMarker>) -> Self {
6671        Self::new(value.into_channel())
6672    }
6673}
6674
6675#[derive(Debug, Clone)]
6676pub struct TelemetryProviderProxy {
6677    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6678}
6679
6680impl fidl::endpoints::Proxy for TelemetryProviderProxy {
6681    type Protocol = TelemetryProviderMarker;
6682
6683    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6684        Self::new(inner)
6685    }
6686
6687    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6688        self.client.into_channel().map_err(|client| Self { client })
6689    }
6690
6691    fn as_channel(&self) -> &::fidl::AsyncChannel {
6692        self.client.as_channel()
6693    }
6694}
6695
6696impl TelemetryProviderProxy {
6697    /// Create a new Proxy for fuchsia.lowpan.experimental/TelemetryProvider.
6698    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6699        let protocol_name =
6700            <TelemetryProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6701        Self { client: fidl::client::Client::new(channel, protocol_name) }
6702    }
6703
6704    /// Get a Stream of events from the remote end of the protocol.
6705    ///
6706    /// # Panics
6707    ///
6708    /// Panics if the event stream was already taken.
6709    pub fn take_event_stream(&self) -> TelemetryProviderEventStream {
6710        TelemetryProviderEventStream { event_receiver: self.client.take_event_receiver() }
6711    }
6712
6713    /// Returns a snapshot the telemetry information table.
6714    pub fn r#get_telemetry(
6715        &self,
6716    ) -> fidl::client::QueryResponseFut<Telemetry, fidl::encoding::DefaultFuchsiaResourceDialect>
6717    {
6718        TelemetryProviderProxyInterface::r#get_telemetry(self)
6719    }
6720}
6721
6722impl TelemetryProviderProxyInterface for TelemetryProviderProxy {
6723    type GetTelemetryResponseFut =
6724        fidl::client::QueryResponseFut<Telemetry, fidl::encoding::DefaultFuchsiaResourceDialect>;
6725    fn r#get_telemetry(&self) -> Self::GetTelemetryResponseFut {
6726        fn _decode(
6727            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6728        ) -> Result<Telemetry, fidl::Error> {
6729            let _response = fidl::client::decode_transaction_body::<
6730                TelemetryProviderGetTelemetryResponse,
6731                fidl::encoding::DefaultFuchsiaResourceDialect,
6732                0xc34f2fff7dacc41,
6733            >(_buf?)?;
6734            Ok(_response.telemetry)
6735        }
6736        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Telemetry>(
6737            (),
6738            0xc34f2fff7dacc41,
6739            fidl::encoding::DynamicFlags::empty(),
6740            _decode,
6741        )
6742    }
6743}
6744
6745pub struct TelemetryProviderEventStream {
6746    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6747}
6748
6749impl std::marker::Unpin for TelemetryProviderEventStream {}
6750
6751impl futures::stream::FusedStream for TelemetryProviderEventStream {
6752    fn is_terminated(&self) -> bool {
6753        self.event_receiver.is_terminated()
6754    }
6755}
6756
6757impl futures::Stream for TelemetryProviderEventStream {
6758    type Item = Result<TelemetryProviderEvent, fidl::Error>;
6759
6760    fn poll_next(
6761        mut self: std::pin::Pin<&mut Self>,
6762        cx: &mut std::task::Context<'_>,
6763    ) -> std::task::Poll<Option<Self::Item>> {
6764        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6765            &mut self.event_receiver,
6766            cx
6767        )?) {
6768            Some(buf) => std::task::Poll::Ready(Some(TelemetryProviderEvent::decode(buf))),
6769            None => std::task::Poll::Ready(None),
6770        }
6771    }
6772}
6773
6774#[derive(Debug)]
6775pub enum TelemetryProviderEvent {}
6776
6777impl TelemetryProviderEvent {
6778    /// Decodes a message buffer as a [`TelemetryProviderEvent`].
6779    fn decode(
6780        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6781    ) -> Result<TelemetryProviderEvent, fidl::Error> {
6782        let (bytes, _handles) = buf.split_mut();
6783        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6784        debug_assert_eq!(tx_header.tx_id, 0);
6785        match tx_header.ordinal {
6786            _ => Err(fidl::Error::UnknownOrdinal {
6787                ordinal: tx_header.ordinal,
6788                protocol_name:
6789                    <TelemetryProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6790            }),
6791        }
6792    }
6793}
6794
6795/// A Stream of incoming requests for fuchsia.lowpan.experimental/TelemetryProvider.
6796pub struct TelemetryProviderRequestStream {
6797    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6798    is_terminated: bool,
6799}
6800
6801impl std::marker::Unpin for TelemetryProviderRequestStream {}
6802
6803impl futures::stream::FusedStream for TelemetryProviderRequestStream {
6804    fn is_terminated(&self) -> bool {
6805        self.is_terminated
6806    }
6807}
6808
6809impl fidl::endpoints::RequestStream for TelemetryProviderRequestStream {
6810    type Protocol = TelemetryProviderMarker;
6811    type ControlHandle = TelemetryProviderControlHandle;
6812
6813    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6814        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6815    }
6816
6817    fn control_handle(&self) -> Self::ControlHandle {
6818        TelemetryProviderControlHandle { inner: self.inner.clone() }
6819    }
6820
6821    fn into_inner(
6822        self,
6823    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6824    {
6825        (self.inner, self.is_terminated)
6826    }
6827
6828    fn from_inner(
6829        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6830        is_terminated: bool,
6831    ) -> Self {
6832        Self { inner, is_terminated }
6833    }
6834}
6835
6836impl futures::Stream for TelemetryProviderRequestStream {
6837    type Item = Result<TelemetryProviderRequest, fidl::Error>;
6838
6839    fn poll_next(
6840        mut self: std::pin::Pin<&mut Self>,
6841        cx: &mut std::task::Context<'_>,
6842    ) -> std::task::Poll<Option<Self::Item>> {
6843        let this = &mut *self;
6844        if this.inner.check_shutdown(cx) {
6845            this.is_terminated = true;
6846            return std::task::Poll::Ready(None);
6847        }
6848        if this.is_terminated {
6849            panic!("polled TelemetryProviderRequestStream after completion");
6850        }
6851        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6852            |bytes, handles| {
6853                match this.inner.channel().read_etc(cx, bytes, handles) {
6854                    std::task::Poll::Ready(Ok(())) => {}
6855                    std::task::Poll::Pending => return std::task::Poll::Pending,
6856                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6857                        this.is_terminated = true;
6858                        return std::task::Poll::Ready(None);
6859                    }
6860                    std::task::Poll::Ready(Err(e)) => {
6861                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6862                            e.into(),
6863                        ))));
6864                    }
6865                }
6866
6867                // A message has been received from the channel
6868                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6869
6870                std::task::Poll::Ready(Some(match header.ordinal {
6871                    0xc34f2fff7dacc41 => {
6872                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6873                        let mut req = fidl::new_empty!(
6874                            fidl::encoding::EmptyPayload,
6875                            fidl::encoding::DefaultFuchsiaResourceDialect
6876                        );
6877                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6878                        let control_handle =
6879                            TelemetryProviderControlHandle { inner: this.inner.clone() };
6880                        Ok(TelemetryProviderRequest::GetTelemetry {
6881                            responder: TelemetryProviderGetTelemetryResponder {
6882                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6883                                tx_id: header.tx_id,
6884                            },
6885                        })
6886                    }
6887                    _ => Err(fidl::Error::UnknownOrdinal {
6888                        ordinal: header.ordinal,
6889                        protocol_name:
6890                            <TelemetryProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6891                    }),
6892                }))
6893            },
6894        )
6895    }
6896}
6897
6898/// Provides telemetry data for an individual interface to the LoWPAN service.
6899#[derive(Debug)]
6900pub enum TelemetryProviderRequest {
6901    /// Returns a snapshot the telemetry information table.
6902    GetTelemetry { responder: TelemetryProviderGetTelemetryResponder },
6903}
6904
6905impl TelemetryProviderRequest {
6906    #[allow(irrefutable_let_patterns)]
6907    pub fn into_get_telemetry(self) -> Option<(TelemetryProviderGetTelemetryResponder)> {
6908        if let TelemetryProviderRequest::GetTelemetry { responder } = self {
6909            Some((responder))
6910        } else {
6911            None
6912        }
6913    }
6914
6915    /// Name of the method defined in FIDL
6916    pub fn method_name(&self) -> &'static str {
6917        match *self {
6918            TelemetryProviderRequest::GetTelemetry { .. } => "get_telemetry",
6919        }
6920    }
6921}
6922
6923#[derive(Debug, Clone)]
6924pub struct TelemetryProviderControlHandle {
6925    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6926}
6927
6928impl fidl::endpoints::ControlHandle for TelemetryProviderControlHandle {
6929    fn shutdown(&self) {
6930        self.inner.shutdown()
6931    }
6932
6933    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6934        self.inner.shutdown_with_epitaph(status)
6935    }
6936
6937    fn is_closed(&self) -> bool {
6938        self.inner.channel().is_closed()
6939    }
6940    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6941        self.inner.channel().on_closed()
6942    }
6943
6944    #[cfg(target_os = "fuchsia")]
6945    fn signal_peer(
6946        &self,
6947        clear_mask: zx::Signals,
6948        set_mask: zx::Signals,
6949    ) -> Result<(), zx_status::Status> {
6950        use fidl::Peered;
6951        self.inner.channel().signal_peer(clear_mask, set_mask)
6952    }
6953}
6954
6955impl TelemetryProviderControlHandle {}
6956
6957#[must_use = "FIDL methods require a response to be sent"]
6958#[derive(Debug)]
6959pub struct TelemetryProviderGetTelemetryResponder {
6960    control_handle: std::mem::ManuallyDrop<TelemetryProviderControlHandle>,
6961    tx_id: u32,
6962}
6963
6964/// Set the the channel to be shutdown (see [`TelemetryProviderControlHandle::shutdown`])
6965/// if the responder is dropped without sending a response, so that the client
6966/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6967impl std::ops::Drop for TelemetryProviderGetTelemetryResponder {
6968    fn drop(&mut self) {
6969        self.control_handle.shutdown();
6970        // Safety: drops once, never accessed again
6971        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6972    }
6973}
6974
6975impl fidl::endpoints::Responder for TelemetryProviderGetTelemetryResponder {
6976    type ControlHandle = TelemetryProviderControlHandle;
6977
6978    fn control_handle(&self) -> &TelemetryProviderControlHandle {
6979        &self.control_handle
6980    }
6981
6982    fn drop_without_shutdown(mut self) {
6983        // Safety: drops once, never accessed again due to mem::forget
6984        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6985        // Prevent Drop from running (which would shut down the channel)
6986        std::mem::forget(self);
6987    }
6988}
6989
6990impl TelemetryProviderGetTelemetryResponder {
6991    /// Sends a response to the FIDL transaction.
6992    ///
6993    /// Sets the channel to shutdown if an error occurs.
6994    pub fn send(self, mut telemetry: &Telemetry) -> Result<(), fidl::Error> {
6995        let _result = self.send_raw(telemetry);
6996        if _result.is_err() {
6997            self.control_handle.shutdown();
6998        }
6999        self.drop_without_shutdown();
7000        _result
7001    }
7002
7003    /// Similar to "send" but does not shutdown the channel if an error occurs.
7004    pub fn send_no_shutdown_on_err(self, mut telemetry: &Telemetry) -> Result<(), fidl::Error> {
7005        let _result = self.send_raw(telemetry);
7006        self.drop_without_shutdown();
7007        _result
7008    }
7009
7010    fn send_raw(&self, mut telemetry: &Telemetry) -> Result<(), fidl::Error> {
7011        self.control_handle.inner.send::<TelemetryProviderGetTelemetryResponse>(
7012            (telemetry,),
7013            self.tx_id,
7014            0xc34f2fff7dacc41,
7015            fidl::encoding::DynamicFlags::empty(),
7016        )
7017    }
7018}
7019
7020#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7021pub struct TelemetryProviderConnectorMarker;
7022
7023impl fidl::endpoints::ProtocolMarker for TelemetryProviderConnectorMarker {
7024    type Proxy = TelemetryProviderConnectorProxy;
7025    type RequestStream = TelemetryProviderConnectorRequestStream;
7026    #[cfg(target_os = "fuchsia")]
7027    type SynchronousProxy = TelemetryProviderConnectorSynchronousProxy;
7028
7029    const DEBUG_NAME: &'static str = "fuchsia.lowpan.experimental.TelemetryProviderConnector";
7030}
7031impl fidl::endpoints::DiscoverableProtocolMarker for TelemetryProviderConnectorMarker {}
7032
7033pub trait TelemetryProviderConnectorProxyInterface: Send + Sync {
7034    fn r#connect(
7035        &self,
7036        name: &str,
7037        server_end: fidl::endpoints::ServerEnd<TelemetryProviderMarker>,
7038    ) -> Result<(), fidl::Error>;
7039}
7040#[derive(Debug)]
7041#[cfg(target_os = "fuchsia")]
7042pub struct TelemetryProviderConnectorSynchronousProxy {
7043    client: fidl::client::sync::Client,
7044}
7045
7046#[cfg(target_os = "fuchsia")]
7047impl fidl::endpoints::SynchronousProxy for TelemetryProviderConnectorSynchronousProxy {
7048    type Proxy = TelemetryProviderConnectorProxy;
7049    type Protocol = TelemetryProviderConnectorMarker;
7050
7051    fn from_channel(inner: fidl::Channel) -> Self {
7052        Self::new(inner)
7053    }
7054
7055    fn into_channel(self) -> fidl::Channel {
7056        self.client.into_channel()
7057    }
7058
7059    fn as_channel(&self) -> &fidl::Channel {
7060        self.client.as_channel()
7061    }
7062}
7063
7064#[cfg(target_os = "fuchsia")]
7065impl TelemetryProviderConnectorSynchronousProxy {
7066    pub fn new(channel: fidl::Channel) -> Self {
7067        Self { client: fidl::client::sync::Client::new(channel) }
7068    }
7069
7070    pub fn into_channel(self) -> fidl::Channel {
7071        self.client.into_channel()
7072    }
7073
7074    /// Waits until an event arrives and returns it. It is safe for other
7075    /// threads to make concurrent requests while waiting for an event.
7076    pub fn wait_for_event(
7077        &self,
7078        deadline: zx::MonotonicInstant,
7079    ) -> Result<TelemetryProviderConnectorEvent, fidl::Error> {
7080        TelemetryProviderConnectorEvent::decode(
7081            self.client.wait_for_event::<TelemetryProviderConnectorMarker>(deadline)?,
7082        )
7083    }
7084
7085    /// Connects to the [`TelemetryProvider`] protocol on the named LoWPAN interface.
7086    ///
7087    /// The name of the interface can be learned by calling [`fuchsia.lowpan/Lookup.GetDevices`].
7088    ///
7089    /// If there is an error in processing this request the given channel is closed and an epitaph
7090    /// code used to describe the reason for the failure:
7091    ///
7092    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name was not formatted correctly or
7093    ///   otherwise invalid.
7094    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the given name.
7095    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but does not support this protocol.
7096    pub fn r#connect(
7097        &self,
7098        mut name: &str,
7099        mut server_end: fidl::endpoints::ServerEnd<TelemetryProviderMarker>,
7100    ) -> Result<(), fidl::Error> {
7101        self.client.send::<TelemetryProviderConnectorConnectRequest>(
7102            (name, server_end),
7103            0x24a5bf1be73e2fad,
7104            fidl::encoding::DynamicFlags::empty(),
7105        )
7106    }
7107}
7108
7109#[cfg(target_os = "fuchsia")]
7110impl From<TelemetryProviderConnectorSynchronousProxy> for zx::NullableHandle {
7111    fn from(value: TelemetryProviderConnectorSynchronousProxy) -> Self {
7112        value.into_channel().into()
7113    }
7114}
7115
7116#[cfg(target_os = "fuchsia")]
7117impl From<fidl::Channel> for TelemetryProviderConnectorSynchronousProxy {
7118    fn from(value: fidl::Channel) -> Self {
7119        Self::new(value)
7120    }
7121}
7122
7123#[cfg(target_os = "fuchsia")]
7124impl fidl::endpoints::FromClient for TelemetryProviderConnectorSynchronousProxy {
7125    type Protocol = TelemetryProviderConnectorMarker;
7126
7127    fn from_client(value: fidl::endpoints::ClientEnd<TelemetryProviderConnectorMarker>) -> Self {
7128        Self::new(value.into_channel())
7129    }
7130}
7131
7132#[derive(Debug, Clone)]
7133pub struct TelemetryProviderConnectorProxy {
7134    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7135}
7136
7137impl fidl::endpoints::Proxy for TelemetryProviderConnectorProxy {
7138    type Protocol = TelemetryProviderConnectorMarker;
7139
7140    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7141        Self::new(inner)
7142    }
7143
7144    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7145        self.client.into_channel().map_err(|client| Self { client })
7146    }
7147
7148    fn as_channel(&self) -> &::fidl::AsyncChannel {
7149        self.client.as_channel()
7150    }
7151}
7152
7153impl TelemetryProviderConnectorProxy {
7154    /// Create a new Proxy for fuchsia.lowpan.experimental/TelemetryProviderConnector.
7155    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7156        let protocol_name =
7157            <TelemetryProviderConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7158        Self { client: fidl::client::Client::new(channel, protocol_name) }
7159    }
7160
7161    /// Get a Stream of events from the remote end of the protocol.
7162    ///
7163    /// # Panics
7164    ///
7165    /// Panics if the event stream was already taken.
7166    pub fn take_event_stream(&self) -> TelemetryProviderConnectorEventStream {
7167        TelemetryProviderConnectorEventStream { event_receiver: self.client.take_event_receiver() }
7168    }
7169
7170    /// Connects to the [`TelemetryProvider`] protocol on the named LoWPAN interface.
7171    ///
7172    /// The name of the interface can be learned by calling [`fuchsia.lowpan/Lookup.GetDevices`].
7173    ///
7174    /// If there is an error in processing this request the given channel is closed and an epitaph
7175    /// code used to describe the reason for the failure:
7176    ///
7177    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name was not formatted correctly or
7178    ///   otherwise invalid.
7179    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the given name.
7180    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but does not support this protocol.
7181    pub fn r#connect(
7182        &self,
7183        mut name: &str,
7184        mut server_end: fidl::endpoints::ServerEnd<TelemetryProviderMarker>,
7185    ) -> Result<(), fidl::Error> {
7186        TelemetryProviderConnectorProxyInterface::r#connect(self, name, server_end)
7187    }
7188}
7189
7190impl TelemetryProviderConnectorProxyInterface for TelemetryProviderConnectorProxy {
7191    fn r#connect(
7192        &self,
7193        mut name: &str,
7194        mut server_end: fidl::endpoints::ServerEnd<TelemetryProviderMarker>,
7195    ) -> Result<(), fidl::Error> {
7196        self.client.send::<TelemetryProviderConnectorConnectRequest>(
7197            (name, server_end),
7198            0x24a5bf1be73e2fad,
7199            fidl::encoding::DynamicFlags::empty(),
7200        )
7201    }
7202}
7203
7204pub struct TelemetryProviderConnectorEventStream {
7205    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7206}
7207
7208impl std::marker::Unpin for TelemetryProviderConnectorEventStream {}
7209
7210impl futures::stream::FusedStream for TelemetryProviderConnectorEventStream {
7211    fn is_terminated(&self) -> bool {
7212        self.event_receiver.is_terminated()
7213    }
7214}
7215
7216impl futures::Stream for TelemetryProviderConnectorEventStream {
7217    type Item = Result<TelemetryProviderConnectorEvent, fidl::Error>;
7218
7219    fn poll_next(
7220        mut self: std::pin::Pin<&mut Self>,
7221        cx: &mut std::task::Context<'_>,
7222    ) -> std::task::Poll<Option<Self::Item>> {
7223        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7224            &mut self.event_receiver,
7225            cx
7226        )?) {
7227            Some(buf) => std::task::Poll::Ready(Some(TelemetryProviderConnectorEvent::decode(buf))),
7228            None => std::task::Poll::Ready(None),
7229        }
7230    }
7231}
7232
7233#[derive(Debug)]
7234pub enum TelemetryProviderConnectorEvent {}
7235
7236impl TelemetryProviderConnectorEvent {
7237    /// Decodes a message buffer as a [`TelemetryProviderConnectorEvent`].
7238    fn decode(
7239        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7240    ) -> Result<TelemetryProviderConnectorEvent, fidl::Error> {
7241        let (bytes, _handles) = buf.split_mut();
7242        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7243        debug_assert_eq!(tx_header.tx_id, 0);
7244        match tx_header.ordinal {
7245            _ => Err(fidl::Error::UnknownOrdinal {
7246                ordinal: tx_header.ordinal,
7247                protocol_name: <TelemetryProviderConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7248            })
7249        }
7250    }
7251}
7252
7253/// A Stream of incoming requests for fuchsia.lowpan.experimental/TelemetryProviderConnector.
7254pub struct TelemetryProviderConnectorRequestStream {
7255    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7256    is_terminated: bool,
7257}
7258
7259impl std::marker::Unpin for TelemetryProviderConnectorRequestStream {}
7260
7261impl futures::stream::FusedStream for TelemetryProviderConnectorRequestStream {
7262    fn is_terminated(&self) -> bool {
7263        self.is_terminated
7264    }
7265}
7266
7267impl fidl::endpoints::RequestStream for TelemetryProviderConnectorRequestStream {
7268    type Protocol = TelemetryProviderConnectorMarker;
7269    type ControlHandle = TelemetryProviderConnectorControlHandle;
7270
7271    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7272        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7273    }
7274
7275    fn control_handle(&self) -> Self::ControlHandle {
7276        TelemetryProviderConnectorControlHandle { inner: self.inner.clone() }
7277    }
7278
7279    fn into_inner(
7280        self,
7281    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7282    {
7283        (self.inner, self.is_terminated)
7284    }
7285
7286    fn from_inner(
7287        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7288        is_terminated: bool,
7289    ) -> Self {
7290        Self { inner, is_terminated }
7291    }
7292}
7293
7294impl futures::Stream for TelemetryProviderConnectorRequestStream {
7295    type Item = Result<TelemetryProviderConnectorRequest, fidl::Error>;
7296
7297    fn poll_next(
7298        mut self: std::pin::Pin<&mut Self>,
7299        cx: &mut std::task::Context<'_>,
7300    ) -> std::task::Poll<Option<Self::Item>> {
7301        let this = &mut *self;
7302        if this.inner.check_shutdown(cx) {
7303            this.is_terminated = true;
7304            return std::task::Poll::Ready(None);
7305        }
7306        if this.is_terminated {
7307            panic!("polled TelemetryProviderConnectorRequestStream after completion");
7308        }
7309        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7310            |bytes, handles| {
7311                match this.inner.channel().read_etc(cx, bytes, handles) {
7312                    std::task::Poll::Ready(Ok(())) => {}
7313                    std::task::Poll::Pending => return std::task::Poll::Pending,
7314                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7315                        this.is_terminated = true;
7316                        return std::task::Poll::Ready(None);
7317                    }
7318                    std::task::Poll::Ready(Err(e)) => {
7319                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7320                            e.into(),
7321                        ))));
7322                    }
7323                }
7324
7325                // A message has been received from the channel
7326                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7327
7328                std::task::Poll::Ready(Some(match header.ordinal {
7329                0x24a5bf1be73e2fad => {
7330                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
7331                    let mut req = fidl::new_empty!(TelemetryProviderConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
7332                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TelemetryProviderConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
7333                    let control_handle = TelemetryProviderConnectorControlHandle {
7334                        inner: this.inner.clone(),
7335                    };
7336                    Ok(TelemetryProviderConnectorRequest::Connect {name: req.name,
7337server_end: req.server_end,
7338
7339                        control_handle,
7340                    })
7341                }
7342                _ => Err(fidl::Error::UnknownOrdinal {
7343                    ordinal: header.ordinal,
7344                    protocol_name: <TelemetryProviderConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7345                }),
7346            }))
7347            },
7348        )
7349    }
7350}
7351
7352/// Protocol for connecting to [`TelemetryProvider`] on a LoWPAN interface.
7353#[derive(Debug)]
7354pub enum TelemetryProviderConnectorRequest {
7355    /// Connects to the [`TelemetryProvider`] protocol on the named LoWPAN interface.
7356    ///
7357    /// The name of the interface can be learned by calling [`fuchsia.lowpan/Lookup.GetDevices`].
7358    ///
7359    /// If there is an error in processing this request the given channel is closed and an epitaph
7360    /// code used to describe the reason for the failure:
7361    ///
7362    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name was not formatted correctly or
7363    ///   otherwise invalid.
7364    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the given name.
7365    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but does not support this protocol.
7366    Connect {
7367        name: String,
7368        server_end: fidl::endpoints::ServerEnd<TelemetryProviderMarker>,
7369        control_handle: TelemetryProviderConnectorControlHandle,
7370    },
7371}
7372
7373impl TelemetryProviderConnectorRequest {
7374    #[allow(irrefutable_let_patterns)]
7375    pub fn into_connect(
7376        self,
7377    ) -> Option<(
7378        String,
7379        fidl::endpoints::ServerEnd<TelemetryProviderMarker>,
7380        TelemetryProviderConnectorControlHandle,
7381    )> {
7382        if let TelemetryProviderConnectorRequest::Connect { name, server_end, control_handle } =
7383            self
7384        {
7385            Some((name, server_end, control_handle))
7386        } else {
7387            None
7388        }
7389    }
7390
7391    /// Name of the method defined in FIDL
7392    pub fn method_name(&self) -> &'static str {
7393        match *self {
7394            TelemetryProviderConnectorRequest::Connect { .. } => "connect",
7395        }
7396    }
7397}
7398
7399#[derive(Debug, Clone)]
7400pub struct TelemetryProviderConnectorControlHandle {
7401    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7402}
7403
7404impl fidl::endpoints::ControlHandle for TelemetryProviderConnectorControlHandle {
7405    fn shutdown(&self) {
7406        self.inner.shutdown()
7407    }
7408
7409    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7410        self.inner.shutdown_with_epitaph(status)
7411    }
7412
7413    fn is_closed(&self) -> bool {
7414        self.inner.channel().is_closed()
7415    }
7416    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7417        self.inner.channel().on_closed()
7418    }
7419
7420    #[cfg(target_os = "fuchsia")]
7421    fn signal_peer(
7422        &self,
7423        clear_mask: zx::Signals,
7424        set_mask: zx::Signals,
7425    ) -> Result<(), zx_status::Status> {
7426        use fidl::Peered;
7427        self.inner.channel().signal_peer(clear_mask, set_mask)
7428    }
7429}
7430
7431impl TelemetryProviderConnectorControlHandle {}
7432
7433mod internal {
7434    use super::*;
7435
7436    impl fidl::encoding::ResourceTypeMarker for DeviceConnectorConnectRequest {
7437        type Borrowed<'a> = &'a mut Self;
7438        fn take_or_borrow<'a>(
7439            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7440        ) -> Self::Borrowed<'a> {
7441            value
7442        }
7443    }
7444
7445    unsafe impl fidl::encoding::TypeMarker for DeviceConnectorConnectRequest {
7446        type Owned = Self;
7447
7448        #[inline(always)]
7449        fn inline_align(_context: fidl::encoding::Context) -> usize {
7450            8
7451        }
7452
7453        #[inline(always)]
7454        fn inline_size(_context: fidl::encoding::Context) -> usize {
7455            24
7456        }
7457    }
7458
7459    unsafe impl
7460        fidl::encoding::Encode<
7461            DeviceConnectorConnectRequest,
7462            fidl::encoding::DefaultFuchsiaResourceDialect,
7463        > for &mut DeviceConnectorConnectRequest
7464    {
7465        #[inline]
7466        unsafe fn encode(
7467            self,
7468            encoder: &mut fidl::encoding::Encoder<
7469                '_,
7470                fidl::encoding::DefaultFuchsiaResourceDialect,
7471            >,
7472            offset: usize,
7473            _depth: fidl::encoding::Depth,
7474        ) -> fidl::Result<()> {
7475            encoder.debug_check_bounds::<DeviceConnectorConnectRequest>(offset);
7476            // Delegate to tuple encoding.
7477            fidl::encoding::Encode::<DeviceConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7478                (
7479                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
7480                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
7481                ),
7482                encoder, offset, _depth
7483            )
7484        }
7485    }
7486    unsafe impl<
7487        T0: fidl::encoding::Encode<
7488                fidl::encoding::BoundedString<32>,
7489                fidl::encoding::DefaultFuchsiaResourceDialect,
7490            >,
7491        T1: fidl::encoding::Encode<
7492                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
7493                fidl::encoding::DefaultFuchsiaResourceDialect,
7494            >,
7495    >
7496        fidl::encoding::Encode<
7497            DeviceConnectorConnectRequest,
7498            fidl::encoding::DefaultFuchsiaResourceDialect,
7499        > for (T0, T1)
7500    {
7501        #[inline]
7502        unsafe fn encode(
7503            self,
7504            encoder: &mut fidl::encoding::Encoder<
7505                '_,
7506                fidl::encoding::DefaultFuchsiaResourceDialect,
7507            >,
7508            offset: usize,
7509            depth: fidl::encoding::Depth,
7510        ) -> fidl::Result<()> {
7511            encoder.debug_check_bounds::<DeviceConnectorConnectRequest>(offset);
7512            // Zero out padding regions. There's no need to apply masks
7513            // because the unmasked parts will be overwritten by fields.
7514            unsafe {
7515                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
7516                (ptr as *mut u64).write_unaligned(0);
7517            }
7518            // Write the fields.
7519            self.0.encode(encoder, offset + 0, depth)?;
7520            self.1.encode(encoder, offset + 16, depth)?;
7521            Ok(())
7522        }
7523    }
7524
7525    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7526        for DeviceConnectorConnectRequest
7527    {
7528        #[inline(always)]
7529        fn new_empty() -> Self {
7530            Self {
7531                name: fidl::new_empty!(
7532                    fidl::encoding::BoundedString<32>,
7533                    fidl::encoding::DefaultFuchsiaResourceDialect
7534                ),
7535                server_end: fidl::new_empty!(
7536                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
7537                    fidl::encoding::DefaultFuchsiaResourceDialect
7538                ),
7539            }
7540        }
7541
7542        #[inline]
7543        unsafe fn decode(
7544            &mut self,
7545            decoder: &mut fidl::encoding::Decoder<
7546                '_,
7547                fidl::encoding::DefaultFuchsiaResourceDialect,
7548            >,
7549            offset: usize,
7550            _depth: fidl::encoding::Depth,
7551        ) -> fidl::Result<()> {
7552            decoder.debug_check_bounds::<Self>(offset);
7553            // Verify that padding bytes are zero.
7554            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
7555            let padval = unsafe { (ptr as *const u64).read_unaligned() };
7556            let mask = 0xffffffff00000000u64;
7557            let maskedval = padval & mask;
7558            if maskedval != 0 {
7559                return Err(fidl::Error::NonZeroPadding {
7560                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
7561                });
7562            }
7563            fidl::decode!(
7564                fidl::encoding::BoundedString<32>,
7565                fidl::encoding::DefaultFuchsiaResourceDialect,
7566                &mut self.name,
7567                decoder,
7568                offset + 0,
7569                _depth
7570            )?;
7571            fidl::decode!(
7572                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceMarker>>,
7573                fidl::encoding::DefaultFuchsiaResourceDialect,
7574                &mut self.server_end,
7575                decoder,
7576                offset + 16,
7577                _depth
7578            )?;
7579            Ok(())
7580        }
7581    }
7582
7583    impl fidl::encoding::ResourceTypeMarker for DeviceExtraConnectorConnectRequest {
7584        type Borrowed<'a> = &'a mut Self;
7585        fn take_or_borrow<'a>(
7586            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7587        ) -> Self::Borrowed<'a> {
7588            value
7589        }
7590    }
7591
7592    unsafe impl fidl::encoding::TypeMarker for DeviceExtraConnectorConnectRequest {
7593        type Owned = Self;
7594
7595        #[inline(always)]
7596        fn inline_align(_context: fidl::encoding::Context) -> usize {
7597            8
7598        }
7599
7600        #[inline(always)]
7601        fn inline_size(_context: fidl::encoding::Context) -> usize {
7602            24
7603        }
7604    }
7605
7606    unsafe impl
7607        fidl::encoding::Encode<
7608            DeviceExtraConnectorConnectRequest,
7609            fidl::encoding::DefaultFuchsiaResourceDialect,
7610        > for &mut DeviceExtraConnectorConnectRequest
7611    {
7612        #[inline]
7613        unsafe fn encode(
7614            self,
7615            encoder: &mut fidl::encoding::Encoder<
7616                '_,
7617                fidl::encoding::DefaultFuchsiaResourceDialect,
7618            >,
7619            offset: usize,
7620            _depth: fidl::encoding::Depth,
7621        ) -> fidl::Result<()> {
7622            encoder.debug_check_bounds::<DeviceExtraConnectorConnectRequest>(offset);
7623            // Delegate to tuple encoding.
7624            fidl::encoding::Encode::<DeviceExtraConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7625                (
7626                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
7627                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceExtraMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
7628                ),
7629                encoder, offset, _depth
7630            )
7631        }
7632    }
7633    unsafe impl<
7634        T0: fidl::encoding::Encode<
7635                fidl::encoding::BoundedString<32>,
7636                fidl::encoding::DefaultFuchsiaResourceDialect,
7637            >,
7638        T1: fidl::encoding::Encode<
7639                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceExtraMarker>>,
7640                fidl::encoding::DefaultFuchsiaResourceDialect,
7641            >,
7642    >
7643        fidl::encoding::Encode<
7644            DeviceExtraConnectorConnectRequest,
7645            fidl::encoding::DefaultFuchsiaResourceDialect,
7646        > for (T0, T1)
7647    {
7648        #[inline]
7649        unsafe fn encode(
7650            self,
7651            encoder: &mut fidl::encoding::Encoder<
7652                '_,
7653                fidl::encoding::DefaultFuchsiaResourceDialect,
7654            >,
7655            offset: usize,
7656            depth: fidl::encoding::Depth,
7657        ) -> fidl::Result<()> {
7658            encoder.debug_check_bounds::<DeviceExtraConnectorConnectRequest>(offset);
7659            // Zero out padding regions. There's no need to apply masks
7660            // because the unmasked parts will be overwritten by fields.
7661            unsafe {
7662                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
7663                (ptr as *mut u64).write_unaligned(0);
7664            }
7665            // Write the fields.
7666            self.0.encode(encoder, offset + 0, depth)?;
7667            self.1.encode(encoder, offset + 16, depth)?;
7668            Ok(())
7669        }
7670    }
7671
7672    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7673        for DeviceExtraConnectorConnectRequest
7674    {
7675        #[inline(always)]
7676        fn new_empty() -> Self {
7677            Self {
7678                name: fidl::new_empty!(
7679                    fidl::encoding::BoundedString<32>,
7680                    fidl::encoding::DefaultFuchsiaResourceDialect
7681                ),
7682                server_end: fidl::new_empty!(
7683                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceExtraMarker>>,
7684                    fidl::encoding::DefaultFuchsiaResourceDialect
7685                ),
7686            }
7687        }
7688
7689        #[inline]
7690        unsafe fn decode(
7691            &mut self,
7692            decoder: &mut fidl::encoding::Decoder<
7693                '_,
7694                fidl::encoding::DefaultFuchsiaResourceDialect,
7695            >,
7696            offset: usize,
7697            _depth: fidl::encoding::Depth,
7698        ) -> fidl::Result<()> {
7699            decoder.debug_check_bounds::<Self>(offset);
7700            // Verify that padding bytes are zero.
7701            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
7702            let padval = unsafe { (ptr as *const u64).read_unaligned() };
7703            let mask = 0xffffffff00000000u64;
7704            let maskedval = padval & mask;
7705            if maskedval != 0 {
7706                return Err(fidl::Error::NonZeroPadding {
7707                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
7708                });
7709            }
7710            fidl::decode!(
7711                fidl::encoding::BoundedString<32>,
7712                fidl::encoding::DefaultFuchsiaResourceDialect,
7713                &mut self.name,
7714                decoder,
7715                offset + 0,
7716                _depth
7717            )?;
7718            fidl::decode!(
7719                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceExtraMarker>>,
7720                fidl::encoding::DefaultFuchsiaResourceDialect,
7721                &mut self.server_end,
7722                decoder,
7723                offset + 16,
7724                _depth
7725            )?;
7726            Ok(())
7727        }
7728    }
7729
7730    impl fidl::encoding::ResourceTypeMarker for DeviceExtraFormNetworkRequest {
7731        type Borrowed<'a> = &'a mut Self;
7732        fn take_or_borrow<'a>(
7733            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7734        ) -> Self::Borrowed<'a> {
7735            value
7736        }
7737    }
7738
7739    unsafe impl fidl::encoding::TypeMarker for DeviceExtraFormNetworkRequest {
7740        type Owned = Self;
7741
7742        #[inline(always)]
7743        fn inline_align(_context: fidl::encoding::Context) -> usize {
7744            8
7745        }
7746
7747        #[inline(always)]
7748        fn inline_size(_context: fidl::encoding::Context) -> usize {
7749            40
7750        }
7751    }
7752
7753    unsafe impl
7754        fidl::encoding::Encode<
7755            DeviceExtraFormNetworkRequest,
7756            fidl::encoding::DefaultFuchsiaResourceDialect,
7757        > for &mut DeviceExtraFormNetworkRequest
7758    {
7759        #[inline]
7760        unsafe fn encode(
7761            self,
7762            encoder: &mut fidl::encoding::Encoder<
7763                '_,
7764                fidl::encoding::DefaultFuchsiaResourceDialect,
7765            >,
7766            offset: usize,
7767            _depth: fidl::encoding::Depth,
7768        ) -> fidl::Result<()> {
7769            encoder.debug_check_bounds::<DeviceExtraFormNetworkRequest>(offset);
7770            // Delegate to tuple encoding.
7771            fidl::encoding::Encode::<DeviceExtraFormNetworkRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7772                (
7773                    <fidl_fuchsia_lowpan_device::ProvisioningParams as fidl::encoding::ValueTypeMarker>::borrow(&self.params),
7774                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProvisioningMonitorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.progress),
7775                ),
7776                encoder, offset, _depth
7777            )
7778        }
7779    }
7780    unsafe impl<
7781        T0: fidl::encoding::Encode<
7782                fidl_fuchsia_lowpan_device::ProvisioningParams,
7783                fidl::encoding::DefaultFuchsiaResourceDialect,
7784            >,
7785        T1: fidl::encoding::Encode<
7786                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProvisioningMonitorMarker>>,
7787                fidl::encoding::DefaultFuchsiaResourceDialect,
7788            >,
7789    >
7790        fidl::encoding::Encode<
7791            DeviceExtraFormNetworkRequest,
7792            fidl::encoding::DefaultFuchsiaResourceDialect,
7793        > for (T0, T1)
7794    {
7795        #[inline]
7796        unsafe fn encode(
7797            self,
7798            encoder: &mut fidl::encoding::Encoder<
7799                '_,
7800                fidl::encoding::DefaultFuchsiaResourceDialect,
7801            >,
7802            offset: usize,
7803            depth: fidl::encoding::Depth,
7804        ) -> fidl::Result<()> {
7805            encoder.debug_check_bounds::<DeviceExtraFormNetworkRequest>(offset);
7806            // Zero out padding regions. There's no need to apply masks
7807            // because the unmasked parts will be overwritten by fields.
7808            unsafe {
7809                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
7810                (ptr as *mut u64).write_unaligned(0);
7811            }
7812            // Write the fields.
7813            self.0.encode(encoder, offset + 0, depth)?;
7814            self.1.encode(encoder, offset + 32, depth)?;
7815            Ok(())
7816        }
7817    }
7818
7819    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7820        for DeviceExtraFormNetworkRequest
7821    {
7822        #[inline(always)]
7823        fn new_empty() -> Self {
7824            Self {
7825                params: fidl::new_empty!(
7826                    fidl_fuchsia_lowpan_device::ProvisioningParams,
7827                    fidl::encoding::DefaultFuchsiaResourceDialect
7828                ),
7829                progress: fidl::new_empty!(
7830                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProvisioningMonitorMarker>>,
7831                    fidl::encoding::DefaultFuchsiaResourceDialect
7832                ),
7833            }
7834        }
7835
7836        #[inline]
7837        unsafe fn decode(
7838            &mut self,
7839            decoder: &mut fidl::encoding::Decoder<
7840                '_,
7841                fidl::encoding::DefaultFuchsiaResourceDialect,
7842            >,
7843            offset: usize,
7844            _depth: fidl::encoding::Depth,
7845        ) -> fidl::Result<()> {
7846            decoder.debug_check_bounds::<Self>(offset);
7847            // Verify that padding bytes are zero.
7848            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
7849            let padval = unsafe { (ptr as *const u64).read_unaligned() };
7850            let mask = 0xffffffff00000000u64;
7851            let maskedval = padval & mask;
7852            if maskedval != 0 {
7853                return Err(fidl::Error::NonZeroPadding {
7854                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
7855                });
7856            }
7857            fidl::decode!(
7858                fidl_fuchsia_lowpan_device::ProvisioningParams,
7859                fidl::encoding::DefaultFuchsiaResourceDialect,
7860                &mut self.params,
7861                decoder,
7862                offset + 0,
7863                _depth
7864            )?;
7865            fidl::decode!(
7866                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProvisioningMonitorMarker>>,
7867                fidl::encoding::DefaultFuchsiaResourceDialect,
7868                &mut self.progress,
7869                decoder,
7870                offset + 32,
7871                _depth
7872            )?;
7873            Ok(())
7874        }
7875    }
7876
7877    impl fidl::encoding::ResourceTypeMarker for DeviceExtraJoinNetworkRequest {
7878        type Borrowed<'a> = &'a mut Self;
7879        fn take_or_borrow<'a>(
7880            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7881        ) -> Self::Borrowed<'a> {
7882            value
7883        }
7884    }
7885
7886    unsafe impl fidl::encoding::TypeMarker for DeviceExtraJoinNetworkRequest {
7887        type Owned = Self;
7888
7889        #[inline(always)]
7890        fn inline_align(_context: fidl::encoding::Context) -> usize {
7891            8
7892        }
7893
7894        #[inline(always)]
7895        fn inline_size(_context: fidl::encoding::Context) -> usize {
7896            24
7897        }
7898    }
7899
7900    unsafe impl
7901        fidl::encoding::Encode<
7902            DeviceExtraJoinNetworkRequest,
7903            fidl::encoding::DefaultFuchsiaResourceDialect,
7904        > for &mut DeviceExtraJoinNetworkRequest
7905    {
7906        #[inline]
7907        unsafe fn encode(
7908            self,
7909            encoder: &mut fidl::encoding::Encoder<
7910                '_,
7911                fidl::encoding::DefaultFuchsiaResourceDialect,
7912            >,
7913            offset: usize,
7914            _depth: fidl::encoding::Depth,
7915        ) -> fidl::Result<()> {
7916            encoder.debug_check_bounds::<DeviceExtraJoinNetworkRequest>(offset);
7917            // Delegate to tuple encoding.
7918            fidl::encoding::Encode::<DeviceExtraJoinNetworkRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
7919                (
7920                    <JoinParams as fidl::encoding::ValueTypeMarker>::borrow(&self.params),
7921                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProvisioningMonitorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.progress),
7922                ),
7923                encoder, offset, _depth
7924            )
7925        }
7926    }
7927    unsafe impl<
7928        T0: fidl::encoding::Encode<JoinParams, fidl::encoding::DefaultFuchsiaResourceDialect>,
7929        T1: fidl::encoding::Encode<
7930                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProvisioningMonitorMarker>>,
7931                fidl::encoding::DefaultFuchsiaResourceDialect,
7932            >,
7933    >
7934        fidl::encoding::Encode<
7935            DeviceExtraJoinNetworkRequest,
7936            fidl::encoding::DefaultFuchsiaResourceDialect,
7937        > for (T0, T1)
7938    {
7939        #[inline]
7940        unsafe fn encode(
7941            self,
7942            encoder: &mut fidl::encoding::Encoder<
7943                '_,
7944                fidl::encoding::DefaultFuchsiaResourceDialect,
7945            >,
7946            offset: usize,
7947            depth: fidl::encoding::Depth,
7948        ) -> fidl::Result<()> {
7949            encoder.debug_check_bounds::<DeviceExtraJoinNetworkRequest>(offset);
7950            // Zero out padding regions. There's no need to apply masks
7951            // because the unmasked parts will be overwritten by fields.
7952            unsafe {
7953                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
7954                (ptr as *mut u64).write_unaligned(0);
7955            }
7956            // Write the fields.
7957            self.0.encode(encoder, offset + 0, depth)?;
7958            self.1.encode(encoder, offset + 16, depth)?;
7959            Ok(())
7960        }
7961    }
7962
7963    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
7964        for DeviceExtraJoinNetworkRequest
7965    {
7966        #[inline(always)]
7967        fn new_empty() -> Self {
7968            Self {
7969                params: fidl::new_empty!(JoinParams, fidl::encoding::DefaultFuchsiaResourceDialect),
7970                progress: fidl::new_empty!(
7971                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProvisioningMonitorMarker>>,
7972                    fidl::encoding::DefaultFuchsiaResourceDialect
7973                ),
7974            }
7975        }
7976
7977        #[inline]
7978        unsafe fn decode(
7979            &mut self,
7980            decoder: &mut fidl::encoding::Decoder<
7981                '_,
7982                fidl::encoding::DefaultFuchsiaResourceDialect,
7983            >,
7984            offset: usize,
7985            _depth: fidl::encoding::Depth,
7986        ) -> fidl::Result<()> {
7987            decoder.debug_check_bounds::<Self>(offset);
7988            // Verify that padding bytes are zero.
7989            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
7990            let padval = unsafe { (ptr as *const u64).read_unaligned() };
7991            let mask = 0xffffffff00000000u64;
7992            let maskedval = padval & mask;
7993            if maskedval != 0 {
7994                return Err(fidl::Error::NonZeroPadding {
7995                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
7996                });
7997            }
7998            fidl::decode!(
7999                JoinParams,
8000                fidl::encoding::DefaultFuchsiaResourceDialect,
8001                &mut self.params,
8002                decoder,
8003                offset + 0,
8004                _depth
8005            )?;
8006            fidl::decode!(
8007                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ProvisioningMonitorMarker>>,
8008                fidl::encoding::DefaultFuchsiaResourceDialect,
8009                &mut self.progress,
8010                decoder,
8011                offset + 16,
8012                _depth
8013            )?;
8014            Ok(())
8015        }
8016    }
8017
8018    impl fidl::encoding::ResourceTypeMarker for DeviceExtraStartNetworkScanRequest {
8019        type Borrowed<'a> = &'a mut Self;
8020        fn take_or_borrow<'a>(
8021            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8022        ) -> Self::Borrowed<'a> {
8023            value
8024        }
8025    }
8026
8027    unsafe impl fidl::encoding::TypeMarker for DeviceExtraStartNetworkScanRequest {
8028        type Owned = Self;
8029
8030        #[inline(always)]
8031        fn inline_align(_context: fidl::encoding::Context) -> usize {
8032            8
8033        }
8034
8035        #[inline(always)]
8036        fn inline_size(_context: fidl::encoding::Context) -> usize {
8037            24
8038        }
8039    }
8040
8041    unsafe impl
8042        fidl::encoding::Encode<
8043            DeviceExtraStartNetworkScanRequest,
8044            fidl::encoding::DefaultFuchsiaResourceDialect,
8045        > for &mut DeviceExtraStartNetworkScanRequest
8046    {
8047        #[inline]
8048        unsafe fn encode(
8049            self,
8050            encoder: &mut fidl::encoding::Encoder<
8051                '_,
8052                fidl::encoding::DefaultFuchsiaResourceDialect,
8053            >,
8054            offset: usize,
8055            _depth: fidl::encoding::Depth,
8056        ) -> fidl::Result<()> {
8057            encoder.debug_check_bounds::<DeviceExtraStartNetworkScanRequest>(offset);
8058            // Delegate to tuple encoding.
8059            fidl::encoding::Encode::<DeviceExtraStartNetworkScanRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8060                (
8061                    <NetworkScanParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.params),
8062                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BeaconInfoStreamMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.stream),
8063                ),
8064                encoder, offset, _depth
8065            )
8066        }
8067    }
8068    unsafe impl<
8069        T0: fidl::encoding::Encode<
8070                NetworkScanParameters,
8071                fidl::encoding::DefaultFuchsiaResourceDialect,
8072            >,
8073        T1: fidl::encoding::Encode<
8074                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BeaconInfoStreamMarker>>,
8075                fidl::encoding::DefaultFuchsiaResourceDialect,
8076            >,
8077    >
8078        fidl::encoding::Encode<
8079            DeviceExtraStartNetworkScanRequest,
8080            fidl::encoding::DefaultFuchsiaResourceDialect,
8081        > for (T0, T1)
8082    {
8083        #[inline]
8084        unsafe fn encode(
8085            self,
8086            encoder: &mut fidl::encoding::Encoder<
8087                '_,
8088                fidl::encoding::DefaultFuchsiaResourceDialect,
8089            >,
8090            offset: usize,
8091            depth: fidl::encoding::Depth,
8092        ) -> fidl::Result<()> {
8093            encoder.debug_check_bounds::<DeviceExtraStartNetworkScanRequest>(offset);
8094            // Zero out padding regions. There's no need to apply masks
8095            // because the unmasked parts will be overwritten by fields.
8096            unsafe {
8097                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
8098                (ptr as *mut u64).write_unaligned(0);
8099            }
8100            // Write the fields.
8101            self.0.encode(encoder, offset + 0, depth)?;
8102            self.1.encode(encoder, offset + 16, depth)?;
8103            Ok(())
8104        }
8105    }
8106
8107    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8108        for DeviceExtraStartNetworkScanRequest
8109    {
8110        #[inline(always)]
8111        fn new_empty() -> Self {
8112            Self {
8113                params: fidl::new_empty!(
8114                    NetworkScanParameters,
8115                    fidl::encoding::DefaultFuchsiaResourceDialect
8116                ),
8117                stream: fidl::new_empty!(
8118                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BeaconInfoStreamMarker>>,
8119                    fidl::encoding::DefaultFuchsiaResourceDialect
8120                ),
8121            }
8122        }
8123
8124        #[inline]
8125        unsafe fn decode(
8126            &mut self,
8127            decoder: &mut fidl::encoding::Decoder<
8128                '_,
8129                fidl::encoding::DefaultFuchsiaResourceDialect,
8130            >,
8131            offset: usize,
8132            _depth: fidl::encoding::Depth,
8133        ) -> fidl::Result<()> {
8134            decoder.debug_check_bounds::<Self>(offset);
8135            // Verify that padding bytes are zero.
8136            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
8137            let padval = unsafe { (ptr as *const u64).read_unaligned() };
8138            let mask = 0xffffffff00000000u64;
8139            let maskedval = padval & mask;
8140            if maskedval != 0 {
8141                return Err(fidl::Error::NonZeroPadding {
8142                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
8143                });
8144            }
8145            fidl::decode!(
8146                NetworkScanParameters,
8147                fidl::encoding::DefaultFuchsiaResourceDialect,
8148                &mut self.params,
8149                decoder,
8150                offset + 0,
8151                _depth
8152            )?;
8153            fidl::decode!(
8154                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<BeaconInfoStreamMarker>>,
8155                fidl::encoding::DefaultFuchsiaResourceDialect,
8156                &mut self.stream,
8157                decoder,
8158                offset + 16,
8159                _depth
8160            )?;
8161            Ok(())
8162        }
8163    }
8164
8165    impl fidl::encoding::ResourceTypeMarker for DeviceRouteConnectorConnectRequest {
8166        type Borrowed<'a> = &'a mut Self;
8167        fn take_or_borrow<'a>(
8168            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8169        ) -> Self::Borrowed<'a> {
8170            value
8171        }
8172    }
8173
8174    unsafe impl fidl::encoding::TypeMarker for DeviceRouteConnectorConnectRequest {
8175        type Owned = Self;
8176
8177        #[inline(always)]
8178        fn inline_align(_context: fidl::encoding::Context) -> usize {
8179            8
8180        }
8181
8182        #[inline(always)]
8183        fn inline_size(_context: fidl::encoding::Context) -> usize {
8184            24
8185        }
8186    }
8187
8188    unsafe impl
8189        fidl::encoding::Encode<
8190            DeviceRouteConnectorConnectRequest,
8191            fidl::encoding::DefaultFuchsiaResourceDialect,
8192        > for &mut DeviceRouteConnectorConnectRequest
8193    {
8194        #[inline]
8195        unsafe fn encode(
8196            self,
8197            encoder: &mut fidl::encoding::Encoder<
8198                '_,
8199                fidl::encoding::DefaultFuchsiaResourceDialect,
8200            >,
8201            offset: usize,
8202            _depth: fidl::encoding::Depth,
8203        ) -> fidl::Result<()> {
8204            encoder.debug_check_bounds::<DeviceRouteConnectorConnectRequest>(offset);
8205            // Delegate to tuple encoding.
8206            fidl::encoding::Encode::<DeviceRouteConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8207                (
8208                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
8209                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceRouteMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
8210                ),
8211                encoder, offset, _depth
8212            )
8213        }
8214    }
8215    unsafe impl<
8216        T0: fidl::encoding::Encode<
8217                fidl::encoding::BoundedString<32>,
8218                fidl::encoding::DefaultFuchsiaResourceDialect,
8219            >,
8220        T1: fidl::encoding::Encode<
8221                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceRouteMarker>>,
8222                fidl::encoding::DefaultFuchsiaResourceDialect,
8223            >,
8224    >
8225        fidl::encoding::Encode<
8226            DeviceRouteConnectorConnectRequest,
8227            fidl::encoding::DefaultFuchsiaResourceDialect,
8228        > for (T0, T1)
8229    {
8230        #[inline]
8231        unsafe fn encode(
8232            self,
8233            encoder: &mut fidl::encoding::Encoder<
8234                '_,
8235                fidl::encoding::DefaultFuchsiaResourceDialect,
8236            >,
8237            offset: usize,
8238            depth: fidl::encoding::Depth,
8239        ) -> fidl::Result<()> {
8240            encoder.debug_check_bounds::<DeviceRouteConnectorConnectRequest>(offset);
8241            // Zero out padding regions. There's no need to apply masks
8242            // because the unmasked parts will be overwritten by fields.
8243            unsafe {
8244                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
8245                (ptr as *mut u64).write_unaligned(0);
8246            }
8247            // Write the fields.
8248            self.0.encode(encoder, offset + 0, depth)?;
8249            self.1.encode(encoder, offset + 16, depth)?;
8250            Ok(())
8251        }
8252    }
8253
8254    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8255        for DeviceRouteConnectorConnectRequest
8256    {
8257        #[inline(always)]
8258        fn new_empty() -> Self {
8259            Self {
8260                name: fidl::new_empty!(
8261                    fidl::encoding::BoundedString<32>,
8262                    fidl::encoding::DefaultFuchsiaResourceDialect
8263                ),
8264                server_end: fidl::new_empty!(
8265                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceRouteMarker>>,
8266                    fidl::encoding::DefaultFuchsiaResourceDialect
8267                ),
8268            }
8269        }
8270
8271        #[inline]
8272        unsafe fn decode(
8273            &mut self,
8274            decoder: &mut fidl::encoding::Decoder<
8275                '_,
8276                fidl::encoding::DefaultFuchsiaResourceDialect,
8277            >,
8278            offset: usize,
8279            _depth: fidl::encoding::Depth,
8280        ) -> fidl::Result<()> {
8281            decoder.debug_check_bounds::<Self>(offset);
8282            // Verify that padding bytes are zero.
8283            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
8284            let padval = unsafe { (ptr as *const u64).read_unaligned() };
8285            let mask = 0xffffffff00000000u64;
8286            let maskedval = padval & mask;
8287            if maskedval != 0 {
8288                return Err(fidl::Error::NonZeroPadding {
8289                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
8290                });
8291            }
8292            fidl::decode!(
8293                fidl::encoding::BoundedString<32>,
8294                fidl::encoding::DefaultFuchsiaResourceDialect,
8295                &mut self.name,
8296                decoder,
8297                offset + 0,
8298                _depth
8299            )?;
8300            fidl::decode!(
8301                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceRouteMarker>>,
8302                fidl::encoding::DefaultFuchsiaResourceDialect,
8303                &mut self.server_end,
8304                decoder,
8305                offset + 16,
8306                _depth
8307            )?;
8308            Ok(())
8309        }
8310    }
8311
8312    impl fidl::encoding::ResourceTypeMarker for DeviceRouteExtraConnectorConnectRequest {
8313        type Borrowed<'a> = &'a mut Self;
8314        fn take_or_borrow<'a>(
8315            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8316        ) -> Self::Borrowed<'a> {
8317            value
8318        }
8319    }
8320
8321    unsafe impl fidl::encoding::TypeMarker for DeviceRouteExtraConnectorConnectRequest {
8322        type Owned = Self;
8323
8324        #[inline(always)]
8325        fn inline_align(_context: fidl::encoding::Context) -> usize {
8326            8
8327        }
8328
8329        #[inline(always)]
8330        fn inline_size(_context: fidl::encoding::Context) -> usize {
8331            24
8332        }
8333    }
8334
8335    unsafe impl
8336        fidl::encoding::Encode<
8337            DeviceRouteExtraConnectorConnectRequest,
8338            fidl::encoding::DefaultFuchsiaResourceDialect,
8339        > for &mut DeviceRouteExtraConnectorConnectRequest
8340    {
8341        #[inline]
8342        unsafe fn encode(
8343            self,
8344            encoder: &mut fidl::encoding::Encoder<
8345                '_,
8346                fidl::encoding::DefaultFuchsiaResourceDialect,
8347            >,
8348            offset: usize,
8349            _depth: fidl::encoding::Depth,
8350        ) -> fidl::Result<()> {
8351            encoder.debug_check_bounds::<DeviceRouteExtraConnectorConnectRequest>(offset);
8352            // Delegate to tuple encoding.
8353            fidl::encoding::Encode::<DeviceRouteExtraConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8354                (
8355                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
8356                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceRouteExtraMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
8357                ),
8358                encoder, offset, _depth
8359            )
8360        }
8361    }
8362    unsafe impl<
8363        T0: fidl::encoding::Encode<
8364                fidl::encoding::BoundedString<32>,
8365                fidl::encoding::DefaultFuchsiaResourceDialect,
8366            >,
8367        T1: fidl::encoding::Encode<
8368                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceRouteExtraMarker>>,
8369                fidl::encoding::DefaultFuchsiaResourceDialect,
8370            >,
8371    >
8372        fidl::encoding::Encode<
8373            DeviceRouteExtraConnectorConnectRequest,
8374            fidl::encoding::DefaultFuchsiaResourceDialect,
8375        > for (T0, T1)
8376    {
8377        #[inline]
8378        unsafe fn encode(
8379            self,
8380            encoder: &mut fidl::encoding::Encoder<
8381                '_,
8382                fidl::encoding::DefaultFuchsiaResourceDialect,
8383            >,
8384            offset: usize,
8385            depth: fidl::encoding::Depth,
8386        ) -> fidl::Result<()> {
8387            encoder.debug_check_bounds::<DeviceRouteExtraConnectorConnectRequest>(offset);
8388            // Zero out padding regions. There's no need to apply masks
8389            // because the unmasked parts will be overwritten by fields.
8390            unsafe {
8391                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
8392                (ptr as *mut u64).write_unaligned(0);
8393            }
8394            // Write the fields.
8395            self.0.encode(encoder, offset + 0, depth)?;
8396            self.1.encode(encoder, offset + 16, depth)?;
8397            Ok(())
8398        }
8399    }
8400
8401    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8402        for DeviceRouteExtraConnectorConnectRequest
8403    {
8404        #[inline(always)]
8405        fn new_empty() -> Self {
8406            Self {
8407                name: fidl::new_empty!(
8408                    fidl::encoding::BoundedString<32>,
8409                    fidl::encoding::DefaultFuchsiaResourceDialect
8410                ),
8411                server_end: fidl::new_empty!(
8412                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceRouteExtraMarker>>,
8413                    fidl::encoding::DefaultFuchsiaResourceDialect
8414                ),
8415            }
8416        }
8417
8418        #[inline]
8419        unsafe fn decode(
8420            &mut self,
8421            decoder: &mut fidl::encoding::Decoder<
8422                '_,
8423                fidl::encoding::DefaultFuchsiaResourceDialect,
8424            >,
8425            offset: usize,
8426            _depth: fidl::encoding::Depth,
8427        ) -> fidl::Result<()> {
8428            decoder.debug_check_bounds::<Self>(offset);
8429            // Verify that padding bytes are zero.
8430            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
8431            let padval = unsafe { (ptr as *const u64).read_unaligned() };
8432            let mask = 0xffffffff00000000u64;
8433            let maskedval = padval & mask;
8434            if maskedval != 0 {
8435                return Err(fidl::Error::NonZeroPadding {
8436                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
8437                });
8438            }
8439            fidl::decode!(
8440                fidl::encoding::BoundedString<32>,
8441                fidl::encoding::DefaultFuchsiaResourceDialect,
8442                &mut self.name,
8443                decoder,
8444                offset + 0,
8445                _depth
8446            )?;
8447            fidl::decode!(
8448                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceRouteExtraMarker>>,
8449                fidl::encoding::DefaultFuchsiaResourceDialect,
8450                &mut self.server_end,
8451                decoder,
8452                offset + 16,
8453                _depth
8454            )?;
8455            Ok(())
8456        }
8457    }
8458
8459    impl fidl::encoding::ResourceTypeMarker for LegacyJoiningConnectorConnectRequest {
8460        type Borrowed<'a> = &'a mut Self;
8461        fn take_or_borrow<'a>(
8462            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8463        ) -> Self::Borrowed<'a> {
8464            value
8465        }
8466    }
8467
8468    unsafe impl fidl::encoding::TypeMarker for LegacyJoiningConnectorConnectRequest {
8469        type Owned = Self;
8470
8471        #[inline(always)]
8472        fn inline_align(_context: fidl::encoding::Context) -> usize {
8473            8
8474        }
8475
8476        #[inline(always)]
8477        fn inline_size(_context: fidl::encoding::Context) -> usize {
8478            24
8479        }
8480    }
8481
8482    unsafe impl
8483        fidl::encoding::Encode<
8484            LegacyJoiningConnectorConnectRequest,
8485            fidl::encoding::DefaultFuchsiaResourceDialect,
8486        > for &mut LegacyJoiningConnectorConnectRequest
8487    {
8488        #[inline]
8489        unsafe fn encode(
8490            self,
8491            encoder: &mut fidl::encoding::Encoder<
8492                '_,
8493                fidl::encoding::DefaultFuchsiaResourceDialect,
8494            >,
8495            offset: usize,
8496            _depth: fidl::encoding::Depth,
8497        ) -> fidl::Result<()> {
8498            encoder.debug_check_bounds::<LegacyJoiningConnectorConnectRequest>(offset);
8499            // Delegate to tuple encoding.
8500            fidl::encoding::Encode::<LegacyJoiningConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8501                (
8502                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
8503                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LegacyJoiningMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
8504                ),
8505                encoder, offset, _depth
8506            )
8507        }
8508    }
8509    unsafe impl<
8510        T0: fidl::encoding::Encode<
8511                fidl::encoding::BoundedString<32>,
8512                fidl::encoding::DefaultFuchsiaResourceDialect,
8513            >,
8514        T1: fidl::encoding::Encode<
8515                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LegacyJoiningMarker>>,
8516                fidl::encoding::DefaultFuchsiaResourceDialect,
8517            >,
8518    >
8519        fidl::encoding::Encode<
8520            LegacyJoiningConnectorConnectRequest,
8521            fidl::encoding::DefaultFuchsiaResourceDialect,
8522        > for (T0, T1)
8523    {
8524        #[inline]
8525        unsafe fn encode(
8526            self,
8527            encoder: &mut fidl::encoding::Encoder<
8528                '_,
8529                fidl::encoding::DefaultFuchsiaResourceDialect,
8530            >,
8531            offset: usize,
8532            depth: fidl::encoding::Depth,
8533        ) -> fidl::Result<()> {
8534            encoder.debug_check_bounds::<LegacyJoiningConnectorConnectRequest>(offset);
8535            // Zero out padding regions. There's no need to apply masks
8536            // because the unmasked parts will be overwritten by fields.
8537            unsafe {
8538                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
8539                (ptr as *mut u64).write_unaligned(0);
8540            }
8541            // Write the fields.
8542            self.0.encode(encoder, offset + 0, depth)?;
8543            self.1.encode(encoder, offset + 16, depth)?;
8544            Ok(())
8545        }
8546    }
8547
8548    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8549        for LegacyJoiningConnectorConnectRequest
8550    {
8551        #[inline(always)]
8552        fn new_empty() -> Self {
8553            Self {
8554                name: fidl::new_empty!(
8555                    fidl::encoding::BoundedString<32>,
8556                    fidl::encoding::DefaultFuchsiaResourceDialect
8557                ),
8558                server_end: fidl::new_empty!(
8559                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LegacyJoiningMarker>>,
8560                    fidl::encoding::DefaultFuchsiaResourceDialect
8561                ),
8562            }
8563        }
8564
8565        #[inline]
8566        unsafe fn decode(
8567            &mut self,
8568            decoder: &mut fidl::encoding::Decoder<
8569                '_,
8570                fidl::encoding::DefaultFuchsiaResourceDialect,
8571            >,
8572            offset: usize,
8573            _depth: fidl::encoding::Depth,
8574        ) -> fidl::Result<()> {
8575            decoder.debug_check_bounds::<Self>(offset);
8576            // Verify that padding bytes are zero.
8577            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
8578            let padval = unsafe { (ptr as *const u64).read_unaligned() };
8579            let mask = 0xffffffff00000000u64;
8580            let maskedval = padval & mask;
8581            if maskedval != 0 {
8582                return Err(fidl::Error::NonZeroPadding {
8583                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
8584                });
8585            }
8586            fidl::decode!(
8587                fidl::encoding::BoundedString<32>,
8588                fidl::encoding::DefaultFuchsiaResourceDialect,
8589                &mut self.name,
8590                decoder,
8591                offset + 0,
8592                _depth
8593            )?;
8594            fidl::decode!(
8595                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<LegacyJoiningMarker>>,
8596                fidl::encoding::DefaultFuchsiaResourceDialect,
8597                &mut self.server_end,
8598                decoder,
8599                offset + 16,
8600                _depth
8601            )?;
8602            Ok(())
8603        }
8604    }
8605
8606    impl fidl::encoding::ResourceTypeMarker for TelemetryProviderConnectorConnectRequest {
8607        type Borrowed<'a> = &'a mut Self;
8608        fn take_or_borrow<'a>(
8609            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8610        ) -> Self::Borrowed<'a> {
8611            value
8612        }
8613    }
8614
8615    unsafe impl fidl::encoding::TypeMarker for TelemetryProviderConnectorConnectRequest {
8616        type Owned = Self;
8617
8618        #[inline(always)]
8619        fn inline_align(_context: fidl::encoding::Context) -> usize {
8620            8
8621        }
8622
8623        #[inline(always)]
8624        fn inline_size(_context: fidl::encoding::Context) -> usize {
8625            24
8626        }
8627    }
8628
8629    unsafe impl
8630        fidl::encoding::Encode<
8631            TelemetryProviderConnectorConnectRequest,
8632            fidl::encoding::DefaultFuchsiaResourceDialect,
8633        > for &mut TelemetryProviderConnectorConnectRequest
8634    {
8635        #[inline]
8636        unsafe fn encode(
8637            self,
8638            encoder: &mut fidl::encoding::Encoder<
8639                '_,
8640                fidl::encoding::DefaultFuchsiaResourceDialect,
8641            >,
8642            offset: usize,
8643            _depth: fidl::encoding::Depth,
8644        ) -> fidl::Result<()> {
8645            encoder.debug_check_bounds::<TelemetryProviderConnectorConnectRequest>(offset);
8646            // Delegate to tuple encoding.
8647            fidl::encoding::Encode::<TelemetryProviderConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
8648                (
8649                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
8650                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TelemetryProviderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
8651                ),
8652                encoder, offset, _depth
8653            )
8654        }
8655    }
8656    unsafe impl<
8657        T0: fidl::encoding::Encode<
8658                fidl::encoding::BoundedString<32>,
8659                fidl::encoding::DefaultFuchsiaResourceDialect,
8660            >,
8661        T1: fidl::encoding::Encode<
8662                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TelemetryProviderMarker>>,
8663                fidl::encoding::DefaultFuchsiaResourceDialect,
8664            >,
8665    >
8666        fidl::encoding::Encode<
8667            TelemetryProviderConnectorConnectRequest,
8668            fidl::encoding::DefaultFuchsiaResourceDialect,
8669        > for (T0, T1)
8670    {
8671        #[inline]
8672        unsafe fn encode(
8673            self,
8674            encoder: &mut fidl::encoding::Encoder<
8675                '_,
8676                fidl::encoding::DefaultFuchsiaResourceDialect,
8677            >,
8678            offset: usize,
8679            depth: fidl::encoding::Depth,
8680        ) -> fidl::Result<()> {
8681            encoder.debug_check_bounds::<TelemetryProviderConnectorConnectRequest>(offset);
8682            // Zero out padding regions. There's no need to apply masks
8683            // because the unmasked parts will be overwritten by fields.
8684            unsafe {
8685                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
8686                (ptr as *mut u64).write_unaligned(0);
8687            }
8688            // Write the fields.
8689            self.0.encode(encoder, offset + 0, depth)?;
8690            self.1.encode(encoder, offset + 16, depth)?;
8691            Ok(())
8692        }
8693    }
8694
8695    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
8696        for TelemetryProviderConnectorConnectRequest
8697    {
8698        #[inline(always)]
8699        fn new_empty() -> Self {
8700            Self {
8701                name: fidl::new_empty!(
8702                    fidl::encoding::BoundedString<32>,
8703                    fidl::encoding::DefaultFuchsiaResourceDialect
8704                ),
8705                server_end: fidl::new_empty!(
8706                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TelemetryProviderMarker>>,
8707                    fidl::encoding::DefaultFuchsiaResourceDialect
8708                ),
8709            }
8710        }
8711
8712        #[inline]
8713        unsafe fn decode(
8714            &mut self,
8715            decoder: &mut fidl::encoding::Decoder<
8716                '_,
8717                fidl::encoding::DefaultFuchsiaResourceDialect,
8718            >,
8719            offset: usize,
8720            _depth: fidl::encoding::Depth,
8721        ) -> fidl::Result<()> {
8722            decoder.debug_check_bounds::<Self>(offset);
8723            // Verify that padding bytes are zero.
8724            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
8725            let padval = unsafe { (ptr as *const u64).read_unaligned() };
8726            let mask = 0xffffffff00000000u64;
8727            let maskedval = padval & mask;
8728            if maskedval != 0 {
8729                return Err(fidl::Error::NonZeroPadding {
8730                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
8731                });
8732            }
8733            fidl::decode!(
8734                fidl::encoding::BoundedString<32>,
8735                fidl::encoding::DefaultFuchsiaResourceDialect,
8736                &mut self.name,
8737                decoder,
8738                offset + 0,
8739                _depth
8740            )?;
8741            fidl::decode!(
8742                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<TelemetryProviderMarker>>,
8743                fidl::encoding::DefaultFuchsiaResourceDialect,
8744                &mut self.server_end,
8745                decoder,
8746                offset + 16,
8747                _depth
8748            )?;
8749            Ok(())
8750        }
8751    }
8752}