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 FeatureConnectorConnectRequest {
38    pub name: String,
39    pub server_end: fidl::endpoints::ServerEnd<FeatureMarker>,
40}
41
42impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
43    for FeatureConnectorConnectRequest
44{
45}
46
47#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
48pub struct MeshcopConnectorConnectRequest {
49    pub name: String,
50    pub server_end: fidl::endpoints::ServerEnd<MeshcopMarker>,
51}
52
53impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
54    for MeshcopConnectorConnectRequest
55{
56}
57
58#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
59pub struct CapabilitiesConnectorMarker;
60
61impl fidl::endpoints::ProtocolMarker for CapabilitiesConnectorMarker {
62    type Proxy = CapabilitiesConnectorProxy;
63    type RequestStream = CapabilitiesConnectorRequestStream;
64    #[cfg(target_os = "fuchsia")]
65    type SynchronousProxy = CapabilitiesConnectorSynchronousProxy;
66
67    const DEBUG_NAME: &'static str = "fuchsia.lowpan.thread.CapabilitiesConnector";
68}
69impl fidl::endpoints::DiscoverableProtocolMarker for CapabilitiesConnectorMarker {}
70
71pub trait CapabilitiesConnectorProxyInterface: Send + Sync {
72    fn r#connect(
73        &self,
74        name: &str,
75        server_end: fidl::endpoints::ServerEnd<ThreadCapabilitiesMarker>,
76    ) -> Result<(), fidl::Error>;
77}
78#[derive(Debug)]
79#[cfg(target_os = "fuchsia")]
80pub struct CapabilitiesConnectorSynchronousProxy {
81    client: fidl::client::sync::Client,
82}
83
84#[cfg(target_os = "fuchsia")]
85impl fidl::endpoints::SynchronousProxy for CapabilitiesConnectorSynchronousProxy {
86    type Proxy = CapabilitiesConnectorProxy;
87    type Protocol = CapabilitiesConnectorMarker;
88
89    fn from_channel(inner: fidl::Channel) -> Self {
90        Self::new(inner)
91    }
92
93    fn into_channel(self) -> fidl::Channel {
94        self.client.into_channel()
95    }
96
97    fn as_channel(&self) -> &fidl::Channel {
98        self.client.as_channel()
99    }
100}
101
102#[cfg(target_os = "fuchsia")]
103impl CapabilitiesConnectorSynchronousProxy {
104    pub fn new(channel: fidl::Channel) -> Self {
105        let protocol_name =
106            <CapabilitiesConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
107        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
108    }
109
110    pub fn into_channel(self) -> fidl::Channel {
111        self.client.into_channel()
112    }
113
114    /// Waits until an event arrives and returns it. It is safe for other
115    /// threads to make concurrent requests while waiting for an event.
116    pub fn wait_for_event(
117        &self,
118        deadline: zx::MonotonicInstant,
119    ) -> Result<CapabilitiesConnectorEvent, fidl::Error> {
120        CapabilitiesConnectorEvent::decode(self.client.wait_for_event(deadline)?)
121    }
122
123    /// Connects to the [`ThreadCapabilities`] protocol on the
124    /// named LoWPAN device.
125    ///
126    /// The name of the interface can be learned by calling
127    /// [`fuchsia.lowpan/Lookup.GetDevices`].
128    ///
129    /// If there is an error in processing this request
130    /// the given channel is closed and an epitaph code used
131    /// to describe the reason for the failure:
132    ///
133    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
134    ///   was not formatted correctly or otherwise invalid.
135    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
136    ///   given name.
137    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
138    ///   does not support this protocol.
139    pub fn r#connect(
140        &self,
141        mut name: &str,
142        mut server_end: fidl::endpoints::ServerEnd<ThreadCapabilitiesMarker>,
143    ) -> Result<(), fidl::Error> {
144        self.client.send::<CapabilitiesConnectorConnectRequest>(
145            (name, server_end),
146            0x1dadd551ecacd85,
147            fidl::encoding::DynamicFlags::empty(),
148        )
149    }
150}
151
152#[cfg(target_os = "fuchsia")]
153impl From<CapabilitiesConnectorSynchronousProxy> for zx::Handle {
154    fn from(value: CapabilitiesConnectorSynchronousProxy) -> Self {
155        value.into_channel().into()
156    }
157}
158
159#[cfg(target_os = "fuchsia")]
160impl From<fidl::Channel> for CapabilitiesConnectorSynchronousProxy {
161    fn from(value: fidl::Channel) -> Self {
162        Self::new(value)
163    }
164}
165
166#[cfg(target_os = "fuchsia")]
167impl fidl::endpoints::FromClient for CapabilitiesConnectorSynchronousProxy {
168    type Protocol = CapabilitiesConnectorMarker;
169
170    fn from_client(value: fidl::endpoints::ClientEnd<CapabilitiesConnectorMarker>) -> Self {
171        Self::new(value.into_channel())
172    }
173}
174
175#[derive(Debug, Clone)]
176pub struct CapabilitiesConnectorProxy {
177    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
178}
179
180impl fidl::endpoints::Proxy for CapabilitiesConnectorProxy {
181    type Protocol = CapabilitiesConnectorMarker;
182
183    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
184        Self::new(inner)
185    }
186
187    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
188        self.client.into_channel().map_err(|client| Self { client })
189    }
190
191    fn as_channel(&self) -> &::fidl::AsyncChannel {
192        self.client.as_channel()
193    }
194}
195
196impl CapabilitiesConnectorProxy {
197    /// Create a new Proxy for fuchsia.lowpan.thread/CapabilitiesConnector.
198    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
199        let protocol_name =
200            <CapabilitiesConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
201        Self { client: fidl::client::Client::new(channel, protocol_name) }
202    }
203
204    /// Get a Stream of events from the remote end of the protocol.
205    ///
206    /// # Panics
207    ///
208    /// Panics if the event stream was already taken.
209    pub fn take_event_stream(&self) -> CapabilitiesConnectorEventStream {
210        CapabilitiesConnectorEventStream { event_receiver: self.client.take_event_receiver() }
211    }
212
213    /// Connects to the [`ThreadCapabilities`] protocol on the
214    /// named LoWPAN device.
215    ///
216    /// The name of the interface can be learned by calling
217    /// [`fuchsia.lowpan/Lookup.GetDevices`].
218    ///
219    /// If there is an error in processing this request
220    /// the given channel is closed and an epitaph code used
221    /// to describe the reason for the failure:
222    ///
223    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
224    ///   was not formatted correctly or otherwise invalid.
225    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
226    ///   given name.
227    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
228    ///   does not support this protocol.
229    pub fn r#connect(
230        &self,
231        mut name: &str,
232        mut server_end: fidl::endpoints::ServerEnd<ThreadCapabilitiesMarker>,
233    ) -> Result<(), fidl::Error> {
234        CapabilitiesConnectorProxyInterface::r#connect(self, name, server_end)
235    }
236}
237
238impl CapabilitiesConnectorProxyInterface for CapabilitiesConnectorProxy {
239    fn r#connect(
240        &self,
241        mut name: &str,
242        mut server_end: fidl::endpoints::ServerEnd<ThreadCapabilitiesMarker>,
243    ) -> Result<(), fidl::Error> {
244        self.client.send::<CapabilitiesConnectorConnectRequest>(
245            (name, server_end),
246            0x1dadd551ecacd85,
247            fidl::encoding::DynamicFlags::empty(),
248        )
249    }
250}
251
252pub struct CapabilitiesConnectorEventStream {
253    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
254}
255
256impl std::marker::Unpin for CapabilitiesConnectorEventStream {}
257
258impl futures::stream::FusedStream for CapabilitiesConnectorEventStream {
259    fn is_terminated(&self) -> bool {
260        self.event_receiver.is_terminated()
261    }
262}
263
264impl futures::Stream for CapabilitiesConnectorEventStream {
265    type Item = Result<CapabilitiesConnectorEvent, fidl::Error>;
266
267    fn poll_next(
268        mut self: std::pin::Pin<&mut Self>,
269        cx: &mut std::task::Context<'_>,
270    ) -> std::task::Poll<Option<Self::Item>> {
271        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
272            &mut self.event_receiver,
273            cx
274        )?) {
275            Some(buf) => std::task::Poll::Ready(Some(CapabilitiesConnectorEvent::decode(buf))),
276            None => std::task::Poll::Ready(None),
277        }
278    }
279}
280
281#[derive(Debug)]
282pub enum CapabilitiesConnectorEvent {}
283
284impl CapabilitiesConnectorEvent {
285    /// Decodes a message buffer as a [`CapabilitiesConnectorEvent`].
286    fn decode(
287        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
288    ) -> Result<CapabilitiesConnectorEvent, fidl::Error> {
289        let (bytes, _handles) = buf.split_mut();
290        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
291        debug_assert_eq!(tx_header.tx_id, 0);
292        match tx_header.ordinal {
293            _ => Err(fidl::Error::UnknownOrdinal {
294                ordinal: tx_header.ordinal,
295                protocol_name:
296                    <CapabilitiesConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
297            }),
298        }
299    }
300}
301
302/// A Stream of incoming requests for fuchsia.lowpan.thread/CapabilitiesConnector.
303pub struct CapabilitiesConnectorRequestStream {
304    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
305    is_terminated: bool,
306}
307
308impl std::marker::Unpin for CapabilitiesConnectorRequestStream {}
309
310impl futures::stream::FusedStream for CapabilitiesConnectorRequestStream {
311    fn is_terminated(&self) -> bool {
312        self.is_terminated
313    }
314}
315
316impl fidl::endpoints::RequestStream for CapabilitiesConnectorRequestStream {
317    type Protocol = CapabilitiesConnectorMarker;
318    type ControlHandle = CapabilitiesConnectorControlHandle;
319
320    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
321        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
322    }
323
324    fn control_handle(&self) -> Self::ControlHandle {
325        CapabilitiesConnectorControlHandle { inner: self.inner.clone() }
326    }
327
328    fn into_inner(
329        self,
330    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
331    {
332        (self.inner, self.is_terminated)
333    }
334
335    fn from_inner(
336        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
337        is_terminated: bool,
338    ) -> Self {
339        Self { inner, is_terminated }
340    }
341}
342
343impl futures::Stream for CapabilitiesConnectorRequestStream {
344    type Item = Result<CapabilitiesConnectorRequest, fidl::Error>;
345
346    fn poll_next(
347        mut self: std::pin::Pin<&mut Self>,
348        cx: &mut std::task::Context<'_>,
349    ) -> std::task::Poll<Option<Self::Item>> {
350        let this = &mut *self;
351        if this.inner.check_shutdown(cx) {
352            this.is_terminated = true;
353            return std::task::Poll::Ready(None);
354        }
355        if this.is_terminated {
356            panic!("polled CapabilitiesConnectorRequestStream after completion");
357        }
358        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
359            |bytes, handles| {
360                match this.inner.channel().read_etc(cx, bytes, handles) {
361                    std::task::Poll::Ready(Ok(())) => {}
362                    std::task::Poll::Pending => return std::task::Poll::Pending,
363                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
364                        this.is_terminated = true;
365                        return std::task::Poll::Ready(None);
366                    }
367                    std::task::Poll::Ready(Err(e)) => {
368                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
369                            e.into(),
370                        ))))
371                    }
372                }
373
374                // A message has been received from the channel
375                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
376
377                std::task::Poll::Ready(Some(match header.ordinal {
378                0x1dadd551ecacd85 => {
379                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
380                    let mut req = fidl::new_empty!(CapabilitiesConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
381                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CapabilitiesConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
382                    let control_handle = CapabilitiesConnectorControlHandle {
383                        inner: this.inner.clone(),
384                    };
385                    Ok(CapabilitiesConnectorRequest::Connect {name: req.name,
386server_end: req.server_end,
387
388                        control_handle,
389                    })
390                }
391                _ => Err(fidl::Error::UnknownOrdinal {
392                    ordinal: header.ordinal,
393                    protocol_name: <CapabilitiesConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
394                }),
395            }))
396            },
397        )
398    }
399}
400
401/// Protocol for connecting to [`Capabilities`] on a LoWPAN device.
402#[derive(Debug)]
403pub enum CapabilitiesConnectorRequest {
404    /// Connects to the [`ThreadCapabilities`] protocol on the
405    /// named LoWPAN device.
406    ///
407    /// The name of the interface can be learned by calling
408    /// [`fuchsia.lowpan/Lookup.GetDevices`].
409    ///
410    /// If there is an error in processing this request
411    /// the given channel is closed and an epitaph code used
412    /// to describe the reason for the failure:
413    ///
414    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
415    ///   was not formatted correctly or otherwise invalid.
416    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
417    ///   given name.
418    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
419    ///   does not support this protocol.
420    Connect {
421        name: String,
422        server_end: fidl::endpoints::ServerEnd<ThreadCapabilitiesMarker>,
423        control_handle: CapabilitiesConnectorControlHandle,
424    },
425}
426
427impl CapabilitiesConnectorRequest {
428    #[allow(irrefutable_let_patterns)]
429    pub fn into_connect(
430        self,
431    ) -> Option<(
432        String,
433        fidl::endpoints::ServerEnd<ThreadCapabilitiesMarker>,
434        CapabilitiesConnectorControlHandle,
435    )> {
436        if let CapabilitiesConnectorRequest::Connect { name, server_end, control_handle } = self {
437            Some((name, server_end, control_handle))
438        } else {
439            None
440        }
441    }
442
443    /// Name of the method defined in FIDL
444    pub fn method_name(&self) -> &'static str {
445        match *self {
446            CapabilitiesConnectorRequest::Connect { .. } => "connect",
447        }
448    }
449}
450
451#[derive(Debug, Clone)]
452pub struct CapabilitiesConnectorControlHandle {
453    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
454}
455
456impl fidl::endpoints::ControlHandle for CapabilitiesConnectorControlHandle {
457    fn shutdown(&self) {
458        self.inner.shutdown()
459    }
460    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
461        self.inner.shutdown_with_epitaph(status)
462    }
463
464    fn is_closed(&self) -> bool {
465        self.inner.channel().is_closed()
466    }
467    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
468        self.inner.channel().on_closed()
469    }
470
471    #[cfg(target_os = "fuchsia")]
472    fn signal_peer(
473        &self,
474        clear_mask: zx::Signals,
475        set_mask: zx::Signals,
476    ) -> Result<(), zx_status::Status> {
477        use fidl::Peered;
478        self.inner.channel().signal_peer(clear_mask, set_mask)
479    }
480}
481
482impl CapabilitiesConnectorControlHandle {}
483
484#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
485pub struct DatasetMarker;
486
487impl fidl::endpoints::ProtocolMarker for DatasetMarker {
488    type Proxy = DatasetProxy;
489    type RequestStream = DatasetRequestStream;
490    #[cfg(target_os = "fuchsia")]
491    type SynchronousProxy = DatasetSynchronousProxy;
492
493    const DEBUG_NAME: &'static str = "(anonymous) Dataset";
494}
495
496pub trait DatasetProxyInterface: Send + Sync {
497    type GetActiveTlvsResponseFut: std::future::Future<Output = Result<Option<Vec<u8>>, fidl::Error>>
498        + Send;
499    fn r#get_active_tlvs(&self) -> Self::GetActiveTlvsResponseFut;
500    type SetActiveTlvsResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
501    fn r#set_active_tlvs(&self, dataset: &[u8]) -> Self::SetActiveTlvsResponseFut;
502    type AttachAllNodesToResponseFut: std::future::Future<Output = Result<i64, fidl::Error>> + Send;
503    fn r#attach_all_nodes_to(&self, dataset: &[u8]) -> Self::AttachAllNodesToResponseFut;
504}
505#[derive(Debug)]
506#[cfg(target_os = "fuchsia")]
507pub struct DatasetSynchronousProxy {
508    client: fidl::client::sync::Client,
509}
510
511#[cfg(target_os = "fuchsia")]
512impl fidl::endpoints::SynchronousProxy for DatasetSynchronousProxy {
513    type Proxy = DatasetProxy;
514    type Protocol = DatasetMarker;
515
516    fn from_channel(inner: fidl::Channel) -> Self {
517        Self::new(inner)
518    }
519
520    fn into_channel(self) -> fidl::Channel {
521        self.client.into_channel()
522    }
523
524    fn as_channel(&self) -> &fidl::Channel {
525        self.client.as_channel()
526    }
527}
528
529#[cfg(target_os = "fuchsia")]
530impl DatasetSynchronousProxy {
531    pub fn new(channel: fidl::Channel) -> Self {
532        let protocol_name = <DatasetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
533        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
534    }
535
536    pub fn into_channel(self) -> fidl::Channel {
537        self.client.into_channel()
538    }
539
540    /// Waits until an event arrives and returns it. It is safe for other
541    /// threads to make concurrent requests while waiting for an event.
542    pub fn wait_for_event(
543        &self,
544        deadline: zx::MonotonicInstant,
545    ) -> Result<DatasetEvent, fidl::Error> {
546        DatasetEvent::decode(self.client.wait_for_event(deadline)?)
547    }
548
549    /// Fetches and returns the active Thread operational dataset in raw
550    /// TLV form. Functionally equivalent to [`otDatasetGetActiveTlvs()`][2].
551    ///
552    /// This method returns the active dataset, or nothing in the case that
553    /// there is no active operational dataset.
554    ///
555    /// Any error that prevents the operation from completing successfully
556    /// will result in the protocol being closed.
557    ///
558    /// [2]: https://openthread.io/reference/group/api-operational-dataset#otdatasetgetactivetlvs
559    pub fn r#get_active_tlvs(
560        &self,
561        ___deadline: zx::MonotonicInstant,
562    ) -> Result<Option<Vec<u8>>, fidl::Error> {
563        let _response =
564            self.client.send_query::<fidl::encoding::EmptyPayload, DatasetGetActiveTlvsResponse>(
565                (),
566                0x3004d50d9fb69b92,
567                fidl::encoding::DynamicFlags::empty(),
568                ___deadline,
569            )?;
570        Ok(_response.dataset)
571    }
572
573    /// Sets the active Thread Operational Dataset in raw TLV form.
574    /// Functionally equivalent to [`otDatasetSetActiveTlvs()`][3].
575    ///
576    /// This method returns once the operation has completed successfully.
577    ///
578    /// Any error that prevents the operation from completing successfully
579    /// will result in the protocol being closed.
580    ///
581    /// [3]: https://openthread.io/reference/group/api-operational-dataset#otdatasetsetactivetlvs
582    pub fn r#set_active_tlvs(
583        &self,
584        mut dataset: &[u8],
585        ___deadline: zx::MonotonicInstant,
586    ) -> Result<(), fidl::Error> {
587        let _response =
588            self.client.send_query::<DatasetSetActiveTlvsRequest, fidl::encoding::EmptyPayload>(
589                (dataset,),
590                0x5a8dc1d4e3b578e7,
591                fidl::encoding::DynamicFlags::empty(),
592                ___deadline,
593            )?;
594        Ok(_response)
595    }
596
597    /// Requests that all nodes on the current network attach to the thread
598    /// network described by given dataset. Returns the number of milliseconds
599    /// until the change takes effect.
600    ///
601    /// Functionally equivalent to `ot-br-posix`'s [`AttachAllNodesTo`][4].
602    ///
603    /// If this device is not currently provisioned, then calling this method
604    /// is equivalent to calling [`SetActiveTlvs()`].
605    ///
606    /// The transition of all nodes to the new network may take as long as
607    /// five minutes. The exact amount of time until the network is
608    /// transitioned is returned by this method.
609    ///
610    /// This method returns once the transition has been scheduled successfully.
611    /// Any error that prevents the scheduling of this operation from
612    /// completing successfully (such as being provided with an incomplete
613    /// dataset) will result in the protocol being closed.
614    ///
615    /// [4]: https://github.com/openthread/ot-br-posix/blob/f68c07702bef50f1cc4a153a59b5a3a8331ff43b/src/dbus/server/introspect.xml#L60-L72
616    pub fn r#attach_all_nodes_to(
617        &self,
618        mut dataset: &[u8],
619        ___deadline: zx::MonotonicInstant,
620    ) -> Result<i64, fidl::Error> {
621        let _response = self
622            .client
623            .send_query::<DatasetAttachAllNodesToRequest, DatasetAttachAllNodesToResponse>(
624                (dataset,),
625                0x6057e8b429c4aefe,
626                fidl::encoding::DynamicFlags::empty(),
627                ___deadline,
628            )?;
629        Ok(_response.delay_ms)
630    }
631}
632
633#[cfg(target_os = "fuchsia")]
634impl From<DatasetSynchronousProxy> for zx::Handle {
635    fn from(value: DatasetSynchronousProxy) -> Self {
636        value.into_channel().into()
637    }
638}
639
640#[cfg(target_os = "fuchsia")]
641impl From<fidl::Channel> for DatasetSynchronousProxy {
642    fn from(value: fidl::Channel) -> Self {
643        Self::new(value)
644    }
645}
646
647#[cfg(target_os = "fuchsia")]
648impl fidl::endpoints::FromClient for DatasetSynchronousProxy {
649    type Protocol = DatasetMarker;
650
651    fn from_client(value: fidl::endpoints::ClientEnd<DatasetMarker>) -> Self {
652        Self::new(value.into_channel())
653    }
654}
655
656#[derive(Debug, Clone)]
657pub struct DatasetProxy {
658    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
659}
660
661impl fidl::endpoints::Proxy for DatasetProxy {
662    type Protocol = DatasetMarker;
663
664    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
665        Self::new(inner)
666    }
667
668    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
669        self.client.into_channel().map_err(|client| Self { client })
670    }
671
672    fn as_channel(&self) -> &::fidl::AsyncChannel {
673        self.client.as_channel()
674    }
675}
676
677impl DatasetProxy {
678    /// Create a new Proxy for fuchsia.lowpan.thread/Dataset.
679    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
680        let protocol_name = <DatasetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
681        Self { client: fidl::client::Client::new(channel, protocol_name) }
682    }
683
684    /// Get a Stream of events from the remote end of the protocol.
685    ///
686    /// # Panics
687    ///
688    /// Panics if the event stream was already taken.
689    pub fn take_event_stream(&self) -> DatasetEventStream {
690        DatasetEventStream { event_receiver: self.client.take_event_receiver() }
691    }
692
693    /// Fetches and returns the active Thread operational dataset in raw
694    /// TLV form. Functionally equivalent to [`otDatasetGetActiveTlvs()`][2].
695    ///
696    /// This method returns the active dataset, or nothing in the case that
697    /// there is no active operational dataset.
698    ///
699    /// Any error that prevents the operation from completing successfully
700    /// will result in the protocol being closed.
701    ///
702    /// [2]: https://openthread.io/reference/group/api-operational-dataset#otdatasetgetactivetlvs
703    pub fn r#get_active_tlvs(
704        &self,
705    ) -> fidl::client::QueryResponseFut<
706        Option<Vec<u8>>,
707        fidl::encoding::DefaultFuchsiaResourceDialect,
708    > {
709        DatasetProxyInterface::r#get_active_tlvs(self)
710    }
711
712    /// Sets the active Thread Operational Dataset in raw TLV form.
713    /// Functionally equivalent to [`otDatasetSetActiveTlvs()`][3].
714    ///
715    /// This method returns once the operation has completed successfully.
716    ///
717    /// Any error that prevents the operation from completing successfully
718    /// will result in the protocol being closed.
719    ///
720    /// [3]: https://openthread.io/reference/group/api-operational-dataset#otdatasetsetactivetlvs
721    pub fn r#set_active_tlvs(
722        &self,
723        mut dataset: &[u8],
724    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
725        DatasetProxyInterface::r#set_active_tlvs(self, dataset)
726    }
727
728    /// Requests that all nodes on the current network attach to the thread
729    /// network described by given dataset. Returns the number of milliseconds
730    /// until the change takes effect.
731    ///
732    /// Functionally equivalent to `ot-br-posix`'s [`AttachAllNodesTo`][4].
733    ///
734    /// If this device is not currently provisioned, then calling this method
735    /// is equivalent to calling [`SetActiveTlvs()`].
736    ///
737    /// The transition of all nodes to the new network may take as long as
738    /// five minutes. The exact amount of time until the network is
739    /// transitioned is returned by this method.
740    ///
741    /// This method returns once the transition has been scheduled successfully.
742    /// Any error that prevents the scheduling of this operation from
743    /// completing successfully (such as being provided with an incomplete
744    /// dataset) will result in the protocol being closed.
745    ///
746    /// [4]: https://github.com/openthread/ot-br-posix/blob/f68c07702bef50f1cc4a153a59b5a3a8331ff43b/src/dbus/server/introspect.xml#L60-L72
747    pub fn r#attach_all_nodes_to(
748        &self,
749        mut dataset: &[u8],
750    ) -> fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect> {
751        DatasetProxyInterface::r#attach_all_nodes_to(self, dataset)
752    }
753}
754
755impl DatasetProxyInterface for DatasetProxy {
756    type GetActiveTlvsResponseFut = fidl::client::QueryResponseFut<
757        Option<Vec<u8>>,
758        fidl::encoding::DefaultFuchsiaResourceDialect,
759    >;
760    fn r#get_active_tlvs(&self) -> Self::GetActiveTlvsResponseFut {
761        fn _decode(
762            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
763        ) -> Result<Option<Vec<u8>>, fidl::Error> {
764            let _response = fidl::client::decode_transaction_body::<
765                DatasetGetActiveTlvsResponse,
766                fidl::encoding::DefaultFuchsiaResourceDialect,
767                0x3004d50d9fb69b92,
768            >(_buf?)?;
769            Ok(_response.dataset)
770        }
771        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Option<Vec<u8>>>(
772            (),
773            0x3004d50d9fb69b92,
774            fidl::encoding::DynamicFlags::empty(),
775            _decode,
776        )
777    }
778
779    type SetActiveTlvsResponseFut =
780        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
781    fn r#set_active_tlvs(&self, mut dataset: &[u8]) -> Self::SetActiveTlvsResponseFut {
782        fn _decode(
783            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
784        ) -> Result<(), fidl::Error> {
785            let _response = fidl::client::decode_transaction_body::<
786                fidl::encoding::EmptyPayload,
787                fidl::encoding::DefaultFuchsiaResourceDialect,
788                0x5a8dc1d4e3b578e7,
789            >(_buf?)?;
790            Ok(_response)
791        }
792        self.client.send_query_and_decode::<DatasetSetActiveTlvsRequest, ()>(
793            (dataset,),
794            0x5a8dc1d4e3b578e7,
795            fidl::encoding::DynamicFlags::empty(),
796            _decode,
797        )
798    }
799
800    type AttachAllNodesToResponseFut =
801        fidl::client::QueryResponseFut<i64, fidl::encoding::DefaultFuchsiaResourceDialect>;
802    fn r#attach_all_nodes_to(&self, mut dataset: &[u8]) -> Self::AttachAllNodesToResponseFut {
803        fn _decode(
804            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
805        ) -> Result<i64, fidl::Error> {
806            let _response = fidl::client::decode_transaction_body::<
807                DatasetAttachAllNodesToResponse,
808                fidl::encoding::DefaultFuchsiaResourceDialect,
809                0x6057e8b429c4aefe,
810            >(_buf?)?;
811            Ok(_response.delay_ms)
812        }
813        self.client.send_query_and_decode::<DatasetAttachAllNodesToRequest, i64>(
814            (dataset,),
815            0x6057e8b429c4aefe,
816            fidl::encoding::DynamicFlags::empty(),
817            _decode,
818        )
819    }
820}
821
822pub struct DatasetEventStream {
823    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
824}
825
826impl std::marker::Unpin for DatasetEventStream {}
827
828impl futures::stream::FusedStream for DatasetEventStream {
829    fn is_terminated(&self) -> bool {
830        self.event_receiver.is_terminated()
831    }
832}
833
834impl futures::Stream for DatasetEventStream {
835    type Item = Result<DatasetEvent, fidl::Error>;
836
837    fn poll_next(
838        mut self: std::pin::Pin<&mut Self>,
839        cx: &mut std::task::Context<'_>,
840    ) -> std::task::Poll<Option<Self::Item>> {
841        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
842            &mut self.event_receiver,
843            cx
844        )?) {
845            Some(buf) => std::task::Poll::Ready(Some(DatasetEvent::decode(buf))),
846            None => std::task::Poll::Ready(None),
847        }
848    }
849}
850
851#[derive(Debug)]
852pub enum DatasetEvent {}
853
854impl DatasetEvent {
855    /// Decodes a message buffer as a [`DatasetEvent`].
856    fn decode(
857        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
858    ) -> Result<DatasetEvent, fidl::Error> {
859        let (bytes, _handles) = buf.split_mut();
860        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
861        debug_assert_eq!(tx_header.tx_id, 0);
862        match tx_header.ordinal {
863            _ => Err(fidl::Error::UnknownOrdinal {
864                ordinal: tx_header.ordinal,
865                protocol_name: <DatasetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
866            }),
867        }
868    }
869}
870
871/// A Stream of incoming requests for fuchsia.lowpan.thread/Dataset.
872pub struct DatasetRequestStream {
873    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
874    is_terminated: bool,
875}
876
877impl std::marker::Unpin for DatasetRequestStream {}
878
879impl futures::stream::FusedStream for DatasetRequestStream {
880    fn is_terminated(&self) -> bool {
881        self.is_terminated
882    }
883}
884
885impl fidl::endpoints::RequestStream for DatasetRequestStream {
886    type Protocol = DatasetMarker;
887    type ControlHandle = DatasetControlHandle;
888
889    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
890        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
891    }
892
893    fn control_handle(&self) -> Self::ControlHandle {
894        DatasetControlHandle { inner: self.inner.clone() }
895    }
896
897    fn into_inner(
898        self,
899    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
900    {
901        (self.inner, self.is_terminated)
902    }
903
904    fn from_inner(
905        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
906        is_terminated: bool,
907    ) -> Self {
908        Self { inner, is_terminated }
909    }
910}
911
912impl futures::Stream for DatasetRequestStream {
913    type Item = Result<DatasetRequest, fidl::Error>;
914
915    fn poll_next(
916        mut self: std::pin::Pin<&mut Self>,
917        cx: &mut std::task::Context<'_>,
918    ) -> std::task::Poll<Option<Self::Item>> {
919        let this = &mut *self;
920        if this.inner.check_shutdown(cx) {
921            this.is_terminated = true;
922            return std::task::Poll::Ready(None);
923        }
924        if this.is_terminated {
925            panic!("polled DatasetRequestStream after completion");
926        }
927        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
928            |bytes, handles| {
929                match this.inner.channel().read_etc(cx, bytes, handles) {
930                    std::task::Poll::Ready(Ok(())) => {}
931                    std::task::Poll::Pending => return std::task::Poll::Pending,
932                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
933                        this.is_terminated = true;
934                        return std::task::Poll::Ready(None);
935                    }
936                    std::task::Poll::Ready(Err(e)) => {
937                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
938                            e.into(),
939                        ))))
940                    }
941                }
942
943                // A message has been received from the channel
944                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
945
946                std::task::Poll::Ready(Some(match header.ordinal {
947                    0x3004d50d9fb69b92 => {
948                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
949                        let mut req = fidl::new_empty!(
950                            fidl::encoding::EmptyPayload,
951                            fidl::encoding::DefaultFuchsiaResourceDialect
952                        );
953                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
954                        let control_handle = DatasetControlHandle { inner: this.inner.clone() };
955                        Ok(DatasetRequest::GetActiveTlvs {
956                            responder: DatasetGetActiveTlvsResponder {
957                                control_handle: std::mem::ManuallyDrop::new(control_handle),
958                                tx_id: header.tx_id,
959                            },
960                        })
961                    }
962                    0x5a8dc1d4e3b578e7 => {
963                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
964                        let mut req = fidl::new_empty!(
965                            DatasetSetActiveTlvsRequest,
966                            fidl::encoding::DefaultFuchsiaResourceDialect
967                        );
968                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DatasetSetActiveTlvsRequest>(&header, _body_bytes, handles, &mut req)?;
969                        let control_handle = DatasetControlHandle { inner: this.inner.clone() };
970                        Ok(DatasetRequest::SetActiveTlvs {
971                            dataset: req.dataset,
972
973                            responder: DatasetSetActiveTlvsResponder {
974                                control_handle: std::mem::ManuallyDrop::new(control_handle),
975                                tx_id: header.tx_id,
976                            },
977                        })
978                    }
979                    0x6057e8b429c4aefe => {
980                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
981                        let mut req = fidl::new_empty!(
982                            DatasetAttachAllNodesToRequest,
983                            fidl::encoding::DefaultFuchsiaResourceDialect
984                        );
985                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DatasetAttachAllNodesToRequest>(&header, _body_bytes, handles, &mut req)?;
986                        let control_handle = DatasetControlHandle { inner: this.inner.clone() };
987                        Ok(DatasetRequest::AttachAllNodesTo {
988                            dataset: req.dataset,
989
990                            responder: DatasetAttachAllNodesToResponder {
991                                control_handle: std::mem::ManuallyDrop::new(control_handle),
992                                tx_id: header.tx_id,
993                            },
994                        })
995                    }
996                    _ => Err(fidl::Error::UnknownOrdinal {
997                        ordinal: header.ordinal,
998                        protocol_name:
999                            <DatasetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1000                    }),
1001                }))
1002            },
1003        )
1004    }
1005}
1006
1007/// Thread Operational Dataset Protocol.
1008///
1009/// This protocol can expose PII.
1010///
1011/// This protocol provides methods related to the management of the
1012/// Thread operational dataset in raw TLV form.
1013#[derive(Debug)]
1014pub enum DatasetRequest {
1015    /// Fetches and returns the active Thread operational dataset in raw
1016    /// TLV form. Functionally equivalent to [`otDatasetGetActiveTlvs()`][2].
1017    ///
1018    /// This method returns the active dataset, or nothing in the case that
1019    /// there is no active operational dataset.
1020    ///
1021    /// Any error that prevents the operation from completing successfully
1022    /// will result in the protocol being closed.
1023    ///
1024    /// [2]: https://openthread.io/reference/group/api-operational-dataset#otdatasetgetactivetlvs
1025    GetActiveTlvs { responder: DatasetGetActiveTlvsResponder },
1026    /// Sets the active Thread Operational Dataset in raw TLV form.
1027    /// Functionally equivalent to [`otDatasetSetActiveTlvs()`][3].
1028    ///
1029    /// This method returns once the operation has completed successfully.
1030    ///
1031    /// Any error that prevents the operation from completing successfully
1032    /// will result in the protocol being closed.
1033    ///
1034    /// [3]: https://openthread.io/reference/group/api-operational-dataset#otdatasetsetactivetlvs
1035    SetActiveTlvs { dataset: Vec<u8>, responder: DatasetSetActiveTlvsResponder },
1036    /// Requests that all nodes on the current network attach to the thread
1037    /// network described by given dataset. Returns the number of milliseconds
1038    /// until the change takes effect.
1039    ///
1040    /// Functionally equivalent to `ot-br-posix`'s [`AttachAllNodesTo`][4].
1041    ///
1042    /// If this device is not currently provisioned, then calling this method
1043    /// is equivalent to calling [`SetActiveTlvs()`].
1044    ///
1045    /// The transition of all nodes to the new network may take as long as
1046    /// five minutes. The exact amount of time until the network is
1047    /// transitioned is returned by this method.
1048    ///
1049    /// This method returns once the transition has been scheduled successfully.
1050    /// Any error that prevents the scheduling of this operation from
1051    /// completing successfully (such as being provided with an incomplete
1052    /// dataset) will result in the protocol being closed.
1053    ///
1054    /// [4]: https://github.com/openthread/ot-br-posix/blob/f68c07702bef50f1cc4a153a59b5a3a8331ff43b/src/dbus/server/introspect.xml#L60-L72
1055    AttachAllNodesTo { dataset: Vec<u8>, responder: DatasetAttachAllNodesToResponder },
1056}
1057
1058impl DatasetRequest {
1059    #[allow(irrefutable_let_patterns)]
1060    pub fn into_get_active_tlvs(self) -> Option<(DatasetGetActiveTlvsResponder)> {
1061        if let DatasetRequest::GetActiveTlvs { responder } = self {
1062            Some((responder))
1063        } else {
1064            None
1065        }
1066    }
1067
1068    #[allow(irrefutable_let_patterns)]
1069    pub fn into_set_active_tlvs(self) -> Option<(Vec<u8>, DatasetSetActiveTlvsResponder)> {
1070        if let DatasetRequest::SetActiveTlvs { dataset, responder } = self {
1071            Some((dataset, responder))
1072        } else {
1073            None
1074        }
1075    }
1076
1077    #[allow(irrefutable_let_patterns)]
1078    pub fn into_attach_all_nodes_to(self) -> Option<(Vec<u8>, DatasetAttachAllNodesToResponder)> {
1079        if let DatasetRequest::AttachAllNodesTo { dataset, responder } = self {
1080            Some((dataset, responder))
1081        } else {
1082            None
1083        }
1084    }
1085
1086    /// Name of the method defined in FIDL
1087    pub fn method_name(&self) -> &'static str {
1088        match *self {
1089            DatasetRequest::GetActiveTlvs { .. } => "get_active_tlvs",
1090            DatasetRequest::SetActiveTlvs { .. } => "set_active_tlvs",
1091            DatasetRequest::AttachAllNodesTo { .. } => "attach_all_nodes_to",
1092        }
1093    }
1094}
1095
1096#[derive(Debug, Clone)]
1097pub struct DatasetControlHandle {
1098    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1099}
1100
1101impl fidl::endpoints::ControlHandle for DatasetControlHandle {
1102    fn shutdown(&self) {
1103        self.inner.shutdown()
1104    }
1105    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1106        self.inner.shutdown_with_epitaph(status)
1107    }
1108
1109    fn is_closed(&self) -> bool {
1110        self.inner.channel().is_closed()
1111    }
1112    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1113        self.inner.channel().on_closed()
1114    }
1115
1116    #[cfg(target_os = "fuchsia")]
1117    fn signal_peer(
1118        &self,
1119        clear_mask: zx::Signals,
1120        set_mask: zx::Signals,
1121    ) -> Result<(), zx_status::Status> {
1122        use fidl::Peered;
1123        self.inner.channel().signal_peer(clear_mask, set_mask)
1124    }
1125}
1126
1127impl DatasetControlHandle {}
1128
1129#[must_use = "FIDL methods require a response to be sent"]
1130#[derive(Debug)]
1131pub struct DatasetGetActiveTlvsResponder {
1132    control_handle: std::mem::ManuallyDrop<DatasetControlHandle>,
1133    tx_id: u32,
1134}
1135
1136/// Set the the channel to be shutdown (see [`DatasetControlHandle::shutdown`])
1137/// if the responder is dropped without sending a response, so that the client
1138/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1139impl std::ops::Drop for DatasetGetActiveTlvsResponder {
1140    fn drop(&mut self) {
1141        self.control_handle.shutdown();
1142        // Safety: drops once, never accessed again
1143        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1144    }
1145}
1146
1147impl fidl::endpoints::Responder for DatasetGetActiveTlvsResponder {
1148    type ControlHandle = DatasetControlHandle;
1149
1150    fn control_handle(&self) -> &DatasetControlHandle {
1151        &self.control_handle
1152    }
1153
1154    fn drop_without_shutdown(mut self) {
1155        // Safety: drops once, never accessed again due to mem::forget
1156        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1157        // Prevent Drop from running (which would shut down the channel)
1158        std::mem::forget(self);
1159    }
1160}
1161
1162impl DatasetGetActiveTlvsResponder {
1163    /// Sends a response to the FIDL transaction.
1164    ///
1165    /// Sets the channel to shutdown if an error occurs.
1166    pub fn send(self, mut dataset: Option<&[u8]>) -> Result<(), fidl::Error> {
1167        let _result = self.send_raw(dataset);
1168        if _result.is_err() {
1169            self.control_handle.shutdown();
1170        }
1171        self.drop_without_shutdown();
1172        _result
1173    }
1174
1175    /// Similar to "send" but does not shutdown the channel if an error occurs.
1176    pub fn send_no_shutdown_on_err(self, mut dataset: Option<&[u8]>) -> Result<(), fidl::Error> {
1177        let _result = self.send_raw(dataset);
1178        self.drop_without_shutdown();
1179        _result
1180    }
1181
1182    fn send_raw(&self, mut dataset: Option<&[u8]>) -> Result<(), fidl::Error> {
1183        self.control_handle.inner.send::<DatasetGetActiveTlvsResponse>(
1184            (dataset,),
1185            self.tx_id,
1186            0x3004d50d9fb69b92,
1187            fidl::encoding::DynamicFlags::empty(),
1188        )
1189    }
1190}
1191
1192#[must_use = "FIDL methods require a response to be sent"]
1193#[derive(Debug)]
1194pub struct DatasetSetActiveTlvsResponder {
1195    control_handle: std::mem::ManuallyDrop<DatasetControlHandle>,
1196    tx_id: u32,
1197}
1198
1199/// Set the the channel to be shutdown (see [`DatasetControlHandle::shutdown`])
1200/// if the responder is dropped without sending a response, so that the client
1201/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1202impl std::ops::Drop for DatasetSetActiveTlvsResponder {
1203    fn drop(&mut self) {
1204        self.control_handle.shutdown();
1205        // Safety: drops once, never accessed again
1206        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1207    }
1208}
1209
1210impl fidl::endpoints::Responder for DatasetSetActiveTlvsResponder {
1211    type ControlHandle = DatasetControlHandle;
1212
1213    fn control_handle(&self) -> &DatasetControlHandle {
1214        &self.control_handle
1215    }
1216
1217    fn drop_without_shutdown(mut self) {
1218        // Safety: drops once, never accessed again due to mem::forget
1219        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1220        // Prevent Drop from running (which would shut down the channel)
1221        std::mem::forget(self);
1222    }
1223}
1224
1225impl DatasetSetActiveTlvsResponder {
1226    /// Sends a response to the FIDL transaction.
1227    ///
1228    /// Sets the channel to shutdown if an error occurs.
1229    pub fn send(self) -> Result<(), fidl::Error> {
1230        let _result = self.send_raw();
1231        if _result.is_err() {
1232            self.control_handle.shutdown();
1233        }
1234        self.drop_without_shutdown();
1235        _result
1236    }
1237
1238    /// Similar to "send" but does not shutdown the channel if an error occurs.
1239    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1240        let _result = self.send_raw();
1241        self.drop_without_shutdown();
1242        _result
1243    }
1244
1245    fn send_raw(&self) -> Result<(), fidl::Error> {
1246        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1247            (),
1248            self.tx_id,
1249            0x5a8dc1d4e3b578e7,
1250            fidl::encoding::DynamicFlags::empty(),
1251        )
1252    }
1253}
1254
1255#[must_use = "FIDL methods require a response to be sent"]
1256#[derive(Debug)]
1257pub struct DatasetAttachAllNodesToResponder {
1258    control_handle: std::mem::ManuallyDrop<DatasetControlHandle>,
1259    tx_id: u32,
1260}
1261
1262/// Set the the channel to be shutdown (see [`DatasetControlHandle::shutdown`])
1263/// if the responder is dropped without sending a response, so that the client
1264/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1265impl std::ops::Drop for DatasetAttachAllNodesToResponder {
1266    fn drop(&mut self) {
1267        self.control_handle.shutdown();
1268        // Safety: drops once, never accessed again
1269        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1270    }
1271}
1272
1273impl fidl::endpoints::Responder for DatasetAttachAllNodesToResponder {
1274    type ControlHandle = DatasetControlHandle;
1275
1276    fn control_handle(&self) -> &DatasetControlHandle {
1277        &self.control_handle
1278    }
1279
1280    fn drop_without_shutdown(mut self) {
1281        // Safety: drops once, never accessed again due to mem::forget
1282        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1283        // Prevent Drop from running (which would shut down the channel)
1284        std::mem::forget(self);
1285    }
1286}
1287
1288impl DatasetAttachAllNodesToResponder {
1289    /// Sends a response to the FIDL transaction.
1290    ///
1291    /// Sets the channel to shutdown if an error occurs.
1292    pub fn send(self, mut delay_ms: i64) -> Result<(), fidl::Error> {
1293        let _result = self.send_raw(delay_ms);
1294        if _result.is_err() {
1295            self.control_handle.shutdown();
1296        }
1297        self.drop_without_shutdown();
1298        _result
1299    }
1300
1301    /// Similar to "send" but does not shutdown the channel if an error occurs.
1302    pub fn send_no_shutdown_on_err(self, mut delay_ms: i64) -> Result<(), fidl::Error> {
1303        let _result = self.send_raw(delay_ms);
1304        self.drop_without_shutdown();
1305        _result
1306    }
1307
1308    fn send_raw(&self, mut delay_ms: i64) -> Result<(), fidl::Error> {
1309        self.control_handle.inner.send::<DatasetAttachAllNodesToResponse>(
1310            (delay_ms,),
1311            self.tx_id,
1312            0x6057e8b429c4aefe,
1313            fidl::encoding::DynamicFlags::empty(),
1314        )
1315    }
1316}
1317
1318#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1319pub struct DatasetConnectorMarker;
1320
1321impl fidl::endpoints::ProtocolMarker for DatasetConnectorMarker {
1322    type Proxy = DatasetConnectorProxy;
1323    type RequestStream = DatasetConnectorRequestStream;
1324    #[cfg(target_os = "fuchsia")]
1325    type SynchronousProxy = DatasetConnectorSynchronousProxy;
1326
1327    const DEBUG_NAME: &'static str = "fuchsia.lowpan.thread.DatasetConnector";
1328}
1329impl fidl::endpoints::DiscoverableProtocolMarker for DatasetConnectorMarker {}
1330
1331pub trait DatasetConnectorProxyInterface: Send + Sync {
1332    fn r#connect(
1333        &self,
1334        name: &str,
1335        server_end: fidl::endpoints::ServerEnd<DatasetMarker>,
1336    ) -> Result<(), fidl::Error>;
1337}
1338#[derive(Debug)]
1339#[cfg(target_os = "fuchsia")]
1340pub struct DatasetConnectorSynchronousProxy {
1341    client: fidl::client::sync::Client,
1342}
1343
1344#[cfg(target_os = "fuchsia")]
1345impl fidl::endpoints::SynchronousProxy for DatasetConnectorSynchronousProxy {
1346    type Proxy = DatasetConnectorProxy;
1347    type Protocol = DatasetConnectorMarker;
1348
1349    fn from_channel(inner: fidl::Channel) -> Self {
1350        Self::new(inner)
1351    }
1352
1353    fn into_channel(self) -> fidl::Channel {
1354        self.client.into_channel()
1355    }
1356
1357    fn as_channel(&self) -> &fidl::Channel {
1358        self.client.as_channel()
1359    }
1360}
1361
1362#[cfg(target_os = "fuchsia")]
1363impl DatasetConnectorSynchronousProxy {
1364    pub fn new(channel: fidl::Channel) -> Self {
1365        let protocol_name = <DatasetConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1366        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1367    }
1368
1369    pub fn into_channel(self) -> fidl::Channel {
1370        self.client.into_channel()
1371    }
1372
1373    /// Waits until an event arrives and returns it. It is safe for other
1374    /// threads to make concurrent requests while waiting for an event.
1375    pub fn wait_for_event(
1376        &self,
1377        deadline: zx::MonotonicInstant,
1378    ) -> Result<DatasetConnectorEvent, fidl::Error> {
1379        DatasetConnectorEvent::decode(self.client.wait_for_event(deadline)?)
1380    }
1381
1382    /// Connects to the [`Dataset`] protocol on the
1383    /// named LoWPAN device.
1384    ///
1385    /// The name of the interface can be learned by calling
1386    /// [`fuchsia.lowpan/Lookup.GetDevices`].
1387    ///
1388    /// If there is an error in processing this request
1389    /// the given channel is closed and an epitaph code used
1390    /// to describe the reason for the failure:
1391    ///
1392    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
1393    ///   was not formatted correctly or otherwise invalid.
1394    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
1395    ///   given name.
1396    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
1397    ///   does not support this protocol.
1398    pub fn r#connect(
1399        &self,
1400        mut name: &str,
1401        mut server_end: fidl::endpoints::ServerEnd<DatasetMarker>,
1402    ) -> Result<(), fidl::Error> {
1403        self.client.send::<DatasetConnectorConnectRequest>(
1404            (name, server_end),
1405            0x24dff5d2c0cee02b,
1406            fidl::encoding::DynamicFlags::empty(),
1407        )
1408    }
1409}
1410
1411#[cfg(target_os = "fuchsia")]
1412impl From<DatasetConnectorSynchronousProxy> for zx::Handle {
1413    fn from(value: DatasetConnectorSynchronousProxy) -> Self {
1414        value.into_channel().into()
1415    }
1416}
1417
1418#[cfg(target_os = "fuchsia")]
1419impl From<fidl::Channel> for DatasetConnectorSynchronousProxy {
1420    fn from(value: fidl::Channel) -> Self {
1421        Self::new(value)
1422    }
1423}
1424
1425#[cfg(target_os = "fuchsia")]
1426impl fidl::endpoints::FromClient for DatasetConnectorSynchronousProxy {
1427    type Protocol = DatasetConnectorMarker;
1428
1429    fn from_client(value: fidl::endpoints::ClientEnd<DatasetConnectorMarker>) -> Self {
1430        Self::new(value.into_channel())
1431    }
1432}
1433
1434#[derive(Debug, Clone)]
1435pub struct DatasetConnectorProxy {
1436    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1437}
1438
1439impl fidl::endpoints::Proxy for DatasetConnectorProxy {
1440    type Protocol = DatasetConnectorMarker;
1441
1442    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1443        Self::new(inner)
1444    }
1445
1446    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1447        self.client.into_channel().map_err(|client| Self { client })
1448    }
1449
1450    fn as_channel(&self) -> &::fidl::AsyncChannel {
1451        self.client.as_channel()
1452    }
1453}
1454
1455impl DatasetConnectorProxy {
1456    /// Create a new Proxy for fuchsia.lowpan.thread/DatasetConnector.
1457    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1458        let protocol_name = <DatasetConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1459        Self { client: fidl::client::Client::new(channel, protocol_name) }
1460    }
1461
1462    /// Get a Stream of events from the remote end of the protocol.
1463    ///
1464    /// # Panics
1465    ///
1466    /// Panics if the event stream was already taken.
1467    pub fn take_event_stream(&self) -> DatasetConnectorEventStream {
1468        DatasetConnectorEventStream { event_receiver: self.client.take_event_receiver() }
1469    }
1470
1471    /// Connects to the [`Dataset`] protocol on the
1472    /// named LoWPAN device.
1473    ///
1474    /// The name of the interface can be learned by calling
1475    /// [`fuchsia.lowpan/Lookup.GetDevices`].
1476    ///
1477    /// If there is an error in processing this request
1478    /// the given channel is closed and an epitaph code used
1479    /// to describe the reason for the failure:
1480    ///
1481    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
1482    ///   was not formatted correctly or otherwise invalid.
1483    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
1484    ///   given name.
1485    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
1486    ///   does not support this protocol.
1487    pub fn r#connect(
1488        &self,
1489        mut name: &str,
1490        mut server_end: fidl::endpoints::ServerEnd<DatasetMarker>,
1491    ) -> Result<(), fidl::Error> {
1492        DatasetConnectorProxyInterface::r#connect(self, name, server_end)
1493    }
1494}
1495
1496impl DatasetConnectorProxyInterface for DatasetConnectorProxy {
1497    fn r#connect(
1498        &self,
1499        mut name: &str,
1500        mut server_end: fidl::endpoints::ServerEnd<DatasetMarker>,
1501    ) -> Result<(), fidl::Error> {
1502        self.client.send::<DatasetConnectorConnectRequest>(
1503            (name, server_end),
1504            0x24dff5d2c0cee02b,
1505            fidl::encoding::DynamicFlags::empty(),
1506        )
1507    }
1508}
1509
1510pub struct DatasetConnectorEventStream {
1511    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1512}
1513
1514impl std::marker::Unpin for DatasetConnectorEventStream {}
1515
1516impl futures::stream::FusedStream for DatasetConnectorEventStream {
1517    fn is_terminated(&self) -> bool {
1518        self.event_receiver.is_terminated()
1519    }
1520}
1521
1522impl futures::Stream for DatasetConnectorEventStream {
1523    type Item = Result<DatasetConnectorEvent, fidl::Error>;
1524
1525    fn poll_next(
1526        mut self: std::pin::Pin<&mut Self>,
1527        cx: &mut std::task::Context<'_>,
1528    ) -> std::task::Poll<Option<Self::Item>> {
1529        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1530            &mut self.event_receiver,
1531            cx
1532        )?) {
1533            Some(buf) => std::task::Poll::Ready(Some(DatasetConnectorEvent::decode(buf))),
1534            None => std::task::Poll::Ready(None),
1535        }
1536    }
1537}
1538
1539#[derive(Debug)]
1540pub enum DatasetConnectorEvent {}
1541
1542impl DatasetConnectorEvent {
1543    /// Decodes a message buffer as a [`DatasetConnectorEvent`].
1544    fn decode(
1545        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1546    ) -> Result<DatasetConnectorEvent, fidl::Error> {
1547        let (bytes, _handles) = buf.split_mut();
1548        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1549        debug_assert_eq!(tx_header.tx_id, 0);
1550        match tx_header.ordinal {
1551            _ => Err(fidl::Error::UnknownOrdinal {
1552                ordinal: tx_header.ordinal,
1553                protocol_name:
1554                    <DatasetConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1555            }),
1556        }
1557    }
1558}
1559
1560/// A Stream of incoming requests for fuchsia.lowpan.thread/DatasetConnector.
1561pub struct DatasetConnectorRequestStream {
1562    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1563    is_terminated: bool,
1564}
1565
1566impl std::marker::Unpin for DatasetConnectorRequestStream {}
1567
1568impl futures::stream::FusedStream for DatasetConnectorRequestStream {
1569    fn is_terminated(&self) -> bool {
1570        self.is_terminated
1571    }
1572}
1573
1574impl fidl::endpoints::RequestStream for DatasetConnectorRequestStream {
1575    type Protocol = DatasetConnectorMarker;
1576    type ControlHandle = DatasetConnectorControlHandle;
1577
1578    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1579        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1580    }
1581
1582    fn control_handle(&self) -> Self::ControlHandle {
1583        DatasetConnectorControlHandle { inner: self.inner.clone() }
1584    }
1585
1586    fn into_inner(
1587        self,
1588    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1589    {
1590        (self.inner, self.is_terminated)
1591    }
1592
1593    fn from_inner(
1594        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1595        is_terminated: bool,
1596    ) -> Self {
1597        Self { inner, is_terminated }
1598    }
1599}
1600
1601impl futures::Stream for DatasetConnectorRequestStream {
1602    type Item = Result<DatasetConnectorRequest, fidl::Error>;
1603
1604    fn poll_next(
1605        mut self: std::pin::Pin<&mut Self>,
1606        cx: &mut std::task::Context<'_>,
1607    ) -> std::task::Poll<Option<Self::Item>> {
1608        let this = &mut *self;
1609        if this.inner.check_shutdown(cx) {
1610            this.is_terminated = true;
1611            return std::task::Poll::Ready(None);
1612        }
1613        if this.is_terminated {
1614            panic!("polled DatasetConnectorRequestStream after completion");
1615        }
1616        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1617            |bytes, handles| {
1618                match this.inner.channel().read_etc(cx, bytes, handles) {
1619                    std::task::Poll::Ready(Ok(())) => {}
1620                    std::task::Poll::Pending => return std::task::Poll::Pending,
1621                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1622                        this.is_terminated = true;
1623                        return std::task::Poll::Ready(None);
1624                    }
1625                    std::task::Poll::Ready(Err(e)) => {
1626                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1627                            e.into(),
1628                        ))))
1629                    }
1630                }
1631
1632                // A message has been received from the channel
1633                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1634
1635                std::task::Poll::Ready(Some(match header.ordinal {
1636                    0x24dff5d2c0cee02b => {
1637                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1638                        let mut req = fidl::new_empty!(
1639                            DatasetConnectorConnectRequest,
1640                            fidl::encoding::DefaultFuchsiaResourceDialect
1641                        );
1642                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DatasetConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
1643                        let control_handle =
1644                            DatasetConnectorControlHandle { inner: this.inner.clone() };
1645                        Ok(DatasetConnectorRequest::Connect {
1646                            name: req.name,
1647                            server_end: req.server_end,
1648
1649                            control_handle,
1650                        })
1651                    }
1652                    _ => Err(fidl::Error::UnknownOrdinal {
1653                        ordinal: header.ordinal,
1654                        protocol_name:
1655                            <DatasetConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1656                    }),
1657                }))
1658            },
1659        )
1660    }
1661}
1662
1663/// Protocol for connecting to [`Dataset`] on a LoWPAN device.
1664#[derive(Debug)]
1665pub enum DatasetConnectorRequest {
1666    /// Connects to the [`Dataset`] protocol on the
1667    /// named LoWPAN device.
1668    ///
1669    /// The name of the interface can be learned by calling
1670    /// [`fuchsia.lowpan/Lookup.GetDevices`].
1671    ///
1672    /// If there is an error in processing this request
1673    /// the given channel is closed and an epitaph code used
1674    /// to describe the reason for the failure:
1675    ///
1676    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
1677    ///   was not formatted correctly or otherwise invalid.
1678    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
1679    ///   given name.
1680    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
1681    ///   does not support this protocol.
1682    Connect {
1683        name: String,
1684        server_end: fidl::endpoints::ServerEnd<DatasetMarker>,
1685        control_handle: DatasetConnectorControlHandle,
1686    },
1687}
1688
1689impl DatasetConnectorRequest {
1690    #[allow(irrefutable_let_patterns)]
1691    pub fn into_connect(
1692        self,
1693    ) -> Option<(String, fidl::endpoints::ServerEnd<DatasetMarker>, DatasetConnectorControlHandle)>
1694    {
1695        if let DatasetConnectorRequest::Connect { name, server_end, control_handle } = self {
1696            Some((name, server_end, control_handle))
1697        } else {
1698            None
1699        }
1700    }
1701
1702    /// Name of the method defined in FIDL
1703    pub fn method_name(&self) -> &'static str {
1704        match *self {
1705            DatasetConnectorRequest::Connect { .. } => "connect",
1706        }
1707    }
1708}
1709
1710#[derive(Debug, Clone)]
1711pub struct DatasetConnectorControlHandle {
1712    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1713}
1714
1715impl fidl::endpoints::ControlHandle for DatasetConnectorControlHandle {
1716    fn shutdown(&self) {
1717        self.inner.shutdown()
1718    }
1719    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1720        self.inner.shutdown_with_epitaph(status)
1721    }
1722
1723    fn is_closed(&self) -> bool {
1724        self.inner.channel().is_closed()
1725    }
1726    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1727        self.inner.channel().on_closed()
1728    }
1729
1730    #[cfg(target_os = "fuchsia")]
1731    fn signal_peer(
1732        &self,
1733        clear_mask: zx::Signals,
1734        set_mask: zx::Signals,
1735    ) -> Result<(), zx_status::Status> {
1736        use fidl::Peered;
1737        self.inner.channel().signal_peer(clear_mask, set_mask)
1738    }
1739}
1740
1741impl DatasetConnectorControlHandle {}
1742
1743#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1744pub struct FeatureMarker;
1745
1746impl fidl::endpoints::ProtocolMarker for FeatureMarker {
1747    type Proxy = FeatureProxy;
1748    type RequestStream = FeatureRequestStream;
1749    #[cfg(target_os = "fuchsia")]
1750    type SynchronousProxy = FeatureSynchronousProxy;
1751
1752    const DEBUG_NAME: &'static str = "(anonymous) Feature";
1753}
1754
1755pub trait FeatureProxyInterface: Send + Sync {
1756    type UpdateFeatureConfigResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
1757        + Send;
1758    fn r#update_feature_config(
1759        &self,
1760        config: &FeatureConfig,
1761    ) -> Self::UpdateFeatureConfigResponseFut;
1762    type GetFeatureConfigResponseFut: std::future::Future<Output = Result<FeatureConfig, fidl::Error>>
1763        + Send;
1764    fn r#get_feature_config(&self) -> Self::GetFeatureConfigResponseFut;
1765}
1766#[derive(Debug)]
1767#[cfg(target_os = "fuchsia")]
1768pub struct FeatureSynchronousProxy {
1769    client: fidl::client::sync::Client,
1770}
1771
1772#[cfg(target_os = "fuchsia")]
1773impl fidl::endpoints::SynchronousProxy for FeatureSynchronousProxy {
1774    type Proxy = FeatureProxy;
1775    type Protocol = FeatureMarker;
1776
1777    fn from_channel(inner: fidl::Channel) -> Self {
1778        Self::new(inner)
1779    }
1780
1781    fn into_channel(self) -> fidl::Channel {
1782        self.client.into_channel()
1783    }
1784
1785    fn as_channel(&self) -> &fidl::Channel {
1786        self.client.as_channel()
1787    }
1788}
1789
1790#[cfg(target_os = "fuchsia")]
1791impl FeatureSynchronousProxy {
1792    pub fn new(channel: fidl::Channel) -> Self {
1793        let protocol_name = <FeatureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1794        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1795    }
1796
1797    pub fn into_channel(self) -> fidl::Channel {
1798        self.client.into_channel()
1799    }
1800
1801    /// Waits until an event arrives and returns it. It is safe for other
1802    /// threads to make concurrent requests while waiting for an event.
1803    pub fn wait_for_event(
1804        &self,
1805        deadline: zx::MonotonicInstant,
1806    ) -> Result<FeatureEvent, fidl::Error> {
1807        FeatureEvent::decode(self.client.wait_for_event(deadline)?)
1808    }
1809
1810    /// Updates the current OpenThread feature configuration for this
1811    /// interface.
1812    ///
1813    /// Any unset field in `config` will leave that field unchanged.
1814    pub fn r#update_feature_config(
1815        &self,
1816        mut config: &FeatureConfig,
1817        ___deadline: zx::MonotonicInstant,
1818    ) -> Result<(), fidl::Error> {
1819        let _response = self
1820            .client
1821            .send_query::<FeatureUpdateFeatureConfigRequest, fidl::encoding::EmptyPayload>(
1822                (config,),
1823                0x2d24a706e8730410,
1824                fidl::encoding::DynamicFlags::empty(),
1825                ___deadline,
1826            )?;
1827        Ok(_response)
1828    }
1829
1830    /// Returns the current OpenThread feature configuration for this
1831    /// interface.
1832    ///
1833    /// A unset field in the returned value means that feature is not
1834    /// supported.
1835    pub fn r#get_feature_config(
1836        &self,
1837        ___deadline: zx::MonotonicInstant,
1838    ) -> Result<FeatureConfig, fidl::Error> {
1839        let _response = self
1840            .client
1841            .send_query::<fidl::encoding::EmptyPayload, FeatureGetFeatureConfigResponse>(
1842                (),
1843                0x2ab1896aea843611,
1844                fidl::encoding::DynamicFlags::empty(),
1845                ___deadline,
1846            )?;
1847        Ok(_response.config)
1848    }
1849}
1850
1851#[cfg(target_os = "fuchsia")]
1852impl From<FeatureSynchronousProxy> for zx::Handle {
1853    fn from(value: FeatureSynchronousProxy) -> Self {
1854        value.into_channel().into()
1855    }
1856}
1857
1858#[cfg(target_os = "fuchsia")]
1859impl From<fidl::Channel> for FeatureSynchronousProxy {
1860    fn from(value: fidl::Channel) -> Self {
1861        Self::new(value)
1862    }
1863}
1864
1865#[cfg(target_os = "fuchsia")]
1866impl fidl::endpoints::FromClient for FeatureSynchronousProxy {
1867    type Protocol = FeatureMarker;
1868
1869    fn from_client(value: fidl::endpoints::ClientEnd<FeatureMarker>) -> Self {
1870        Self::new(value.into_channel())
1871    }
1872}
1873
1874#[derive(Debug, Clone)]
1875pub struct FeatureProxy {
1876    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1877}
1878
1879impl fidl::endpoints::Proxy for FeatureProxy {
1880    type Protocol = FeatureMarker;
1881
1882    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1883        Self::new(inner)
1884    }
1885
1886    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1887        self.client.into_channel().map_err(|client| Self { client })
1888    }
1889
1890    fn as_channel(&self) -> &::fidl::AsyncChannel {
1891        self.client.as_channel()
1892    }
1893}
1894
1895impl FeatureProxy {
1896    /// Create a new Proxy for fuchsia.lowpan.thread/Feature.
1897    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1898        let protocol_name = <FeatureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1899        Self { client: fidl::client::Client::new(channel, protocol_name) }
1900    }
1901
1902    /// Get a Stream of events from the remote end of the protocol.
1903    ///
1904    /// # Panics
1905    ///
1906    /// Panics if the event stream was already taken.
1907    pub fn take_event_stream(&self) -> FeatureEventStream {
1908        FeatureEventStream { event_receiver: self.client.take_event_receiver() }
1909    }
1910
1911    /// Updates the current OpenThread feature configuration for this
1912    /// interface.
1913    ///
1914    /// Any unset field in `config` will leave that field unchanged.
1915    pub fn r#update_feature_config(
1916        &self,
1917        mut config: &FeatureConfig,
1918    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1919        FeatureProxyInterface::r#update_feature_config(self, config)
1920    }
1921
1922    /// Returns the current OpenThread feature configuration for this
1923    /// interface.
1924    ///
1925    /// A unset field in the returned value means that feature is not
1926    /// supported.
1927    pub fn r#get_feature_config(
1928        &self,
1929    ) -> fidl::client::QueryResponseFut<FeatureConfig, fidl::encoding::DefaultFuchsiaResourceDialect>
1930    {
1931        FeatureProxyInterface::r#get_feature_config(self)
1932    }
1933}
1934
1935impl FeatureProxyInterface for FeatureProxy {
1936    type UpdateFeatureConfigResponseFut =
1937        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1938    fn r#update_feature_config(
1939        &self,
1940        mut config: &FeatureConfig,
1941    ) -> Self::UpdateFeatureConfigResponseFut {
1942        fn _decode(
1943            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1944        ) -> Result<(), fidl::Error> {
1945            let _response = fidl::client::decode_transaction_body::<
1946                fidl::encoding::EmptyPayload,
1947                fidl::encoding::DefaultFuchsiaResourceDialect,
1948                0x2d24a706e8730410,
1949            >(_buf?)?;
1950            Ok(_response)
1951        }
1952        self.client.send_query_and_decode::<FeatureUpdateFeatureConfigRequest, ()>(
1953            (config,),
1954            0x2d24a706e8730410,
1955            fidl::encoding::DynamicFlags::empty(),
1956            _decode,
1957        )
1958    }
1959
1960    type GetFeatureConfigResponseFut = fidl::client::QueryResponseFut<
1961        FeatureConfig,
1962        fidl::encoding::DefaultFuchsiaResourceDialect,
1963    >;
1964    fn r#get_feature_config(&self) -> Self::GetFeatureConfigResponseFut {
1965        fn _decode(
1966            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1967        ) -> Result<FeatureConfig, fidl::Error> {
1968            let _response = fidl::client::decode_transaction_body::<
1969                FeatureGetFeatureConfigResponse,
1970                fidl::encoding::DefaultFuchsiaResourceDialect,
1971                0x2ab1896aea843611,
1972            >(_buf?)?;
1973            Ok(_response.config)
1974        }
1975        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, FeatureConfig>(
1976            (),
1977            0x2ab1896aea843611,
1978            fidl::encoding::DynamicFlags::empty(),
1979            _decode,
1980        )
1981    }
1982}
1983
1984pub struct FeatureEventStream {
1985    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1986}
1987
1988impl std::marker::Unpin for FeatureEventStream {}
1989
1990impl futures::stream::FusedStream for FeatureEventStream {
1991    fn is_terminated(&self) -> bool {
1992        self.event_receiver.is_terminated()
1993    }
1994}
1995
1996impl futures::Stream for FeatureEventStream {
1997    type Item = Result<FeatureEvent, fidl::Error>;
1998
1999    fn poll_next(
2000        mut self: std::pin::Pin<&mut Self>,
2001        cx: &mut std::task::Context<'_>,
2002    ) -> std::task::Poll<Option<Self::Item>> {
2003        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2004            &mut self.event_receiver,
2005            cx
2006        )?) {
2007            Some(buf) => std::task::Poll::Ready(Some(FeatureEvent::decode(buf))),
2008            None => std::task::Poll::Ready(None),
2009        }
2010    }
2011}
2012
2013#[derive(Debug)]
2014pub enum FeatureEvent {}
2015
2016impl FeatureEvent {
2017    /// Decodes a message buffer as a [`FeatureEvent`].
2018    fn decode(
2019        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2020    ) -> Result<FeatureEvent, fidl::Error> {
2021        let (bytes, _handles) = buf.split_mut();
2022        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2023        debug_assert_eq!(tx_header.tx_id, 0);
2024        match tx_header.ordinal {
2025            _ => Err(fidl::Error::UnknownOrdinal {
2026                ordinal: tx_header.ordinal,
2027                protocol_name: <FeatureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2028            }),
2029        }
2030    }
2031}
2032
2033/// A Stream of incoming requests for fuchsia.lowpan.thread/Feature.
2034pub struct FeatureRequestStream {
2035    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2036    is_terminated: bool,
2037}
2038
2039impl std::marker::Unpin for FeatureRequestStream {}
2040
2041impl futures::stream::FusedStream for FeatureRequestStream {
2042    fn is_terminated(&self) -> bool {
2043        self.is_terminated
2044    }
2045}
2046
2047impl fidl::endpoints::RequestStream for FeatureRequestStream {
2048    type Protocol = FeatureMarker;
2049    type ControlHandle = FeatureControlHandle;
2050
2051    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2052        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2053    }
2054
2055    fn control_handle(&self) -> Self::ControlHandle {
2056        FeatureControlHandle { inner: self.inner.clone() }
2057    }
2058
2059    fn into_inner(
2060        self,
2061    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2062    {
2063        (self.inner, self.is_terminated)
2064    }
2065
2066    fn from_inner(
2067        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2068        is_terminated: bool,
2069    ) -> Self {
2070        Self { inner, is_terminated }
2071    }
2072}
2073
2074impl futures::Stream for FeatureRequestStream {
2075    type Item = Result<FeatureRequest, fidl::Error>;
2076
2077    fn poll_next(
2078        mut self: std::pin::Pin<&mut Self>,
2079        cx: &mut std::task::Context<'_>,
2080    ) -> std::task::Poll<Option<Self::Item>> {
2081        let this = &mut *self;
2082        if this.inner.check_shutdown(cx) {
2083            this.is_terminated = true;
2084            return std::task::Poll::Ready(None);
2085        }
2086        if this.is_terminated {
2087            panic!("polled FeatureRequestStream after completion");
2088        }
2089        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2090            |bytes, handles| {
2091                match this.inner.channel().read_etc(cx, bytes, handles) {
2092                    std::task::Poll::Ready(Ok(())) => {}
2093                    std::task::Poll::Pending => return std::task::Poll::Pending,
2094                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2095                        this.is_terminated = true;
2096                        return std::task::Poll::Ready(None);
2097                    }
2098                    std::task::Poll::Ready(Err(e)) => {
2099                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2100                            e.into(),
2101                        ))))
2102                    }
2103                }
2104
2105                // A message has been received from the channel
2106                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2107
2108                std::task::Poll::Ready(Some(match header.ordinal {
2109                    0x2d24a706e8730410 => {
2110                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2111                        let mut req = fidl::new_empty!(
2112                            FeatureUpdateFeatureConfigRequest,
2113                            fidl::encoding::DefaultFuchsiaResourceDialect
2114                        );
2115                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FeatureUpdateFeatureConfigRequest>(&header, _body_bytes, handles, &mut req)?;
2116                        let control_handle = FeatureControlHandle { inner: this.inner.clone() };
2117                        Ok(FeatureRequest::UpdateFeatureConfig {
2118                            config: req.config,
2119
2120                            responder: FeatureUpdateFeatureConfigResponder {
2121                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2122                                tx_id: header.tx_id,
2123                            },
2124                        })
2125                    }
2126                    0x2ab1896aea843611 => {
2127                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2128                        let mut req = fidl::new_empty!(
2129                            fidl::encoding::EmptyPayload,
2130                            fidl::encoding::DefaultFuchsiaResourceDialect
2131                        );
2132                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2133                        let control_handle = FeatureControlHandle { inner: this.inner.clone() };
2134                        Ok(FeatureRequest::GetFeatureConfig {
2135                            responder: FeatureGetFeatureConfigResponder {
2136                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2137                                tx_id: header.tx_id,
2138                            },
2139                        })
2140                    }
2141                    _ => Err(fidl::Error::UnknownOrdinal {
2142                        ordinal: header.ordinal,
2143                        protocol_name:
2144                            <FeatureMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2145                    }),
2146                }))
2147            },
2148        )
2149    }
2150}
2151
2152/// Protocol for fetching and updating the OpenThread feature configuration
2153/// for a specific LoWPAN interface.
2154#[derive(Debug)]
2155pub enum FeatureRequest {
2156    /// Updates the current OpenThread feature configuration for this
2157    /// interface.
2158    ///
2159    /// Any unset field in `config` will leave that field unchanged.
2160    UpdateFeatureConfig { config: FeatureConfig, responder: FeatureUpdateFeatureConfigResponder },
2161    /// Returns the current OpenThread feature configuration for this
2162    /// interface.
2163    ///
2164    /// A unset field in the returned value means that feature is not
2165    /// supported.
2166    GetFeatureConfig { responder: FeatureGetFeatureConfigResponder },
2167}
2168
2169impl FeatureRequest {
2170    #[allow(irrefutable_let_patterns)]
2171    pub fn into_update_feature_config(
2172        self,
2173    ) -> Option<(FeatureConfig, FeatureUpdateFeatureConfigResponder)> {
2174        if let FeatureRequest::UpdateFeatureConfig { config, responder } = self {
2175            Some((config, responder))
2176        } else {
2177            None
2178        }
2179    }
2180
2181    #[allow(irrefutable_let_patterns)]
2182    pub fn into_get_feature_config(self) -> Option<(FeatureGetFeatureConfigResponder)> {
2183        if let FeatureRequest::GetFeatureConfig { responder } = self {
2184            Some((responder))
2185        } else {
2186            None
2187        }
2188    }
2189
2190    /// Name of the method defined in FIDL
2191    pub fn method_name(&self) -> &'static str {
2192        match *self {
2193            FeatureRequest::UpdateFeatureConfig { .. } => "update_feature_config",
2194            FeatureRequest::GetFeatureConfig { .. } => "get_feature_config",
2195        }
2196    }
2197}
2198
2199#[derive(Debug, Clone)]
2200pub struct FeatureControlHandle {
2201    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2202}
2203
2204impl fidl::endpoints::ControlHandle for FeatureControlHandle {
2205    fn shutdown(&self) {
2206        self.inner.shutdown()
2207    }
2208    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2209        self.inner.shutdown_with_epitaph(status)
2210    }
2211
2212    fn is_closed(&self) -> bool {
2213        self.inner.channel().is_closed()
2214    }
2215    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2216        self.inner.channel().on_closed()
2217    }
2218
2219    #[cfg(target_os = "fuchsia")]
2220    fn signal_peer(
2221        &self,
2222        clear_mask: zx::Signals,
2223        set_mask: zx::Signals,
2224    ) -> Result<(), zx_status::Status> {
2225        use fidl::Peered;
2226        self.inner.channel().signal_peer(clear_mask, set_mask)
2227    }
2228}
2229
2230impl FeatureControlHandle {}
2231
2232#[must_use = "FIDL methods require a response to be sent"]
2233#[derive(Debug)]
2234pub struct FeatureUpdateFeatureConfigResponder {
2235    control_handle: std::mem::ManuallyDrop<FeatureControlHandle>,
2236    tx_id: u32,
2237}
2238
2239/// Set the the channel to be shutdown (see [`FeatureControlHandle::shutdown`])
2240/// if the responder is dropped without sending a response, so that the client
2241/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2242impl std::ops::Drop for FeatureUpdateFeatureConfigResponder {
2243    fn drop(&mut self) {
2244        self.control_handle.shutdown();
2245        // Safety: drops once, never accessed again
2246        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2247    }
2248}
2249
2250impl fidl::endpoints::Responder for FeatureUpdateFeatureConfigResponder {
2251    type ControlHandle = FeatureControlHandle;
2252
2253    fn control_handle(&self) -> &FeatureControlHandle {
2254        &self.control_handle
2255    }
2256
2257    fn drop_without_shutdown(mut self) {
2258        // Safety: drops once, never accessed again due to mem::forget
2259        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2260        // Prevent Drop from running (which would shut down the channel)
2261        std::mem::forget(self);
2262    }
2263}
2264
2265impl FeatureUpdateFeatureConfigResponder {
2266    /// Sends a response to the FIDL transaction.
2267    ///
2268    /// Sets the channel to shutdown if an error occurs.
2269    pub fn send(self) -> Result<(), fidl::Error> {
2270        let _result = self.send_raw();
2271        if _result.is_err() {
2272            self.control_handle.shutdown();
2273        }
2274        self.drop_without_shutdown();
2275        _result
2276    }
2277
2278    /// Similar to "send" but does not shutdown the channel if an error occurs.
2279    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2280        let _result = self.send_raw();
2281        self.drop_without_shutdown();
2282        _result
2283    }
2284
2285    fn send_raw(&self) -> Result<(), fidl::Error> {
2286        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2287            (),
2288            self.tx_id,
2289            0x2d24a706e8730410,
2290            fidl::encoding::DynamicFlags::empty(),
2291        )
2292    }
2293}
2294
2295#[must_use = "FIDL methods require a response to be sent"]
2296#[derive(Debug)]
2297pub struct FeatureGetFeatureConfigResponder {
2298    control_handle: std::mem::ManuallyDrop<FeatureControlHandle>,
2299    tx_id: u32,
2300}
2301
2302/// Set the the channel to be shutdown (see [`FeatureControlHandle::shutdown`])
2303/// if the responder is dropped without sending a response, so that the client
2304/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2305impl std::ops::Drop for FeatureGetFeatureConfigResponder {
2306    fn drop(&mut self) {
2307        self.control_handle.shutdown();
2308        // Safety: drops once, never accessed again
2309        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2310    }
2311}
2312
2313impl fidl::endpoints::Responder for FeatureGetFeatureConfigResponder {
2314    type ControlHandle = FeatureControlHandle;
2315
2316    fn control_handle(&self) -> &FeatureControlHandle {
2317        &self.control_handle
2318    }
2319
2320    fn drop_without_shutdown(mut self) {
2321        // Safety: drops once, never accessed again due to mem::forget
2322        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2323        // Prevent Drop from running (which would shut down the channel)
2324        std::mem::forget(self);
2325    }
2326}
2327
2328impl FeatureGetFeatureConfigResponder {
2329    /// Sends a response to the FIDL transaction.
2330    ///
2331    /// Sets the channel to shutdown if an error occurs.
2332    pub fn send(self, mut config: &FeatureConfig) -> Result<(), fidl::Error> {
2333        let _result = self.send_raw(config);
2334        if _result.is_err() {
2335            self.control_handle.shutdown();
2336        }
2337        self.drop_without_shutdown();
2338        _result
2339    }
2340
2341    /// Similar to "send" but does not shutdown the channel if an error occurs.
2342    pub fn send_no_shutdown_on_err(self, mut config: &FeatureConfig) -> Result<(), fidl::Error> {
2343        let _result = self.send_raw(config);
2344        self.drop_without_shutdown();
2345        _result
2346    }
2347
2348    fn send_raw(&self, mut config: &FeatureConfig) -> Result<(), fidl::Error> {
2349        self.control_handle.inner.send::<FeatureGetFeatureConfigResponse>(
2350            (config,),
2351            self.tx_id,
2352            0x2ab1896aea843611,
2353            fidl::encoding::DynamicFlags::empty(),
2354        )
2355    }
2356}
2357
2358#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2359pub struct FeatureConnectorMarker;
2360
2361impl fidl::endpoints::ProtocolMarker for FeatureConnectorMarker {
2362    type Proxy = FeatureConnectorProxy;
2363    type RequestStream = FeatureConnectorRequestStream;
2364    #[cfg(target_os = "fuchsia")]
2365    type SynchronousProxy = FeatureConnectorSynchronousProxy;
2366
2367    const DEBUG_NAME: &'static str = "fuchsia.lowpan.thread.FeatureConnector";
2368}
2369impl fidl::endpoints::DiscoverableProtocolMarker for FeatureConnectorMarker {}
2370
2371pub trait FeatureConnectorProxyInterface: Send + Sync {
2372    fn r#connect(
2373        &self,
2374        name: &str,
2375        server_end: fidl::endpoints::ServerEnd<FeatureMarker>,
2376    ) -> Result<(), fidl::Error>;
2377}
2378#[derive(Debug)]
2379#[cfg(target_os = "fuchsia")]
2380pub struct FeatureConnectorSynchronousProxy {
2381    client: fidl::client::sync::Client,
2382}
2383
2384#[cfg(target_os = "fuchsia")]
2385impl fidl::endpoints::SynchronousProxy for FeatureConnectorSynchronousProxy {
2386    type Proxy = FeatureConnectorProxy;
2387    type Protocol = FeatureConnectorMarker;
2388
2389    fn from_channel(inner: fidl::Channel) -> Self {
2390        Self::new(inner)
2391    }
2392
2393    fn into_channel(self) -> fidl::Channel {
2394        self.client.into_channel()
2395    }
2396
2397    fn as_channel(&self) -> &fidl::Channel {
2398        self.client.as_channel()
2399    }
2400}
2401
2402#[cfg(target_os = "fuchsia")]
2403impl FeatureConnectorSynchronousProxy {
2404    pub fn new(channel: fidl::Channel) -> Self {
2405        let protocol_name = <FeatureConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2406        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2407    }
2408
2409    pub fn into_channel(self) -> fidl::Channel {
2410        self.client.into_channel()
2411    }
2412
2413    /// Waits until an event arrives and returns it. It is safe for other
2414    /// threads to make concurrent requests while waiting for an event.
2415    pub fn wait_for_event(
2416        &self,
2417        deadline: zx::MonotonicInstant,
2418    ) -> Result<FeatureConnectorEvent, fidl::Error> {
2419        FeatureConnectorEvent::decode(self.client.wait_for_event(deadline)?)
2420    }
2421
2422    /// Connects to the [`Feature`] protocol on the
2423    /// named LoWPAN device.
2424    ///
2425    /// The name of the interface can be learned by calling
2426    /// [`fuchsia.lowpan/Lookup.GetDevices`].
2427    ///
2428    /// If there is an error in processing this request
2429    /// the given channel is closed and an epitaph code used
2430    /// to describe the reason for the failure:
2431    ///
2432    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
2433    ///   was not formatted correctly or otherwise invalid.
2434    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
2435    ///   given name.
2436    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
2437    ///   does not support this protocol.
2438    pub fn r#connect(
2439        &self,
2440        mut name: &str,
2441        mut server_end: fidl::endpoints::ServerEnd<FeatureMarker>,
2442    ) -> Result<(), fidl::Error> {
2443        self.client.send::<FeatureConnectorConnectRequest>(
2444            (name, server_end),
2445            0x470f006d630987a5,
2446            fidl::encoding::DynamicFlags::empty(),
2447        )
2448    }
2449}
2450
2451#[cfg(target_os = "fuchsia")]
2452impl From<FeatureConnectorSynchronousProxy> for zx::Handle {
2453    fn from(value: FeatureConnectorSynchronousProxy) -> Self {
2454        value.into_channel().into()
2455    }
2456}
2457
2458#[cfg(target_os = "fuchsia")]
2459impl From<fidl::Channel> for FeatureConnectorSynchronousProxy {
2460    fn from(value: fidl::Channel) -> Self {
2461        Self::new(value)
2462    }
2463}
2464
2465#[cfg(target_os = "fuchsia")]
2466impl fidl::endpoints::FromClient for FeatureConnectorSynchronousProxy {
2467    type Protocol = FeatureConnectorMarker;
2468
2469    fn from_client(value: fidl::endpoints::ClientEnd<FeatureConnectorMarker>) -> Self {
2470        Self::new(value.into_channel())
2471    }
2472}
2473
2474#[derive(Debug, Clone)]
2475pub struct FeatureConnectorProxy {
2476    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2477}
2478
2479impl fidl::endpoints::Proxy for FeatureConnectorProxy {
2480    type Protocol = FeatureConnectorMarker;
2481
2482    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2483        Self::new(inner)
2484    }
2485
2486    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2487        self.client.into_channel().map_err(|client| Self { client })
2488    }
2489
2490    fn as_channel(&self) -> &::fidl::AsyncChannel {
2491        self.client.as_channel()
2492    }
2493}
2494
2495impl FeatureConnectorProxy {
2496    /// Create a new Proxy for fuchsia.lowpan.thread/FeatureConnector.
2497    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2498        let protocol_name = <FeatureConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2499        Self { client: fidl::client::Client::new(channel, protocol_name) }
2500    }
2501
2502    /// Get a Stream of events from the remote end of the protocol.
2503    ///
2504    /// # Panics
2505    ///
2506    /// Panics if the event stream was already taken.
2507    pub fn take_event_stream(&self) -> FeatureConnectorEventStream {
2508        FeatureConnectorEventStream { event_receiver: self.client.take_event_receiver() }
2509    }
2510
2511    /// Connects to the [`Feature`] protocol on the
2512    /// named LoWPAN device.
2513    ///
2514    /// The name of the interface can be learned by calling
2515    /// [`fuchsia.lowpan/Lookup.GetDevices`].
2516    ///
2517    /// If there is an error in processing this request
2518    /// the given channel is closed and an epitaph code used
2519    /// to describe the reason for the failure:
2520    ///
2521    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
2522    ///   was not formatted correctly or otherwise invalid.
2523    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
2524    ///   given name.
2525    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
2526    ///   does not support this protocol.
2527    pub fn r#connect(
2528        &self,
2529        mut name: &str,
2530        mut server_end: fidl::endpoints::ServerEnd<FeatureMarker>,
2531    ) -> Result<(), fidl::Error> {
2532        FeatureConnectorProxyInterface::r#connect(self, name, server_end)
2533    }
2534}
2535
2536impl FeatureConnectorProxyInterface for FeatureConnectorProxy {
2537    fn r#connect(
2538        &self,
2539        mut name: &str,
2540        mut server_end: fidl::endpoints::ServerEnd<FeatureMarker>,
2541    ) -> Result<(), fidl::Error> {
2542        self.client.send::<FeatureConnectorConnectRequest>(
2543            (name, server_end),
2544            0x470f006d630987a5,
2545            fidl::encoding::DynamicFlags::empty(),
2546        )
2547    }
2548}
2549
2550pub struct FeatureConnectorEventStream {
2551    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2552}
2553
2554impl std::marker::Unpin for FeatureConnectorEventStream {}
2555
2556impl futures::stream::FusedStream for FeatureConnectorEventStream {
2557    fn is_terminated(&self) -> bool {
2558        self.event_receiver.is_terminated()
2559    }
2560}
2561
2562impl futures::Stream for FeatureConnectorEventStream {
2563    type Item = Result<FeatureConnectorEvent, fidl::Error>;
2564
2565    fn poll_next(
2566        mut self: std::pin::Pin<&mut Self>,
2567        cx: &mut std::task::Context<'_>,
2568    ) -> std::task::Poll<Option<Self::Item>> {
2569        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2570            &mut self.event_receiver,
2571            cx
2572        )?) {
2573            Some(buf) => std::task::Poll::Ready(Some(FeatureConnectorEvent::decode(buf))),
2574            None => std::task::Poll::Ready(None),
2575        }
2576    }
2577}
2578
2579#[derive(Debug)]
2580pub enum FeatureConnectorEvent {}
2581
2582impl FeatureConnectorEvent {
2583    /// Decodes a message buffer as a [`FeatureConnectorEvent`].
2584    fn decode(
2585        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2586    ) -> Result<FeatureConnectorEvent, fidl::Error> {
2587        let (bytes, _handles) = buf.split_mut();
2588        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2589        debug_assert_eq!(tx_header.tx_id, 0);
2590        match tx_header.ordinal {
2591            _ => Err(fidl::Error::UnknownOrdinal {
2592                ordinal: tx_header.ordinal,
2593                protocol_name:
2594                    <FeatureConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2595            }),
2596        }
2597    }
2598}
2599
2600/// A Stream of incoming requests for fuchsia.lowpan.thread/FeatureConnector.
2601pub struct FeatureConnectorRequestStream {
2602    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2603    is_terminated: bool,
2604}
2605
2606impl std::marker::Unpin for FeatureConnectorRequestStream {}
2607
2608impl futures::stream::FusedStream for FeatureConnectorRequestStream {
2609    fn is_terminated(&self) -> bool {
2610        self.is_terminated
2611    }
2612}
2613
2614impl fidl::endpoints::RequestStream for FeatureConnectorRequestStream {
2615    type Protocol = FeatureConnectorMarker;
2616    type ControlHandle = FeatureConnectorControlHandle;
2617
2618    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2619        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2620    }
2621
2622    fn control_handle(&self) -> Self::ControlHandle {
2623        FeatureConnectorControlHandle { inner: self.inner.clone() }
2624    }
2625
2626    fn into_inner(
2627        self,
2628    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2629    {
2630        (self.inner, self.is_terminated)
2631    }
2632
2633    fn from_inner(
2634        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2635        is_terminated: bool,
2636    ) -> Self {
2637        Self { inner, is_terminated }
2638    }
2639}
2640
2641impl futures::Stream for FeatureConnectorRequestStream {
2642    type Item = Result<FeatureConnectorRequest, fidl::Error>;
2643
2644    fn poll_next(
2645        mut self: std::pin::Pin<&mut Self>,
2646        cx: &mut std::task::Context<'_>,
2647    ) -> std::task::Poll<Option<Self::Item>> {
2648        let this = &mut *self;
2649        if this.inner.check_shutdown(cx) {
2650            this.is_terminated = true;
2651            return std::task::Poll::Ready(None);
2652        }
2653        if this.is_terminated {
2654            panic!("polled FeatureConnectorRequestStream after completion");
2655        }
2656        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2657            |bytes, handles| {
2658                match this.inner.channel().read_etc(cx, bytes, handles) {
2659                    std::task::Poll::Ready(Ok(())) => {}
2660                    std::task::Poll::Pending => return std::task::Poll::Pending,
2661                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2662                        this.is_terminated = true;
2663                        return std::task::Poll::Ready(None);
2664                    }
2665                    std::task::Poll::Ready(Err(e)) => {
2666                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2667                            e.into(),
2668                        ))))
2669                    }
2670                }
2671
2672                // A message has been received from the channel
2673                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2674
2675                std::task::Poll::Ready(Some(match header.ordinal {
2676                    0x470f006d630987a5 => {
2677                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2678                        let mut req = fidl::new_empty!(
2679                            FeatureConnectorConnectRequest,
2680                            fidl::encoding::DefaultFuchsiaResourceDialect
2681                        );
2682                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FeatureConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2683                        let control_handle =
2684                            FeatureConnectorControlHandle { inner: this.inner.clone() };
2685                        Ok(FeatureConnectorRequest::Connect {
2686                            name: req.name,
2687                            server_end: req.server_end,
2688
2689                            control_handle,
2690                        })
2691                    }
2692                    _ => Err(fidl::Error::UnknownOrdinal {
2693                        ordinal: header.ordinal,
2694                        protocol_name:
2695                            <FeatureConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2696                    }),
2697                }))
2698            },
2699        )
2700    }
2701}
2702
2703/// Protocol for connecting to [`Feature`] on a LoWPAN device.
2704#[derive(Debug)]
2705pub enum FeatureConnectorRequest {
2706    /// Connects to the [`Feature`] protocol on the
2707    /// named LoWPAN device.
2708    ///
2709    /// The name of the interface can be learned by calling
2710    /// [`fuchsia.lowpan/Lookup.GetDevices`].
2711    ///
2712    /// If there is an error in processing this request
2713    /// the given channel is closed and an epitaph code used
2714    /// to describe the reason for the failure:
2715    ///
2716    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
2717    ///   was not formatted correctly or otherwise invalid.
2718    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
2719    ///   given name.
2720    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
2721    ///   does not support this protocol.
2722    Connect {
2723        name: String,
2724        server_end: fidl::endpoints::ServerEnd<FeatureMarker>,
2725        control_handle: FeatureConnectorControlHandle,
2726    },
2727}
2728
2729impl FeatureConnectorRequest {
2730    #[allow(irrefutable_let_patterns)]
2731    pub fn into_connect(
2732        self,
2733    ) -> Option<(String, fidl::endpoints::ServerEnd<FeatureMarker>, FeatureConnectorControlHandle)>
2734    {
2735        if let FeatureConnectorRequest::Connect { name, server_end, control_handle } = self {
2736            Some((name, server_end, control_handle))
2737        } else {
2738            None
2739        }
2740    }
2741
2742    /// Name of the method defined in FIDL
2743    pub fn method_name(&self) -> &'static str {
2744        match *self {
2745            FeatureConnectorRequest::Connect { .. } => "connect",
2746        }
2747    }
2748}
2749
2750#[derive(Debug, Clone)]
2751pub struct FeatureConnectorControlHandle {
2752    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2753}
2754
2755impl fidl::endpoints::ControlHandle for FeatureConnectorControlHandle {
2756    fn shutdown(&self) {
2757        self.inner.shutdown()
2758    }
2759    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2760        self.inner.shutdown_with_epitaph(status)
2761    }
2762
2763    fn is_closed(&self) -> bool {
2764        self.inner.channel().is_closed()
2765    }
2766    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2767        self.inner.channel().on_closed()
2768    }
2769
2770    #[cfg(target_os = "fuchsia")]
2771    fn signal_peer(
2772        &self,
2773        clear_mask: zx::Signals,
2774        set_mask: zx::Signals,
2775    ) -> Result<(), zx_status::Status> {
2776        use fidl::Peered;
2777        self.inner.channel().signal_peer(clear_mask, set_mask)
2778    }
2779}
2780
2781impl FeatureConnectorControlHandle {}
2782
2783#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2784pub struct MeshcopMarker;
2785
2786impl fidl::endpoints::ProtocolMarker for MeshcopMarker {
2787    type Proxy = MeshcopProxy;
2788    type RequestStream = MeshcopRequestStream;
2789    #[cfg(target_os = "fuchsia")]
2790    type SynchronousProxy = MeshcopSynchronousProxy;
2791
2792    const DEBUG_NAME: &'static str = "(anonymous) Meshcop";
2793}
2794
2795pub trait MeshcopProxyInterface: Send + Sync {
2796    type UpdateTxtEntriesResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
2797    fn r#update_txt_entries(&self, txt_entries: &[TxtEntries])
2798        -> Self::UpdateTxtEntriesResponseFut;
2799}
2800#[derive(Debug)]
2801#[cfg(target_os = "fuchsia")]
2802pub struct MeshcopSynchronousProxy {
2803    client: fidl::client::sync::Client,
2804}
2805
2806#[cfg(target_os = "fuchsia")]
2807impl fidl::endpoints::SynchronousProxy for MeshcopSynchronousProxy {
2808    type Proxy = MeshcopProxy;
2809    type Protocol = MeshcopMarker;
2810
2811    fn from_channel(inner: fidl::Channel) -> Self {
2812        Self::new(inner)
2813    }
2814
2815    fn into_channel(self) -> fidl::Channel {
2816        self.client.into_channel()
2817    }
2818
2819    fn as_channel(&self) -> &fidl::Channel {
2820        self.client.as_channel()
2821    }
2822}
2823
2824#[cfg(target_os = "fuchsia")]
2825impl MeshcopSynchronousProxy {
2826    pub fn new(channel: fidl::Channel) -> Self {
2827        let protocol_name = <MeshcopMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2828        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2829    }
2830
2831    pub fn into_channel(self) -> fidl::Channel {
2832        self.client.into_channel()
2833    }
2834
2835    /// Waits until an event arrives and returns it. It is safe for other
2836    /// threads to make concurrent requests while waiting for an event.
2837    pub fn wait_for_event(
2838        &self,
2839        deadline: zx::MonotonicInstant,
2840    ) -> Result<MeshcopEvent, fidl::Error> {
2841        MeshcopEvent::decode(self.client.wait_for_event(deadline)?)
2842    }
2843
2844    /// Updates the TXT record information associated with the Meshcop border
2845    /// agent DNS-SD entry. This allows additional information about the
2846    /// device to be discoverable on the local network when acting as a
2847    /// border agent.
2848    ///
2849    /// Functionally equivalent to `ot-br-posix`'s
2850    /// [`UpdateVendorMeshCopTxtEntries`][1].
2851    ///
2852    /// Typically, the following keys are updated:
2853    ///
2854    /// * `vn`: Vendor Name
2855    /// * `mn`: Model Name
2856    /// * `vo`: Vendor OUI
2857    /// * `vd`/`vcd`: Vendor-specific Data
2858    ///
2859    /// See table 8-4 in section 8.4.1.1.2 of the Thread 1.2 specification for
2860    /// a detailed explanation of all the keys and their values.
2861    ///
2862    /// Any error that prevents the operation from completing successfully
2863    /// (such as being provided with invalid keys) will result in the
2864    /// protocol being closed.
2865    ///
2866    /// [1]: https://github.com/openthread/ot-br-posix/blob/0b5c6e1ecb8152ef6cea57c09b8a37a020fc4d6f/src/dbus/server/introspect.xml#L196-L210
2867    pub fn r#update_txt_entries(
2868        &self,
2869        mut txt_entries: &[TxtEntries],
2870        ___deadline: zx::MonotonicInstant,
2871    ) -> Result<(), fidl::Error> {
2872        let _response = self
2873            .client
2874            .send_query::<MeshcopUpdateTxtEntriesRequest, fidl::encoding::EmptyPayload>(
2875                (txt_entries,),
2876                0x358d4d9593140bed,
2877                fidl::encoding::DynamicFlags::empty(),
2878                ___deadline,
2879            )?;
2880        Ok(_response)
2881    }
2882}
2883
2884#[cfg(target_os = "fuchsia")]
2885impl From<MeshcopSynchronousProxy> for zx::Handle {
2886    fn from(value: MeshcopSynchronousProxy) -> Self {
2887        value.into_channel().into()
2888    }
2889}
2890
2891#[cfg(target_os = "fuchsia")]
2892impl From<fidl::Channel> for MeshcopSynchronousProxy {
2893    fn from(value: fidl::Channel) -> Self {
2894        Self::new(value)
2895    }
2896}
2897
2898#[cfg(target_os = "fuchsia")]
2899impl fidl::endpoints::FromClient for MeshcopSynchronousProxy {
2900    type Protocol = MeshcopMarker;
2901
2902    fn from_client(value: fidl::endpoints::ClientEnd<MeshcopMarker>) -> Self {
2903        Self::new(value.into_channel())
2904    }
2905}
2906
2907#[derive(Debug, Clone)]
2908pub struct MeshcopProxy {
2909    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2910}
2911
2912impl fidl::endpoints::Proxy for MeshcopProxy {
2913    type Protocol = MeshcopMarker;
2914
2915    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2916        Self::new(inner)
2917    }
2918
2919    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2920        self.client.into_channel().map_err(|client| Self { client })
2921    }
2922
2923    fn as_channel(&self) -> &::fidl::AsyncChannel {
2924        self.client.as_channel()
2925    }
2926}
2927
2928impl MeshcopProxy {
2929    /// Create a new Proxy for fuchsia.lowpan.thread/Meshcop.
2930    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2931        let protocol_name = <MeshcopMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2932        Self { client: fidl::client::Client::new(channel, protocol_name) }
2933    }
2934
2935    /// Get a Stream of events from the remote end of the protocol.
2936    ///
2937    /// # Panics
2938    ///
2939    /// Panics if the event stream was already taken.
2940    pub fn take_event_stream(&self) -> MeshcopEventStream {
2941        MeshcopEventStream { event_receiver: self.client.take_event_receiver() }
2942    }
2943
2944    /// Updates the TXT record information associated with the Meshcop border
2945    /// agent DNS-SD entry. This allows additional information about the
2946    /// device to be discoverable on the local network when acting as a
2947    /// border agent.
2948    ///
2949    /// Functionally equivalent to `ot-br-posix`'s
2950    /// [`UpdateVendorMeshCopTxtEntries`][1].
2951    ///
2952    /// Typically, the following keys are updated:
2953    ///
2954    /// * `vn`: Vendor Name
2955    /// * `mn`: Model Name
2956    /// * `vo`: Vendor OUI
2957    /// * `vd`/`vcd`: Vendor-specific Data
2958    ///
2959    /// See table 8-4 in section 8.4.1.1.2 of the Thread 1.2 specification for
2960    /// a detailed explanation of all the keys and their values.
2961    ///
2962    /// Any error that prevents the operation from completing successfully
2963    /// (such as being provided with invalid keys) will result in the
2964    /// protocol being closed.
2965    ///
2966    /// [1]: https://github.com/openthread/ot-br-posix/blob/0b5c6e1ecb8152ef6cea57c09b8a37a020fc4d6f/src/dbus/server/introspect.xml#L196-L210
2967    pub fn r#update_txt_entries(
2968        &self,
2969        mut txt_entries: &[TxtEntries],
2970    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
2971        MeshcopProxyInterface::r#update_txt_entries(self, txt_entries)
2972    }
2973}
2974
2975impl MeshcopProxyInterface for MeshcopProxy {
2976    type UpdateTxtEntriesResponseFut =
2977        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
2978    fn r#update_txt_entries(
2979        &self,
2980        mut txt_entries: &[TxtEntries],
2981    ) -> Self::UpdateTxtEntriesResponseFut {
2982        fn _decode(
2983            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2984        ) -> Result<(), fidl::Error> {
2985            let _response = fidl::client::decode_transaction_body::<
2986                fidl::encoding::EmptyPayload,
2987                fidl::encoding::DefaultFuchsiaResourceDialect,
2988                0x358d4d9593140bed,
2989            >(_buf?)?;
2990            Ok(_response)
2991        }
2992        self.client.send_query_and_decode::<MeshcopUpdateTxtEntriesRequest, ()>(
2993            (txt_entries,),
2994            0x358d4d9593140bed,
2995            fidl::encoding::DynamicFlags::empty(),
2996            _decode,
2997        )
2998    }
2999}
3000
3001pub struct MeshcopEventStream {
3002    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3003}
3004
3005impl std::marker::Unpin for MeshcopEventStream {}
3006
3007impl futures::stream::FusedStream for MeshcopEventStream {
3008    fn is_terminated(&self) -> bool {
3009        self.event_receiver.is_terminated()
3010    }
3011}
3012
3013impl futures::Stream for MeshcopEventStream {
3014    type Item = Result<MeshcopEvent, fidl::Error>;
3015
3016    fn poll_next(
3017        mut self: std::pin::Pin<&mut Self>,
3018        cx: &mut std::task::Context<'_>,
3019    ) -> std::task::Poll<Option<Self::Item>> {
3020        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3021            &mut self.event_receiver,
3022            cx
3023        )?) {
3024            Some(buf) => std::task::Poll::Ready(Some(MeshcopEvent::decode(buf))),
3025            None => std::task::Poll::Ready(None),
3026        }
3027    }
3028}
3029
3030#[derive(Debug)]
3031pub enum MeshcopEvent {}
3032
3033impl MeshcopEvent {
3034    /// Decodes a message buffer as a [`MeshcopEvent`].
3035    fn decode(
3036        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3037    ) -> Result<MeshcopEvent, fidl::Error> {
3038        let (bytes, _handles) = buf.split_mut();
3039        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3040        debug_assert_eq!(tx_header.tx_id, 0);
3041        match tx_header.ordinal {
3042            _ => Err(fidl::Error::UnknownOrdinal {
3043                ordinal: tx_header.ordinal,
3044                protocol_name: <MeshcopMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3045            }),
3046        }
3047    }
3048}
3049
3050/// A Stream of incoming requests for fuchsia.lowpan.thread/Meshcop.
3051pub struct MeshcopRequestStream {
3052    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3053    is_terminated: bool,
3054}
3055
3056impl std::marker::Unpin for MeshcopRequestStream {}
3057
3058impl futures::stream::FusedStream for MeshcopRequestStream {
3059    fn is_terminated(&self) -> bool {
3060        self.is_terminated
3061    }
3062}
3063
3064impl fidl::endpoints::RequestStream for MeshcopRequestStream {
3065    type Protocol = MeshcopMarker;
3066    type ControlHandle = MeshcopControlHandle;
3067
3068    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3069        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3070    }
3071
3072    fn control_handle(&self) -> Self::ControlHandle {
3073        MeshcopControlHandle { inner: self.inner.clone() }
3074    }
3075
3076    fn into_inner(
3077        self,
3078    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3079    {
3080        (self.inner, self.is_terminated)
3081    }
3082
3083    fn from_inner(
3084        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3085        is_terminated: bool,
3086    ) -> Self {
3087        Self { inner, is_terminated }
3088    }
3089}
3090
3091impl futures::Stream for MeshcopRequestStream {
3092    type Item = Result<MeshcopRequest, fidl::Error>;
3093
3094    fn poll_next(
3095        mut self: std::pin::Pin<&mut Self>,
3096        cx: &mut std::task::Context<'_>,
3097    ) -> std::task::Poll<Option<Self::Item>> {
3098        let this = &mut *self;
3099        if this.inner.check_shutdown(cx) {
3100            this.is_terminated = true;
3101            return std::task::Poll::Ready(None);
3102        }
3103        if this.is_terminated {
3104            panic!("polled MeshcopRequestStream after completion");
3105        }
3106        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3107            |bytes, handles| {
3108                match this.inner.channel().read_etc(cx, bytes, handles) {
3109                    std::task::Poll::Ready(Ok(())) => {}
3110                    std::task::Poll::Pending => return std::task::Poll::Pending,
3111                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3112                        this.is_terminated = true;
3113                        return std::task::Poll::Ready(None);
3114                    }
3115                    std::task::Poll::Ready(Err(e)) => {
3116                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3117                            e.into(),
3118                        ))))
3119                    }
3120                }
3121
3122                // A message has been received from the channel
3123                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3124
3125                std::task::Poll::Ready(Some(match header.ordinal {
3126                    0x358d4d9593140bed => {
3127                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3128                        let mut req = fidl::new_empty!(
3129                            MeshcopUpdateTxtEntriesRequest,
3130                            fidl::encoding::DefaultFuchsiaResourceDialect
3131                        );
3132                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MeshcopUpdateTxtEntriesRequest>(&header, _body_bytes, handles, &mut req)?;
3133                        let control_handle = MeshcopControlHandle { inner: this.inner.clone() };
3134                        Ok(MeshcopRequest::UpdateTxtEntries {
3135                            txt_entries: req.txt_entries,
3136
3137                            responder: MeshcopUpdateTxtEntriesResponder {
3138                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3139                                tx_id: header.tx_id,
3140                            },
3141                        })
3142                    }
3143                    _ => Err(fidl::Error::UnknownOrdinal {
3144                        ordinal: header.ordinal,
3145                        protocol_name:
3146                            <MeshcopMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3147                    }),
3148                }))
3149            },
3150        )
3151    }
3152}
3153
3154/// Methods associated with the Mesh Commissioning Protocol (Meshcop).
3155#[derive(Debug)]
3156pub enum MeshcopRequest {
3157    /// Updates the TXT record information associated with the Meshcop border
3158    /// agent DNS-SD entry. This allows additional information about the
3159    /// device to be discoverable on the local network when acting as a
3160    /// border agent.
3161    ///
3162    /// Functionally equivalent to `ot-br-posix`'s
3163    /// [`UpdateVendorMeshCopTxtEntries`][1].
3164    ///
3165    /// Typically, the following keys are updated:
3166    ///
3167    /// * `vn`: Vendor Name
3168    /// * `mn`: Model Name
3169    /// * `vo`: Vendor OUI
3170    /// * `vd`/`vcd`: Vendor-specific Data
3171    ///
3172    /// See table 8-4 in section 8.4.1.1.2 of the Thread 1.2 specification for
3173    /// a detailed explanation of all the keys and their values.
3174    ///
3175    /// Any error that prevents the operation from completing successfully
3176    /// (such as being provided with invalid keys) will result in the
3177    /// protocol being closed.
3178    ///
3179    /// [1]: https://github.com/openthread/ot-br-posix/blob/0b5c6e1ecb8152ef6cea57c09b8a37a020fc4d6f/src/dbus/server/introspect.xml#L196-L210
3180    UpdateTxtEntries { txt_entries: Vec<TxtEntries>, responder: MeshcopUpdateTxtEntriesResponder },
3181}
3182
3183impl MeshcopRequest {
3184    #[allow(irrefutable_let_patterns)]
3185    pub fn into_update_txt_entries(
3186        self,
3187    ) -> Option<(Vec<TxtEntries>, MeshcopUpdateTxtEntriesResponder)> {
3188        if let MeshcopRequest::UpdateTxtEntries { txt_entries, responder } = self {
3189            Some((txt_entries, responder))
3190        } else {
3191            None
3192        }
3193    }
3194
3195    /// Name of the method defined in FIDL
3196    pub fn method_name(&self) -> &'static str {
3197        match *self {
3198            MeshcopRequest::UpdateTxtEntries { .. } => "update_txt_entries",
3199        }
3200    }
3201}
3202
3203#[derive(Debug, Clone)]
3204pub struct MeshcopControlHandle {
3205    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3206}
3207
3208impl fidl::endpoints::ControlHandle for MeshcopControlHandle {
3209    fn shutdown(&self) {
3210        self.inner.shutdown()
3211    }
3212    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3213        self.inner.shutdown_with_epitaph(status)
3214    }
3215
3216    fn is_closed(&self) -> bool {
3217        self.inner.channel().is_closed()
3218    }
3219    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3220        self.inner.channel().on_closed()
3221    }
3222
3223    #[cfg(target_os = "fuchsia")]
3224    fn signal_peer(
3225        &self,
3226        clear_mask: zx::Signals,
3227        set_mask: zx::Signals,
3228    ) -> Result<(), zx_status::Status> {
3229        use fidl::Peered;
3230        self.inner.channel().signal_peer(clear_mask, set_mask)
3231    }
3232}
3233
3234impl MeshcopControlHandle {}
3235
3236#[must_use = "FIDL methods require a response to be sent"]
3237#[derive(Debug)]
3238pub struct MeshcopUpdateTxtEntriesResponder {
3239    control_handle: std::mem::ManuallyDrop<MeshcopControlHandle>,
3240    tx_id: u32,
3241}
3242
3243/// Set the the channel to be shutdown (see [`MeshcopControlHandle::shutdown`])
3244/// if the responder is dropped without sending a response, so that the client
3245/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3246impl std::ops::Drop for MeshcopUpdateTxtEntriesResponder {
3247    fn drop(&mut self) {
3248        self.control_handle.shutdown();
3249        // Safety: drops once, never accessed again
3250        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3251    }
3252}
3253
3254impl fidl::endpoints::Responder for MeshcopUpdateTxtEntriesResponder {
3255    type ControlHandle = MeshcopControlHandle;
3256
3257    fn control_handle(&self) -> &MeshcopControlHandle {
3258        &self.control_handle
3259    }
3260
3261    fn drop_without_shutdown(mut self) {
3262        // Safety: drops once, never accessed again due to mem::forget
3263        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3264        // Prevent Drop from running (which would shut down the channel)
3265        std::mem::forget(self);
3266    }
3267}
3268
3269impl MeshcopUpdateTxtEntriesResponder {
3270    /// Sends a response to the FIDL transaction.
3271    ///
3272    /// Sets the channel to shutdown if an error occurs.
3273    pub fn send(self) -> Result<(), fidl::Error> {
3274        let _result = self.send_raw();
3275        if _result.is_err() {
3276            self.control_handle.shutdown();
3277        }
3278        self.drop_without_shutdown();
3279        _result
3280    }
3281
3282    /// Similar to "send" but does not shutdown the channel if an error occurs.
3283    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
3284        let _result = self.send_raw();
3285        self.drop_without_shutdown();
3286        _result
3287    }
3288
3289    fn send_raw(&self) -> Result<(), fidl::Error> {
3290        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
3291            (),
3292            self.tx_id,
3293            0x358d4d9593140bed,
3294            fidl::encoding::DynamicFlags::empty(),
3295        )
3296    }
3297}
3298
3299#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3300pub struct MeshcopConnectorMarker;
3301
3302impl fidl::endpoints::ProtocolMarker for MeshcopConnectorMarker {
3303    type Proxy = MeshcopConnectorProxy;
3304    type RequestStream = MeshcopConnectorRequestStream;
3305    #[cfg(target_os = "fuchsia")]
3306    type SynchronousProxy = MeshcopConnectorSynchronousProxy;
3307
3308    const DEBUG_NAME: &'static str = "fuchsia.lowpan.thread.MeshcopConnector";
3309}
3310impl fidl::endpoints::DiscoverableProtocolMarker for MeshcopConnectorMarker {}
3311
3312pub trait MeshcopConnectorProxyInterface: Send + Sync {
3313    fn r#connect(
3314        &self,
3315        name: &str,
3316        server_end: fidl::endpoints::ServerEnd<MeshcopMarker>,
3317    ) -> Result<(), fidl::Error>;
3318}
3319#[derive(Debug)]
3320#[cfg(target_os = "fuchsia")]
3321pub struct MeshcopConnectorSynchronousProxy {
3322    client: fidl::client::sync::Client,
3323}
3324
3325#[cfg(target_os = "fuchsia")]
3326impl fidl::endpoints::SynchronousProxy for MeshcopConnectorSynchronousProxy {
3327    type Proxy = MeshcopConnectorProxy;
3328    type Protocol = MeshcopConnectorMarker;
3329
3330    fn from_channel(inner: fidl::Channel) -> Self {
3331        Self::new(inner)
3332    }
3333
3334    fn into_channel(self) -> fidl::Channel {
3335        self.client.into_channel()
3336    }
3337
3338    fn as_channel(&self) -> &fidl::Channel {
3339        self.client.as_channel()
3340    }
3341}
3342
3343#[cfg(target_os = "fuchsia")]
3344impl MeshcopConnectorSynchronousProxy {
3345    pub fn new(channel: fidl::Channel) -> Self {
3346        let protocol_name = <MeshcopConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3347        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3348    }
3349
3350    pub fn into_channel(self) -> fidl::Channel {
3351        self.client.into_channel()
3352    }
3353
3354    /// Waits until an event arrives and returns it. It is safe for other
3355    /// threads to make concurrent requests while waiting for an event.
3356    pub fn wait_for_event(
3357        &self,
3358        deadline: zx::MonotonicInstant,
3359    ) -> Result<MeshcopConnectorEvent, fidl::Error> {
3360        MeshcopConnectorEvent::decode(self.client.wait_for_event(deadline)?)
3361    }
3362
3363    /// Connects to the [`Meshcop`] protocol on the
3364    /// named LoWPAN interface.
3365    ///
3366    /// The name of the interface can be learned by calling
3367    /// [`fuchsia.lowpan/Lookup.GetDevices`].
3368    ///
3369    /// If there is an error in processing this request
3370    /// the given channel is closed and an epitaph code used
3371    /// to describe the reason for the failure:
3372    ///
3373    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
3374    ///   was not formatted correctly or otherwise invalid.
3375    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
3376    ///   given name.
3377    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
3378    ///   does not support this protocol.
3379    pub fn r#connect(
3380        &self,
3381        mut name: &str,
3382        mut server_end: fidl::endpoints::ServerEnd<MeshcopMarker>,
3383    ) -> Result<(), fidl::Error> {
3384        self.client.send::<MeshcopConnectorConnectRequest>(
3385            (name, server_end),
3386            0x53f87536b40ad6fb,
3387            fidl::encoding::DynamicFlags::empty(),
3388        )
3389    }
3390}
3391
3392#[cfg(target_os = "fuchsia")]
3393impl From<MeshcopConnectorSynchronousProxy> for zx::Handle {
3394    fn from(value: MeshcopConnectorSynchronousProxy) -> Self {
3395        value.into_channel().into()
3396    }
3397}
3398
3399#[cfg(target_os = "fuchsia")]
3400impl From<fidl::Channel> for MeshcopConnectorSynchronousProxy {
3401    fn from(value: fidl::Channel) -> Self {
3402        Self::new(value)
3403    }
3404}
3405
3406#[cfg(target_os = "fuchsia")]
3407impl fidl::endpoints::FromClient for MeshcopConnectorSynchronousProxy {
3408    type Protocol = MeshcopConnectorMarker;
3409
3410    fn from_client(value: fidl::endpoints::ClientEnd<MeshcopConnectorMarker>) -> Self {
3411        Self::new(value.into_channel())
3412    }
3413}
3414
3415#[derive(Debug, Clone)]
3416pub struct MeshcopConnectorProxy {
3417    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3418}
3419
3420impl fidl::endpoints::Proxy for MeshcopConnectorProxy {
3421    type Protocol = MeshcopConnectorMarker;
3422
3423    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3424        Self::new(inner)
3425    }
3426
3427    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3428        self.client.into_channel().map_err(|client| Self { client })
3429    }
3430
3431    fn as_channel(&self) -> &::fidl::AsyncChannel {
3432        self.client.as_channel()
3433    }
3434}
3435
3436impl MeshcopConnectorProxy {
3437    /// Create a new Proxy for fuchsia.lowpan.thread/MeshcopConnector.
3438    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3439        let protocol_name = <MeshcopConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3440        Self { client: fidl::client::Client::new(channel, protocol_name) }
3441    }
3442
3443    /// Get a Stream of events from the remote end of the protocol.
3444    ///
3445    /// # Panics
3446    ///
3447    /// Panics if the event stream was already taken.
3448    pub fn take_event_stream(&self) -> MeshcopConnectorEventStream {
3449        MeshcopConnectorEventStream { event_receiver: self.client.take_event_receiver() }
3450    }
3451
3452    /// Connects to the [`Meshcop`] protocol on the
3453    /// named LoWPAN interface.
3454    ///
3455    /// The name of the interface can be learned by calling
3456    /// [`fuchsia.lowpan/Lookup.GetDevices`].
3457    ///
3458    /// If there is an error in processing this request
3459    /// the given channel is closed and an epitaph code used
3460    /// to describe the reason for the failure:
3461    ///
3462    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
3463    ///   was not formatted correctly or otherwise invalid.
3464    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
3465    ///   given name.
3466    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
3467    ///   does not support this protocol.
3468    pub fn r#connect(
3469        &self,
3470        mut name: &str,
3471        mut server_end: fidl::endpoints::ServerEnd<MeshcopMarker>,
3472    ) -> Result<(), fidl::Error> {
3473        MeshcopConnectorProxyInterface::r#connect(self, name, server_end)
3474    }
3475}
3476
3477impl MeshcopConnectorProxyInterface for MeshcopConnectorProxy {
3478    fn r#connect(
3479        &self,
3480        mut name: &str,
3481        mut server_end: fidl::endpoints::ServerEnd<MeshcopMarker>,
3482    ) -> Result<(), fidl::Error> {
3483        self.client.send::<MeshcopConnectorConnectRequest>(
3484            (name, server_end),
3485            0x53f87536b40ad6fb,
3486            fidl::encoding::DynamicFlags::empty(),
3487        )
3488    }
3489}
3490
3491pub struct MeshcopConnectorEventStream {
3492    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3493}
3494
3495impl std::marker::Unpin for MeshcopConnectorEventStream {}
3496
3497impl futures::stream::FusedStream for MeshcopConnectorEventStream {
3498    fn is_terminated(&self) -> bool {
3499        self.event_receiver.is_terminated()
3500    }
3501}
3502
3503impl futures::Stream for MeshcopConnectorEventStream {
3504    type Item = Result<MeshcopConnectorEvent, fidl::Error>;
3505
3506    fn poll_next(
3507        mut self: std::pin::Pin<&mut Self>,
3508        cx: &mut std::task::Context<'_>,
3509    ) -> std::task::Poll<Option<Self::Item>> {
3510        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3511            &mut self.event_receiver,
3512            cx
3513        )?) {
3514            Some(buf) => std::task::Poll::Ready(Some(MeshcopConnectorEvent::decode(buf))),
3515            None => std::task::Poll::Ready(None),
3516        }
3517    }
3518}
3519
3520#[derive(Debug)]
3521pub enum MeshcopConnectorEvent {}
3522
3523impl MeshcopConnectorEvent {
3524    /// Decodes a message buffer as a [`MeshcopConnectorEvent`].
3525    fn decode(
3526        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3527    ) -> Result<MeshcopConnectorEvent, fidl::Error> {
3528        let (bytes, _handles) = buf.split_mut();
3529        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3530        debug_assert_eq!(tx_header.tx_id, 0);
3531        match tx_header.ordinal {
3532            _ => Err(fidl::Error::UnknownOrdinal {
3533                ordinal: tx_header.ordinal,
3534                protocol_name:
3535                    <MeshcopConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3536            }),
3537        }
3538    }
3539}
3540
3541/// A Stream of incoming requests for fuchsia.lowpan.thread/MeshcopConnector.
3542pub struct MeshcopConnectorRequestStream {
3543    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3544    is_terminated: bool,
3545}
3546
3547impl std::marker::Unpin for MeshcopConnectorRequestStream {}
3548
3549impl futures::stream::FusedStream for MeshcopConnectorRequestStream {
3550    fn is_terminated(&self) -> bool {
3551        self.is_terminated
3552    }
3553}
3554
3555impl fidl::endpoints::RequestStream for MeshcopConnectorRequestStream {
3556    type Protocol = MeshcopConnectorMarker;
3557    type ControlHandle = MeshcopConnectorControlHandle;
3558
3559    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3560        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3561    }
3562
3563    fn control_handle(&self) -> Self::ControlHandle {
3564        MeshcopConnectorControlHandle { inner: self.inner.clone() }
3565    }
3566
3567    fn into_inner(
3568        self,
3569    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3570    {
3571        (self.inner, self.is_terminated)
3572    }
3573
3574    fn from_inner(
3575        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3576        is_terminated: bool,
3577    ) -> Self {
3578        Self { inner, is_terminated }
3579    }
3580}
3581
3582impl futures::Stream for MeshcopConnectorRequestStream {
3583    type Item = Result<MeshcopConnectorRequest, fidl::Error>;
3584
3585    fn poll_next(
3586        mut self: std::pin::Pin<&mut Self>,
3587        cx: &mut std::task::Context<'_>,
3588    ) -> std::task::Poll<Option<Self::Item>> {
3589        let this = &mut *self;
3590        if this.inner.check_shutdown(cx) {
3591            this.is_terminated = true;
3592            return std::task::Poll::Ready(None);
3593        }
3594        if this.is_terminated {
3595            panic!("polled MeshcopConnectorRequestStream after completion");
3596        }
3597        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3598            |bytes, handles| {
3599                match this.inner.channel().read_etc(cx, bytes, handles) {
3600                    std::task::Poll::Ready(Ok(())) => {}
3601                    std::task::Poll::Pending => return std::task::Poll::Pending,
3602                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3603                        this.is_terminated = true;
3604                        return std::task::Poll::Ready(None);
3605                    }
3606                    std::task::Poll::Ready(Err(e)) => {
3607                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3608                            e.into(),
3609                        ))))
3610                    }
3611                }
3612
3613                // A message has been received from the channel
3614                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3615
3616                std::task::Poll::Ready(Some(match header.ordinal {
3617                    0x53f87536b40ad6fb => {
3618                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3619                        let mut req = fidl::new_empty!(
3620                            MeshcopConnectorConnectRequest,
3621                            fidl::encoding::DefaultFuchsiaResourceDialect
3622                        );
3623                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<MeshcopConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
3624                        let control_handle =
3625                            MeshcopConnectorControlHandle { inner: this.inner.clone() };
3626                        Ok(MeshcopConnectorRequest::Connect {
3627                            name: req.name,
3628                            server_end: req.server_end,
3629
3630                            control_handle,
3631                        })
3632                    }
3633                    _ => Err(fidl::Error::UnknownOrdinal {
3634                        ordinal: header.ordinal,
3635                        protocol_name:
3636                            <MeshcopConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3637                    }),
3638                }))
3639            },
3640        )
3641    }
3642}
3643
3644/// Protocol for connecting to [`Meshcop`] on a LoWPAN device.
3645#[derive(Debug)]
3646pub enum MeshcopConnectorRequest {
3647    /// Connects to the [`Meshcop`] protocol on the
3648    /// named LoWPAN interface.
3649    ///
3650    /// The name of the interface can be learned by calling
3651    /// [`fuchsia.lowpan/Lookup.GetDevices`].
3652    ///
3653    /// If there is an error in processing this request
3654    /// the given channel is closed and an epitaph code used
3655    /// to describe the reason for the failure:
3656    ///
3657    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
3658    ///   was not formatted correctly or otherwise invalid.
3659    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
3660    ///   given name.
3661    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
3662    ///   does not support this protocol.
3663    Connect {
3664        name: String,
3665        server_end: fidl::endpoints::ServerEnd<MeshcopMarker>,
3666        control_handle: MeshcopConnectorControlHandle,
3667    },
3668}
3669
3670impl MeshcopConnectorRequest {
3671    #[allow(irrefutable_let_patterns)]
3672    pub fn into_connect(
3673        self,
3674    ) -> Option<(String, fidl::endpoints::ServerEnd<MeshcopMarker>, MeshcopConnectorControlHandle)>
3675    {
3676        if let MeshcopConnectorRequest::Connect { name, server_end, control_handle } = self {
3677            Some((name, server_end, control_handle))
3678        } else {
3679            None
3680        }
3681    }
3682
3683    /// Name of the method defined in FIDL
3684    pub fn method_name(&self) -> &'static str {
3685        match *self {
3686            MeshcopConnectorRequest::Connect { .. } => "connect",
3687        }
3688    }
3689}
3690
3691#[derive(Debug, Clone)]
3692pub struct MeshcopConnectorControlHandle {
3693    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3694}
3695
3696impl fidl::endpoints::ControlHandle for MeshcopConnectorControlHandle {
3697    fn shutdown(&self) {
3698        self.inner.shutdown()
3699    }
3700    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3701        self.inner.shutdown_with_epitaph(status)
3702    }
3703
3704    fn is_closed(&self) -> bool {
3705        self.inner.channel().is_closed()
3706    }
3707    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3708        self.inner.channel().on_closed()
3709    }
3710
3711    #[cfg(target_os = "fuchsia")]
3712    fn signal_peer(
3713        &self,
3714        clear_mask: zx::Signals,
3715        set_mask: zx::Signals,
3716    ) -> Result<(), zx_status::Status> {
3717        use fidl::Peered;
3718        self.inner.channel().signal_peer(clear_mask, set_mask)
3719    }
3720}
3721
3722impl MeshcopConnectorControlHandle {}
3723
3724#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3725pub struct ThreadCapabilitiesMarker;
3726
3727impl fidl::endpoints::ProtocolMarker for ThreadCapabilitiesMarker {
3728    type Proxy = ThreadCapabilitiesProxy;
3729    type RequestStream = ThreadCapabilitiesRequestStream;
3730    #[cfg(target_os = "fuchsia")]
3731    type SynchronousProxy = ThreadCapabilitiesSynchronousProxy;
3732
3733    const DEBUG_NAME: &'static str = "(anonymous) ThreadCapabilities";
3734}
3735
3736pub trait ThreadCapabilitiesProxyInterface: Send + Sync {
3737    type GetCapabilitiesResponseFut: std::future::Future<Output = Result<Capabilities, fidl::Error>>
3738        + Send;
3739    fn r#get_capabilities(&self) -> Self::GetCapabilitiesResponseFut;
3740}
3741#[derive(Debug)]
3742#[cfg(target_os = "fuchsia")]
3743pub struct ThreadCapabilitiesSynchronousProxy {
3744    client: fidl::client::sync::Client,
3745}
3746
3747#[cfg(target_os = "fuchsia")]
3748impl fidl::endpoints::SynchronousProxy for ThreadCapabilitiesSynchronousProxy {
3749    type Proxy = ThreadCapabilitiesProxy;
3750    type Protocol = ThreadCapabilitiesMarker;
3751
3752    fn from_channel(inner: fidl::Channel) -> Self {
3753        Self::new(inner)
3754    }
3755
3756    fn into_channel(self) -> fidl::Channel {
3757        self.client.into_channel()
3758    }
3759
3760    fn as_channel(&self) -> &fidl::Channel {
3761        self.client.as_channel()
3762    }
3763}
3764
3765#[cfg(target_os = "fuchsia")]
3766impl ThreadCapabilitiesSynchronousProxy {
3767    pub fn new(channel: fidl::Channel) -> Self {
3768        let protocol_name =
3769            <ThreadCapabilitiesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3770        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3771    }
3772
3773    pub fn into_channel(self) -> fidl::Channel {
3774        self.client.into_channel()
3775    }
3776
3777    /// Waits until an event arrives and returns it. It is safe for other
3778    /// threads to make concurrent requests while waiting for an event.
3779    pub fn wait_for_event(
3780        &self,
3781        deadline: zx::MonotonicInstant,
3782    ) -> Result<ThreadCapabilitiesEvent, fidl::Error> {
3783        ThreadCapabilitiesEvent::decode(self.client.wait_for_event(deadline)?)
3784    }
3785
3786    /// Returns the current capabilities of Openthread for this interface.
3787    ///
3788    /// capabilities is not expected to change for the lifetime of the
3789    /// interface.
3790    pub fn r#get_capabilities(
3791        &self,
3792        ___deadline: zx::MonotonicInstant,
3793    ) -> Result<Capabilities, fidl::Error> {
3794        let _response = self
3795            .client
3796            .send_query::<fidl::encoding::EmptyPayload, ThreadCapabilitiesGetCapabilitiesResponse>(
3797                (),
3798                0x5a0823ac35f2d425,
3799                fidl::encoding::DynamicFlags::empty(),
3800                ___deadline,
3801            )?;
3802        Ok(_response.capabilities)
3803    }
3804}
3805
3806#[cfg(target_os = "fuchsia")]
3807impl From<ThreadCapabilitiesSynchronousProxy> for zx::Handle {
3808    fn from(value: ThreadCapabilitiesSynchronousProxy) -> Self {
3809        value.into_channel().into()
3810    }
3811}
3812
3813#[cfg(target_os = "fuchsia")]
3814impl From<fidl::Channel> for ThreadCapabilitiesSynchronousProxy {
3815    fn from(value: fidl::Channel) -> Self {
3816        Self::new(value)
3817    }
3818}
3819
3820#[cfg(target_os = "fuchsia")]
3821impl fidl::endpoints::FromClient for ThreadCapabilitiesSynchronousProxy {
3822    type Protocol = ThreadCapabilitiesMarker;
3823
3824    fn from_client(value: fidl::endpoints::ClientEnd<ThreadCapabilitiesMarker>) -> Self {
3825        Self::new(value.into_channel())
3826    }
3827}
3828
3829#[derive(Debug, Clone)]
3830pub struct ThreadCapabilitiesProxy {
3831    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3832}
3833
3834impl fidl::endpoints::Proxy for ThreadCapabilitiesProxy {
3835    type Protocol = ThreadCapabilitiesMarker;
3836
3837    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3838        Self::new(inner)
3839    }
3840
3841    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3842        self.client.into_channel().map_err(|client| Self { client })
3843    }
3844
3845    fn as_channel(&self) -> &::fidl::AsyncChannel {
3846        self.client.as_channel()
3847    }
3848}
3849
3850impl ThreadCapabilitiesProxy {
3851    /// Create a new Proxy for fuchsia.lowpan.thread/ThreadCapabilities.
3852    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3853        let protocol_name =
3854            <ThreadCapabilitiesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3855        Self { client: fidl::client::Client::new(channel, protocol_name) }
3856    }
3857
3858    /// Get a Stream of events from the remote end of the protocol.
3859    ///
3860    /// # Panics
3861    ///
3862    /// Panics if the event stream was already taken.
3863    pub fn take_event_stream(&self) -> ThreadCapabilitiesEventStream {
3864        ThreadCapabilitiesEventStream { event_receiver: self.client.take_event_receiver() }
3865    }
3866
3867    /// Returns the current capabilities of Openthread for this interface.
3868    ///
3869    /// capabilities is not expected to change for the lifetime of the
3870    /// interface.
3871    pub fn r#get_capabilities(
3872        &self,
3873    ) -> fidl::client::QueryResponseFut<Capabilities, fidl::encoding::DefaultFuchsiaResourceDialect>
3874    {
3875        ThreadCapabilitiesProxyInterface::r#get_capabilities(self)
3876    }
3877}
3878
3879impl ThreadCapabilitiesProxyInterface for ThreadCapabilitiesProxy {
3880    type GetCapabilitiesResponseFut =
3881        fidl::client::QueryResponseFut<Capabilities, fidl::encoding::DefaultFuchsiaResourceDialect>;
3882    fn r#get_capabilities(&self) -> Self::GetCapabilitiesResponseFut {
3883        fn _decode(
3884            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3885        ) -> Result<Capabilities, fidl::Error> {
3886            let _response = fidl::client::decode_transaction_body::<
3887                ThreadCapabilitiesGetCapabilitiesResponse,
3888                fidl::encoding::DefaultFuchsiaResourceDialect,
3889                0x5a0823ac35f2d425,
3890            >(_buf?)?;
3891            Ok(_response.capabilities)
3892        }
3893        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Capabilities>(
3894            (),
3895            0x5a0823ac35f2d425,
3896            fidl::encoding::DynamicFlags::empty(),
3897            _decode,
3898        )
3899    }
3900}
3901
3902pub struct ThreadCapabilitiesEventStream {
3903    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3904}
3905
3906impl std::marker::Unpin for ThreadCapabilitiesEventStream {}
3907
3908impl futures::stream::FusedStream for ThreadCapabilitiesEventStream {
3909    fn is_terminated(&self) -> bool {
3910        self.event_receiver.is_terminated()
3911    }
3912}
3913
3914impl futures::Stream for ThreadCapabilitiesEventStream {
3915    type Item = Result<ThreadCapabilitiesEvent, fidl::Error>;
3916
3917    fn poll_next(
3918        mut self: std::pin::Pin<&mut Self>,
3919        cx: &mut std::task::Context<'_>,
3920    ) -> std::task::Poll<Option<Self::Item>> {
3921        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3922            &mut self.event_receiver,
3923            cx
3924        )?) {
3925            Some(buf) => std::task::Poll::Ready(Some(ThreadCapabilitiesEvent::decode(buf))),
3926            None => std::task::Poll::Ready(None),
3927        }
3928    }
3929}
3930
3931#[derive(Debug)]
3932pub enum ThreadCapabilitiesEvent {}
3933
3934impl ThreadCapabilitiesEvent {
3935    /// Decodes a message buffer as a [`ThreadCapabilitiesEvent`].
3936    fn decode(
3937        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3938    ) -> Result<ThreadCapabilitiesEvent, fidl::Error> {
3939        let (bytes, _handles) = buf.split_mut();
3940        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3941        debug_assert_eq!(tx_header.tx_id, 0);
3942        match tx_header.ordinal {
3943            _ => Err(fidl::Error::UnknownOrdinal {
3944                ordinal: tx_header.ordinal,
3945                protocol_name:
3946                    <ThreadCapabilitiesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3947            }),
3948        }
3949    }
3950}
3951
3952/// A Stream of incoming requests for fuchsia.lowpan.thread/ThreadCapabilities.
3953pub struct ThreadCapabilitiesRequestStream {
3954    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3955    is_terminated: bool,
3956}
3957
3958impl std::marker::Unpin for ThreadCapabilitiesRequestStream {}
3959
3960impl futures::stream::FusedStream for ThreadCapabilitiesRequestStream {
3961    fn is_terminated(&self) -> bool {
3962        self.is_terminated
3963    }
3964}
3965
3966impl fidl::endpoints::RequestStream for ThreadCapabilitiesRequestStream {
3967    type Protocol = ThreadCapabilitiesMarker;
3968    type ControlHandle = ThreadCapabilitiesControlHandle;
3969
3970    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3971        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3972    }
3973
3974    fn control_handle(&self) -> Self::ControlHandle {
3975        ThreadCapabilitiesControlHandle { inner: self.inner.clone() }
3976    }
3977
3978    fn into_inner(
3979        self,
3980    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3981    {
3982        (self.inner, self.is_terminated)
3983    }
3984
3985    fn from_inner(
3986        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3987        is_terminated: bool,
3988    ) -> Self {
3989        Self { inner, is_terminated }
3990    }
3991}
3992
3993impl futures::Stream for ThreadCapabilitiesRequestStream {
3994    type Item = Result<ThreadCapabilitiesRequest, fidl::Error>;
3995
3996    fn poll_next(
3997        mut self: std::pin::Pin<&mut Self>,
3998        cx: &mut std::task::Context<'_>,
3999    ) -> std::task::Poll<Option<Self::Item>> {
4000        let this = &mut *self;
4001        if this.inner.check_shutdown(cx) {
4002            this.is_terminated = true;
4003            return std::task::Poll::Ready(None);
4004        }
4005        if this.is_terminated {
4006            panic!("polled ThreadCapabilitiesRequestStream after completion");
4007        }
4008        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4009            |bytes, handles| {
4010                match this.inner.channel().read_etc(cx, bytes, handles) {
4011                    std::task::Poll::Ready(Ok(())) => {}
4012                    std::task::Poll::Pending => return std::task::Poll::Pending,
4013                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4014                        this.is_terminated = true;
4015                        return std::task::Poll::Ready(None);
4016                    }
4017                    std::task::Poll::Ready(Err(e)) => {
4018                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4019                            e.into(),
4020                        ))))
4021                    }
4022                }
4023
4024                // A message has been received from the channel
4025                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4026
4027                std::task::Poll::Ready(Some(match header.ordinal {
4028                0x5a0823ac35f2d425 => {
4029                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4030                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
4031                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4032                    let control_handle = ThreadCapabilitiesControlHandle {
4033                        inner: this.inner.clone(),
4034                    };
4035                    Ok(ThreadCapabilitiesRequest::GetCapabilities {
4036                        responder: ThreadCapabilitiesGetCapabilitiesResponder {
4037                            control_handle: std::mem::ManuallyDrop::new(control_handle),
4038                            tx_id: header.tx_id,
4039                        },
4040                    })
4041                }
4042                _ => Err(fidl::Error::UnknownOrdinal {
4043                    ordinal: header.ordinal,
4044                    protocol_name: <ThreadCapabilitiesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4045                }),
4046            }))
4047            },
4048        )
4049    }
4050}
4051
4052/// Protocol for retrieving supported capabilities of the thread stack.
4053#[derive(Debug)]
4054pub enum ThreadCapabilitiesRequest {
4055    /// Returns the current capabilities of Openthread for this interface.
4056    ///
4057    /// capabilities is not expected to change for the lifetime of the
4058    /// interface.
4059    GetCapabilities { responder: ThreadCapabilitiesGetCapabilitiesResponder },
4060}
4061
4062impl ThreadCapabilitiesRequest {
4063    #[allow(irrefutable_let_patterns)]
4064    pub fn into_get_capabilities(self) -> Option<(ThreadCapabilitiesGetCapabilitiesResponder)> {
4065        if let ThreadCapabilitiesRequest::GetCapabilities { responder } = self {
4066            Some((responder))
4067        } else {
4068            None
4069        }
4070    }
4071
4072    /// Name of the method defined in FIDL
4073    pub fn method_name(&self) -> &'static str {
4074        match *self {
4075            ThreadCapabilitiesRequest::GetCapabilities { .. } => "get_capabilities",
4076        }
4077    }
4078}
4079
4080#[derive(Debug, Clone)]
4081pub struct ThreadCapabilitiesControlHandle {
4082    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4083}
4084
4085impl fidl::endpoints::ControlHandle for ThreadCapabilitiesControlHandle {
4086    fn shutdown(&self) {
4087        self.inner.shutdown()
4088    }
4089    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4090        self.inner.shutdown_with_epitaph(status)
4091    }
4092
4093    fn is_closed(&self) -> bool {
4094        self.inner.channel().is_closed()
4095    }
4096    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4097        self.inner.channel().on_closed()
4098    }
4099
4100    #[cfg(target_os = "fuchsia")]
4101    fn signal_peer(
4102        &self,
4103        clear_mask: zx::Signals,
4104        set_mask: zx::Signals,
4105    ) -> Result<(), zx_status::Status> {
4106        use fidl::Peered;
4107        self.inner.channel().signal_peer(clear_mask, set_mask)
4108    }
4109}
4110
4111impl ThreadCapabilitiesControlHandle {}
4112
4113#[must_use = "FIDL methods require a response to be sent"]
4114#[derive(Debug)]
4115pub struct ThreadCapabilitiesGetCapabilitiesResponder {
4116    control_handle: std::mem::ManuallyDrop<ThreadCapabilitiesControlHandle>,
4117    tx_id: u32,
4118}
4119
4120/// Set the the channel to be shutdown (see [`ThreadCapabilitiesControlHandle::shutdown`])
4121/// if the responder is dropped without sending a response, so that the client
4122/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4123impl std::ops::Drop for ThreadCapabilitiesGetCapabilitiesResponder {
4124    fn drop(&mut self) {
4125        self.control_handle.shutdown();
4126        // Safety: drops once, never accessed again
4127        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4128    }
4129}
4130
4131impl fidl::endpoints::Responder for ThreadCapabilitiesGetCapabilitiesResponder {
4132    type ControlHandle = ThreadCapabilitiesControlHandle;
4133
4134    fn control_handle(&self) -> &ThreadCapabilitiesControlHandle {
4135        &self.control_handle
4136    }
4137
4138    fn drop_without_shutdown(mut self) {
4139        // Safety: drops once, never accessed again due to mem::forget
4140        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4141        // Prevent Drop from running (which would shut down the channel)
4142        std::mem::forget(self);
4143    }
4144}
4145
4146impl ThreadCapabilitiesGetCapabilitiesResponder {
4147    /// Sends a response to the FIDL transaction.
4148    ///
4149    /// Sets the channel to shutdown if an error occurs.
4150    pub fn send(self, mut capabilities: &Capabilities) -> Result<(), fidl::Error> {
4151        let _result = self.send_raw(capabilities);
4152        if _result.is_err() {
4153            self.control_handle.shutdown();
4154        }
4155        self.drop_without_shutdown();
4156        _result
4157    }
4158
4159    /// Similar to "send" but does not shutdown the channel if an error occurs.
4160    pub fn send_no_shutdown_on_err(
4161        self,
4162        mut capabilities: &Capabilities,
4163    ) -> Result<(), fidl::Error> {
4164        let _result = self.send_raw(capabilities);
4165        self.drop_without_shutdown();
4166        _result
4167    }
4168
4169    fn send_raw(&self, mut capabilities: &Capabilities) -> Result<(), fidl::Error> {
4170        self.control_handle.inner.send::<ThreadCapabilitiesGetCapabilitiesResponse>(
4171            (capabilities,),
4172            self.tx_id,
4173            0x5a0823ac35f2d425,
4174            fidl::encoding::DynamicFlags::empty(),
4175        )
4176    }
4177}
4178
4179mod internal {
4180    use super::*;
4181
4182    impl fidl::encoding::ResourceTypeMarker for CapabilitiesConnectorConnectRequest {
4183        type Borrowed<'a> = &'a mut Self;
4184        fn take_or_borrow<'a>(
4185            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4186        ) -> Self::Borrowed<'a> {
4187            value
4188        }
4189    }
4190
4191    unsafe impl fidl::encoding::TypeMarker for CapabilitiesConnectorConnectRequest {
4192        type Owned = Self;
4193
4194        #[inline(always)]
4195        fn inline_align(_context: fidl::encoding::Context) -> usize {
4196            8
4197        }
4198
4199        #[inline(always)]
4200        fn inline_size(_context: fidl::encoding::Context) -> usize {
4201            24
4202        }
4203    }
4204
4205    unsafe impl
4206        fidl::encoding::Encode<
4207            CapabilitiesConnectorConnectRequest,
4208            fidl::encoding::DefaultFuchsiaResourceDialect,
4209        > for &mut CapabilitiesConnectorConnectRequest
4210    {
4211        #[inline]
4212        unsafe fn encode(
4213            self,
4214            encoder: &mut fidl::encoding::Encoder<
4215                '_,
4216                fidl::encoding::DefaultFuchsiaResourceDialect,
4217            >,
4218            offset: usize,
4219            _depth: fidl::encoding::Depth,
4220        ) -> fidl::Result<()> {
4221            encoder.debug_check_bounds::<CapabilitiesConnectorConnectRequest>(offset);
4222            // Delegate to tuple encoding.
4223            fidl::encoding::Encode::<CapabilitiesConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4224                (
4225                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
4226                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ThreadCapabilitiesMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
4227                ),
4228                encoder, offset, _depth
4229            )
4230        }
4231    }
4232    unsafe impl<
4233            T0: fidl::encoding::Encode<
4234                fidl::encoding::BoundedString<32>,
4235                fidl::encoding::DefaultFuchsiaResourceDialect,
4236            >,
4237            T1: fidl::encoding::Encode<
4238                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ThreadCapabilitiesMarker>>,
4239                fidl::encoding::DefaultFuchsiaResourceDialect,
4240            >,
4241        >
4242        fidl::encoding::Encode<
4243            CapabilitiesConnectorConnectRequest,
4244            fidl::encoding::DefaultFuchsiaResourceDialect,
4245        > for (T0, T1)
4246    {
4247        #[inline]
4248        unsafe fn encode(
4249            self,
4250            encoder: &mut fidl::encoding::Encoder<
4251                '_,
4252                fidl::encoding::DefaultFuchsiaResourceDialect,
4253            >,
4254            offset: usize,
4255            depth: fidl::encoding::Depth,
4256        ) -> fidl::Result<()> {
4257            encoder.debug_check_bounds::<CapabilitiesConnectorConnectRequest>(offset);
4258            // Zero out padding regions. There's no need to apply masks
4259            // because the unmasked parts will be overwritten by fields.
4260            unsafe {
4261                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
4262                (ptr as *mut u64).write_unaligned(0);
4263            }
4264            // Write the fields.
4265            self.0.encode(encoder, offset + 0, depth)?;
4266            self.1.encode(encoder, offset + 16, depth)?;
4267            Ok(())
4268        }
4269    }
4270
4271    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4272        for CapabilitiesConnectorConnectRequest
4273    {
4274        #[inline(always)]
4275        fn new_empty() -> Self {
4276            Self {
4277                name: fidl::new_empty!(
4278                    fidl::encoding::BoundedString<32>,
4279                    fidl::encoding::DefaultFuchsiaResourceDialect
4280                ),
4281                server_end: fidl::new_empty!(
4282                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ThreadCapabilitiesMarker>>,
4283                    fidl::encoding::DefaultFuchsiaResourceDialect
4284                ),
4285            }
4286        }
4287
4288        #[inline]
4289        unsafe fn decode(
4290            &mut self,
4291            decoder: &mut fidl::encoding::Decoder<
4292                '_,
4293                fidl::encoding::DefaultFuchsiaResourceDialect,
4294            >,
4295            offset: usize,
4296            _depth: fidl::encoding::Depth,
4297        ) -> fidl::Result<()> {
4298            decoder.debug_check_bounds::<Self>(offset);
4299            // Verify that padding bytes are zero.
4300            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
4301            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4302            let mask = 0xffffffff00000000u64;
4303            let maskedval = padval & mask;
4304            if maskedval != 0 {
4305                return Err(fidl::Error::NonZeroPadding {
4306                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
4307                });
4308            }
4309            fidl::decode!(
4310                fidl::encoding::BoundedString<32>,
4311                fidl::encoding::DefaultFuchsiaResourceDialect,
4312                &mut self.name,
4313                decoder,
4314                offset + 0,
4315                _depth
4316            )?;
4317            fidl::decode!(
4318                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ThreadCapabilitiesMarker>>,
4319                fidl::encoding::DefaultFuchsiaResourceDialect,
4320                &mut self.server_end,
4321                decoder,
4322                offset + 16,
4323                _depth
4324            )?;
4325            Ok(())
4326        }
4327    }
4328
4329    impl fidl::encoding::ResourceTypeMarker for DatasetConnectorConnectRequest {
4330        type Borrowed<'a> = &'a mut Self;
4331        fn take_or_borrow<'a>(
4332            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4333        ) -> Self::Borrowed<'a> {
4334            value
4335        }
4336    }
4337
4338    unsafe impl fidl::encoding::TypeMarker for DatasetConnectorConnectRequest {
4339        type Owned = Self;
4340
4341        #[inline(always)]
4342        fn inline_align(_context: fidl::encoding::Context) -> usize {
4343            8
4344        }
4345
4346        #[inline(always)]
4347        fn inline_size(_context: fidl::encoding::Context) -> usize {
4348            24
4349        }
4350    }
4351
4352    unsafe impl
4353        fidl::encoding::Encode<
4354            DatasetConnectorConnectRequest,
4355            fidl::encoding::DefaultFuchsiaResourceDialect,
4356        > for &mut DatasetConnectorConnectRequest
4357    {
4358        #[inline]
4359        unsafe fn encode(
4360            self,
4361            encoder: &mut fidl::encoding::Encoder<
4362                '_,
4363                fidl::encoding::DefaultFuchsiaResourceDialect,
4364            >,
4365            offset: usize,
4366            _depth: fidl::encoding::Depth,
4367        ) -> fidl::Result<()> {
4368            encoder.debug_check_bounds::<DatasetConnectorConnectRequest>(offset);
4369            // Delegate to tuple encoding.
4370            fidl::encoding::Encode::<DatasetConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4371                (
4372                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
4373                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DatasetMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
4374                ),
4375                encoder, offset, _depth
4376            )
4377        }
4378    }
4379    unsafe impl<
4380            T0: fidl::encoding::Encode<
4381                fidl::encoding::BoundedString<32>,
4382                fidl::encoding::DefaultFuchsiaResourceDialect,
4383            >,
4384            T1: fidl::encoding::Encode<
4385                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DatasetMarker>>,
4386                fidl::encoding::DefaultFuchsiaResourceDialect,
4387            >,
4388        >
4389        fidl::encoding::Encode<
4390            DatasetConnectorConnectRequest,
4391            fidl::encoding::DefaultFuchsiaResourceDialect,
4392        > for (T0, T1)
4393    {
4394        #[inline]
4395        unsafe fn encode(
4396            self,
4397            encoder: &mut fidl::encoding::Encoder<
4398                '_,
4399                fidl::encoding::DefaultFuchsiaResourceDialect,
4400            >,
4401            offset: usize,
4402            depth: fidl::encoding::Depth,
4403        ) -> fidl::Result<()> {
4404            encoder.debug_check_bounds::<DatasetConnectorConnectRequest>(offset);
4405            // Zero out padding regions. There's no need to apply masks
4406            // because the unmasked parts will be overwritten by fields.
4407            unsafe {
4408                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
4409                (ptr as *mut u64).write_unaligned(0);
4410            }
4411            // Write the fields.
4412            self.0.encode(encoder, offset + 0, depth)?;
4413            self.1.encode(encoder, offset + 16, depth)?;
4414            Ok(())
4415        }
4416    }
4417
4418    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4419        for DatasetConnectorConnectRequest
4420    {
4421        #[inline(always)]
4422        fn new_empty() -> Self {
4423            Self {
4424                name: fidl::new_empty!(
4425                    fidl::encoding::BoundedString<32>,
4426                    fidl::encoding::DefaultFuchsiaResourceDialect
4427                ),
4428                server_end: fidl::new_empty!(
4429                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DatasetMarker>>,
4430                    fidl::encoding::DefaultFuchsiaResourceDialect
4431                ),
4432            }
4433        }
4434
4435        #[inline]
4436        unsafe fn decode(
4437            &mut self,
4438            decoder: &mut fidl::encoding::Decoder<
4439                '_,
4440                fidl::encoding::DefaultFuchsiaResourceDialect,
4441            >,
4442            offset: usize,
4443            _depth: fidl::encoding::Depth,
4444        ) -> fidl::Result<()> {
4445            decoder.debug_check_bounds::<Self>(offset);
4446            // Verify that padding bytes are zero.
4447            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
4448            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4449            let mask = 0xffffffff00000000u64;
4450            let maskedval = padval & mask;
4451            if maskedval != 0 {
4452                return Err(fidl::Error::NonZeroPadding {
4453                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
4454                });
4455            }
4456            fidl::decode!(
4457                fidl::encoding::BoundedString<32>,
4458                fidl::encoding::DefaultFuchsiaResourceDialect,
4459                &mut self.name,
4460                decoder,
4461                offset + 0,
4462                _depth
4463            )?;
4464            fidl::decode!(
4465                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DatasetMarker>>,
4466                fidl::encoding::DefaultFuchsiaResourceDialect,
4467                &mut self.server_end,
4468                decoder,
4469                offset + 16,
4470                _depth
4471            )?;
4472            Ok(())
4473        }
4474    }
4475
4476    impl fidl::encoding::ResourceTypeMarker for FeatureConnectorConnectRequest {
4477        type Borrowed<'a> = &'a mut Self;
4478        fn take_or_borrow<'a>(
4479            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4480        ) -> Self::Borrowed<'a> {
4481            value
4482        }
4483    }
4484
4485    unsafe impl fidl::encoding::TypeMarker for FeatureConnectorConnectRequest {
4486        type Owned = Self;
4487
4488        #[inline(always)]
4489        fn inline_align(_context: fidl::encoding::Context) -> usize {
4490            8
4491        }
4492
4493        #[inline(always)]
4494        fn inline_size(_context: fidl::encoding::Context) -> usize {
4495            24
4496        }
4497    }
4498
4499    unsafe impl
4500        fidl::encoding::Encode<
4501            FeatureConnectorConnectRequest,
4502            fidl::encoding::DefaultFuchsiaResourceDialect,
4503        > for &mut FeatureConnectorConnectRequest
4504    {
4505        #[inline]
4506        unsafe fn encode(
4507            self,
4508            encoder: &mut fidl::encoding::Encoder<
4509                '_,
4510                fidl::encoding::DefaultFuchsiaResourceDialect,
4511            >,
4512            offset: usize,
4513            _depth: fidl::encoding::Depth,
4514        ) -> fidl::Result<()> {
4515            encoder.debug_check_bounds::<FeatureConnectorConnectRequest>(offset);
4516            // Delegate to tuple encoding.
4517            fidl::encoding::Encode::<FeatureConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4518                (
4519                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
4520                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FeatureMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
4521                ),
4522                encoder, offset, _depth
4523            )
4524        }
4525    }
4526    unsafe impl<
4527            T0: fidl::encoding::Encode<
4528                fidl::encoding::BoundedString<32>,
4529                fidl::encoding::DefaultFuchsiaResourceDialect,
4530            >,
4531            T1: fidl::encoding::Encode<
4532                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FeatureMarker>>,
4533                fidl::encoding::DefaultFuchsiaResourceDialect,
4534            >,
4535        >
4536        fidl::encoding::Encode<
4537            FeatureConnectorConnectRequest,
4538            fidl::encoding::DefaultFuchsiaResourceDialect,
4539        > for (T0, T1)
4540    {
4541        #[inline]
4542        unsafe fn encode(
4543            self,
4544            encoder: &mut fidl::encoding::Encoder<
4545                '_,
4546                fidl::encoding::DefaultFuchsiaResourceDialect,
4547            >,
4548            offset: usize,
4549            depth: fidl::encoding::Depth,
4550        ) -> fidl::Result<()> {
4551            encoder.debug_check_bounds::<FeatureConnectorConnectRequest>(offset);
4552            // Zero out padding regions. There's no need to apply masks
4553            // because the unmasked parts will be overwritten by fields.
4554            unsafe {
4555                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
4556                (ptr as *mut u64).write_unaligned(0);
4557            }
4558            // Write the fields.
4559            self.0.encode(encoder, offset + 0, depth)?;
4560            self.1.encode(encoder, offset + 16, depth)?;
4561            Ok(())
4562        }
4563    }
4564
4565    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4566        for FeatureConnectorConnectRequest
4567    {
4568        #[inline(always)]
4569        fn new_empty() -> Self {
4570            Self {
4571                name: fidl::new_empty!(
4572                    fidl::encoding::BoundedString<32>,
4573                    fidl::encoding::DefaultFuchsiaResourceDialect
4574                ),
4575                server_end: fidl::new_empty!(
4576                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FeatureMarker>>,
4577                    fidl::encoding::DefaultFuchsiaResourceDialect
4578                ),
4579            }
4580        }
4581
4582        #[inline]
4583        unsafe fn decode(
4584            &mut self,
4585            decoder: &mut fidl::encoding::Decoder<
4586                '_,
4587                fidl::encoding::DefaultFuchsiaResourceDialect,
4588            >,
4589            offset: usize,
4590            _depth: fidl::encoding::Depth,
4591        ) -> fidl::Result<()> {
4592            decoder.debug_check_bounds::<Self>(offset);
4593            // Verify that padding bytes are zero.
4594            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
4595            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4596            let mask = 0xffffffff00000000u64;
4597            let maskedval = padval & mask;
4598            if maskedval != 0 {
4599                return Err(fidl::Error::NonZeroPadding {
4600                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
4601                });
4602            }
4603            fidl::decode!(
4604                fidl::encoding::BoundedString<32>,
4605                fidl::encoding::DefaultFuchsiaResourceDialect,
4606                &mut self.name,
4607                decoder,
4608                offset + 0,
4609                _depth
4610            )?;
4611            fidl::decode!(
4612                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<FeatureMarker>>,
4613                fidl::encoding::DefaultFuchsiaResourceDialect,
4614                &mut self.server_end,
4615                decoder,
4616                offset + 16,
4617                _depth
4618            )?;
4619            Ok(())
4620        }
4621    }
4622
4623    impl fidl::encoding::ResourceTypeMarker for MeshcopConnectorConnectRequest {
4624        type Borrowed<'a> = &'a mut Self;
4625        fn take_or_borrow<'a>(
4626            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4627        ) -> Self::Borrowed<'a> {
4628            value
4629        }
4630    }
4631
4632    unsafe impl fidl::encoding::TypeMarker for MeshcopConnectorConnectRequest {
4633        type Owned = Self;
4634
4635        #[inline(always)]
4636        fn inline_align(_context: fidl::encoding::Context) -> usize {
4637            8
4638        }
4639
4640        #[inline(always)]
4641        fn inline_size(_context: fidl::encoding::Context) -> usize {
4642            24
4643        }
4644    }
4645
4646    unsafe impl
4647        fidl::encoding::Encode<
4648            MeshcopConnectorConnectRequest,
4649            fidl::encoding::DefaultFuchsiaResourceDialect,
4650        > for &mut MeshcopConnectorConnectRequest
4651    {
4652        #[inline]
4653        unsafe fn encode(
4654            self,
4655            encoder: &mut fidl::encoding::Encoder<
4656                '_,
4657                fidl::encoding::DefaultFuchsiaResourceDialect,
4658            >,
4659            offset: usize,
4660            _depth: fidl::encoding::Depth,
4661        ) -> fidl::Result<()> {
4662            encoder.debug_check_bounds::<MeshcopConnectorConnectRequest>(offset);
4663            // Delegate to tuple encoding.
4664            fidl::encoding::Encode::<MeshcopConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4665                (
4666                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
4667                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MeshcopMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
4668                ),
4669                encoder, offset, _depth
4670            )
4671        }
4672    }
4673    unsafe impl<
4674            T0: fidl::encoding::Encode<
4675                fidl::encoding::BoundedString<32>,
4676                fidl::encoding::DefaultFuchsiaResourceDialect,
4677            >,
4678            T1: fidl::encoding::Encode<
4679                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MeshcopMarker>>,
4680                fidl::encoding::DefaultFuchsiaResourceDialect,
4681            >,
4682        >
4683        fidl::encoding::Encode<
4684            MeshcopConnectorConnectRequest,
4685            fidl::encoding::DefaultFuchsiaResourceDialect,
4686        > for (T0, T1)
4687    {
4688        #[inline]
4689        unsafe fn encode(
4690            self,
4691            encoder: &mut fidl::encoding::Encoder<
4692                '_,
4693                fidl::encoding::DefaultFuchsiaResourceDialect,
4694            >,
4695            offset: usize,
4696            depth: fidl::encoding::Depth,
4697        ) -> fidl::Result<()> {
4698            encoder.debug_check_bounds::<MeshcopConnectorConnectRequest>(offset);
4699            // Zero out padding regions. There's no need to apply masks
4700            // because the unmasked parts will be overwritten by fields.
4701            unsafe {
4702                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
4703                (ptr as *mut u64).write_unaligned(0);
4704            }
4705            // Write the fields.
4706            self.0.encode(encoder, offset + 0, depth)?;
4707            self.1.encode(encoder, offset + 16, depth)?;
4708            Ok(())
4709        }
4710    }
4711
4712    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4713        for MeshcopConnectorConnectRequest
4714    {
4715        #[inline(always)]
4716        fn new_empty() -> Self {
4717            Self {
4718                name: fidl::new_empty!(
4719                    fidl::encoding::BoundedString<32>,
4720                    fidl::encoding::DefaultFuchsiaResourceDialect
4721                ),
4722                server_end: fidl::new_empty!(
4723                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MeshcopMarker>>,
4724                    fidl::encoding::DefaultFuchsiaResourceDialect
4725                ),
4726            }
4727        }
4728
4729        #[inline]
4730        unsafe fn decode(
4731            &mut self,
4732            decoder: &mut fidl::encoding::Decoder<
4733                '_,
4734                fidl::encoding::DefaultFuchsiaResourceDialect,
4735            >,
4736            offset: usize,
4737            _depth: fidl::encoding::Depth,
4738        ) -> fidl::Result<()> {
4739            decoder.debug_check_bounds::<Self>(offset);
4740            // Verify that padding bytes are zero.
4741            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
4742            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4743            let mask = 0xffffffff00000000u64;
4744            let maskedval = padval & mask;
4745            if maskedval != 0 {
4746                return Err(fidl::Error::NonZeroPadding {
4747                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
4748                });
4749            }
4750            fidl::decode!(
4751                fidl::encoding::BoundedString<32>,
4752                fidl::encoding::DefaultFuchsiaResourceDialect,
4753                &mut self.name,
4754                decoder,
4755                offset + 0,
4756                _depth
4757            )?;
4758            fidl::decode!(
4759                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<MeshcopMarker>>,
4760                fidl::encoding::DefaultFuchsiaResourceDialect,
4761                &mut self.server_end,
4762                decoder,
4763                offset + 16,
4764                _depth
4765            )?;
4766            Ok(())
4767        }
4768    }
4769}