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