Skip to main content

fidl_fuchsia_net_neighbor/
fidl_fuchsia_net_neighbor.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_net_neighbor__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct ViewOpenEntryIteratorRequest {
16    pub it: fidl::endpoints::ServerEnd<EntryIteratorMarker>,
17    /// Options for modifying the behavior of an [`EntryIterator`].
18    pub options: EntryIteratorOptions,
19}
20
21impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
22    for ViewOpenEntryIteratorRequest
23{
24}
25
26#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
27pub struct ControllerMarker;
28
29impl fidl::endpoints::ProtocolMarker for ControllerMarker {
30    type Proxy = ControllerProxy;
31    type RequestStream = ControllerRequestStream;
32    #[cfg(target_os = "fuchsia")]
33    type SynchronousProxy = ControllerSynchronousProxy;
34
35    const DEBUG_NAME: &'static str = "fuchsia.net.neighbor.Controller";
36}
37impl fidl::endpoints::DiscoverableProtocolMarker for ControllerMarker {}
38pub type ControllerAddEntryResult = Result<(), ControllerError>;
39pub type ControllerProbeEntryResult = Result<(), ControllerError>;
40pub type ControllerRemoveEntryResult = Result<(), ControllerError>;
41pub type ControllerClearEntriesResult = Result<(), ControllerError>;
42
43pub trait ControllerProxyInterface: Send + Sync {
44    type AddEntryResponseFut: std::future::Future<Output = Result<ControllerAddEntryResult, fidl::Error>>
45        + Send;
46    fn r#add_entry(
47        &self,
48        interface: u64,
49        neighbor: &fidl_fuchsia_net::IpAddress,
50        mac: &fidl_fuchsia_net::MacAddress,
51    ) -> Self::AddEntryResponseFut;
52    type ProbeEntryResponseFut: std::future::Future<Output = Result<ControllerProbeEntryResult, fidl::Error>>
53        + Send;
54    fn r#probe_entry(
55        &self,
56        interface: u64,
57        neighbor: &fidl_fuchsia_net::IpAddress,
58    ) -> Self::ProbeEntryResponseFut;
59    type RemoveEntryResponseFut: std::future::Future<Output = Result<ControllerRemoveEntryResult, fidl::Error>>
60        + Send;
61    fn r#remove_entry(
62        &self,
63        interface: u64,
64        neighbor: &fidl_fuchsia_net::IpAddress,
65    ) -> Self::RemoveEntryResponseFut;
66    type ClearEntriesResponseFut: std::future::Future<Output = Result<ControllerClearEntriesResult, fidl::Error>>
67        + Send;
68    fn r#clear_entries(
69        &self,
70        interface: u64,
71        ip_version: fidl_fuchsia_net::IpVersion,
72    ) -> Self::ClearEntriesResponseFut;
73}
74#[derive(Debug)]
75#[cfg(target_os = "fuchsia")]
76pub struct ControllerSynchronousProxy {
77    client: fidl::client::sync::Client,
78}
79
80#[cfg(target_os = "fuchsia")]
81impl fidl::endpoints::SynchronousProxy for ControllerSynchronousProxy {
82    type Proxy = ControllerProxy;
83    type Protocol = ControllerMarker;
84
85    fn from_channel(inner: fidl::Channel) -> Self {
86        Self::new(inner)
87    }
88
89    fn into_channel(self) -> fidl::Channel {
90        self.client.into_channel()
91    }
92
93    fn as_channel(&self) -> &fidl::Channel {
94        self.client.as_channel()
95    }
96}
97
98#[cfg(target_os = "fuchsia")]
99impl ControllerSynchronousProxy {
100    pub fn new(channel: fidl::Channel) -> Self {
101        let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
102        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
103    }
104
105    pub fn into_channel(self) -> fidl::Channel {
106        self.client.into_channel()
107    }
108
109    /// Waits until an event arrives and returns it. It is safe for other
110    /// threads to make concurrent requests while waiting for an event.
111    pub fn wait_for_event(
112        &self,
113        deadline: zx::MonotonicInstant,
114    ) -> Result<ControllerEvent, fidl::Error> {
115        ControllerEvent::decode(self.client.wait_for_event(deadline)?)
116    }
117
118    /// Create a static entry. If a conflict is found, overwrite the existing
119    /// entry. Conflicts occur when two entries have the same interface
120    /// identifier and IP address.
121    ///
122    /// + request `interface` identifier for the interface used for
123    ///     communicating with the neighbor.
124    /// + request `neighbor` IP address of the neighbor.
125    /// + request `mac` MAC address of the neighbor.
126    pub fn r#add_entry(
127        &self,
128        mut interface: u64,
129        mut neighbor: &fidl_fuchsia_net::IpAddress,
130        mut mac: &fidl_fuchsia_net::MacAddress,
131        ___deadline: zx::MonotonicInstant,
132    ) -> Result<ControllerAddEntryResult, fidl::Error> {
133        let _response = self.client.send_query::<
134            ControllerAddEntryRequest,
135            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ControllerError>,
136        >(
137            (interface, neighbor, mac,),
138            0x778c829580aa23ac,
139            fidl::encoding::DynamicFlags::empty(),
140            ___deadline,
141        )?;
142        Ok(_response.map(|x| x))
143    }
144
145    /// Probe the reachability of an entry in the neighbor table.
146    ///
147    /// If the entry is static it will be converted into a dynamic entry and may
148    /// eventually be discarded if no longer in active use.
149    ///
150    /// + request `interface` identifier for the interface used for
151    ///     communicating with the neighbor.
152    /// + request `neighbor` IP address of the neighbor.
153    pub fn r#probe_entry(
154        &self,
155        mut interface: u64,
156        mut neighbor: &fidl_fuchsia_net::IpAddress,
157        ___deadline: zx::MonotonicInstant,
158    ) -> Result<ControllerProbeEntryResult, fidl::Error> {
159        let _response = self.client.send_query::<
160            ControllerProbeEntryRequest,
161            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ControllerError>,
162        >(
163            (interface, neighbor,),
164            0x4f71dd58473f58ad,
165            fidl::encoding::DynamicFlags::empty(),
166            ___deadline,
167        )?;
168        Ok(_response.map(|x| x))
169    }
170
171    /// Delete a dynamic or static entry.
172    ///
173    /// + request `interface` identifier for the interface associated with the
174    ///     entry to be deleted.
175    /// + request `neighbor` IP address of the entry to be deleted.
176    pub fn r#remove_entry(
177        &self,
178        mut interface: u64,
179        mut neighbor: &fidl_fuchsia_net::IpAddress,
180        ___deadline: zx::MonotonicInstant,
181    ) -> Result<ControllerRemoveEntryResult, fidl::Error> {
182        let _response = self.client.send_query::<
183            ControllerRemoveEntryRequest,
184            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ControllerError>,
185        >(
186            (interface, neighbor,),
187            0xfd0b52f53a0f815,
188            fidl::encoding::DynamicFlags::empty(),
189            ___deadline,
190        )?;
191        Ok(_response.map(|x| x))
192    }
193
194    /// Delete all dynamic and static entries belonging to an interface.
195    ///
196    /// + request `interface` identifier for the interface associated with the
197    ///     entries to be deleted.
198    /// + request `ip_version` the IP version to clear entries from.
199    pub fn r#clear_entries(
200        &self,
201        mut interface: u64,
202        mut ip_version: fidl_fuchsia_net::IpVersion,
203        ___deadline: zx::MonotonicInstant,
204    ) -> Result<ControllerClearEntriesResult, fidl::Error> {
205        let _response = self.client.send_query::<
206            ControllerClearEntriesRequest,
207            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ControllerError>,
208        >(
209            (interface, ip_version,),
210            0x33e53d9769a999d,
211            fidl::encoding::DynamicFlags::empty(),
212            ___deadline,
213        )?;
214        Ok(_response.map(|x| x))
215    }
216}
217
218#[cfg(target_os = "fuchsia")]
219impl From<ControllerSynchronousProxy> for zx::NullableHandle {
220    fn from(value: ControllerSynchronousProxy) -> Self {
221        value.into_channel().into()
222    }
223}
224
225#[cfg(target_os = "fuchsia")]
226impl From<fidl::Channel> for ControllerSynchronousProxy {
227    fn from(value: fidl::Channel) -> Self {
228        Self::new(value)
229    }
230}
231
232#[cfg(target_os = "fuchsia")]
233impl fidl::endpoints::FromClient for ControllerSynchronousProxy {
234    type Protocol = ControllerMarker;
235
236    fn from_client(value: fidl::endpoints::ClientEnd<ControllerMarker>) -> Self {
237        Self::new(value.into_channel())
238    }
239}
240
241#[derive(Debug, Clone)]
242pub struct ControllerProxy {
243    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
244}
245
246impl fidl::endpoints::Proxy for ControllerProxy {
247    type Protocol = ControllerMarker;
248
249    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
250        Self::new(inner)
251    }
252
253    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
254        self.client.into_channel().map_err(|client| Self { client })
255    }
256
257    fn as_channel(&self) -> &::fidl::AsyncChannel {
258        self.client.as_channel()
259    }
260}
261
262impl ControllerProxy {
263    /// Create a new Proxy for fuchsia.net.neighbor/Controller.
264    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
265        let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
266        Self { client: fidl::client::Client::new(channel, protocol_name) }
267    }
268
269    /// Get a Stream of events from the remote end of the protocol.
270    ///
271    /// # Panics
272    ///
273    /// Panics if the event stream was already taken.
274    pub fn take_event_stream(&self) -> ControllerEventStream {
275        ControllerEventStream { event_receiver: self.client.take_event_receiver() }
276    }
277
278    /// Create a static entry. If a conflict is found, overwrite the existing
279    /// entry. Conflicts occur when two entries have the same interface
280    /// identifier and IP address.
281    ///
282    /// + request `interface` identifier for the interface used for
283    ///     communicating with the neighbor.
284    /// + request `neighbor` IP address of the neighbor.
285    /// + request `mac` MAC address of the neighbor.
286    pub fn r#add_entry(
287        &self,
288        mut interface: u64,
289        mut neighbor: &fidl_fuchsia_net::IpAddress,
290        mut mac: &fidl_fuchsia_net::MacAddress,
291    ) -> fidl::client::QueryResponseFut<
292        ControllerAddEntryResult,
293        fidl::encoding::DefaultFuchsiaResourceDialect,
294    > {
295        ControllerProxyInterface::r#add_entry(self, interface, neighbor, mac)
296    }
297
298    /// Probe the reachability of an entry in the neighbor table.
299    ///
300    /// If the entry is static it will be converted into a dynamic entry and may
301    /// eventually be discarded if no longer in active use.
302    ///
303    /// + request `interface` identifier for the interface used for
304    ///     communicating with the neighbor.
305    /// + request `neighbor` IP address of the neighbor.
306    pub fn r#probe_entry(
307        &self,
308        mut interface: u64,
309        mut neighbor: &fidl_fuchsia_net::IpAddress,
310    ) -> fidl::client::QueryResponseFut<
311        ControllerProbeEntryResult,
312        fidl::encoding::DefaultFuchsiaResourceDialect,
313    > {
314        ControllerProxyInterface::r#probe_entry(self, interface, neighbor)
315    }
316
317    /// Delete a dynamic or static entry.
318    ///
319    /// + request `interface` identifier for the interface associated with the
320    ///     entry to be deleted.
321    /// + request `neighbor` IP address of the entry to be deleted.
322    pub fn r#remove_entry(
323        &self,
324        mut interface: u64,
325        mut neighbor: &fidl_fuchsia_net::IpAddress,
326    ) -> fidl::client::QueryResponseFut<
327        ControllerRemoveEntryResult,
328        fidl::encoding::DefaultFuchsiaResourceDialect,
329    > {
330        ControllerProxyInterface::r#remove_entry(self, interface, neighbor)
331    }
332
333    /// Delete all dynamic and static entries belonging to an interface.
334    ///
335    /// + request `interface` identifier for the interface associated with the
336    ///     entries to be deleted.
337    /// + request `ip_version` the IP version to clear entries from.
338    pub fn r#clear_entries(
339        &self,
340        mut interface: u64,
341        mut ip_version: fidl_fuchsia_net::IpVersion,
342    ) -> fidl::client::QueryResponseFut<
343        ControllerClearEntriesResult,
344        fidl::encoding::DefaultFuchsiaResourceDialect,
345    > {
346        ControllerProxyInterface::r#clear_entries(self, interface, ip_version)
347    }
348}
349
350impl ControllerProxyInterface for ControllerProxy {
351    type AddEntryResponseFut = fidl::client::QueryResponseFut<
352        ControllerAddEntryResult,
353        fidl::encoding::DefaultFuchsiaResourceDialect,
354    >;
355    fn r#add_entry(
356        &self,
357        mut interface: u64,
358        mut neighbor: &fidl_fuchsia_net::IpAddress,
359        mut mac: &fidl_fuchsia_net::MacAddress,
360    ) -> Self::AddEntryResponseFut {
361        fn _decode(
362            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
363        ) -> Result<ControllerAddEntryResult, fidl::Error> {
364            let _response = fidl::client::decode_transaction_body::<
365                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ControllerError>,
366                fidl::encoding::DefaultFuchsiaResourceDialect,
367                0x778c829580aa23ac,
368            >(_buf?)?;
369            Ok(_response.map(|x| x))
370        }
371        self.client.send_query_and_decode::<ControllerAddEntryRequest, ControllerAddEntryResult>(
372            (interface, neighbor, mac),
373            0x778c829580aa23ac,
374            fidl::encoding::DynamicFlags::empty(),
375            _decode,
376        )
377    }
378
379    type ProbeEntryResponseFut = fidl::client::QueryResponseFut<
380        ControllerProbeEntryResult,
381        fidl::encoding::DefaultFuchsiaResourceDialect,
382    >;
383    fn r#probe_entry(
384        &self,
385        mut interface: u64,
386        mut neighbor: &fidl_fuchsia_net::IpAddress,
387    ) -> Self::ProbeEntryResponseFut {
388        fn _decode(
389            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
390        ) -> Result<ControllerProbeEntryResult, fidl::Error> {
391            let _response = fidl::client::decode_transaction_body::<
392                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ControllerError>,
393                fidl::encoding::DefaultFuchsiaResourceDialect,
394                0x4f71dd58473f58ad,
395            >(_buf?)?;
396            Ok(_response.map(|x| x))
397        }
398        self.client
399            .send_query_and_decode::<ControllerProbeEntryRequest, ControllerProbeEntryResult>(
400                (interface, neighbor),
401                0x4f71dd58473f58ad,
402                fidl::encoding::DynamicFlags::empty(),
403                _decode,
404            )
405    }
406
407    type RemoveEntryResponseFut = fidl::client::QueryResponseFut<
408        ControllerRemoveEntryResult,
409        fidl::encoding::DefaultFuchsiaResourceDialect,
410    >;
411    fn r#remove_entry(
412        &self,
413        mut interface: u64,
414        mut neighbor: &fidl_fuchsia_net::IpAddress,
415    ) -> Self::RemoveEntryResponseFut {
416        fn _decode(
417            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
418        ) -> Result<ControllerRemoveEntryResult, fidl::Error> {
419            let _response = fidl::client::decode_transaction_body::<
420                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ControllerError>,
421                fidl::encoding::DefaultFuchsiaResourceDialect,
422                0xfd0b52f53a0f815,
423            >(_buf?)?;
424            Ok(_response.map(|x| x))
425        }
426        self.client
427            .send_query_and_decode::<ControllerRemoveEntryRequest, ControllerRemoveEntryResult>(
428                (interface, neighbor),
429                0xfd0b52f53a0f815,
430                fidl::encoding::DynamicFlags::empty(),
431                _decode,
432            )
433    }
434
435    type ClearEntriesResponseFut = fidl::client::QueryResponseFut<
436        ControllerClearEntriesResult,
437        fidl::encoding::DefaultFuchsiaResourceDialect,
438    >;
439    fn r#clear_entries(
440        &self,
441        mut interface: u64,
442        mut ip_version: fidl_fuchsia_net::IpVersion,
443    ) -> Self::ClearEntriesResponseFut {
444        fn _decode(
445            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
446        ) -> Result<ControllerClearEntriesResult, fidl::Error> {
447            let _response = fidl::client::decode_transaction_body::<
448                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ControllerError>,
449                fidl::encoding::DefaultFuchsiaResourceDialect,
450                0x33e53d9769a999d,
451            >(_buf?)?;
452            Ok(_response.map(|x| x))
453        }
454        self.client
455            .send_query_and_decode::<ControllerClearEntriesRequest, ControllerClearEntriesResult>(
456                (interface, ip_version),
457                0x33e53d9769a999d,
458                fidl::encoding::DynamicFlags::empty(),
459                _decode,
460            )
461    }
462}
463
464pub struct ControllerEventStream {
465    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
466}
467
468impl std::marker::Unpin for ControllerEventStream {}
469
470impl futures::stream::FusedStream for ControllerEventStream {
471    fn is_terminated(&self) -> bool {
472        self.event_receiver.is_terminated()
473    }
474}
475
476impl futures::Stream for ControllerEventStream {
477    type Item = Result<ControllerEvent, fidl::Error>;
478
479    fn poll_next(
480        mut self: std::pin::Pin<&mut Self>,
481        cx: &mut std::task::Context<'_>,
482    ) -> std::task::Poll<Option<Self::Item>> {
483        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
484            &mut self.event_receiver,
485            cx
486        )?) {
487            Some(buf) => std::task::Poll::Ready(Some(ControllerEvent::decode(buf))),
488            None => std::task::Poll::Ready(None),
489        }
490    }
491}
492
493#[derive(Debug)]
494pub enum ControllerEvent {}
495
496impl ControllerEvent {
497    /// Decodes a message buffer as a [`ControllerEvent`].
498    fn decode(
499        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
500    ) -> Result<ControllerEvent, fidl::Error> {
501        let (bytes, _handles) = buf.split_mut();
502        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
503        debug_assert_eq!(tx_header.tx_id, 0);
504        match tx_header.ordinal {
505            _ => Err(fidl::Error::UnknownOrdinal {
506                ordinal: tx_header.ordinal,
507                protocol_name: <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
508            }),
509        }
510    }
511}
512
513/// A Stream of incoming requests for fuchsia.net.neighbor/Controller.
514pub struct ControllerRequestStream {
515    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
516    is_terminated: bool,
517}
518
519impl std::marker::Unpin for ControllerRequestStream {}
520
521impl futures::stream::FusedStream for ControllerRequestStream {
522    fn is_terminated(&self) -> bool {
523        self.is_terminated
524    }
525}
526
527impl fidl::endpoints::RequestStream for ControllerRequestStream {
528    type Protocol = ControllerMarker;
529    type ControlHandle = ControllerControlHandle;
530
531    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
532        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
533    }
534
535    fn control_handle(&self) -> Self::ControlHandle {
536        ControllerControlHandle { inner: self.inner.clone() }
537    }
538
539    fn into_inner(
540        self,
541    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
542    {
543        (self.inner, self.is_terminated)
544    }
545
546    fn from_inner(
547        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
548        is_terminated: bool,
549    ) -> Self {
550        Self { inner, is_terminated }
551    }
552}
553
554impl futures::Stream for ControllerRequestStream {
555    type Item = Result<ControllerRequest, fidl::Error>;
556
557    fn poll_next(
558        mut self: std::pin::Pin<&mut Self>,
559        cx: &mut std::task::Context<'_>,
560    ) -> std::task::Poll<Option<Self::Item>> {
561        let this = &mut *self;
562        if this.inner.check_shutdown(cx) {
563            this.is_terminated = true;
564            return std::task::Poll::Ready(None);
565        }
566        if this.is_terminated {
567            panic!("polled ControllerRequestStream after completion");
568        }
569        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
570            |bytes, handles| {
571                match this.inner.channel().read_etc(cx, bytes, handles) {
572                    std::task::Poll::Ready(Ok(())) => {}
573                    std::task::Poll::Pending => return std::task::Poll::Pending,
574                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
575                        this.is_terminated = true;
576                        return std::task::Poll::Ready(None);
577                    }
578                    std::task::Poll::Ready(Err(e)) => {
579                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
580                            e.into(),
581                        ))));
582                    }
583                }
584
585                // A message has been received from the channel
586                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
587
588                std::task::Poll::Ready(Some(match header.ordinal {
589                    0x778c829580aa23ac => {
590                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
591                        let mut req = fidl::new_empty!(
592                            ControllerAddEntryRequest,
593                            fidl::encoding::DefaultFuchsiaResourceDialect
594                        );
595                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerAddEntryRequest>(&header, _body_bytes, handles, &mut req)?;
596                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
597                        Ok(ControllerRequest::AddEntry {
598                            interface: req.interface,
599                            neighbor: req.neighbor,
600                            mac: req.mac,
601
602                            responder: ControllerAddEntryResponder {
603                                control_handle: std::mem::ManuallyDrop::new(control_handle),
604                                tx_id: header.tx_id,
605                            },
606                        })
607                    }
608                    0x4f71dd58473f58ad => {
609                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
610                        let mut req = fidl::new_empty!(
611                            ControllerProbeEntryRequest,
612                            fidl::encoding::DefaultFuchsiaResourceDialect
613                        );
614                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerProbeEntryRequest>(&header, _body_bytes, handles, &mut req)?;
615                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
616                        Ok(ControllerRequest::ProbeEntry {
617                            interface: req.interface,
618                            neighbor: req.neighbor,
619
620                            responder: ControllerProbeEntryResponder {
621                                control_handle: std::mem::ManuallyDrop::new(control_handle),
622                                tx_id: header.tx_id,
623                            },
624                        })
625                    }
626                    0xfd0b52f53a0f815 => {
627                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
628                        let mut req = fidl::new_empty!(
629                            ControllerRemoveEntryRequest,
630                            fidl::encoding::DefaultFuchsiaResourceDialect
631                        );
632                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerRemoveEntryRequest>(&header, _body_bytes, handles, &mut req)?;
633                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
634                        Ok(ControllerRequest::RemoveEntry {
635                            interface: req.interface,
636                            neighbor: req.neighbor,
637
638                            responder: ControllerRemoveEntryResponder {
639                                control_handle: std::mem::ManuallyDrop::new(control_handle),
640                                tx_id: header.tx_id,
641                            },
642                        })
643                    }
644                    0x33e53d9769a999d => {
645                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
646                        let mut req = fidl::new_empty!(
647                            ControllerClearEntriesRequest,
648                            fidl::encoding::DefaultFuchsiaResourceDialect
649                        );
650                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerClearEntriesRequest>(&header, _body_bytes, handles, &mut req)?;
651                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
652                        Ok(ControllerRequest::ClearEntries {
653                            interface: req.interface,
654                            ip_version: req.ip_version,
655
656                            responder: ControllerClearEntriesResponder {
657                                control_handle: std::mem::ManuallyDrop::new(control_handle),
658                                tx_id: header.tx_id,
659                            },
660                        })
661                    }
662                    _ => Err(fidl::Error::UnknownOrdinal {
663                        ordinal: header.ordinal,
664                        protocol_name:
665                            <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
666                    }),
667                }))
668            },
669        )
670    }
671}
672
673/// Modify the neighbor table.
674#[derive(Debug)]
675pub enum ControllerRequest {
676    /// Create a static entry. If a conflict is found, overwrite the existing
677    /// entry. Conflicts occur when two entries have the same interface
678    /// identifier and IP address.
679    ///
680    /// + request `interface` identifier for the interface used for
681    ///     communicating with the neighbor.
682    /// + request `neighbor` IP address of the neighbor.
683    /// + request `mac` MAC address of the neighbor.
684    AddEntry {
685        interface: u64,
686        neighbor: fidl_fuchsia_net::IpAddress,
687        mac: fidl_fuchsia_net::MacAddress,
688        responder: ControllerAddEntryResponder,
689    },
690    /// Probe the reachability of an entry in the neighbor table.
691    ///
692    /// If the entry is static it will be converted into a dynamic entry and may
693    /// eventually be discarded if no longer in active use.
694    ///
695    /// + request `interface` identifier for the interface used for
696    ///     communicating with the neighbor.
697    /// + request `neighbor` IP address of the neighbor.
698    ProbeEntry {
699        interface: u64,
700        neighbor: fidl_fuchsia_net::IpAddress,
701        responder: ControllerProbeEntryResponder,
702    },
703    /// Delete a dynamic or static entry.
704    ///
705    /// + request `interface` identifier for the interface associated with the
706    ///     entry to be deleted.
707    /// + request `neighbor` IP address of the entry to be deleted.
708    RemoveEntry {
709        interface: u64,
710        neighbor: fidl_fuchsia_net::IpAddress,
711        responder: ControllerRemoveEntryResponder,
712    },
713    /// Delete all dynamic and static entries belonging to an interface.
714    ///
715    /// + request `interface` identifier for the interface associated with the
716    ///     entries to be deleted.
717    /// + request `ip_version` the IP version to clear entries from.
718    ClearEntries {
719        interface: u64,
720        ip_version: fidl_fuchsia_net::IpVersion,
721        responder: ControllerClearEntriesResponder,
722    },
723}
724
725impl ControllerRequest {
726    #[allow(irrefutable_let_patterns)]
727    pub fn into_add_entry(
728        self,
729    ) -> Option<(
730        u64,
731        fidl_fuchsia_net::IpAddress,
732        fidl_fuchsia_net::MacAddress,
733        ControllerAddEntryResponder,
734    )> {
735        if let ControllerRequest::AddEntry { interface, neighbor, mac, responder } = self {
736            Some((interface, neighbor, mac, responder))
737        } else {
738            None
739        }
740    }
741
742    #[allow(irrefutable_let_patterns)]
743    pub fn into_probe_entry(
744        self,
745    ) -> Option<(u64, fidl_fuchsia_net::IpAddress, ControllerProbeEntryResponder)> {
746        if let ControllerRequest::ProbeEntry { interface, neighbor, responder } = self {
747            Some((interface, neighbor, responder))
748        } else {
749            None
750        }
751    }
752
753    #[allow(irrefutable_let_patterns)]
754    pub fn into_remove_entry(
755        self,
756    ) -> Option<(u64, fidl_fuchsia_net::IpAddress, ControllerRemoveEntryResponder)> {
757        if let ControllerRequest::RemoveEntry { interface, neighbor, responder } = self {
758            Some((interface, neighbor, responder))
759        } else {
760            None
761        }
762    }
763
764    #[allow(irrefutable_let_patterns)]
765    pub fn into_clear_entries(
766        self,
767    ) -> Option<(u64, fidl_fuchsia_net::IpVersion, ControllerClearEntriesResponder)> {
768        if let ControllerRequest::ClearEntries { interface, ip_version, responder } = self {
769            Some((interface, ip_version, responder))
770        } else {
771            None
772        }
773    }
774
775    /// Name of the method defined in FIDL
776    pub fn method_name(&self) -> &'static str {
777        match *self {
778            ControllerRequest::AddEntry { .. } => "add_entry",
779            ControllerRequest::ProbeEntry { .. } => "probe_entry",
780            ControllerRequest::RemoveEntry { .. } => "remove_entry",
781            ControllerRequest::ClearEntries { .. } => "clear_entries",
782        }
783    }
784}
785
786#[derive(Debug, Clone)]
787pub struct ControllerControlHandle {
788    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
789}
790
791impl fidl::endpoints::ControlHandle for ControllerControlHandle {
792    fn shutdown(&self) {
793        self.inner.shutdown()
794    }
795
796    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
797        self.inner.shutdown_with_epitaph(status)
798    }
799
800    fn is_closed(&self) -> bool {
801        self.inner.channel().is_closed()
802    }
803    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
804        self.inner.channel().on_closed()
805    }
806
807    #[cfg(target_os = "fuchsia")]
808    fn signal_peer(
809        &self,
810        clear_mask: zx::Signals,
811        set_mask: zx::Signals,
812    ) -> Result<(), zx_status::Status> {
813        use fidl::Peered;
814        self.inner.channel().signal_peer(clear_mask, set_mask)
815    }
816}
817
818impl ControllerControlHandle {}
819
820#[must_use = "FIDL methods require a response to be sent"]
821#[derive(Debug)]
822pub struct ControllerAddEntryResponder {
823    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
824    tx_id: u32,
825}
826
827/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
828/// if the responder is dropped without sending a response, so that the client
829/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
830impl std::ops::Drop for ControllerAddEntryResponder {
831    fn drop(&mut self) {
832        self.control_handle.shutdown();
833        // Safety: drops once, never accessed again
834        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
835    }
836}
837
838impl fidl::endpoints::Responder for ControllerAddEntryResponder {
839    type ControlHandle = ControllerControlHandle;
840
841    fn control_handle(&self) -> &ControllerControlHandle {
842        &self.control_handle
843    }
844
845    fn drop_without_shutdown(mut self) {
846        // Safety: drops once, never accessed again due to mem::forget
847        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
848        // Prevent Drop from running (which would shut down the channel)
849        std::mem::forget(self);
850    }
851}
852
853impl ControllerAddEntryResponder {
854    /// Sends a response to the FIDL transaction.
855    ///
856    /// Sets the channel to shutdown if an error occurs.
857    pub fn send(self, mut result: Result<(), ControllerError>) -> Result<(), fidl::Error> {
858        let _result = self.send_raw(result);
859        if _result.is_err() {
860            self.control_handle.shutdown();
861        }
862        self.drop_without_shutdown();
863        _result
864    }
865
866    /// Similar to "send" but does not shutdown the channel if an error occurs.
867    pub fn send_no_shutdown_on_err(
868        self,
869        mut result: Result<(), ControllerError>,
870    ) -> Result<(), fidl::Error> {
871        let _result = self.send_raw(result);
872        self.drop_without_shutdown();
873        _result
874    }
875
876    fn send_raw(&self, mut result: Result<(), ControllerError>) -> Result<(), fidl::Error> {
877        self.control_handle.inner.send::<fidl::encoding::ResultType<
878            fidl::encoding::EmptyStruct,
879            ControllerError,
880        >>(
881            result,
882            self.tx_id,
883            0x778c829580aa23ac,
884            fidl::encoding::DynamicFlags::empty(),
885        )
886    }
887}
888
889#[must_use = "FIDL methods require a response to be sent"]
890#[derive(Debug)]
891pub struct ControllerProbeEntryResponder {
892    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
893    tx_id: u32,
894}
895
896/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
897/// if the responder is dropped without sending a response, so that the client
898/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
899impl std::ops::Drop for ControllerProbeEntryResponder {
900    fn drop(&mut self) {
901        self.control_handle.shutdown();
902        // Safety: drops once, never accessed again
903        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
904    }
905}
906
907impl fidl::endpoints::Responder for ControllerProbeEntryResponder {
908    type ControlHandle = ControllerControlHandle;
909
910    fn control_handle(&self) -> &ControllerControlHandle {
911        &self.control_handle
912    }
913
914    fn drop_without_shutdown(mut self) {
915        // Safety: drops once, never accessed again due to mem::forget
916        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
917        // Prevent Drop from running (which would shut down the channel)
918        std::mem::forget(self);
919    }
920}
921
922impl ControllerProbeEntryResponder {
923    /// Sends a response to the FIDL transaction.
924    ///
925    /// Sets the channel to shutdown if an error occurs.
926    pub fn send(self, mut result: Result<(), ControllerError>) -> Result<(), fidl::Error> {
927        let _result = self.send_raw(result);
928        if _result.is_err() {
929            self.control_handle.shutdown();
930        }
931        self.drop_without_shutdown();
932        _result
933    }
934
935    /// Similar to "send" but does not shutdown the channel if an error occurs.
936    pub fn send_no_shutdown_on_err(
937        self,
938        mut result: Result<(), ControllerError>,
939    ) -> Result<(), fidl::Error> {
940        let _result = self.send_raw(result);
941        self.drop_without_shutdown();
942        _result
943    }
944
945    fn send_raw(&self, mut result: Result<(), ControllerError>) -> Result<(), fidl::Error> {
946        self.control_handle.inner.send::<fidl::encoding::ResultType<
947            fidl::encoding::EmptyStruct,
948            ControllerError,
949        >>(
950            result,
951            self.tx_id,
952            0x4f71dd58473f58ad,
953            fidl::encoding::DynamicFlags::empty(),
954        )
955    }
956}
957
958#[must_use = "FIDL methods require a response to be sent"]
959#[derive(Debug)]
960pub struct ControllerRemoveEntryResponder {
961    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
962    tx_id: u32,
963}
964
965/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
966/// if the responder is dropped without sending a response, so that the client
967/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
968impl std::ops::Drop for ControllerRemoveEntryResponder {
969    fn drop(&mut self) {
970        self.control_handle.shutdown();
971        // Safety: drops once, never accessed again
972        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
973    }
974}
975
976impl fidl::endpoints::Responder for ControllerRemoveEntryResponder {
977    type ControlHandle = ControllerControlHandle;
978
979    fn control_handle(&self) -> &ControllerControlHandle {
980        &self.control_handle
981    }
982
983    fn drop_without_shutdown(mut self) {
984        // Safety: drops once, never accessed again due to mem::forget
985        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
986        // Prevent Drop from running (which would shut down the channel)
987        std::mem::forget(self);
988    }
989}
990
991impl ControllerRemoveEntryResponder {
992    /// Sends a response to the FIDL transaction.
993    ///
994    /// Sets the channel to shutdown if an error occurs.
995    pub fn send(self, mut result: Result<(), ControllerError>) -> Result<(), fidl::Error> {
996        let _result = self.send_raw(result);
997        if _result.is_err() {
998            self.control_handle.shutdown();
999        }
1000        self.drop_without_shutdown();
1001        _result
1002    }
1003
1004    /// Similar to "send" but does not shutdown the channel if an error occurs.
1005    pub fn send_no_shutdown_on_err(
1006        self,
1007        mut result: Result<(), ControllerError>,
1008    ) -> Result<(), fidl::Error> {
1009        let _result = self.send_raw(result);
1010        self.drop_without_shutdown();
1011        _result
1012    }
1013
1014    fn send_raw(&self, mut result: Result<(), ControllerError>) -> Result<(), fidl::Error> {
1015        self.control_handle.inner.send::<fidl::encoding::ResultType<
1016            fidl::encoding::EmptyStruct,
1017            ControllerError,
1018        >>(
1019            result,
1020            self.tx_id,
1021            0xfd0b52f53a0f815,
1022            fidl::encoding::DynamicFlags::empty(),
1023        )
1024    }
1025}
1026
1027#[must_use = "FIDL methods require a response to be sent"]
1028#[derive(Debug)]
1029pub struct ControllerClearEntriesResponder {
1030    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
1031    tx_id: u32,
1032}
1033
1034/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
1035/// if the responder is dropped without sending a response, so that the client
1036/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1037impl std::ops::Drop for ControllerClearEntriesResponder {
1038    fn drop(&mut self) {
1039        self.control_handle.shutdown();
1040        // Safety: drops once, never accessed again
1041        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1042    }
1043}
1044
1045impl fidl::endpoints::Responder for ControllerClearEntriesResponder {
1046    type ControlHandle = ControllerControlHandle;
1047
1048    fn control_handle(&self) -> &ControllerControlHandle {
1049        &self.control_handle
1050    }
1051
1052    fn drop_without_shutdown(mut self) {
1053        // Safety: drops once, never accessed again due to mem::forget
1054        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1055        // Prevent Drop from running (which would shut down the channel)
1056        std::mem::forget(self);
1057    }
1058}
1059
1060impl ControllerClearEntriesResponder {
1061    /// Sends a response to the FIDL transaction.
1062    ///
1063    /// Sets the channel to shutdown if an error occurs.
1064    pub fn send(self, mut result: Result<(), ControllerError>) -> Result<(), fidl::Error> {
1065        let _result = self.send_raw(result);
1066        if _result.is_err() {
1067            self.control_handle.shutdown();
1068        }
1069        self.drop_without_shutdown();
1070        _result
1071    }
1072
1073    /// Similar to "send" but does not shutdown the channel if an error occurs.
1074    pub fn send_no_shutdown_on_err(
1075        self,
1076        mut result: Result<(), ControllerError>,
1077    ) -> Result<(), fidl::Error> {
1078        let _result = self.send_raw(result);
1079        self.drop_without_shutdown();
1080        _result
1081    }
1082
1083    fn send_raw(&self, mut result: Result<(), ControllerError>) -> Result<(), fidl::Error> {
1084        self.control_handle.inner.send::<fidl::encoding::ResultType<
1085            fidl::encoding::EmptyStruct,
1086            ControllerError,
1087        >>(
1088            result,
1089            self.tx_id,
1090            0x33e53d9769a999d,
1091            fidl::encoding::DynamicFlags::empty(),
1092        )
1093    }
1094}
1095
1096#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1097pub struct EntryIteratorMarker;
1098
1099impl fidl::endpoints::ProtocolMarker for EntryIteratorMarker {
1100    type Proxy = EntryIteratorProxy;
1101    type RequestStream = EntryIteratorRequestStream;
1102    #[cfg(target_os = "fuchsia")]
1103    type SynchronousProxy = EntryIteratorSynchronousProxy;
1104
1105    const DEBUG_NAME: &'static str = "(anonymous) EntryIterator";
1106}
1107
1108pub trait EntryIteratorProxyInterface: Send + Sync {
1109    type GetNextResponseFut: std::future::Future<Output = Result<Vec<EntryIteratorItem>, fidl::Error>>
1110        + Send;
1111    fn r#get_next(&self) -> Self::GetNextResponseFut;
1112}
1113#[derive(Debug)]
1114#[cfg(target_os = "fuchsia")]
1115pub struct EntryIteratorSynchronousProxy {
1116    client: fidl::client::sync::Client,
1117}
1118
1119#[cfg(target_os = "fuchsia")]
1120impl fidl::endpoints::SynchronousProxy for EntryIteratorSynchronousProxy {
1121    type Proxy = EntryIteratorProxy;
1122    type Protocol = EntryIteratorMarker;
1123
1124    fn from_channel(inner: fidl::Channel) -> Self {
1125        Self::new(inner)
1126    }
1127
1128    fn into_channel(self) -> fidl::Channel {
1129        self.client.into_channel()
1130    }
1131
1132    fn as_channel(&self) -> &fidl::Channel {
1133        self.client.as_channel()
1134    }
1135}
1136
1137#[cfg(target_os = "fuchsia")]
1138impl EntryIteratorSynchronousProxy {
1139    pub fn new(channel: fidl::Channel) -> Self {
1140        let protocol_name = <EntryIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1141        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1142    }
1143
1144    pub fn into_channel(self) -> fidl::Channel {
1145        self.client.into_channel()
1146    }
1147
1148    /// Waits until an event arrives and returns it. It is safe for other
1149    /// threads to make concurrent requests while waiting for an event.
1150    pub fn wait_for_event(
1151        &self,
1152        deadline: zx::MonotonicInstant,
1153    ) -> Result<EntryIteratorEvent, fidl::Error> {
1154        EntryIteratorEvent::decode(self.client.wait_for_event(deadline)?)
1155    }
1156
1157    /// Take items from the iterator. If no items are available, block until one
1158    /// is; otherwise, return immediately with items queued since the last
1159    /// invocation.
1160    ///
1161    /// This does not guarantee that, when blocking, only one item will be
1162    /// returned; implementations may debounce or batch events.
1163    ///
1164    /// Clients should only have one call of this method at a time; a second
1165    /// call to this method while a call is already pending will cause the
1166    /// server end of the protocol to be closed.
1167    ///
1168    /// - response `events` a list of events that occurred since the last
1169    ///     invocation of this method.
1170    pub fn r#get_next(
1171        &self,
1172        ___deadline: zx::MonotonicInstant,
1173    ) -> Result<Vec<EntryIteratorItem>, fidl::Error> {
1174        let _response =
1175            self.client.send_query::<fidl::encoding::EmptyPayload, EntryIteratorGetNextResponse>(
1176                (),
1177                0x6d03407803da8647,
1178                fidl::encoding::DynamicFlags::empty(),
1179                ___deadline,
1180            )?;
1181        Ok(_response.events)
1182    }
1183}
1184
1185#[cfg(target_os = "fuchsia")]
1186impl From<EntryIteratorSynchronousProxy> for zx::NullableHandle {
1187    fn from(value: EntryIteratorSynchronousProxy) -> Self {
1188        value.into_channel().into()
1189    }
1190}
1191
1192#[cfg(target_os = "fuchsia")]
1193impl From<fidl::Channel> for EntryIteratorSynchronousProxy {
1194    fn from(value: fidl::Channel) -> Self {
1195        Self::new(value)
1196    }
1197}
1198
1199#[cfg(target_os = "fuchsia")]
1200impl fidl::endpoints::FromClient for EntryIteratorSynchronousProxy {
1201    type Protocol = EntryIteratorMarker;
1202
1203    fn from_client(value: fidl::endpoints::ClientEnd<EntryIteratorMarker>) -> Self {
1204        Self::new(value.into_channel())
1205    }
1206}
1207
1208#[derive(Debug, Clone)]
1209pub struct EntryIteratorProxy {
1210    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1211}
1212
1213impl fidl::endpoints::Proxy for EntryIteratorProxy {
1214    type Protocol = EntryIteratorMarker;
1215
1216    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1217        Self::new(inner)
1218    }
1219
1220    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1221        self.client.into_channel().map_err(|client| Self { client })
1222    }
1223
1224    fn as_channel(&self) -> &::fidl::AsyncChannel {
1225        self.client.as_channel()
1226    }
1227}
1228
1229impl EntryIteratorProxy {
1230    /// Create a new Proxy for fuchsia.net.neighbor/EntryIterator.
1231    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1232        let protocol_name = <EntryIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1233        Self { client: fidl::client::Client::new(channel, protocol_name) }
1234    }
1235
1236    /// Get a Stream of events from the remote end of the protocol.
1237    ///
1238    /// # Panics
1239    ///
1240    /// Panics if the event stream was already taken.
1241    pub fn take_event_stream(&self) -> EntryIteratorEventStream {
1242        EntryIteratorEventStream { event_receiver: self.client.take_event_receiver() }
1243    }
1244
1245    /// Take items from the iterator. If no items are available, block until one
1246    /// is; otherwise, return immediately with items queued since the last
1247    /// invocation.
1248    ///
1249    /// This does not guarantee that, when blocking, only one item will be
1250    /// returned; implementations may debounce or batch events.
1251    ///
1252    /// Clients should only have one call of this method at a time; a second
1253    /// call to this method while a call is already pending will cause the
1254    /// server end of the protocol to be closed.
1255    ///
1256    /// - response `events` a list of events that occurred since the last
1257    ///     invocation of this method.
1258    pub fn r#get_next(
1259        &self,
1260    ) -> fidl::client::QueryResponseFut<
1261        Vec<EntryIteratorItem>,
1262        fidl::encoding::DefaultFuchsiaResourceDialect,
1263    > {
1264        EntryIteratorProxyInterface::r#get_next(self)
1265    }
1266}
1267
1268impl EntryIteratorProxyInterface for EntryIteratorProxy {
1269    type GetNextResponseFut = fidl::client::QueryResponseFut<
1270        Vec<EntryIteratorItem>,
1271        fidl::encoding::DefaultFuchsiaResourceDialect,
1272    >;
1273    fn r#get_next(&self) -> Self::GetNextResponseFut {
1274        fn _decode(
1275            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1276        ) -> Result<Vec<EntryIteratorItem>, fidl::Error> {
1277            let _response = fidl::client::decode_transaction_body::<
1278                EntryIteratorGetNextResponse,
1279                fidl::encoding::DefaultFuchsiaResourceDialect,
1280                0x6d03407803da8647,
1281            >(_buf?)?;
1282            Ok(_response.events)
1283        }
1284        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<EntryIteratorItem>>(
1285            (),
1286            0x6d03407803da8647,
1287            fidl::encoding::DynamicFlags::empty(),
1288            _decode,
1289        )
1290    }
1291}
1292
1293pub struct EntryIteratorEventStream {
1294    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1295}
1296
1297impl std::marker::Unpin for EntryIteratorEventStream {}
1298
1299impl futures::stream::FusedStream for EntryIteratorEventStream {
1300    fn is_terminated(&self) -> bool {
1301        self.event_receiver.is_terminated()
1302    }
1303}
1304
1305impl futures::Stream for EntryIteratorEventStream {
1306    type Item = Result<EntryIteratorEvent, fidl::Error>;
1307
1308    fn poll_next(
1309        mut self: std::pin::Pin<&mut Self>,
1310        cx: &mut std::task::Context<'_>,
1311    ) -> std::task::Poll<Option<Self::Item>> {
1312        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1313            &mut self.event_receiver,
1314            cx
1315        )?) {
1316            Some(buf) => std::task::Poll::Ready(Some(EntryIteratorEvent::decode(buf))),
1317            None => std::task::Poll::Ready(None),
1318        }
1319    }
1320}
1321
1322#[derive(Debug)]
1323pub enum EntryIteratorEvent {}
1324
1325impl EntryIteratorEvent {
1326    /// Decodes a message buffer as a [`EntryIteratorEvent`].
1327    fn decode(
1328        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1329    ) -> Result<EntryIteratorEvent, fidl::Error> {
1330        let (bytes, _handles) = buf.split_mut();
1331        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1332        debug_assert_eq!(tx_header.tx_id, 0);
1333        match tx_header.ordinal {
1334            _ => Err(fidl::Error::UnknownOrdinal {
1335                ordinal: tx_header.ordinal,
1336                protocol_name: <EntryIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1337            }),
1338        }
1339    }
1340}
1341
1342/// A Stream of incoming requests for fuchsia.net.neighbor/EntryIterator.
1343pub struct EntryIteratorRequestStream {
1344    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1345    is_terminated: bool,
1346}
1347
1348impl std::marker::Unpin for EntryIteratorRequestStream {}
1349
1350impl futures::stream::FusedStream for EntryIteratorRequestStream {
1351    fn is_terminated(&self) -> bool {
1352        self.is_terminated
1353    }
1354}
1355
1356impl fidl::endpoints::RequestStream for EntryIteratorRequestStream {
1357    type Protocol = EntryIteratorMarker;
1358    type ControlHandle = EntryIteratorControlHandle;
1359
1360    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1361        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1362    }
1363
1364    fn control_handle(&self) -> Self::ControlHandle {
1365        EntryIteratorControlHandle { inner: self.inner.clone() }
1366    }
1367
1368    fn into_inner(
1369        self,
1370    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1371    {
1372        (self.inner, self.is_terminated)
1373    }
1374
1375    fn from_inner(
1376        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1377        is_terminated: bool,
1378    ) -> Self {
1379        Self { inner, is_terminated }
1380    }
1381}
1382
1383impl futures::Stream for EntryIteratorRequestStream {
1384    type Item = Result<EntryIteratorRequest, fidl::Error>;
1385
1386    fn poll_next(
1387        mut self: std::pin::Pin<&mut Self>,
1388        cx: &mut std::task::Context<'_>,
1389    ) -> std::task::Poll<Option<Self::Item>> {
1390        let this = &mut *self;
1391        if this.inner.check_shutdown(cx) {
1392            this.is_terminated = true;
1393            return std::task::Poll::Ready(None);
1394        }
1395        if this.is_terminated {
1396            panic!("polled EntryIteratorRequestStream after completion");
1397        }
1398        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1399            |bytes, handles| {
1400                match this.inner.channel().read_etc(cx, bytes, handles) {
1401                    std::task::Poll::Ready(Ok(())) => {}
1402                    std::task::Poll::Pending => return std::task::Poll::Pending,
1403                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1404                        this.is_terminated = true;
1405                        return std::task::Poll::Ready(None);
1406                    }
1407                    std::task::Poll::Ready(Err(e)) => {
1408                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1409                            e.into(),
1410                        ))));
1411                    }
1412                }
1413
1414                // A message has been received from the channel
1415                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1416
1417                std::task::Poll::Ready(Some(match header.ordinal {
1418                    0x6d03407803da8647 => {
1419                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1420                        let mut req = fidl::new_empty!(
1421                            fidl::encoding::EmptyPayload,
1422                            fidl::encoding::DefaultFuchsiaResourceDialect
1423                        );
1424                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1425                        let control_handle =
1426                            EntryIteratorControlHandle { inner: this.inner.clone() };
1427                        Ok(EntryIteratorRequest::GetNext {
1428                            responder: EntryIteratorGetNextResponder {
1429                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1430                                tx_id: header.tx_id,
1431                            },
1432                        })
1433                    }
1434                    _ => Err(fidl::Error::UnknownOrdinal {
1435                        ordinal: header.ordinal,
1436                        protocol_name:
1437                            <EntryIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1438                    }),
1439                }))
1440            },
1441        )
1442    }
1443}
1444
1445/// Returns entries and events from the neighbor table. Clients can open an
1446/// iterator using the [`fuchsia.net.neighbor/View.EntryIterator`] method.
1447///
1448/// An atomic snapshot of the neighbor table is queued for clients upon opening
1449/// an EntryIterator. This snapshot consists of `existing` entries followed by
1450/// an [`IdleEvent`]. No other types of events will be sent before an
1451/// [`IdleEvent`].
1452#[derive(Debug)]
1453pub enum EntryIteratorRequest {
1454    /// Take items from the iterator. If no items are available, block until one
1455    /// is; otherwise, return immediately with items queued since the last
1456    /// invocation.
1457    ///
1458    /// This does not guarantee that, when blocking, only one item will be
1459    /// returned; implementations may debounce or batch events.
1460    ///
1461    /// Clients should only have one call of this method at a time; a second
1462    /// call to this method while a call is already pending will cause the
1463    /// server end of the protocol to be closed.
1464    ///
1465    /// - response `events` a list of events that occurred since the last
1466    ///     invocation of this method.
1467    GetNext { responder: EntryIteratorGetNextResponder },
1468}
1469
1470impl EntryIteratorRequest {
1471    #[allow(irrefutable_let_patterns)]
1472    pub fn into_get_next(self) -> Option<(EntryIteratorGetNextResponder)> {
1473        if let EntryIteratorRequest::GetNext { responder } = self {
1474            Some((responder))
1475        } else {
1476            None
1477        }
1478    }
1479
1480    /// Name of the method defined in FIDL
1481    pub fn method_name(&self) -> &'static str {
1482        match *self {
1483            EntryIteratorRequest::GetNext { .. } => "get_next",
1484        }
1485    }
1486}
1487
1488#[derive(Debug, Clone)]
1489pub struct EntryIteratorControlHandle {
1490    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1491}
1492
1493impl fidl::endpoints::ControlHandle for EntryIteratorControlHandle {
1494    fn shutdown(&self) {
1495        self.inner.shutdown()
1496    }
1497
1498    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1499        self.inner.shutdown_with_epitaph(status)
1500    }
1501
1502    fn is_closed(&self) -> bool {
1503        self.inner.channel().is_closed()
1504    }
1505    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1506        self.inner.channel().on_closed()
1507    }
1508
1509    #[cfg(target_os = "fuchsia")]
1510    fn signal_peer(
1511        &self,
1512        clear_mask: zx::Signals,
1513        set_mask: zx::Signals,
1514    ) -> Result<(), zx_status::Status> {
1515        use fidl::Peered;
1516        self.inner.channel().signal_peer(clear_mask, set_mask)
1517    }
1518}
1519
1520impl EntryIteratorControlHandle {}
1521
1522#[must_use = "FIDL methods require a response to be sent"]
1523#[derive(Debug)]
1524pub struct EntryIteratorGetNextResponder {
1525    control_handle: std::mem::ManuallyDrop<EntryIteratorControlHandle>,
1526    tx_id: u32,
1527}
1528
1529/// Set the the channel to be shutdown (see [`EntryIteratorControlHandle::shutdown`])
1530/// if the responder is dropped without sending a response, so that the client
1531/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1532impl std::ops::Drop for EntryIteratorGetNextResponder {
1533    fn drop(&mut self) {
1534        self.control_handle.shutdown();
1535        // Safety: drops once, never accessed again
1536        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1537    }
1538}
1539
1540impl fidl::endpoints::Responder for EntryIteratorGetNextResponder {
1541    type ControlHandle = EntryIteratorControlHandle;
1542
1543    fn control_handle(&self) -> &EntryIteratorControlHandle {
1544        &self.control_handle
1545    }
1546
1547    fn drop_without_shutdown(mut self) {
1548        // Safety: drops once, never accessed again due to mem::forget
1549        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1550        // Prevent Drop from running (which would shut down the channel)
1551        std::mem::forget(self);
1552    }
1553}
1554
1555impl EntryIteratorGetNextResponder {
1556    /// Sends a response to the FIDL transaction.
1557    ///
1558    /// Sets the channel to shutdown if an error occurs.
1559    pub fn send(self, mut events: &[EntryIteratorItem]) -> Result<(), fidl::Error> {
1560        let _result = self.send_raw(events);
1561        if _result.is_err() {
1562            self.control_handle.shutdown();
1563        }
1564        self.drop_without_shutdown();
1565        _result
1566    }
1567
1568    /// Similar to "send" but does not shutdown the channel if an error occurs.
1569    pub fn send_no_shutdown_on_err(
1570        self,
1571        mut events: &[EntryIteratorItem],
1572    ) -> Result<(), fidl::Error> {
1573        let _result = self.send_raw(events);
1574        self.drop_without_shutdown();
1575        _result
1576    }
1577
1578    fn send_raw(&self, mut events: &[EntryIteratorItem]) -> Result<(), fidl::Error> {
1579        self.control_handle.inner.send::<EntryIteratorGetNextResponse>(
1580            (events,),
1581            self.tx_id,
1582            0x6d03407803da8647,
1583            fidl::encoding::DynamicFlags::empty(),
1584        )
1585    }
1586}
1587
1588#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1589pub struct ViewMarker;
1590
1591impl fidl::endpoints::ProtocolMarker for ViewMarker {
1592    type Proxy = ViewProxy;
1593    type RequestStream = ViewRequestStream;
1594    #[cfg(target_os = "fuchsia")]
1595    type SynchronousProxy = ViewSynchronousProxy;
1596
1597    const DEBUG_NAME: &'static str = "fuchsia.net.neighbor.View";
1598}
1599impl fidl::endpoints::DiscoverableProtocolMarker for ViewMarker {}
1600
1601pub trait ViewProxyInterface: Send + Sync {
1602    fn r#open_entry_iterator(
1603        &self,
1604        it: fidl::endpoints::ServerEnd<EntryIteratorMarker>,
1605        options: &EntryIteratorOptions,
1606    ) -> Result<(), fidl::Error>;
1607}
1608#[derive(Debug)]
1609#[cfg(target_os = "fuchsia")]
1610pub struct ViewSynchronousProxy {
1611    client: fidl::client::sync::Client,
1612}
1613
1614#[cfg(target_os = "fuchsia")]
1615impl fidl::endpoints::SynchronousProxy for ViewSynchronousProxy {
1616    type Proxy = ViewProxy;
1617    type Protocol = ViewMarker;
1618
1619    fn from_channel(inner: fidl::Channel) -> Self {
1620        Self::new(inner)
1621    }
1622
1623    fn into_channel(self) -> fidl::Channel {
1624        self.client.into_channel()
1625    }
1626
1627    fn as_channel(&self) -> &fidl::Channel {
1628        self.client.as_channel()
1629    }
1630}
1631
1632#[cfg(target_os = "fuchsia")]
1633impl ViewSynchronousProxy {
1634    pub fn new(channel: fidl::Channel) -> Self {
1635        let protocol_name = <ViewMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1636        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1637    }
1638
1639    pub fn into_channel(self) -> fidl::Channel {
1640        self.client.into_channel()
1641    }
1642
1643    /// Waits until an event arrives and returns it. It is safe for other
1644    /// threads to make concurrent requests while waiting for an event.
1645    pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<ViewEvent, fidl::Error> {
1646        ViewEvent::decode(self.client.wait_for_event(deadline)?)
1647    }
1648
1649    /// Open a connection to an [`EntryIterator`] for listing existing entries
1650    /// and optionally watching for state changes.
1651    ///
1652    /// + request `it` grants access to the [`EntryIterator`].
1653    /// + request `options` specifies the behavior of the [`EntryIterator`].
1654    pub fn r#open_entry_iterator(
1655        &self,
1656        mut it: fidl::endpoints::ServerEnd<EntryIteratorMarker>,
1657        mut options: &EntryIteratorOptions,
1658    ) -> Result<(), fidl::Error> {
1659        self.client.send::<ViewOpenEntryIteratorRequest>(
1660            (it, options),
1661            0x3c9531929383e911,
1662            fidl::encoding::DynamicFlags::empty(),
1663        )
1664    }
1665}
1666
1667#[cfg(target_os = "fuchsia")]
1668impl From<ViewSynchronousProxy> for zx::NullableHandle {
1669    fn from(value: ViewSynchronousProxy) -> Self {
1670        value.into_channel().into()
1671    }
1672}
1673
1674#[cfg(target_os = "fuchsia")]
1675impl From<fidl::Channel> for ViewSynchronousProxy {
1676    fn from(value: fidl::Channel) -> Self {
1677        Self::new(value)
1678    }
1679}
1680
1681#[cfg(target_os = "fuchsia")]
1682impl fidl::endpoints::FromClient for ViewSynchronousProxy {
1683    type Protocol = ViewMarker;
1684
1685    fn from_client(value: fidl::endpoints::ClientEnd<ViewMarker>) -> Self {
1686        Self::new(value.into_channel())
1687    }
1688}
1689
1690#[derive(Debug, Clone)]
1691pub struct ViewProxy {
1692    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1693}
1694
1695impl fidl::endpoints::Proxy for ViewProxy {
1696    type Protocol = ViewMarker;
1697
1698    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1699        Self::new(inner)
1700    }
1701
1702    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1703        self.client.into_channel().map_err(|client| Self { client })
1704    }
1705
1706    fn as_channel(&self) -> &::fidl::AsyncChannel {
1707        self.client.as_channel()
1708    }
1709}
1710
1711impl ViewProxy {
1712    /// Create a new Proxy for fuchsia.net.neighbor/View.
1713    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1714        let protocol_name = <ViewMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1715        Self { client: fidl::client::Client::new(channel, protocol_name) }
1716    }
1717
1718    /// Get a Stream of events from the remote end of the protocol.
1719    ///
1720    /// # Panics
1721    ///
1722    /// Panics if the event stream was already taken.
1723    pub fn take_event_stream(&self) -> ViewEventStream {
1724        ViewEventStream { event_receiver: self.client.take_event_receiver() }
1725    }
1726
1727    /// Open a connection to an [`EntryIterator`] for listing existing entries
1728    /// and optionally watching for state changes.
1729    ///
1730    /// + request `it` grants access to the [`EntryIterator`].
1731    /// + request `options` specifies the behavior of the [`EntryIterator`].
1732    pub fn r#open_entry_iterator(
1733        &self,
1734        mut it: fidl::endpoints::ServerEnd<EntryIteratorMarker>,
1735        mut options: &EntryIteratorOptions,
1736    ) -> Result<(), fidl::Error> {
1737        ViewProxyInterface::r#open_entry_iterator(self, it, options)
1738    }
1739}
1740
1741impl ViewProxyInterface for ViewProxy {
1742    fn r#open_entry_iterator(
1743        &self,
1744        mut it: fidl::endpoints::ServerEnd<EntryIteratorMarker>,
1745        mut options: &EntryIteratorOptions,
1746    ) -> Result<(), fidl::Error> {
1747        self.client.send::<ViewOpenEntryIteratorRequest>(
1748            (it, options),
1749            0x3c9531929383e911,
1750            fidl::encoding::DynamicFlags::empty(),
1751        )
1752    }
1753}
1754
1755pub struct ViewEventStream {
1756    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1757}
1758
1759impl std::marker::Unpin for ViewEventStream {}
1760
1761impl futures::stream::FusedStream for ViewEventStream {
1762    fn is_terminated(&self) -> bool {
1763        self.event_receiver.is_terminated()
1764    }
1765}
1766
1767impl futures::Stream for ViewEventStream {
1768    type Item = Result<ViewEvent, fidl::Error>;
1769
1770    fn poll_next(
1771        mut self: std::pin::Pin<&mut Self>,
1772        cx: &mut std::task::Context<'_>,
1773    ) -> std::task::Poll<Option<Self::Item>> {
1774        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1775            &mut self.event_receiver,
1776            cx
1777        )?) {
1778            Some(buf) => std::task::Poll::Ready(Some(ViewEvent::decode(buf))),
1779            None => std::task::Poll::Ready(None),
1780        }
1781    }
1782}
1783
1784#[derive(Debug)]
1785pub enum ViewEvent {}
1786
1787impl ViewEvent {
1788    /// Decodes a message buffer as a [`ViewEvent`].
1789    fn decode(
1790        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1791    ) -> Result<ViewEvent, fidl::Error> {
1792        let (bytes, _handles) = buf.split_mut();
1793        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1794        debug_assert_eq!(tx_header.tx_id, 0);
1795        match tx_header.ordinal {
1796            _ => Err(fidl::Error::UnknownOrdinal {
1797                ordinal: tx_header.ordinal,
1798                protocol_name: <ViewMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1799            }),
1800        }
1801    }
1802}
1803
1804/// A Stream of incoming requests for fuchsia.net.neighbor/View.
1805pub struct ViewRequestStream {
1806    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1807    is_terminated: bool,
1808}
1809
1810impl std::marker::Unpin for ViewRequestStream {}
1811
1812impl futures::stream::FusedStream for ViewRequestStream {
1813    fn is_terminated(&self) -> bool {
1814        self.is_terminated
1815    }
1816}
1817
1818impl fidl::endpoints::RequestStream for ViewRequestStream {
1819    type Protocol = ViewMarker;
1820    type ControlHandle = ViewControlHandle;
1821
1822    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1823        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1824    }
1825
1826    fn control_handle(&self) -> Self::ControlHandle {
1827        ViewControlHandle { inner: self.inner.clone() }
1828    }
1829
1830    fn into_inner(
1831        self,
1832    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1833    {
1834        (self.inner, self.is_terminated)
1835    }
1836
1837    fn from_inner(
1838        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1839        is_terminated: bool,
1840    ) -> Self {
1841        Self { inner, is_terminated }
1842    }
1843}
1844
1845impl futures::Stream for ViewRequestStream {
1846    type Item = Result<ViewRequest, fidl::Error>;
1847
1848    fn poll_next(
1849        mut self: std::pin::Pin<&mut Self>,
1850        cx: &mut std::task::Context<'_>,
1851    ) -> std::task::Poll<Option<Self::Item>> {
1852        let this = &mut *self;
1853        if this.inner.check_shutdown(cx) {
1854            this.is_terminated = true;
1855            return std::task::Poll::Ready(None);
1856        }
1857        if this.is_terminated {
1858            panic!("polled ViewRequestStream after completion");
1859        }
1860        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1861            |bytes, handles| {
1862                match this.inner.channel().read_etc(cx, bytes, handles) {
1863                    std::task::Poll::Ready(Ok(())) => {}
1864                    std::task::Poll::Pending => return std::task::Poll::Pending,
1865                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1866                        this.is_terminated = true;
1867                        return std::task::Poll::Ready(None);
1868                    }
1869                    std::task::Poll::Ready(Err(e)) => {
1870                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1871                            e.into(),
1872                        ))));
1873                    }
1874                }
1875
1876                // A message has been received from the channel
1877                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1878
1879                std::task::Poll::Ready(Some(match header.ordinal {
1880                    0x3c9531929383e911 => {
1881                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1882                        let mut req = fidl::new_empty!(
1883                            ViewOpenEntryIteratorRequest,
1884                            fidl::encoding::DefaultFuchsiaResourceDialect
1885                        );
1886                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ViewOpenEntryIteratorRequest>(&header, _body_bytes, handles, &mut req)?;
1887                        let control_handle = ViewControlHandle { inner: this.inner.clone() };
1888                        Ok(ViewRequest::OpenEntryIterator {
1889                            it: req.it,
1890                            options: req.options,
1891
1892                            control_handle,
1893                        })
1894                    }
1895                    _ => Err(fidl::Error::UnknownOrdinal {
1896                        ordinal: header.ordinal,
1897                        protocol_name: <ViewMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1898                    }),
1899                }))
1900            },
1901        )
1902    }
1903}
1904
1905/// Inspect the neighbor table.
1906#[derive(Debug)]
1907pub enum ViewRequest {
1908    /// Open a connection to an [`EntryIterator`] for listing existing entries
1909    /// and optionally watching for state changes.
1910    ///
1911    /// + request `it` grants access to the [`EntryIterator`].
1912    /// + request `options` specifies the behavior of the [`EntryIterator`].
1913    OpenEntryIterator {
1914        it: fidl::endpoints::ServerEnd<EntryIteratorMarker>,
1915        options: EntryIteratorOptions,
1916        control_handle: ViewControlHandle,
1917    },
1918}
1919
1920impl ViewRequest {
1921    #[allow(irrefutable_let_patterns)]
1922    pub fn into_open_entry_iterator(
1923        self,
1924    ) -> Option<(
1925        fidl::endpoints::ServerEnd<EntryIteratorMarker>,
1926        EntryIteratorOptions,
1927        ViewControlHandle,
1928    )> {
1929        if let ViewRequest::OpenEntryIterator { it, options, control_handle } = self {
1930            Some((it, options, control_handle))
1931        } else {
1932            None
1933        }
1934    }
1935
1936    /// Name of the method defined in FIDL
1937    pub fn method_name(&self) -> &'static str {
1938        match *self {
1939            ViewRequest::OpenEntryIterator { .. } => "open_entry_iterator",
1940        }
1941    }
1942}
1943
1944#[derive(Debug, Clone)]
1945pub struct ViewControlHandle {
1946    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1947}
1948
1949impl fidl::endpoints::ControlHandle for ViewControlHandle {
1950    fn shutdown(&self) {
1951        self.inner.shutdown()
1952    }
1953
1954    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1955        self.inner.shutdown_with_epitaph(status)
1956    }
1957
1958    fn is_closed(&self) -> bool {
1959        self.inner.channel().is_closed()
1960    }
1961    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1962        self.inner.channel().on_closed()
1963    }
1964
1965    #[cfg(target_os = "fuchsia")]
1966    fn signal_peer(
1967        &self,
1968        clear_mask: zx::Signals,
1969        set_mask: zx::Signals,
1970    ) -> Result<(), zx_status::Status> {
1971        use fidl::Peered;
1972        self.inner.channel().signal_peer(clear_mask, set_mask)
1973    }
1974}
1975
1976impl ViewControlHandle {}
1977
1978mod internal {
1979    use super::*;
1980
1981    impl fidl::encoding::ResourceTypeMarker for ViewOpenEntryIteratorRequest {
1982        type Borrowed<'a> = &'a mut Self;
1983        fn take_or_borrow<'a>(
1984            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1985        ) -> Self::Borrowed<'a> {
1986            value
1987        }
1988    }
1989
1990    unsafe impl fidl::encoding::TypeMarker for ViewOpenEntryIteratorRequest {
1991        type Owned = Self;
1992
1993        #[inline(always)]
1994        fn inline_align(_context: fidl::encoding::Context) -> usize {
1995            8
1996        }
1997
1998        #[inline(always)]
1999        fn inline_size(_context: fidl::encoding::Context) -> usize {
2000            24
2001        }
2002    }
2003
2004    unsafe impl
2005        fidl::encoding::Encode<
2006            ViewOpenEntryIteratorRequest,
2007            fidl::encoding::DefaultFuchsiaResourceDialect,
2008        > for &mut ViewOpenEntryIteratorRequest
2009    {
2010        #[inline]
2011        unsafe fn encode(
2012            self,
2013            encoder: &mut fidl::encoding::Encoder<
2014                '_,
2015                fidl::encoding::DefaultFuchsiaResourceDialect,
2016            >,
2017            offset: usize,
2018            _depth: fidl::encoding::Depth,
2019        ) -> fidl::Result<()> {
2020            encoder.debug_check_bounds::<ViewOpenEntryIteratorRequest>(offset);
2021            // Delegate to tuple encoding.
2022            fidl::encoding::Encode::<ViewOpenEntryIteratorRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2023                (
2024                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EntryIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.it),
2025                    <EntryIteratorOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
2026                ),
2027                encoder, offset, _depth
2028            )
2029        }
2030    }
2031    unsafe impl<
2032        T0: fidl::encoding::Encode<
2033                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EntryIteratorMarker>>,
2034                fidl::encoding::DefaultFuchsiaResourceDialect,
2035            >,
2036        T1: fidl::encoding::Encode<EntryIteratorOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
2037    >
2038        fidl::encoding::Encode<
2039            ViewOpenEntryIteratorRequest,
2040            fidl::encoding::DefaultFuchsiaResourceDialect,
2041        > for (T0, T1)
2042    {
2043        #[inline]
2044        unsafe fn encode(
2045            self,
2046            encoder: &mut fidl::encoding::Encoder<
2047                '_,
2048                fidl::encoding::DefaultFuchsiaResourceDialect,
2049            >,
2050            offset: usize,
2051            depth: fidl::encoding::Depth,
2052        ) -> fidl::Result<()> {
2053            encoder.debug_check_bounds::<ViewOpenEntryIteratorRequest>(offset);
2054            // Zero out padding regions. There's no need to apply masks
2055            // because the unmasked parts will be overwritten by fields.
2056            unsafe {
2057                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2058                (ptr as *mut u64).write_unaligned(0);
2059            }
2060            // Write the fields.
2061            self.0.encode(encoder, offset + 0, depth)?;
2062            self.1.encode(encoder, offset + 8, depth)?;
2063            Ok(())
2064        }
2065    }
2066
2067    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2068        for ViewOpenEntryIteratorRequest
2069    {
2070        #[inline(always)]
2071        fn new_empty() -> Self {
2072            Self {
2073                it: fidl::new_empty!(
2074                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EntryIteratorMarker>>,
2075                    fidl::encoding::DefaultFuchsiaResourceDialect
2076                ),
2077                options: fidl::new_empty!(
2078                    EntryIteratorOptions,
2079                    fidl::encoding::DefaultFuchsiaResourceDialect
2080                ),
2081            }
2082        }
2083
2084        #[inline]
2085        unsafe fn decode(
2086            &mut self,
2087            decoder: &mut fidl::encoding::Decoder<
2088                '_,
2089                fidl::encoding::DefaultFuchsiaResourceDialect,
2090            >,
2091            offset: usize,
2092            _depth: fidl::encoding::Depth,
2093        ) -> fidl::Result<()> {
2094            decoder.debug_check_bounds::<Self>(offset);
2095            // Verify that padding bytes are zero.
2096            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2097            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2098            let mask = 0xffffffff00000000u64;
2099            let maskedval = padval & mask;
2100            if maskedval != 0 {
2101                return Err(fidl::Error::NonZeroPadding {
2102                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2103                });
2104            }
2105            fidl::decode!(
2106                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EntryIteratorMarker>>,
2107                fidl::encoding::DefaultFuchsiaResourceDialect,
2108                &mut self.it,
2109                decoder,
2110                offset + 0,
2111                _depth
2112            )?;
2113            fidl::decode!(
2114                EntryIteratorOptions,
2115                fidl::encoding::DefaultFuchsiaResourceDialect,
2116                &mut self.options,
2117                decoder,
2118                offset + 8,
2119                _depth
2120            )?;
2121            Ok(())
2122        }
2123    }
2124}