fidl_fuchsia_lowpan_driver/
fidl_fuchsia_lowpan_driver.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_driver_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct DriverGetProtocolsRequest {
16    pub protocols: Protocols,
17}
18
19impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for DriverGetProtocolsRequest {}
20
21#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
22pub struct RegisterRegisterDeviceRequest {
23    pub name: String,
24    pub driver: fidl::endpoints::ClientEnd<DriverMarker>,
25}
26
27impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
28    for RegisterRegisterDeviceRequest
29{
30}
31
32/// Table of protocol requests that is passed into `Driver.GetProtocols()`.
33#[derive(Debug, Default, PartialEq)]
34pub struct Protocols {
35    pub device: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_device::DeviceMarker>>,
36    pub device_extra:
37        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_device::DeviceExtraMarker>>,
38    pub device_test: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_test::DeviceTestMarker>>,
39    pub device_route:
40        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_experimental::DeviceRouteMarker>>,
41    pub device_route_extra: Option<
42        fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_experimental::DeviceRouteExtraMarker>,
43    >,
44    pub counters: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_device::CountersMarker>>,
45    pub thread_legacy_joining:
46        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_experimental::LegacyJoiningMarker>>,
47    pub thread_dataset:
48        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_thread::DatasetMarker>>,
49    pub energy_scan:
50        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_device::EnergyScanMarker>>,
51    pub experimental_device:
52        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_experimental::DeviceMarker>>,
53    pub experimental_device_extra:
54        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_experimental::DeviceExtraMarker>>,
55    pub meshcop: Option<fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_thread::MeshcopMarker>>,
56    pub telemetry_provider: Option<
57        fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_experimental::TelemetryProviderMarker>,
58    >,
59    pub thread_feature:
60        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_thread::FeatureMarker>>,
61    pub capabilities:
62        Option<fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_thread::ThreadCapabilitiesMarker>>,
63    #[doc(hidden)]
64    pub __source_breaking: fidl::marker::SourceBreaking,
65}
66
67impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Protocols {}
68
69#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
70pub struct DriverMarker;
71
72impl fidl::endpoints::ProtocolMarker for DriverMarker {
73    type Proxy = DriverProxy;
74    type RequestStream = DriverRequestStream;
75    #[cfg(target_os = "fuchsia")]
76    type SynchronousProxy = DriverSynchronousProxy;
77
78    const DEBUG_NAME: &'static str = "(anonymous) Driver";
79}
80
81pub trait DriverProxyInterface: Send + Sync {
82    fn r#get_protocols(&self, protocols: Protocols) -> Result<(), fidl::Error>;
83}
84#[derive(Debug)]
85#[cfg(target_os = "fuchsia")]
86pub struct DriverSynchronousProxy {
87    client: fidl::client::sync::Client,
88}
89
90#[cfg(target_os = "fuchsia")]
91impl fidl::endpoints::SynchronousProxy for DriverSynchronousProxy {
92    type Proxy = DriverProxy;
93    type Protocol = DriverMarker;
94
95    fn from_channel(inner: fidl::Channel) -> Self {
96        Self::new(inner)
97    }
98
99    fn into_channel(self) -> fidl::Channel {
100        self.client.into_channel()
101    }
102
103    fn as_channel(&self) -> &fidl::Channel {
104        self.client.as_channel()
105    }
106}
107
108#[cfg(target_os = "fuchsia")]
109impl DriverSynchronousProxy {
110    pub fn new(channel: fidl::Channel) -> Self {
111        let protocol_name = <DriverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
112        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
113    }
114
115    pub fn into_channel(self) -> fidl::Channel {
116        self.client.into_channel()
117    }
118
119    /// Waits until an event arrives and returns it. It is safe for other
120    /// threads to make concurrent requests while waiting for an event.
121    pub fn wait_for_event(
122        &self,
123        deadline: zx::MonotonicInstant,
124    ) -> Result<DriverEvent, fidl::Error> {
125        DriverEvent::decode(self.client.wait_for_event(deadline)?)
126    }
127
128    /// Request protocols to control this device.
129    /// Unsupported protocols are closed.
130    pub fn r#get_protocols(&self, mut protocols: Protocols) -> Result<(), fidl::Error> {
131        self.client.send::<DriverGetProtocolsRequest>(
132            (&mut protocols,),
133            0x165f5b09fcc7bc85,
134            fidl::encoding::DynamicFlags::empty(),
135        )
136    }
137}
138
139#[cfg(target_os = "fuchsia")]
140impl From<DriverSynchronousProxy> for zx::Handle {
141    fn from(value: DriverSynchronousProxy) -> Self {
142        value.into_channel().into()
143    }
144}
145
146#[cfg(target_os = "fuchsia")]
147impl From<fidl::Channel> for DriverSynchronousProxy {
148    fn from(value: fidl::Channel) -> Self {
149        Self::new(value)
150    }
151}
152
153#[derive(Debug, Clone)]
154pub struct DriverProxy {
155    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
156}
157
158impl fidl::endpoints::Proxy for DriverProxy {
159    type Protocol = DriverMarker;
160
161    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
162        Self::new(inner)
163    }
164
165    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
166        self.client.into_channel().map_err(|client| Self { client })
167    }
168
169    fn as_channel(&self) -> &::fidl::AsyncChannel {
170        self.client.as_channel()
171    }
172}
173
174impl DriverProxy {
175    /// Create a new Proxy for fuchsia.lowpan.driver/Driver.
176    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
177        let protocol_name = <DriverMarker 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) -> DriverEventStream {
187        DriverEventStream { event_receiver: self.client.take_event_receiver() }
188    }
189
190    /// Request protocols to control this device.
191    /// Unsupported protocols are closed.
192    pub fn r#get_protocols(&self, mut protocols: Protocols) -> Result<(), fidl::Error> {
193        DriverProxyInterface::r#get_protocols(self, protocols)
194    }
195}
196
197impl DriverProxyInterface for DriverProxy {
198    fn r#get_protocols(&self, mut protocols: Protocols) -> Result<(), fidl::Error> {
199        self.client.send::<DriverGetProtocolsRequest>(
200            (&mut protocols,),
201            0x165f5b09fcc7bc85,
202            fidl::encoding::DynamicFlags::empty(),
203        )
204    }
205}
206
207pub struct DriverEventStream {
208    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
209}
210
211impl std::marker::Unpin for DriverEventStream {}
212
213impl futures::stream::FusedStream for DriverEventStream {
214    fn is_terminated(&self) -> bool {
215        self.event_receiver.is_terminated()
216    }
217}
218
219impl futures::Stream for DriverEventStream {
220    type Item = Result<DriverEvent, fidl::Error>;
221
222    fn poll_next(
223        mut self: std::pin::Pin<&mut Self>,
224        cx: &mut std::task::Context<'_>,
225    ) -> std::task::Poll<Option<Self::Item>> {
226        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
227            &mut self.event_receiver,
228            cx
229        )?) {
230            Some(buf) => std::task::Poll::Ready(Some(DriverEvent::decode(buf))),
231            None => std::task::Poll::Ready(None),
232        }
233    }
234}
235
236#[derive(Debug)]
237pub enum DriverEvent {}
238
239impl DriverEvent {
240    /// Decodes a message buffer as a [`DriverEvent`].
241    fn decode(
242        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
243    ) -> Result<DriverEvent, fidl::Error> {
244        let (bytes, _handles) = buf.split_mut();
245        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
246        debug_assert_eq!(tx_header.tx_id, 0);
247        match tx_header.ordinal {
248            _ => Err(fidl::Error::UnknownOrdinal {
249                ordinal: tx_header.ordinal,
250                protocol_name: <DriverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
251            }),
252        }
253    }
254}
255
256/// A Stream of incoming requests for fuchsia.lowpan.driver/Driver.
257pub struct DriverRequestStream {
258    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
259    is_terminated: bool,
260}
261
262impl std::marker::Unpin for DriverRequestStream {}
263
264impl futures::stream::FusedStream for DriverRequestStream {
265    fn is_terminated(&self) -> bool {
266        self.is_terminated
267    }
268}
269
270impl fidl::endpoints::RequestStream for DriverRequestStream {
271    type Protocol = DriverMarker;
272    type ControlHandle = DriverControlHandle;
273
274    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
275        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
276    }
277
278    fn control_handle(&self) -> Self::ControlHandle {
279        DriverControlHandle { inner: self.inner.clone() }
280    }
281
282    fn into_inner(
283        self,
284    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
285    {
286        (self.inner, self.is_terminated)
287    }
288
289    fn from_inner(
290        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
291        is_terminated: bool,
292    ) -> Self {
293        Self { inner, is_terminated }
294    }
295}
296
297impl futures::Stream for DriverRequestStream {
298    type Item = Result<DriverRequest, fidl::Error>;
299
300    fn poll_next(
301        mut self: std::pin::Pin<&mut Self>,
302        cx: &mut std::task::Context<'_>,
303    ) -> std::task::Poll<Option<Self::Item>> {
304        let this = &mut *self;
305        if this.inner.check_shutdown(cx) {
306            this.is_terminated = true;
307            return std::task::Poll::Ready(None);
308        }
309        if this.is_terminated {
310            panic!("polled DriverRequestStream after completion");
311        }
312        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
313            |bytes, handles| {
314                match this.inner.channel().read_etc(cx, bytes, handles) {
315                    std::task::Poll::Ready(Ok(())) => {}
316                    std::task::Poll::Pending => return std::task::Poll::Pending,
317                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
318                        this.is_terminated = true;
319                        return std::task::Poll::Ready(None);
320                    }
321                    std::task::Poll::Ready(Err(e)) => {
322                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
323                            e.into(),
324                        ))))
325                    }
326                }
327
328                // A message has been received from the channel
329                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
330
331                std::task::Poll::Ready(Some(match header.ordinal {
332                    0x165f5b09fcc7bc85 => {
333                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
334                        let mut req = fidl::new_empty!(
335                            DriverGetProtocolsRequest,
336                            fidl::encoding::DefaultFuchsiaResourceDialect
337                        );
338                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DriverGetProtocolsRequest>(&header, _body_bytes, handles, &mut req)?;
339                        let control_handle = DriverControlHandle { inner: this.inner.clone() };
340                        Ok(DriverRequest::GetProtocols { protocols: req.protocols, control_handle })
341                    }
342                    _ => Err(fidl::Error::UnknownOrdinal {
343                        ordinal: header.ordinal,
344                        protocol_name:
345                            <DriverMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
346                    }),
347                }))
348            },
349        )
350    }
351}
352
353/// Protocol representing a LoWPAN driver instance.
354#[derive(Debug)]
355pub enum DriverRequest {
356    /// Request protocols to control this device.
357    /// Unsupported protocols are closed.
358    GetProtocols { protocols: Protocols, control_handle: DriverControlHandle },
359}
360
361impl DriverRequest {
362    #[allow(irrefutable_let_patterns)]
363    pub fn into_get_protocols(self) -> Option<(Protocols, DriverControlHandle)> {
364        if let DriverRequest::GetProtocols { protocols, control_handle } = self {
365            Some((protocols, control_handle))
366        } else {
367            None
368        }
369    }
370
371    /// Name of the method defined in FIDL
372    pub fn method_name(&self) -> &'static str {
373        match *self {
374            DriverRequest::GetProtocols { .. } => "get_protocols",
375        }
376    }
377}
378
379#[derive(Debug, Clone)]
380pub struct DriverControlHandle {
381    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
382}
383
384impl fidl::endpoints::ControlHandle for DriverControlHandle {
385    fn shutdown(&self) {
386        self.inner.shutdown()
387    }
388    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
389        self.inner.shutdown_with_epitaph(status)
390    }
391
392    fn is_closed(&self) -> bool {
393        self.inner.channel().is_closed()
394    }
395    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
396        self.inner.channel().on_closed()
397    }
398
399    #[cfg(target_os = "fuchsia")]
400    fn signal_peer(
401        &self,
402        clear_mask: zx::Signals,
403        set_mask: zx::Signals,
404    ) -> Result<(), zx_status::Status> {
405        use fidl::Peered;
406        self.inner.channel().signal_peer(clear_mask, set_mask)
407    }
408}
409
410impl DriverControlHandle {}
411
412#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
413pub struct RegisterMarker;
414
415impl fidl::endpoints::ProtocolMarker for RegisterMarker {
416    type Proxy = RegisterProxy;
417    type RequestStream = RegisterRequestStream;
418    #[cfg(target_os = "fuchsia")]
419    type SynchronousProxy = RegisterSynchronousProxy;
420
421    const DEBUG_NAME: &'static str = "fuchsia.lowpan.driver.Register";
422}
423impl fidl::endpoints::DiscoverableProtocolMarker for RegisterMarker {}
424
425pub trait RegisterProxyInterface: Send + Sync {
426    fn r#register_device(
427        &self,
428        name: &str,
429        driver: fidl::endpoints::ClientEnd<DriverMarker>,
430    ) -> Result<(), fidl::Error>;
431}
432#[derive(Debug)]
433#[cfg(target_os = "fuchsia")]
434pub struct RegisterSynchronousProxy {
435    client: fidl::client::sync::Client,
436}
437
438#[cfg(target_os = "fuchsia")]
439impl fidl::endpoints::SynchronousProxy for RegisterSynchronousProxy {
440    type Proxy = RegisterProxy;
441    type Protocol = RegisterMarker;
442
443    fn from_channel(inner: fidl::Channel) -> Self {
444        Self::new(inner)
445    }
446
447    fn into_channel(self) -> fidl::Channel {
448        self.client.into_channel()
449    }
450
451    fn as_channel(&self) -> &fidl::Channel {
452        self.client.as_channel()
453    }
454}
455
456#[cfg(target_os = "fuchsia")]
457impl RegisterSynchronousProxy {
458    pub fn new(channel: fidl::Channel) -> Self {
459        let protocol_name = <RegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
460        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
461    }
462
463    pub fn into_channel(self) -> fidl::Channel {
464        self.client.into_channel()
465    }
466
467    /// Waits until an event arrives and returns it. It is safe for other
468    /// threads to make concurrent requests while waiting for an event.
469    pub fn wait_for_event(
470        &self,
471        deadline: zx::MonotonicInstant,
472    ) -> Result<RegisterEvent, fidl::Error> {
473        RegisterEvent::decode(self.client.wait_for_event(deadline)?)
474    }
475
476    /// Registers the given LoWPAN device with the LoWPAN Service
477    /// using the given interface name.
478    pub fn r#register_device(
479        &self,
480        mut name: &str,
481        mut driver: fidl::endpoints::ClientEnd<DriverMarker>,
482    ) -> Result<(), fidl::Error> {
483        self.client.send::<RegisterRegisterDeviceRequest>(
484            (name, driver),
485            0x19280d20cfdd62e6,
486            fidl::encoding::DynamicFlags::empty(),
487        )
488    }
489}
490
491#[cfg(target_os = "fuchsia")]
492impl From<RegisterSynchronousProxy> for zx::Handle {
493    fn from(value: RegisterSynchronousProxy) -> Self {
494        value.into_channel().into()
495    }
496}
497
498#[cfg(target_os = "fuchsia")]
499impl From<fidl::Channel> for RegisterSynchronousProxy {
500    fn from(value: fidl::Channel) -> Self {
501        Self::new(value)
502    }
503}
504
505#[derive(Debug, Clone)]
506pub struct RegisterProxy {
507    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
508}
509
510impl fidl::endpoints::Proxy for RegisterProxy {
511    type Protocol = RegisterMarker;
512
513    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
514        Self::new(inner)
515    }
516
517    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
518        self.client.into_channel().map_err(|client| Self { client })
519    }
520
521    fn as_channel(&self) -> &::fidl::AsyncChannel {
522        self.client.as_channel()
523    }
524}
525
526impl RegisterProxy {
527    /// Create a new Proxy for fuchsia.lowpan.driver/Register.
528    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
529        let protocol_name = <RegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
530        Self { client: fidl::client::Client::new(channel, protocol_name) }
531    }
532
533    /// Get a Stream of events from the remote end of the protocol.
534    ///
535    /// # Panics
536    ///
537    /// Panics if the event stream was already taken.
538    pub fn take_event_stream(&self) -> RegisterEventStream {
539        RegisterEventStream { event_receiver: self.client.take_event_receiver() }
540    }
541
542    /// Registers the given LoWPAN device with the LoWPAN Service
543    /// using the given interface name.
544    pub fn r#register_device(
545        &self,
546        mut name: &str,
547        mut driver: fidl::endpoints::ClientEnd<DriverMarker>,
548    ) -> Result<(), fidl::Error> {
549        RegisterProxyInterface::r#register_device(self, name, driver)
550    }
551}
552
553impl RegisterProxyInterface for RegisterProxy {
554    fn r#register_device(
555        &self,
556        mut name: &str,
557        mut driver: fidl::endpoints::ClientEnd<DriverMarker>,
558    ) -> Result<(), fidl::Error> {
559        self.client.send::<RegisterRegisterDeviceRequest>(
560            (name, driver),
561            0x19280d20cfdd62e6,
562            fidl::encoding::DynamicFlags::empty(),
563        )
564    }
565}
566
567pub struct RegisterEventStream {
568    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
569}
570
571impl std::marker::Unpin for RegisterEventStream {}
572
573impl futures::stream::FusedStream for RegisterEventStream {
574    fn is_terminated(&self) -> bool {
575        self.event_receiver.is_terminated()
576    }
577}
578
579impl futures::Stream for RegisterEventStream {
580    type Item = Result<RegisterEvent, fidl::Error>;
581
582    fn poll_next(
583        mut self: std::pin::Pin<&mut Self>,
584        cx: &mut std::task::Context<'_>,
585    ) -> std::task::Poll<Option<Self::Item>> {
586        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
587            &mut self.event_receiver,
588            cx
589        )?) {
590            Some(buf) => std::task::Poll::Ready(Some(RegisterEvent::decode(buf))),
591            None => std::task::Poll::Ready(None),
592        }
593    }
594}
595
596#[derive(Debug)]
597pub enum RegisterEvent {}
598
599impl RegisterEvent {
600    /// Decodes a message buffer as a [`RegisterEvent`].
601    fn decode(
602        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
603    ) -> Result<RegisterEvent, fidl::Error> {
604        let (bytes, _handles) = buf.split_mut();
605        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
606        debug_assert_eq!(tx_header.tx_id, 0);
607        match tx_header.ordinal {
608            _ => Err(fidl::Error::UnknownOrdinal {
609                ordinal: tx_header.ordinal,
610                protocol_name: <RegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
611            }),
612        }
613    }
614}
615
616/// A Stream of incoming requests for fuchsia.lowpan.driver/Register.
617pub struct RegisterRequestStream {
618    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
619    is_terminated: bool,
620}
621
622impl std::marker::Unpin for RegisterRequestStream {}
623
624impl futures::stream::FusedStream for RegisterRequestStream {
625    fn is_terminated(&self) -> bool {
626        self.is_terminated
627    }
628}
629
630impl fidl::endpoints::RequestStream for RegisterRequestStream {
631    type Protocol = RegisterMarker;
632    type ControlHandle = RegisterControlHandle;
633
634    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
635        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
636    }
637
638    fn control_handle(&self) -> Self::ControlHandle {
639        RegisterControlHandle { inner: self.inner.clone() }
640    }
641
642    fn into_inner(
643        self,
644    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
645    {
646        (self.inner, self.is_terminated)
647    }
648
649    fn from_inner(
650        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
651        is_terminated: bool,
652    ) -> Self {
653        Self { inner, is_terminated }
654    }
655}
656
657impl futures::Stream for RegisterRequestStream {
658    type Item = Result<RegisterRequest, fidl::Error>;
659
660    fn poll_next(
661        mut self: std::pin::Pin<&mut Self>,
662        cx: &mut std::task::Context<'_>,
663    ) -> std::task::Poll<Option<Self::Item>> {
664        let this = &mut *self;
665        if this.inner.check_shutdown(cx) {
666            this.is_terminated = true;
667            return std::task::Poll::Ready(None);
668        }
669        if this.is_terminated {
670            panic!("polled RegisterRequestStream after completion");
671        }
672        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
673            |bytes, handles| {
674                match this.inner.channel().read_etc(cx, bytes, handles) {
675                    std::task::Poll::Ready(Ok(())) => {}
676                    std::task::Poll::Pending => return std::task::Poll::Pending,
677                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
678                        this.is_terminated = true;
679                        return std::task::Poll::Ready(None);
680                    }
681                    std::task::Poll::Ready(Err(e)) => {
682                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
683                            e.into(),
684                        ))))
685                    }
686                }
687
688                // A message has been received from the channel
689                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
690
691                std::task::Poll::Ready(Some(match header.ordinal {
692                    0x19280d20cfdd62e6 => {
693                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
694                        let mut req = fidl::new_empty!(
695                            RegisterRegisterDeviceRequest,
696                            fidl::encoding::DefaultFuchsiaResourceDialect
697                        );
698                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RegisterRegisterDeviceRequest>(&header, _body_bytes, handles, &mut req)?;
699                        let control_handle = RegisterControlHandle { inner: this.inner.clone() };
700                        Ok(RegisterRequest::RegisterDevice {
701                            name: req.name,
702                            driver: req.driver,
703
704                            control_handle,
705                        })
706                    }
707                    _ => Err(fidl::Error::UnknownOrdinal {
708                        ordinal: header.ordinal,
709                        protocol_name:
710                            <RegisterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
711                    }),
712                }))
713            },
714        )
715    }
716}
717
718/// Protocol for registering LoWPAN interfaces and their
719/// associated control protocols with the LoWPAN service.
720#[derive(Debug)]
721pub enum RegisterRequest {
722    /// Registers the given LoWPAN device with the LoWPAN Service
723    /// using the given interface name.
724    RegisterDevice {
725        name: String,
726        driver: fidl::endpoints::ClientEnd<DriverMarker>,
727        control_handle: RegisterControlHandle,
728    },
729}
730
731impl RegisterRequest {
732    #[allow(irrefutable_let_patterns)]
733    pub fn into_register_device(
734        self,
735    ) -> Option<(String, fidl::endpoints::ClientEnd<DriverMarker>, RegisterControlHandle)> {
736        if let RegisterRequest::RegisterDevice { name, driver, control_handle } = self {
737            Some((name, driver, control_handle))
738        } else {
739            None
740        }
741    }
742
743    /// Name of the method defined in FIDL
744    pub fn method_name(&self) -> &'static str {
745        match *self {
746            RegisterRequest::RegisterDevice { .. } => "register_device",
747        }
748    }
749}
750
751#[derive(Debug, Clone)]
752pub struct RegisterControlHandle {
753    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
754}
755
756impl fidl::endpoints::ControlHandle for RegisterControlHandle {
757    fn shutdown(&self) {
758        self.inner.shutdown()
759    }
760    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
761        self.inner.shutdown_with_epitaph(status)
762    }
763
764    fn is_closed(&self) -> bool {
765        self.inner.channel().is_closed()
766    }
767    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
768        self.inner.channel().on_closed()
769    }
770
771    #[cfg(target_os = "fuchsia")]
772    fn signal_peer(
773        &self,
774        clear_mask: zx::Signals,
775        set_mask: zx::Signals,
776    ) -> Result<(), zx_status::Status> {
777        use fidl::Peered;
778        self.inner.channel().signal_peer(clear_mask, set_mask)
779    }
780}
781
782impl RegisterControlHandle {}
783
784mod internal {
785    use super::*;
786
787    impl fidl::encoding::ResourceTypeMarker for DriverGetProtocolsRequest {
788        type Borrowed<'a> = &'a mut Self;
789        fn take_or_borrow<'a>(
790            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
791        ) -> Self::Borrowed<'a> {
792            value
793        }
794    }
795
796    unsafe impl fidl::encoding::TypeMarker for DriverGetProtocolsRequest {
797        type Owned = Self;
798
799        #[inline(always)]
800        fn inline_align(_context: fidl::encoding::Context) -> usize {
801            8
802        }
803
804        #[inline(always)]
805        fn inline_size(_context: fidl::encoding::Context) -> usize {
806            16
807        }
808    }
809
810    unsafe impl
811        fidl::encoding::Encode<
812            DriverGetProtocolsRequest,
813            fidl::encoding::DefaultFuchsiaResourceDialect,
814        > for &mut DriverGetProtocolsRequest
815    {
816        #[inline]
817        unsafe fn encode(
818            self,
819            encoder: &mut fidl::encoding::Encoder<
820                '_,
821                fidl::encoding::DefaultFuchsiaResourceDialect,
822            >,
823            offset: usize,
824            _depth: fidl::encoding::Depth,
825        ) -> fidl::Result<()> {
826            encoder.debug_check_bounds::<DriverGetProtocolsRequest>(offset);
827            // Delegate to tuple encoding.
828            fidl::encoding::Encode::<
829                DriverGetProtocolsRequest,
830                fidl::encoding::DefaultFuchsiaResourceDialect,
831            >::encode(
832                (<Protocols as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
833                    &mut self.protocols,
834                ),),
835                encoder,
836                offset,
837                _depth,
838            )
839        }
840    }
841    unsafe impl<T0: fidl::encoding::Encode<Protocols, fidl::encoding::DefaultFuchsiaResourceDialect>>
842        fidl::encoding::Encode<
843            DriverGetProtocolsRequest,
844            fidl::encoding::DefaultFuchsiaResourceDialect,
845        > for (T0,)
846    {
847        #[inline]
848        unsafe fn encode(
849            self,
850            encoder: &mut fidl::encoding::Encoder<
851                '_,
852                fidl::encoding::DefaultFuchsiaResourceDialect,
853            >,
854            offset: usize,
855            depth: fidl::encoding::Depth,
856        ) -> fidl::Result<()> {
857            encoder.debug_check_bounds::<DriverGetProtocolsRequest>(offset);
858            // Zero out padding regions. There's no need to apply masks
859            // because the unmasked parts will be overwritten by fields.
860            // Write the fields.
861            self.0.encode(encoder, offset + 0, depth)?;
862            Ok(())
863        }
864    }
865
866    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
867        for DriverGetProtocolsRequest
868    {
869        #[inline(always)]
870        fn new_empty() -> Self {
871            Self {
872                protocols: fidl::new_empty!(
873                    Protocols,
874                    fidl::encoding::DefaultFuchsiaResourceDialect
875                ),
876            }
877        }
878
879        #[inline]
880        unsafe fn decode(
881            &mut self,
882            decoder: &mut fidl::encoding::Decoder<
883                '_,
884                fidl::encoding::DefaultFuchsiaResourceDialect,
885            >,
886            offset: usize,
887            _depth: fidl::encoding::Depth,
888        ) -> fidl::Result<()> {
889            decoder.debug_check_bounds::<Self>(offset);
890            // Verify that padding bytes are zero.
891            fidl::decode!(
892                Protocols,
893                fidl::encoding::DefaultFuchsiaResourceDialect,
894                &mut self.protocols,
895                decoder,
896                offset + 0,
897                _depth
898            )?;
899            Ok(())
900        }
901    }
902
903    impl fidl::encoding::ResourceTypeMarker for RegisterRegisterDeviceRequest {
904        type Borrowed<'a> = &'a mut Self;
905        fn take_or_borrow<'a>(
906            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
907        ) -> Self::Borrowed<'a> {
908            value
909        }
910    }
911
912    unsafe impl fidl::encoding::TypeMarker for RegisterRegisterDeviceRequest {
913        type Owned = Self;
914
915        #[inline(always)]
916        fn inline_align(_context: fidl::encoding::Context) -> usize {
917            8
918        }
919
920        #[inline(always)]
921        fn inline_size(_context: fidl::encoding::Context) -> usize {
922            24
923        }
924    }
925
926    unsafe impl
927        fidl::encoding::Encode<
928            RegisterRegisterDeviceRequest,
929            fidl::encoding::DefaultFuchsiaResourceDialect,
930        > for &mut RegisterRegisterDeviceRequest
931    {
932        #[inline]
933        unsafe fn encode(
934            self,
935            encoder: &mut fidl::encoding::Encoder<
936                '_,
937                fidl::encoding::DefaultFuchsiaResourceDialect,
938            >,
939            offset: usize,
940            _depth: fidl::encoding::Depth,
941        ) -> fidl::Result<()> {
942            encoder.debug_check_bounds::<RegisterRegisterDeviceRequest>(offset);
943            // Delegate to tuple encoding.
944            fidl::encoding::Encode::<RegisterRegisterDeviceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
945                (
946                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
947                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DriverMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.driver),
948                ),
949                encoder, offset, _depth
950            )
951        }
952    }
953    unsafe impl<
954            T0: fidl::encoding::Encode<
955                fidl::encoding::BoundedString<32>,
956                fidl::encoding::DefaultFuchsiaResourceDialect,
957            >,
958            T1: fidl::encoding::Encode<
959                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DriverMarker>>,
960                fidl::encoding::DefaultFuchsiaResourceDialect,
961            >,
962        >
963        fidl::encoding::Encode<
964            RegisterRegisterDeviceRequest,
965            fidl::encoding::DefaultFuchsiaResourceDialect,
966        > for (T0, T1)
967    {
968        #[inline]
969        unsafe fn encode(
970            self,
971            encoder: &mut fidl::encoding::Encoder<
972                '_,
973                fidl::encoding::DefaultFuchsiaResourceDialect,
974            >,
975            offset: usize,
976            depth: fidl::encoding::Depth,
977        ) -> fidl::Result<()> {
978            encoder.debug_check_bounds::<RegisterRegisterDeviceRequest>(offset);
979            // Zero out padding regions. There's no need to apply masks
980            // because the unmasked parts will be overwritten by fields.
981            unsafe {
982                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
983                (ptr as *mut u64).write_unaligned(0);
984            }
985            // Write the fields.
986            self.0.encode(encoder, offset + 0, depth)?;
987            self.1.encode(encoder, offset + 16, depth)?;
988            Ok(())
989        }
990    }
991
992    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
993        for RegisterRegisterDeviceRequest
994    {
995        #[inline(always)]
996        fn new_empty() -> Self {
997            Self {
998                name: fidl::new_empty!(
999                    fidl::encoding::BoundedString<32>,
1000                    fidl::encoding::DefaultFuchsiaResourceDialect
1001                ),
1002                driver: fidl::new_empty!(
1003                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DriverMarker>>,
1004                    fidl::encoding::DefaultFuchsiaResourceDialect
1005                ),
1006            }
1007        }
1008
1009        #[inline]
1010        unsafe fn decode(
1011            &mut self,
1012            decoder: &mut fidl::encoding::Decoder<
1013                '_,
1014                fidl::encoding::DefaultFuchsiaResourceDialect,
1015            >,
1016            offset: usize,
1017            _depth: fidl::encoding::Depth,
1018        ) -> fidl::Result<()> {
1019            decoder.debug_check_bounds::<Self>(offset);
1020            // Verify that padding bytes are zero.
1021            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1022            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1023            let mask = 0xffffffff00000000u64;
1024            let maskedval = padval & mask;
1025            if maskedval != 0 {
1026                return Err(fidl::Error::NonZeroPadding {
1027                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1028                });
1029            }
1030            fidl::decode!(
1031                fidl::encoding::BoundedString<32>,
1032                fidl::encoding::DefaultFuchsiaResourceDialect,
1033                &mut self.name,
1034                decoder,
1035                offset + 0,
1036                _depth
1037            )?;
1038            fidl::decode!(
1039                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<DriverMarker>>,
1040                fidl::encoding::DefaultFuchsiaResourceDialect,
1041                &mut self.driver,
1042                decoder,
1043                offset + 16,
1044                _depth
1045            )?;
1046            Ok(())
1047        }
1048    }
1049
1050    impl Protocols {
1051        #[inline(always)]
1052        fn max_ordinal_present(&self) -> u64 {
1053            if let Some(_) = self.capabilities {
1054                return 15;
1055            }
1056            if let Some(_) = self.thread_feature {
1057                return 14;
1058            }
1059            if let Some(_) = self.telemetry_provider {
1060                return 13;
1061            }
1062            if let Some(_) = self.meshcop {
1063                return 12;
1064            }
1065            if let Some(_) = self.experimental_device_extra {
1066                return 11;
1067            }
1068            if let Some(_) = self.experimental_device {
1069                return 10;
1070            }
1071            if let Some(_) = self.energy_scan {
1072                return 9;
1073            }
1074            if let Some(_) = self.thread_dataset {
1075                return 8;
1076            }
1077            if let Some(_) = self.thread_legacy_joining {
1078                return 7;
1079            }
1080            if let Some(_) = self.counters {
1081                return 6;
1082            }
1083            if let Some(_) = self.device_route_extra {
1084                return 5;
1085            }
1086            if let Some(_) = self.device_route {
1087                return 4;
1088            }
1089            if let Some(_) = self.device_test {
1090                return 3;
1091            }
1092            if let Some(_) = self.device_extra {
1093                return 2;
1094            }
1095            if let Some(_) = self.device {
1096                return 1;
1097            }
1098            0
1099        }
1100    }
1101
1102    impl fidl::encoding::ResourceTypeMarker for Protocols {
1103        type Borrowed<'a> = &'a mut Self;
1104        fn take_or_borrow<'a>(
1105            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1106        ) -> Self::Borrowed<'a> {
1107            value
1108        }
1109    }
1110
1111    unsafe impl fidl::encoding::TypeMarker for Protocols {
1112        type Owned = Self;
1113
1114        #[inline(always)]
1115        fn inline_align(_context: fidl::encoding::Context) -> usize {
1116            8
1117        }
1118
1119        #[inline(always)]
1120        fn inline_size(_context: fidl::encoding::Context) -> usize {
1121            16
1122        }
1123    }
1124
1125    unsafe impl fidl::encoding::Encode<Protocols, fidl::encoding::DefaultFuchsiaResourceDialect>
1126        for &mut Protocols
1127    {
1128        unsafe fn encode(
1129            self,
1130            encoder: &mut fidl::encoding::Encoder<
1131                '_,
1132                fidl::encoding::DefaultFuchsiaResourceDialect,
1133            >,
1134            offset: usize,
1135            mut depth: fidl::encoding::Depth,
1136        ) -> fidl::Result<()> {
1137            encoder.debug_check_bounds::<Protocols>(offset);
1138            // Vector header
1139            let max_ordinal: u64 = self.max_ordinal_present();
1140            encoder.write_num(max_ordinal, offset);
1141            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1142            // Calling encoder.out_of_line_offset(0) is not allowed.
1143            if max_ordinal == 0 {
1144                return Ok(());
1145            }
1146            depth.increment()?;
1147            let envelope_size = 8;
1148            let bytes_len = max_ordinal as usize * envelope_size;
1149            #[allow(unused_variables)]
1150            let offset = encoder.out_of_line_offset(bytes_len);
1151            let mut _prev_end_offset: usize = 0;
1152            if 1 > max_ordinal {
1153                return Ok(());
1154            }
1155
1156            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1157            // are envelope_size bytes.
1158            let cur_offset: usize = (1 - 1) * envelope_size;
1159
1160            // Zero reserved fields.
1161            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1162
1163            // Safety:
1164            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1165            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1166            //   envelope_size bytes, there is always sufficient room.
1167            fidl::encoding::encode_in_envelope_optional::<
1168                fidl::encoding::Endpoint<
1169                    fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_device::DeviceMarker>,
1170                >,
1171                fidl::encoding::DefaultFuchsiaResourceDialect,
1172            >(
1173                self.device.as_mut().map(
1174                    <fidl::encoding::Endpoint<
1175                        fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_device::DeviceMarker>,
1176                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1177                ),
1178                encoder,
1179                offset + cur_offset,
1180                depth,
1181            )?;
1182
1183            _prev_end_offset = cur_offset + envelope_size;
1184            if 2 > max_ordinal {
1185                return Ok(());
1186            }
1187
1188            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1189            // are envelope_size bytes.
1190            let cur_offset: usize = (2 - 1) * envelope_size;
1191
1192            // Zero reserved fields.
1193            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1194
1195            // Safety:
1196            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1197            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1198            //   envelope_size bytes, there is always sufficient room.
1199            fidl::encoding::encode_in_envelope_optional::<
1200                fidl::encoding::Endpoint<
1201                    fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_device::DeviceExtraMarker>,
1202                >,
1203                fidl::encoding::DefaultFuchsiaResourceDialect,
1204            >(
1205                self.device_extra.as_mut().map(
1206                    <fidl::encoding::Endpoint<
1207                        fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_device::DeviceExtraMarker>,
1208                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1209                ),
1210                encoder,
1211                offset + cur_offset,
1212                depth,
1213            )?;
1214
1215            _prev_end_offset = cur_offset + envelope_size;
1216            if 3 > max_ordinal {
1217                return Ok(());
1218            }
1219
1220            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1221            // are envelope_size bytes.
1222            let cur_offset: usize = (3 - 1) * envelope_size;
1223
1224            // Zero reserved fields.
1225            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1226
1227            // Safety:
1228            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1229            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1230            //   envelope_size bytes, there is always sufficient room.
1231            fidl::encoding::encode_in_envelope_optional::<
1232                fidl::encoding::Endpoint<
1233                    fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_test::DeviceTestMarker>,
1234                >,
1235                fidl::encoding::DefaultFuchsiaResourceDialect,
1236            >(
1237                self.device_test.as_mut().map(
1238                    <fidl::encoding::Endpoint<
1239                        fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_test::DeviceTestMarker>,
1240                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1241                ),
1242                encoder,
1243                offset + cur_offset,
1244                depth,
1245            )?;
1246
1247            _prev_end_offset = cur_offset + envelope_size;
1248            if 4 > max_ordinal {
1249                return Ok(());
1250            }
1251
1252            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1253            // are envelope_size bytes.
1254            let cur_offset: usize = (4 - 1) * envelope_size;
1255
1256            // Zero reserved fields.
1257            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1258
1259            // Safety:
1260            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1261            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1262            //   envelope_size bytes, there is always sufficient room.
1263            fidl::encoding::encode_in_envelope_optional::<
1264                fidl::encoding::Endpoint<
1265                    fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_experimental::DeviceRouteMarker>,
1266                >,
1267                fidl::encoding::DefaultFuchsiaResourceDialect,
1268            >(
1269                self.device_route.as_mut().map(
1270                    <fidl::encoding::Endpoint<
1271                        fidl::endpoints::ServerEnd<
1272                            fidl_fuchsia_lowpan_experimental::DeviceRouteMarker,
1273                        >,
1274                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1275                ),
1276                encoder,
1277                offset + cur_offset,
1278                depth,
1279            )?;
1280
1281            _prev_end_offset = cur_offset + envelope_size;
1282            if 5 > max_ordinal {
1283                return Ok(());
1284            }
1285
1286            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1287            // are envelope_size bytes.
1288            let cur_offset: usize = (5 - 1) * envelope_size;
1289
1290            // Zero reserved fields.
1291            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1292
1293            // Safety:
1294            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1295            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1296            //   envelope_size bytes, there is always sufficient room.
1297            fidl::encoding::encode_in_envelope_optional::<
1298                fidl::encoding::Endpoint<
1299                    fidl::endpoints::ServerEnd<
1300                        fidl_fuchsia_lowpan_experimental::DeviceRouteExtraMarker,
1301                    >,
1302                >,
1303                fidl::encoding::DefaultFuchsiaResourceDialect,
1304            >(
1305                self.device_route_extra.as_mut().map(
1306                    <fidl::encoding::Endpoint<
1307                        fidl::endpoints::ServerEnd<
1308                            fidl_fuchsia_lowpan_experimental::DeviceRouteExtraMarker,
1309                        >,
1310                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1311                ),
1312                encoder,
1313                offset + cur_offset,
1314                depth,
1315            )?;
1316
1317            _prev_end_offset = cur_offset + envelope_size;
1318            if 6 > max_ordinal {
1319                return Ok(());
1320            }
1321
1322            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1323            // are envelope_size bytes.
1324            let cur_offset: usize = (6 - 1) * envelope_size;
1325
1326            // Zero reserved fields.
1327            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1328
1329            // Safety:
1330            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1331            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1332            //   envelope_size bytes, there is always sufficient room.
1333            fidl::encoding::encode_in_envelope_optional::<
1334                fidl::encoding::Endpoint<
1335                    fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_device::CountersMarker>,
1336                >,
1337                fidl::encoding::DefaultFuchsiaResourceDialect,
1338            >(
1339                self.counters.as_mut().map(
1340                    <fidl::encoding::Endpoint<
1341                        fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_device::CountersMarker>,
1342                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1343                ),
1344                encoder,
1345                offset + cur_offset,
1346                depth,
1347            )?;
1348
1349            _prev_end_offset = cur_offset + envelope_size;
1350            if 7 > max_ordinal {
1351                return Ok(());
1352            }
1353
1354            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1355            // are envelope_size bytes.
1356            let cur_offset: usize = (7 - 1) * envelope_size;
1357
1358            // Zero reserved fields.
1359            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1360
1361            // Safety:
1362            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1363            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1364            //   envelope_size bytes, there is always sufficient room.
1365            fidl::encoding::encode_in_envelope_optional::<
1366                fidl::encoding::Endpoint<
1367                    fidl::endpoints::ServerEnd<
1368                        fidl_fuchsia_lowpan_experimental::LegacyJoiningMarker,
1369                    >,
1370                >,
1371                fidl::encoding::DefaultFuchsiaResourceDialect,
1372            >(
1373                self.thread_legacy_joining.as_mut().map(
1374                    <fidl::encoding::Endpoint<
1375                        fidl::endpoints::ServerEnd<
1376                            fidl_fuchsia_lowpan_experimental::LegacyJoiningMarker,
1377                        >,
1378                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1379                ),
1380                encoder,
1381                offset + cur_offset,
1382                depth,
1383            )?;
1384
1385            _prev_end_offset = cur_offset + envelope_size;
1386            if 8 > max_ordinal {
1387                return Ok(());
1388            }
1389
1390            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1391            // are envelope_size bytes.
1392            let cur_offset: usize = (8 - 1) * envelope_size;
1393
1394            // Zero reserved fields.
1395            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1396
1397            // Safety:
1398            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1399            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1400            //   envelope_size bytes, there is always sufficient room.
1401            fidl::encoding::encode_in_envelope_optional::<
1402                fidl::encoding::Endpoint<
1403                    fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_thread::DatasetMarker>,
1404                >,
1405                fidl::encoding::DefaultFuchsiaResourceDialect,
1406            >(
1407                self.thread_dataset.as_mut().map(
1408                    <fidl::encoding::Endpoint<
1409                        fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_thread::DatasetMarker>,
1410                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1411                ),
1412                encoder,
1413                offset + cur_offset,
1414                depth,
1415            )?;
1416
1417            _prev_end_offset = cur_offset + envelope_size;
1418            if 9 > max_ordinal {
1419                return Ok(());
1420            }
1421
1422            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1423            // are envelope_size bytes.
1424            let cur_offset: usize = (9 - 1) * envelope_size;
1425
1426            // Zero reserved fields.
1427            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1428
1429            // Safety:
1430            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1431            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1432            //   envelope_size bytes, there is always sufficient room.
1433            fidl::encoding::encode_in_envelope_optional::<
1434                fidl::encoding::Endpoint<
1435                    fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_device::EnergyScanMarker>,
1436                >,
1437                fidl::encoding::DefaultFuchsiaResourceDialect,
1438            >(
1439                self.energy_scan.as_mut().map(
1440                    <fidl::encoding::Endpoint<
1441                        fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_device::EnergyScanMarker>,
1442                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1443                ),
1444                encoder,
1445                offset + cur_offset,
1446                depth,
1447            )?;
1448
1449            _prev_end_offset = cur_offset + envelope_size;
1450            if 10 > max_ordinal {
1451                return Ok(());
1452            }
1453
1454            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1455            // are envelope_size bytes.
1456            let cur_offset: usize = (10 - 1) * envelope_size;
1457
1458            // Zero reserved fields.
1459            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1460
1461            // Safety:
1462            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1463            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1464            //   envelope_size bytes, there is always sufficient room.
1465            fidl::encoding::encode_in_envelope_optional::<
1466                fidl::encoding::Endpoint<
1467                    fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_experimental::DeviceMarker>,
1468                >,
1469                fidl::encoding::DefaultFuchsiaResourceDialect,
1470            >(
1471                self.experimental_device.as_mut().map(
1472                    <fidl::encoding::Endpoint<
1473                        fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_experimental::DeviceMarker>,
1474                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1475                ),
1476                encoder,
1477                offset + cur_offset,
1478                depth,
1479            )?;
1480
1481            _prev_end_offset = cur_offset + envelope_size;
1482            if 11 > max_ordinal {
1483                return Ok(());
1484            }
1485
1486            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1487            // are envelope_size bytes.
1488            let cur_offset: usize = (11 - 1) * envelope_size;
1489
1490            // Zero reserved fields.
1491            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1492
1493            // Safety:
1494            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1495            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1496            //   envelope_size bytes, there is always sufficient room.
1497            fidl::encoding::encode_in_envelope_optional::<
1498                fidl::encoding::Endpoint<
1499                    fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_experimental::DeviceExtraMarker>,
1500                >,
1501                fidl::encoding::DefaultFuchsiaResourceDialect,
1502            >(
1503                self.experimental_device_extra.as_mut().map(
1504                    <fidl::encoding::Endpoint<
1505                        fidl::endpoints::ServerEnd<
1506                            fidl_fuchsia_lowpan_experimental::DeviceExtraMarker,
1507                        >,
1508                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1509                ),
1510                encoder,
1511                offset + cur_offset,
1512                depth,
1513            )?;
1514
1515            _prev_end_offset = cur_offset + envelope_size;
1516            if 12 > max_ordinal {
1517                return Ok(());
1518            }
1519
1520            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1521            // are envelope_size bytes.
1522            let cur_offset: usize = (12 - 1) * envelope_size;
1523
1524            // Zero reserved fields.
1525            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1526
1527            // Safety:
1528            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1529            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1530            //   envelope_size bytes, there is always sufficient room.
1531            fidl::encoding::encode_in_envelope_optional::<
1532                fidl::encoding::Endpoint<
1533                    fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_thread::MeshcopMarker>,
1534                >,
1535                fidl::encoding::DefaultFuchsiaResourceDialect,
1536            >(
1537                self.meshcop.as_mut().map(
1538                    <fidl::encoding::Endpoint<
1539                        fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_thread::MeshcopMarker>,
1540                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1541                ),
1542                encoder,
1543                offset + cur_offset,
1544                depth,
1545            )?;
1546
1547            _prev_end_offset = cur_offset + envelope_size;
1548            if 13 > max_ordinal {
1549                return Ok(());
1550            }
1551
1552            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1553            // are envelope_size bytes.
1554            let cur_offset: usize = (13 - 1) * envelope_size;
1555
1556            // Zero reserved fields.
1557            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1558
1559            // Safety:
1560            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1561            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1562            //   envelope_size bytes, there is always sufficient room.
1563            fidl::encoding::encode_in_envelope_optional::<
1564                fidl::encoding::Endpoint<
1565                    fidl::endpoints::ServerEnd<
1566                        fidl_fuchsia_lowpan_experimental::TelemetryProviderMarker,
1567                    >,
1568                >,
1569                fidl::encoding::DefaultFuchsiaResourceDialect,
1570            >(
1571                self.telemetry_provider.as_mut().map(
1572                    <fidl::encoding::Endpoint<
1573                        fidl::endpoints::ServerEnd<
1574                            fidl_fuchsia_lowpan_experimental::TelemetryProviderMarker,
1575                        >,
1576                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1577                ),
1578                encoder,
1579                offset + cur_offset,
1580                depth,
1581            )?;
1582
1583            _prev_end_offset = cur_offset + envelope_size;
1584            if 14 > max_ordinal {
1585                return Ok(());
1586            }
1587
1588            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1589            // are envelope_size bytes.
1590            let cur_offset: usize = (14 - 1) * envelope_size;
1591
1592            // Zero reserved fields.
1593            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1594
1595            // Safety:
1596            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1597            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1598            //   envelope_size bytes, there is always sufficient room.
1599            fidl::encoding::encode_in_envelope_optional::<
1600                fidl::encoding::Endpoint<
1601                    fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_thread::FeatureMarker>,
1602                >,
1603                fidl::encoding::DefaultFuchsiaResourceDialect,
1604            >(
1605                self.thread_feature.as_mut().map(
1606                    <fidl::encoding::Endpoint<
1607                        fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_thread::FeatureMarker>,
1608                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1609                ),
1610                encoder,
1611                offset + cur_offset,
1612                depth,
1613            )?;
1614
1615            _prev_end_offset = cur_offset + envelope_size;
1616            if 15 > max_ordinal {
1617                return Ok(());
1618            }
1619
1620            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1621            // are envelope_size bytes.
1622            let cur_offset: usize = (15 - 1) * envelope_size;
1623
1624            // Zero reserved fields.
1625            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1626
1627            // Safety:
1628            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1629            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1630            //   envelope_size bytes, there is always sufficient room.
1631            fidl::encoding::encode_in_envelope_optional::<
1632                fidl::encoding::Endpoint<
1633                    fidl::endpoints::ServerEnd<
1634                        fidl_fuchsia_lowpan_thread::ThreadCapabilitiesMarker,
1635                    >,
1636                >,
1637                fidl::encoding::DefaultFuchsiaResourceDialect,
1638            >(
1639                self.capabilities.as_mut().map(
1640                    <fidl::encoding::Endpoint<
1641                        fidl::endpoints::ServerEnd<
1642                            fidl_fuchsia_lowpan_thread::ThreadCapabilitiesMarker,
1643                        >,
1644                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
1645                ),
1646                encoder,
1647                offset + cur_offset,
1648                depth,
1649            )?;
1650
1651            _prev_end_offset = cur_offset + envelope_size;
1652
1653            Ok(())
1654        }
1655    }
1656
1657    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Protocols {
1658        #[inline(always)]
1659        fn new_empty() -> Self {
1660            Self::default()
1661        }
1662
1663        unsafe fn decode(
1664            &mut self,
1665            decoder: &mut fidl::encoding::Decoder<
1666                '_,
1667                fidl::encoding::DefaultFuchsiaResourceDialect,
1668            >,
1669            offset: usize,
1670            mut depth: fidl::encoding::Depth,
1671        ) -> fidl::Result<()> {
1672            decoder.debug_check_bounds::<Self>(offset);
1673            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1674                None => return Err(fidl::Error::NotNullable),
1675                Some(len) => len,
1676            };
1677            // Calling decoder.out_of_line_offset(0) is not allowed.
1678            if len == 0 {
1679                return Ok(());
1680            };
1681            depth.increment()?;
1682            let envelope_size = 8;
1683            let bytes_len = len * envelope_size;
1684            let offset = decoder.out_of_line_offset(bytes_len)?;
1685            // Decode the envelope for each type.
1686            let mut _next_ordinal_to_read = 0;
1687            let mut next_offset = offset;
1688            let end_offset = offset + bytes_len;
1689            _next_ordinal_to_read += 1;
1690            if next_offset >= end_offset {
1691                return Ok(());
1692            }
1693
1694            // Decode unknown envelopes for gaps in ordinals.
1695            while _next_ordinal_to_read < 1 {
1696                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1697                _next_ordinal_to_read += 1;
1698                next_offset += envelope_size;
1699            }
1700
1701            let next_out_of_line = decoder.next_out_of_line();
1702            let handles_before = decoder.remaining_handles();
1703            if let Some((inlined, num_bytes, num_handles)) =
1704                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1705            {
1706                let member_inline_size = <fidl::encoding::Endpoint<
1707                    fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_device::DeviceMarker>,
1708                > as fidl::encoding::TypeMarker>::inline_size(
1709                    decoder.context
1710                );
1711                if inlined != (member_inline_size <= 4) {
1712                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1713                }
1714                let inner_offset;
1715                let mut inner_depth = depth.clone();
1716                if inlined {
1717                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1718                    inner_offset = next_offset;
1719                } else {
1720                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1721                    inner_depth.increment()?;
1722                }
1723                let val_ref = self.device.get_or_insert_with(|| {
1724                    fidl::new_empty!(
1725                        fidl::encoding::Endpoint<
1726                            fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_device::DeviceMarker>,
1727                        >,
1728                        fidl::encoding::DefaultFuchsiaResourceDialect
1729                    )
1730                });
1731                fidl::decode!(
1732                    fidl::encoding::Endpoint<
1733                        fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_device::DeviceMarker>,
1734                    >,
1735                    fidl::encoding::DefaultFuchsiaResourceDialect,
1736                    val_ref,
1737                    decoder,
1738                    inner_offset,
1739                    inner_depth
1740                )?;
1741                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1742                {
1743                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1744                }
1745                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1746                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1747                }
1748            }
1749
1750            next_offset += envelope_size;
1751            _next_ordinal_to_read += 1;
1752            if next_offset >= end_offset {
1753                return Ok(());
1754            }
1755
1756            // Decode unknown envelopes for gaps in ordinals.
1757            while _next_ordinal_to_read < 2 {
1758                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1759                _next_ordinal_to_read += 1;
1760                next_offset += envelope_size;
1761            }
1762
1763            let next_out_of_line = decoder.next_out_of_line();
1764            let handles_before = decoder.remaining_handles();
1765            if let Some((inlined, num_bytes, num_handles)) =
1766                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1767            {
1768                let member_inline_size = <fidl::encoding::Endpoint<
1769                    fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_device::DeviceExtraMarker>,
1770                > as fidl::encoding::TypeMarker>::inline_size(
1771                    decoder.context
1772                );
1773                if inlined != (member_inline_size <= 4) {
1774                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1775                }
1776                let inner_offset;
1777                let mut inner_depth = depth.clone();
1778                if inlined {
1779                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1780                    inner_offset = next_offset;
1781                } else {
1782                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1783                    inner_depth.increment()?;
1784                }
1785                let val_ref = self.device_extra.get_or_insert_with(|| {
1786                    fidl::new_empty!(
1787                        fidl::encoding::Endpoint<
1788                            fidl::endpoints::ServerEnd<
1789                                fidl_fuchsia_lowpan_device::DeviceExtraMarker,
1790                            >,
1791                        >,
1792                        fidl::encoding::DefaultFuchsiaResourceDialect
1793                    )
1794                });
1795                fidl::decode!(
1796                    fidl::encoding::Endpoint<
1797                        fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_device::DeviceExtraMarker>,
1798                    >,
1799                    fidl::encoding::DefaultFuchsiaResourceDialect,
1800                    val_ref,
1801                    decoder,
1802                    inner_offset,
1803                    inner_depth
1804                )?;
1805                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1806                {
1807                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1808                }
1809                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1810                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1811                }
1812            }
1813
1814            next_offset += envelope_size;
1815            _next_ordinal_to_read += 1;
1816            if next_offset >= end_offset {
1817                return Ok(());
1818            }
1819
1820            // Decode unknown envelopes for gaps in ordinals.
1821            while _next_ordinal_to_read < 3 {
1822                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1823                _next_ordinal_to_read += 1;
1824                next_offset += envelope_size;
1825            }
1826
1827            let next_out_of_line = decoder.next_out_of_line();
1828            let handles_before = decoder.remaining_handles();
1829            if let Some((inlined, num_bytes, num_handles)) =
1830                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1831            {
1832                let member_inline_size = <fidl::encoding::Endpoint<
1833                    fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_test::DeviceTestMarker>,
1834                > as fidl::encoding::TypeMarker>::inline_size(
1835                    decoder.context
1836                );
1837                if inlined != (member_inline_size <= 4) {
1838                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1839                }
1840                let inner_offset;
1841                let mut inner_depth = depth.clone();
1842                if inlined {
1843                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1844                    inner_offset = next_offset;
1845                } else {
1846                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1847                    inner_depth.increment()?;
1848                }
1849                let val_ref = self.device_test.get_or_insert_with(|| {
1850                    fidl::new_empty!(
1851                        fidl::encoding::Endpoint<
1852                            fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_test::DeviceTestMarker>,
1853                        >,
1854                        fidl::encoding::DefaultFuchsiaResourceDialect
1855                    )
1856                });
1857                fidl::decode!(
1858                    fidl::encoding::Endpoint<
1859                        fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_test::DeviceTestMarker>,
1860                    >,
1861                    fidl::encoding::DefaultFuchsiaResourceDialect,
1862                    val_ref,
1863                    decoder,
1864                    inner_offset,
1865                    inner_depth
1866                )?;
1867                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1868                {
1869                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1870                }
1871                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1872                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1873                }
1874            }
1875
1876            next_offset += envelope_size;
1877            _next_ordinal_to_read += 1;
1878            if next_offset >= end_offset {
1879                return Ok(());
1880            }
1881
1882            // Decode unknown envelopes for gaps in ordinals.
1883            while _next_ordinal_to_read < 4 {
1884                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1885                _next_ordinal_to_read += 1;
1886                next_offset += envelope_size;
1887            }
1888
1889            let next_out_of_line = decoder.next_out_of_line();
1890            let handles_before = decoder.remaining_handles();
1891            if let Some((inlined, num_bytes, num_handles)) =
1892                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1893            {
1894                let member_inline_size = <fidl::encoding::Endpoint<
1895                    fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_experimental::DeviceRouteMarker>,
1896                > as fidl::encoding::TypeMarker>::inline_size(
1897                    decoder.context
1898                );
1899                if inlined != (member_inline_size <= 4) {
1900                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1901                }
1902                let inner_offset;
1903                let mut inner_depth = depth.clone();
1904                if inlined {
1905                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1906                    inner_offset = next_offset;
1907                } else {
1908                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1909                    inner_depth.increment()?;
1910                }
1911                let val_ref = self.device_route.get_or_insert_with(|| {
1912                    fidl::new_empty!(
1913                        fidl::encoding::Endpoint<
1914                            fidl::endpoints::ServerEnd<
1915                                fidl_fuchsia_lowpan_experimental::DeviceRouteMarker,
1916                            >,
1917                        >,
1918                        fidl::encoding::DefaultFuchsiaResourceDialect
1919                    )
1920                });
1921                fidl::decode!(
1922                    fidl::encoding::Endpoint<
1923                        fidl::endpoints::ServerEnd<
1924                            fidl_fuchsia_lowpan_experimental::DeviceRouteMarker,
1925                        >,
1926                    >,
1927                    fidl::encoding::DefaultFuchsiaResourceDialect,
1928                    val_ref,
1929                    decoder,
1930                    inner_offset,
1931                    inner_depth
1932                )?;
1933                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1934                {
1935                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1936                }
1937                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1938                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1939                }
1940            }
1941
1942            next_offset += envelope_size;
1943            _next_ordinal_to_read += 1;
1944            if next_offset >= end_offset {
1945                return Ok(());
1946            }
1947
1948            // Decode unknown envelopes for gaps in ordinals.
1949            while _next_ordinal_to_read < 5 {
1950                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1951                _next_ordinal_to_read += 1;
1952                next_offset += envelope_size;
1953            }
1954
1955            let next_out_of_line = decoder.next_out_of_line();
1956            let handles_before = decoder.remaining_handles();
1957            if let Some((inlined, num_bytes, num_handles)) =
1958                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1959            {
1960                let member_inline_size = <fidl::encoding::Endpoint<
1961                    fidl::endpoints::ServerEnd<
1962                        fidl_fuchsia_lowpan_experimental::DeviceRouteExtraMarker,
1963                    >,
1964                > as fidl::encoding::TypeMarker>::inline_size(
1965                    decoder.context
1966                );
1967                if inlined != (member_inline_size <= 4) {
1968                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1969                }
1970                let inner_offset;
1971                let mut inner_depth = depth.clone();
1972                if inlined {
1973                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1974                    inner_offset = next_offset;
1975                } else {
1976                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1977                    inner_depth.increment()?;
1978                }
1979                let val_ref = self.device_route_extra.get_or_insert_with(|| {
1980                    fidl::new_empty!(
1981                        fidl::encoding::Endpoint<
1982                            fidl::endpoints::ServerEnd<
1983                                fidl_fuchsia_lowpan_experimental::DeviceRouteExtraMarker,
1984                            >,
1985                        >,
1986                        fidl::encoding::DefaultFuchsiaResourceDialect
1987                    )
1988                });
1989                fidl::decode!(
1990                    fidl::encoding::Endpoint<
1991                        fidl::endpoints::ServerEnd<
1992                            fidl_fuchsia_lowpan_experimental::DeviceRouteExtraMarker,
1993                        >,
1994                    >,
1995                    fidl::encoding::DefaultFuchsiaResourceDialect,
1996                    val_ref,
1997                    decoder,
1998                    inner_offset,
1999                    inner_depth
2000                )?;
2001                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2002                {
2003                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2004                }
2005                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2006                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2007                }
2008            }
2009
2010            next_offset += envelope_size;
2011            _next_ordinal_to_read += 1;
2012            if next_offset >= end_offset {
2013                return Ok(());
2014            }
2015
2016            // Decode unknown envelopes for gaps in ordinals.
2017            while _next_ordinal_to_read < 6 {
2018                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2019                _next_ordinal_to_read += 1;
2020                next_offset += envelope_size;
2021            }
2022
2023            let next_out_of_line = decoder.next_out_of_line();
2024            let handles_before = decoder.remaining_handles();
2025            if let Some((inlined, num_bytes, num_handles)) =
2026                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2027            {
2028                let member_inline_size = <fidl::encoding::Endpoint<
2029                    fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_device::CountersMarker>,
2030                > as fidl::encoding::TypeMarker>::inline_size(
2031                    decoder.context
2032                );
2033                if inlined != (member_inline_size <= 4) {
2034                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2035                }
2036                let inner_offset;
2037                let mut inner_depth = depth.clone();
2038                if inlined {
2039                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2040                    inner_offset = next_offset;
2041                } else {
2042                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2043                    inner_depth.increment()?;
2044                }
2045                let val_ref = self.counters.get_or_insert_with(|| {
2046                    fidl::new_empty!(
2047                        fidl::encoding::Endpoint<
2048                            fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_device::CountersMarker>,
2049                        >,
2050                        fidl::encoding::DefaultFuchsiaResourceDialect
2051                    )
2052                });
2053                fidl::decode!(
2054                    fidl::encoding::Endpoint<
2055                        fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_device::CountersMarker>,
2056                    >,
2057                    fidl::encoding::DefaultFuchsiaResourceDialect,
2058                    val_ref,
2059                    decoder,
2060                    inner_offset,
2061                    inner_depth
2062                )?;
2063                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2064                {
2065                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2066                }
2067                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2068                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2069                }
2070            }
2071
2072            next_offset += envelope_size;
2073            _next_ordinal_to_read += 1;
2074            if next_offset >= end_offset {
2075                return Ok(());
2076            }
2077
2078            // Decode unknown envelopes for gaps in ordinals.
2079            while _next_ordinal_to_read < 7 {
2080                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2081                _next_ordinal_to_read += 1;
2082                next_offset += envelope_size;
2083            }
2084
2085            let next_out_of_line = decoder.next_out_of_line();
2086            let handles_before = decoder.remaining_handles();
2087            if let Some((inlined, num_bytes, num_handles)) =
2088                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2089            {
2090                let member_inline_size = <fidl::encoding::Endpoint<
2091                    fidl::endpoints::ServerEnd<
2092                        fidl_fuchsia_lowpan_experimental::LegacyJoiningMarker,
2093                    >,
2094                > as fidl::encoding::TypeMarker>::inline_size(
2095                    decoder.context
2096                );
2097                if inlined != (member_inline_size <= 4) {
2098                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2099                }
2100                let inner_offset;
2101                let mut inner_depth = depth.clone();
2102                if inlined {
2103                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2104                    inner_offset = next_offset;
2105                } else {
2106                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2107                    inner_depth.increment()?;
2108                }
2109                let val_ref = self.thread_legacy_joining.get_or_insert_with(|| {
2110                    fidl::new_empty!(
2111                        fidl::encoding::Endpoint<
2112                            fidl::endpoints::ServerEnd<
2113                                fidl_fuchsia_lowpan_experimental::LegacyJoiningMarker,
2114                            >,
2115                        >,
2116                        fidl::encoding::DefaultFuchsiaResourceDialect
2117                    )
2118                });
2119                fidl::decode!(
2120                    fidl::encoding::Endpoint<
2121                        fidl::endpoints::ServerEnd<
2122                            fidl_fuchsia_lowpan_experimental::LegacyJoiningMarker,
2123                        >,
2124                    >,
2125                    fidl::encoding::DefaultFuchsiaResourceDialect,
2126                    val_ref,
2127                    decoder,
2128                    inner_offset,
2129                    inner_depth
2130                )?;
2131                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2132                {
2133                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2134                }
2135                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2136                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2137                }
2138            }
2139
2140            next_offset += envelope_size;
2141            _next_ordinal_to_read += 1;
2142            if next_offset >= end_offset {
2143                return Ok(());
2144            }
2145
2146            // Decode unknown envelopes for gaps in ordinals.
2147            while _next_ordinal_to_read < 8 {
2148                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2149                _next_ordinal_to_read += 1;
2150                next_offset += envelope_size;
2151            }
2152
2153            let next_out_of_line = decoder.next_out_of_line();
2154            let handles_before = decoder.remaining_handles();
2155            if let Some((inlined, num_bytes, num_handles)) =
2156                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2157            {
2158                let member_inline_size = <fidl::encoding::Endpoint<
2159                    fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_thread::DatasetMarker>,
2160                > as fidl::encoding::TypeMarker>::inline_size(
2161                    decoder.context
2162                );
2163                if inlined != (member_inline_size <= 4) {
2164                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2165                }
2166                let inner_offset;
2167                let mut inner_depth = depth.clone();
2168                if inlined {
2169                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2170                    inner_offset = next_offset;
2171                } else {
2172                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2173                    inner_depth.increment()?;
2174                }
2175                let val_ref = self.thread_dataset.get_or_insert_with(|| {
2176                    fidl::new_empty!(
2177                        fidl::encoding::Endpoint<
2178                            fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_thread::DatasetMarker>,
2179                        >,
2180                        fidl::encoding::DefaultFuchsiaResourceDialect
2181                    )
2182                });
2183                fidl::decode!(
2184                    fidl::encoding::Endpoint<
2185                        fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_thread::DatasetMarker>,
2186                    >,
2187                    fidl::encoding::DefaultFuchsiaResourceDialect,
2188                    val_ref,
2189                    decoder,
2190                    inner_offset,
2191                    inner_depth
2192                )?;
2193                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2194                {
2195                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2196                }
2197                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2198                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2199                }
2200            }
2201
2202            next_offset += envelope_size;
2203            _next_ordinal_to_read += 1;
2204            if next_offset >= end_offset {
2205                return Ok(());
2206            }
2207
2208            // Decode unknown envelopes for gaps in ordinals.
2209            while _next_ordinal_to_read < 9 {
2210                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2211                _next_ordinal_to_read += 1;
2212                next_offset += envelope_size;
2213            }
2214
2215            let next_out_of_line = decoder.next_out_of_line();
2216            let handles_before = decoder.remaining_handles();
2217            if let Some((inlined, num_bytes, num_handles)) =
2218                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2219            {
2220                let member_inline_size = <fidl::encoding::Endpoint<
2221                    fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_device::EnergyScanMarker>,
2222                > as fidl::encoding::TypeMarker>::inline_size(
2223                    decoder.context
2224                );
2225                if inlined != (member_inline_size <= 4) {
2226                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2227                }
2228                let inner_offset;
2229                let mut inner_depth = depth.clone();
2230                if inlined {
2231                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2232                    inner_offset = next_offset;
2233                } else {
2234                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2235                    inner_depth.increment()?;
2236                }
2237                let val_ref = self.energy_scan.get_or_insert_with(|| {
2238                    fidl::new_empty!(
2239                        fidl::encoding::Endpoint<
2240                            fidl::endpoints::ServerEnd<
2241                                fidl_fuchsia_lowpan_device::EnergyScanMarker,
2242                            >,
2243                        >,
2244                        fidl::encoding::DefaultFuchsiaResourceDialect
2245                    )
2246                });
2247                fidl::decode!(
2248                    fidl::encoding::Endpoint<
2249                        fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_device::EnergyScanMarker>,
2250                    >,
2251                    fidl::encoding::DefaultFuchsiaResourceDialect,
2252                    val_ref,
2253                    decoder,
2254                    inner_offset,
2255                    inner_depth
2256                )?;
2257                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2258                {
2259                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2260                }
2261                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2262                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2263                }
2264            }
2265
2266            next_offset += envelope_size;
2267            _next_ordinal_to_read += 1;
2268            if next_offset >= end_offset {
2269                return Ok(());
2270            }
2271
2272            // Decode unknown envelopes for gaps in ordinals.
2273            while _next_ordinal_to_read < 10 {
2274                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2275                _next_ordinal_to_read += 1;
2276                next_offset += envelope_size;
2277            }
2278
2279            let next_out_of_line = decoder.next_out_of_line();
2280            let handles_before = decoder.remaining_handles();
2281            if let Some((inlined, num_bytes, num_handles)) =
2282                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2283            {
2284                let member_inline_size = <fidl::encoding::Endpoint<
2285                    fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_experimental::DeviceMarker>,
2286                > as fidl::encoding::TypeMarker>::inline_size(
2287                    decoder.context
2288                );
2289                if inlined != (member_inline_size <= 4) {
2290                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2291                }
2292                let inner_offset;
2293                let mut inner_depth = depth.clone();
2294                if inlined {
2295                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2296                    inner_offset = next_offset;
2297                } else {
2298                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2299                    inner_depth.increment()?;
2300                }
2301                let val_ref = self.experimental_device.get_or_insert_with(|| {
2302                    fidl::new_empty!(
2303                        fidl::encoding::Endpoint<
2304                            fidl::endpoints::ServerEnd<
2305                                fidl_fuchsia_lowpan_experimental::DeviceMarker,
2306                            >,
2307                        >,
2308                        fidl::encoding::DefaultFuchsiaResourceDialect
2309                    )
2310                });
2311                fidl::decode!(
2312                    fidl::encoding::Endpoint<
2313                        fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_experimental::DeviceMarker>,
2314                    >,
2315                    fidl::encoding::DefaultFuchsiaResourceDialect,
2316                    val_ref,
2317                    decoder,
2318                    inner_offset,
2319                    inner_depth
2320                )?;
2321                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2322                {
2323                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2324                }
2325                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2326                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2327                }
2328            }
2329
2330            next_offset += envelope_size;
2331            _next_ordinal_to_read += 1;
2332            if next_offset >= end_offset {
2333                return Ok(());
2334            }
2335
2336            // Decode unknown envelopes for gaps in ordinals.
2337            while _next_ordinal_to_read < 11 {
2338                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2339                _next_ordinal_to_read += 1;
2340                next_offset += envelope_size;
2341            }
2342
2343            let next_out_of_line = decoder.next_out_of_line();
2344            let handles_before = decoder.remaining_handles();
2345            if let Some((inlined, num_bytes, num_handles)) =
2346                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2347            {
2348                let member_inline_size = <fidl::encoding::Endpoint<
2349                    fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_experimental::DeviceExtraMarker>,
2350                > as fidl::encoding::TypeMarker>::inline_size(
2351                    decoder.context
2352                );
2353                if inlined != (member_inline_size <= 4) {
2354                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2355                }
2356                let inner_offset;
2357                let mut inner_depth = depth.clone();
2358                if inlined {
2359                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2360                    inner_offset = next_offset;
2361                } else {
2362                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2363                    inner_depth.increment()?;
2364                }
2365                let val_ref = self.experimental_device_extra.get_or_insert_with(|| {
2366                    fidl::new_empty!(
2367                        fidl::encoding::Endpoint<
2368                            fidl::endpoints::ServerEnd<
2369                                fidl_fuchsia_lowpan_experimental::DeviceExtraMarker,
2370                            >,
2371                        >,
2372                        fidl::encoding::DefaultFuchsiaResourceDialect
2373                    )
2374                });
2375                fidl::decode!(
2376                    fidl::encoding::Endpoint<
2377                        fidl::endpoints::ServerEnd<
2378                            fidl_fuchsia_lowpan_experimental::DeviceExtraMarker,
2379                        >,
2380                    >,
2381                    fidl::encoding::DefaultFuchsiaResourceDialect,
2382                    val_ref,
2383                    decoder,
2384                    inner_offset,
2385                    inner_depth
2386                )?;
2387                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2388                {
2389                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2390                }
2391                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2392                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2393                }
2394            }
2395
2396            next_offset += envelope_size;
2397            _next_ordinal_to_read += 1;
2398            if next_offset >= end_offset {
2399                return Ok(());
2400            }
2401
2402            // Decode unknown envelopes for gaps in ordinals.
2403            while _next_ordinal_to_read < 12 {
2404                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2405                _next_ordinal_to_read += 1;
2406                next_offset += envelope_size;
2407            }
2408
2409            let next_out_of_line = decoder.next_out_of_line();
2410            let handles_before = decoder.remaining_handles();
2411            if let Some((inlined, num_bytes, num_handles)) =
2412                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2413            {
2414                let member_inline_size = <fidl::encoding::Endpoint<
2415                    fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_thread::MeshcopMarker>,
2416                > as fidl::encoding::TypeMarker>::inline_size(
2417                    decoder.context
2418                );
2419                if inlined != (member_inline_size <= 4) {
2420                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2421                }
2422                let inner_offset;
2423                let mut inner_depth = depth.clone();
2424                if inlined {
2425                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2426                    inner_offset = next_offset;
2427                } else {
2428                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2429                    inner_depth.increment()?;
2430                }
2431                let val_ref = self.meshcop.get_or_insert_with(|| {
2432                    fidl::new_empty!(
2433                        fidl::encoding::Endpoint<
2434                            fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_thread::MeshcopMarker>,
2435                        >,
2436                        fidl::encoding::DefaultFuchsiaResourceDialect
2437                    )
2438                });
2439                fidl::decode!(
2440                    fidl::encoding::Endpoint<
2441                        fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_thread::MeshcopMarker>,
2442                    >,
2443                    fidl::encoding::DefaultFuchsiaResourceDialect,
2444                    val_ref,
2445                    decoder,
2446                    inner_offset,
2447                    inner_depth
2448                )?;
2449                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2450                {
2451                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2452                }
2453                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2454                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2455                }
2456            }
2457
2458            next_offset += envelope_size;
2459            _next_ordinal_to_read += 1;
2460            if next_offset >= end_offset {
2461                return Ok(());
2462            }
2463
2464            // Decode unknown envelopes for gaps in ordinals.
2465            while _next_ordinal_to_read < 13 {
2466                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2467                _next_ordinal_to_read += 1;
2468                next_offset += envelope_size;
2469            }
2470
2471            let next_out_of_line = decoder.next_out_of_line();
2472            let handles_before = decoder.remaining_handles();
2473            if let Some((inlined, num_bytes, num_handles)) =
2474                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2475            {
2476                let member_inline_size = <fidl::encoding::Endpoint<
2477                    fidl::endpoints::ServerEnd<
2478                        fidl_fuchsia_lowpan_experimental::TelemetryProviderMarker,
2479                    >,
2480                > as fidl::encoding::TypeMarker>::inline_size(
2481                    decoder.context
2482                );
2483                if inlined != (member_inline_size <= 4) {
2484                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2485                }
2486                let inner_offset;
2487                let mut inner_depth = depth.clone();
2488                if inlined {
2489                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2490                    inner_offset = next_offset;
2491                } else {
2492                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2493                    inner_depth.increment()?;
2494                }
2495                let val_ref = self.telemetry_provider.get_or_insert_with(|| {
2496                    fidl::new_empty!(
2497                        fidl::encoding::Endpoint<
2498                            fidl::endpoints::ServerEnd<
2499                                fidl_fuchsia_lowpan_experimental::TelemetryProviderMarker,
2500                            >,
2501                        >,
2502                        fidl::encoding::DefaultFuchsiaResourceDialect
2503                    )
2504                });
2505                fidl::decode!(
2506                    fidl::encoding::Endpoint<
2507                        fidl::endpoints::ServerEnd<
2508                            fidl_fuchsia_lowpan_experimental::TelemetryProviderMarker,
2509                        >,
2510                    >,
2511                    fidl::encoding::DefaultFuchsiaResourceDialect,
2512                    val_ref,
2513                    decoder,
2514                    inner_offset,
2515                    inner_depth
2516                )?;
2517                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2518                {
2519                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2520                }
2521                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2522                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2523                }
2524            }
2525
2526            next_offset += envelope_size;
2527            _next_ordinal_to_read += 1;
2528            if next_offset >= end_offset {
2529                return Ok(());
2530            }
2531
2532            // Decode unknown envelopes for gaps in ordinals.
2533            while _next_ordinal_to_read < 14 {
2534                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2535                _next_ordinal_to_read += 1;
2536                next_offset += envelope_size;
2537            }
2538
2539            let next_out_of_line = decoder.next_out_of_line();
2540            let handles_before = decoder.remaining_handles();
2541            if let Some((inlined, num_bytes, num_handles)) =
2542                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2543            {
2544                let member_inline_size = <fidl::encoding::Endpoint<
2545                    fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_thread::FeatureMarker>,
2546                > as fidl::encoding::TypeMarker>::inline_size(
2547                    decoder.context
2548                );
2549                if inlined != (member_inline_size <= 4) {
2550                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2551                }
2552                let inner_offset;
2553                let mut inner_depth = depth.clone();
2554                if inlined {
2555                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2556                    inner_offset = next_offset;
2557                } else {
2558                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2559                    inner_depth.increment()?;
2560                }
2561                let val_ref = self.thread_feature.get_or_insert_with(|| {
2562                    fidl::new_empty!(
2563                        fidl::encoding::Endpoint<
2564                            fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_thread::FeatureMarker>,
2565                        >,
2566                        fidl::encoding::DefaultFuchsiaResourceDialect
2567                    )
2568                });
2569                fidl::decode!(
2570                    fidl::encoding::Endpoint<
2571                        fidl::endpoints::ServerEnd<fidl_fuchsia_lowpan_thread::FeatureMarker>,
2572                    >,
2573                    fidl::encoding::DefaultFuchsiaResourceDialect,
2574                    val_ref,
2575                    decoder,
2576                    inner_offset,
2577                    inner_depth
2578                )?;
2579                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2580                {
2581                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2582                }
2583                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2584                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2585                }
2586            }
2587
2588            next_offset += envelope_size;
2589            _next_ordinal_to_read += 1;
2590            if next_offset >= end_offset {
2591                return Ok(());
2592            }
2593
2594            // Decode unknown envelopes for gaps in ordinals.
2595            while _next_ordinal_to_read < 15 {
2596                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2597                _next_ordinal_to_read += 1;
2598                next_offset += envelope_size;
2599            }
2600
2601            let next_out_of_line = decoder.next_out_of_line();
2602            let handles_before = decoder.remaining_handles();
2603            if let Some((inlined, num_bytes, num_handles)) =
2604                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2605            {
2606                let member_inline_size = <fidl::encoding::Endpoint<
2607                    fidl::endpoints::ServerEnd<
2608                        fidl_fuchsia_lowpan_thread::ThreadCapabilitiesMarker,
2609                    >,
2610                > as fidl::encoding::TypeMarker>::inline_size(
2611                    decoder.context
2612                );
2613                if inlined != (member_inline_size <= 4) {
2614                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2615                }
2616                let inner_offset;
2617                let mut inner_depth = depth.clone();
2618                if inlined {
2619                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2620                    inner_offset = next_offset;
2621                } else {
2622                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2623                    inner_depth.increment()?;
2624                }
2625                let val_ref = self.capabilities.get_or_insert_with(|| {
2626                    fidl::new_empty!(
2627                        fidl::encoding::Endpoint<
2628                            fidl::endpoints::ServerEnd<
2629                                fidl_fuchsia_lowpan_thread::ThreadCapabilitiesMarker,
2630                            >,
2631                        >,
2632                        fidl::encoding::DefaultFuchsiaResourceDialect
2633                    )
2634                });
2635                fidl::decode!(
2636                    fidl::encoding::Endpoint<
2637                        fidl::endpoints::ServerEnd<
2638                            fidl_fuchsia_lowpan_thread::ThreadCapabilitiesMarker,
2639                        >,
2640                    >,
2641                    fidl::encoding::DefaultFuchsiaResourceDialect,
2642                    val_ref,
2643                    decoder,
2644                    inner_offset,
2645                    inner_depth
2646                )?;
2647                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2648                {
2649                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2650                }
2651                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2652                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2653                }
2654            }
2655
2656            next_offset += envelope_size;
2657
2658            // Decode the remaining unknown envelopes.
2659            while next_offset < end_offset {
2660                _next_ordinal_to_read += 1;
2661                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2662                next_offset += envelope_size;
2663            }
2664
2665            Ok(())
2666        }
2667    }
2668}