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