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