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