Skip to main content

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