Skip to main content

fidl_fuchsia_net_ndp/
fidl_fuchsia_net_ndp.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_ndp__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest {
16    pub option_watcher: fidl::endpoints::ServerEnd<OptionWatcherMarker>,
17    pub params: RouterAdvertisementOptionWatcherParams,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21    for RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest
22{
23}
24
25#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
26pub struct OptionWatcherMarker;
27
28impl fidl::endpoints::ProtocolMarker for OptionWatcherMarker {
29    type Proxy = OptionWatcherProxy;
30    type RequestStream = OptionWatcherRequestStream;
31    #[cfg(target_os = "fuchsia")]
32    type SynchronousProxy = OptionWatcherSynchronousProxy;
33
34    const DEBUG_NAME: &'static str = "(anonymous) OptionWatcher";
35}
36
37pub trait OptionWatcherProxyInterface: Send + Sync {
38    type ProbeResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
39    fn r#probe(&self) -> Self::ProbeResponseFut;
40    type WatchOptionsResponseFut: std::future::Future<Output = Result<(Vec<OptionWatchEntry>, u32), fidl::Error>>
41        + Send;
42    fn r#watch_options(&self) -> Self::WatchOptionsResponseFut;
43}
44#[derive(Debug)]
45#[cfg(target_os = "fuchsia")]
46pub struct OptionWatcherSynchronousProxy {
47    client: fidl::client::sync::Client,
48}
49
50#[cfg(target_os = "fuchsia")]
51impl fidl::endpoints::SynchronousProxy for OptionWatcherSynchronousProxy {
52    type Proxy = OptionWatcherProxy;
53    type Protocol = OptionWatcherMarker;
54
55    fn from_channel(inner: fidl::Channel) -> Self {
56        Self::new(inner)
57    }
58
59    fn into_channel(self) -> fidl::Channel {
60        self.client.into_channel()
61    }
62
63    fn as_channel(&self) -> &fidl::Channel {
64        self.client.as_channel()
65    }
66}
67
68#[cfg(target_os = "fuchsia")]
69impl OptionWatcherSynchronousProxy {
70    pub fn new(channel: fidl::Channel) -> Self {
71        Self { client: fidl::client::sync::Client::new(channel) }
72    }
73
74    pub fn into_channel(self) -> fidl::Channel {
75        self.client.into_channel()
76    }
77
78    /// Waits until an event arrives and returns it. It is safe for other
79    /// threads to make concurrent requests while waiting for an event.
80    pub fn wait_for_event(
81        &self,
82        deadline: zx::MonotonicInstant,
83    ) -> Result<OptionWatcherEvent, fidl::Error> {
84        OptionWatcherEvent::decode(self.client.wait_for_event::<OptionWatcherMarker>(deadline)?)
85    }
86
87    /// Probes for completion of watcher construction.
88    ///
89    /// Returns once the watcher has been registered. Any NDP options received
90    /// in router advertisements after this returns are guaranteed to be
91    /// observed by the watcher, assuming that they meet the watcher's interest
92    /// criteria and that the watcher does not lag too far behind in consuming
93    /// yielded options.
94    pub fn r#probe(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
95        let _response = self.client.send_query::<
96            fidl::encoding::EmptyPayload,
97            fidl::encoding::EmptyPayload,
98            OptionWatcherMarker,
99        >(
100            (),
101            0x11ef2cfafa567e8d,
102            fidl::encoding::DynamicFlags::empty(),
103            ___deadline,
104        )?;
105        Ok(_response)
106    }
107
108    /// The hanging get method for receiving batches of NDP options.
109    ///
110    /// The batching behavior is left as an implementation detail. Not all
111    /// options in a batch are guaranteed to have been received within the same
112    /// NDP message, from the same source, or via the same interface.
113    ///
114    /// Clients should only have one call of this method at a time; a second
115    /// call to this method while a call is already pending will cause the
116    /// server end of the protocol to be closed.
117    ///
118    /// The server may at its discretion drop options instead of yielding them
119    /// if the watcher takes too long to request them via `WatchOptions`.
120    pub fn r#watch_options(
121        &self,
122        ___deadline: zx::MonotonicInstant,
123    ) -> Result<(Vec<OptionWatchEntry>, u32), fidl::Error> {
124        let _response = self.client.send_query::<
125            fidl::encoding::EmptyPayload,
126            OptionWatcherWatchOptionsResponse,
127            OptionWatcherMarker,
128        >(
129            (),
130            0x6d7b8e3d3f84faf5,
131            fidl::encoding::DynamicFlags::empty(),
132            ___deadline,
133        )?;
134        Ok((_response.options, _response.dropped))
135    }
136}
137
138#[cfg(target_os = "fuchsia")]
139impl From<OptionWatcherSynchronousProxy> for zx::NullableHandle {
140    fn from(value: OptionWatcherSynchronousProxy) -> Self {
141        value.into_channel().into()
142    }
143}
144
145#[cfg(target_os = "fuchsia")]
146impl From<fidl::Channel> for OptionWatcherSynchronousProxy {
147    fn from(value: fidl::Channel) -> Self {
148        Self::new(value)
149    }
150}
151
152#[cfg(target_os = "fuchsia")]
153impl fidl::endpoints::FromClient for OptionWatcherSynchronousProxy {
154    type Protocol = OptionWatcherMarker;
155
156    fn from_client(value: fidl::endpoints::ClientEnd<OptionWatcherMarker>) -> Self {
157        Self::new(value.into_channel())
158    }
159}
160
161#[derive(Debug, Clone)]
162pub struct OptionWatcherProxy {
163    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
164}
165
166impl fidl::endpoints::Proxy for OptionWatcherProxy {
167    type Protocol = OptionWatcherMarker;
168
169    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
170        Self::new(inner)
171    }
172
173    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
174        self.client.into_channel().map_err(|client| Self { client })
175    }
176
177    fn as_channel(&self) -> &::fidl::AsyncChannel {
178        self.client.as_channel()
179    }
180}
181
182impl OptionWatcherProxy {
183    /// Create a new Proxy for fuchsia.net.ndp/OptionWatcher.
184    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
185        let protocol_name = <OptionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
186        Self { client: fidl::client::Client::new(channel, protocol_name) }
187    }
188
189    /// Get a Stream of events from the remote end of the protocol.
190    ///
191    /// # Panics
192    ///
193    /// Panics if the event stream was already taken.
194    pub fn take_event_stream(&self) -> OptionWatcherEventStream {
195        OptionWatcherEventStream { event_receiver: self.client.take_event_receiver() }
196    }
197
198    /// Probes for completion of watcher construction.
199    ///
200    /// Returns once the watcher has been registered. Any NDP options received
201    /// in router advertisements after this returns are guaranteed to be
202    /// observed by the watcher, assuming that they meet the watcher's interest
203    /// criteria and that the watcher does not lag too far behind in consuming
204    /// yielded options.
205    pub fn r#probe(
206        &self,
207    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
208        OptionWatcherProxyInterface::r#probe(self)
209    }
210
211    /// The hanging get method for receiving batches of NDP options.
212    ///
213    /// The batching behavior is left as an implementation detail. Not all
214    /// options in a batch are guaranteed to have been received within the same
215    /// NDP message, from the same source, or via the same interface.
216    ///
217    /// Clients should only have one call of this method at a time; a second
218    /// call to this method while a call is already pending will cause the
219    /// server end of the protocol to be closed.
220    ///
221    /// The server may at its discretion drop options instead of yielding them
222    /// if the watcher takes too long to request them via `WatchOptions`.
223    pub fn r#watch_options(
224        &self,
225    ) -> fidl::client::QueryResponseFut<
226        (Vec<OptionWatchEntry>, u32),
227        fidl::encoding::DefaultFuchsiaResourceDialect,
228    > {
229        OptionWatcherProxyInterface::r#watch_options(self)
230    }
231}
232
233impl OptionWatcherProxyInterface for OptionWatcherProxy {
234    type ProbeResponseFut =
235        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
236    fn r#probe(&self) -> Self::ProbeResponseFut {
237        fn _decode(
238            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
239        ) -> Result<(), fidl::Error> {
240            let _response = fidl::client::decode_transaction_body::<
241                fidl::encoding::EmptyPayload,
242                fidl::encoding::DefaultFuchsiaResourceDialect,
243                0x11ef2cfafa567e8d,
244            >(_buf?)?;
245            Ok(_response)
246        }
247        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
248            (),
249            0x11ef2cfafa567e8d,
250            fidl::encoding::DynamicFlags::empty(),
251            _decode,
252        )
253    }
254
255    type WatchOptionsResponseFut = fidl::client::QueryResponseFut<
256        (Vec<OptionWatchEntry>, u32),
257        fidl::encoding::DefaultFuchsiaResourceDialect,
258    >;
259    fn r#watch_options(&self) -> Self::WatchOptionsResponseFut {
260        fn _decode(
261            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
262        ) -> Result<(Vec<OptionWatchEntry>, u32), fidl::Error> {
263            let _response = fidl::client::decode_transaction_body::<
264                OptionWatcherWatchOptionsResponse,
265                fidl::encoding::DefaultFuchsiaResourceDialect,
266                0x6d7b8e3d3f84faf5,
267            >(_buf?)?;
268            Ok((_response.options, _response.dropped))
269        }
270        self.client
271            .send_query_and_decode::<fidl::encoding::EmptyPayload, (Vec<OptionWatchEntry>, u32)>(
272                (),
273                0x6d7b8e3d3f84faf5,
274                fidl::encoding::DynamicFlags::empty(),
275                _decode,
276            )
277    }
278}
279
280pub struct OptionWatcherEventStream {
281    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
282}
283
284impl std::marker::Unpin for OptionWatcherEventStream {}
285
286impl futures::stream::FusedStream for OptionWatcherEventStream {
287    fn is_terminated(&self) -> bool {
288        self.event_receiver.is_terminated()
289    }
290}
291
292impl futures::Stream for OptionWatcherEventStream {
293    type Item = Result<OptionWatcherEvent, fidl::Error>;
294
295    fn poll_next(
296        mut self: std::pin::Pin<&mut Self>,
297        cx: &mut std::task::Context<'_>,
298    ) -> std::task::Poll<Option<Self::Item>> {
299        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
300            &mut self.event_receiver,
301            cx
302        )?) {
303            Some(buf) => std::task::Poll::Ready(Some(OptionWatcherEvent::decode(buf))),
304            None => std::task::Poll::Ready(None),
305        }
306    }
307}
308
309#[derive(Debug)]
310pub enum OptionWatcherEvent {}
311
312impl OptionWatcherEvent {
313    /// Decodes a message buffer as a [`OptionWatcherEvent`].
314    fn decode(
315        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
316    ) -> Result<OptionWatcherEvent, fidl::Error> {
317        let (bytes, _handles) = buf.split_mut();
318        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
319        debug_assert_eq!(tx_header.tx_id, 0);
320        match tx_header.ordinal {
321            _ => Err(fidl::Error::UnknownOrdinal {
322                ordinal: tx_header.ordinal,
323                protocol_name: <OptionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
324            }),
325        }
326    }
327}
328
329/// A Stream of incoming requests for fuchsia.net.ndp/OptionWatcher.
330pub struct OptionWatcherRequestStream {
331    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
332    is_terminated: bool,
333}
334
335impl std::marker::Unpin for OptionWatcherRequestStream {}
336
337impl futures::stream::FusedStream for OptionWatcherRequestStream {
338    fn is_terminated(&self) -> bool {
339        self.is_terminated
340    }
341}
342
343impl fidl::endpoints::RequestStream for OptionWatcherRequestStream {
344    type Protocol = OptionWatcherMarker;
345    type ControlHandle = OptionWatcherControlHandle;
346
347    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
348        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
349    }
350
351    fn control_handle(&self) -> Self::ControlHandle {
352        OptionWatcherControlHandle { inner: self.inner.clone() }
353    }
354
355    fn into_inner(
356        self,
357    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
358    {
359        (self.inner, self.is_terminated)
360    }
361
362    fn from_inner(
363        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
364        is_terminated: bool,
365    ) -> Self {
366        Self { inner, is_terminated }
367    }
368}
369
370impl futures::Stream for OptionWatcherRequestStream {
371    type Item = Result<OptionWatcherRequest, fidl::Error>;
372
373    fn poll_next(
374        mut self: std::pin::Pin<&mut Self>,
375        cx: &mut std::task::Context<'_>,
376    ) -> std::task::Poll<Option<Self::Item>> {
377        let this = &mut *self;
378        if this.inner.check_shutdown(cx) {
379            this.is_terminated = true;
380            return std::task::Poll::Ready(None);
381        }
382        if this.is_terminated {
383            panic!("polled OptionWatcherRequestStream after completion");
384        }
385        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
386            |bytes, handles| {
387                match this.inner.channel().read_etc(cx, bytes, handles) {
388                    std::task::Poll::Ready(Ok(())) => {}
389                    std::task::Poll::Pending => return std::task::Poll::Pending,
390                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
391                        this.is_terminated = true;
392                        return std::task::Poll::Ready(None);
393                    }
394                    std::task::Poll::Ready(Err(e)) => {
395                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
396                            e.into(),
397                        ))));
398                    }
399                }
400
401                // A message has been received from the channel
402                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
403
404                std::task::Poll::Ready(Some(match header.ordinal {
405                    0x11ef2cfafa567e8d => {
406                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
407                        let mut req = fidl::new_empty!(
408                            fidl::encoding::EmptyPayload,
409                            fidl::encoding::DefaultFuchsiaResourceDialect
410                        );
411                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
412                        let control_handle =
413                            OptionWatcherControlHandle { inner: this.inner.clone() };
414                        Ok(OptionWatcherRequest::Probe {
415                            responder: OptionWatcherProbeResponder {
416                                control_handle: std::mem::ManuallyDrop::new(control_handle),
417                                tx_id: header.tx_id,
418                            },
419                        })
420                    }
421                    0x6d7b8e3d3f84faf5 => {
422                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
423                        let mut req = fidl::new_empty!(
424                            fidl::encoding::EmptyPayload,
425                            fidl::encoding::DefaultFuchsiaResourceDialect
426                        );
427                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
428                        let control_handle =
429                            OptionWatcherControlHandle { inner: this.inner.clone() };
430                        Ok(OptionWatcherRequest::WatchOptions {
431                            responder: OptionWatcherWatchOptionsResponder {
432                                control_handle: std::mem::ManuallyDrop::new(control_handle),
433                                tx_id: header.tx_id,
434                            },
435                        })
436                    }
437                    _ => Err(fidl::Error::UnknownOrdinal {
438                        ordinal: header.ordinal,
439                        protocol_name:
440                            <OptionWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
441                    }),
442                }))
443            },
444        )
445    }
446}
447
448/// An NDP option watcher.
449#[derive(Debug)]
450pub enum OptionWatcherRequest {
451    /// Probes for completion of watcher construction.
452    ///
453    /// Returns once the watcher has been registered. Any NDP options received
454    /// in router advertisements after this returns are guaranteed to be
455    /// observed by the watcher, assuming that they meet the watcher's interest
456    /// criteria and that the watcher does not lag too far behind in consuming
457    /// yielded options.
458    Probe { responder: OptionWatcherProbeResponder },
459    /// The hanging get method for receiving batches of NDP options.
460    ///
461    /// The batching behavior is left as an implementation detail. Not all
462    /// options in a batch are guaranteed to have been received within the same
463    /// NDP message, from the same source, or via the same interface.
464    ///
465    /// Clients should only have one call of this method at a time; a second
466    /// call to this method while a call is already pending will cause the
467    /// server end of the protocol to be closed.
468    ///
469    /// The server may at its discretion drop options instead of yielding them
470    /// if the watcher takes too long to request them via `WatchOptions`.
471    WatchOptions { responder: OptionWatcherWatchOptionsResponder },
472}
473
474impl OptionWatcherRequest {
475    #[allow(irrefutable_let_patterns)]
476    pub fn into_probe(self) -> Option<(OptionWatcherProbeResponder)> {
477        if let OptionWatcherRequest::Probe { responder } = self { Some((responder)) } else { None }
478    }
479
480    #[allow(irrefutable_let_patterns)]
481    pub fn into_watch_options(self) -> Option<(OptionWatcherWatchOptionsResponder)> {
482        if let OptionWatcherRequest::WatchOptions { responder } = self {
483            Some((responder))
484        } else {
485            None
486        }
487    }
488
489    /// Name of the method defined in FIDL
490    pub fn method_name(&self) -> &'static str {
491        match *self {
492            OptionWatcherRequest::Probe { .. } => "probe",
493            OptionWatcherRequest::WatchOptions { .. } => "watch_options",
494        }
495    }
496}
497
498#[derive(Debug, Clone)]
499pub struct OptionWatcherControlHandle {
500    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
501}
502
503impl fidl::endpoints::ControlHandle for OptionWatcherControlHandle {
504    fn shutdown(&self) {
505        self.inner.shutdown()
506    }
507
508    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
509        self.inner.shutdown_with_epitaph(status)
510    }
511
512    fn is_closed(&self) -> bool {
513        self.inner.channel().is_closed()
514    }
515    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
516        self.inner.channel().on_closed()
517    }
518
519    #[cfg(target_os = "fuchsia")]
520    fn signal_peer(
521        &self,
522        clear_mask: zx::Signals,
523        set_mask: zx::Signals,
524    ) -> Result<(), zx_status::Status> {
525        use fidl::Peered;
526        self.inner.channel().signal_peer(clear_mask, set_mask)
527    }
528}
529
530impl OptionWatcherControlHandle {}
531
532#[must_use = "FIDL methods require a response to be sent"]
533#[derive(Debug)]
534pub struct OptionWatcherProbeResponder {
535    control_handle: std::mem::ManuallyDrop<OptionWatcherControlHandle>,
536    tx_id: u32,
537}
538
539/// Set the the channel to be shutdown (see [`OptionWatcherControlHandle::shutdown`])
540/// if the responder is dropped without sending a response, so that the client
541/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
542impl std::ops::Drop for OptionWatcherProbeResponder {
543    fn drop(&mut self) {
544        self.control_handle.shutdown();
545        // Safety: drops once, never accessed again
546        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
547    }
548}
549
550impl fidl::endpoints::Responder for OptionWatcherProbeResponder {
551    type ControlHandle = OptionWatcherControlHandle;
552
553    fn control_handle(&self) -> &OptionWatcherControlHandle {
554        &self.control_handle
555    }
556
557    fn drop_without_shutdown(mut self) {
558        // Safety: drops once, never accessed again due to mem::forget
559        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
560        // Prevent Drop from running (which would shut down the channel)
561        std::mem::forget(self);
562    }
563}
564
565impl OptionWatcherProbeResponder {
566    /// Sends a response to the FIDL transaction.
567    ///
568    /// Sets the channel to shutdown if an error occurs.
569    pub fn send(self) -> Result<(), fidl::Error> {
570        let _result = self.send_raw();
571        if _result.is_err() {
572            self.control_handle.shutdown();
573        }
574        self.drop_without_shutdown();
575        _result
576    }
577
578    /// Similar to "send" but does not shutdown the channel if an error occurs.
579    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
580        let _result = self.send_raw();
581        self.drop_without_shutdown();
582        _result
583    }
584
585    fn send_raw(&self) -> Result<(), fidl::Error> {
586        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
587            (),
588            self.tx_id,
589            0x11ef2cfafa567e8d,
590            fidl::encoding::DynamicFlags::empty(),
591        )
592    }
593}
594
595#[must_use = "FIDL methods require a response to be sent"]
596#[derive(Debug)]
597pub struct OptionWatcherWatchOptionsResponder {
598    control_handle: std::mem::ManuallyDrop<OptionWatcherControlHandle>,
599    tx_id: u32,
600}
601
602/// Set the the channel to be shutdown (see [`OptionWatcherControlHandle::shutdown`])
603/// if the responder is dropped without sending a response, so that the client
604/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
605impl std::ops::Drop for OptionWatcherWatchOptionsResponder {
606    fn drop(&mut self) {
607        self.control_handle.shutdown();
608        // Safety: drops once, never accessed again
609        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
610    }
611}
612
613impl fidl::endpoints::Responder for OptionWatcherWatchOptionsResponder {
614    type ControlHandle = OptionWatcherControlHandle;
615
616    fn control_handle(&self) -> &OptionWatcherControlHandle {
617        &self.control_handle
618    }
619
620    fn drop_without_shutdown(mut self) {
621        // Safety: drops once, never accessed again due to mem::forget
622        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
623        // Prevent Drop from running (which would shut down the channel)
624        std::mem::forget(self);
625    }
626}
627
628impl OptionWatcherWatchOptionsResponder {
629    /// Sends a response to the FIDL transaction.
630    ///
631    /// Sets the channel to shutdown if an error occurs.
632    pub fn send(
633        self,
634        mut options: &[OptionWatchEntry],
635        mut dropped: u32,
636    ) -> Result<(), fidl::Error> {
637        let _result = self.send_raw(options, dropped);
638        if _result.is_err() {
639            self.control_handle.shutdown();
640        }
641        self.drop_without_shutdown();
642        _result
643    }
644
645    /// Similar to "send" but does not shutdown the channel if an error occurs.
646    pub fn send_no_shutdown_on_err(
647        self,
648        mut options: &[OptionWatchEntry],
649        mut dropped: u32,
650    ) -> Result<(), fidl::Error> {
651        let _result = self.send_raw(options, dropped);
652        self.drop_without_shutdown();
653        _result
654    }
655
656    fn send_raw(
657        &self,
658        mut options: &[OptionWatchEntry],
659        mut dropped: u32,
660    ) -> Result<(), fidl::Error> {
661        self.control_handle.inner.send::<OptionWatcherWatchOptionsResponse>(
662            (options, dropped),
663            self.tx_id,
664            0x6d7b8e3d3f84faf5,
665            fidl::encoding::DynamicFlags::empty(),
666        )
667    }
668}
669
670#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
671pub struct RouterAdvertisementOptionWatcherProviderMarker;
672
673impl fidl::endpoints::ProtocolMarker for RouterAdvertisementOptionWatcherProviderMarker {
674    type Proxy = RouterAdvertisementOptionWatcherProviderProxy;
675    type RequestStream = RouterAdvertisementOptionWatcherProviderRequestStream;
676    #[cfg(target_os = "fuchsia")]
677    type SynchronousProxy = RouterAdvertisementOptionWatcherProviderSynchronousProxy;
678
679    const DEBUG_NAME: &'static str = "fuchsia.net.ndp.RouterAdvertisementOptionWatcherProvider";
680}
681impl fidl::endpoints::DiscoverableProtocolMarker
682    for RouterAdvertisementOptionWatcherProviderMarker
683{
684}
685
686pub trait RouterAdvertisementOptionWatcherProviderProxyInterface: Send + Sync {
687    fn r#new_router_advertisement_option_watcher(
688        &self,
689        option_watcher: fidl::endpoints::ServerEnd<OptionWatcherMarker>,
690        params: &RouterAdvertisementOptionWatcherParams,
691    ) -> Result<(), fidl::Error>;
692}
693#[derive(Debug)]
694#[cfg(target_os = "fuchsia")]
695pub struct RouterAdvertisementOptionWatcherProviderSynchronousProxy {
696    client: fidl::client::sync::Client,
697}
698
699#[cfg(target_os = "fuchsia")]
700impl fidl::endpoints::SynchronousProxy
701    for RouterAdvertisementOptionWatcherProviderSynchronousProxy
702{
703    type Proxy = RouterAdvertisementOptionWatcherProviderProxy;
704    type Protocol = RouterAdvertisementOptionWatcherProviderMarker;
705
706    fn from_channel(inner: fidl::Channel) -> Self {
707        Self::new(inner)
708    }
709
710    fn into_channel(self) -> fidl::Channel {
711        self.client.into_channel()
712    }
713
714    fn as_channel(&self) -> &fidl::Channel {
715        self.client.as_channel()
716    }
717}
718
719#[cfg(target_os = "fuchsia")]
720impl RouterAdvertisementOptionWatcherProviderSynchronousProxy {
721    pub fn new(channel: fidl::Channel) -> Self {
722        Self { client: fidl::client::sync::Client::new(channel) }
723    }
724
725    pub fn into_channel(self) -> fidl::Channel {
726        self.client.into_channel()
727    }
728
729    /// Waits until an event arrives and returns it. It is safe for other
730    /// threads to make concurrent requests while waiting for an event.
731    pub fn wait_for_event(
732        &self,
733        deadline: zx::MonotonicInstant,
734    ) -> Result<RouterAdvertisementOptionWatcherProviderEvent, fidl::Error> {
735        RouterAdvertisementOptionWatcherProviderEvent::decode(
736            self.client
737                .wait_for_event::<RouterAdvertisementOptionWatcherProviderMarker>(deadline)?,
738        )
739    }
740
741    /// Constructs a new watcher that yields NDP options received from router
742    /// advertisement messages as described in [RFC 4861 section
743    /// 4.2](https://datatracker.ietf.org/doc/html/rfc4861#section-4.2).
744    pub fn r#new_router_advertisement_option_watcher(
745        &self,
746        mut option_watcher: fidl::endpoints::ServerEnd<OptionWatcherMarker>,
747        mut params: &RouterAdvertisementOptionWatcherParams,
748    ) -> Result<(), fidl::Error> {
749        self.client.send::<RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest>(
750            (option_watcher, params,),
751            0x2a90a8bd5fd2bbf4,
752            fidl::encoding::DynamicFlags::empty(),
753        )
754    }
755}
756
757#[cfg(target_os = "fuchsia")]
758impl From<RouterAdvertisementOptionWatcherProviderSynchronousProxy> for zx::NullableHandle {
759    fn from(value: RouterAdvertisementOptionWatcherProviderSynchronousProxy) -> Self {
760        value.into_channel().into()
761    }
762}
763
764#[cfg(target_os = "fuchsia")]
765impl From<fidl::Channel> for RouterAdvertisementOptionWatcherProviderSynchronousProxy {
766    fn from(value: fidl::Channel) -> Self {
767        Self::new(value)
768    }
769}
770
771#[cfg(target_os = "fuchsia")]
772impl fidl::endpoints::FromClient for RouterAdvertisementOptionWatcherProviderSynchronousProxy {
773    type Protocol = RouterAdvertisementOptionWatcherProviderMarker;
774
775    fn from_client(
776        value: fidl::endpoints::ClientEnd<RouterAdvertisementOptionWatcherProviderMarker>,
777    ) -> Self {
778        Self::new(value.into_channel())
779    }
780}
781
782#[derive(Debug, Clone)]
783pub struct RouterAdvertisementOptionWatcherProviderProxy {
784    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
785}
786
787impl fidl::endpoints::Proxy for RouterAdvertisementOptionWatcherProviderProxy {
788    type Protocol = RouterAdvertisementOptionWatcherProviderMarker;
789
790    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
791        Self::new(inner)
792    }
793
794    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
795        self.client.into_channel().map_err(|client| Self { client })
796    }
797
798    fn as_channel(&self) -> &::fidl::AsyncChannel {
799        self.client.as_channel()
800    }
801}
802
803impl RouterAdvertisementOptionWatcherProviderProxy {
804    /// Create a new Proxy for fuchsia.net.ndp/RouterAdvertisementOptionWatcherProvider.
805    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
806        let protocol_name = <RouterAdvertisementOptionWatcherProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
807        Self { client: fidl::client::Client::new(channel, protocol_name) }
808    }
809
810    /// Get a Stream of events from the remote end of the protocol.
811    ///
812    /// # Panics
813    ///
814    /// Panics if the event stream was already taken.
815    pub fn take_event_stream(&self) -> RouterAdvertisementOptionWatcherProviderEventStream {
816        RouterAdvertisementOptionWatcherProviderEventStream {
817            event_receiver: self.client.take_event_receiver(),
818        }
819    }
820
821    /// Constructs a new watcher that yields NDP options received from router
822    /// advertisement messages as described in [RFC 4861 section
823    /// 4.2](https://datatracker.ietf.org/doc/html/rfc4861#section-4.2).
824    pub fn r#new_router_advertisement_option_watcher(
825        &self,
826        mut option_watcher: fidl::endpoints::ServerEnd<OptionWatcherMarker>,
827        mut params: &RouterAdvertisementOptionWatcherParams,
828    ) -> Result<(), fidl::Error> {
829        RouterAdvertisementOptionWatcherProviderProxyInterface::r#new_router_advertisement_option_watcher(self,
830            option_watcher,
831            params,
832        )
833    }
834}
835
836impl RouterAdvertisementOptionWatcherProviderProxyInterface
837    for RouterAdvertisementOptionWatcherProviderProxy
838{
839    fn r#new_router_advertisement_option_watcher(
840        &self,
841        mut option_watcher: fidl::endpoints::ServerEnd<OptionWatcherMarker>,
842        mut params: &RouterAdvertisementOptionWatcherParams,
843    ) -> Result<(), fidl::Error> {
844        self.client.send::<RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest>(
845            (option_watcher, params,),
846            0x2a90a8bd5fd2bbf4,
847            fidl::encoding::DynamicFlags::empty(),
848        )
849    }
850}
851
852pub struct RouterAdvertisementOptionWatcherProviderEventStream {
853    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
854}
855
856impl std::marker::Unpin for RouterAdvertisementOptionWatcherProviderEventStream {}
857
858impl futures::stream::FusedStream for RouterAdvertisementOptionWatcherProviderEventStream {
859    fn is_terminated(&self) -> bool {
860        self.event_receiver.is_terminated()
861    }
862}
863
864impl futures::Stream for RouterAdvertisementOptionWatcherProviderEventStream {
865    type Item = Result<RouterAdvertisementOptionWatcherProviderEvent, fidl::Error>;
866
867    fn poll_next(
868        mut self: std::pin::Pin<&mut Self>,
869        cx: &mut std::task::Context<'_>,
870    ) -> std::task::Poll<Option<Self::Item>> {
871        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
872            &mut self.event_receiver,
873            cx
874        )?) {
875            Some(buf) => std::task::Poll::Ready(Some(
876                RouterAdvertisementOptionWatcherProviderEvent::decode(buf),
877            )),
878            None => std::task::Poll::Ready(None),
879        }
880    }
881}
882
883#[derive(Debug)]
884pub enum RouterAdvertisementOptionWatcherProviderEvent {}
885
886impl RouterAdvertisementOptionWatcherProviderEvent {
887    /// Decodes a message buffer as a [`RouterAdvertisementOptionWatcherProviderEvent`].
888    fn decode(
889        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
890    ) -> Result<RouterAdvertisementOptionWatcherProviderEvent, fidl::Error> {
891        let (bytes, _handles) = buf.split_mut();
892        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
893        debug_assert_eq!(tx_header.tx_id, 0);
894        match tx_header.ordinal {
895            _ => Err(fidl::Error::UnknownOrdinal {
896                ordinal: tx_header.ordinal,
897                protocol_name: <RouterAdvertisementOptionWatcherProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
898            })
899        }
900    }
901}
902
903/// A Stream of incoming requests for fuchsia.net.ndp/RouterAdvertisementOptionWatcherProvider.
904pub struct RouterAdvertisementOptionWatcherProviderRequestStream {
905    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
906    is_terminated: bool,
907}
908
909impl std::marker::Unpin for RouterAdvertisementOptionWatcherProviderRequestStream {}
910
911impl futures::stream::FusedStream for RouterAdvertisementOptionWatcherProviderRequestStream {
912    fn is_terminated(&self) -> bool {
913        self.is_terminated
914    }
915}
916
917impl fidl::endpoints::RequestStream for RouterAdvertisementOptionWatcherProviderRequestStream {
918    type Protocol = RouterAdvertisementOptionWatcherProviderMarker;
919    type ControlHandle = RouterAdvertisementOptionWatcherProviderControlHandle;
920
921    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
922        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
923    }
924
925    fn control_handle(&self) -> Self::ControlHandle {
926        RouterAdvertisementOptionWatcherProviderControlHandle { inner: self.inner.clone() }
927    }
928
929    fn into_inner(
930        self,
931    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
932    {
933        (self.inner, self.is_terminated)
934    }
935
936    fn from_inner(
937        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
938        is_terminated: bool,
939    ) -> Self {
940        Self { inner, is_terminated }
941    }
942}
943
944impl futures::Stream for RouterAdvertisementOptionWatcherProviderRequestStream {
945    type Item = Result<RouterAdvertisementOptionWatcherProviderRequest, fidl::Error>;
946
947    fn poll_next(
948        mut self: std::pin::Pin<&mut Self>,
949        cx: &mut std::task::Context<'_>,
950    ) -> std::task::Poll<Option<Self::Item>> {
951        let this = &mut *self;
952        if this.inner.check_shutdown(cx) {
953            this.is_terminated = true;
954            return std::task::Poll::Ready(None);
955        }
956        if this.is_terminated {
957            panic!("polled RouterAdvertisementOptionWatcherProviderRequestStream after completion");
958        }
959        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
960            |bytes, handles| {
961                match this.inner.channel().read_etc(cx, bytes, handles) {
962                    std::task::Poll::Ready(Ok(())) => {}
963                    std::task::Poll::Pending => return std::task::Poll::Pending,
964                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
965                        this.is_terminated = true;
966                        return std::task::Poll::Ready(None);
967                    }
968                    std::task::Poll::Ready(Err(e)) => {
969                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
970                            e.into(),
971                        ))));
972                    }
973                }
974
975                // A message has been received from the channel
976                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
977
978                std::task::Poll::Ready(Some(match header.ordinal {
979                0x2a90a8bd5fd2bbf4 => {
980                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
981                    let mut req = fidl::new_empty!(RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
982                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest>(&header, _body_bytes, handles, &mut req)?;
983                    let control_handle = RouterAdvertisementOptionWatcherProviderControlHandle {
984                        inner: this.inner.clone(),
985                    };
986                    Ok(RouterAdvertisementOptionWatcherProviderRequest::NewRouterAdvertisementOptionWatcher {option_watcher: req.option_watcher,
987params: req.params,
988
989                        control_handle,
990                    })
991                }
992                _ => Err(fidl::Error::UnknownOrdinal {
993                    ordinal: header.ordinal,
994                    protocol_name: <RouterAdvertisementOptionWatcherProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
995                }),
996            }))
997            },
998        )
999    }
1000}
1001
1002/// Provides watchers for NDP options observed via router advertisements.
1003///
1004/// ## Privacy note
1005///
1006/// This protocol provides access to the raw bytes of NDP options, which can
1007/// contain privileged information such as the hardware addresses of the user's
1008/// host device or other devices on the network. Thus, care should be taken with
1009/// where this protocol is made available.
1010#[derive(Debug)]
1011pub enum RouterAdvertisementOptionWatcherProviderRequest {
1012    /// Constructs a new watcher that yields NDP options received from router
1013    /// advertisement messages as described in [RFC 4861 section
1014    /// 4.2](https://datatracker.ietf.org/doc/html/rfc4861#section-4.2).
1015    NewRouterAdvertisementOptionWatcher {
1016        option_watcher: fidl::endpoints::ServerEnd<OptionWatcherMarker>,
1017        params: RouterAdvertisementOptionWatcherParams,
1018        control_handle: RouterAdvertisementOptionWatcherProviderControlHandle,
1019    },
1020}
1021
1022impl RouterAdvertisementOptionWatcherProviderRequest {
1023    #[allow(irrefutable_let_patterns)]
1024    pub fn into_new_router_advertisement_option_watcher(
1025        self,
1026    ) -> Option<(
1027        fidl::endpoints::ServerEnd<OptionWatcherMarker>,
1028        RouterAdvertisementOptionWatcherParams,
1029        RouterAdvertisementOptionWatcherProviderControlHandle,
1030    )> {
1031        if let RouterAdvertisementOptionWatcherProviderRequest::NewRouterAdvertisementOptionWatcher {
1032            option_watcher,
1033            params,
1034            control_handle,
1035        } = self {
1036            Some((option_watcher,params,
1037                control_handle))
1038        } else {
1039            None
1040        }
1041    }
1042
1043    /// Name of the method defined in FIDL
1044    pub fn method_name(&self) -> &'static str {
1045        match *self {
1046            RouterAdvertisementOptionWatcherProviderRequest::NewRouterAdvertisementOptionWatcher{..} => "new_router_advertisement_option_watcher",
1047        }
1048    }
1049}
1050
1051#[derive(Debug, Clone)]
1052pub struct RouterAdvertisementOptionWatcherProviderControlHandle {
1053    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1054}
1055
1056impl fidl::endpoints::ControlHandle for RouterAdvertisementOptionWatcherProviderControlHandle {
1057    fn shutdown(&self) {
1058        self.inner.shutdown()
1059    }
1060
1061    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1062        self.inner.shutdown_with_epitaph(status)
1063    }
1064
1065    fn is_closed(&self) -> bool {
1066        self.inner.channel().is_closed()
1067    }
1068    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1069        self.inner.channel().on_closed()
1070    }
1071
1072    #[cfg(target_os = "fuchsia")]
1073    fn signal_peer(
1074        &self,
1075        clear_mask: zx::Signals,
1076        set_mask: zx::Signals,
1077    ) -> Result<(), zx_status::Status> {
1078        use fidl::Peered;
1079        self.inner.channel().signal_peer(clear_mask, set_mask)
1080    }
1081}
1082
1083impl RouterAdvertisementOptionWatcherProviderControlHandle {}
1084
1085mod internal {
1086    use super::*;
1087
1088    impl fidl::encoding::ResourceTypeMarker
1089        for RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest
1090    {
1091        type Borrowed<'a> = &'a mut Self;
1092        fn take_or_borrow<'a>(
1093            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1094        ) -> Self::Borrowed<'a> {
1095            value
1096        }
1097    }
1098
1099    unsafe impl fidl::encoding::TypeMarker
1100        for RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest
1101    {
1102        type Owned = Self;
1103
1104        #[inline(always)]
1105        fn inline_align(_context: fidl::encoding::Context) -> usize {
1106            8
1107        }
1108
1109        #[inline(always)]
1110        fn inline_size(_context: fidl::encoding::Context) -> usize {
1111            24
1112        }
1113    }
1114
1115    unsafe impl
1116        fidl::encoding::Encode<
1117            RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest,
1118            fidl::encoding::DefaultFuchsiaResourceDialect,
1119        >
1120        for &mut RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest
1121    {
1122        #[inline]
1123        unsafe fn encode(
1124            self,
1125            encoder: &mut fidl::encoding::Encoder<
1126                '_,
1127                fidl::encoding::DefaultFuchsiaResourceDialect,
1128            >,
1129            offset: usize,
1130            _depth: fidl::encoding::Depth,
1131        ) -> fidl::Result<()> {
1132            encoder.debug_check_bounds::<RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest>(offset);
1133            // Delegate to tuple encoding.
1134            fidl::encoding::Encode::<RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1135                (
1136                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<OptionWatcherMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.option_watcher),
1137                    <RouterAdvertisementOptionWatcherParams as fidl::encoding::ValueTypeMarker>::borrow(&self.params),
1138                ),
1139                encoder, offset, _depth
1140            )
1141        }
1142    }
1143    unsafe impl<
1144        T0: fidl::encoding::Encode<
1145                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<OptionWatcherMarker>>,
1146                fidl::encoding::DefaultFuchsiaResourceDialect,
1147            >,
1148        T1: fidl::encoding::Encode<
1149                RouterAdvertisementOptionWatcherParams,
1150                fidl::encoding::DefaultFuchsiaResourceDialect,
1151            >,
1152    >
1153        fidl::encoding::Encode<
1154            RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest,
1155            fidl::encoding::DefaultFuchsiaResourceDialect,
1156        > for (T0, T1)
1157    {
1158        #[inline]
1159        unsafe fn encode(
1160            self,
1161            encoder: &mut fidl::encoding::Encoder<
1162                '_,
1163                fidl::encoding::DefaultFuchsiaResourceDialect,
1164            >,
1165            offset: usize,
1166            depth: fidl::encoding::Depth,
1167        ) -> fidl::Result<()> {
1168            encoder.debug_check_bounds::<RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest>(offset);
1169            // Zero out padding regions. There's no need to apply masks
1170            // because the unmasked parts will be overwritten by fields.
1171            unsafe {
1172                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
1173                (ptr as *mut u64).write_unaligned(0);
1174            }
1175            // Write the fields.
1176            self.0.encode(encoder, offset + 0, depth)?;
1177            self.1.encode(encoder, offset + 8, depth)?;
1178            Ok(())
1179        }
1180    }
1181
1182    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1183        for RouterAdvertisementOptionWatcherProviderNewRouterAdvertisementOptionWatcherRequest
1184    {
1185        #[inline(always)]
1186        fn new_empty() -> Self {
1187            Self {
1188                option_watcher: fidl::new_empty!(
1189                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<OptionWatcherMarker>>,
1190                    fidl::encoding::DefaultFuchsiaResourceDialect
1191                ),
1192                params: fidl::new_empty!(
1193                    RouterAdvertisementOptionWatcherParams,
1194                    fidl::encoding::DefaultFuchsiaResourceDialect
1195                ),
1196            }
1197        }
1198
1199        #[inline]
1200        unsafe fn decode(
1201            &mut self,
1202            decoder: &mut fidl::encoding::Decoder<
1203                '_,
1204                fidl::encoding::DefaultFuchsiaResourceDialect,
1205            >,
1206            offset: usize,
1207            _depth: fidl::encoding::Depth,
1208        ) -> fidl::Result<()> {
1209            decoder.debug_check_bounds::<Self>(offset);
1210            // Verify that padding bytes are zero.
1211            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
1212            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1213            let mask = 0xffffffff00000000u64;
1214            let maskedval = padval & mask;
1215            if maskedval != 0 {
1216                return Err(fidl::Error::NonZeroPadding {
1217                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
1218                });
1219            }
1220            fidl::decode!(
1221                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<OptionWatcherMarker>>,
1222                fidl::encoding::DefaultFuchsiaResourceDialect,
1223                &mut self.option_watcher,
1224                decoder,
1225                offset + 0,
1226                _depth
1227            )?;
1228            fidl::decode!(
1229                RouterAdvertisementOptionWatcherParams,
1230                fidl::encoding::DefaultFuchsiaResourceDialect,
1231                &mut self.params,
1232                decoder,
1233                offset + 8,
1234                _depth
1235            )?;
1236            Ok(())
1237        }
1238    }
1239}