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