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