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