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