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