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