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::NullableHandle {
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
714    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
715        self.inner.shutdown_with_epitaph(status)
716    }
717
718    fn is_closed(&self) -> bool {
719        self.inner.channel().is_closed()
720    }
721    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
722        self.inner.channel().on_closed()
723    }
724
725    #[cfg(target_os = "fuchsia")]
726    fn signal_peer(
727        &self,
728        clear_mask: zx::Signals,
729        set_mask: zx::Signals,
730    ) -> Result<(), zx_status::Status> {
731        use fidl::Peered;
732        self.inner.channel().signal_peer(clear_mask, set_mask)
733    }
734}
735
736impl ControllerControlHandle {}
737
738#[must_use = "FIDL methods require a response to be sent"]
739#[derive(Debug)]
740pub struct ControllerAddEntryResponder {
741    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
742    tx_id: u32,
743}
744
745/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
746/// if the responder is dropped without sending a response, so that the client
747/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
748impl std::ops::Drop for ControllerAddEntryResponder {
749    fn drop(&mut self) {
750        self.control_handle.shutdown();
751        // Safety: drops once, never accessed again
752        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
753    }
754}
755
756impl fidl::endpoints::Responder for ControllerAddEntryResponder {
757    type ControlHandle = ControllerControlHandle;
758
759    fn control_handle(&self) -> &ControllerControlHandle {
760        &self.control_handle
761    }
762
763    fn drop_without_shutdown(mut self) {
764        // Safety: drops once, never accessed again due to mem::forget
765        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
766        // Prevent Drop from running (which would shut down the channel)
767        std::mem::forget(self);
768    }
769}
770
771impl ControllerAddEntryResponder {
772    /// Sends a response to the FIDL transaction.
773    ///
774    /// Sets the channel to shutdown if an error occurs.
775    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
776        let _result = self.send_raw(result);
777        if _result.is_err() {
778            self.control_handle.shutdown();
779        }
780        self.drop_without_shutdown();
781        _result
782    }
783
784    /// Similar to "send" but does not shutdown the channel if an error occurs.
785    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
786        let _result = self.send_raw(result);
787        self.drop_without_shutdown();
788        _result
789    }
790
791    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
792        self.control_handle
793            .inner
794            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
795                result,
796                self.tx_id,
797                0x778c829580aa23ac,
798                fidl::encoding::DynamicFlags::empty(),
799            )
800    }
801}
802
803#[must_use = "FIDL methods require a response to be sent"]
804#[derive(Debug)]
805pub struct ControllerRemoveEntryResponder {
806    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
807    tx_id: u32,
808}
809
810/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
811/// if the responder is dropped without sending a response, so that the client
812/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
813impl std::ops::Drop for ControllerRemoveEntryResponder {
814    fn drop(&mut self) {
815        self.control_handle.shutdown();
816        // Safety: drops once, never accessed again
817        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
818    }
819}
820
821impl fidl::endpoints::Responder for ControllerRemoveEntryResponder {
822    type ControlHandle = ControllerControlHandle;
823
824    fn control_handle(&self) -> &ControllerControlHandle {
825        &self.control_handle
826    }
827
828    fn drop_without_shutdown(mut self) {
829        // Safety: drops once, never accessed again due to mem::forget
830        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
831        // Prevent Drop from running (which would shut down the channel)
832        std::mem::forget(self);
833    }
834}
835
836impl ControllerRemoveEntryResponder {
837    /// Sends a response to the FIDL transaction.
838    ///
839    /// Sets the channel to shutdown if an error occurs.
840    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
841        let _result = self.send_raw(result);
842        if _result.is_err() {
843            self.control_handle.shutdown();
844        }
845        self.drop_without_shutdown();
846        _result
847    }
848
849    /// Similar to "send" but does not shutdown the channel if an error occurs.
850    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
851        let _result = self.send_raw(result);
852        self.drop_without_shutdown();
853        _result
854    }
855
856    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
857        self.control_handle
858            .inner
859            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
860                result,
861                self.tx_id,
862                0xfd0b52f53a0f815,
863                fidl::encoding::DynamicFlags::empty(),
864            )
865    }
866}
867
868#[must_use = "FIDL methods require a response to be sent"]
869#[derive(Debug)]
870pub struct ControllerClearEntriesResponder {
871    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
872    tx_id: u32,
873}
874
875/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
876/// if the responder is dropped without sending a response, so that the client
877/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
878impl std::ops::Drop for ControllerClearEntriesResponder {
879    fn drop(&mut self) {
880        self.control_handle.shutdown();
881        // Safety: drops once, never accessed again
882        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
883    }
884}
885
886impl fidl::endpoints::Responder for ControllerClearEntriesResponder {
887    type ControlHandle = ControllerControlHandle;
888
889    fn control_handle(&self) -> &ControllerControlHandle {
890        &self.control_handle
891    }
892
893    fn drop_without_shutdown(mut self) {
894        // Safety: drops once, never accessed again due to mem::forget
895        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
896        // Prevent Drop from running (which would shut down the channel)
897        std::mem::forget(self);
898    }
899}
900
901impl ControllerClearEntriesResponder {
902    /// Sends a response to the FIDL transaction.
903    ///
904    /// Sets the channel to shutdown if an error occurs.
905    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
906        let _result = self.send_raw(result);
907        if _result.is_err() {
908            self.control_handle.shutdown();
909        }
910        self.drop_without_shutdown();
911        _result
912    }
913
914    /// Similar to "send" but does not shutdown the channel if an error occurs.
915    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
916        let _result = self.send_raw(result);
917        self.drop_without_shutdown();
918        _result
919    }
920
921    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
922        self.control_handle
923            .inner
924            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
925                result,
926                self.tx_id,
927                0x33e53d9769a999d,
928                fidl::encoding::DynamicFlags::empty(),
929            )
930    }
931}
932
933#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
934pub struct EntryIteratorMarker;
935
936impl fidl::endpoints::ProtocolMarker for EntryIteratorMarker {
937    type Proxy = EntryIteratorProxy;
938    type RequestStream = EntryIteratorRequestStream;
939    #[cfg(target_os = "fuchsia")]
940    type SynchronousProxy = EntryIteratorSynchronousProxy;
941
942    const DEBUG_NAME: &'static str = "(anonymous) EntryIterator";
943}
944
945pub trait EntryIteratorProxyInterface: Send + Sync {
946    type GetNextResponseFut: std::future::Future<Output = Result<Vec<EntryIteratorItem>, fidl::Error>>
947        + Send;
948    fn r#get_next(&self) -> Self::GetNextResponseFut;
949}
950#[derive(Debug)]
951#[cfg(target_os = "fuchsia")]
952pub struct EntryIteratorSynchronousProxy {
953    client: fidl::client::sync::Client,
954}
955
956#[cfg(target_os = "fuchsia")]
957impl fidl::endpoints::SynchronousProxy for EntryIteratorSynchronousProxy {
958    type Proxy = EntryIteratorProxy;
959    type Protocol = EntryIteratorMarker;
960
961    fn from_channel(inner: fidl::Channel) -> Self {
962        Self::new(inner)
963    }
964
965    fn into_channel(self) -> fidl::Channel {
966        self.client.into_channel()
967    }
968
969    fn as_channel(&self) -> &fidl::Channel {
970        self.client.as_channel()
971    }
972}
973
974#[cfg(target_os = "fuchsia")]
975impl EntryIteratorSynchronousProxy {
976    pub fn new(channel: fidl::Channel) -> Self {
977        let protocol_name = <EntryIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
978        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
979    }
980
981    pub fn into_channel(self) -> fidl::Channel {
982        self.client.into_channel()
983    }
984
985    /// Waits until an event arrives and returns it. It is safe for other
986    /// threads to make concurrent requests while waiting for an event.
987    pub fn wait_for_event(
988        &self,
989        deadline: zx::MonotonicInstant,
990    ) -> Result<EntryIteratorEvent, fidl::Error> {
991        EntryIteratorEvent::decode(self.client.wait_for_event(deadline)?)
992    }
993
994    /// Take items from the iterator. If no items are available, block until one
995    /// is; otherwise, return immediately with items queued since the last
996    /// invocation.
997    ///
998    /// This does not guarantee that, when blocking, only one item will be
999    /// returned; implementations may debounce or batch events.
1000    ///
1001    /// Clients should only have one call of this method at a time; a second
1002    /// call to this method while a call is already pending will cause the
1003    /// server end of the protocol to be closed.
1004    ///
1005    /// - response `events` a list of events that occurred since the last
1006    ///     invocation of this method.
1007    pub fn r#get_next(
1008        &self,
1009        ___deadline: zx::MonotonicInstant,
1010    ) -> Result<Vec<EntryIteratorItem>, fidl::Error> {
1011        let _response =
1012            self.client.send_query::<fidl::encoding::EmptyPayload, EntryIteratorGetNextResponse>(
1013                (),
1014                0x6d03407803da8647,
1015                fidl::encoding::DynamicFlags::empty(),
1016                ___deadline,
1017            )?;
1018        Ok(_response.events)
1019    }
1020}
1021
1022#[cfg(target_os = "fuchsia")]
1023impl From<EntryIteratorSynchronousProxy> for zx::NullableHandle {
1024    fn from(value: EntryIteratorSynchronousProxy) -> Self {
1025        value.into_channel().into()
1026    }
1027}
1028
1029#[cfg(target_os = "fuchsia")]
1030impl From<fidl::Channel> for EntryIteratorSynchronousProxy {
1031    fn from(value: fidl::Channel) -> Self {
1032        Self::new(value)
1033    }
1034}
1035
1036#[cfg(target_os = "fuchsia")]
1037impl fidl::endpoints::FromClient for EntryIteratorSynchronousProxy {
1038    type Protocol = EntryIteratorMarker;
1039
1040    fn from_client(value: fidl::endpoints::ClientEnd<EntryIteratorMarker>) -> Self {
1041        Self::new(value.into_channel())
1042    }
1043}
1044
1045#[derive(Debug, Clone)]
1046pub struct EntryIteratorProxy {
1047    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1048}
1049
1050impl fidl::endpoints::Proxy for EntryIteratorProxy {
1051    type Protocol = EntryIteratorMarker;
1052
1053    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1054        Self::new(inner)
1055    }
1056
1057    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1058        self.client.into_channel().map_err(|client| Self { client })
1059    }
1060
1061    fn as_channel(&self) -> &::fidl::AsyncChannel {
1062        self.client.as_channel()
1063    }
1064}
1065
1066impl EntryIteratorProxy {
1067    /// Create a new Proxy for fuchsia.net.neighbor/EntryIterator.
1068    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1069        let protocol_name = <EntryIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1070        Self { client: fidl::client::Client::new(channel, protocol_name) }
1071    }
1072
1073    /// Get a Stream of events from the remote end of the protocol.
1074    ///
1075    /// # Panics
1076    ///
1077    /// Panics if the event stream was already taken.
1078    pub fn take_event_stream(&self) -> EntryIteratorEventStream {
1079        EntryIteratorEventStream { event_receiver: self.client.take_event_receiver() }
1080    }
1081
1082    /// Take items from the iterator. If no items are available, block until one
1083    /// is; otherwise, return immediately with items queued since the last
1084    /// invocation.
1085    ///
1086    /// This does not guarantee that, when blocking, only one item will be
1087    /// returned; implementations may debounce or batch events.
1088    ///
1089    /// Clients should only have one call of this method at a time; a second
1090    /// call to this method while a call is already pending will cause the
1091    /// server end of the protocol to be closed.
1092    ///
1093    /// - response `events` a list of events that occurred since the last
1094    ///     invocation of this method.
1095    pub fn r#get_next(
1096        &self,
1097    ) -> fidl::client::QueryResponseFut<
1098        Vec<EntryIteratorItem>,
1099        fidl::encoding::DefaultFuchsiaResourceDialect,
1100    > {
1101        EntryIteratorProxyInterface::r#get_next(self)
1102    }
1103}
1104
1105impl EntryIteratorProxyInterface for EntryIteratorProxy {
1106    type GetNextResponseFut = fidl::client::QueryResponseFut<
1107        Vec<EntryIteratorItem>,
1108        fidl::encoding::DefaultFuchsiaResourceDialect,
1109    >;
1110    fn r#get_next(&self) -> Self::GetNextResponseFut {
1111        fn _decode(
1112            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1113        ) -> Result<Vec<EntryIteratorItem>, fidl::Error> {
1114            let _response = fidl::client::decode_transaction_body::<
1115                EntryIteratorGetNextResponse,
1116                fidl::encoding::DefaultFuchsiaResourceDialect,
1117                0x6d03407803da8647,
1118            >(_buf?)?;
1119            Ok(_response.events)
1120        }
1121        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<EntryIteratorItem>>(
1122            (),
1123            0x6d03407803da8647,
1124            fidl::encoding::DynamicFlags::empty(),
1125            _decode,
1126        )
1127    }
1128}
1129
1130pub struct EntryIteratorEventStream {
1131    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1132}
1133
1134impl std::marker::Unpin for EntryIteratorEventStream {}
1135
1136impl futures::stream::FusedStream for EntryIteratorEventStream {
1137    fn is_terminated(&self) -> bool {
1138        self.event_receiver.is_terminated()
1139    }
1140}
1141
1142impl futures::Stream for EntryIteratorEventStream {
1143    type Item = Result<EntryIteratorEvent, fidl::Error>;
1144
1145    fn poll_next(
1146        mut self: std::pin::Pin<&mut Self>,
1147        cx: &mut std::task::Context<'_>,
1148    ) -> std::task::Poll<Option<Self::Item>> {
1149        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1150            &mut self.event_receiver,
1151            cx
1152        )?) {
1153            Some(buf) => std::task::Poll::Ready(Some(EntryIteratorEvent::decode(buf))),
1154            None => std::task::Poll::Ready(None),
1155        }
1156    }
1157}
1158
1159#[derive(Debug)]
1160pub enum EntryIteratorEvent {}
1161
1162impl EntryIteratorEvent {
1163    /// Decodes a message buffer as a [`EntryIteratorEvent`].
1164    fn decode(
1165        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1166    ) -> Result<EntryIteratorEvent, fidl::Error> {
1167        let (bytes, _handles) = buf.split_mut();
1168        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1169        debug_assert_eq!(tx_header.tx_id, 0);
1170        match tx_header.ordinal {
1171            _ => Err(fidl::Error::UnknownOrdinal {
1172                ordinal: tx_header.ordinal,
1173                protocol_name: <EntryIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1174            }),
1175        }
1176    }
1177}
1178
1179/// A Stream of incoming requests for fuchsia.net.neighbor/EntryIterator.
1180pub struct EntryIteratorRequestStream {
1181    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1182    is_terminated: bool,
1183}
1184
1185impl std::marker::Unpin for EntryIteratorRequestStream {}
1186
1187impl futures::stream::FusedStream for EntryIteratorRequestStream {
1188    fn is_terminated(&self) -> bool {
1189        self.is_terminated
1190    }
1191}
1192
1193impl fidl::endpoints::RequestStream for EntryIteratorRequestStream {
1194    type Protocol = EntryIteratorMarker;
1195    type ControlHandle = EntryIteratorControlHandle;
1196
1197    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1198        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1199    }
1200
1201    fn control_handle(&self) -> Self::ControlHandle {
1202        EntryIteratorControlHandle { inner: self.inner.clone() }
1203    }
1204
1205    fn into_inner(
1206        self,
1207    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1208    {
1209        (self.inner, self.is_terminated)
1210    }
1211
1212    fn from_inner(
1213        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1214        is_terminated: bool,
1215    ) -> Self {
1216        Self { inner, is_terminated }
1217    }
1218}
1219
1220impl futures::Stream for EntryIteratorRequestStream {
1221    type Item = Result<EntryIteratorRequest, fidl::Error>;
1222
1223    fn poll_next(
1224        mut self: std::pin::Pin<&mut Self>,
1225        cx: &mut std::task::Context<'_>,
1226    ) -> std::task::Poll<Option<Self::Item>> {
1227        let this = &mut *self;
1228        if this.inner.check_shutdown(cx) {
1229            this.is_terminated = true;
1230            return std::task::Poll::Ready(None);
1231        }
1232        if this.is_terminated {
1233            panic!("polled EntryIteratorRequestStream after completion");
1234        }
1235        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1236            |bytes, handles| {
1237                match this.inner.channel().read_etc(cx, bytes, handles) {
1238                    std::task::Poll::Ready(Ok(())) => {}
1239                    std::task::Poll::Pending => return std::task::Poll::Pending,
1240                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1241                        this.is_terminated = true;
1242                        return std::task::Poll::Ready(None);
1243                    }
1244                    std::task::Poll::Ready(Err(e)) => {
1245                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1246                            e.into(),
1247                        ))));
1248                    }
1249                }
1250
1251                // A message has been received from the channel
1252                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1253
1254                std::task::Poll::Ready(Some(match header.ordinal {
1255                    0x6d03407803da8647 => {
1256                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1257                        let mut req = fidl::new_empty!(
1258                            fidl::encoding::EmptyPayload,
1259                            fidl::encoding::DefaultFuchsiaResourceDialect
1260                        );
1261                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1262                        let control_handle =
1263                            EntryIteratorControlHandle { inner: this.inner.clone() };
1264                        Ok(EntryIteratorRequest::GetNext {
1265                            responder: EntryIteratorGetNextResponder {
1266                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1267                                tx_id: header.tx_id,
1268                            },
1269                        })
1270                    }
1271                    _ => Err(fidl::Error::UnknownOrdinal {
1272                        ordinal: header.ordinal,
1273                        protocol_name:
1274                            <EntryIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1275                    }),
1276                }))
1277            },
1278        )
1279    }
1280}
1281
1282/// Returns entries and events from the neighbor table. Clients can open an
1283/// iterator using the [`fuchsia.net.neighbor/View.EntryIterator`] method.
1284///
1285/// An atomic snapshot of the neighbor table is queued for clients upon opening
1286/// an EntryIterator. This snapshot consists of `existing` entries followed by
1287/// an [`IdleEvent`]. No other types of events will be sent before an
1288/// [`IdleEvent`].
1289#[derive(Debug)]
1290pub enum EntryIteratorRequest {
1291    /// Take items from the iterator. If no items are available, block until one
1292    /// is; otherwise, return immediately with items queued since the last
1293    /// invocation.
1294    ///
1295    /// This does not guarantee that, when blocking, only one item will be
1296    /// returned; implementations may debounce or batch events.
1297    ///
1298    /// Clients should only have one call of this method at a time; a second
1299    /// call to this method while a call is already pending will cause the
1300    /// server end of the protocol to be closed.
1301    ///
1302    /// - response `events` a list of events that occurred since the last
1303    ///     invocation of this method.
1304    GetNext { responder: EntryIteratorGetNextResponder },
1305}
1306
1307impl EntryIteratorRequest {
1308    #[allow(irrefutable_let_patterns)]
1309    pub fn into_get_next(self) -> Option<(EntryIteratorGetNextResponder)> {
1310        if let EntryIteratorRequest::GetNext { responder } = self {
1311            Some((responder))
1312        } else {
1313            None
1314        }
1315    }
1316
1317    /// Name of the method defined in FIDL
1318    pub fn method_name(&self) -> &'static str {
1319        match *self {
1320            EntryIteratorRequest::GetNext { .. } => "get_next",
1321        }
1322    }
1323}
1324
1325#[derive(Debug, Clone)]
1326pub struct EntryIteratorControlHandle {
1327    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1328}
1329
1330impl fidl::endpoints::ControlHandle for EntryIteratorControlHandle {
1331    fn shutdown(&self) {
1332        self.inner.shutdown()
1333    }
1334
1335    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1336        self.inner.shutdown_with_epitaph(status)
1337    }
1338
1339    fn is_closed(&self) -> bool {
1340        self.inner.channel().is_closed()
1341    }
1342    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1343        self.inner.channel().on_closed()
1344    }
1345
1346    #[cfg(target_os = "fuchsia")]
1347    fn signal_peer(
1348        &self,
1349        clear_mask: zx::Signals,
1350        set_mask: zx::Signals,
1351    ) -> Result<(), zx_status::Status> {
1352        use fidl::Peered;
1353        self.inner.channel().signal_peer(clear_mask, set_mask)
1354    }
1355}
1356
1357impl EntryIteratorControlHandle {}
1358
1359#[must_use = "FIDL methods require a response to be sent"]
1360#[derive(Debug)]
1361pub struct EntryIteratorGetNextResponder {
1362    control_handle: std::mem::ManuallyDrop<EntryIteratorControlHandle>,
1363    tx_id: u32,
1364}
1365
1366/// Set the the channel to be shutdown (see [`EntryIteratorControlHandle::shutdown`])
1367/// if the responder is dropped without sending a response, so that the client
1368/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1369impl std::ops::Drop for EntryIteratorGetNextResponder {
1370    fn drop(&mut self) {
1371        self.control_handle.shutdown();
1372        // Safety: drops once, never accessed again
1373        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1374    }
1375}
1376
1377impl fidl::endpoints::Responder for EntryIteratorGetNextResponder {
1378    type ControlHandle = EntryIteratorControlHandle;
1379
1380    fn control_handle(&self) -> &EntryIteratorControlHandle {
1381        &self.control_handle
1382    }
1383
1384    fn drop_without_shutdown(mut self) {
1385        // Safety: drops once, never accessed again due to mem::forget
1386        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1387        // Prevent Drop from running (which would shut down the channel)
1388        std::mem::forget(self);
1389    }
1390}
1391
1392impl EntryIteratorGetNextResponder {
1393    /// Sends a response to the FIDL transaction.
1394    ///
1395    /// Sets the channel to shutdown if an error occurs.
1396    pub fn send(self, mut events: &[EntryIteratorItem]) -> Result<(), fidl::Error> {
1397        let _result = self.send_raw(events);
1398        if _result.is_err() {
1399            self.control_handle.shutdown();
1400        }
1401        self.drop_without_shutdown();
1402        _result
1403    }
1404
1405    /// Similar to "send" but does not shutdown the channel if an error occurs.
1406    pub fn send_no_shutdown_on_err(
1407        self,
1408        mut events: &[EntryIteratorItem],
1409    ) -> Result<(), fidl::Error> {
1410        let _result = self.send_raw(events);
1411        self.drop_without_shutdown();
1412        _result
1413    }
1414
1415    fn send_raw(&self, mut events: &[EntryIteratorItem]) -> Result<(), fidl::Error> {
1416        self.control_handle.inner.send::<EntryIteratorGetNextResponse>(
1417            (events,),
1418            self.tx_id,
1419            0x6d03407803da8647,
1420            fidl::encoding::DynamicFlags::empty(),
1421        )
1422    }
1423}
1424
1425#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1426pub struct ViewMarker;
1427
1428impl fidl::endpoints::ProtocolMarker for ViewMarker {
1429    type Proxy = ViewProxy;
1430    type RequestStream = ViewRequestStream;
1431    #[cfg(target_os = "fuchsia")]
1432    type SynchronousProxy = ViewSynchronousProxy;
1433
1434    const DEBUG_NAME: &'static str = "fuchsia.net.neighbor.View";
1435}
1436impl fidl::endpoints::DiscoverableProtocolMarker for ViewMarker {}
1437
1438pub trait ViewProxyInterface: Send + Sync {
1439    fn r#open_entry_iterator(
1440        &self,
1441        it: fidl::endpoints::ServerEnd<EntryIteratorMarker>,
1442        options: &EntryIteratorOptions,
1443    ) -> Result<(), fidl::Error>;
1444}
1445#[derive(Debug)]
1446#[cfg(target_os = "fuchsia")]
1447pub struct ViewSynchronousProxy {
1448    client: fidl::client::sync::Client,
1449}
1450
1451#[cfg(target_os = "fuchsia")]
1452impl fidl::endpoints::SynchronousProxy for ViewSynchronousProxy {
1453    type Proxy = ViewProxy;
1454    type Protocol = ViewMarker;
1455
1456    fn from_channel(inner: fidl::Channel) -> Self {
1457        Self::new(inner)
1458    }
1459
1460    fn into_channel(self) -> fidl::Channel {
1461        self.client.into_channel()
1462    }
1463
1464    fn as_channel(&self) -> &fidl::Channel {
1465        self.client.as_channel()
1466    }
1467}
1468
1469#[cfg(target_os = "fuchsia")]
1470impl ViewSynchronousProxy {
1471    pub fn new(channel: fidl::Channel) -> Self {
1472        let protocol_name = <ViewMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1473        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1474    }
1475
1476    pub fn into_channel(self) -> fidl::Channel {
1477        self.client.into_channel()
1478    }
1479
1480    /// Waits until an event arrives and returns it. It is safe for other
1481    /// threads to make concurrent requests while waiting for an event.
1482    pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<ViewEvent, fidl::Error> {
1483        ViewEvent::decode(self.client.wait_for_event(deadline)?)
1484    }
1485
1486    /// Open a connection to an [`EntryIterator`] for listing existing entries
1487    /// and optionally watching for state changes.
1488    ///
1489    /// + request `it` grants access to the [`EntryIterator`].
1490    /// + request `options` specifies the behavior of the [`EntryIterator`].
1491    pub fn r#open_entry_iterator(
1492        &self,
1493        mut it: fidl::endpoints::ServerEnd<EntryIteratorMarker>,
1494        mut options: &EntryIteratorOptions,
1495    ) -> Result<(), fidl::Error> {
1496        self.client.send::<ViewOpenEntryIteratorRequest>(
1497            (it, options),
1498            0x3c9531929383e911,
1499            fidl::encoding::DynamicFlags::empty(),
1500        )
1501    }
1502}
1503
1504#[cfg(target_os = "fuchsia")]
1505impl From<ViewSynchronousProxy> for zx::NullableHandle {
1506    fn from(value: ViewSynchronousProxy) -> Self {
1507        value.into_channel().into()
1508    }
1509}
1510
1511#[cfg(target_os = "fuchsia")]
1512impl From<fidl::Channel> for ViewSynchronousProxy {
1513    fn from(value: fidl::Channel) -> Self {
1514        Self::new(value)
1515    }
1516}
1517
1518#[cfg(target_os = "fuchsia")]
1519impl fidl::endpoints::FromClient for ViewSynchronousProxy {
1520    type Protocol = ViewMarker;
1521
1522    fn from_client(value: fidl::endpoints::ClientEnd<ViewMarker>) -> Self {
1523        Self::new(value.into_channel())
1524    }
1525}
1526
1527#[derive(Debug, Clone)]
1528pub struct ViewProxy {
1529    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1530}
1531
1532impl fidl::endpoints::Proxy for ViewProxy {
1533    type Protocol = ViewMarker;
1534
1535    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1536        Self::new(inner)
1537    }
1538
1539    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1540        self.client.into_channel().map_err(|client| Self { client })
1541    }
1542
1543    fn as_channel(&self) -> &::fidl::AsyncChannel {
1544        self.client.as_channel()
1545    }
1546}
1547
1548impl ViewProxy {
1549    /// Create a new Proxy for fuchsia.net.neighbor/View.
1550    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1551        let protocol_name = <ViewMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1552        Self { client: fidl::client::Client::new(channel, protocol_name) }
1553    }
1554
1555    /// Get a Stream of events from the remote end of the protocol.
1556    ///
1557    /// # Panics
1558    ///
1559    /// Panics if the event stream was already taken.
1560    pub fn take_event_stream(&self) -> ViewEventStream {
1561        ViewEventStream { event_receiver: self.client.take_event_receiver() }
1562    }
1563
1564    /// Open a connection to an [`EntryIterator`] for listing existing entries
1565    /// and optionally watching for state changes.
1566    ///
1567    /// + request `it` grants access to the [`EntryIterator`].
1568    /// + request `options` specifies the behavior of the [`EntryIterator`].
1569    pub fn r#open_entry_iterator(
1570        &self,
1571        mut it: fidl::endpoints::ServerEnd<EntryIteratorMarker>,
1572        mut options: &EntryIteratorOptions,
1573    ) -> Result<(), fidl::Error> {
1574        ViewProxyInterface::r#open_entry_iterator(self, it, options)
1575    }
1576}
1577
1578impl ViewProxyInterface for ViewProxy {
1579    fn r#open_entry_iterator(
1580        &self,
1581        mut it: fidl::endpoints::ServerEnd<EntryIteratorMarker>,
1582        mut options: &EntryIteratorOptions,
1583    ) -> Result<(), fidl::Error> {
1584        self.client.send::<ViewOpenEntryIteratorRequest>(
1585            (it, options),
1586            0x3c9531929383e911,
1587            fidl::encoding::DynamicFlags::empty(),
1588        )
1589    }
1590}
1591
1592pub struct ViewEventStream {
1593    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1594}
1595
1596impl std::marker::Unpin for ViewEventStream {}
1597
1598impl futures::stream::FusedStream for ViewEventStream {
1599    fn is_terminated(&self) -> bool {
1600        self.event_receiver.is_terminated()
1601    }
1602}
1603
1604impl futures::Stream for ViewEventStream {
1605    type Item = Result<ViewEvent, fidl::Error>;
1606
1607    fn poll_next(
1608        mut self: std::pin::Pin<&mut Self>,
1609        cx: &mut std::task::Context<'_>,
1610    ) -> std::task::Poll<Option<Self::Item>> {
1611        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1612            &mut self.event_receiver,
1613            cx
1614        )?) {
1615            Some(buf) => std::task::Poll::Ready(Some(ViewEvent::decode(buf))),
1616            None => std::task::Poll::Ready(None),
1617        }
1618    }
1619}
1620
1621#[derive(Debug)]
1622pub enum ViewEvent {}
1623
1624impl ViewEvent {
1625    /// Decodes a message buffer as a [`ViewEvent`].
1626    fn decode(
1627        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1628    ) -> Result<ViewEvent, fidl::Error> {
1629        let (bytes, _handles) = buf.split_mut();
1630        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1631        debug_assert_eq!(tx_header.tx_id, 0);
1632        match tx_header.ordinal {
1633            _ => Err(fidl::Error::UnknownOrdinal {
1634                ordinal: tx_header.ordinal,
1635                protocol_name: <ViewMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1636            }),
1637        }
1638    }
1639}
1640
1641/// A Stream of incoming requests for fuchsia.net.neighbor/View.
1642pub struct ViewRequestStream {
1643    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1644    is_terminated: bool,
1645}
1646
1647impl std::marker::Unpin for ViewRequestStream {}
1648
1649impl futures::stream::FusedStream for ViewRequestStream {
1650    fn is_terminated(&self) -> bool {
1651        self.is_terminated
1652    }
1653}
1654
1655impl fidl::endpoints::RequestStream for ViewRequestStream {
1656    type Protocol = ViewMarker;
1657    type ControlHandle = ViewControlHandle;
1658
1659    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1660        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1661    }
1662
1663    fn control_handle(&self) -> Self::ControlHandle {
1664        ViewControlHandle { inner: self.inner.clone() }
1665    }
1666
1667    fn into_inner(
1668        self,
1669    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1670    {
1671        (self.inner, self.is_terminated)
1672    }
1673
1674    fn from_inner(
1675        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1676        is_terminated: bool,
1677    ) -> Self {
1678        Self { inner, is_terminated }
1679    }
1680}
1681
1682impl futures::Stream for ViewRequestStream {
1683    type Item = Result<ViewRequest, fidl::Error>;
1684
1685    fn poll_next(
1686        mut self: std::pin::Pin<&mut Self>,
1687        cx: &mut std::task::Context<'_>,
1688    ) -> std::task::Poll<Option<Self::Item>> {
1689        let this = &mut *self;
1690        if this.inner.check_shutdown(cx) {
1691            this.is_terminated = true;
1692            return std::task::Poll::Ready(None);
1693        }
1694        if this.is_terminated {
1695            panic!("polled ViewRequestStream after completion");
1696        }
1697        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1698            |bytes, handles| {
1699                match this.inner.channel().read_etc(cx, bytes, handles) {
1700                    std::task::Poll::Ready(Ok(())) => {}
1701                    std::task::Poll::Pending => return std::task::Poll::Pending,
1702                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1703                        this.is_terminated = true;
1704                        return std::task::Poll::Ready(None);
1705                    }
1706                    std::task::Poll::Ready(Err(e)) => {
1707                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1708                            e.into(),
1709                        ))));
1710                    }
1711                }
1712
1713                // A message has been received from the channel
1714                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1715
1716                std::task::Poll::Ready(Some(match header.ordinal {
1717                    0x3c9531929383e911 => {
1718                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1719                        let mut req = fidl::new_empty!(
1720                            ViewOpenEntryIteratorRequest,
1721                            fidl::encoding::DefaultFuchsiaResourceDialect
1722                        );
1723                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ViewOpenEntryIteratorRequest>(&header, _body_bytes, handles, &mut req)?;
1724                        let control_handle = ViewControlHandle { inner: this.inner.clone() };
1725                        Ok(ViewRequest::OpenEntryIterator {
1726                            it: req.it,
1727                            options: req.options,
1728
1729                            control_handle,
1730                        })
1731                    }
1732                    _ => Err(fidl::Error::UnknownOrdinal {
1733                        ordinal: header.ordinal,
1734                        protocol_name: <ViewMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1735                    }),
1736                }))
1737            },
1738        )
1739    }
1740}
1741
1742/// Inspect the neighbor table.
1743#[derive(Debug)]
1744pub enum ViewRequest {
1745    /// Open a connection to an [`EntryIterator`] for listing existing entries
1746    /// and optionally watching for state changes.
1747    ///
1748    /// + request `it` grants access to the [`EntryIterator`].
1749    /// + request `options` specifies the behavior of the [`EntryIterator`].
1750    OpenEntryIterator {
1751        it: fidl::endpoints::ServerEnd<EntryIteratorMarker>,
1752        options: EntryIteratorOptions,
1753        control_handle: ViewControlHandle,
1754    },
1755}
1756
1757impl ViewRequest {
1758    #[allow(irrefutable_let_patterns)]
1759    pub fn into_open_entry_iterator(
1760        self,
1761    ) -> Option<(
1762        fidl::endpoints::ServerEnd<EntryIteratorMarker>,
1763        EntryIteratorOptions,
1764        ViewControlHandle,
1765    )> {
1766        if let ViewRequest::OpenEntryIterator { it, options, control_handle } = self {
1767            Some((it, options, control_handle))
1768        } else {
1769            None
1770        }
1771    }
1772
1773    /// Name of the method defined in FIDL
1774    pub fn method_name(&self) -> &'static str {
1775        match *self {
1776            ViewRequest::OpenEntryIterator { .. } => "open_entry_iterator",
1777        }
1778    }
1779}
1780
1781#[derive(Debug, Clone)]
1782pub struct ViewControlHandle {
1783    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1784}
1785
1786impl fidl::endpoints::ControlHandle for ViewControlHandle {
1787    fn shutdown(&self) {
1788        self.inner.shutdown()
1789    }
1790
1791    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1792        self.inner.shutdown_with_epitaph(status)
1793    }
1794
1795    fn is_closed(&self) -> bool {
1796        self.inner.channel().is_closed()
1797    }
1798    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1799        self.inner.channel().on_closed()
1800    }
1801
1802    #[cfg(target_os = "fuchsia")]
1803    fn signal_peer(
1804        &self,
1805        clear_mask: zx::Signals,
1806        set_mask: zx::Signals,
1807    ) -> Result<(), zx_status::Status> {
1808        use fidl::Peered;
1809        self.inner.channel().signal_peer(clear_mask, set_mask)
1810    }
1811}
1812
1813impl ViewControlHandle {}
1814
1815mod internal {
1816    use super::*;
1817
1818    impl fidl::encoding::ResourceTypeMarker for ViewOpenEntryIteratorRequest {
1819        type Borrowed<'a> = &'a mut Self;
1820        fn take_or_borrow<'a>(
1821            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1822        ) -> Self::Borrowed<'a> {
1823            value
1824        }
1825    }
1826
1827    unsafe impl fidl::encoding::TypeMarker for ViewOpenEntryIteratorRequest {
1828        type Owned = Self;
1829
1830        #[inline(always)]
1831        fn inline_align(_context: fidl::encoding::Context) -> usize {
1832            8
1833        }
1834
1835        #[inline(always)]
1836        fn inline_size(_context: fidl::encoding::Context) -> usize {
1837            24
1838        }
1839    }
1840
1841    unsafe impl
1842        fidl::encoding::Encode<
1843            ViewOpenEntryIteratorRequest,
1844            fidl::encoding::DefaultFuchsiaResourceDialect,
1845        > for &mut ViewOpenEntryIteratorRequest
1846    {
1847        #[inline]
1848        unsafe fn encode(
1849            self,
1850            encoder: &mut fidl::encoding::Encoder<
1851                '_,
1852                fidl::encoding::DefaultFuchsiaResourceDialect,
1853            >,
1854            offset: usize,
1855            _depth: fidl::encoding::Depth,
1856        ) -> fidl::Result<()> {
1857            encoder.debug_check_bounds::<ViewOpenEntryIteratorRequest>(offset);
1858            // Delegate to tuple encoding.
1859            fidl::encoding::Encode::<ViewOpenEntryIteratorRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1860                (
1861                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EntryIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.it),
1862                    <EntryIteratorOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
1863                ),
1864                encoder, offset, _depth
1865            )
1866        }
1867    }
1868    unsafe impl<
1869        T0: fidl::encoding::Encode<
1870                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<EntryIteratorMarker>>,
1871                fidl::encoding::DefaultFuchsiaResourceDialect,
1872            >,
1873        T1: fidl::encoding::Encode<EntryIteratorOptions, fidl::encoding::DefaultFuchsiaResourceDialect>,
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}