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