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