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}
1806#[derive(Debug)]
1807#[cfg(target_os = "fuchsia")]
1808pub struct EpskcSynchronousProxy {
1809    client: fidl::client::sync::Client,
1810}
1811
1812#[cfg(target_os = "fuchsia")]
1813impl fidl::endpoints::SynchronousProxy for EpskcSynchronousProxy {
1814    type Proxy = EpskcProxy;
1815    type Protocol = EpskcMarker;
1816
1817    fn from_channel(inner: fidl::Channel) -> Self {
1818        Self::new(inner)
1819    }
1820
1821    fn into_channel(self) -> fidl::Channel {
1822        self.client.into_channel()
1823    }
1824
1825    fn as_channel(&self) -> &fidl::Channel {
1826        self.client.as_channel()
1827    }
1828}
1829
1830#[cfg(target_os = "fuchsia")]
1831impl EpskcSynchronousProxy {
1832    pub fn new(channel: fidl::Channel) -> Self {
1833        Self { client: fidl::client::sync::Client::new(channel) }
1834    }
1835
1836    pub fn into_channel(self) -> fidl::Channel {
1837        self.client.into_channel()
1838    }
1839
1840    /// Waits until an event arrives and returns it. It is safe for other
1841    /// threads to make concurrent requests while waiting for an event.
1842    pub fn wait_for_event(
1843        &self,
1844        deadline: zx::MonotonicInstant,
1845    ) -> Result<EpskcEvent, fidl::Error> {
1846        EpskcEvent::decode(self.client.wait_for_event::<EpskcMarker>(deadline)?)
1847    }
1848
1849    /// Starts the ephemeral key handler.
1850    ///
1851    /// The ePSKc functionality must first be enabled via
1852    /// fuchsia.lowpan.thread/FeatureConnector.
1853    ///
1854    /// The lifetime is in units of milliseconds.
1855    ///
1856    /// From OpenThread:
1857    ///
1858    /// When successfully set, the ephemeral key can be used only once by an
1859    /// external commissioner candidate to establish a secure session. After the
1860    /// commissioner candidate disconnects, the use of the ephemeral key is
1861    /// stopped.
1862    ///
1863    /// The maximum ephemeral key lifetime is 10 minutes.
1864    ///
1865    /// If a lifetime of 0 is provided, OpenThread will use its default lifetime
1866    /// of 2 minutes.
1867    ///
1868    /// If the lifetime expires, the use of the ephemeral key is stopped, and
1869    /// any connected session using the key is immediately disconnected.
1870    ///
1871    /// The Ephemeral Key Manager limits the number of failed DTLS connections
1872    /// to 10 attempts. After the 10th failed attempt, the use of the ephemeral
1873    /// key is automatically stopped (even if the lifetime has not yet expired).
1874    ///
1875    /// * `ZX_ERR_INVALID_ARGS`: The specified lifetime is greater than allowed.
1876    /// * `ZX_ERR_BAD_STATE`: The ePSKc functionality has not been enabled.
1877    /// * `ZX_ERR_INTERNAL`: There was a failure in generating the ephemeral key.`
1878    pub fn r#start_ephemeral_key(
1879        &self,
1880        mut lifetime: u32,
1881        ___deadline: zx::MonotonicInstant,
1882    ) -> Result<EpskcStartEphemeralKeyResult, fidl::Error> {
1883        let _response = self.client.send_query::<
1884            EpskcStartEphemeralKeyRequest,
1885            fidl::encoding::FlexibleResultType<EpskcStartEphemeralKeyResponse, i32>,
1886            EpskcMarker,
1887        >(
1888            (lifetime,),
1889            0x215e7ca3dab0a8b7,
1890            fidl::encoding::DynamicFlags::FLEXIBLE,
1891            ___deadline,
1892        )?
1893        .into_result::<EpskcMarker>("start_ephemeral_key")?;
1894        Ok(_response.map(|x| x.key))
1895    }
1896
1897    /// Stops the ephemeral key use.
1898    ///
1899    /// Existing sessions are terminated if retain_active_session is false.
1900    /// If retain_active_session is true and there is an ongoing session, the
1901    /// ephemeral key is not stopped.
1902    ///
1903    /// The ePSKc functionality must first be enabled via
1904    /// fuchsia.lowpan.thread/FeatureConnector.
1905    ///
1906    /// * `ZX_ERR_BAD_STATE`: The ePSKc functionality has not been enabled or
1907    ///   `retain_active_session` is true and there is an active session.
1908    pub fn r#stop_ephemeral_key(
1909        &self,
1910        mut retain_active_session: bool,
1911        ___deadline: zx::MonotonicInstant,
1912    ) -> Result<EpskcStopEphemeralKeyResult, fidl::Error> {
1913        let _response = self.client.send_query::<
1914            EpskcStopEphemeralKeyRequest,
1915            fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
1916            EpskcMarker,
1917        >(
1918            (retain_active_session,),
1919            0x33a89ab1cfd88906,
1920            fidl::encoding::DynamicFlags::FLEXIBLE,
1921            ___deadline,
1922        )?
1923        .into_result::<EpskcMarker>("stop_ephemeral_key")?;
1924        Ok(_response.map(|x| x))
1925    }
1926}
1927
1928#[cfg(target_os = "fuchsia")]
1929impl From<EpskcSynchronousProxy> for zx::NullableHandle {
1930    fn from(value: EpskcSynchronousProxy) -> Self {
1931        value.into_channel().into()
1932    }
1933}
1934
1935#[cfg(target_os = "fuchsia")]
1936impl From<fidl::Channel> for EpskcSynchronousProxy {
1937    fn from(value: fidl::Channel) -> Self {
1938        Self::new(value)
1939    }
1940}
1941
1942#[cfg(target_os = "fuchsia")]
1943impl fidl::endpoints::FromClient for EpskcSynchronousProxy {
1944    type Protocol = EpskcMarker;
1945
1946    fn from_client(value: fidl::endpoints::ClientEnd<EpskcMarker>) -> Self {
1947        Self::new(value.into_channel())
1948    }
1949}
1950
1951#[derive(Debug, Clone)]
1952pub struct EpskcProxy {
1953    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1954}
1955
1956impl fidl::endpoints::Proxy for EpskcProxy {
1957    type Protocol = EpskcMarker;
1958
1959    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1960        Self::new(inner)
1961    }
1962
1963    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1964        self.client.into_channel().map_err(|client| Self { client })
1965    }
1966
1967    fn as_channel(&self) -> &::fidl::AsyncChannel {
1968        self.client.as_channel()
1969    }
1970}
1971
1972impl EpskcProxy {
1973    /// Create a new Proxy for fuchsia.lowpan.thread/Epskc.
1974    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1975        let protocol_name = <EpskcMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1976        Self { client: fidl::client::Client::new(channel, protocol_name) }
1977    }
1978
1979    /// Get a Stream of events from the remote end of the protocol.
1980    ///
1981    /// # Panics
1982    ///
1983    /// Panics if the event stream was already taken.
1984    pub fn take_event_stream(&self) -> EpskcEventStream {
1985        EpskcEventStream { event_receiver: self.client.take_event_receiver() }
1986    }
1987
1988    /// Starts the ephemeral key handler.
1989    ///
1990    /// The ePSKc functionality must first be enabled via
1991    /// fuchsia.lowpan.thread/FeatureConnector.
1992    ///
1993    /// The lifetime is in units of milliseconds.
1994    ///
1995    /// From OpenThread:
1996    ///
1997    /// When successfully set, the ephemeral key can be used only once by an
1998    /// external commissioner candidate to establish a secure session. After the
1999    /// commissioner candidate disconnects, the use of the ephemeral key is
2000    /// stopped.
2001    ///
2002    /// The maximum ephemeral key lifetime is 10 minutes.
2003    ///
2004    /// If a lifetime of 0 is provided, OpenThread will use its default lifetime
2005    /// of 2 minutes.
2006    ///
2007    /// If the lifetime expires, the use of the ephemeral key is stopped, and
2008    /// any connected session using the key is immediately disconnected.
2009    ///
2010    /// The Ephemeral Key Manager limits the number of failed DTLS connections
2011    /// to 10 attempts. After the 10th failed attempt, the use of the ephemeral
2012    /// key is automatically stopped (even if the lifetime has not yet expired).
2013    ///
2014    /// * `ZX_ERR_INVALID_ARGS`: The specified lifetime is greater than allowed.
2015    /// * `ZX_ERR_BAD_STATE`: The ePSKc functionality has not been enabled.
2016    /// * `ZX_ERR_INTERNAL`: There was a failure in generating the ephemeral key.`
2017    pub fn r#start_ephemeral_key(
2018        &self,
2019        mut lifetime: u32,
2020    ) -> fidl::client::QueryResponseFut<
2021        EpskcStartEphemeralKeyResult,
2022        fidl::encoding::DefaultFuchsiaResourceDialect,
2023    > {
2024        EpskcProxyInterface::r#start_ephemeral_key(self, lifetime)
2025    }
2026
2027    /// Stops the ephemeral key use.
2028    ///
2029    /// Existing sessions are terminated if retain_active_session is false.
2030    /// If retain_active_session is true and there is an ongoing session, the
2031    /// ephemeral key is not stopped.
2032    ///
2033    /// The ePSKc functionality must first be enabled via
2034    /// fuchsia.lowpan.thread/FeatureConnector.
2035    ///
2036    /// * `ZX_ERR_BAD_STATE`: The ePSKc functionality has not been enabled or
2037    ///   `retain_active_session` is true and there is an active session.
2038    pub fn r#stop_ephemeral_key(
2039        &self,
2040        mut retain_active_session: bool,
2041    ) -> fidl::client::QueryResponseFut<
2042        EpskcStopEphemeralKeyResult,
2043        fidl::encoding::DefaultFuchsiaResourceDialect,
2044    > {
2045        EpskcProxyInterface::r#stop_ephemeral_key(self, retain_active_session)
2046    }
2047}
2048
2049impl EpskcProxyInterface for EpskcProxy {
2050    type StartEphemeralKeyResponseFut = fidl::client::QueryResponseFut<
2051        EpskcStartEphemeralKeyResult,
2052        fidl::encoding::DefaultFuchsiaResourceDialect,
2053    >;
2054    fn r#start_ephemeral_key(&self, mut lifetime: u32) -> Self::StartEphemeralKeyResponseFut {
2055        fn _decode(
2056            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2057        ) -> Result<EpskcStartEphemeralKeyResult, fidl::Error> {
2058            let _response = fidl::client::decode_transaction_body::<
2059                fidl::encoding::FlexibleResultType<EpskcStartEphemeralKeyResponse, i32>,
2060                fidl::encoding::DefaultFuchsiaResourceDialect,
2061                0x215e7ca3dab0a8b7,
2062            >(_buf?)?
2063            .into_result::<EpskcMarker>("start_ephemeral_key")?;
2064            Ok(_response.map(|x| x.key))
2065        }
2066        self.client
2067            .send_query_and_decode::<EpskcStartEphemeralKeyRequest, EpskcStartEphemeralKeyResult>(
2068                (lifetime,),
2069                0x215e7ca3dab0a8b7,
2070                fidl::encoding::DynamicFlags::FLEXIBLE,
2071                _decode,
2072            )
2073    }
2074
2075    type StopEphemeralKeyResponseFut = fidl::client::QueryResponseFut<
2076        EpskcStopEphemeralKeyResult,
2077        fidl::encoding::DefaultFuchsiaResourceDialect,
2078    >;
2079    fn r#stop_ephemeral_key(
2080        &self,
2081        mut retain_active_session: bool,
2082    ) -> Self::StopEphemeralKeyResponseFut {
2083        fn _decode(
2084            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2085        ) -> Result<EpskcStopEphemeralKeyResult, fidl::Error> {
2086            let _response = fidl::client::decode_transaction_body::<
2087                fidl::encoding::FlexibleResultType<fidl::encoding::EmptyStruct, i32>,
2088                fidl::encoding::DefaultFuchsiaResourceDialect,
2089                0x33a89ab1cfd88906,
2090            >(_buf?)?
2091            .into_result::<EpskcMarker>("stop_ephemeral_key")?;
2092            Ok(_response.map(|x| x))
2093        }
2094        self.client
2095            .send_query_and_decode::<EpskcStopEphemeralKeyRequest, EpskcStopEphemeralKeyResult>(
2096                (retain_active_session,),
2097                0x33a89ab1cfd88906,
2098                fidl::encoding::DynamicFlags::FLEXIBLE,
2099                _decode,
2100            )
2101    }
2102}
2103
2104pub struct EpskcEventStream {
2105    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2106}
2107
2108impl std::marker::Unpin for EpskcEventStream {}
2109
2110impl futures::stream::FusedStream for EpskcEventStream {
2111    fn is_terminated(&self) -> bool {
2112        self.event_receiver.is_terminated()
2113    }
2114}
2115
2116impl futures::Stream for EpskcEventStream {
2117    type Item = Result<EpskcEvent, fidl::Error>;
2118
2119    fn poll_next(
2120        mut self: std::pin::Pin<&mut Self>,
2121        cx: &mut std::task::Context<'_>,
2122    ) -> std::task::Poll<Option<Self::Item>> {
2123        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2124            &mut self.event_receiver,
2125            cx
2126        )?) {
2127            Some(buf) => std::task::Poll::Ready(Some(EpskcEvent::decode(buf))),
2128            None => std::task::Poll::Ready(None),
2129        }
2130    }
2131}
2132
2133#[derive(Debug)]
2134pub enum EpskcEvent {
2135    #[non_exhaustive]
2136    _UnknownEvent {
2137        /// Ordinal of the event that was sent.
2138        ordinal: u64,
2139    },
2140}
2141
2142impl EpskcEvent {
2143    /// Decodes a message buffer as a [`EpskcEvent`].
2144    fn decode(
2145        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2146    ) -> Result<EpskcEvent, fidl::Error> {
2147        let (bytes, _handles) = buf.split_mut();
2148        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2149        debug_assert_eq!(tx_header.tx_id, 0);
2150        match tx_header.ordinal {
2151            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2152                Ok(EpskcEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2153            }
2154            _ => Err(fidl::Error::UnknownOrdinal {
2155                ordinal: tx_header.ordinal,
2156                protocol_name: <EpskcMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2157            }),
2158        }
2159    }
2160}
2161
2162/// A Stream of incoming requests for fuchsia.lowpan.thread/Epskc.
2163pub struct EpskcRequestStream {
2164    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2165    is_terminated: bool,
2166}
2167
2168impl std::marker::Unpin for EpskcRequestStream {}
2169
2170impl futures::stream::FusedStream for EpskcRequestStream {
2171    fn is_terminated(&self) -> bool {
2172        self.is_terminated
2173    }
2174}
2175
2176impl fidl::endpoints::RequestStream for EpskcRequestStream {
2177    type Protocol = EpskcMarker;
2178    type ControlHandle = EpskcControlHandle;
2179
2180    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2181        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2182    }
2183
2184    fn control_handle(&self) -> Self::ControlHandle {
2185        EpskcControlHandle { inner: self.inner.clone() }
2186    }
2187
2188    fn into_inner(
2189        self,
2190    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2191    {
2192        (self.inner, self.is_terminated)
2193    }
2194
2195    fn from_inner(
2196        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2197        is_terminated: bool,
2198    ) -> Self {
2199        Self { inner, is_terminated }
2200    }
2201}
2202
2203impl futures::Stream for EpskcRequestStream {
2204    type Item = Result<EpskcRequest, fidl::Error>;
2205
2206    fn poll_next(
2207        mut self: std::pin::Pin<&mut Self>,
2208        cx: &mut std::task::Context<'_>,
2209    ) -> std::task::Poll<Option<Self::Item>> {
2210        let this = &mut *self;
2211        if this.inner.check_shutdown(cx) {
2212            this.is_terminated = true;
2213            return std::task::Poll::Ready(None);
2214        }
2215        if this.is_terminated {
2216            panic!("polled EpskcRequestStream after completion");
2217        }
2218        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2219            |bytes, handles| {
2220                match this.inner.channel().read_etc(cx, bytes, handles) {
2221                    std::task::Poll::Ready(Ok(())) => {}
2222                    std::task::Poll::Pending => return std::task::Poll::Pending,
2223                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2224                        this.is_terminated = true;
2225                        return std::task::Poll::Ready(None);
2226                    }
2227                    std::task::Poll::Ready(Err(e)) => {
2228                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2229                            e.into(),
2230                        ))));
2231                    }
2232                }
2233
2234                // A message has been received from the channel
2235                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2236
2237                std::task::Poll::Ready(Some(match header.ordinal {
2238                    0x215e7ca3dab0a8b7 => {
2239                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2240                        let mut req = fidl::new_empty!(
2241                            EpskcStartEphemeralKeyRequest,
2242                            fidl::encoding::DefaultFuchsiaResourceDialect
2243                        );
2244                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EpskcStartEphemeralKeyRequest>(&header, _body_bytes, handles, &mut req)?;
2245                        let control_handle = EpskcControlHandle { inner: this.inner.clone() };
2246                        Ok(EpskcRequest::StartEphemeralKey {
2247                            lifetime: req.lifetime,
2248
2249                            responder: EpskcStartEphemeralKeyResponder {
2250                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2251                                tx_id: header.tx_id,
2252                            },
2253                        })
2254                    }
2255                    0x33a89ab1cfd88906 => {
2256                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2257                        let mut req = fidl::new_empty!(
2258                            EpskcStopEphemeralKeyRequest,
2259                            fidl::encoding::DefaultFuchsiaResourceDialect
2260                        );
2261                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EpskcStopEphemeralKeyRequest>(&header, _body_bytes, handles, &mut req)?;
2262                        let control_handle = EpskcControlHandle { inner: this.inner.clone() };
2263                        Ok(EpskcRequest::StopEphemeralKey {
2264                            retain_active_session: req.retain_active_session,
2265
2266                            responder: EpskcStopEphemeralKeyResponder {
2267                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2268                                tx_id: header.tx_id,
2269                            },
2270                        })
2271                    }
2272                    _ if header.tx_id == 0
2273                        && header
2274                            .dynamic_flags()
2275                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2276                    {
2277                        Ok(EpskcRequest::_UnknownMethod {
2278                            ordinal: header.ordinal,
2279                            control_handle: EpskcControlHandle { inner: this.inner.clone() },
2280                            method_type: fidl::MethodType::OneWay,
2281                        })
2282                    }
2283                    _ if header
2284                        .dynamic_flags()
2285                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2286                    {
2287                        this.inner.send_framework_err(
2288                            fidl::encoding::FrameworkErr::UnknownMethod,
2289                            header.tx_id,
2290                            header.ordinal,
2291                            header.dynamic_flags(),
2292                            (bytes, handles),
2293                        )?;
2294                        Ok(EpskcRequest::_UnknownMethod {
2295                            ordinal: header.ordinal,
2296                            control_handle: EpskcControlHandle { inner: this.inner.clone() },
2297                            method_type: fidl::MethodType::TwoWay,
2298                        })
2299                    }
2300                    _ => Err(fidl::Error::UnknownOrdinal {
2301                        ordinal: header.ordinal,
2302                        protocol_name: <EpskcMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2303                    }),
2304                }))
2305            },
2306        )
2307    }
2308}
2309
2310/// ePSKc configuration protocol
2311///
2312/// This allows callers to interact with the Thread stack's ePSKc functionality
2313/// to produce or invalidate ephemeral keys.
2314#[derive(Debug)]
2315pub enum EpskcRequest {
2316    /// Starts the ephemeral key handler.
2317    ///
2318    /// The ePSKc functionality must first be enabled via
2319    /// fuchsia.lowpan.thread/FeatureConnector.
2320    ///
2321    /// The lifetime is in units of milliseconds.
2322    ///
2323    /// From OpenThread:
2324    ///
2325    /// When successfully set, the ephemeral key can be used only once by an
2326    /// external commissioner candidate to establish a secure session. After the
2327    /// commissioner candidate disconnects, the use of the ephemeral key is
2328    /// stopped.
2329    ///
2330    /// The maximum ephemeral key lifetime is 10 minutes.
2331    ///
2332    /// If a lifetime of 0 is provided, OpenThread will use its default lifetime
2333    /// of 2 minutes.
2334    ///
2335    /// If the lifetime expires, the use of the ephemeral key is stopped, and
2336    /// any connected session using the key is immediately disconnected.
2337    ///
2338    /// The Ephemeral Key Manager limits the number of failed DTLS connections
2339    /// to 10 attempts. After the 10th failed attempt, the use of the ephemeral
2340    /// key is automatically stopped (even if the lifetime has not yet expired).
2341    ///
2342    /// * `ZX_ERR_INVALID_ARGS`: The specified lifetime is greater than allowed.
2343    /// * `ZX_ERR_BAD_STATE`: The ePSKc functionality has not been enabled.
2344    /// * `ZX_ERR_INTERNAL`: There was a failure in generating the ephemeral key.`
2345    StartEphemeralKey { lifetime: u32, responder: EpskcStartEphemeralKeyResponder },
2346    /// Stops the ephemeral key use.
2347    ///
2348    /// Existing sessions are terminated if retain_active_session is false.
2349    /// If retain_active_session is true and there is an ongoing session, the
2350    /// ephemeral key is not stopped.
2351    ///
2352    /// The ePSKc functionality must first be enabled via
2353    /// fuchsia.lowpan.thread/FeatureConnector.
2354    ///
2355    /// * `ZX_ERR_BAD_STATE`: The ePSKc functionality has not been enabled or
2356    ///   `retain_active_session` is true and there is an active session.
2357    StopEphemeralKey { retain_active_session: bool, responder: EpskcStopEphemeralKeyResponder },
2358    /// An interaction was received which does not match any known method.
2359    #[non_exhaustive]
2360    _UnknownMethod {
2361        /// Ordinal of the method that was called.
2362        ordinal: u64,
2363        control_handle: EpskcControlHandle,
2364        method_type: fidl::MethodType,
2365    },
2366}
2367
2368impl EpskcRequest {
2369    #[allow(irrefutable_let_patterns)]
2370    pub fn into_start_ephemeral_key(self) -> Option<(u32, EpskcStartEphemeralKeyResponder)> {
2371        if let EpskcRequest::StartEphemeralKey { lifetime, responder } = self {
2372            Some((lifetime, responder))
2373        } else {
2374            None
2375        }
2376    }
2377
2378    #[allow(irrefutable_let_patterns)]
2379    pub fn into_stop_ephemeral_key(self) -> Option<(bool, EpskcStopEphemeralKeyResponder)> {
2380        if let EpskcRequest::StopEphemeralKey { retain_active_session, responder } = self {
2381            Some((retain_active_session, responder))
2382        } else {
2383            None
2384        }
2385    }
2386
2387    /// Name of the method defined in FIDL
2388    pub fn method_name(&self) -> &'static str {
2389        match *self {
2390            EpskcRequest::StartEphemeralKey { .. } => "start_ephemeral_key",
2391            EpskcRequest::StopEphemeralKey { .. } => "stop_ephemeral_key",
2392            EpskcRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
2393                "unknown one-way method"
2394            }
2395            EpskcRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
2396                "unknown two-way method"
2397            }
2398        }
2399    }
2400}
2401
2402#[derive(Debug, Clone)]
2403pub struct EpskcControlHandle {
2404    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2405}
2406
2407impl EpskcControlHandle {
2408    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2409        self.inner.shutdown_with_epitaph(status.into())
2410    }
2411}
2412
2413impl fidl::endpoints::ControlHandle for EpskcControlHandle {
2414    fn shutdown(&self) {
2415        self.inner.shutdown()
2416    }
2417
2418    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2419        self.inner.shutdown_with_epitaph(status)
2420    }
2421
2422    fn is_closed(&self) -> bool {
2423        self.inner.channel().is_closed()
2424    }
2425    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2426        self.inner.channel().on_closed()
2427    }
2428
2429    #[cfg(target_os = "fuchsia")]
2430    fn signal_peer(
2431        &self,
2432        clear_mask: zx::Signals,
2433        set_mask: zx::Signals,
2434    ) -> Result<(), zx_status::Status> {
2435        use fidl::Peered;
2436        self.inner.channel().signal_peer(clear_mask, set_mask)
2437    }
2438}
2439
2440impl EpskcControlHandle {}
2441
2442#[must_use = "FIDL methods require a response to be sent"]
2443#[derive(Debug)]
2444pub struct EpskcStartEphemeralKeyResponder {
2445    control_handle: std::mem::ManuallyDrop<EpskcControlHandle>,
2446    tx_id: u32,
2447}
2448
2449/// Set the the channel to be shutdown (see [`EpskcControlHandle::shutdown`])
2450/// if the responder is dropped without sending a response, so that the client
2451/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2452impl std::ops::Drop for EpskcStartEphemeralKeyResponder {
2453    fn drop(&mut self) {
2454        self.control_handle.shutdown();
2455        // Safety: drops once, never accessed again
2456        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2457    }
2458}
2459
2460impl fidl::endpoints::Responder for EpskcStartEphemeralKeyResponder {
2461    type ControlHandle = EpskcControlHandle;
2462
2463    fn control_handle(&self) -> &EpskcControlHandle {
2464        &self.control_handle
2465    }
2466
2467    fn drop_without_shutdown(mut self) {
2468        // Safety: drops once, never accessed again due to mem::forget
2469        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2470        // Prevent Drop from running (which would shut down the channel)
2471        std::mem::forget(self);
2472    }
2473}
2474
2475impl EpskcStartEphemeralKeyResponder {
2476    /// Sends a response to the FIDL transaction.
2477    ///
2478    /// Sets the channel to shutdown if an error occurs.
2479    pub fn send(self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
2480        let _result = self.send_raw(result);
2481        if _result.is_err() {
2482            self.control_handle.shutdown();
2483        }
2484        self.drop_without_shutdown();
2485        _result
2486    }
2487
2488    /// Similar to "send" but does not shutdown the channel if an error occurs.
2489    pub fn send_no_shutdown_on_err(
2490        self,
2491        mut result: Result<&[u8], i32>,
2492    ) -> Result<(), fidl::Error> {
2493        let _result = self.send_raw(result);
2494        self.drop_without_shutdown();
2495        _result
2496    }
2497
2498    fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
2499        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2500            EpskcStartEphemeralKeyResponse,
2501            i32,
2502        >>(
2503            fidl::encoding::FlexibleResult::new(result.map(|key| (key,))),
2504            self.tx_id,
2505            0x215e7ca3dab0a8b7,
2506            fidl::encoding::DynamicFlags::FLEXIBLE,
2507        )
2508    }
2509}
2510
2511#[must_use = "FIDL methods require a response to be sent"]
2512#[derive(Debug)]
2513pub struct EpskcStopEphemeralKeyResponder {
2514    control_handle: std::mem::ManuallyDrop<EpskcControlHandle>,
2515    tx_id: u32,
2516}
2517
2518/// Set the the channel to be shutdown (see [`EpskcControlHandle::shutdown`])
2519/// if the responder is dropped without sending a response, so that the client
2520/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2521impl std::ops::Drop for EpskcStopEphemeralKeyResponder {
2522    fn drop(&mut self) {
2523        self.control_handle.shutdown();
2524        // Safety: drops once, never accessed again
2525        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2526    }
2527}
2528
2529impl fidl::endpoints::Responder for EpskcStopEphemeralKeyResponder {
2530    type ControlHandle = EpskcControlHandle;
2531
2532    fn control_handle(&self) -> &EpskcControlHandle {
2533        &self.control_handle
2534    }
2535
2536    fn drop_without_shutdown(mut self) {
2537        // Safety: drops once, never accessed again due to mem::forget
2538        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2539        // Prevent Drop from running (which would shut down the channel)
2540        std::mem::forget(self);
2541    }
2542}
2543
2544impl EpskcStopEphemeralKeyResponder {
2545    /// Sends a response to the FIDL transaction.
2546    ///
2547    /// Sets the channel to shutdown if an error occurs.
2548    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2549        let _result = self.send_raw(result);
2550        if _result.is_err() {
2551            self.control_handle.shutdown();
2552        }
2553        self.drop_without_shutdown();
2554        _result
2555    }
2556
2557    /// Similar to "send" but does not shutdown the channel if an error occurs.
2558    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2559        let _result = self.send_raw(result);
2560        self.drop_without_shutdown();
2561        _result
2562    }
2563
2564    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2565        self.control_handle.inner.send::<fidl::encoding::FlexibleResultType<
2566            fidl::encoding::EmptyStruct,
2567            i32,
2568        >>(
2569            fidl::encoding::FlexibleResult::new(result),
2570            self.tx_id,
2571            0x33a89ab1cfd88906,
2572            fidl::encoding::DynamicFlags::FLEXIBLE,
2573        )
2574    }
2575}
2576
2577#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2578pub struct EpskcConnectorMarker;
2579
2580impl fidl::endpoints::ProtocolMarker for EpskcConnectorMarker {
2581    type Proxy = EpskcConnectorProxy;
2582    type RequestStream = EpskcConnectorRequestStream;
2583    #[cfg(target_os = "fuchsia")]
2584    type SynchronousProxy = EpskcConnectorSynchronousProxy;
2585
2586    const DEBUG_NAME: &'static str = "fuchsia.lowpan.thread.EpskcConnector";
2587}
2588impl fidl::endpoints::DiscoverableProtocolMarker for EpskcConnectorMarker {}
2589
2590pub trait EpskcConnectorProxyInterface: Send + Sync {
2591    fn r#connect(
2592        &self,
2593        name: &str,
2594        server_end: fidl::endpoints::ServerEnd<EpskcMarker>,
2595    ) -> Result<(), fidl::Error>;
2596}
2597#[derive(Debug)]
2598#[cfg(target_os = "fuchsia")]
2599pub struct EpskcConnectorSynchronousProxy {
2600    client: fidl::client::sync::Client,
2601}
2602
2603#[cfg(target_os = "fuchsia")]
2604impl fidl::endpoints::SynchronousProxy for EpskcConnectorSynchronousProxy {
2605    type Proxy = EpskcConnectorProxy;
2606    type Protocol = EpskcConnectorMarker;
2607
2608    fn from_channel(inner: fidl::Channel) -> Self {
2609        Self::new(inner)
2610    }
2611
2612    fn into_channel(self) -> fidl::Channel {
2613        self.client.into_channel()
2614    }
2615
2616    fn as_channel(&self) -> &fidl::Channel {
2617        self.client.as_channel()
2618    }
2619}
2620
2621#[cfg(target_os = "fuchsia")]
2622impl EpskcConnectorSynchronousProxy {
2623    pub fn new(channel: fidl::Channel) -> Self {
2624        Self { client: fidl::client::sync::Client::new(channel) }
2625    }
2626
2627    pub fn into_channel(self) -> fidl::Channel {
2628        self.client.into_channel()
2629    }
2630
2631    /// Waits until an event arrives and returns it. It is safe for other
2632    /// threads to make concurrent requests while waiting for an event.
2633    pub fn wait_for_event(
2634        &self,
2635        deadline: zx::MonotonicInstant,
2636    ) -> Result<EpskcConnectorEvent, fidl::Error> {
2637        EpskcConnectorEvent::decode(self.client.wait_for_event::<EpskcConnectorMarker>(deadline)?)
2638    }
2639
2640    /// Connects to the [`Epskc`] protocol on the
2641    /// named LoWPAN device.
2642    ///
2643    /// The name of the interface can be learned by calling
2644    /// [`fuchsia.lowpan/Lookup.GetDevices`].
2645    ///
2646    /// If there is an error in processing this request
2647    /// the given channel is closed and an epitaph code used
2648    /// to describe the reason for the failure:
2649    ///
2650    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
2651    ///   was not formatted correctly or otherwise invalid.
2652    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
2653    ///   given name.
2654    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
2655    ///   does not support this protocol.
2656    pub fn r#connect(
2657        &self,
2658        mut name: &str,
2659        mut server_end: fidl::endpoints::ServerEnd<EpskcMarker>,
2660    ) -> Result<(), fidl::Error> {
2661        self.client.send::<EpskcConnectorConnectRequest>(
2662            (name, server_end),
2663            0x1df4842606b2f03c,
2664            fidl::encoding::DynamicFlags::FLEXIBLE,
2665        )
2666    }
2667}
2668
2669#[cfg(target_os = "fuchsia")]
2670impl From<EpskcConnectorSynchronousProxy> for zx::NullableHandle {
2671    fn from(value: EpskcConnectorSynchronousProxy) -> Self {
2672        value.into_channel().into()
2673    }
2674}
2675
2676#[cfg(target_os = "fuchsia")]
2677impl From<fidl::Channel> for EpskcConnectorSynchronousProxy {
2678    fn from(value: fidl::Channel) -> Self {
2679        Self::new(value)
2680    }
2681}
2682
2683#[cfg(target_os = "fuchsia")]
2684impl fidl::endpoints::FromClient for EpskcConnectorSynchronousProxy {
2685    type Protocol = EpskcConnectorMarker;
2686
2687    fn from_client(value: fidl::endpoints::ClientEnd<EpskcConnectorMarker>) -> Self {
2688        Self::new(value.into_channel())
2689    }
2690}
2691
2692#[derive(Debug, Clone)]
2693pub struct EpskcConnectorProxy {
2694    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2695}
2696
2697impl fidl::endpoints::Proxy for EpskcConnectorProxy {
2698    type Protocol = EpskcConnectorMarker;
2699
2700    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2701        Self::new(inner)
2702    }
2703
2704    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2705        self.client.into_channel().map_err(|client| Self { client })
2706    }
2707
2708    fn as_channel(&self) -> &::fidl::AsyncChannel {
2709        self.client.as_channel()
2710    }
2711}
2712
2713impl EpskcConnectorProxy {
2714    /// Create a new Proxy for fuchsia.lowpan.thread/EpskcConnector.
2715    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2716        let protocol_name = <EpskcConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2717        Self { client: fidl::client::Client::new(channel, protocol_name) }
2718    }
2719
2720    /// Get a Stream of events from the remote end of the protocol.
2721    ///
2722    /// # Panics
2723    ///
2724    /// Panics if the event stream was already taken.
2725    pub fn take_event_stream(&self) -> EpskcConnectorEventStream {
2726        EpskcConnectorEventStream { event_receiver: self.client.take_event_receiver() }
2727    }
2728
2729    /// Connects to the [`Epskc`] protocol on the
2730    /// named LoWPAN device.
2731    ///
2732    /// The name of the interface can be learned by calling
2733    /// [`fuchsia.lowpan/Lookup.GetDevices`].
2734    ///
2735    /// If there is an error in processing this request
2736    /// the given channel is closed and an epitaph code used
2737    /// to describe the reason for the failure:
2738    ///
2739    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
2740    ///   was not formatted correctly or otherwise invalid.
2741    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
2742    ///   given name.
2743    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
2744    ///   does not support this protocol.
2745    pub fn r#connect(
2746        &self,
2747        mut name: &str,
2748        mut server_end: fidl::endpoints::ServerEnd<EpskcMarker>,
2749    ) -> Result<(), fidl::Error> {
2750        EpskcConnectorProxyInterface::r#connect(self, name, server_end)
2751    }
2752}
2753
2754impl EpskcConnectorProxyInterface for EpskcConnectorProxy {
2755    fn r#connect(
2756        &self,
2757        mut name: &str,
2758        mut server_end: fidl::endpoints::ServerEnd<EpskcMarker>,
2759    ) -> Result<(), fidl::Error> {
2760        self.client.send::<EpskcConnectorConnectRequest>(
2761            (name, server_end),
2762            0x1df4842606b2f03c,
2763            fidl::encoding::DynamicFlags::FLEXIBLE,
2764        )
2765    }
2766}
2767
2768pub struct EpskcConnectorEventStream {
2769    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2770}
2771
2772impl std::marker::Unpin for EpskcConnectorEventStream {}
2773
2774impl futures::stream::FusedStream for EpskcConnectorEventStream {
2775    fn is_terminated(&self) -> bool {
2776        self.event_receiver.is_terminated()
2777    }
2778}
2779
2780impl futures::Stream for EpskcConnectorEventStream {
2781    type Item = Result<EpskcConnectorEvent, fidl::Error>;
2782
2783    fn poll_next(
2784        mut self: std::pin::Pin<&mut Self>,
2785        cx: &mut std::task::Context<'_>,
2786    ) -> std::task::Poll<Option<Self::Item>> {
2787        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2788            &mut self.event_receiver,
2789            cx
2790        )?) {
2791            Some(buf) => std::task::Poll::Ready(Some(EpskcConnectorEvent::decode(buf))),
2792            None => std::task::Poll::Ready(None),
2793        }
2794    }
2795}
2796
2797#[derive(Debug)]
2798pub enum EpskcConnectorEvent {
2799    #[non_exhaustive]
2800    _UnknownEvent {
2801        /// Ordinal of the event that was sent.
2802        ordinal: u64,
2803    },
2804}
2805
2806impl EpskcConnectorEvent {
2807    /// Decodes a message buffer as a [`EpskcConnectorEvent`].
2808    fn decode(
2809        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2810    ) -> Result<EpskcConnectorEvent, fidl::Error> {
2811        let (bytes, _handles) = buf.split_mut();
2812        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2813        debug_assert_eq!(tx_header.tx_id, 0);
2814        match tx_header.ordinal {
2815            _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
2816                Ok(EpskcConnectorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
2817            }
2818            _ => Err(fidl::Error::UnknownOrdinal {
2819                ordinal: tx_header.ordinal,
2820                protocol_name:
2821                    <EpskcConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2822            }),
2823        }
2824    }
2825}
2826
2827/// A Stream of incoming requests for fuchsia.lowpan.thread/EpskcConnector.
2828pub struct EpskcConnectorRequestStream {
2829    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2830    is_terminated: bool,
2831}
2832
2833impl std::marker::Unpin for EpskcConnectorRequestStream {}
2834
2835impl futures::stream::FusedStream for EpskcConnectorRequestStream {
2836    fn is_terminated(&self) -> bool {
2837        self.is_terminated
2838    }
2839}
2840
2841impl fidl::endpoints::RequestStream for EpskcConnectorRequestStream {
2842    type Protocol = EpskcConnectorMarker;
2843    type ControlHandle = EpskcConnectorControlHandle;
2844
2845    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2846        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2847    }
2848
2849    fn control_handle(&self) -> Self::ControlHandle {
2850        EpskcConnectorControlHandle { inner: self.inner.clone() }
2851    }
2852
2853    fn into_inner(
2854        self,
2855    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2856    {
2857        (self.inner, self.is_terminated)
2858    }
2859
2860    fn from_inner(
2861        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2862        is_terminated: bool,
2863    ) -> Self {
2864        Self { inner, is_terminated }
2865    }
2866}
2867
2868impl futures::Stream for EpskcConnectorRequestStream {
2869    type Item = Result<EpskcConnectorRequest, fidl::Error>;
2870
2871    fn poll_next(
2872        mut self: std::pin::Pin<&mut Self>,
2873        cx: &mut std::task::Context<'_>,
2874    ) -> std::task::Poll<Option<Self::Item>> {
2875        let this = &mut *self;
2876        if this.inner.check_shutdown(cx) {
2877            this.is_terminated = true;
2878            return std::task::Poll::Ready(None);
2879        }
2880        if this.is_terminated {
2881            panic!("polled EpskcConnectorRequestStream after completion");
2882        }
2883        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2884            |bytes, handles| {
2885                match this.inner.channel().read_etc(cx, bytes, handles) {
2886                    std::task::Poll::Ready(Ok(())) => {}
2887                    std::task::Poll::Pending => return std::task::Poll::Pending,
2888                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2889                        this.is_terminated = true;
2890                        return std::task::Poll::Ready(None);
2891                    }
2892                    std::task::Poll::Ready(Err(e)) => {
2893                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2894                            e.into(),
2895                        ))));
2896                    }
2897                }
2898
2899                // A message has been received from the channel
2900                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2901
2902                std::task::Poll::Ready(Some(match header.ordinal {
2903                    0x1df4842606b2f03c => {
2904                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2905                        let mut req = fidl::new_empty!(
2906                            EpskcConnectorConnectRequest,
2907                            fidl::encoding::DefaultFuchsiaResourceDialect
2908                        );
2909                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<EpskcConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2910                        let control_handle =
2911                            EpskcConnectorControlHandle { inner: this.inner.clone() };
2912                        Ok(EpskcConnectorRequest::Connect {
2913                            name: req.name,
2914                            server_end: req.server_end,
2915
2916                            control_handle,
2917                        })
2918                    }
2919                    _ if header.tx_id == 0
2920                        && header
2921                            .dynamic_flags()
2922                            .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2923                    {
2924                        Ok(EpskcConnectorRequest::_UnknownMethod {
2925                            ordinal: header.ordinal,
2926                            control_handle: EpskcConnectorControlHandle {
2927                                inner: this.inner.clone(),
2928                            },
2929                            method_type: fidl::MethodType::OneWay,
2930                        })
2931                    }
2932                    _ if header
2933                        .dynamic_flags()
2934                        .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
2935                    {
2936                        this.inner.send_framework_err(
2937                            fidl::encoding::FrameworkErr::UnknownMethod,
2938                            header.tx_id,
2939                            header.ordinal,
2940                            header.dynamic_flags(),
2941                            (bytes, handles),
2942                        )?;
2943                        Ok(EpskcConnectorRequest::_UnknownMethod {
2944                            ordinal: header.ordinal,
2945                            control_handle: EpskcConnectorControlHandle {
2946                                inner: this.inner.clone(),
2947                            },
2948                            method_type: fidl::MethodType::TwoWay,
2949                        })
2950                    }
2951                    _ => Err(fidl::Error::UnknownOrdinal {
2952                        ordinal: header.ordinal,
2953                        protocol_name:
2954                            <EpskcConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2955                    }),
2956                }))
2957            },
2958        )
2959    }
2960}
2961
2962/// Protocol for connecting to [`Epskc`] on a LoWPAN device.
2963#[derive(Debug)]
2964pub enum EpskcConnectorRequest {
2965    /// Connects to the [`Epskc`] protocol on the
2966    /// named LoWPAN device.
2967    ///
2968    /// The name of the interface can be learned by calling
2969    /// [`fuchsia.lowpan/Lookup.GetDevices`].
2970    ///
2971    /// If there is an error in processing this request
2972    /// the given channel is closed and an epitaph code used
2973    /// to describe the reason for the failure:
2974    ///
2975    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
2976    ///   was not formatted correctly or otherwise invalid.
2977    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
2978    ///   given name.
2979    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
2980    ///   does not support this protocol.
2981    Connect {
2982        name: String,
2983        server_end: fidl::endpoints::ServerEnd<EpskcMarker>,
2984        control_handle: EpskcConnectorControlHandle,
2985    },
2986    /// An interaction was received which does not match any known method.
2987    #[non_exhaustive]
2988    _UnknownMethod {
2989        /// Ordinal of the method that was called.
2990        ordinal: u64,
2991        control_handle: EpskcConnectorControlHandle,
2992        method_type: fidl::MethodType,
2993    },
2994}
2995
2996impl EpskcConnectorRequest {
2997    #[allow(irrefutable_let_patterns)]
2998    pub fn into_connect(
2999        self,
3000    ) -> Option<(String, fidl::endpoints::ServerEnd<EpskcMarker>, EpskcConnectorControlHandle)>
3001    {
3002        if let EpskcConnectorRequest::Connect { name, server_end, control_handle } = self {
3003            Some((name, server_end, control_handle))
3004        } else {
3005            None
3006        }
3007    }
3008
3009    /// Name of the method defined in FIDL
3010    pub fn method_name(&self) -> &'static str {
3011        match *self {
3012            EpskcConnectorRequest::Connect { .. } => "connect",
3013            EpskcConnectorRequest::_UnknownMethod {
3014                method_type: fidl::MethodType::OneWay, ..
3015            } => "unknown one-way method",
3016            EpskcConnectorRequest::_UnknownMethod {
3017                method_type: fidl::MethodType::TwoWay, ..
3018            } => "unknown two-way method",
3019        }
3020    }
3021}
3022
3023#[derive(Debug, Clone)]
3024pub struct EpskcConnectorControlHandle {
3025    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3026}
3027
3028impl EpskcConnectorControlHandle {
3029    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3030        self.inner.shutdown_with_epitaph(status.into())
3031    }
3032}
3033
3034impl fidl::endpoints::ControlHandle for EpskcConnectorControlHandle {
3035    fn shutdown(&self) {
3036        self.inner.shutdown()
3037    }
3038
3039    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3040        self.inner.shutdown_with_epitaph(status)
3041    }
3042
3043    fn is_closed(&self) -> bool {
3044        self.inner.channel().is_closed()
3045    }
3046    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3047        self.inner.channel().on_closed()
3048    }
3049
3050    #[cfg(target_os = "fuchsia")]
3051    fn signal_peer(
3052        &self,
3053        clear_mask: zx::Signals,
3054        set_mask: zx::Signals,
3055    ) -> Result<(), zx_status::Status> {
3056        use fidl::Peered;
3057        self.inner.channel().signal_peer(clear_mask, set_mask)
3058    }
3059}
3060
3061impl EpskcConnectorControlHandle {}
3062
3063#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3064pub struct FeatureMarker;
3065
3066impl fidl::endpoints::ProtocolMarker for FeatureMarker {
3067    type Proxy = FeatureProxy;
3068    type RequestStream = FeatureRequestStream;
3069    #[cfg(target_os = "fuchsia")]
3070    type SynchronousProxy = FeatureSynchronousProxy;
3071
3072    const DEBUG_NAME: &'static str = "(anonymous) Feature";
3073}
3074
3075pub trait FeatureProxyInterface: Send + Sync {
3076    type UpdateFeatureConfigResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
3077        + Send;
3078    fn r#update_feature_config(
3079        &self,
3080        config: &FeatureConfig,
3081    ) -> Self::UpdateFeatureConfigResponseFut;
3082    type GetFeatureConfigResponseFut: std::future::Future<Output = Result<FeatureConfig, fidl::Error>>
3083        + Send;
3084    fn r#get_feature_config(&self) -> Self::GetFeatureConfigResponseFut;
3085}
3086#[derive(Debug)]
3087#[cfg(target_os = "fuchsia")]
3088pub struct FeatureSynchronousProxy {
3089    client: fidl::client::sync::Client,
3090}
3091
3092#[cfg(target_os = "fuchsia")]
3093impl fidl::endpoints::SynchronousProxy for FeatureSynchronousProxy {
3094    type Proxy = FeatureProxy;
3095    type Protocol = FeatureMarker;
3096
3097    fn from_channel(inner: fidl::Channel) -> Self {
3098        Self::new(inner)
3099    }
3100
3101    fn into_channel(self) -> fidl::Channel {
3102        self.client.into_channel()
3103    }
3104
3105    fn as_channel(&self) -> &fidl::Channel {
3106        self.client.as_channel()
3107    }
3108}
3109
3110#[cfg(target_os = "fuchsia")]
3111impl FeatureSynchronousProxy {
3112    pub fn new(channel: fidl::Channel) -> Self {
3113        Self { client: fidl::client::sync::Client::new(channel) }
3114    }
3115
3116    pub fn into_channel(self) -> fidl::Channel {
3117        self.client.into_channel()
3118    }
3119
3120    /// Waits until an event arrives and returns it. It is safe for other
3121    /// threads to make concurrent requests while waiting for an event.
3122    pub fn wait_for_event(
3123        &self,
3124        deadline: zx::MonotonicInstant,
3125    ) -> Result<FeatureEvent, fidl::Error> {
3126        FeatureEvent::decode(self.client.wait_for_event::<FeatureMarker>(deadline)?)
3127    }
3128
3129    /// Updates the current OpenThread feature configuration for this
3130    /// interface.
3131    ///
3132    /// Any unset field in `config` will leave that field unchanged.
3133    pub fn r#update_feature_config(
3134        &self,
3135        mut config: &FeatureConfig,
3136        ___deadline: zx::MonotonicInstant,
3137    ) -> Result<(), fidl::Error> {
3138        let _response = self.client.send_query::<
3139            FeatureUpdateFeatureConfigRequest,
3140            fidl::encoding::EmptyPayload,
3141            FeatureMarker,
3142        >(
3143            (config,),
3144            0x2d24a706e8730410,
3145            fidl::encoding::DynamicFlags::empty(),
3146            ___deadline,
3147        )?;
3148        Ok(_response)
3149    }
3150
3151    /// Returns the current OpenThread feature configuration for this
3152    /// interface.
3153    ///
3154    /// A unset field in the returned value means that feature is not
3155    /// supported.
3156    pub fn r#get_feature_config(
3157        &self,
3158        ___deadline: zx::MonotonicInstant,
3159    ) -> Result<FeatureConfig, fidl::Error> {
3160        let _response = self.client.send_query::<
3161            fidl::encoding::EmptyPayload,
3162            FeatureGetFeatureConfigResponse,
3163            FeatureMarker,
3164        >(
3165            (),
3166            0x2ab1896aea843611,
3167            fidl::encoding::DynamicFlags::empty(),
3168            ___deadline,
3169        )?;
3170        Ok(_response.config)
3171    }
3172}
3173
3174#[cfg(target_os = "fuchsia")]
3175impl From<FeatureSynchronousProxy> for zx::NullableHandle {
3176    fn from(value: FeatureSynchronousProxy) -> Self {
3177        value.into_channel().into()
3178    }
3179}
3180
3181#[cfg(target_os = "fuchsia")]
3182impl From<fidl::Channel> for FeatureSynchronousProxy {
3183    fn from(value: fidl::Channel) -> Self {
3184        Self::new(value)
3185    }
3186}
3187
3188#[cfg(target_os = "fuchsia")]
3189impl fidl::endpoints::FromClient for FeatureSynchronousProxy {
3190    type Protocol = FeatureMarker;
3191
3192    fn from_client(value: fidl::endpoints::ClientEnd<FeatureMarker>) -> Self {
3193        Self::new(value.into_channel())
3194    }
3195}
3196
3197#[derive(Debug, Clone)]
3198pub struct FeatureProxy {
3199    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3200}
3201
3202impl fidl::endpoints::Proxy for FeatureProxy {
3203    type Protocol = FeatureMarker;
3204
3205    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3206        Self::new(inner)
3207    }
3208
3209    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3210        self.client.into_channel().map_err(|client| Self { client })
3211    }
3212
3213    fn as_channel(&self) -> &::fidl::AsyncChannel {
3214        self.client.as_channel()
3215    }
3216}
3217
3218impl FeatureProxy {
3219    /// Create a new Proxy for fuchsia.lowpan.thread/Feature.
3220    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3221        let protocol_name = <FeatureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3222        Self { client: fidl::client::Client::new(channel, protocol_name) }
3223    }
3224
3225    /// Get a Stream of events from the remote end of the protocol.
3226    ///
3227    /// # Panics
3228    ///
3229    /// Panics if the event stream was already taken.
3230    pub fn take_event_stream(&self) -> FeatureEventStream {
3231        FeatureEventStream { event_receiver: self.client.take_event_receiver() }
3232    }
3233
3234    /// Updates the current OpenThread feature configuration for this
3235    /// interface.
3236    ///
3237    /// Any unset field in `config` will leave that field unchanged.
3238    pub fn r#update_feature_config(
3239        &self,
3240        mut config: &FeatureConfig,
3241    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
3242        FeatureProxyInterface::r#update_feature_config(self, config)
3243    }
3244
3245    /// Returns the current OpenThread feature configuration for this
3246    /// interface.
3247    ///
3248    /// A unset field in the returned value means that feature is not
3249    /// supported.
3250    pub fn r#get_feature_config(
3251        &self,
3252    ) -> fidl::client::QueryResponseFut<FeatureConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
3253    {
3254        FeatureProxyInterface::r#get_feature_config(self)
3255    }
3256}
3257
3258impl FeatureProxyInterface for FeatureProxy {
3259    type UpdateFeatureConfigResponseFut =
3260        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
3261    fn r#update_feature_config(
3262        &self,
3263        mut config: &FeatureConfig,
3264    ) -> Self::UpdateFeatureConfigResponseFut {
3265        fn _decode(
3266            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3267        ) -> Result<(), fidl::Error> {
3268            let _response = fidl::client::decode_transaction_body::<
3269                fidl::encoding::EmptyPayload,
3270                fidl::encoding::DefaultFuchsiaResourceDialect,
3271                0x2d24a706e8730410,
3272            >(_buf?)?;
3273            Ok(_response)
3274        }
3275        self.client.send_query_and_decode::<FeatureUpdateFeatureConfigRequest, ()>(
3276            (config,),
3277            0x2d24a706e8730410,
3278            fidl::encoding::DynamicFlags::empty(),
3279            _decode,
3280        )
3281    }
3282
3283    type GetFeatureConfigResponseFut = fidl::client::QueryResponseFut<
3284        FeatureConfig,
3285        fidl::encoding::DefaultFuchsiaResourceDialect,
3286    >;
3287    fn r#get_feature_config(&self) -> Self::GetFeatureConfigResponseFut {
3288        fn _decode(
3289            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3290        ) -> Result<FeatureConfig, fidl::Error> {
3291            let _response = fidl::client::decode_transaction_body::<
3292                FeatureGetFeatureConfigResponse,
3293                fidl::encoding::DefaultFuchsiaResourceDialect,
3294                0x2ab1896aea843611,
3295            >(_buf?)?;
3296            Ok(_response.config)
3297        }
3298        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, FeatureConfig>(
3299            (),
3300            0x2ab1896aea843611,
3301            fidl::encoding::DynamicFlags::empty(),
3302            _decode,
3303        )
3304    }
3305}
3306
3307pub struct FeatureEventStream {
3308    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3309}
3310
3311impl std::marker::Unpin for FeatureEventStream {}
3312
3313impl futures::stream::FusedStream for FeatureEventStream {
3314    fn is_terminated(&self) -> bool {
3315        self.event_receiver.is_terminated()
3316    }
3317}
3318
3319impl futures::Stream for FeatureEventStream {
3320    type Item = Result<FeatureEvent, fidl::Error>;
3321
3322    fn poll_next(
3323        mut self: std::pin::Pin<&mut Self>,
3324        cx: &mut std::task::Context<'_>,
3325    ) -> std::task::Poll<Option<Self::Item>> {
3326        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3327            &mut self.event_receiver,
3328            cx
3329        )?) {
3330            Some(buf) => std::task::Poll::Ready(Some(FeatureEvent::decode(buf))),
3331            None => std::task::Poll::Ready(None),
3332        }
3333    }
3334}
3335
3336#[derive(Debug)]
3337pub enum FeatureEvent {}
3338
3339impl FeatureEvent {
3340    /// Decodes a message buffer as a [`FeatureEvent`].
3341    fn decode(
3342        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3343    ) -> Result<FeatureEvent, fidl::Error> {
3344        let (bytes, _handles) = buf.split_mut();
3345        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3346        debug_assert_eq!(tx_header.tx_id, 0);
3347        match tx_header.ordinal {
3348            _ => Err(fidl::Error::UnknownOrdinal {
3349                ordinal: tx_header.ordinal,
3350                protocol_name: <FeatureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3351            }),
3352        }
3353    }
3354}
3355
3356/// A Stream of incoming requests for fuchsia.lowpan.thread/Feature.
3357pub struct FeatureRequestStream {
3358    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3359    is_terminated: bool,
3360}
3361
3362impl std::marker::Unpin for FeatureRequestStream {}
3363
3364impl futures::stream::FusedStream for FeatureRequestStream {
3365    fn is_terminated(&self) -> bool {
3366        self.is_terminated
3367    }
3368}
3369
3370impl fidl::endpoints::RequestStream for FeatureRequestStream {
3371    type Protocol = FeatureMarker;
3372    type ControlHandle = FeatureControlHandle;
3373
3374    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3375        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3376    }
3377
3378    fn control_handle(&self) -> Self::ControlHandle {
3379        FeatureControlHandle { inner: self.inner.clone() }
3380    }
3381
3382    fn into_inner(
3383        self,
3384    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3385    {
3386        (self.inner, self.is_terminated)
3387    }
3388
3389    fn from_inner(
3390        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3391        is_terminated: bool,
3392    ) -> Self {
3393        Self { inner, is_terminated }
3394    }
3395}
3396
3397impl futures::Stream for FeatureRequestStream {
3398    type Item = Result<FeatureRequest, fidl::Error>;
3399
3400    fn poll_next(
3401        mut self: std::pin::Pin<&mut Self>,
3402        cx: &mut std::task::Context<'_>,
3403    ) -> std::task::Poll<Option<Self::Item>> {
3404        let this = &mut *self;
3405        if this.inner.check_shutdown(cx) {
3406            this.is_terminated = true;
3407            return std::task::Poll::Ready(None);
3408        }
3409        if this.is_terminated {
3410            panic!("polled FeatureRequestStream after completion");
3411        }
3412        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3413            |bytes, handles| {
3414                match this.inner.channel().read_etc(cx, bytes, handles) {
3415                    std::task::Poll::Ready(Ok(())) => {}
3416                    std::task::Poll::Pending => return std::task::Poll::Pending,
3417                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3418                        this.is_terminated = true;
3419                        return std::task::Poll::Ready(None);
3420                    }
3421                    std::task::Poll::Ready(Err(e)) => {
3422                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3423                            e.into(),
3424                        ))));
3425                    }
3426                }
3427
3428                // A message has been received from the channel
3429                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3430
3431                std::task::Poll::Ready(Some(match header.ordinal {
3432                    0x2d24a706e8730410 => {
3433                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3434                        let mut req = fidl::new_empty!(
3435                            FeatureUpdateFeatureConfigRequest,
3436                            fidl::encoding::DefaultFuchsiaResourceDialect
3437                        );
3438                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FeatureUpdateFeatureConfigRequest>(&header, _body_bytes, handles, &mut req)?;
3439                        let control_handle = FeatureControlHandle { inner: this.inner.clone() };
3440                        Ok(FeatureRequest::UpdateFeatureConfig {
3441                            config: req.config,
3442
3443                            responder: FeatureUpdateFeatureConfigResponder {
3444                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3445                                tx_id: header.tx_id,
3446                            },
3447                        })
3448                    }
3449                    0x2ab1896aea843611 => {
3450                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3451                        let mut req = fidl::new_empty!(
3452                            fidl::encoding::EmptyPayload,
3453                            fidl::encoding::DefaultFuchsiaResourceDialect
3454                        );
3455                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3456                        let control_handle = FeatureControlHandle { inner: this.inner.clone() };
3457                        Ok(FeatureRequest::GetFeatureConfig {
3458                            responder: FeatureGetFeatureConfigResponder {
3459                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3460                                tx_id: header.tx_id,
3461                            },
3462                        })
3463                    }
3464                    _ => Err(fidl::Error::UnknownOrdinal {
3465                        ordinal: header.ordinal,
3466                        protocol_name:
3467                            <FeatureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3468                    }),
3469                }))
3470            },
3471        )
3472    }
3473}
3474
3475/// Protocol for fetching and updating the OpenThread feature configuration
3476/// for a specific LoWPAN interface.
3477#[derive(Debug)]
3478pub enum FeatureRequest {
3479    /// Updates the current OpenThread feature configuration for this
3480    /// interface.
3481    ///
3482    /// Any unset field in `config` will leave that field unchanged.
3483    UpdateFeatureConfig { config: FeatureConfig, responder: FeatureUpdateFeatureConfigResponder },
3484    /// Returns the current OpenThread feature configuration for this
3485    /// interface.
3486    ///
3487    /// A unset field in the returned value means that feature is not
3488    /// supported.
3489    GetFeatureConfig { responder: FeatureGetFeatureConfigResponder },
3490}
3491
3492impl FeatureRequest {
3493    #[allow(irrefutable_let_patterns)]
3494    pub fn into_update_feature_config(
3495        self,
3496    ) -> Option<(FeatureConfig, FeatureUpdateFeatureConfigResponder)> {
3497        if let FeatureRequest::UpdateFeatureConfig { config, responder } = self {
3498            Some((config, responder))
3499        } else {
3500            None
3501        }
3502    }
3503
3504    #[allow(irrefutable_let_patterns)]
3505    pub fn into_get_feature_config(self) -> Option<(FeatureGetFeatureConfigResponder)> {
3506        if let FeatureRequest::GetFeatureConfig { responder } = self {
3507            Some((responder))
3508        } else {
3509            None
3510        }
3511    }
3512
3513    /// Name of the method defined in FIDL
3514    pub fn method_name(&self) -> &'static str {
3515        match *self {
3516            FeatureRequest::UpdateFeatureConfig { .. } => "update_feature_config",
3517            FeatureRequest::GetFeatureConfig { .. } => "get_feature_config",
3518        }
3519    }
3520}
3521
3522#[derive(Debug, Clone)]
3523pub struct FeatureControlHandle {
3524    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3525}
3526
3527impl FeatureControlHandle {
3528    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3529        self.inner.shutdown_with_epitaph(status.into())
3530    }
3531}
3532
3533impl fidl::endpoints::ControlHandle for FeatureControlHandle {
3534    fn shutdown(&self) {
3535        self.inner.shutdown()
3536    }
3537
3538    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3539        self.inner.shutdown_with_epitaph(status)
3540    }
3541
3542    fn is_closed(&self) -> bool {
3543        self.inner.channel().is_closed()
3544    }
3545    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3546        self.inner.channel().on_closed()
3547    }
3548
3549    #[cfg(target_os = "fuchsia")]
3550    fn signal_peer(
3551        &self,
3552        clear_mask: zx::Signals,
3553        set_mask: zx::Signals,
3554    ) -> Result<(), zx_status::Status> {
3555        use fidl::Peered;
3556        self.inner.channel().signal_peer(clear_mask, set_mask)
3557    }
3558}
3559
3560impl FeatureControlHandle {}
3561
3562#[must_use = "FIDL methods require a response to be sent"]
3563#[derive(Debug)]
3564pub struct FeatureUpdateFeatureConfigResponder {
3565    control_handle: std::mem::ManuallyDrop<FeatureControlHandle>,
3566    tx_id: u32,
3567}
3568
3569/// Set the the channel to be shutdown (see [`FeatureControlHandle::shutdown`])
3570/// if the responder is dropped without sending a response, so that the client
3571/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3572impl std::ops::Drop for FeatureUpdateFeatureConfigResponder {
3573    fn drop(&mut self) {
3574        self.control_handle.shutdown();
3575        // Safety: drops once, never accessed again
3576        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3577    }
3578}
3579
3580impl fidl::endpoints::Responder for FeatureUpdateFeatureConfigResponder {
3581    type ControlHandle = FeatureControlHandle;
3582
3583    fn control_handle(&self) -> &FeatureControlHandle {
3584        &self.control_handle
3585    }
3586
3587    fn drop_without_shutdown(mut self) {
3588        // Safety: drops once, never accessed again due to mem::forget
3589        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3590        // Prevent Drop from running (which would shut down the channel)
3591        std::mem::forget(self);
3592    }
3593}
3594
3595impl FeatureUpdateFeatureConfigResponder {
3596    /// Sends a response to the FIDL transaction.
3597    ///
3598    /// Sets the channel to shutdown if an error occurs.
3599    pub fn send(self) -> Result<(), fidl::Error> {
3600        let _result = self.send_raw();
3601        if _result.is_err() {
3602            self.control_handle.shutdown();
3603        }
3604        self.drop_without_shutdown();
3605        _result
3606    }
3607
3608    /// Similar to "send" but does not shutdown the channel if an error occurs.
3609    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3610        let _result = self.send_raw();
3611        self.drop_without_shutdown();
3612        _result
3613    }
3614
3615    fn send_raw(&self) -> Result<(), fidl::Error> {
3616        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
3617            (),
3618            self.tx_id,
3619            0x2d24a706e8730410,
3620            fidl::encoding::DynamicFlags::empty(),
3621        )
3622    }
3623}
3624
3625#[must_use = "FIDL methods require a response to be sent"]
3626#[derive(Debug)]
3627pub struct FeatureGetFeatureConfigResponder {
3628    control_handle: std::mem::ManuallyDrop<FeatureControlHandle>,
3629    tx_id: u32,
3630}
3631
3632/// Set the the channel to be shutdown (see [`FeatureControlHandle::shutdown`])
3633/// if the responder is dropped without sending a response, so that the client
3634/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3635impl std::ops::Drop for FeatureGetFeatureConfigResponder {
3636    fn drop(&mut self) {
3637        self.control_handle.shutdown();
3638        // Safety: drops once, never accessed again
3639        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3640    }
3641}
3642
3643impl fidl::endpoints::Responder for FeatureGetFeatureConfigResponder {
3644    type ControlHandle = FeatureControlHandle;
3645
3646    fn control_handle(&self) -> &FeatureControlHandle {
3647        &self.control_handle
3648    }
3649
3650    fn drop_without_shutdown(mut self) {
3651        // Safety: drops once, never accessed again due to mem::forget
3652        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3653        // Prevent Drop from running (which would shut down the channel)
3654        std::mem::forget(self);
3655    }
3656}
3657
3658impl FeatureGetFeatureConfigResponder {
3659    /// Sends a response to the FIDL transaction.
3660    ///
3661    /// Sets the channel to shutdown if an error occurs.
3662    pub fn send(self, mut config: &FeatureConfig) -> Result<(), fidl::Error> {
3663        let _result = self.send_raw(config);
3664        if _result.is_err() {
3665            self.control_handle.shutdown();
3666        }
3667        self.drop_without_shutdown();
3668        _result
3669    }
3670
3671    /// Similar to "send" but does not shutdown the channel if an error occurs.
3672    pub fn send_no_shutdown_on_err(self, mut config: &FeatureConfig) -> Result<(), fidl::Error> {
3673        let _result = self.send_raw(config);
3674        self.drop_without_shutdown();
3675        _result
3676    }
3677
3678    fn send_raw(&self, mut config: &FeatureConfig) -> Result<(), fidl::Error> {
3679        self.control_handle.inner.send::<FeatureGetFeatureConfigResponse>(
3680            (config,),
3681            self.tx_id,
3682            0x2ab1896aea843611,
3683            fidl::encoding::DynamicFlags::empty(),
3684        )
3685    }
3686}
3687
3688#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3689pub struct FeatureConnectorMarker;
3690
3691impl fidl::endpoints::ProtocolMarker for FeatureConnectorMarker {
3692    type Proxy = FeatureConnectorProxy;
3693    type RequestStream = FeatureConnectorRequestStream;
3694    #[cfg(target_os = "fuchsia")]
3695    type SynchronousProxy = FeatureConnectorSynchronousProxy;
3696
3697    const DEBUG_NAME: &'static str = "fuchsia.lowpan.thread.FeatureConnector";
3698}
3699impl fidl::endpoints::DiscoverableProtocolMarker for FeatureConnectorMarker {}
3700
3701pub trait FeatureConnectorProxyInterface: Send + Sync {
3702    fn r#connect(
3703        &self,
3704        name: &str,
3705        server_end: fidl::endpoints::ServerEnd<FeatureMarker>,
3706    ) -> Result<(), fidl::Error>;
3707}
3708#[derive(Debug)]
3709#[cfg(target_os = "fuchsia")]
3710pub struct FeatureConnectorSynchronousProxy {
3711    client: fidl::client::sync::Client,
3712}
3713
3714#[cfg(target_os = "fuchsia")]
3715impl fidl::endpoints::SynchronousProxy for FeatureConnectorSynchronousProxy {
3716    type Proxy = FeatureConnectorProxy;
3717    type Protocol = FeatureConnectorMarker;
3718
3719    fn from_channel(inner: fidl::Channel) -> Self {
3720        Self::new(inner)
3721    }
3722
3723    fn into_channel(self) -> fidl::Channel {
3724        self.client.into_channel()
3725    }
3726
3727    fn as_channel(&self) -> &fidl::Channel {
3728        self.client.as_channel()
3729    }
3730}
3731
3732#[cfg(target_os = "fuchsia")]
3733impl FeatureConnectorSynchronousProxy {
3734    pub fn new(channel: fidl::Channel) -> Self {
3735        Self { client: fidl::client::sync::Client::new(channel) }
3736    }
3737
3738    pub fn into_channel(self) -> fidl::Channel {
3739        self.client.into_channel()
3740    }
3741
3742    /// Waits until an event arrives and returns it. It is safe for other
3743    /// threads to make concurrent requests while waiting for an event.
3744    pub fn wait_for_event(
3745        &self,
3746        deadline: zx::MonotonicInstant,
3747    ) -> Result<FeatureConnectorEvent, fidl::Error> {
3748        FeatureConnectorEvent::decode(
3749            self.client.wait_for_event::<FeatureConnectorMarker>(deadline)?,
3750        )
3751    }
3752
3753    /// Connects to the [`Feature`] protocol on the
3754    /// named LoWPAN device.
3755    ///
3756    /// The name of the interface can be learned by calling
3757    /// [`fuchsia.lowpan/Lookup.GetDevices`].
3758    ///
3759    /// If there is an error in processing this request
3760    /// the given channel is closed and an epitaph code used
3761    /// to describe the reason for the failure:
3762    ///
3763    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
3764    ///   was not formatted correctly or otherwise invalid.
3765    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
3766    ///   given name.
3767    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
3768    ///   does not support this protocol.
3769    pub fn r#connect(
3770        &self,
3771        mut name: &str,
3772        mut server_end: fidl::endpoints::ServerEnd<FeatureMarker>,
3773    ) -> Result<(), fidl::Error> {
3774        self.client.send::<FeatureConnectorConnectRequest>(
3775            (name, server_end),
3776            0x470f006d630987a5,
3777            fidl::encoding::DynamicFlags::empty(),
3778        )
3779    }
3780}
3781
3782#[cfg(target_os = "fuchsia")]
3783impl From<FeatureConnectorSynchronousProxy> for zx::NullableHandle {
3784    fn from(value: FeatureConnectorSynchronousProxy) -> Self {
3785        value.into_channel().into()
3786    }
3787}
3788
3789#[cfg(target_os = "fuchsia")]
3790impl From<fidl::Channel> for FeatureConnectorSynchronousProxy {
3791    fn from(value: fidl::Channel) -> Self {
3792        Self::new(value)
3793    }
3794}
3795
3796#[cfg(target_os = "fuchsia")]
3797impl fidl::endpoints::FromClient for FeatureConnectorSynchronousProxy {
3798    type Protocol = FeatureConnectorMarker;
3799
3800    fn from_client(value: fidl::endpoints::ClientEnd<FeatureConnectorMarker>) -> Self {
3801        Self::new(value.into_channel())
3802    }
3803}
3804
3805#[derive(Debug, Clone)]
3806pub struct FeatureConnectorProxy {
3807    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3808}
3809
3810impl fidl::endpoints::Proxy for FeatureConnectorProxy {
3811    type Protocol = FeatureConnectorMarker;
3812
3813    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3814        Self::new(inner)
3815    }
3816
3817    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3818        self.client.into_channel().map_err(|client| Self { client })
3819    }
3820
3821    fn as_channel(&self) -> &::fidl::AsyncChannel {
3822        self.client.as_channel()
3823    }
3824}
3825
3826impl FeatureConnectorProxy {
3827    /// Create a new Proxy for fuchsia.lowpan.thread/FeatureConnector.
3828    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3829        let protocol_name = <FeatureConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3830        Self { client: fidl::client::Client::new(channel, protocol_name) }
3831    }
3832
3833    /// Get a Stream of events from the remote end of the protocol.
3834    ///
3835    /// # Panics
3836    ///
3837    /// Panics if the event stream was already taken.
3838    pub fn take_event_stream(&self) -> FeatureConnectorEventStream {
3839        FeatureConnectorEventStream { event_receiver: self.client.take_event_receiver() }
3840    }
3841
3842    /// Connects to the [`Feature`] protocol on the
3843    /// named LoWPAN device.
3844    ///
3845    /// The name of the interface can be learned by calling
3846    /// [`fuchsia.lowpan/Lookup.GetDevices`].
3847    ///
3848    /// If there is an error in processing this request
3849    /// the given channel is closed and an epitaph code used
3850    /// to describe the reason for the failure:
3851    ///
3852    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
3853    ///   was not formatted correctly or otherwise invalid.
3854    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
3855    ///   given name.
3856    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
3857    ///   does not support this protocol.
3858    pub fn r#connect(
3859        &self,
3860        mut name: &str,
3861        mut server_end: fidl::endpoints::ServerEnd<FeatureMarker>,
3862    ) -> Result<(), fidl::Error> {
3863        FeatureConnectorProxyInterface::r#connect(self, name, server_end)
3864    }
3865}
3866
3867impl FeatureConnectorProxyInterface for FeatureConnectorProxy {
3868    fn r#connect(
3869        &self,
3870        mut name: &str,
3871        mut server_end: fidl::endpoints::ServerEnd<FeatureMarker>,
3872    ) -> Result<(), fidl::Error> {
3873        self.client.send::<FeatureConnectorConnectRequest>(
3874            (name, server_end),
3875            0x470f006d630987a5,
3876            fidl::encoding::DynamicFlags::empty(),
3877        )
3878    }
3879}
3880
3881pub struct FeatureConnectorEventStream {
3882    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3883}
3884
3885impl std::marker::Unpin for FeatureConnectorEventStream {}
3886
3887impl futures::stream::FusedStream for FeatureConnectorEventStream {
3888    fn is_terminated(&self) -> bool {
3889        self.event_receiver.is_terminated()
3890    }
3891}
3892
3893impl futures::Stream for FeatureConnectorEventStream {
3894    type Item = Result<FeatureConnectorEvent, fidl::Error>;
3895
3896    fn poll_next(
3897        mut self: std::pin::Pin<&mut Self>,
3898        cx: &mut std::task::Context<'_>,
3899    ) -> std::task::Poll<Option<Self::Item>> {
3900        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3901            &mut self.event_receiver,
3902            cx
3903        )?) {
3904            Some(buf) => std::task::Poll::Ready(Some(FeatureConnectorEvent::decode(buf))),
3905            None => std::task::Poll::Ready(None),
3906        }
3907    }
3908}
3909
3910#[derive(Debug)]
3911pub enum FeatureConnectorEvent {}
3912
3913impl FeatureConnectorEvent {
3914    /// Decodes a message buffer as a [`FeatureConnectorEvent`].
3915    fn decode(
3916        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3917    ) -> Result<FeatureConnectorEvent, fidl::Error> {
3918        let (bytes, _handles) = buf.split_mut();
3919        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3920        debug_assert_eq!(tx_header.tx_id, 0);
3921        match tx_header.ordinal {
3922            _ => Err(fidl::Error::UnknownOrdinal {
3923                ordinal: tx_header.ordinal,
3924                protocol_name:
3925                    <FeatureConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3926            }),
3927        }
3928    }
3929}
3930
3931/// A Stream of incoming requests for fuchsia.lowpan.thread/FeatureConnector.
3932pub struct FeatureConnectorRequestStream {
3933    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3934    is_terminated: bool,
3935}
3936
3937impl std::marker::Unpin for FeatureConnectorRequestStream {}
3938
3939impl futures::stream::FusedStream for FeatureConnectorRequestStream {
3940    fn is_terminated(&self) -> bool {
3941        self.is_terminated
3942    }
3943}
3944
3945impl fidl::endpoints::RequestStream for FeatureConnectorRequestStream {
3946    type Protocol = FeatureConnectorMarker;
3947    type ControlHandle = FeatureConnectorControlHandle;
3948
3949    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3950        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3951    }
3952
3953    fn control_handle(&self) -> Self::ControlHandle {
3954        FeatureConnectorControlHandle { inner: self.inner.clone() }
3955    }
3956
3957    fn into_inner(
3958        self,
3959    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3960    {
3961        (self.inner, self.is_terminated)
3962    }
3963
3964    fn from_inner(
3965        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3966        is_terminated: bool,
3967    ) -> Self {
3968        Self { inner, is_terminated }
3969    }
3970}
3971
3972impl futures::Stream for FeatureConnectorRequestStream {
3973    type Item = Result<FeatureConnectorRequest, fidl::Error>;
3974
3975    fn poll_next(
3976        mut self: std::pin::Pin<&mut Self>,
3977        cx: &mut std::task::Context<'_>,
3978    ) -> std::task::Poll<Option<Self::Item>> {
3979        let this = &mut *self;
3980        if this.inner.check_shutdown(cx) {
3981            this.is_terminated = true;
3982            return std::task::Poll::Ready(None);
3983        }
3984        if this.is_terminated {
3985            panic!("polled FeatureConnectorRequestStream after completion");
3986        }
3987        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3988            |bytes, handles| {
3989                match this.inner.channel().read_etc(cx, bytes, handles) {
3990                    std::task::Poll::Ready(Ok(())) => {}
3991                    std::task::Poll::Pending => return std::task::Poll::Pending,
3992                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3993                        this.is_terminated = true;
3994                        return std::task::Poll::Ready(None);
3995                    }
3996                    std::task::Poll::Ready(Err(e)) => {
3997                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3998                            e.into(),
3999                        ))));
4000                    }
4001                }
4002
4003                // A message has been received from the channel
4004                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4005
4006                std::task::Poll::Ready(Some(match header.ordinal {
4007                    0x470f006d630987a5 => {
4008                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4009                        let mut req = fidl::new_empty!(
4010                            FeatureConnectorConnectRequest,
4011                            fidl::encoding::DefaultFuchsiaResourceDialect
4012                        );
4013                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FeatureConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
4014                        let control_handle =
4015                            FeatureConnectorControlHandle { inner: this.inner.clone() };
4016                        Ok(FeatureConnectorRequest::Connect {
4017                            name: req.name,
4018                            server_end: req.server_end,
4019
4020                            control_handle,
4021                        })
4022                    }
4023                    _ => Err(fidl::Error::UnknownOrdinal {
4024                        ordinal: header.ordinal,
4025                        protocol_name:
4026                            <FeatureConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4027                    }),
4028                }))
4029            },
4030        )
4031    }
4032}
4033
4034/// Protocol for connecting to [`Feature`] on a LoWPAN device.
4035#[derive(Debug)]
4036pub enum FeatureConnectorRequest {
4037    /// Connects to the [`Feature`] protocol on the
4038    /// named LoWPAN device.
4039    ///
4040    /// The name of the interface can be learned by calling
4041    /// [`fuchsia.lowpan/Lookup.GetDevices`].
4042    ///
4043    /// If there is an error in processing this request
4044    /// the given channel is closed and an epitaph code used
4045    /// to describe the reason for the failure:
4046    ///
4047    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
4048    ///   was not formatted correctly or otherwise invalid.
4049    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
4050    ///   given name.
4051    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
4052    ///   does not support this protocol.
4053    Connect {
4054        name: String,
4055        server_end: fidl::endpoints::ServerEnd<FeatureMarker>,
4056        control_handle: FeatureConnectorControlHandle,
4057    },
4058}
4059
4060impl FeatureConnectorRequest {
4061    #[allow(irrefutable_let_patterns)]
4062    pub fn into_connect(
4063        self,
4064    ) -> Option<(String, fidl::endpoints::ServerEnd<FeatureMarker>, FeatureConnectorControlHandle)>
4065    {
4066        if let FeatureConnectorRequest::Connect { name, server_end, control_handle } = self {
4067            Some((name, server_end, control_handle))
4068        } else {
4069            None
4070        }
4071    }
4072
4073    /// Name of the method defined in FIDL
4074    pub fn method_name(&self) -> &'static str {
4075        match *self {
4076            FeatureConnectorRequest::Connect { .. } => "connect",
4077        }
4078    }
4079}
4080
4081#[derive(Debug, Clone)]
4082pub struct FeatureConnectorControlHandle {
4083    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4084}
4085
4086impl FeatureConnectorControlHandle {
4087    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
4088        self.inner.shutdown_with_epitaph(status.into())
4089    }
4090}
4091
4092impl fidl::endpoints::ControlHandle for FeatureConnectorControlHandle {
4093    fn shutdown(&self) {
4094        self.inner.shutdown()
4095    }
4096
4097    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4098        self.inner.shutdown_with_epitaph(status)
4099    }
4100
4101    fn is_closed(&self) -> bool {
4102        self.inner.channel().is_closed()
4103    }
4104    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4105        self.inner.channel().on_closed()
4106    }
4107
4108    #[cfg(target_os = "fuchsia")]
4109    fn signal_peer(
4110        &self,
4111        clear_mask: zx::Signals,
4112        set_mask: zx::Signals,
4113    ) -> Result<(), zx_status::Status> {
4114        use fidl::Peered;
4115        self.inner.channel().signal_peer(clear_mask, set_mask)
4116    }
4117}
4118
4119impl FeatureConnectorControlHandle {}
4120
4121#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4122pub struct MeshcopMarker;
4123
4124impl fidl::endpoints::ProtocolMarker for MeshcopMarker {
4125    type Proxy = MeshcopProxy;
4126    type RequestStream = MeshcopRequestStream;
4127    #[cfg(target_os = "fuchsia")]
4128    type SynchronousProxy = MeshcopSynchronousProxy;
4129
4130    const DEBUG_NAME: &'static str = "(anonymous) Meshcop";
4131}
4132
4133pub trait MeshcopProxyInterface: Send + Sync {
4134    type UpdateTxtEntriesResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
4135    fn r#update_txt_entries(&self, txt_entries: &[TxtEntries])
4136    -> Self::UpdateTxtEntriesResponseFut;
4137}
4138#[derive(Debug)]
4139#[cfg(target_os = "fuchsia")]
4140pub struct MeshcopSynchronousProxy {
4141    client: fidl::client::sync::Client,
4142}
4143
4144#[cfg(target_os = "fuchsia")]
4145impl fidl::endpoints::SynchronousProxy for MeshcopSynchronousProxy {
4146    type Proxy = MeshcopProxy;
4147    type Protocol = MeshcopMarker;
4148
4149    fn from_channel(inner: fidl::Channel) -> Self {
4150        Self::new(inner)
4151    }
4152
4153    fn into_channel(self) -> fidl::Channel {
4154        self.client.into_channel()
4155    }
4156
4157    fn as_channel(&self) -> &fidl::Channel {
4158        self.client.as_channel()
4159    }
4160}
4161
4162#[cfg(target_os = "fuchsia")]
4163impl MeshcopSynchronousProxy {
4164    pub fn new(channel: fidl::Channel) -> Self {
4165        Self { client: fidl::client::sync::Client::new(channel) }
4166    }
4167
4168    pub fn into_channel(self) -> fidl::Channel {
4169        self.client.into_channel()
4170    }
4171
4172    /// Waits until an event arrives and returns it. It is safe for other
4173    /// threads to make concurrent requests while waiting for an event.
4174    pub fn wait_for_event(
4175        &self,
4176        deadline: zx::MonotonicInstant,
4177    ) -> Result<MeshcopEvent, fidl::Error> {
4178        MeshcopEvent::decode(self.client.wait_for_event::<MeshcopMarker>(deadline)?)
4179    }
4180
4181    /// Updates the TXT record information associated with the Meshcop border
4182    /// agent DNS-SD entry. This allows additional information about the
4183    /// device to be discoverable on the local network when acting as a
4184    /// border agent.
4185    ///
4186    /// Functionally equivalent to `ot-br-posix`'s
4187    /// [`UpdateVendorMeshCopTxtEntries`][1].
4188    ///
4189    /// Typically, the following keys are updated:
4190    ///
4191    /// * `vn`: Vendor Name
4192    /// * `mn`: Model Name
4193    /// * `vo`: Vendor OUI
4194    /// * `vd`/`vcd`: Vendor-specific Data
4195    ///
4196    /// See table 8-4 in section 8.4.1.1.2 of the Thread 1.2 specification for
4197    /// a detailed explanation of all the keys and their values.
4198    ///
4199    /// Any error that prevents the operation from completing successfully
4200    /// (such as being provided with invalid keys) will result in the
4201    /// protocol being closed.
4202    ///
4203    /// [1]: https://github.com/openthread/ot-br-posix/blob/0b5c6e1ecb8152ef6cea57c09b8a37a020fc4d6f/src/dbus/server/introspect.xml#L196-L210
4204    pub fn r#update_txt_entries(
4205        &self,
4206        mut txt_entries: &[TxtEntries],
4207        ___deadline: zx::MonotonicInstant,
4208    ) -> Result<(), fidl::Error> {
4209        let _response = self.client.send_query::<
4210            MeshcopUpdateTxtEntriesRequest,
4211            fidl::encoding::EmptyPayload,
4212            MeshcopMarker,
4213        >(
4214            (txt_entries,),
4215            0x358d4d9593140bed,
4216            fidl::encoding::DynamicFlags::empty(),
4217            ___deadline,
4218        )?;
4219        Ok(_response)
4220    }
4221}
4222
4223#[cfg(target_os = "fuchsia")]
4224impl From<MeshcopSynchronousProxy> for zx::NullableHandle {
4225    fn from(value: MeshcopSynchronousProxy) -> Self {
4226        value.into_channel().into()
4227    }
4228}
4229
4230#[cfg(target_os = "fuchsia")]
4231impl From<fidl::Channel> for MeshcopSynchronousProxy {
4232    fn from(value: fidl::Channel) -> Self {
4233        Self::new(value)
4234    }
4235}
4236
4237#[cfg(target_os = "fuchsia")]
4238impl fidl::endpoints::FromClient for MeshcopSynchronousProxy {
4239    type Protocol = MeshcopMarker;
4240
4241    fn from_client(value: fidl::endpoints::ClientEnd<MeshcopMarker>) -> Self {
4242        Self::new(value.into_channel())
4243    }
4244}
4245
4246#[derive(Debug, Clone)]
4247pub struct MeshcopProxy {
4248    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4249}
4250
4251impl fidl::endpoints::Proxy for MeshcopProxy {
4252    type Protocol = MeshcopMarker;
4253
4254    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4255        Self::new(inner)
4256    }
4257
4258    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4259        self.client.into_channel().map_err(|client| Self { client })
4260    }
4261
4262    fn as_channel(&self) -> &::fidl::AsyncChannel {
4263        self.client.as_channel()
4264    }
4265}
4266
4267impl MeshcopProxy {
4268    /// Create a new Proxy for fuchsia.lowpan.thread/Meshcop.
4269    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4270        let protocol_name = <MeshcopMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4271        Self { client: fidl::client::Client::new(channel, protocol_name) }
4272    }
4273
4274    /// Get a Stream of events from the remote end of the protocol.
4275    ///
4276    /// # Panics
4277    ///
4278    /// Panics if the event stream was already taken.
4279    pub fn take_event_stream(&self) -> MeshcopEventStream {
4280        MeshcopEventStream { event_receiver: self.client.take_event_receiver() }
4281    }
4282
4283    /// Updates the TXT record information associated with the Meshcop border
4284    /// agent DNS-SD entry. This allows additional information about the
4285    /// device to be discoverable on the local network when acting as a
4286    /// border agent.
4287    ///
4288    /// Functionally equivalent to `ot-br-posix`'s
4289    /// [`UpdateVendorMeshCopTxtEntries`][1].
4290    ///
4291    /// Typically, the following keys are updated:
4292    ///
4293    /// * `vn`: Vendor Name
4294    /// * `mn`: Model Name
4295    /// * `vo`: Vendor OUI
4296    /// * `vd`/`vcd`: Vendor-specific Data
4297    ///
4298    /// See table 8-4 in section 8.4.1.1.2 of the Thread 1.2 specification for
4299    /// a detailed explanation of all the keys and their values.
4300    ///
4301    /// Any error that prevents the operation from completing successfully
4302    /// (such as being provided with invalid keys) will result in the
4303    /// protocol being closed.
4304    ///
4305    /// [1]: https://github.com/openthread/ot-br-posix/blob/0b5c6e1ecb8152ef6cea57c09b8a37a020fc4d6f/src/dbus/server/introspect.xml#L196-L210
4306    pub fn r#update_txt_entries(
4307        &self,
4308        mut txt_entries: &[TxtEntries],
4309    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
4310        MeshcopProxyInterface::r#update_txt_entries(self, txt_entries)
4311    }
4312}
4313
4314impl MeshcopProxyInterface for MeshcopProxy {
4315    type UpdateTxtEntriesResponseFut =
4316        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
4317    fn r#update_txt_entries(
4318        &self,
4319        mut txt_entries: &[TxtEntries],
4320    ) -> Self::UpdateTxtEntriesResponseFut {
4321        fn _decode(
4322            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4323        ) -> Result<(), fidl::Error> {
4324            let _response = fidl::client::decode_transaction_body::<
4325                fidl::encoding::EmptyPayload,
4326                fidl::encoding::DefaultFuchsiaResourceDialect,
4327                0x358d4d9593140bed,
4328            >(_buf?)?;
4329            Ok(_response)
4330        }
4331        self.client.send_query_and_decode::<MeshcopUpdateTxtEntriesRequest, ()>(
4332            (txt_entries,),
4333            0x358d4d9593140bed,
4334            fidl::encoding::DynamicFlags::empty(),
4335            _decode,
4336        )
4337    }
4338}
4339
4340pub struct MeshcopEventStream {
4341    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4342}
4343
4344impl std::marker::Unpin for MeshcopEventStream {}
4345
4346impl futures::stream::FusedStream for MeshcopEventStream {
4347    fn is_terminated(&self) -> bool {
4348        self.event_receiver.is_terminated()
4349    }
4350}
4351
4352impl futures::Stream for MeshcopEventStream {
4353    type Item = Result<MeshcopEvent, fidl::Error>;
4354
4355    fn poll_next(
4356        mut self: std::pin::Pin<&mut Self>,
4357        cx: &mut std::task::Context<'_>,
4358    ) -> std::task::Poll<Option<Self::Item>> {
4359        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4360            &mut self.event_receiver,
4361            cx
4362        )?) {
4363            Some(buf) => std::task::Poll::Ready(Some(MeshcopEvent::decode(buf))),
4364            None => std::task::Poll::Ready(None),
4365        }
4366    }
4367}
4368
4369#[derive(Debug)]
4370pub enum MeshcopEvent {}
4371
4372impl MeshcopEvent {
4373    /// Decodes a message buffer as a [`MeshcopEvent`].
4374    fn decode(
4375        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4376    ) -> Result<MeshcopEvent, fidl::Error> {
4377        let (bytes, _handles) = buf.split_mut();
4378        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4379        debug_assert_eq!(tx_header.tx_id, 0);
4380        match tx_header.ordinal {
4381            _ => Err(fidl::Error::UnknownOrdinal {
4382                ordinal: tx_header.ordinal,
4383                protocol_name: <MeshcopMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4384            }),
4385        }
4386    }
4387}
4388
4389/// A Stream of incoming requests for fuchsia.lowpan.thread/Meshcop.
4390pub struct MeshcopRequestStream {
4391    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4392    is_terminated: bool,
4393}
4394
4395impl std::marker::Unpin for MeshcopRequestStream {}
4396
4397impl futures::stream::FusedStream for MeshcopRequestStream {
4398    fn is_terminated(&self) -> bool {
4399        self.is_terminated
4400    }
4401}
4402
4403impl fidl::endpoints::RequestStream for MeshcopRequestStream {
4404    type Protocol = MeshcopMarker;
4405    type ControlHandle = MeshcopControlHandle;
4406
4407    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4408        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4409    }
4410
4411    fn control_handle(&self) -> Self::ControlHandle {
4412        MeshcopControlHandle { inner: self.inner.clone() }
4413    }
4414
4415    fn into_inner(
4416        self,
4417    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4418    {
4419        (self.inner, self.is_terminated)
4420    }
4421
4422    fn from_inner(
4423        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4424        is_terminated: bool,
4425    ) -> Self {
4426        Self { inner, is_terminated }
4427    }
4428}
4429
4430impl futures::Stream for MeshcopRequestStream {
4431    type Item = Result<MeshcopRequest, fidl::Error>;
4432
4433    fn poll_next(
4434        mut self: std::pin::Pin<&mut Self>,
4435        cx: &mut std::task::Context<'_>,
4436    ) -> std::task::Poll<Option<Self::Item>> {
4437        let this = &mut *self;
4438        if this.inner.check_shutdown(cx) {
4439            this.is_terminated = true;
4440            return std::task::Poll::Ready(None);
4441        }
4442        if this.is_terminated {
4443            panic!("polled MeshcopRequestStream after completion");
4444        }
4445        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4446            |bytes, handles| {
4447                match this.inner.channel().read_etc(cx, bytes, handles) {
4448                    std::task::Poll::Ready(Ok(())) => {}
4449                    std::task::Poll::Pending => return std::task::Poll::Pending,
4450                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4451                        this.is_terminated = true;
4452                        return std::task::Poll::Ready(None);
4453                    }
4454                    std::task::Poll::Ready(Err(e)) => {
4455                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4456                            e.into(),
4457                        ))));
4458                    }
4459                }
4460
4461                // A message has been received from the channel
4462                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4463
4464                std::task::Poll::Ready(Some(match header.ordinal {
4465                    0x358d4d9593140bed => {
4466                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4467                        let mut req = fidl::new_empty!(
4468                            MeshcopUpdateTxtEntriesRequest,
4469                            fidl::encoding::DefaultFuchsiaResourceDialect
4470                        );
4471                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MeshcopUpdateTxtEntriesRequest>(&header, _body_bytes, handles, &mut req)?;
4472                        let control_handle = MeshcopControlHandle { inner: this.inner.clone() };
4473                        Ok(MeshcopRequest::UpdateTxtEntries {
4474                            txt_entries: req.txt_entries,
4475
4476                            responder: MeshcopUpdateTxtEntriesResponder {
4477                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4478                                tx_id: header.tx_id,
4479                            },
4480                        })
4481                    }
4482                    _ => Err(fidl::Error::UnknownOrdinal {
4483                        ordinal: header.ordinal,
4484                        protocol_name:
4485                            <MeshcopMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4486                    }),
4487                }))
4488            },
4489        )
4490    }
4491}
4492
4493/// Methods associated with the Mesh Commissioning Protocol (Meshcop).
4494#[derive(Debug)]
4495pub enum MeshcopRequest {
4496    /// Updates the TXT record information associated with the Meshcop border
4497    /// agent DNS-SD entry. This allows additional information about the
4498    /// device to be discoverable on the local network when acting as a
4499    /// border agent.
4500    ///
4501    /// Functionally equivalent to `ot-br-posix`'s
4502    /// [`UpdateVendorMeshCopTxtEntries`][1].
4503    ///
4504    /// Typically, the following keys are updated:
4505    ///
4506    /// * `vn`: Vendor Name
4507    /// * `mn`: Model Name
4508    /// * `vo`: Vendor OUI
4509    /// * `vd`/`vcd`: Vendor-specific Data
4510    ///
4511    /// See table 8-4 in section 8.4.1.1.2 of the Thread 1.2 specification for
4512    /// a detailed explanation of all the keys and their values.
4513    ///
4514    /// Any error that prevents the operation from completing successfully
4515    /// (such as being provided with invalid keys) will result in the
4516    /// protocol being closed.
4517    ///
4518    /// [1]: https://github.com/openthread/ot-br-posix/blob/0b5c6e1ecb8152ef6cea57c09b8a37a020fc4d6f/src/dbus/server/introspect.xml#L196-L210
4519    UpdateTxtEntries { txt_entries: Vec<TxtEntries>, responder: MeshcopUpdateTxtEntriesResponder },
4520}
4521
4522impl MeshcopRequest {
4523    #[allow(irrefutable_let_patterns)]
4524    pub fn into_update_txt_entries(
4525        self,
4526    ) -> Option<(Vec<TxtEntries>, MeshcopUpdateTxtEntriesResponder)> {
4527        if let MeshcopRequest::UpdateTxtEntries { txt_entries, responder } = self {
4528            Some((txt_entries, responder))
4529        } else {
4530            None
4531        }
4532    }
4533
4534    /// Name of the method defined in FIDL
4535    pub fn method_name(&self) -> &'static str {
4536        match *self {
4537            MeshcopRequest::UpdateTxtEntries { .. } => "update_txt_entries",
4538        }
4539    }
4540}
4541
4542#[derive(Debug, Clone)]
4543pub struct MeshcopControlHandle {
4544    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4545}
4546
4547impl MeshcopControlHandle {
4548    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
4549        self.inner.shutdown_with_epitaph(status.into())
4550    }
4551}
4552
4553impl fidl::endpoints::ControlHandle for MeshcopControlHandle {
4554    fn shutdown(&self) {
4555        self.inner.shutdown()
4556    }
4557
4558    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4559        self.inner.shutdown_with_epitaph(status)
4560    }
4561
4562    fn is_closed(&self) -> bool {
4563        self.inner.channel().is_closed()
4564    }
4565    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4566        self.inner.channel().on_closed()
4567    }
4568
4569    #[cfg(target_os = "fuchsia")]
4570    fn signal_peer(
4571        &self,
4572        clear_mask: zx::Signals,
4573        set_mask: zx::Signals,
4574    ) -> Result<(), zx_status::Status> {
4575        use fidl::Peered;
4576        self.inner.channel().signal_peer(clear_mask, set_mask)
4577    }
4578}
4579
4580impl MeshcopControlHandle {}
4581
4582#[must_use = "FIDL methods require a response to be sent"]
4583#[derive(Debug)]
4584pub struct MeshcopUpdateTxtEntriesResponder {
4585    control_handle: std::mem::ManuallyDrop<MeshcopControlHandle>,
4586    tx_id: u32,
4587}
4588
4589/// Set the the channel to be shutdown (see [`MeshcopControlHandle::shutdown`])
4590/// if the responder is dropped without sending a response, so that the client
4591/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4592impl std::ops::Drop for MeshcopUpdateTxtEntriesResponder {
4593    fn drop(&mut self) {
4594        self.control_handle.shutdown();
4595        // Safety: drops once, never accessed again
4596        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4597    }
4598}
4599
4600impl fidl::endpoints::Responder for MeshcopUpdateTxtEntriesResponder {
4601    type ControlHandle = MeshcopControlHandle;
4602
4603    fn control_handle(&self) -> &MeshcopControlHandle {
4604        &self.control_handle
4605    }
4606
4607    fn drop_without_shutdown(mut self) {
4608        // Safety: drops once, never accessed again due to mem::forget
4609        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4610        // Prevent Drop from running (which would shut down the channel)
4611        std::mem::forget(self);
4612    }
4613}
4614
4615impl MeshcopUpdateTxtEntriesResponder {
4616    /// Sends a response to the FIDL transaction.
4617    ///
4618    /// Sets the channel to shutdown if an error occurs.
4619    pub fn send(self) -> Result<(), fidl::Error> {
4620        let _result = self.send_raw();
4621        if _result.is_err() {
4622            self.control_handle.shutdown();
4623        }
4624        self.drop_without_shutdown();
4625        _result
4626    }
4627
4628    /// Similar to "send" but does not shutdown the channel if an error occurs.
4629    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
4630        let _result = self.send_raw();
4631        self.drop_without_shutdown();
4632        _result
4633    }
4634
4635    fn send_raw(&self) -> Result<(), fidl::Error> {
4636        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
4637            (),
4638            self.tx_id,
4639            0x358d4d9593140bed,
4640            fidl::encoding::DynamicFlags::empty(),
4641        )
4642    }
4643}
4644
4645#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4646pub struct MeshcopConnectorMarker;
4647
4648impl fidl::endpoints::ProtocolMarker for MeshcopConnectorMarker {
4649    type Proxy = MeshcopConnectorProxy;
4650    type RequestStream = MeshcopConnectorRequestStream;
4651    #[cfg(target_os = "fuchsia")]
4652    type SynchronousProxy = MeshcopConnectorSynchronousProxy;
4653
4654    const DEBUG_NAME: &'static str = "fuchsia.lowpan.thread.MeshcopConnector";
4655}
4656impl fidl::endpoints::DiscoverableProtocolMarker for MeshcopConnectorMarker {}
4657
4658pub trait MeshcopConnectorProxyInterface: Send + Sync {
4659    fn r#connect(
4660        &self,
4661        name: &str,
4662        server_end: fidl::endpoints::ServerEnd<MeshcopMarker>,
4663    ) -> Result<(), fidl::Error>;
4664}
4665#[derive(Debug)]
4666#[cfg(target_os = "fuchsia")]
4667pub struct MeshcopConnectorSynchronousProxy {
4668    client: fidl::client::sync::Client,
4669}
4670
4671#[cfg(target_os = "fuchsia")]
4672impl fidl::endpoints::SynchronousProxy for MeshcopConnectorSynchronousProxy {
4673    type Proxy = MeshcopConnectorProxy;
4674    type Protocol = MeshcopConnectorMarker;
4675
4676    fn from_channel(inner: fidl::Channel) -> Self {
4677        Self::new(inner)
4678    }
4679
4680    fn into_channel(self) -> fidl::Channel {
4681        self.client.into_channel()
4682    }
4683
4684    fn as_channel(&self) -> &fidl::Channel {
4685        self.client.as_channel()
4686    }
4687}
4688
4689#[cfg(target_os = "fuchsia")]
4690impl MeshcopConnectorSynchronousProxy {
4691    pub fn new(channel: fidl::Channel) -> Self {
4692        Self { client: fidl::client::sync::Client::new(channel) }
4693    }
4694
4695    pub fn into_channel(self) -> fidl::Channel {
4696        self.client.into_channel()
4697    }
4698
4699    /// Waits until an event arrives and returns it. It is safe for other
4700    /// threads to make concurrent requests while waiting for an event.
4701    pub fn wait_for_event(
4702        &self,
4703        deadline: zx::MonotonicInstant,
4704    ) -> Result<MeshcopConnectorEvent, fidl::Error> {
4705        MeshcopConnectorEvent::decode(
4706            self.client.wait_for_event::<MeshcopConnectorMarker>(deadline)?,
4707        )
4708    }
4709
4710    /// Connects to the [`Meshcop`] protocol on the
4711    /// named LoWPAN interface.
4712    ///
4713    /// The name of the interface can be learned by calling
4714    /// [`fuchsia.lowpan/Lookup.GetDevices`].
4715    ///
4716    /// If there is an error in processing this request
4717    /// the given channel is closed and an epitaph code used
4718    /// to describe the reason for the failure:
4719    ///
4720    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
4721    ///   was not formatted correctly or otherwise invalid.
4722    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
4723    ///   given name.
4724    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
4725    ///   does not support this protocol.
4726    pub fn r#connect(
4727        &self,
4728        mut name: &str,
4729        mut server_end: fidl::endpoints::ServerEnd<MeshcopMarker>,
4730    ) -> Result<(), fidl::Error> {
4731        self.client.send::<MeshcopConnectorConnectRequest>(
4732            (name, server_end),
4733            0x53f87536b40ad6fb,
4734            fidl::encoding::DynamicFlags::empty(),
4735        )
4736    }
4737}
4738
4739#[cfg(target_os = "fuchsia")]
4740impl From<MeshcopConnectorSynchronousProxy> for zx::NullableHandle {
4741    fn from(value: MeshcopConnectorSynchronousProxy) -> Self {
4742        value.into_channel().into()
4743    }
4744}
4745
4746#[cfg(target_os = "fuchsia")]
4747impl From<fidl::Channel> for MeshcopConnectorSynchronousProxy {
4748    fn from(value: fidl::Channel) -> Self {
4749        Self::new(value)
4750    }
4751}
4752
4753#[cfg(target_os = "fuchsia")]
4754impl fidl::endpoints::FromClient for MeshcopConnectorSynchronousProxy {
4755    type Protocol = MeshcopConnectorMarker;
4756
4757    fn from_client(value: fidl::endpoints::ClientEnd<MeshcopConnectorMarker>) -> Self {
4758        Self::new(value.into_channel())
4759    }
4760}
4761
4762#[derive(Debug, Clone)]
4763pub struct MeshcopConnectorProxy {
4764    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4765}
4766
4767impl fidl::endpoints::Proxy for MeshcopConnectorProxy {
4768    type Protocol = MeshcopConnectorMarker;
4769
4770    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4771        Self::new(inner)
4772    }
4773
4774    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4775        self.client.into_channel().map_err(|client| Self { client })
4776    }
4777
4778    fn as_channel(&self) -> &::fidl::AsyncChannel {
4779        self.client.as_channel()
4780    }
4781}
4782
4783impl MeshcopConnectorProxy {
4784    /// Create a new Proxy for fuchsia.lowpan.thread/MeshcopConnector.
4785    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4786        let protocol_name = <MeshcopConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4787        Self { client: fidl::client::Client::new(channel, protocol_name) }
4788    }
4789
4790    /// Get a Stream of events from the remote end of the protocol.
4791    ///
4792    /// # Panics
4793    ///
4794    /// Panics if the event stream was already taken.
4795    pub fn take_event_stream(&self) -> MeshcopConnectorEventStream {
4796        MeshcopConnectorEventStream { event_receiver: self.client.take_event_receiver() }
4797    }
4798
4799    /// Connects to the [`Meshcop`] protocol on the
4800    /// named LoWPAN interface.
4801    ///
4802    /// The name of the interface can be learned by calling
4803    /// [`fuchsia.lowpan/Lookup.GetDevices`].
4804    ///
4805    /// If there is an error in processing this request
4806    /// the given channel is closed and an epitaph code used
4807    /// to describe the reason for the failure:
4808    ///
4809    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
4810    ///   was not formatted correctly or otherwise invalid.
4811    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
4812    ///   given name.
4813    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
4814    ///   does not support this protocol.
4815    pub fn r#connect(
4816        &self,
4817        mut name: &str,
4818        mut server_end: fidl::endpoints::ServerEnd<MeshcopMarker>,
4819    ) -> Result<(), fidl::Error> {
4820        MeshcopConnectorProxyInterface::r#connect(self, name, server_end)
4821    }
4822}
4823
4824impl MeshcopConnectorProxyInterface for MeshcopConnectorProxy {
4825    fn r#connect(
4826        &self,
4827        mut name: &str,
4828        mut server_end: fidl::endpoints::ServerEnd<MeshcopMarker>,
4829    ) -> Result<(), fidl::Error> {
4830        self.client.send::<MeshcopConnectorConnectRequest>(
4831            (name, server_end),
4832            0x53f87536b40ad6fb,
4833            fidl::encoding::DynamicFlags::empty(),
4834        )
4835    }
4836}
4837
4838pub struct MeshcopConnectorEventStream {
4839    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4840}
4841
4842impl std::marker::Unpin for MeshcopConnectorEventStream {}
4843
4844impl futures::stream::FusedStream for MeshcopConnectorEventStream {
4845    fn is_terminated(&self) -> bool {
4846        self.event_receiver.is_terminated()
4847    }
4848}
4849
4850impl futures::Stream for MeshcopConnectorEventStream {
4851    type Item = Result<MeshcopConnectorEvent, fidl::Error>;
4852
4853    fn poll_next(
4854        mut self: std::pin::Pin<&mut Self>,
4855        cx: &mut std::task::Context<'_>,
4856    ) -> std::task::Poll<Option<Self::Item>> {
4857        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4858            &mut self.event_receiver,
4859            cx
4860        )?) {
4861            Some(buf) => std::task::Poll::Ready(Some(MeshcopConnectorEvent::decode(buf))),
4862            None => std::task::Poll::Ready(None),
4863        }
4864    }
4865}
4866
4867#[derive(Debug)]
4868pub enum MeshcopConnectorEvent {}
4869
4870impl MeshcopConnectorEvent {
4871    /// Decodes a message buffer as a [`MeshcopConnectorEvent`].
4872    fn decode(
4873        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4874    ) -> Result<MeshcopConnectorEvent, fidl::Error> {
4875        let (bytes, _handles) = buf.split_mut();
4876        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4877        debug_assert_eq!(tx_header.tx_id, 0);
4878        match tx_header.ordinal {
4879            _ => Err(fidl::Error::UnknownOrdinal {
4880                ordinal: tx_header.ordinal,
4881                protocol_name:
4882                    <MeshcopConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4883            }),
4884        }
4885    }
4886}
4887
4888/// A Stream of incoming requests for fuchsia.lowpan.thread/MeshcopConnector.
4889pub struct MeshcopConnectorRequestStream {
4890    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4891    is_terminated: bool,
4892}
4893
4894impl std::marker::Unpin for MeshcopConnectorRequestStream {}
4895
4896impl futures::stream::FusedStream for MeshcopConnectorRequestStream {
4897    fn is_terminated(&self) -> bool {
4898        self.is_terminated
4899    }
4900}
4901
4902impl fidl::endpoints::RequestStream for MeshcopConnectorRequestStream {
4903    type Protocol = MeshcopConnectorMarker;
4904    type ControlHandle = MeshcopConnectorControlHandle;
4905
4906    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4907        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4908    }
4909
4910    fn control_handle(&self) -> Self::ControlHandle {
4911        MeshcopConnectorControlHandle { inner: self.inner.clone() }
4912    }
4913
4914    fn into_inner(
4915        self,
4916    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4917    {
4918        (self.inner, self.is_terminated)
4919    }
4920
4921    fn from_inner(
4922        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4923        is_terminated: bool,
4924    ) -> Self {
4925        Self { inner, is_terminated }
4926    }
4927}
4928
4929impl futures::Stream for MeshcopConnectorRequestStream {
4930    type Item = Result<MeshcopConnectorRequest, fidl::Error>;
4931
4932    fn poll_next(
4933        mut self: std::pin::Pin<&mut Self>,
4934        cx: &mut std::task::Context<'_>,
4935    ) -> std::task::Poll<Option<Self::Item>> {
4936        let this = &mut *self;
4937        if this.inner.check_shutdown(cx) {
4938            this.is_terminated = true;
4939            return std::task::Poll::Ready(None);
4940        }
4941        if this.is_terminated {
4942            panic!("polled MeshcopConnectorRequestStream after completion");
4943        }
4944        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4945            |bytes, handles| {
4946                match this.inner.channel().read_etc(cx, bytes, handles) {
4947                    std::task::Poll::Ready(Ok(())) => {}
4948                    std::task::Poll::Pending => return std::task::Poll::Pending,
4949                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4950                        this.is_terminated = true;
4951                        return std::task::Poll::Ready(None);
4952                    }
4953                    std::task::Poll::Ready(Err(e)) => {
4954                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4955                            e.into(),
4956                        ))));
4957                    }
4958                }
4959
4960                // A message has been received from the channel
4961                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4962
4963                std::task::Poll::Ready(Some(match header.ordinal {
4964                    0x53f87536b40ad6fb => {
4965                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4966                        let mut req = fidl::new_empty!(
4967                            MeshcopConnectorConnectRequest,
4968                            fidl::encoding::DefaultFuchsiaResourceDialect
4969                        );
4970                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MeshcopConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
4971                        let control_handle =
4972                            MeshcopConnectorControlHandle { inner: this.inner.clone() };
4973                        Ok(MeshcopConnectorRequest::Connect {
4974                            name: req.name,
4975                            server_end: req.server_end,
4976
4977                            control_handle,
4978                        })
4979                    }
4980                    _ => Err(fidl::Error::UnknownOrdinal {
4981                        ordinal: header.ordinal,
4982                        protocol_name:
4983                            <MeshcopConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4984                    }),
4985                }))
4986            },
4987        )
4988    }
4989}
4990
4991/// Protocol for connecting to [`Meshcop`] on a LoWPAN device.
4992#[derive(Debug)]
4993pub enum MeshcopConnectorRequest {
4994    /// Connects to the [`Meshcop`] protocol on the
4995    /// named LoWPAN interface.
4996    ///
4997    /// The name of the interface can be learned by calling
4998    /// [`fuchsia.lowpan/Lookup.GetDevices`].
4999    ///
5000    /// If there is an error in processing this request
5001    /// the given channel is closed and an epitaph code used
5002    /// to describe the reason for the failure:
5003    ///
5004    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
5005    ///   was not formatted correctly or otherwise invalid.
5006    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
5007    ///   given name.
5008    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
5009    ///   does not support this protocol.
5010    Connect {
5011        name: String,
5012        server_end: fidl::endpoints::ServerEnd<MeshcopMarker>,
5013        control_handle: MeshcopConnectorControlHandle,
5014    },
5015}
5016
5017impl MeshcopConnectorRequest {
5018    #[allow(irrefutable_let_patterns)]
5019    pub fn into_connect(
5020        self,
5021    ) -> Option<(String, fidl::endpoints::ServerEnd<MeshcopMarker>, MeshcopConnectorControlHandle)>
5022    {
5023        if let MeshcopConnectorRequest::Connect { name, server_end, control_handle } = self {
5024            Some((name, server_end, control_handle))
5025        } else {
5026            None
5027        }
5028    }
5029
5030    /// Name of the method defined in FIDL
5031    pub fn method_name(&self) -> &'static str {
5032        match *self {
5033            MeshcopConnectorRequest::Connect { .. } => "connect",
5034        }
5035    }
5036}
5037
5038#[derive(Debug, Clone)]
5039pub struct MeshcopConnectorControlHandle {
5040    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5041}
5042
5043impl MeshcopConnectorControlHandle {
5044    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
5045        self.inner.shutdown_with_epitaph(status.into())
5046    }
5047}
5048
5049impl fidl::endpoints::ControlHandle for MeshcopConnectorControlHandle {
5050    fn shutdown(&self) {
5051        self.inner.shutdown()
5052    }
5053
5054    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
5055        self.inner.shutdown_with_epitaph(status)
5056    }
5057
5058    fn is_closed(&self) -> bool {
5059        self.inner.channel().is_closed()
5060    }
5061    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5062        self.inner.channel().on_closed()
5063    }
5064
5065    #[cfg(target_os = "fuchsia")]
5066    fn signal_peer(
5067        &self,
5068        clear_mask: zx::Signals,
5069        set_mask: zx::Signals,
5070    ) -> Result<(), zx_status::Status> {
5071        use fidl::Peered;
5072        self.inner.channel().signal_peer(clear_mask, set_mask)
5073    }
5074}
5075
5076impl MeshcopConnectorControlHandle {}
5077
5078#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5079pub struct ThreadCapabilitiesMarker;
5080
5081impl fidl::endpoints::ProtocolMarker for ThreadCapabilitiesMarker {
5082    type Proxy = ThreadCapabilitiesProxy;
5083    type RequestStream = ThreadCapabilitiesRequestStream;
5084    #[cfg(target_os = "fuchsia")]
5085    type SynchronousProxy = ThreadCapabilitiesSynchronousProxy;
5086
5087    const DEBUG_NAME: &'static str = "(anonymous) ThreadCapabilities";
5088}
5089
5090pub trait ThreadCapabilitiesProxyInterface: Send + Sync {
5091    type GetCapabilitiesResponseFut: std::future::Future<Output = Result<Capabilities, fidl::Error>>
5092        + Send;
5093    fn r#get_capabilities(&self) -> Self::GetCapabilitiesResponseFut;
5094}
5095#[derive(Debug)]
5096#[cfg(target_os = "fuchsia")]
5097pub struct ThreadCapabilitiesSynchronousProxy {
5098    client: fidl::client::sync::Client,
5099}
5100
5101#[cfg(target_os = "fuchsia")]
5102impl fidl::endpoints::SynchronousProxy for ThreadCapabilitiesSynchronousProxy {
5103    type Proxy = ThreadCapabilitiesProxy;
5104    type Protocol = ThreadCapabilitiesMarker;
5105
5106    fn from_channel(inner: fidl::Channel) -> Self {
5107        Self::new(inner)
5108    }
5109
5110    fn into_channel(self) -> fidl::Channel {
5111        self.client.into_channel()
5112    }
5113
5114    fn as_channel(&self) -> &fidl::Channel {
5115        self.client.as_channel()
5116    }
5117}
5118
5119#[cfg(target_os = "fuchsia")]
5120impl ThreadCapabilitiesSynchronousProxy {
5121    pub fn new(channel: fidl::Channel) -> Self {
5122        Self { client: fidl::client::sync::Client::new(channel) }
5123    }
5124
5125    pub fn into_channel(self) -> fidl::Channel {
5126        self.client.into_channel()
5127    }
5128
5129    /// Waits until an event arrives and returns it. It is safe for other
5130    /// threads to make concurrent requests while waiting for an event.
5131    pub fn wait_for_event(
5132        &self,
5133        deadline: zx::MonotonicInstant,
5134    ) -> Result<ThreadCapabilitiesEvent, fidl::Error> {
5135        ThreadCapabilitiesEvent::decode(
5136            self.client.wait_for_event::<ThreadCapabilitiesMarker>(deadline)?,
5137        )
5138    }
5139
5140    /// Returns the current capabilities of Openthread for this interface.
5141    ///
5142    /// capabilities is not expected to change for the lifetime of the
5143    /// interface.
5144    pub fn r#get_capabilities(
5145        &self,
5146        ___deadline: zx::MonotonicInstant,
5147    ) -> Result<Capabilities, fidl::Error> {
5148        let _response = self.client.send_query::<
5149            fidl::encoding::EmptyPayload,
5150            ThreadCapabilitiesGetCapabilitiesResponse,
5151            ThreadCapabilitiesMarker,
5152        >(
5153            (),
5154            0x5a0823ac35f2d425,
5155            fidl::encoding::DynamicFlags::empty(),
5156            ___deadline,
5157        )?;
5158        Ok(_response.capabilities)
5159    }
5160}
5161
5162#[cfg(target_os = "fuchsia")]
5163impl From<ThreadCapabilitiesSynchronousProxy> for zx::NullableHandle {
5164    fn from(value: ThreadCapabilitiesSynchronousProxy) -> Self {
5165        value.into_channel().into()
5166    }
5167}
5168
5169#[cfg(target_os = "fuchsia")]
5170impl From<fidl::Channel> for ThreadCapabilitiesSynchronousProxy {
5171    fn from(value: fidl::Channel) -> Self {
5172        Self::new(value)
5173    }
5174}
5175
5176#[cfg(target_os = "fuchsia")]
5177impl fidl::endpoints::FromClient for ThreadCapabilitiesSynchronousProxy {
5178    type Protocol = ThreadCapabilitiesMarker;
5179
5180    fn from_client(value: fidl::endpoints::ClientEnd<ThreadCapabilitiesMarker>) -> Self {
5181        Self::new(value.into_channel())
5182    }
5183}
5184
5185#[derive(Debug, Clone)]
5186pub struct ThreadCapabilitiesProxy {
5187    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5188}
5189
5190impl fidl::endpoints::Proxy for ThreadCapabilitiesProxy {
5191    type Protocol = ThreadCapabilitiesMarker;
5192
5193    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5194        Self::new(inner)
5195    }
5196
5197    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5198        self.client.into_channel().map_err(|client| Self { client })
5199    }
5200
5201    fn as_channel(&self) -> &::fidl::AsyncChannel {
5202        self.client.as_channel()
5203    }
5204}
5205
5206impl ThreadCapabilitiesProxy {
5207    /// Create a new Proxy for fuchsia.lowpan.thread/ThreadCapabilities.
5208    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5209        let protocol_name =
5210            <ThreadCapabilitiesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5211        Self { client: fidl::client::Client::new(channel, protocol_name) }
5212    }
5213
5214    /// Get a Stream of events from the remote end of the protocol.
5215    ///
5216    /// # Panics
5217    ///
5218    /// Panics if the event stream was already taken.
5219    pub fn take_event_stream(&self) -> ThreadCapabilitiesEventStream {
5220        ThreadCapabilitiesEventStream { event_receiver: self.client.take_event_receiver() }
5221    }
5222
5223    /// Returns the current capabilities of Openthread for this interface.
5224    ///
5225    /// capabilities is not expected to change for the lifetime of the
5226    /// interface.
5227    pub fn r#get_capabilities(
5228        &self,
5229    ) -> fidl::client::QueryResponseFut<Capabilities, fidl::encoding::DefaultFuchsiaResourceDialect>
5230    {
5231        ThreadCapabilitiesProxyInterface::r#get_capabilities(self)
5232    }
5233}
5234
5235impl ThreadCapabilitiesProxyInterface for ThreadCapabilitiesProxy {
5236    type GetCapabilitiesResponseFut =
5237        fidl::client::QueryResponseFut<Capabilities, fidl::encoding::DefaultFuchsiaResourceDialect>;
5238    fn r#get_capabilities(&self) -> Self::GetCapabilitiesResponseFut {
5239        fn _decode(
5240            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5241        ) -> Result<Capabilities, fidl::Error> {
5242            let _response = fidl::client::decode_transaction_body::<
5243                ThreadCapabilitiesGetCapabilitiesResponse,
5244                fidl::encoding::DefaultFuchsiaResourceDialect,
5245                0x5a0823ac35f2d425,
5246            >(_buf?)?;
5247            Ok(_response.capabilities)
5248        }
5249        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Capabilities>(
5250            (),
5251            0x5a0823ac35f2d425,
5252            fidl::encoding::DynamicFlags::empty(),
5253            _decode,
5254        )
5255    }
5256}
5257
5258pub struct ThreadCapabilitiesEventStream {
5259    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5260}
5261
5262impl std::marker::Unpin for ThreadCapabilitiesEventStream {}
5263
5264impl futures::stream::FusedStream for ThreadCapabilitiesEventStream {
5265    fn is_terminated(&self) -> bool {
5266        self.event_receiver.is_terminated()
5267    }
5268}
5269
5270impl futures::Stream for ThreadCapabilitiesEventStream {
5271    type Item = Result<ThreadCapabilitiesEvent, fidl::Error>;
5272
5273    fn poll_next(
5274        mut self: std::pin::Pin<&mut Self>,
5275        cx: &mut std::task::Context<'_>,
5276    ) -> std::task::Poll<Option<Self::Item>> {
5277        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5278            &mut self.event_receiver,
5279            cx
5280        )?) {
5281            Some(buf) => std::task::Poll::Ready(Some(ThreadCapabilitiesEvent::decode(buf))),
5282            None => std::task::Poll::Ready(None),
5283        }
5284    }
5285}
5286
5287#[derive(Debug)]
5288pub enum ThreadCapabilitiesEvent {}
5289
5290impl ThreadCapabilitiesEvent {
5291    /// Decodes a message buffer as a [`ThreadCapabilitiesEvent`].
5292    fn decode(
5293        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5294    ) -> Result<ThreadCapabilitiesEvent, fidl::Error> {
5295        let (bytes, _handles) = buf.split_mut();
5296        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5297        debug_assert_eq!(tx_header.tx_id, 0);
5298        match tx_header.ordinal {
5299            _ => Err(fidl::Error::UnknownOrdinal {
5300                ordinal: tx_header.ordinal,
5301                protocol_name:
5302                    <ThreadCapabilitiesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5303            }),
5304        }
5305    }
5306}
5307
5308/// A Stream of incoming requests for fuchsia.lowpan.thread/ThreadCapabilities.
5309pub struct ThreadCapabilitiesRequestStream {
5310    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5311    is_terminated: bool,
5312}
5313
5314impl std::marker::Unpin for ThreadCapabilitiesRequestStream {}
5315
5316impl futures::stream::FusedStream for ThreadCapabilitiesRequestStream {
5317    fn is_terminated(&self) -> bool {
5318        self.is_terminated
5319    }
5320}
5321
5322impl fidl::endpoints::RequestStream for ThreadCapabilitiesRequestStream {
5323    type Protocol = ThreadCapabilitiesMarker;
5324    type ControlHandle = ThreadCapabilitiesControlHandle;
5325
5326    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5327        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5328    }
5329
5330    fn control_handle(&self) -> Self::ControlHandle {
5331        ThreadCapabilitiesControlHandle { inner: self.inner.clone() }
5332    }
5333
5334    fn into_inner(
5335        self,
5336    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5337    {
5338        (self.inner, self.is_terminated)
5339    }
5340
5341    fn from_inner(
5342        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5343        is_terminated: bool,
5344    ) -> Self {
5345        Self { inner, is_terminated }
5346    }
5347}
5348
5349impl futures::Stream for ThreadCapabilitiesRequestStream {
5350    type Item = Result<ThreadCapabilitiesRequest, fidl::Error>;
5351
5352    fn poll_next(
5353        mut self: std::pin::Pin<&mut Self>,
5354        cx: &mut std::task::Context<'_>,
5355    ) -> std::task::Poll<Option<Self::Item>> {
5356        let this = &mut *self;
5357        if this.inner.check_shutdown(cx) {
5358            this.is_terminated = true;
5359            return std::task::Poll::Ready(None);
5360        }
5361        if this.is_terminated {
5362            panic!("polled ThreadCapabilitiesRequestStream after completion");
5363        }
5364        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5365            |bytes, handles| {
5366                match this.inner.channel().read_etc(cx, bytes, handles) {
5367                    std::task::Poll::Ready(Ok(())) => {}
5368                    std::task::Poll::Pending => return std::task::Poll::Pending,
5369                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5370                        this.is_terminated = true;
5371                        return std::task::Poll::Ready(None);
5372                    }
5373                    std::task::Poll::Ready(Err(e)) => {
5374                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5375                            e.into(),
5376                        ))));
5377                    }
5378                }
5379
5380                // A message has been received from the channel
5381                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5382
5383                std::task::Poll::Ready(Some(match header.ordinal {
5384                0x5a0823ac35f2d425 => {
5385                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5386                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
5387                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5388                    let control_handle = ThreadCapabilitiesControlHandle {
5389                        inner: this.inner.clone(),
5390                    };
5391                    Ok(ThreadCapabilitiesRequest::GetCapabilities {
5392                        responder: ThreadCapabilitiesGetCapabilitiesResponder {
5393                            control_handle: std::mem::ManuallyDrop::new(control_handle),
5394                            tx_id: header.tx_id,
5395                        },
5396                    })
5397                }
5398                _ => Err(fidl::Error::UnknownOrdinal {
5399                    ordinal: header.ordinal,
5400                    protocol_name: <ThreadCapabilitiesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5401                }),
5402            }))
5403            },
5404        )
5405    }
5406}
5407
5408/// Protocol for retrieving supported capabilities of the thread stack.
5409#[derive(Debug)]
5410pub enum ThreadCapabilitiesRequest {
5411    /// Returns the current capabilities of Openthread for this interface.
5412    ///
5413    /// capabilities is not expected to change for the lifetime of the
5414    /// interface.
5415    GetCapabilities { responder: ThreadCapabilitiesGetCapabilitiesResponder },
5416}
5417
5418impl ThreadCapabilitiesRequest {
5419    #[allow(irrefutable_let_patterns)]
5420    pub fn into_get_capabilities(self) -> Option<(ThreadCapabilitiesGetCapabilitiesResponder)> {
5421        if let ThreadCapabilitiesRequest::GetCapabilities { responder } = self {
5422            Some((responder))
5423        } else {
5424            None
5425        }
5426    }
5427
5428    /// Name of the method defined in FIDL
5429    pub fn method_name(&self) -> &'static str {
5430        match *self {
5431            ThreadCapabilitiesRequest::GetCapabilities { .. } => "get_capabilities",
5432        }
5433    }
5434}
5435
5436#[derive(Debug, Clone)]
5437pub struct ThreadCapabilitiesControlHandle {
5438    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5439}
5440
5441impl ThreadCapabilitiesControlHandle {
5442    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
5443        self.inner.shutdown_with_epitaph(status.into())
5444    }
5445}
5446
5447impl fidl::endpoints::ControlHandle for ThreadCapabilitiesControlHandle {
5448    fn shutdown(&self) {
5449        self.inner.shutdown()
5450    }
5451
5452    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
5453        self.inner.shutdown_with_epitaph(status)
5454    }
5455
5456    fn is_closed(&self) -> bool {
5457        self.inner.channel().is_closed()
5458    }
5459    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5460        self.inner.channel().on_closed()
5461    }
5462
5463    #[cfg(target_os = "fuchsia")]
5464    fn signal_peer(
5465        &self,
5466        clear_mask: zx::Signals,
5467        set_mask: zx::Signals,
5468    ) -> Result<(), zx_status::Status> {
5469        use fidl::Peered;
5470        self.inner.channel().signal_peer(clear_mask, set_mask)
5471    }
5472}
5473
5474impl ThreadCapabilitiesControlHandle {}
5475
5476#[must_use = "FIDL methods require a response to be sent"]
5477#[derive(Debug)]
5478pub struct ThreadCapabilitiesGetCapabilitiesResponder {
5479    control_handle: std::mem::ManuallyDrop<ThreadCapabilitiesControlHandle>,
5480    tx_id: u32,
5481}
5482
5483/// Set the the channel to be shutdown (see [`ThreadCapabilitiesControlHandle::shutdown`])
5484/// if the responder is dropped without sending a response, so that the client
5485/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5486impl std::ops::Drop for ThreadCapabilitiesGetCapabilitiesResponder {
5487    fn drop(&mut self) {
5488        self.control_handle.shutdown();
5489        // Safety: drops once, never accessed again
5490        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5491    }
5492}
5493
5494impl fidl::endpoints::Responder for ThreadCapabilitiesGetCapabilitiesResponder {
5495    type ControlHandle = ThreadCapabilitiesControlHandle;
5496
5497    fn control_handle(&self) -> &ThreadCapabilitiesControlHandle {
5498        &self.control_handle
5499    }
5500
5501    fn drop_without_shutdown(mut self) {
5502        // Safety: drops once, never accessed again due to mem::forget
5503        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5504        // Prevent Drop from running (which would shut down the channel)
5505        std::mem::forget(self);
5506    }
5507}
5508
5509impl ThreadCapabilitiesGetCapabilitiesResponder {
5510    /// Sends a response to the FIDL transaction.
5511    ///
5512    /// Sets the channel to shutdown if an error occurs.
5513    pub fn send(self, mut capabilities: &Capabilities) -> Result<(), fidl::Error> {
5514        let _result = self.send_raw(capabilities);
5515        if _result.is_err() {
5516            self.control_handle.shutdown();
5517        }
5518        self.drop_without_shutdown();
5519        _result
5520    }
5521
5522    /// Similar to "send" but does not shutdown the channel if an error occurs.
5523    pub fn send_no_shutdown_on_err(
5524        self,
5525        mut capabilities: &Capabilities,
5526    ) -> Result<(), fidl::Error> {
5527        let _result = self.send_raw(capabilities);
5528        self.drop_without_shutdown();
5529        _result
5530    }
5531
5532    fn send_raw(&self, mut capabilities: &Capabilities) -> Result<(), fidl::Error> {
5533        self.control_handle.inner.send::<ThreadCapabilitiesGetCapabilitiesResponse>(
5534            (capabilities,),
5535            self.tx_id,
5536            0x5a0823ac35f2d425,
5537            fidl::encoding::DynamicFlags::empty(),
5538        )
5539    }
5540}
5541
5542mod internal {
5543    use super::*;
5544
5545    impl fidl::encoding::ResourceTypeMarker for CapabilitiesConnectorConnectRequest {
5546        type Borrowed<'a> = &'a mut Self;
5547        fn take_or_borrow<'a>(
5548            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5549        ) -> Self::Borrowed<'a> {
5550            value
5551        }
5552    }
5553
5554    unsafe impl fidl::encoding::TypeMarker for CapabilitiesConnectorConnectRequest {
5555        type Owned = Self;
5556
5557        #[inline(always)]
5558        fn inline_align(_context: fidl::encoding::Context) -> usize {
5559            8
5560        }
5561
5562        #[inline(always)]
5563        fn inline_size(_context: fidl::encoding::Context) -> usize {
5564            24
5565        }
5566    }
5567
5568    unsafe impl
5569        fidl::encoding::Encode<
5570            CapabilitiesConnectorConnectRequest,
5571            fidl::encoding::DefaultFuchsiaResourceDialect,
5572        > for &mut CapabilitiesConnectorConnectRequest
5573    {
5574        #[inline]
5575        unsafe fn encode(
5576            self,
5577            encoder: &mut fidl::encoding::Encoder<
5578                '_,
5579                fidl::encoding::DefaultFuchsiaResourceDialect,
5580            >,
5581            offset: usize,
5582            _depth: fidl::encoding::Depth,
5583        ) -> fidl::Result<()> {
5584            encoder.debug_check_bounds::<CapabilitiesConnectorConnectRequest>(offset);
5585            // Delegate to tuple encoding.
5586            fidl::encoding::Encode::<CapabilitiesConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5587                (
5588                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
5589                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ThreadCapabilitiesMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
5590                ),
5591                encoder, offset, _depth
5592            )
5593        }
5594    }
5595    unsafe impl<
5596        T0: fidl::encoding::Encode<
5597                fidl::encoding::BoundedString<32>,
5598                fidl::encoding::DefaultFuchsiaResourceDialect,
5599            >,
5600        T1: fidl::encoding::Encode<
5601                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ThreadCapabilitiesMarker>>,
5602                fidl::encoding::DefaultFuchsiaResourceDialect,
5603            >,
5604    >
5605        fidl::encoding::Encode<
5606            CapabilitiesConnectorConnectRequest,
5607            fidl::encoding::DefaultFuchsiaResourceDialect,
5608        > for (T0, T1)
5609    {
5610        #[inline]
5611        unsafe fn encode(
5612            self,
5613            encoder: &mut fidl::encoding::Encoder<
5614                '_,
5615                fidl::encoding::DefaultFuchsiaResourceDialect,
5616            >,
5617            offset: usize,
5618            depth: fidl::encoding::Depth,
5619        ) -> fidl::Result<()> {
5620            encoder.debug_check_bounds::<CapabilitiesConnectorConnectRequest>(offset);
5621            // Zero out padding regions. There's no need to apply masks
5622            // because the unmasked parts will be overwritten by fields.
5623            unsafe {
5624                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
5625                (ptr as *mut u64).write_unaligned(0);
5626            }
5627            // Write the fields.
5628            self.0.encode(encoder, offset + 0, depth)?;
5629            self.1.encode(encoder, offset + 16, depth)?;
5630            Ok(())
5631        }
5632    }
5633
5634    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5635        for CapabilitiesConnectorConnectRequest
5636    {
5637        #[inline(always)]
5638        fn new_empty() -> Self {
5639            Self {
5640                name: fidl::new_empty!(
5641                    fidl::encoding::BoundedString<32>,
5642                    fidl::encoding::DefaultFuchsiaResourceDialect
5643                ),
5644                server_end: fidl::new_empty!(
5645                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ThreadCapabilitiesMarker>>,
5646                    fidl::encoding::DefaultFuchsiaResourceDialect
5647                ),
5648            }
5649        }
5650
5651        #[inline]
5652        unsafe fn decode(
5653            &mut self,
5654            decoder: &mut fidl::encoding::Decoder<
5655                '_,
5656                fidl::encoding::DefaultFuchsiaResourceDialect,
5657            >,
5658            offset: usize,
5659            _depth: fidl::encoding::Depth,
5660        ) -> fidl::Result<()> {
5661            decoder.debug_check_bounds::<Self>(offset);
5662            // Verify that padding bytes are zero.
5663            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
5664            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5665            let mask = 0xffffffff00000000u64;
5666            let maskedval = padval & mask;
5667            if maskedval != 0 {
5668                return Err(fidl::Error::NonZeroPadding {
5669                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
5670                });
5671            }
5672            fidl::decode!(
5673                fidl::encoding::BoundedString<32>,
5674                fidl::encoding::DefaultFuchsiaResourceDialect,
5675                &mut self.name,
5676                decoder,
5677                offset + 0,
5678                _depth
5679            )?;
5680            fidl::decode!(
5681                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ThreadCapabilitiesMarker>>,
5682                fidl::encoding::DefaultFuchsiaResourceDialect,
5683                &mut self.server_end,
5684                decoder,
5685                offset + 16,
5686                _depth
5687            )?;
5688            Ok(())
5689        }
5690    }
5691
5692    impl fidl::encoding::ResourceTypeMarker for DatasetConnectorConnectRequest {
5693        type Borrowed<'a> = &'a mut Self;
5694        fn take_or_borrow<'a>(
5695            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5696        ) -> Self::Borrowed<'a> {
5697            value
5698        }
5699    }
5700
5701    unsafe impl fidl::encoding::TypeMarker for DatasetConnectorConnectRequest {
5702        type Owned = Self;
5703
5704        #[inline(always)]
5705        fn inline_align(_context: fidl::encoding::Context) -> usize {
5706            8
5707        }
5708
5709        #[inline(always)]
5710        fn inline_size(_context: fidl::encoding::Context) -> usize {
5711            24
5712        }
5713    }
5714
5715    unsafe impl
5716        fidl::encoding::Encode<
5717            DatasetConnectorConnectRequest,
5718            fidl::encoding::DefaultFuchsiaResourceDialect,
5719        > for &mut DatasetConnectorConnectRequest
5720    {
5721        #[inline]
5722        unsafe fn encode(
5723            self,
5724            encoder: &mut fidl::encoding::Encoder<
5725                '_,
5726                fidl::encoding::DefaultFuchsiaResourceDialect,
5727            >,
5728            offset: usize,
5729            _depth: fidl::encoding::Depth,
5730        ) -> fidl::Result<()> {
5731            encoder.debug_check_bounds::<DatasetConnectorConnectRequest>(offset);
5732            // Delegate to tuple encoding.
5733            fidl::encoding::Encode::<DatasetConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5734                (
5735                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
5736                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DatasetMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
5737                ),
5738                encoder, offset, _depth
5739            )
5740        }
5741    }
5742    unsafe impl<
5743        T0: fidl::encoding::Encode<
5744                fidl::encoding::BoundedString<32>,
5745                fidl::encoding::DefaultFuchsiaResourceDialect,
5746            >,
5747        T1: fidl::encoding::Encode<
5748                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DatasetMarker>>,
5749                fidl::encoding::DefaultFuchsiaResourceDialect,
5750            >,
5751    >
5752        fidl::encoding::Encode<
5753            DatasetConnectorConnectRequest,
5754            fidl::encoding::DefaultFuchsiaResourceDialect,
5755        > for (T0, T1)
5756    {
5757        #[inline]
5758        unsafe fn encode(
5759            self,
5760            encoder: &mut fidl::encoding::Encoder<
5761                '_,
5762                fidl::encoding::DefaultFuchsiaResourceDialect,
5763            >,
5764            offset: usize,
5765            depth: fidl::encoding::Depth,
5766        ) -> fidl::Result<()> {
5767            encoder.debug_check_bounds::<DatasetConnectorConnectRequest>(offset);
5768            // Zero out padding regions. There's no need to apply masks
5769            // because the unmasked parts will be overwritten by fields.
5770            unsafe {
5771                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
5772                (ptr as *mut u64).write_unaligned(0);
5773            }
5774            // Write the fields.
5775            self.0.encode(encoder, offset + 0, depth)?;
5776            self.1.encode(encoder, offset + 16, depth)?;
5777            Ok(())
5778        }
5779    }
5780
5781    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5782        for DatasetConnectorConnectRequest
5783    {
5784        #[inline(always)]
5785        fn new_empty() -> Self {
5786            Self {
5787                name: fidl::new_empty!(
5788                    fidl::encoding::BoundedString<32>,
5789                    fidl::encoding::DefaultFuchsiaResourceDialect
5790                ),
5791                server_end: fidl::new_empty!(
5792                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DatasetMarker>>,
5793                    fidl::encoding::DefaultFuchsiaResourceDialect
5794                ),
5795            }
5796        }
5797
5798        #[inline]
5799        unsafe fn decode(
5800            &mut self,
5801            decoder: &mut fidl::encoding::Decoder<
5802                '_,
5803                fidl::encoding::DefaultFuchsiaResourceDialect,
5804            >,
5805            offset: usize,
5806            _depth: fidl::encoding::Depth,
5807        ) -> fidl::Result<()> {
5808            decoder.debug_check_bounds::<Self>(offset);
5809            // Verify that padding bytes are zero.
5810            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
5811            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5812            let mask = 0xffffffff00000000u64;
5813            let maskedval = padval & mask;
5814            if maskedval != 0 {
5815                return Err(fidl::Error::NonZeroPadding {
5816                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
5817                });
5818            }
5819            fidl::decode!(
5820                fidl::encoding::BoundedString<32>,
5821                fidl::encoding::DefaultFuchsiaResourceDialect,
5822                &mut self.name,
5823                decoder,
5824                offset + 0,
5825                _depth
5826            )?;
5827            fidl::decode!(
5828                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DatasetMarker>>,
5829                fidl::encoding::DefaultFuchsiaResourceDialect,
5830                &mut self.server_end,
5831                decoder,
5832                offset + 16,
5833                _depth
5834            )?;
5835            Ok(())
5836        }
5837    }
5838
5839    impl fidl::encoding::ResourceTypeMarker for EpskcConnectorConnectRequest {
5840        type Borrowed<'a> = &'a mut Self;
5841        fn take_or_borrow<'a>(
5842            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5843        ) -> Self::Borrowed<'a> {
5844            value
5845        }
5846    }
5847
5848    unsafe impl fidl::encoding::TypeMarker for EpskcConnectorConnectRequest {
5849        type Owned = Self;
5850
5851        #[inline(always)]
5852        fn inline_align(_context: fidl::encoding::Context) -> usize {
5853            8
5854        }
5855
5856        #[inline(always)]
5857        fn inline_size(_context: fidl::encoding::Context) -> usize {
5858            24
5859        }
5860    }
5861
5862    unsafe impl
5863        fidl::encoding::Encode<
5864            EpskcConnectorConnectRequest,
5865            fidl::encoding::DefaultFuchsiaResourceDialect,
5866        > for &mut EpskcConnectorConnectRequest
5867    {
5868        #[inline]
5869        unsafe fn encode(
5870            self,
5871            encoder: &mut fidl::encoding::Encoder<
5872                '_,
5873                fidl::encoding::DefaultFuchsiaResourceDialect,
5874            >,
5875            offset: usize,
5876            _depth: fidl::encoding::Depth,
5877        ) -> fidl::Result<()> {
5878            encoder.debug_check_bounds::<EpskcConnectorConnectRequest>(offset);
5879            // Delegate to tuple encoding.
5880            fidl::encoding::Encode::<EpskcConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
5881                (
5882                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
5883                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EpskcMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
5884                ),
5885                encoder, offset, _depth
5886            )
5887        }
5888    }
5889    unsafe impl<
5890        T0: fidl::encoding::Encode<
5891                fidl::encoding::BoundedString<32>,
5892                fidl::encoding::DefaultFuchsiaResourceDialect,
5893            >,
5894        T1: fidl::encoding::Encode<
5895                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EpskcMarker>>,
5896                fidl::encoding::DefaultFuchsiaResourceDialect,
5897            >,
5898    >
5899        fidl::encoding::Encode<
5900            EpskcConnectorConnectRequest,
5901            fidl::encoding::DefaultFuchsiaResourceDialect,
5902        > for (T0, T1)
5903    {
5904        #[inline]
5905        unsafe fn encode(
5906            self,
5907            encoder: &mut fidl::encoding::Encoder<
5908                '_,
5909                fidl::encoding::DefaultFuchsiaResourceDialect,
5910            >,
5911            offset: usize,
5912            depth: fidl::encoding::Depth,
5913        ) -> fidl::Result<()> {
5914            encoder.debug_check_bounds::<EpskcConnectorConnectRequest>(offset);
5915            // Zero out padding regions. There's no need to apply masks
5916            // because the unmasked parts will be overwritten by fields.
5917            unsafe {
5918                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
5919                (ptr as *mut u64).write_unaligned(0);
5920            }
5921            // Write the fields.
5922            self.0.encode(encoder, offset + 0, depth)?;
5923            self.1.encode(encoder, offset + 16, depth)?;
5924            Ok(())
5925        }
5926    }
5927
5928    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5929        for EpskcConnectorConnectRequest
5930    {
5931        #[inline(always)]
5932        fn new_empty() -> Self {
5933            Self {
5934                name: fidl::new_empty!(
5935                    fidl::encoding::BoundedString<32>,
5936                    fidl::encoding::DefaultFuchsiaResourceDialect
5937                ),
5938                server_end: fidl::new_empty!(
5939                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EpskcMarker>>,
5940                    fidl::encoding::DefaultFuchsiaResourceDialect
5941                ),
5942            }
5943        }
5944
5945        #[inline]
5946        unsafe fn decode(
5947            &mut self,
5948            decoder: &mut fidl::encoding::Decoder<
5949                '_,
5950                fidl::encoding::DefaultFuchsiaResourceDialect,
5951            >,
5952            offset: usize,
5953            _depth: fidl::encoding::Depth,
5954        ) -> fidl::Result<()> {
5955            decoder.debug_check_bounds::<Self>(offset);
5956            // Verify that padding bytes are zero.
5957            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
5958            let padval = unsafe { (ptr as *const u64).read_unaligned() };
5959            let mask = 0xffffffff00000000u64;
5960            let maskedval = padval & mask;
5961            if maskedval != 0 {
5962                return Err(fidl::Error::NonZeroPadding {
5963                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
5964                });
5965            }
5966            fidl::decode!(
5967                fidl::encoding::BoundedString<32>,
5968                fidl::encoding::DefaultFuchsiaResourceDialect,
5969                &mut self.name,
5970                decoder,
5971                offset + 0,
5972                _depth
5973            )?;
5974            fidl::decode!(
5975                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EpskcMarker>>,
5976                fidl::encoding::DefaultFuchsiaResourceDialect,
5977                &mut self.server_end,
5978                decoder,
5979                offset + 16,
5980                _depth
5981            )?;
5982            Ok(())
5983        }
5984    }
5985
5986    impl fidl::encoding::ResourceTypeMarker for FeatureConnectorConnectRequest {
5987        type Borrowed<'a> = &'a mut Self;
5988        fn take_or_borrow<'a>(
5989            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5990        ) -> Self::Borrowed<'a> {
5991            value
5992        }
5993    }
5994
5995    unsafe impl fidl::encoding::TypeMarker for FeatureConnectorConnectRequest {
5996        type Owned = Self;
5997
5998        #[inline(always)]
5999        fn inline_align(_context: fidl::encoding::Context) -> usize {
6000            8
6001        }
6002
6003        #[inline(always)]
6004        fn inline_size(_context: fidl::encoding::Context) -> usize {
6005            24
6006        }
6007    }
6008
6009    unsafe impl
6010        fidl::encoding::Encode<
6011            FeatureConnectorConnectRequest,
6012            fidl::encoding::DefaultFuchsiaResourceDialect,
6013        > for &mut FeatureConnectorConnectRequest
6014    {
6015        #[inline]
6016        unsafe fn encode(
6017            self,
6018            encoder: &mut fidl::encoding::Encoder<
6019                '_,
6020                fidl::encoding::DefaultFuchsiaResourceDialect,
6021            >,
6022            offset: usize,
6023            _depth: fidl::encoding::Depth,
6024        ) -> fidl::Result<()> {
6025            encoder.debug_check_bounds::<FeatureConnectorConnectRequest>(offset);
6026            // Delegate to tuple encoding.
6027            fidl::encoding::Encode::<FeatureConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6028                (
6029                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
6030                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FeatureMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
6031                ),
6032                encoder, offset, _depth
6033            )
6034        }
6035    }
6036    unsafe impl<
6037        T0: fidl::encoding::Encode<
6038                fidl::encoding::BoundedString<32>,
6039                fidl::encoding::DefaultFuchsiaResourceDialect,
6040            >,
6041        T1: fidl::encoding::Encode<
6042                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FeatureMarker>>,
6043                fidl::encoding::DefaultFuchsiaResourceDialect,
6044            >,
6045    >
6046        fidl::encoding::Encode<
6047            FeatureConnectorConnectRequest,
6048            fidl::encoding::DefaultFuchsiaResourceDialect,
6049        > for (T0, T1)
6050    {
6051        #[inline]
6052        unsafe fn encode(
6053            self,
6054            encoder: &mut fidl::encoding::Encoder<
6055                '_,
6056                fidl::encoding::DefaultFuchsiaResourceDialect,
6057            >,
6058            offset: usize,
6059            depth: fidl::encoding::Depth,
6060        ) -> fidl::Result<()> {
6061            encoder.debug_check_bounds::<FeatureConnectorConnectRequest>(offset);
6062            // Zero out padding regions. There's no need to apply masks
6063            // because the unmasked parts will be overwritten by fields.
6064            unsafe {
6065                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
6066                (ptr as *mut u64).write_unaligned(0);
6067            }
6068            // Write the fields.
6069            self.0.encode(encoder, offset + 0, depth)?;
6070            self.1.encode(encoder, offset + 16, depth)?;
6071            Ok(())
6072        }
6073    }
6074
6075    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6076        for FeatureConnectorConnectRequest
6077    {
6078        #[inline(always)]
6079        fn new_empty() -> Self {
6080            Self {
6081                name: fidl::new_empty!(
6082                    fidl::encoding::BoundedString<32>,
6083                    fidl::encoding::DefaultFuchsiaResourceDialect
6084                ),
6085                server_end: fidl::new_empty!(
6086                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FeatureMarker>>,
6087                    fidl::encoding::DefaultFuchsiaResourceDialect
6088                ),
6089            }
6090        }
6091
6092        #[inline]
6093        unsafe fn decode(
6094            &mut self,
6095            decoder: &mut fidl::encoding::Decoder<
6096                '_,
6097                fidl::encoding::DefaultFuchsiaResourceDialect,
6098            >,
6099            offset: usize,
6100            _depth: fidl::encoding::Depth,
6101        ) -> fidl::Result<()> {
6102            decoder.debug_check_bounds::<Self>(offset);
6103            // Verify that padding bytes are zero.
6104            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
6105            let padval = unsafe { (ptr as *const u64).read_unaligned() };
6106            let mask = 0xffffffff00000000u64;
6107            let maskedval = padval & mask;
6108            if maskedval != 0 {
6109                return Err(fidl::Error::NonZeroPadding {
6110                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
6111                });
6112            }
6113            fidl::decode!(
6114                fidl::encoding::BoundedString<32>,
6115                fidl::encoding::DefaultFuchsiaResourceDialect,
6116                &mut self.name,
6117                decoder,
6118                offset + 0,
6119                _depth
6120            )?;
6121            fidl::decode!(
6122                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FeatureMarker>>,
6123                fidl::encoding::DefaultFuchsiaResourceDialect,
6124                &mut self.server_end,
6125                decoder,
6126                offset + 16,
6127                _depth
6128            )?;
6129            Ok(())
6130        }
6131    }
6132
6133    impl fidl::encoding::ResourceTypeMarker for MeshcopConnectorConnectRequest {
6134        type Borrowed<'a> = &'a mut Self;
6135        fn take_or_borrow<'a>(
6136            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
6137        ) -> Self::Borrowed<'a> {
6138            value
6139        }
6140    }
6141
6142    unsafe impl fidl::encoding::TypeMarker for MeshcopConnectorConnectRequest {
6143        type Owned = Self;
6144
6145        #[inline(always)]
6146        fn inline_align(_context: fidl::encoding::Context) -> usize {
6147            8
6148        }
6149
6150        #[inline(always)]
6151        fn inline_size(_context: fidl::encoding::Context) -> usize {
6152            24
6153        }
6154    }
6155
6156    unsafe impl
6157        fidl::encoding::Encode<
6158            MeshcopConnectorConnectRequest,
6159            fidl::encoding::DefaultFuchsiaResourceDialect,
6160        > for &mut MeshcopConnectorConnectRequest
6161    {
6162        #[inline]
6163        unsafe fn encode(
6164            self,
6165            encoder: &mut fidl::encoding::Encoder<
6166                '_,
6167                fidl::encoding::DefaultFuchsiaResourceDialect,
6168            >,
6169            offset: usize,
6170            _depth: fidl::encoding::Depth,
6171        ) -> fidl::Result<()> {
6172            encoder.debug_check_bounds::<MeshcopConnectorConnectRequest>(offset);
6173            // Delegate to tuple encoding.
6174            fidl::encoding::Encode::<MeshcopConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
6175                (
6176                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
6177                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MeshcopMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
6178                ),
6179                encoder, offset, _depth
6180            )
6181        }
6182    }
6183    unsafe impl<
6184        T0: fidl::encoding::Encode<
6185                fidl::encoding::BoundedString<32>,
6186                fidl::encoding::DefaultFuchsiaResourceDialect,
6187            >,
6188        T1: fidl::encoding::Encode<
6189                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MeshcopMarker>>,
6190                fidl::encoding::DefaultFuchsiaResourceDialect,
6191            >,
6192    >
6193        fidl::encoding::Encode<
6194            MeshcopConnectorConnectRequest,
6195            fidl::encoding::DefaultFuchsiaResourceDialect,
6196        > for (T0, T1)
6197    {
6198        #[inline]
6199        unsafe fn encode(
6200            self,
6201            encoder: &mut fidl::encoding::Encoder<
6202                '_,
6203                fidl::encoding::DefaultFuchsiaResourceDialect,
6204            >,
6205            offset: usize,
6206            depth: fidl::encoding::Depth,
6207        ) -> fidl::Result<()> {
6208            encoder.debug_check_bounds::<MeshcopConnectorConnectRequest>(offset);
6209            // Zero out padding regions. There's no need to apply masks
6210            // because the unmasked parts will be overwritten by fields.
6211            unsafe {
6212                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
6213                (ptr as *mut u64).write_unaligned(0);
6214            }
6215            // Write the fields.
6216            self.0.encode(encoder, offset + 0, depth)?;
6217            self.1.encode(encoder, offset + 16, depth)?;
6218            Ok(())
6219        }
6220    }
6221
6222    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
6223        for MeshcopConnectorConnectRequest
6224    {
6225        #[inline(always)]
6226        fn new_empty() -> Self {
6227            Self {
6228                name: fidl::new_empty!(
6229                    fidl::encoding::BoundedString<32>,
6230                    fidl::encoding::DefaultFuchsiaResourceDialect
6231                ),
6232                server_end: fidl::new_empty!(
6233                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MeshcopMarker>>,
6234                    fidl::encoding::DefaultFuchsiaResourceDialect
6235                ),
6236            }
6237        }
6238
6239        #[inline]
6240        unsafe fn decode(
6241            &mut self,
6242            decoder: &mut fidl::encoding::Decoder<
6243                '_,
6244                fidl::encoding::DefaultFuchsiaResourceDialect,
6245            >,
6246            offset: usize,
6247            _depth: fidl::encoding::Depth,
6248        ) -> fidl::Result<()> {
6249            decoder.debug_check_bounds::<Self>(offset);
6250            // Verify that padding bytes are zero.
6251            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
6252            let padval = unsafe { (ptr as *const u64).read_unaligned() };
6253            let mask = 0xffffffff00000000u64;
6254            let maskedval = padval & mask;
6255            if maskedval != 0 {
6256                return Err(fidl::Error::NonZeroPadding {
6257                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
6258                });
6259            }
6260            fidl::decode!(
6261                fidl::encoding::BoundedString<32>,
6262                fidl::encoding::DefaultFuchsiaResourceDialect,
6263                &mut self.name,
6264                decoder,
6265                offset + 0,
6266                _depth
6267            )?;
6268            fidl::decode!(
6269                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MeshcopMarker>>,
6270                fidl::encoding::DefaultFuchsiaResourceDialect,
6271                &mut self.server_end,
6272                decoder,
6273                offset + 16,
6274                _depth
6275            )?;
6276            Ok(())
6277        }
6278    }
6279}