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