Skip to main content

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