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 DeviceTestControlHandle {
1294    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1295        self.inner.shutdown_with_epitaph(status.into())
1296    }
1297}
1298
1299impl fidl::endpoints::ControlHandle for DeviceTestControlHandle {
1300    fn shutdown(&self) {
1301        self.inner.shutdown()
1302    }
1303
1304    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1305        self.inner.shutdown_with_epitaph(status)
1306    }
1307
1308    fn is_closed(&self) -> bool {
1309        self.inner.channel().is_closed()
1310    }
1311    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1312        self.inner.channel().on_closed()
1313    }
1314
1315    #[cfg(target_os = "fuchsia")]
1316    fn signal_peer(
1317        &self,
1318        clear_mask: zx::Signals,
1319        set_mask: zx::Signals,
1320    ) -> Result<(), zx_status::Status> {
1321        use fidl::Peered;
1322        self.inner.channel().signal_peer(clear_mask, set_mask)
1323    }
1324}
1325
1326impl DeviceTestControlHandle {}
1327
1328#[must_use = "FIDL methods require a response to be sent"]
1329#[derive(Debug)]
1330pub struct DeviceTestResetResponder {
1331    control_handle: std::mem::ManuallyDrop<DeviceTestControlHandle>,
1332    tx_id: u32,
1333}
1334
1335/// Set the the channel to be shutdown (see [`DeviceTestControlHandle::shutdown`])
1336/// if the responder is dropped without sending a response, so that the client
1337/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1338impl std::ops::Drop for DeviceTestResetResponder {
1339    fn drop(&mut self) {
1340        self.control_handle.shutdown();
1341        // Safety: drops once, never accessed again
1342        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1343    }
1344}
1345
1346impl fidl::endpoints::Responder for DeviceTestResetResponder {
1347    type ControlHandle = DeviceTestControlHandle;
1348
1349    fn control_handle(&self) -> &DeviceTestControlHandle {
1350        &self.control_handle
1351    }
1352
1353    fn drop_without_shutdown(mut self) {
1354        // Safety: drops once, never accessed again due to mem::forget
1355        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1356        // Prevent Drop from running (which would shut down the channel)
1357        std::mem::forget(self);
1358    }
1359}
1360
1361impl DeviceTestResetResponder {
1362    /// Sends a response to the FIDL transaction.
1363    ///
1364    /// Sets the channel to shutdown if an error occurs.
1365    pub fn send(self) -> Result<(), fidl::Error> {
1366        let _result = self.send_raw();
1367        if _result.is_err() {
1368            self.control_handle.shutdown();
1369        }
1370        self.drop_without_shutdown();
1371        _result
1372    }
1373
1374    /// Similar to "send" but does not shutdown the channel if an error occurs.
1375    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1376        let _result = self.send_raw();
1377        self.drop_without_shutdown();
1378        _result
1379    }
1380
1381    fn send_raw(&self) -> Result<(), fidl::Error> {
1382        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1383            (),
1384            self.tx_id,
1385            0x772795fd82e287e,
1386            fidl::encoding::DynamicFlags::empty(),
1387        )
1388    }
1389}
1390
1391#[must_use = "FIDL methods require a response to be sent"]
1392#[derive(Debug)]
1393pub struct DeviceTestGetNcpVersionResponder {
1394    control_handle: std::mem::ManuallyDrop<DeviceTestControlHandle>,
1395    tx_id: u32,
1396}
1397
1398/// Set the the channel to be shutdown (see [`DeviceTestControlHandle::shutdown`])
1399/// if the responder is dropped without sending a response, so that the client
1400/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1401impl std::ops::Drop for DeviceTestGetNcpVersionResponder {
1402    fn drop(&mut self) {
1403        self.control_handle.shutdown();
1404        // Safety: drops once, never accessed again
1405        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1406    }
1407}
1408
1409impl fidl::endpoints::Responder for DeviceTestGetNcpVersionResponder {
1410    type ControlHandle = DeviceTestControlHandle;
1411
1412    fn control_handle(&self) -> &DeviceTestControlHandle {
1413        &self.control_handle
1414    }
1415
1416    fn drop_without_shutdown(mut self) {
1417        // Safety: drops once, never accessed again due to mem::forget
1418        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1419        // Prevent Drop from running (which would shut down the channel)
1420        std::mem::forget(self);
1421    }
1422}
1423
1424impl DeviceTestGetNcpVersionResponder {
1425    /// Sends a response to the FIDL transaction.
1426    ///
1427    /// Sets the channel to shutdown if an error occurs.
1428    pub fn send(self, mut version: &str) -> Result<(), fidl::Error> {
1429        let _result = self.send_raw(version);
1430        if _result.is_err() {
1431            self.control_handle.shutdown();
1432        }
1433        self.drop_without_shutdown();
1434        _result
1435    }
1436
1437    /// Similar to "send" but does not shutdown the channel if an error occurs.
1438    pub fn send_no_shutdown_on_err(self, mut version: &str) -> Result<(), fidl::Error> {
1439        let _result = self.send_raw(version);
1440        self.drop_without_shutdown();
1441        _result
1442    }
1443
1444    fn send_raw(&self, mut version: &str) -> Result<(), fidl::Error> {
1445        self.control_handle.inner.send::<DeviceTestGetNcpVersionResponse>(
1446            (version,),
1447            self.tx_id,
1448            0x5006d66ecaa992f2,
1449            fidl::encoding::DynamicFlags::empty(),
1450        )
1451    }
1452}
1453
1454#[must_use = "FIDL methods require a response to be sent"]
1455#[derive(Debug)]
1456pub struct DeviceTestGetCurrentRssiResponder {
1457    control_handle: std::mem::ManuallyDrop<DeviceTestControlHandle>,
1458    tx_id: u32,
1459}
1460
1461/// Set the the channel to be shutdown (see [`DeviceTestControlHandle::shutdown`])
1462/// if the responder is dropped without sending a response, so that the client
1463/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1464impl std::ops::Drop for DeviceTestGetCurrentRssiResponder {
1465    fn drop(&mut self) {
1466        self.control_handle.shutdown();
1467        // Safety: drops once, never accessed again
1468        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1469    }
1470}
1471
1472impl fidl::endpoints::Responder for DeviceTestGetCurrentRssiResponder {
1473    type ControlHandle = DeviceTestControlHandle;
1474
1475    fn control_handle(&self) -> &DeviceTestControlHandle {
1476        &self.control_handle
1477    }
1478
1479    fn drop_without_shutdown(mut self) {
1480        // Safety: drops once, never accessed again due to mem::forget
1481        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1482        // Prevent Drop from running (which would shut down the channel)
1483        std::mem::forget(self);
1484    }
1485}
1486
1487impl DeviceTestGetCurrentRssiResponder {
1488    /// Sends a response to the FIDL transaction.
1489    ///
1490    /// Sets the channel to shutdown if an error occurs.
1491    pub fn send(self, mut rssi: i8) -> Result<(), fidl::Error> {
1492        let _result = self.send_raw(rssi);
1493        if _result.is_err() {
1494            self.control_handle.shutdown();
1495        }
1496        self.drop_without_shutdown();
1497        _result
1498    }
1499
1500    /// Similar to "send" but does not shutdown the channel if an error occurs.
1501    pub fn send_no_shutdown_on_err(self, mut rssi: i8) -> Result<(), fidl::Error> {
1502        let _result = self.send_raw(rssi);
1503        self.drop_without_shutdown();
1504        _result
1505    }
1506
1507    fn send_raw(&self, mut rssi: i8) -> Result<(), fidl::Error> {
1508        self.control_handle.inner.send::<DeviceTestGetCurrentRssiResponse>(
1509            (rssi,),
1510            self.tx_id,
1511            0x6ac289cf16a976ab,
1512            fidl::encoding::DynamicFlags::empty(),
1513        )
1514    }
1515}
1516
1517#[must_use = "FIDL methods require a response to be sent"]
1518#[derive(Debug)]
1519pub struct DeviceTestGetFactoryMacAddressResponder {
1520    control_handle: std::mem::ManuallyDrop<DeviceTestControlHandle>,
1521    tx_id: u32,
1522}
1523
1524/// Set the the channel to be shutdown (see [`DeviceTestControlHandle::shutdown`])
1525/// if the responder is dropped without sending a response, so that the client
1526/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1527impl std::ops::Drop for DeviceTestGetFactoryMacAddressResponder {
1528    fn drop(&mut self) {
1529        self.control_handle.shutdown();
1530        // Safety: drops once, never accessed again
1531        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1532    }
1533}
1534
1535impl fidl::endpoints::Responder for DeviceTestGetFactoryMacAddressResponder {
1536    type ControlHandle = DeviceTestControlHandle;
1537
1538    fn control_handle(&self) -> &DeviceTestControlHandle {
1539        &self.control_handle
1540    }
1541
1542    fn drop_without_shutdown(mut self) {
1543        // Safety: drops once, never accessed again due to mem::forget
1544        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1545        // Prevent Drop from running (which would shut down the channel)
1546        std::mem::forget(self);
1547    }
1548}
1549
1550impl DeviceTestGetFactoryMacAddressResponder {
1551    /// Sends a response to the FIDL transaction.
1552    ///
1553    /// Sets the channel to shutdown if an error occurs.
1554    pub fn send(self, mut address: &fidl_fuchsia_lowpan::MacAddress) -> Result<(), fidl::Error> {
1555        let _result = self.send_raw(address);
1556        if _result.is_err() {
1557            self.control_handle.shutdown();
1558        }
1559        self.drop_without_shutdown();
1560        _result
1561    }
1562
1563    /// Similar to "send" but does not shutdown the channel if an error occurs.
1564    pub fn send_no_shutdown_on_err(
1565        self,
1566        mut address: &fidl_fuchsia_lowpan::MacAddress,
1567    ) -> Result<(), fidl::Error> {
1568        let _result = self.send_raw(address);
1569        self.drop_without_shutdown();
1570        _result
1571    }
1572
1573    fn send_raw(&self, mut address: &fidl_fuchsia_lowpan::MacAddress) -> Result<(), fidl::Error> {
1574        self.control_handle.inner.send::<DeviceTestGetFactoryMacAddressResponse>(
1575            (address,),
1576            self.tx_id,
1577            0x2a32094f1da3372,
1578            fidl::encoding::DynamicFlags::empty(),
1579        )
1580    }
1581}
1582
1583#[must_use = "FIDL methods require a response to be sent"]
1584#[derive(Debug)]
1585pub struct DeviceTestGetCurrentMacAddressResponder {
1586    control_handle: std::mem::ManuallyDrop<DeviceTestControlHandle>,
1587    tx_id: u32,
1588}
1589
1590/// Set the the channel to be shutdown (see [`DeviceTestControlHandle::shutdown`])
1591/// if the responder is dropped without sending a response, so that the client
1592/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1593impl std::ops::Drop for DeviceTestGetCurrentMacAddressResponder {
1594    fn drop(&mut self) {
1595        self.control_handle.shutdown();
1596        // Safety: drops once, never accessed again
1597        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1598    }
1599}
1600
1601impl fidl::endpoints::Responder for DeviceTestGetCurrentMacAddressResponder {
1602    type ControlHandle = DeviceTestControlHandle;
1603
1604    fn control_handle(&self) -> &DeviceTestControlHandle {
1605        &self.control_handle
1606    }
1607
1608    fn drop_without_shutdown(mut self) {
1609        // Safety: drops once, never accessed again due to mem::forget
1610        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1611        // Prevent Drop from running (which would shut down the channel)
1612        std::mem::forget(self);
1613    }
1614}
1615
1616impl DeviceTestGetCurrentMacAddressResponder {
1617    /// Sends a response to the FIDL transaction.
1618    ///
1619    /// Sets the channel to shutdown if an error occurs.
1620    pub fn send(self, mut address: &fidl_fuchsia_lowpan::MacAddress) -> Result<(), fidl::Error> {
1621        let _result = self.send_raw(address);
1622        if _result.is_err() {
1623            self.control_handle.shutdown();
1624        }
1625        self.drop_without_shutdown();
1626        _result
1627    }
1628
1629    /// Similar to "send" but does not shutdown the channel if an error occurs.
1630    pub fn send_no_shutdown_on_err(
1631        self,
1632        mut address: &fidl_fuchsia_lowpan::MacAddress,
1633    ) -> Result<(), fidl::Error> {
1634        let _result = self.send_raw(address);
1635        self.drop_without_shutdown();
1636        _result
1637    }
1638
1639    fn send_raw(&self, mut address: &fidl_fuchsia_lowpan::MacAddress) -> Result<(), fidl::Error> {
1640        self.control_handle.inner.send::<DeviceTestGetCurrentMacAddressResponse>(
1641            (address,),
1642            self.tx_id,
1643            0x39fc2f974a484b62,
1644            fidl::encoding::DynamicFlags::empty(),
1645        )
1646    }
1647}
1648
1649#[must_use = "FIDL methods require a response to be sent"]
1650#[derive(Debug)]
1651pub struct DeviceTestGetCurrentChannelResponder {
1652    control_handle: std::mem::ManuallyDrop<DeviceTestControlHandle>,
1653    tx_id: u32,
1654}
1655
1656/// Set the the channel to be shutdown (see [`DeviceTestControlHandle::shutdown`])
1657/// if the responder is dropped without sending a response, so that the client
1658/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1659impl std::ops::Drop for DeviceTestGetCurrentChannelResponder {
1660    fn drop(&mut self) {
1661        self.control_handle.shutdown();
1662        // Safety: drops once, never accessed again
1663        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1664    }
1665}
1666
1667impl fidl::endpoints::Responder for DeviceTestGetCurrentChannelResponder {
1668    type ControlHandle = DeviceTestControlHandle;
1669
1670    fn control_handle(&self) -> &DeviceTestControlHandle {
1671        &self.control_handle
1672    }
1673
1674    fn drop_without_shutdown(mut self) {
1675        // Safety: drops once, never accessed again due to mem::forget
1676        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1677        // Prevent Drop from running (which would shut down the channel)
1678        std::mem::forget(self);
1679    }
1680}
1681
1682impl DeviceTestGetCurrentChannelResponder {
1683    /// Sends a response to the FIDL transaction.
1684    ///
1685    /// Sets the channel to shutdown if an error occurs.
1686    pub fn send(self, mut channel_index: u16) -> Result<(), fidl::Error> {
1687        let _result = self.send_raw(channel_index);
1688        if _result.is_err() {
1689            self.control_handle.shutdown();
1690        }
1691        self.drop_without_shutdown();
1692        _result
1693    }
1694
1695    /// Similar to "send" but does not shutdown the channel if an error occurs.
1696    pub fn send_no_shutdown_on_err(self, mut channel_index: u16) -> Result<(), fidl::Error> {
1697        let _result = self.send_raw(channel_index);
1698        self.drop_without_shutdown();
1699        _result
1700    }
1701
1702    fn send_raw(&self, mut channel_index: u16) -> Result<(), fidl::Error> {
1703        self.control_handle.inner.send::<DeviceTestGetCurrentChannelResponse>(
1704            (channel_index,),
1705            self.tx_id,
1706            0x2bd32ba980668d13,
1707            fidl::encoding::DynamicFlags::empty(),
1708        )
1709    }
1710}
1711
1712#[must_use = "FIDL methods require a response to be sent"]
1713#[derive(Debug)]
1714pub struct DeviceTestGetPartitionIdResponder {
1715    control_handle: std::mem::ManuallyDrop<DeviceTestControlHandle>,
1716    tx_id: u32,
1717}
1718
1719/// Set the the channel to be shutdown (see [`DeviceTestControlHandle::shutdown`])
1720/// if the responder is dropped without sending a response, so that the client
1721/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1722impl std::ops::Drop for DeviceTestGetPartitionIdResponder {
1723    fn drop(&mut self) {
1724        self.control_handle.shutdown();
1725        // Safety: drops once, never accessed again
1726        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1727    }
1728}
1729
1730impl fidl::endpoints::Responder for DeviceTestGetPartitionIdResponder {
1731    type ControlHandle = DeviceTestControlHandle;
1732
1733    fn control_handle(&self) -> &DeviceTestControlHandle {
1734        &self.control_handle
1735    }
1736
1737    fn drop_without_shutdown(mut self) {
1738        // Safety: drops once, never accessed again due to mem::forget
1739        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1740        // Prevent Drop from running (which would shut down the channel)
1741        std::mem::forget(self);
1742    }
1743}
1744
1745impl DeviceTestGetPartitionIdResponder {
1746    /// Sends a response to the FIDL transaction.
1747    ///
1748    /// Sets the channel to shutdown if an error occurs.
1749    pub fn send(self, mut pid: u32) -> Result<(), fidl::Error> {
1750        let _result = self.send_raw(pid);
1751        if _result.is_err() {
1752            self.control_handle.shutdown();
1753        }
1754        self.drop_without_shutdown();
1755        _result
1756    }
1757
1758    /// Similar to "send" but does not shutdown the channel if an error occurs.
1759    pub fn send_no_shutdown_on_err(self, mut pid: u32) -> Result<(), fidl::Error> {
1760        let _result = self.send_raw(pid);
1761        self.drop_without_shutdown();
1762        _result
1763    }
1764
1765    fn send_raw(&self, mut pid: u32) -> Result<(), fidl::Error> {
1766        self.control_handle.inner.send::<DeviceTestGetPartitionIdResponse>(
1767            (pid,),
1768            self.tx_id,
1769            0x32be448a6dc88b33,
1770            fidl::encoding::DynamicFlags::empty(),
1771        )
1772    }
1773}
1774
1775#[must_use = "FIDL methods require a response to be sent"]
1776#[derive(Debug)]
1777pub struct DeviceTestGetThreadRloc16Responder {
1778    control_handle: std::mem::ManuallyDrop<DeviceTestControlHandle>,
1779    tx_id: u32,
1780}
1781
1782/// Set the the channel to be shutdown (see [`DeviceTestControlHandle::shutdown`])
1783/// if the responder is dropped without sending a response, so that the client
1784/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1785impl std::ops::Drop for DeviceTestGetThreadRloc16Responder {
1786    fn drop(&mut self) {
1787        self.control_handle.shutdown();
1788        // Safety: drops once, never accessed again
1789        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1790    }
1791}
1792
1793impl fidl::endpoints::Responder for DeviceTestGetThreadRloc16Responder {
1794    type ControlHandle = DeviceTestControlHandle;
1795
1796    fn control_handle(&self) -> &DeviceTestControlHandle {
1797        &self.control_handle
1798    }
1799
1800    fn drop_without_shutdown(mut self) {
1801        // Safety: drops once, never accessed again due to mem::forget
1802        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1803        // Prevent Drop from running (which would shut down the channel)
1804        std::mem::forget(self);
1805    }
1806}
1807
1808impl DeviceTestGetThreadRloc16Responder {
1809    /// Sends a response to the FIDL transaction.
1810    ///
1811    /// Sets the channel to shutdown if an error occurs.
1812    pub fn send(self, mut rloc: u16) -> Result<(), fidl::Error> {
1813        let _result = self.send_raw(rloc);
1814        if _result.is_err() {
1815            self.control_handle.shutdown();
1816        }
1817        self.drop_without_shutdown();
1818        _result
1819    }
1820
1821    /// Similar to "send" but does not shutdown the channel if an error occurs.
1822    pub fn send_no_shutdown_on_err(self, mut rloc: u16) -> Result<(), fidl::Error> {
1823        let _result = self.send_raw(rloc);
1824        self.drop_without_shutdown();
1825        _result
1826    }
1827
1828    fn send_raw(&self, mut rloc: u16) -> Result<(), fidl::Error> {
1829        self.control_handle.inner.send::<DeviceTestGetThreadRloc16Response>(
1830            (rloc,),
1831            self.tx_id,
1832            0x4e554e42c1953d31,
1833            fidl::encoding::DynamicFlags::empty(),
1834        )
1835    }
1836}
1837
1838#[must_use = "FIDL methods require a response to be sent"]
1839#[derive(Debug)]
1840pub struct DeviceTestGetThreadRouterIdResponder {
1841    control_handle: std::mem::ManuallyDrop<DeviceTestControlHandle>,
1842    tx_id: u32,
1843}
1844
1845/// Set the the channel to be shutdown (see [`DeviceTestControlHandle::shutdown`])
1846/// if the responder is dropped without sending a response, so that the client
1847/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1848impl std::ops::Drop for DeviceTestGetThreadRouterIdResponder {
1849    fn drop(&mut self) {
1850        self.control_handle.shutdown();
1851        // Safety: drops once, never accessed again
1852        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1853    }
1854}
1855
1856impl fidl::endpoints::Responder for DeviceTestGetThreadRouterIdResponder {
1857    type ControlHandle = DeviceTestControlHandle;
1858
1859    fn control_handle(&self) -> &DeviceTestControlHandle {
1860        &self.control_handle
1861    }
1862
1863    fn drop_without_shutdown(mut self) {
1864        // Safety: drops once, never accessed again due to mem::forget
1865        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1866        // Prevent Drop from running (which would shut down the channel)
1867        std::mem::forget(self);
1868    }
1869}
1870
1871impl DeviceTestGetThreadRouterIdResponder {
1872    /// Sends a response to the FIDL transaction.
1873    ///
1874    /// Sets the channel to shutdown if an error occurs.
1875    pub fn send(self, mut router_id: u8) -> Result<(), fidl::Error> {
1876        let _result = self.send_raw(router_id);
1877        if _result.is_err() {
1878            self.control_handle.shutdown();
1879        }
1880        self.drop_without_shutdown();
1881        _result
1882    }
1883
1884    /// Similar to "send" but does not shutdown the channel if an error occurs.
1885    pub fn send_no_shutdown_on_err(self, mut router_id: u8) -> Result<(), fidl::Error> {
1886        let _result = self.send_raw(router_id);
1887        self.drop_without_shutdown();
1888        _result
1889    }
1890
1891    fn send_raw(&self, mut router_id: u8) -> Result<(), fidl::Error> {
1892        self.control_handle.inner.send::<DeviceTestGetThreadRouterIdResponse>(
1893            (router_id,),
1894            self.tx_id,
1895            0x753df71fce9f3563,
1896            fidl::encoding::DynamicFlags::empty(),
1897        )
1898    }
1899}
1900
1901#[must_use = "FIDL methods require a response to be sent"]
1902#[derive(Debug)]
1903pub struct DeviceTestReplaceMacAddressFilterSettingsResponder {
1904    control_handle: std::mem::ManuallyDrop<DeviceTestControlHandle>,
1905    tx_id: u32,
1906}
1907
1908/// Set the the channel to be shutdown (see [`DeviceTestControlHandle::shutdown`])
1909/// if the responder is dropped without sending a response, so that the client
1910/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1911impl std::ops::Drop for DeviceTestReplaceMacAddressFilterSettingsResponder {
1912    fn drop(&mut self) {
1913        self.control_handle.shutdown();
1914        // Safety: drops once, never accessed again
1915        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1916    }
1917}
1918
1919impl fidl::endpoints::Responder for DeviceTestReplaceMacAddressFilterSettingsResponder {
1920    type ControlHandle = DeviceTestControlHandle;
1921
1922    fn control_handle(&self) -> &DeviceTestControlHandle {
1923        &self.control_handle
1924    }
1925
1926    fn drop_without_shutdown(mut self) {
1927        // Safety: drops once, never accessed again due to mem::forget
1928        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1929        // Prevent Drop from running (which would shut down the channel)
1930        std::mem::forget(self);
1931    }
1932}
1933
1934impl DeviceTestReplaceMacAddressFilterSettingsResponder {
1935    /// Sends a response to the FIDL transaction.
1936    ///
1937    /// Sets the channel to shutdown if an error occurs.
1938    pub fn send(self) -> Result<(), fidl::Error> {
1939        let _result = self.send_raw();
1940        if _result.is_err() {
1941            self.control_handle.shutdown();
1942        }
1943        self.drop_without_shutdown();
1944        _result
1945    }
1946
1947    /// Similar to "send" but does not shutdown the channel if an error occurs.
1948    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1949        let _result = self.send_raw();
1950        self.drop_without_shutdown();
1951        _result
1952    }
1953
1954    fn send_raw(&self) -> Result<(), fidl::Error> {
1955        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1956            (),
1957            self.tx_id,
1958            0x66eb4780f869de19,
1959            fidl::encoding::DynamicFlags::empty(),
1960        )
1961    }
1962}
1963
1964#[must_use = "FIDL methods require a response to be sent"]
1965#[derive(Debug)]
1966pub struct DeviceTestGetMacAddressFilterSettingsResponder {
1967    control_handle: std::mem::ManuallyDrop<DeviceTestControlHandle>,
1968    tx_id: u32,
1969}
1970
1971/// Set the the channel to be shutdown (see [`DeviceTestControlHandle::shutdown`])
1972/// if the responder is dropped without sending a response, so that the client
1973/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1974impl std::ops::Drop for DeviceTestGetMacAddressFilterSettingsResponder {
1975    fn drop(&mut self) {
1976        self.control_handle.shutdown();
1977        // Safety: drops once, never accessed again
1978        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1979    }
1980}
1981
1982impl fidl::endpoints::Responder for DeviceTestGetMacAddressFilterSettingsResponder {
1983    type ControlHandle = DeviceTestControlHandle;
1984
1985    fn control_handle(&self) -> &DeviceTestControlHandle {
1986        &self.control_handle
1987    }
1988
1989    fn drop_without_shutdown(mut self) {
1990        // Safety: drops once, never accessed again due to mem::forget
1991        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1992        // Prevent Drop from running (which would shut down the channel)
1993        std::mem::forget(self);
1994    }
1995}
1996
1997impl DeviceTestGetMacAddressFilterSettingsResponder {
1998    /// Sends a response to the FIDL transaction.
1999    ///
2000    /// Sets the channel to shutdown if an error occurs.
2001    pub fn send(self, mut settings: &MacAddressFilterSettings) -> Result<(), fidl::Error> {
2002        let _result = self.send_raw(settings);
2003        if _result.is_err() {
2004            self.control_handle.shutdown();
2005        }
2006        self.drop_without_shutdown();
2007        _result
2008    }
2009
2010    /// Similar to "send" but does not shutdown the channel if an error occurs.
2011    pub fn send_no_shutdown_on_err(
2012        self,
2013        mut settings: &MacAddressFilterSettings,
2014    ) -> Result<(), fidl::Error> {
2015        let _result = self.send_raw(settings);
2016        self.drop_without_shutdown();
2017        _result
2018    }
2019
2020    fn send_raw(&self, mut settings: &MacAddressFilterSettings) -> Result<(), fidl::Error> {
2021        self.control_handle.inner.send::<DeviceTestGetMacAddressFilterSettingsResponse>(
2022            (settings,),
2023            self.tx_id,
2024            0x2d727bf2dd3e231c,
2025            fidl::encoding::DynamicFlags::empty(),
2026        )
2027    }
2028}
2029
2030#[must_use = "FIDL methods require a response to be sent"]
2031#[derive(Debug)]
2032pub struct DeviceTestGetNeighborTableResponder {
2033    control_handle: std::mem::ManuallyDrop<DeviceTestControlHandle>,
2034    tx_id: u32,
2035}
2036
2037/// Set the the channel to be shutdown (see [`DeviceTestControlHandle::shutdown`])
2038/// if the responder is dropped without sending a response, so that the client
2039/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2040impl std::ops::Drop for DeviceTestGetNeighborTableResponder {
2041    fn drop(&mut self) {
2042        self.control_handle.shutdown();
2043        // Safety: drops once, never accessed again
2044        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2045    }
2046}
2047
2048impl fidl::endpoints::Responder for DeviceTestGetNeighborTableResponder {
2049    type ControlHandle = DeviceTestControlHandle;
2050
2051    fn control_handle(&self) -> &DeviceTestControlHandle {
2052        &self.control_handle
2053    }
2054
2055    fn drop_without_shutdown(mut self) {
2056        // Safety: drops once, never accessed again due to mem::forget
2057        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2058        // Prevent Drop from running (which would shut down the channel)
2059        std::mem::forget(self);
2060    }
2061}
2062
2063impl DeviceTestGetNeighborTableResponder {
2064    /// Sends a response to the FIDL transaction.
2065    ///
2066    /// Sets the channel to shutdown if an error occurs.
2067    pub fn send(self, mut neighbor_table: &[NeighborInfo]) -> Result<(), fidl::Error> {
2068        let _result = self.send_raw(neighbor_table);
2069        if _result.is_err() {
2070            self.control_handle.shutdown();
2071        }
2072        self.drop_without_shutdown();
2073        _result
2074    }
2075
2076    /// Similar to "send" but does not shutdown the channel if an error occurs.
2077    pub fn send_no_shutdown_on_err(
2078        self,
2079        mut neighbor_table: &[NeighborInfo],
2080    ) -> Result<(), fidl::Error> {
2081        let _result = self.send_raw(neighbor_table);
2082        self.drop_without_shutdown();
2083        _result
2084    }
2085
2086    fn send_raw(&self, mut neighbor_table: &[NeighborInfo]) -> Result<(), fidl::Error> {
2087        self.control_handle.inner.send::<DeviceTestGetNeighborTableResponse>(
2088            (neighbor_table,),
2089            self.tx_id,
2090            0x6f2db4573c413cde,
2091            fidl::encoding::DynamicFlags::empty(),
2092        )
2093    }
2094}
2095
2096#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2097pub struct DeviceTestConnectorMarker;
2098
2099impl fidl::endpoints::ProtocolMarker for DeviceTestConnectorMarker {
2100    type Proxy = DeviceTestConnectorProxy;
2101    type RequestStream = DeviceTestConnectorRequestStream;
2102    #[cfg(target_os = "fuchsia")]
2103    type SynchronousProxy = DeviceTestConnectorSynchronousProxy;
2104
2105    const DEBUG_NAME: &'static str = "fuchsia.lowpan.test.DeviceTestConnector";
2106}
2107impl fidl::endpoints::DiscoverableProtocolMarker for DeviceTestConnectorMarker {}
2108
2109pub trait DeviceTestConnectorProxyInterface: Send + Sync {
2110    fn r#connect(
2111        &self,
2112        name: &str,
2113        server_end: fidl::endpoints::ServerEnd<DeviceTestMarker>,
2114    ) -> Result<(), fidl::Error>;
2115}
2116#[derive(Debug)]
2117#[cfg(target_os = "fuchsia")]
2118pub struct DeviceTestConnectorSynchronousProxy {
2119    client: fidl::client::sync::Client,
2120}
2121
2122#[cfg(target_os = "fuchsia")]
2123impl fidl::endpoints::SynchronousProxy for DeviceTestConnectorSynchronousProxy {
2124    type Proxy = DeviceTestConnectorProxy;
2125    type Protocol = DeviceTestConnectorMarker;
2126
2127    fn from_channel(inner: fidl::Channel) -> Self {
2128        Self::new(inner)
2129    }
2130
2131    fn into_channel(self) -> fidl::Channel {
2132        self.client.into_channel()
2133    }
2134
2135    fn as_channel(&self) -> &fidl::Channel {
2136        self.client.as_channel()
2137    }
2138}
2139
2140#[cfg(target_os = "fuchsia")]
2141impl DeviceTestConnectorSynchronousProxy {
2142    pub fn new(channel: fidl::Channel) -> Self {
2143        Self { client: fidl::client::sync::Client::new(channel) }
2144    }
2145
2146    pub fn into_channel(self) -> fidl::Channel {
2147        self.client.into_channel()
2148    }
2149
2150    /// Waits until an event arrives and returns it. It is safe for other
2151    /// threads to make concurrent requests while waiting for an event.
2152    pub fn wait_for_event(
2153        &self,
2154        deadline: zx::MonotonicInstant,
2155    ) -> Result<DeviceTestConnectorEvent, fidl::Error> {
2156        DeviceTestConnectorEvent::decode(
2157            self.client.wait_for_event::<DeviceTestConnectorMarker>(deadline)?,
2158        )
2159    }
2160
2161    /// Connects to the [`DeviceTest`] protocol on the
2162    /// named LoWPAN interface.
2163    ///
2164    /// The name of the interface can be learned by calling
2165    /// [`fuchsia.lowpan/Lookup.GetDevices`].
2166    ///
2167    /// If there is an error in processing this request
2168    /// the given channel is closed and an epitaph code used
2169    /// to describe the reason for the failure:
2170    ///
2171    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
2172    ///   was not formatted correctly or otherwise invalid.
2173    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
2174    ///   given name.
2175    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
2176    ///   does not support this protocol.
2177    pub fn r#connect(
2178        &self,
2179        mut name: &str,
2180        mut server_end: fidl::endpoints::ServerEnd<DeviceTestMarker>,
2181    ) -> Result<(), fidl::Error> {
2182        self.client.send::<DeviceTestConnectorConnectRequest>(
2183            (name, server_end),
2184            0x366c1167cee8caa3,
2185            fidl::encoding::DynamicFlags::empty(),
2186        )
2187    }
2188}
2189
2190#[cfg(target_os = "fuchsia")]
2191impl From<DeviceTestConnectorSynchronousProxy> for zx::NullableHandle {
2192    fn from(value: DeviceTestConnectorSynchronousProxy) -> Self {
2193        value.into_channel().into()
2194    }
2195}
2196
2197#[cfg(target_os = "fuchsia")]
2198impl From<fidl::Channel> for DeviceTestConnectorSynchronousProxy {
2199    fn from(value: fidl::Channel) -> Self {
2200        Self::new(value)
2201    }
2202}
2203
2204#[cfg(target_os = "fuchsia")]
2205impl fidl::endpoints::FromClient for DeviceTestConnectorSynchronousProxy {
2206    type Protocol = DeviceTestConnectorMarker;
2207
2208    fn from_client(value: fidl::endpoints::ClientEnd<DeviceTestConnectorMarker>) -> Self {
2209        Self::new(value.into_channel())
2210    }
2211}
2212
2213#[derive(Debug, Clone)]
2214pub struct DeviceTestConnectorProxy {
2215    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2216}
2217
2218impl fidl::endpoints::Proxy for DeviceTestConnectorProxy {
2219    type Protocol = DeviceTestConnectorMarker;
2220
2221    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2222        Self::new(inner)
2223    }
2224
2225    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2226        self.client.into_channel().map_err(|client| Self { client })
2227    }
2228
2229    fn as_channel(&self) -> &::fidl::AsyncChannel {
2230        self.client.as_channel()
2231    }
2232}
2233
2234impl DeviceTestConnectorProxy {
2235    /// Create a new Proxy for fuchsia.lowpan.test/DeviceTestConnector.
2236    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2237        let protocol_name =
2238            <DeviceTestConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2239        Self { client: fidl::client::Client::new(channel, protocol_name) }
2240    }
2241
2242    /// Get a Stream of events from the remote end of the protocol.
2243    ///
2244    /// # Panics
2245    ///
2246    /// Panics if the event stream was already taken.
2247    pub fn take_event_stream(&self) -> DeviceTestConnectorEventStream {
2248        DeviceTestConnectorEventStream { event_receiver: self.client.take_event_receiver() }
2249    }
2250
2251    /// Connects to the [`DeviceTest`] protocol on the
2252    /// named LoWPAN interface.
2253    ///
2254    /// The name of the interface can be learned by calling
2255    /// [`fuchsia.lowpan/Lookup.GetDevices`].
2256    ///
2257    /// If there is an error in processing this request
2258    /// the given channel is closed and an epitaph code used
2259    /// to describe the reason for the failure:
2260    ///
2261    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
2262    ///   was not formatted correctly or otherwise invalid.
2263    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
2264    ///   given name.
2265    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
2266    ///   does not support this protocol.
2267    pub fn r#connect(
2268        &self,
2269        mut name: &str,
2270        mut server_end: fidl::endpoints::ServerEnd<DeviceTestMarker>,
2271    ) -> Result<(), fidl::Error> {
2272        DeviceTestConnectorProxyInterface::r#connect(self, name, server_end)
2273    }
2274}
2275
2276impl DeviceTestConnectorProxyInterface for DeviceTestConnectorProxy {
2277    fn r#connect(
2278        &self,
2279        mut name: &str,
2280        mut server_end: fidl::endpoints::ServerEnd<DeviceTestMarker>,
2281    ) -> Result<(), fidl::Error> {
2282        self.client.send::<DeviceTestConnectorConnectRequest>(
2283            (name, server_end),
2284            0x366c1167cee8caa3,
2285            fidl::encoding::DynamicFlags::empty(),
2286        )
2287    }
2288}
2289
2290pub struct DeviceTestConnectorEventStream {
2291    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2292}
2293
2294impl std::marker::Unpin for DeviceTestConnectorEventStream {}
2295
2296impl futures::stream::FusedStream for DeviceTestConnectorEventStream {
2297    fn is_terminated(&self) -> bool {
2298        self.event_receiver.is_terminated()
2299    }
2300}
2301
2302impl futures::Stream for DeviceTestConnectorEventStream {
2303    type Item = Result<DeviceTestConnectorEvent, fidl::Error>;
2304
2305    fn poll_next(
2306        mut self: std::pin::Pin<&mut Self>,
2307        cx: &mut std::task::Context<'_>,
2308    ) -> std::task::Poll<Option<Self::Item>> {
2309        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2310            &mut self.event_receiver,
2311            cx
2312        )?) {
2313            Some(buf) => std::task::Poll::Ready(Some(DeviceTestConnectorEvent::decode(buf))),
2314            None => std::task::Poll::Ready(None),
2315        }
2316    }
2317}
2318
2319#[derive(Debug)]
2320pub enum DeviceTestConnectorEvent {}
2321
2322impl DeviceTestConnectorEvent {
2323    /// Decodes a message buffer as a [`DeviceTestConnectorEvent`].
2324    fn decode(
2325        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2326    ) -> Result<DeviceTestConnectorEvent, fidl::Error> {
2327        let (bytes, _handles) = buf.split_mut();
2328        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2329        debug_assert_eq!(tx_header.tx_id, 0);
2330        match tx_header.ordinal {
2331            _ => Err(fidl::Error::UnknownOrdinal {
2332                ordinal: tx_header.ordinal,
2333                protocol_name:
2334                    <DeviceTestConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2335            }),
2336        }
2337    }
2338}
2339
2340/// A Stream of incoming requests for fuchsia.lowpan.test/DeviceTestConnector.
2341pub struct DeviceTestConnectorRequestStream {
2342    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2343    is_terminated: bool,
2344}
2345
2346impl std::marker::Unpin for DeviceTestConnectorRequestStream {}
2347
2348impl futures::stream::FusedStream for DeviceTestConnectorRequestStream {
2349    fn is_terminated(&self) -> bool {
2350        self.is_terminated
2351    }
2352}
2353
2354impl fidl::endpoints::RequestStream for DeviceTestConnectorRequestStream {
2355    type Protocol = DeviceTestConnectorMarker;
2356    type ControlHandle = DeviceTestConnectorControlHandle;
2357
2358    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2359        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2360    }
2361
2362    fn control_handle(&self) -> Self::ControlHandle {
2363        DeviceTestConnectorControlHandle { inner: self.inner.clone() }
2364    }
2365
2366    fn into_inner(
2367        self,
2368    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2369    {
2370        (self.inner, self.is_terminated)
2371    }
2372
2373    fn from_inner(
2374        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2375        is_terminated: bool,
2376    ) -> Self {
2377        Self { inner, is_terminated }
2378    }
2379}
2380
2381impl futures::Stream for DeviceTestConnectorRequestStream {
2382    type Item = Result<DeviceTestConnectorRequest, fidl::Error>;
2383
2384    fn poll_next(
2385        mut self: std::pin::Pin<&mut Self>,
2386        cx: &mut std::task::Context<'_>,
2387    ) -> std::task::Poll<Option<Self::Item>> {
2388        let this = &mut *self;
2389        if this.inner.check_shutdown(cx) {
2390            this.is_terminated = true;
2391            return std::task::Poll::Ready(None);
2392        }
2393        if this.is_terminated {
2394            panic!("polled DeviceTestConnectorRequestStream after completion");
2395        }
2396        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2397            |bytes, handles| {
2398                match this.inner.channel().read_etc(cx, bytes, handles) {
2399                    std::task::Poll::Ready(Ok(())) => {}
2400                    std::task::Poll::Pending => return std::task::Poll::Pending,
2401                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2402                        this.is_terminated = true;
2403                        return std::task::Poll::Ready(None);
2404                    }
2405                    std::task::Poll::Ready(Err(e)) => {
2406                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2407                            e.into(),
2408                        ))));
2409                    }
2410                }
2411
2412                // A message has been received from the channel
2413                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2414
2415                std::task::Poll::Ready(Some(match header.ordinal {
2416                0x366c1167cee8caa3 => {
2417                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2418                    let mut req = fidl::new_empty!(DeviceTestConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2419                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceTestConnectorConnectRequest>(&header, _body_bytes, handles, &mut req)?;
2420                    let control_handle = DeviceTestConnectorControlHandle {
2421                        inner: this.inner.clone(),
2422                    };
2423                    Ok(DeviceTestConnectorRequest::Connect {name: req.name,
2424server_end: req.server_end,
2425
2426                        control_handle,
2427                    })
2428                }
2429                _ => Err(fidl::Error::UnknownOrdinal {
2430                    ordinal: header.ordinal,
2431                    protocol_name: <DeviceTestConnectorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2432                }),
2433            }))
2434            },
2435        )
2436    }
2437}
2438
2439/// Protocol for connecting to [`DeviceTest`] on a LoWPAN
2440/// interface.
2441#[derive(Debug)]
2442pub enum DeviceTestConnectorRequest {
2443    /// Connects to the [`DeviceTest`] protocol on the
2444    /// named LoWPAN interface.
2445    ///
2446    /// The name of the interface can be learned by calling
2447    /// [`fuchsia.lowpan/Lookup.GetDevices`].
2448    ///
2449    /// If there is an error in processing this request
2450    /// the given channel is closed and an epitaph code used
2451    /// to describe the reason for the failure:
2452    ///
2453    /// * `ZX_ERR_INVALID_ARGUMENT`: The given interface name
2454    ///   was not formatted correctly or otherwise invalid.
2455    /// * `ZX_ERR_NOT_FOUND`: No interface was found with the
2456    ///   given name.
2457    /// * `ZX_ERR_NOT_SUPPORTED`: The interface exists but
2458    ///   does not support this protocol.
2459    Connect {
2460        name: String,
2461        server_end: fidl::endpoints::ServerEnd<DeviceTestMarker>,
2462        control_handle: DeviceTestConnectorControlHandle,
2463    },
2464}
2465
2466impl DeviceTestConnectorRequest {
2467    #[allow(irrefutable_let_patterns)]
2468    pub fn into_connect(
2469        self,
2470    ) -> Option<(
2471        String,
2472        fidl::endpoints::ServerEnd<DeviceTestMarker>,
2473        DeviceTestConnectorControlHandle,
2474    )> {
2475        if let DeviceTestConnectorRequest::Connect { name, server_end, control_handle } = self {
2476            Some((name, server_end, control_handle))
2477        } else {
2478            None
2479        }
2480    }
2481
2482    /// Name of the method defined in FIDL
2483    pub fn method_name(&self) -> &'static str {
2484        match *self {
2485            DeviceTestConnectorRequest::Connect { .. } => "connect",
2486        }
2487    }
2488}
2489
2490#[derive(Debug, Clone)]
2491pub struct DeviceTestConnectorControlHandle {
2492    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2493}
2494
2495impl DeviceTestConnectorControlHandle {
2496    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2497        self.inner.shutdown_with_epitaph(status.into())
2498    }
2499}
2500
2501impl fidl::endpoints::ControlHandle for DeviceTestConnectorControlHandle {
2502    fn shutdown(&self) {
2503        self.inner.shutdown()
2504    }
2505
2506    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2507        self.inner.shutdown_with_epitaph(status)
2508    }
2509
2510    fn is_closed(&self) -> bool {
2511        self.inner.channel().is_closed()
2512    }
2513    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2514        self.inner.channel().on_closed()
2515    }
2516
2517    #[cfg(target_os = "fuchsia")]
2518    fn signal_peer(
2519        &self,
2520        clear_mask: zx::Signals,
2521        set_mask: zx::Signals,
2522    ) -> Result<(), zx_status::Status> {
2523        use fidl::Peered;
2524        self.inner.channel().signal_peer(clear_mask, set_mask)
2525    }
2526}
2527
2528impl DeviceTestConnectorControlHandle {}
2529
2530mod internal {
2531    use super::*;
2532
2533    impl fidl::encoding::ResourceTypeMarker for DeviceTestConnectorConnectRequest {
2534        type Borrowed<'a> = &'a mut Self;
2535        fn take_or_borrow<'a>(
2536            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2537        ) -> Self::Borrowed<'a> {
2538            value
2539        }
2540    }
2541
2542    unsafe impl fidl::encoding::TypeMarker for DeviceTestConnectorConnectRequest {
2543        type Owned = Self;
2544
2545        #[inline(always)]
2546        fn inline_align(_context: fidl::encoding::Context) -> usize {
2547            8
2548        }
2549
2550        #[inline(always)]
2551        fn inline_size(_context: fidl::encoding::Context) -> usize {
2552            24
2553        }
2554    }
2555
2556    unsafe impl
2557        fidl::encoding::Encode<
2558            DeviceTestConnectorConnectRequest,
2559            fidl::encoding::DefaultFuchsiaResourceDialect,
2560        > for &mut DeviceTestConnectorConnectRequest
2561    {
2562        #[inline]
2563        unsafe fn encode(
2564            self,
2565            encoder: &mut fidl::encoding::Encoder<
2566                '_,
2567                fidl::encoding::DefaultFuchsiaResourceDialect,
2568            >,
2569            offset: usize,
2570            _depth: fidl::encoding::Depth,
2571        ) -> fidl::Result<()> {
2572            encoder.debug_check_bounds::<DeviceTestConnectorConnectRequest>(offset);
2573            // Delegate to tuple encoding.
2574            fidl::encoding::Encode::<DeviceTestConnectorConnectRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2575                (
2576                    <fidl::encoding::BoundedString<32> as fidl::encoding::ValueTypeMarker>::borrow(&self.name),
2577                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceTestMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.server_end),
2578                ),
2579                encoder, offset, _depth
2580            )
2581        }
2582    }
2583    unsafe impl<
2584        T0: fidl::encoding::Encode<
2585                fidl::encoding::BoundedString<32>,
2586                fidl::encoding::DefaultFuchsiaResourceDialect,
2587            >,
2588        T1: fidl::encoding::Encode<
2589                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceTestMarker>>,
2590                fidl::encoding::DefaultFuchsiaResourceDialect,
2591            >,
2592    >
2593        fidl::encoding::Encode<
2594            DeviceTestConnectorConnectRequest,
2595            fidl::encoding::DefaultFuchsiaResourceDialect,
2596        > for (T0, T1)
2597    {
2598        #[inline]
2599        unsafe fn encode(
2600            self,
2601            encoder: &mut fidl::encoding::Encoder<
2602                '_,
2603                fidl::encoding::DefaultFuchsiaResourceDialect,
2604            >,
2605            offset: usize,
2606            depth: fidl::encoding::Depth,
2607        ) -> fidl::Result<()> {
2608            encoder.debug_check_bounds::<DeviceTestConnectorConnectRequest>(offset);
2609            // Zero out padding regions. There's no need to apply masks
2610            // because the unmasked parts will be overwritten by fields.
2611            unsafe {
2612                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2613                (ptr as *mut u64).write_unaligned(0);
2614            }
2615            // Write the fields.
2616            self.0.encode(encoder, offset + 0, depth)?;
2617            self.1.encode(encoder, offset + 16, depth)?;
2618            Ok(())
2619        }
2620    }
2621
2622    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2623        for DeviceTestConnectorConnectRequest
2624    {
2625        #[inline(always)]
2626        fn new_empty() -> Self {
2627            Self {
2628                name: fidl::new_empty!(
2629                    fidl::encoding::BoundedString<32>,
2630                    fidl::encoding::DefaultFuchsiaResourceDialect
2631                ),
2632                server_end: fidl::new_empty!(
2633                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceTestMarker>>,
2634                    fidl::encoding::DefaultFuchsiaResourceDialect
2635                ),
2636            }
2637        }
2638
2639        #[inline]
2640        unsafe fn decode(
2641            &mut self,
2642            decoder: &mut fidl::encoding::Decoder<
2643                '_,
2644                fidl::encoding::DefaultFuchsiaResourceDialect,
2645            >,
2646            offset: usize,
2647            _depth: fidl::encoding::Depth,
2648        ) -> fidl::Result<()> {
2649            decoder.debug_check_bounds::<Self>(offset);
2650            // Verify that padding bytes are zero.
2651            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2652            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2653            let mask = 0xffffffff00000000u64;
2654            let maskedval = padval & mask;
2655            if maskedval != 0 {
2656                return Err(fidl::Error::NonZeroPadding {
2657                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2658                });
2659            }
2660            fidl::decode!(
2661                fidl::encoding::BoundedString<32>,
2662                fidl::encoding::DefaultFuchsiaResourceDialect,
2663                &mut self.name,
2664                decoder,
2665                offset + 0,
2666                _depth
2667            )?;
2668            fidl::decode!(
2669                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceTestMarker>>,
2670                fidl::encoding::DefaultFuchsiaResourceDialect,
2671                &mut self.server_end,
2672                decoder,
2673                offset + 16,
2674                _depth
2675            )?;
2676            Ok(())
2677        }
2678    }
2679}