Skip to main content

fdomain_fuchsia_net_routes/
fdomain_fuchsia_net_routes.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 fdomain_client::fidl::{ControlHandle as _, FDomainFlexibleIntoResult as _, Responder as _};
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9pub use fidl_fuchsia_net_routes_common::*;
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Debug, PartialEq)]
14pub struct StateV4GetRuleWatcherV4Request {
15    pub watcher: fdomain_client::fidl::ServerEnd<RuleWatcherV4Marker>,
16    pub options: RuleWatcherOptionsV4,
17}
18
19impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
20    for StateV4GetRuleWatcherV4Request
21{
22}
23
24#[derive(Debug, PartialEq)]
25pub struct StateV4GetWatcherV4Request {
26    pub watcher: fdomain_client::fidl::ServerEnd<WatcherV4Marker>,
27    pub options: WatcherOptionsV4,
28}
29
30impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for StateV4GetWatcherV4Request {}
31
32#[derive(Debug, PartialEq)]
33pub struct StateV6GetRuleWatcherV6Request {
34    pub watcher: fdomain_client::fidl::ServerEnd<RuleWatcherV6Marker>,
35    pub options: RuleWatcherOptionsV6,
36}
37
38impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
39    for StateV6GetRuleWatcherV6Request
40{
41}
42
43#[derive(Debug, PartialEq)]
44pub struct StateV6GetWatcherV6Request {
45    pub watcher: fdomain_client::fidl::ServerEnd<WatcherV6Marker>,
46    pub options: WatcherOptionsV6,
47}
48
49impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for StateV6GetWatcherV6Request {}
50
51#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
52pub struct RuleWatcherV4Marker;
53
54impl fdomain_client::fidl::ProtocolMarker for RuleWatcherV4Marker {
55    type Proxy = RuleWatcherV4Proxy;
56    type RequestStream = RuleWatcherV4RequestStream;
57
58    const DEBUG_NAME: &'static str = "(anonymous) RuleWatcherV4";
59}
60
61pub trait RuleWatcherV4ProxyInterface: Send + Sync {
62    type WatchResponseFut: std::future::Future<Output = Result<Vec<RuleEventV4>, fidl::Error>>
63        + Send;
64    fn r#watch(&self) -> Self::WatchResponseFut;
65}
66
67#[derive(Debug, Clone)]
68pub struct RuleWatcherV4Proxy {
69    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
70}
71
72impl fdomain_client::fidl::Proxy for RuleWatcherV4Proxy {
73    type Protocol = RuleWatcherV4Marker;
74
75    fn from_channel(inner: fdomain_client::Channel) -> Self {
76        Self::new(inner)
77    }
78
79    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
80        self.client.into_channel().map_err(|client| Self { client })
81    }
82
83    fn as_channel(&self) -> &fdomain_client::Channel {
84        self.client.as_channel()
85    }
86}
87
88impl RuleWatcherV4Proxy {
89    /// Create a new Proxy for fuchsia.net.routes/RuleWatcherV4.
90    pub fn new(channel: fdomain_client::Channel) -> Self {
91        let protocol_name =
92            <RuleWatcherV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
93        Self { client: fidl::client::Client::new(channel, protocol_name) }
94    }
95
96    /// Get a Stream of events from the remote end of the protocol.
97    ///
98    /// # Panics
99    ///
100    /// Panics if the event stream was already taken.
101    pub fn take_event_stream(&self) -> RuleWatcherV4EventStream {
102        RuleWatcherV4EventStream { event_receiver: self.client.take_event_receiver() }
103    }
104
105    /// Hanging-Get style API for observing routing rule changes.
106    ///
107    /// Clients must only have one pending `Watch` call at a time. Calling
108    /// `Watch` while a request is already pending will cause the protocol to
109    /// close.
110    ///
111    /// The first N events will always be `existing` where N is the number of
112    /// IPv4 rules that already existed when the server-end of the protocol was
113    /// initialized. The following event will be `idle` signaling the end of the
114    /// `existing` events. At this point the client has watched all existing
115    /// state and will never again observe an `existing` event.
116    ///
117    /// - response `events` A vector of at most `MAX_EVENTS` events.
118    pub fn r#watch(
119        &self,
120    ) -> fidl::client::QueryResponseFut<
121        Vec<RuleEventV4>,
122        fdomain_client::fidl::FDomainResourceDialect,
123    > {
124        RuleWatcherV4ProxyInterface::r#watch(self)
125    }
126}
127
128impl RuleWatcherV4ProxyInterface for RuleWatcherV4Proxy {
129    type WatchResponseFut = fidl::client::QueryResponseFut<
130        Vec<RuleEventV4>,
131        fdomain_client::fidl::FDomainResourceDialect,
132    >;
133    fn r#watch(&self) -> Self::WatchResponseFut {
134        fn _decode(
135            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
136        ) -> Result<Vec<RuleEventV4>, fidl::Error> {
137            let _response = fidl::client::decode_transaction_body::<
138                RuleWatcherV4WatchResponse,
139                fdomain_client::fidl::FDomainResourceDialect,
140                0x7f94d7ea0f843271,
141            >(_buf?)?;
142            Ok(_response.events)
143        }
144        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<RuleEventV4>>(
145            (),
146            0x7f94d7ea0f843271,
147            fidl::encoding::DynamicFlags::empty(),
148            _decode,
149        )
150    }
151}
152
153pub struct RuleWatcherV4EventStream {
154    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
155}
156
157impl std::marker::Unpin for RuleWatcherV4EventStream {}
158
159impl futures::stream::FusedStream for RuleWatcherV4EventStream {
160    fn is_terminated(&self) -> bool {
161        self.event_receiver.is_terminated()
162    }
163}
164
165impl futures::Stream for RuleWatcherV4EventStream {
166    type Item = Result<RuleWatcherV4Event, fidl::Error>;
167
168    fn poll_next(
169        mut self: std::pin::Pin<&mut Self>,
170        cx: &mut std::task::Context<'_>,
171    ) -> std::task::Poll<Option<Self::Item>> {
172        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
173            &mut self.event_receiver,
174            cx
175        )?) {
176            Some(buf) => std::task::Poll::Ready(Some(RuleWatcherV4Event::decode(buf))),
177            None => std::task::Poll::Ready(None),
178        }
179    }
180}
181
182#[derive(Debug)]
183pub enum RuleWatcherV4Event {}
184
185impl RuleWatcherV4Event {
186    /// Decodes a message buffer as a [`RuleWatcherV4Event`].
187    fn decode(
188        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
189    ) -> Result<RuleWatcherV4Event, fidl::Error> {
190        let (bytes, _handles) = buf.split_mut();
191        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
192        debug_assert_eq!(tx_header.tx_id, 0);
193        match tx_header.ordinal {
194            _ => Err(fidl::Error::UnknownOrdinal {
195                ordinal: tx_header.ordinal,
196                protocol_name:
197                    <RuleWatcherV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
198            }),
199        }
200    }
201}
202
203/// A Stream of incoming requests for fuchsia.net.routes/RuleWatcherV4.
204pub struct RuleWatcherV4RequestStream {
205    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
206    is_terminated: bool,
207}
208
209impl std::marker::Unpin for RuleWatcherV4RequestStream {}
210
211impl futures::stream::FusedStream for RuleWatcherV4RequestStream {
212    fn is_terminated(&self) -> bool {
213        self.is_terminated
214    }
215}
216
217impl fdomain_client::fidl::RequestStream for RuleWatcherV4RequestStream {
218    type Protocol = RuleWatcherV4Marker;
219    type ControlHandle = RuleWatcherV4ControlHandle;
220
221    fn from_channel(channel: fdomain_client::Channel) -> Self {
222        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
223    }
224
225    fn control_handle(&self) -> Self::ControlHandle {
226        RuleWatcherV4ControlHandle { inner: self.inner.clone() }
227    }
228
229    fn into_inner(
230        self,
231    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
232    {
233        (self.inner, self.is_terminated)
234    }
235
236    fn from_inner(
237        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
238        is_terminated: bool,
239    ) -> Self {
240        Self { inner, is_terminated }
241    }
242}
243
244impl futures::Stream for RuleWatcherV4RequestStream {
245    type Item = Result<RuleWatcherV4Request, fidl::Error>;
246
247    fn poll_next(
248        mut self: std::pin::Pin<&mut Self>,
249        cx: &mut std::task::Context<'_>,
250    ) -> std::task::Poll<Option<Self::Item>> {
251        let this = &mut *self;
252        if this.inner.check_shutdown(cx) {
253            this.is_terminated = true;
254            return std::task::Poll::Ready(None);
255        }
256        if this.is_terminated {
257            panic!("polled RuleWatcherV4RequestStream after completion");
258        }
259        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
260            |bytes, handles| {
261                match this.inner.channel().read_etc(cx, bytes, handles) {
262                    std::task::Poll::Ready(Ok(())) => {}
263                    std::task::Poll::Pending => return std::task::Poll::Pending,
264                    std::task::Poll::Ready(Err(None)) => {
265                        this.is_terminated = true;
266                        return std::task::Poll::Ready(None);
267                    }
268                    std::task::Poll::Ready(Err(Some(e))) => {
269                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
270                            e.into(),
271                        ))));
272                    }
273                }
274
275                // A message has been received from the channel
276                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
277
278                std::task::Poll::Ready(Some(match header.ordinal {
279                0x7f94d7ea0f843271 => {
280                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
281                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
282                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
283                    let control_handle = RuleWatcherV4ControlHandle {
284                        inner: this.inner.clone(),
285                    };
286                    Ok(RuleWatcherV4Request::Watch {
287                        responder: RuleWatcherV4WatchResponder {
288                            control_handle: std::mem::ManuallyDrop::new(control_handle),
289                            tx_id: header.tx_id,
290                        },
291                    })
292                }
293                _ => Err(fidl::Error::UnknownOrdinal {
294                    ordinal: header.ordinal,
295                    protocol_name: <RuleWatcherV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
296                }),
297            }))
298            },
299        )
300    }
301}
302
303/// An observer protocol for changes in the system's IPv4 rules table.
304#[derive(Debug)]
305pub enum RuleWatcherV4Request {
306    /// Hanging-Get style API for observing routing rule changes.
307    ///
308    /// Clients must only have one pending `Watch` call at a time. Calling
309    /// `Watch` while a request is already pending will cause the protocol to
310    /// close.
311    ///
312    /// The first N events will always be `existing` where N is the number of
313    /// IPv4 rules that already existed when the server-end of the protocol was
314    /// initialized. The following event will be `idle` signaling the end of the
315    /// `existing` events. At this point the client has watched all existing
316    /// state and will never again observe an `existing` event.
317    ///
318    /// - response `events` A vector of at most `MAX_EVENTS` events.
319    Watch { responder: RuleWatcherV4WatchResponder },
320}
321
322impl RuleWatcherV4Request {
323    #[allow(irrefutable_let_patterns)]
324    pub fn into_watch(self) -> Option<(RuleWatcherV4WatchResponder)> {
325        if let RuleWatcherV4Request::Watch { responder } = self { Some((responder)) } else { None }
326    }
327
328    /// Name of the method defined in FIDL
329    pub fn method_name(&self) -> &'static str {
330        match *self {
331            RuleWatcherV4Request::Watch { .. } => "watch",
332        }
333    }
334}
335
336#[derive(Debug, Clone)]
337pub struct RuleWatcherV4ControlHandle {
338    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
339}
340
341impl RuleWatcherV4ControlHandle {
342    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
343        self.inner.shutdown_with_epitaph(status.into())
344    }
345}
346
347impl fdomain_client::fidl::ControlHandle for RuleWatcherV4ControlHandle {
348    fn shutdown(&self) {
349        self.inner.shutdown()
350    }
351
352    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
353        self.inner.shutdown_with_epitaph(status)
354    }
355
356    fn is_closed(&self) -> bool {
357        self.inner.channel().is_closed()
358    }
359    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
360        self.inner.channel().on_closed()
361    }
362}
363
364impl RuleWatcherV4ControlHandle {}
365
366#[must_use = "FIDL methods require a response to be sent"]
367#[derive(Debug)]
368pub struct RuleWatcherV4WatchResponder {
369    control_handle: std::mem::ManuallyDrop<RuleWatcherV4ControlHandle>,
370    tx_id: u32,
371}
372
373/// Set the the channel to be shutdown (see [`RuleWatcherV4ControlHandle::shutdown`])
374/// if the responder is dropped without sending a response, so that the client
375/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
376impl std::ops::Drop for RuleWatcherV4WatchResponder {
377    fn drop(&mut self) {
378        self.control_handle.shutdown();
379        // Safety: drops once, never accessed again
380        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
381    }
382}
383
384impl fdomain_client::fidl::Responder for RuleWatcherV4WatchResponder {
385    type ControlHandle = RuleWatcherV4ControlHandle;
386
387    fn control_handle(&self) -> &RuleWatcherV4ControlHandle {
388        &self.control_handle
389    }
390
391    fn drop_without_shutdown(mut self) {
392        // Safety: drops once, never accessed again due to mem::forget
393        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
394        // Prevent Drop from running (which would shut down the channel)
395        std::mem::forget(self);
396    }
397}
398
399impl RuleWatcherV4WatchResponder {
400    /// Sends a response to the FIDL transaction.
401    ///
402    /// Sets the channel to shutdown if an error occurs.
403    pub fn send(self, mut events: &[RuleEventV4]) -> Result<(), fidl::Error> {
404        let _result = self.send_raw(events);
405        if _result.is_err() {
406            self.control_handle.shutdown();
407        }
408        self.drop_without_shutdown();
409        _result
410    }
411
412    /// Similar to "send" but does not shutdown the channel if an error occurs.
413    pub fn send_no_shutdown_on_err(self, mut events: &[RuleEventV4]) -> Result<(), fidl::Error> {
414        let _result = self.send_raw(events);
415        self.drop_without_shutdown();
416        _result
417    }
418
419    fn send_raw(&self, mut events: &[RuleEventV4]) -> Result<(), fidl::Error> {
420        self.control_handle.inner.send::<RuleWatcherV4WatchResponse>(
421            (events,),
422            self.tx_id,
423            0x7f94d7ea0f843271,
424            fidl::encoding::DynamicFlags::empty(),
425        )
426    }
427}
428
429#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
430pub struct RuleWatcherV6Marker;
431
432impl fdomain_client::fidl::ProtocolMarker for RuleWatcherV6Marker {
433    type Proxy = RuleWatcherV6Proxy;
434    type RequestStream = RuleWatcherV6RequestStream;
435
436    const DEBUG_NAME: &'static str = "(anonymous) RuleWatcherV6";
437}
438
439pub trait RuleWatcherV6ProxyInterface: Send + Sync {
440    type WatchResponseFut: std::future::Future<Output = Result<Vec<RuleEventV6>, fidl::Error>>
441        + Send;
442    fn r#watch(&self) -> Self::WatchResponseFut;
443}
444
445#[derive(Debug, Clone)]
446pub struct RuleWatcherV6Proxy {
447    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
448}
449
450impl fdomain_client::fidl::Proxy for RuleWatcherV6Proxy {
451    type Protocol = RuleWatcherV6Marker;
452
453    fn from_channel(inner: fdomain_client::Channel) -> Self {
454        Self::new(inner)
455    }
456
457    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
458        self.client.into_channel().map_err(|client| Self { client })
459    }
460
461    fn as_channel(&self) -> &fdomain_client::Channel {
462        self.client.as_channel()
463    }
464}
465
466impl RuleWatcherV6Proxy {
467    /// Create a new Proxy for fuchsia.net.routes/RuleWatcherV6.
468    pub fn new(channel: fdomain_client::Channel) -> Self {
469        let protocol_name =
470            <RuleWatcherV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
471        Self { client: fidl::client::Client::new(channel, protocol_name) }
472    }
473
474    /// Get a Stream of events from the remote end of the protocol.
475    ///
476    /// # Panics
477    ///
478    /// Panics if the event stream was already taken.
479    pub fn take_event_stream(&self) -> RuleWatcherV6EventStream {
480        RuleWatcherV6EventStream { event_receiver: self.client.take_event_receiver() }
481    }
482
483    /// Hanging-Get style API for observing routing rule changes.
484    ///
485    /// Clients must only have one pending `Watch` call at a time. Calling
486    /// `Watch` while a request is already pending will cause the protocol to
487    /// close.
488    ///
489    /// The first N events will always be `existing` where N is the number of
490    /// IPv6 rules that already existed when the server-end of the protocol was
491    /// initialized. The following event will be `idle` signaling the end of the
492    /// `existing` events. At this point the client has watched all existing
493    /// state and will never again observe an `existing` event.
494    ///
495    /// - response `events` A vector of at most `MAX_EVENTS` events.
496    pub fn r#watch(
497        &self,
498    ) -> fidl::client::QueryResponseFut<
499        Vec<RuleEventV6>,
500        fdomain_client::fidl::FDomainResourceDialect,
501    > {
502        RuleWatcherV6ProxyInterface::r#watch(self)
503    }
504}
505
506impl RuleWatcherV6ProxyInterface for RuleWatcherV6Proxy {
507    type WatchResponseFut = fidl::client::QueryResponseFut<
508        Vec<RuleEventV6>,
509        fdomain_client::fidl::FDomainResourceDialect,
510    >;
511    fn r#watch(&self) -> Self::WatchResponseFut {
512        fn _decode(
513            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
514        ) -> Result<Vec<RuleEventV6>, fidl::Error> {
515            let _response = fidl::client::decode_transaction_body::<
516                RuleWatcherV6WatchResponse,
517                fdomain_client::fidl::FDomainResourceDialect,
518                0x5ccd746122bfa678,
519            >(_buf?)?;
520            Ok(_response.events)
521        }
522        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<RuleEventV6>>(
523            (),
524            0x5ccd746122bfa678,
525            fidl::encoding::DynamicFlags::empty(),
526            _decode,
527        )
528    }
529}
530
531pub struct RuleWatcherV6EventStream {
532    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
533}
534
535impl std::marker::Unpin for RuleWatcherV6EventStream {}
536
537impl futures::stream::FusedStream for RuleWatcherV6EventStream {
538    fn is_terminated(&self) -> bool {
539        self.event_receiver.is_terminated()
540    }
541}
542
543impl futures::Stream for RuleWatcherV6EventStream {
544    type Item = Result<RuleWatcherV6Event, fidl::Error>;
545
546    fn poll_next(
547        mut self: std::pin::Pin<&mut Self>,
548        cx: &mut std::task::Context<'_>,
549    ) -> std::task::Poll<Option<Self::Item>> {
550        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
551            &mut self.event_receiver,
552            cx
553        )?) {
554            Some(buf) => std::task::Poll::Ready(Some(RuleWatcherV6Event::decode(buf))),
555            None => std::task::Poll::Ready(None),
556        }
557    }
558}
559
560#[derive(Debug)]
561pub enum RuleWatcherV6Event {}
562
563impl RuleWatcherV6Event {
564    /// Decodes a message buffer as a [`RuleWatcherV6Event`].
565    fn decode(
566        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
567    ) -> Result<RuleWatcherV6Event, fidl::Error> {
568        let (bytes, _handles) = buf.split_mut();
569        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
570        debug_assert_eq!(tx_header.tx_id, 0);
571        match tx_header.ordinal {
572            _ => Err(fidl::Error::UnknownOrdinal {
573                ordinal: tx_header.ordinal,
574                protocol_name:
575                    <RuleWatcherV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
576            }),
577        }
578    }
579}
580
581/// A Stream of incoming requests for fuchsia.net.routes/RuleWatcherV6.
582pub struct RuleWatcherV6RequestStream {
583    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
584    is_terminated: bool,
585}
586
587impl std::marker::Unpin for RuleWatcherV6RequestStream {}
588
589impl futures::stream::FusedStream for RuleWatcherV6RequestStream {
590    fn is_terminated(&self) -> bool {
591        self.is_terminated
592    }
593}
594
595impl fdomain_client::fidl::RequestStream for RuleWatcherV6RequestStream {
596    type Protocol = RuleWatcherV6Marker;
597    type ControlHandle = RuleWatcherV6ControlHandle;
598
599    fn from_channel(channel: fdomain_client::Channel) -> Self {
600        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
601    }
602
603    fn control_handle(&self) -> Self::ControlHandle {
604        RuleWatcherV6ControlHandle { inner: self.inner.clone() }
605    }
606
607    fn into_inner(
608        self,
609    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
610    {
611        (self.inner, self.is_terminated)
612    }
613
614    fn from_inner(
615        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
616        is_terminated: bool,
617    ) -> Self {
618        Self { inner, is_terminated }
619    }
620}
621
622impl futures::Stream for RuleWatcherV6RequestStream {
623    type Item = Result<RuleWatcherV6Request, fidl::Error>;
624
625    fn poll_next(
626        mut self: std::pin::Pin<&mut Self>,
627        cx: &mut std::task::Context<'_>,
628    ) -> std::task::Poll<Option<Self::Item>> {
629        let this = &mut *self;
630        if this.inner.check_shutdown(cx) {
631            this.is_terminated = true;
632            return std::task::Poll::Ready(None);
633        }
634        if this.is_terminated {
635            panic!("polled RuleWatcherV6RequestStream after completion");
636        }
637        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
638            |bytes, handles| {
639                match this.inner.channel().read_etc(cx, bytes, handles) {
640                    std::task::Poll::Ready(Ok(())) => {}
641                    std::task::Poll::Pending => return std::task::Poll::Pending,
642                    std::task::Poll::Ready(Err(None)) => {
643                        this.is_terminated = true;
644                        return std::task::Poll::Ready(None);
645                    }
646                    std::task::Poll::Ready(Err(Some(e))) => {
647                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
648                            e.into(),
649                        ))));
650                    }
651                }
652
653                // A message has been received from the channel
654                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
655
656                std::task::Poll::Ready(Some(match header.ordinal {
657                0x5ccd746122bfa678 => {
658                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
659                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
660                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
661                    let control_handle = RuleWatcherV6ControlHandle {
662                        inner: this.inner.clone(),
663                    };
664                    Ok(RuleWatcherV6Request::Watch {
665                        responder: RuleWatcherV6WatchResponder {
666                            control_handle: std::mem::ManuallyDrop::new(control_handle),
667                            tx_id: header.tx_id,
668                        },
669                    })
670                }
671                _ => Err(fidl::Error::UnknownOrdinal {
672                    ordinal: header.ordinal,
673                    protocol_name: <RuleWatcherV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
674                }),
675            }))
676            },
677        )
678    }
679}
680
681/// An observer protocol for changes in the system's IPv6 rules table.
682#[derive(Debug)]
683pub enum RuleWatcherV6Request {
684    /// Hanging-Get style API for observing routing rule changes.
685    ///
686    /// Clients must only have one pending `Watch` call at a time. Calling
687    /// `Watch` while a request is already pending will cause the protocol to
688    /// close.
689    ///
690    /// The first N events will always be `existing` where N is the number of
691    /// IPv6 rules that already existed when the server-end of the protocol was
692    /// initialized. The following event will be `idle` signaling the end of the
693    /// `existing` events. At this point the client has watched all existing
694    /// state and will never again observe an `existing` event.
695    ///
696    /// - response `events` A vector of at most `MAX_EVENTS` events.
697    Watch { responder: RuleWatcherV6WatchResponder },
698}
699
700impl RuleWatcherV6Request {
701    #[allow(irrefutable_let_patterns)]
702    pub fn into_watch(self) -> Option<(RuleWatcherV6WatchResponder)> {
703        if let RuleWatcherV6Request::Watch { responder } = self { Some((responder)) } else { None }
704    }
705
706    /// Name of the method defined in FIDL
707    pub fn method_name(&self) -> &'static str {
708        match *self {
709            RuleWatcherV6Request::Watch { .. } => "watch",
710        }
711    }
712}
713
714#[derive(Debug, Clone)]
715pub struct RuleWatcherV6ControlHandle {
716    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
717}
718
719impl RuleWatcherV6ControlHandle {
720    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
721        self.inner.shutdown_with_epitaph(status.into())
722    }
723}
724
725impl fdomain_client::fidl::ControlHandle for RuleWatcherV6ControlHandle {
726    fn shutdown(&self) {
727        self.inner.shutdown()
728    }
729
730    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
731        self.inner.shutdown_with_epitaph(status)
732    }
733
734    fn is_closed(&self) -> bool {
735        self.inner.channel().is_closed()
736    }
737    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
738        self.inner.channel().on_closed()
739    }
740}
741
742impl RuleWatcherV6ControlHandle {}
743
744#[must_use = "FIDL methods require a response to be sent"]
745#[derive(Debug)]
746pub struct RuleWatcherV6WatchResponder {
747    control_handle: std::mem::ManuallyDrop<RuleWatcherV6ControlHandle>,
748    tx_id: u32,
749}
750
751/// Set the the channel to be shutdown (see [`RuleWatcherV6ControlHandle::shutdown`])
752/// if the responder is dropped without sending a response, so that the client
753/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
754impl std::ops::Drop for RuleWatcherV6WatchResponder {
755    fn drop(&mut self) {
756        self.control_handle.shutdown();
757        // Safety: drops once, never accessed again
758        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
759    }
760}
761
762impl fdomain_client::fidl::Responder for RuleWatcherV6WatchResponder {
763    type ControlHandle = RuleWatcherV6ControlHandle;
764
765    fn control_handle(&self) -> &RuleWatcherV6ControlHandle {
766        &self.control_handle
767    }
768
769    fn drop_without_shutdown(mut self) {
770        // Safety: drops once, never accessed again due to mem::forget
771        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
772        // Prevent Drop from running (which would shut down the channel)
773        std::mem::forget(self);
774    }
775}
776
777impl RuleWatcherV6WatchResponder {
778    /// Sends a response to the FIDL transaction.
779    ///
780    /// Sets the channel to shutdown if an error occurs.
781    pub fn send(self, mut events: &[RuleEventV6]) -> Result<(), fidl::Error> {
782        let _result = self.send_raw(events);
783        if _result.is_err() {
784            self.control_handle.shutdown();
785        }
786        self.drop_without_shutdown();
787        _result
788    }
789
790    /// Similar to "send" but does not shutdown the channel if an error occurs.
791    pub fn send_no_shutdown_on_err(self, mut events: &[RuleEventV6]) -> Result<(), fidl::Error> {
792        let _result = self.send_raw(events);
793        self.drop_without_shutdown();
794        _result
795    }
796
797    fn send_raw(&self, mut events: &[RuleEventV6]) -> Result<(), fidl::Error> {
798        self.control_handle.inner.send::<RuleWatcherV6WatchResponse>(
799            (events,),
800            self.tx_id,
801            0x5ccd746122bfa678,
802            fidl::encoding::DynamicFlags::empty(),
803        )
804    }
805}
806
807#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
808pub struct StateMarker;
809
810impl fdomain_client::fidl::ProtocolMarker for StateMarker {
811    type Proxy = StateProxy;
812    type RequestStream = StateRequestStream;
813
814    const DEBUG_NAME: &'static str = "fuchsia.net.routes.State";
815}
816impl fdomain_client::fidl::DiscoverableProtocolMarker for StateMarker {}
817pub type StateResolveResult = Result<Resolved, i32>;
818pub type StateResolve2Result = Result<ResolveResult, ResolveError>;
819pub type StateGetRouteTableNameResult = Result<String, StateGetRouteTableNameError>;
820
821pub trait StateProxyInterface: Send + Sync {
822    type ResolveResponseFut: std::future::Future<Output = Result<StateResolveResult, fidl::Error>>
823        + Send;
824    fn r#resolve(&self, destination: &fdomain_fuchsia_net::IpAddress) -> Self::ResolveResponseFut;
825    type Resolve2ResponseFut: std::future::Future<Output = Result<StateResolve2Result, fidl::Error>>
826        + Send;
827    fn r#resolve2(
828        &self,
829        destination: &fdomain_fuchsia_net::IpAddress,
830        options: &ResolveOptions,
831    ) -> Self::Resolve2ResponseFut;
832    type GetRouteTableNameResponseFut: std::future::Future<Output = Result<StateGetRouteTableNameResult, fidl::Error>>
833        + Send;
834    fn r#get_route_table_name(&self, table_id: u32) -> Self::GetRouteTableNameResponseFut;
835}
836
837#[derive(Debug, Clone)]
838pub struct StateProxy {
839    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
840}
841
842impl fdomain_client::fidl::Proxy for StateProxy {
843    type Protocol = StateMarker;
844
845    fn from_channel(inner: fdomain_client::Channel) -> Self {
846        Self::new(inner)
847    }
848
849    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
850        self.client.into_channel().map_err(|client| Self { client })
851    }
852
853    fn as_channel(&self) -> &fdomain_client::Channel {
854        self.client.as_channel()
855    }
856}
857
858impl StateProxy {
859    /// Create a new Proxy for fuchsia.net.routes/State.
860    pub fn new(channel: fdomain_client::Channel) -> Self {
861        let protocol_name = <StateMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
862        Self { client: fidl::client::Client::new(channel, protocol_name) }
863    }
864
865    /// Get a Stream of events from the remote end of the protocol.
866    ///
867    /// # Panics
868    ///
869    /// Panics if the event stream was already taken.
870    pub fn take_event_stream(&self) -> StateEventStream {
871        StateEventStream { event_receiver: self.client.take_event_receiver() }
872    }
873
874    /// Resolves the route to a destination.
875    ///
876    /// + request `destination` the IP address to resolve a route to. If the
877    ///     unspecified address (all zeroes) is provided, the default route will
878    ///     be returned. The variant of `destination` determines variant of
879    ///     [`fuchsia.net/IpAddress`] fields in the resolved route.
880    /// - response `result` contains the resolved route to `destination`.
881    /// * error `ZX_ERR_ADDRESS_UNREACHABLE` if `destination` can't be resolved.
882    pub fn r#resolve(
883        &self,
884        mut destination: &fdomain_fuchsia_net::IpAddress,
885    ) -> fidl::client::QueryResponseFut<
886        StateResolveResult,
887        fdomain_client::fidl::FDomainResourceDialect,
888    > {
889        StateProxyInterface::r#resolve(self, destination)
890    }
891
892    /// Resolves the route to a destination.
893    ///
894    /// + request `destination` the IP address to resolve a route to. If the
895    ///     unspecified address (all zeroes) is provided, the default route will
896    ///     be returned. The variant of `destination` determines variant of
897    ///     [`fuchsia.net/IpAddress`] fields in the resolved route.
898    /// + request `options` contains optional information used for the route resolution.
899    /// - response `result` contains the resolved route to `destination`.
900    /// * error `ADDRESS_UNREACHABLE` if `destination` can't be resolved.
901    pub fn r#resolve2(
902        &self,
903        mut destination: &fdomain_fuchsia_net::IpAddress,
904        mut options: &ResolveOptions,
905    ) -> fidl::client::QueryResponseFut<
906        StateResolve2Result,
907        fdomain_client::fidl::FDomainResourceDialect,
908    > {
909        StateProxyInterface::r#resolve2(self, destination, options)
910    }
911
912    /// Gets the route table name by its ID.
913    ///
914    /// + request `table_id` the ID of the route table in question.
915    /// - response `table_name` the name of the route table, if the route table
916    /// does not have a name, an empty string is returned.
917    /// * error `NO_TABLE` if the route table does not exist.
918    pub fn r#get_route_table_name(
919        &self,
920        mut table_id: u32,
921    ) -> fidl::client::QueryResponseFut<
922        StateGetRouteTableNameResult,
923        fdomain_client::fidl::FDomainResourceDialect,
924    > {
925        StateProxyInterface::r#get_route_table_name(self, table_id)
926    }
927}
928
929impl StateProxyInterface for StateProxy {
930    type ResolveResponseFut = fidl::client::QueryResponseFut<
931        StateResolveResult,
932        fdomain_client::fidl::FDomainResourceDialect,
933    >;
934    fn r#resolve(
935        &self,
936        mut destination: &fdomain_fuchsia_net::IpAddress,
937    ) -> Self::ResolveResponseFut {
938        fn _decode(
939            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
940        ) -> Result<StateResolveResult, fidl::Error> {
941            let _response = fidl::client::decode_transaction_body::<
942                fidl::encoding::ResultType<StateResolveResponse, i32>,
943                fdomain_client::fidl::FDomainResourceDialect,
944                0x1541bc37d2d1dfb0,
945            >(_buf?)?;
946            Ok(_response.map(|x| x.result))
947        }
948        self.client.send_query_and_decode::<StateResolveRequest, StateResolveResult>(
949            (destination,),
950            0x1541bc37d2d1dfb0,
951            fidl::encoding::DynamicFlags::empty(),
952            _decode,
953        )
954    }
955
956    type Resolve2ResponseFut = fidl::client::QueryResponseFut<
957        StateResolve2Result,
958        fdomain_client::fidl::FDomainResourceDialect,
959    >;
960    fn r#resolve2(
961        &self,
962        mut destination: &fdomain_fuchsia_net::IpAddress,
963        mut options: &ResolveOptions,
964    ) -> Self::Resolve2ResponseFut {
965        fn _decode(
966            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
967        ) -> Result<StateResolve2Result, fidl::Error> {
968            let _response = fidl::client::decode_transaction_body::<
969                fidl::encoding::ResultType<StateResolve2Response, ResolveError>,
970                fdomain_client::fidl::FDomainResourceDialect,
971                0x3a37608b6851f75c,
972            >(_buf?)?;
973            Ok(_response.map(|x| x.result))
974        }
975        self.client.send_query_and_decode::<StateResolve2Request, StateResolve2Result>(
976            (destination, options),
977            0x3a37608b6851f75c,
978            fidl::encoding::DynamicFlags::empty(),
979            _decode,
980        )
981    }
982
983    type GetRouteTableNameResponseFut = fidl::client::QueryResponseFut<
984        StateGetRouteTableNameResult,
985        fdomain_client::fidl::FDomainResourceDialect,
986    >;
987    fn r#get_route_table_name(&self, mut table_id: u32) -> Self::GetRouteTableNameResponseFut {
988        fn _decode(
989            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
990        ) -> Result<StateGetRouteTableNameResult, fidl::Error> {
991            let _response = fidl::client::decode_transaction_body::<
992                fidl::encoding::ResultType<
993                    StateGetRouteTableNameResponse,
994                    StateGetRouteTableNameError,
995                >,
996                fdomain_client::fidl::FDomainResourceDialect,
997                0x6fed5423c7ce421a,
998            >(_buf?)?;
999            Ok(_response.map(|x| x.table_name))
1000        }
1001        self.client
1002            .send_query_and_decode::<StateGetRouteTableNameRequest, StateGetRouteTableNameResult>(
1003                (table_id,),
1004                0x6fed5423c7ce421a,
1005                fidl::encoding::DynamicFlags::empty(),
1006                _decode,
1007            )
1008    }
1009}
1010
1011pub struct StateEventStream {
1012    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
1013}
1014
1015impl std::marker::Unpin for StateEventStream {}
1016
1017impl futures::stream::FusedStream for StateEventStream {
1018    fn is_terminated(&self) -> bool {
1019        self.event_receiver.is_terminated()
1020    }
1021}
1022
1023impl futures::Stream for StateEventStream {
1024    type Item = Result<StateEvent, fidl::Error>;
1025
1026    fn poll_next(
1027        mut self: std::pin::Pin<&mut Self>,
1028        cx: &mut std::task::Context<'_>,
1029    ) -> std::task::Poll<Option<Self::Item>> {
1030        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1031            &mut self.event_receiver,
1032            cx
1033        )?) {
1034            Some(buf) => std::task::Poll::Ready(Some(StateEvent::decode(buf))),
1035            None => std::task::Poll::Ready(None),
1036        }
1037    }
1038}
1039
1040#[derive(Debug)]
1041pub enum StateEvent {}
1042
1043impl StateEvent {
1044    /// Decodes a message buffer as a [`StateEvent`].
1045    fn decode(
1046        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1047    ) -> Result<StateEvent, fidl::Error> {
1048        let (bytes, _handles) = buf.split_mut();
1049        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1050        debug_assert_eq!(tx_header.tx_id, 0);
1051        match tx_header.ordinal {
1052            _ => Err(fidl::Error::UnknownOrdinal {
1053                ordinal: tx_header.ordinal,
1054                protocol_name: <StateMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1055            }),
1056        }
1057    }
1058}
1059
1060/// A Stream of incoming requests for fuchsia.net.routes/State.
1061pub struct StateRequestStream {
1062    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1063    is_terminated: bool,
1064}
1065
1066impl std::marker::Unpin for StateRequestStream {}
1067
1068impl futures::stream::FusedStream for StateRequestStream {
1069    fn is_terminated(&self) -> bool {
1070        self.is_terminated
1071    }
1072}
1073
1074impl fdomain_client::fidl::RequestStream for StateRequestStream {
1075    type Protocol = StateMarker;
1076    type ControlHandle = StateControlHandle;
1077
1078    fn from_channel(channel: fdomain_client::Channel) -> Self {
1079        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1080    }
1081
1082    fn control_handle(&self) -> Self::ControlHandle {
1083        StateControlHandle { inner: self.inner.clone() }
1084    }
1085
1086    fn into_inner(
1087        self,
1088    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1089    {
1090        (self.inner, self.is_terminated)
1091    }
1092
1093    fn from_inner(
1094        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1095        is_terminated: bool,
1096    ) -> Self {
1097        Self { inner, is_terminated }
1098    }
1099}
1100
1101impl futures::Stream for StateRequestStream {
1102    type Item = Result<StateRequest, fidl::Error>;
1103
1104    fn poll_next(
1105        mut self: std::pin::Pin<&mut Self>,
1106        cx: &mut std::task::Context<'_>,
1107    ) -> std::task::Poll<Option<Self::Item>> {
1108        let this = &mut *self;
1109        if this.inner.check_shutdown(cx) {
1110            this.is_terminated = true;
1111            return std::task::Poll::Ready(None);
1112        }
1113        if this.is_terminated {
1114            panic!("polled StateRequestStream after completion");
1115        }
1116        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1117            |bytes, handles| {
1118                match this.inner.channel().read_etc(cx, bytes, handles) {
1119                    std::task::Poll::Ready(Ok(())) => {}
1120                    std::task::Poll::Pending => return std::task::Poll::Pending,
1121                    std::task::Poll::Ready(Err(None)) => {
1122                        this.is_terminated = true;
1123                        return std::task::Poll::Ready(None);
1124                    }
1125                    std::task::Poll::Ready(Err(Some(e))) => {
1126                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1127                            e.into(),
1128                        ))));
1129                    }
1130                }
1131
1132                // A message has been received from the channel
1133                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1134
1135                std::task::Poll::Ready(Some(match header.ordinal {
1136                    0x1541bc37d2d1dfb0 => {
1137                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1138                        let mut req = fidl::new_empty!(
1139                            StateResolveRequest,
1140                            fdomain_client::fidl::FDomainResourceDialect
1141                        );
1142                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<StateResolveRequest>(&header, _body_bytes, handles, &mut req)?;
1143                        let control_handle = StateControlHandle { inner: this.inner.clone() };
1144                        Ok(StateRequest::Resolve {
1145                            destination: req.destination,
1146
1147                            responder: StateResolveResponder {
1148                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1149                                tx_id: header.tx_id,
1150                            },
1151                        })
1152                    }
1153                    0x3a37608b6851f75c => {
1154                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1155                        let mut req = fidl::new_empty!(
1156                            StateResolve2Request,
1157                            fdomain_client::fidl::FDomainResourceDialect
1158                        );
1159                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<StateResolve2Request>(&header, _body_bytes, handles, &mut req)?;
1160                        let control_handle = StateControlHandle { inner: this.inner.clone() };
1161                        Ok(StateRequest::Resolve2 {
1162                            destination: req.destination,
1163                            options: req.options,
1164
1165                            responder: StateResolve2Responder {
1166                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1167                                tx_id: header.tx_id,
1168                            },
1169                        })
1170                    }
1171                    0x6fed5423c7ce421a => {
1172                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1173                        let mut req = fidl::new_empty!(
1174                            StateGetRouteTableNameRequest,
1175                            fdomain_client::fidl::FDomainResourceDialect
1176                        );
1177                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<StateGetRouteTableNameRequest>(&header, _body_bytes, handles, &mut req)?;
1178                        let control_handle = StateControlHandle { inner: this.inner.clone() };
1179                        Ok(StateRequest::GetRouteTableName {
1180                            table_id: req.table_id,
1181
1182                            responder: StateGetRouteTableNameResponder {
1183                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1184                                tx_id: header.tx_id,
1185                            },
1186                        })
1187                    }
1188                    _ => Err(fidl::Error::UnknownOrdinal {
1189                        ordinal: header.ordinal,
1190                        protocol_name:
1191                            <StateMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1192                    }),
1193                }))
1194            },
1195        )
1196    }
1197}
1198
1199/// Provides access to the system's routing state.
1200#[derive(Debug)]
1201pub enum StateRequest {
1202    /// Resolves the route to a destination.
1203    ///
1204    /// + request `destination` the IP address to resolve a route to. If the
1205    ///     unspecified address (all zeroes) is provided, the default route will
1206    ///     be returned. The variant of `destination` determines variant of
1207    ///     [`fuchsia.net/IpAddress`] fields in the resolved route.
1208    /// - response `result` contains the resolved route to `destination`.
1209    /// * error `ZX_ERR_ADDRESS_UNREACHABLE` if `destination` can't be resolved.
1210    Resolve { destination: fdomain_fuchsia_net::IpAddress, responder: StateResolveResponder },
1211    /// Resolves the route to a destination.
1212    ///
1213    /// + request `destination` the IP address to resolve a route to. If the
1214    ///     unspecified address (all zeroes) is provided, the default route will
1215    ///     be returned. The variant of `destination` determines variant of
1216    ///     [`fuchsia.net/IpAddress`] fields in the resolved route.
1217    /// + request `options` contains optional information used for the route resolution.
1218    /// - response `result` contains the resolved route to `destination`.
1219    /// * error `ADDRESS_UNREACHABLE` if `destination` can't be resolved.
1220    Resolve2 {
1221        destination: fdomain_fuchsia_net::IpAddress,
1222        options: ResolveOptions,
1223        responder: StateResolve2Responder,
1224    },
1225    /// Gets the route table name by its ID.
1226    ///
1227    /// + request `table_id` the ID of the route table in question.
1228    /// - response `table_name` the name of the route table, if the route table
1229    /// does not have a name, an empty string is returned.
1230    /// * error `NO_TABLE` if the route table does not exist.
1231    GetRouteTableName { table_id: u32, responder: StateGetRouteTableNameResponder },
1232}
1233
1234impl StateRequest {
1235    #[allow(irrefutable_let_patterns)]
1236    pub fn into_resolve(self) -> Option<(fdomain_fuchsia_net::IpAddress, StateResolveResponder)> {
1237        if let StateRequest::Resolve { destination, responder } = self {
1238            Some((destination, responder))
1239        } else {
1240            None
1241        }
1242    }
1243
1244    #[allow(irrefutable_let_patterns)]
1245    pub fn into_resolve2(
1246        self,
1247    ) -> Option<(fdomain_fuchsia_net::IpAddress, ResolveOptions, StateResolve2Responder)> {
1248        if let StateRequest::Resolve2 { destination, options, responder } = self {
1249            Some((destination, options, responder))
1250        } else {
1251            None
1252        }
1253    }
1254
1255    #[allow(irrefutable_let_patterns)]
1256    pub fn into_get_route_table_name(self) -> Option<(u32, StateGetRouteTableNameResponder)> {
1257        if let StateRequest::GetRouteTableName { table_id, responder } = self {
1258            Some((table_id, responder))
1259        } else {
1260            None
1261        }
1262    }
1263
1264    /// Name of the method defined in FIDL
1265    pub fn method_name(&self) -> &'static str {
1266        match *self {
1267            StateRequest::Resolve { .. } => "resolve",
1268            StateRequest::Resolve2 { .. } => "resolve2",
1269            StateRequest::GetRouteTableName { .. } => "get_route_table_name",
1270        }
1271    }
1272}
1273
1274#[derive(Debug, Clone)]
1275pub struct StateControlHandle {
1276    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1277}
1278
1279impl StateControlHandle {
1280    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1281        self.inner.shutdown_with_epitaph(status.into())
1282    }
1283}
1284
1285impl fdomain_client::fidl::ControlHandle for StateControlHandle {
1286    fn shutdown(&self) {
1287        self.inner.shutdown()
1288    }
1289
1290    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1291        self.inner.shutdown_with_epitaph(status)
1292    }
1293
1294    fn is_closed(&self) -> bool {
1295        self.inner.channel().is_closed()
1296    }
1297    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1298        self.inner.channel().on_closed()
1299    }
1300}
1301
1302impl StateControlHandle {}
1303
1304#[must_use = "FIDL methods require a response to be sent"]
1305#[derive(Debug)]
1306pub struct StateResolveResponder {
1307    control_handle: std::mem::ManuallyDrop<StateControlHandle>,
1308    tx_id: u32,
1309}
1310
1311/// Set the the channel to be shutdown (see [`StateControlHandle::shutdown`])
1312/// if the responder is dropped without sending a response, so that the client
1313/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1314impl std::ops::Drop for StateResolveResponder {
1315    fn drop(&mut self) {
1316        self.control_handle.shutdown();
1317        // Safety: drops once, never accessed again
1318        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1319    }
1320}
1321
1322impl fdomain_client::fidl::Responder for StateResolveResponder {
1323    type ControlHandle = StateControlHandle;
1324
1325    fn control_handle(&self) -> &StateControlHandle {
1326        &self.control_handle
1327    }
1328
1329    fn drop_without_shutdown(mut self) {
1330        // Safety: drops once, never accessed again due to mem::forget
1331        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1332        // Prevent Drop from running (which would shut down the channel)
1333        std::mem::forget(self);
1334    }
1335}
1336
1337impl StateResolveResponder {
1338    /// Sends a response to the FIDL transaction.
1339    ///
1340    /// Sets the channel to shutdown if an error occurs.
1341    pub fn send(self, mut result: Result<&Resolved, i32>) -> Result<(), fidl::Error> {
1342        let _result = self.send_raw(result);
1343        if _result.is_err() {
1344            self.control_handle.shutdown();
1345        }
1346        self.drop_without_shutdown();
1347        _result
1348    }
1349
1350    /// Similar to "send" but does not shutdown the channel if an error occurs.
1351    pub fn send_no_shutdown_on_err(
1352        self,
1353        mut result: Result<&Resolved, i32>,
1354    ) -> Result<(), fidl::Error> {
1355        let _result = self.send_raw(result);
1356        self.drop_without_shutdown();
1357        _result
1358    }
1359
1360    fn send_raw(&self, mut result: Result<&Resolved, i32>) -> Result<(), fidl::Error> {
1361        self.control_handle.inner.send::<fidl::encoding::ResultType<StateResolveResponse, i32>>(
1362            result.map(|result| (result,)),
1363            self.tx_id,
1364            0x1541bc37d2d1dfb0,
1365            fidl::encoding::DynamicFlags::empty(),
1366        )
1367    }
1368}
1369
1370#[must_use = "FIDL methods require a response to be sent"]
1371#[derive(Debug)]
1372pub struct StateResolve2Responder {
1373    control_handle: std::mem::ManuallyDrop<StateControlHandle>,
1374    tx_id: u32,
1375}
1376
1377/// Set the the channel to be shutdown (see [`StateControlHandle::shutdown`])
1378/// if the responder is dropped without sending a response, so that the client
1379/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1380impl std::ops::Drop for StateResolve2Responder {
1381    fn drop(&mut self) {
1382        self.control_handle.shutdown();
1383        // Safety: drops once, never accessed again
1384        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1385    }
1386}
1387
1388impl fdomain_client::fidl::Responder for StateResolve2Responder {
1389    type ControlHandle = StateControlHandle;
1390
1391    fn control_handle(&self) -> &StateControlHandle {
1392        &self.control_handle
1393    }
1394
1395    fn drop_without_shutdown(mut self) {
1396        // Safety: drops once, never accessed again due to mem::forget
1397        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1398        // Prevent Drop from running (which would shut down the channel)
1399        std::mem::forget(self);
1400    }
1401}
1402
1403impl StateResolve2Responder {
1404    /// Sends a response to the FIDL transaction.
1405    ///
1406    /// Sets the channel to shutdown if an error occurs.
1407    pub fn send(self, mut result: Result<&ResolveResult, ResolveError>) -> Result<(), fidl::Error> {
1408        let _result = self.send_raw(result);
1409        if _result.is_err() {
1410            self.control_handle.shutdown();
1411        }
1412        self.drop_without_shutdown();
1413        _result
1414    }
1415
1416    /// Similar to "send" but does not shutdown the channel if an error occurs.
1417    pub fn send_no_shutdown_on_err(
1418        self,
1419        mut result: Result<&ResolveResult, ResolveError>,
1420    ) -> Result<(), fidl::Error> {
1421        let _result = self.send_raw(result);
1422        self.drop_without_shutdown();
1423        _result
1424    }
1425
1426    fn send_raw(
1427        &self,
1428        mut result: Result<&ResolveResult, ResolveError>,
1429    ) -> Result<(), fidl::Error> {
1430        self.control_handle
1431            .inner
1432            .send::<fidl::encoding::ResultType<StateResolve2Response, ResolveError>>(
1433                result.map(|result| (result,)),
1434                self.tx_id,
1435                0x3a37608b6851f75c,
1436                fidl::encoding::DynamicFlags::empty(),
1437            )
1438    }
1439}
1440
1441#[must_use = "FIDL methods require a response to be sent"]
1442#[derive(Debug)]
1443pub struct StateGetRouteTableNameResponder {
1444    control_handle: std::mem::ManuallyDrop<StateControlHandle>,
1445    tx_id: u32,
1446}
1447
1448/// Set the the channel to be shutdown (see [`StateControlHandle::shutdown`])
1449/// if the responder is dropped without sending a response, so that the client
1450/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1451impl std::ops::Drop for StateGetRouteTableNameResponder {
1452    fn drop(&mut self) {
1453        self.control_handle.shutdown();
1454        // Safety: drops once, never accessed again
1455        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1456    }
1457}
1458
1459impl fdomain_client::fidl::Responder for StateGetRouteTableNameResponder {
1460    type ControlHandle = StateControlHandle;
1461
1462    fn control_handle(&self) -> &StateControlHandle {
1463        &self.control_handle
1464    }
1465
1466    fn drop_without_shutdown(mut self) {
1467        // Safety: drops once, never accessed again due to mem::forget
1468        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1469        // Prevent Drop from running (which would shut down the channel)
1470        std::mem::forget(self);
1471    }
1472}
1473
1474impl StateGetRouteTableNameResponder {
1475    /// Sends a response to the FIDL transaction.
1476    ///
1477    /// Sets the channel to shutdown if an error occurs.
1478    pub fn send(
1479        self,
1480        mut result: Result<&str, StateGetRouteTableNameError>,
1481    ) -> Result<(), fidl::Error> {
1482        let _result = self.send_raw(result);
1483        if _result.is_err() {
1484            self.control_handle.shutdown();
1485        }
1486        self.drop_without_shutdown();
1487        _result
1488    }
1489
1490    /// Similar to "send" but does not shutdown the channel if an error occurs.
1491    pub fn send_no_shutdown_on_err(
1492        self,
1493        mut result: Result<&str, StateGetRouteTableNameError>,
1494    ) -> Result<(), fidl::Error> {
1495        let _result = self.send_raw(result);
1496        self.drop_without_shutdown();
1497        _result
1498    }
1499
1500    fn send_raw(
1501        &self,
1502        mut result: Result<&str, StateGetRouteTableNameError>,
1503    ) -> Result<(), fidl::Error> {
1504        self.control_handle.inner.send::<fidl::encoding::ResultType<
1505            StateGetRouteTableNameResponse,
1506            StateGetRouteTableNameError,
1507        >>(
1508            result.map(|table_name| (table_name,)),
1509            self.tx_id,
1510            0x6fed5423c7ce421a,
1511            fidl::encoding::DynamicFlags::empty(),
1512        )
1513    }
1514}
1515
1516#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1517pub struct StateV4Marker;
1518
1519impl fdomain_client::fidl::ProtocolMarker for StateV4Marker {
1520    type Proxy = StateV4Proxy;
1521    type RequestStream = StateV4RequestStream;
1522
1523    const DEBUG_NAME: &'static str = "fuchsia.net.routes.StateV4";
1524}
1525impl fdomain_client::fidl::DiscoverableProtocolMarker for StateV4Marker {}
1526
1527pub trait StateV4ProxyInterface: Send + Sync {
1528    fn r#get_watcher_v4(
1529        &self,
1530        watcher: fdomain_client::fidl::ServerEnd<WatcherV4Marker>,
1531        options: &WatcherOptionsV4,
1532    ) -> Result<(), fidl::Error>;
1533    fn r#get_rule_watcher_v4(
1534        &self,
1535        watcher: fdomain_client::fidl::ServerEnd<RuleWatcherV4Marker>,
1536        options: &RuleWatcherOptionsV4,
1537    ) -> Result<(), fidl::Error>;
1538}
1539
1540#[derive(Debug, Clone)]
1541pub struct StateV4Proxy {
1542    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
1543}
1544
1545impl fdomain_client::fidl::Proxy for StateV4Proxy {
1546    type Protocol = StateV4Marker;
1547
1548    fn from_channel(inner: fdomain_client::Channel) -> Self {
1549        Self::new(inner)
1550    }
1551
1552    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
1553        self.client.into_channel().map_err(|client| Self { client })
1554    }
1555
1556    fn as_channel(&self) -> &fdomain_client::Channel {
1557        self.client.as_channel()
1558    }
1559}
1560
1561impl StateV4Proxy {
1562    /// Create a new Proxy for fuchsia.net.routes/StateV4.
1563    pub fn new(channel: fdomain_client::Channel) -> Self {
1564        let protocol_name = <StateV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
1565        Self { client: fidl::client::Client::new(channel, protocol_name) }
1566    }
1567
1568    /// Get a Stream of events from the remote end of the protocol.
1569    ///
1570    /// # Panics
1571    ///
1572    /// Panics if the event stream was already taken.
1573    pub fn take_event_stream(&self) -> StateV4EventStream {
1574        StateV4EventStream { event_receiver: self.client.take_event_receiver() }
1575    }
1576
1577    /// Initialize a watcher for IPv4 routing state.
1578    ///
1579    /// + request 'watcher' grants access to the `WatcherV4` Protocol.
1580    /// + request `watch_options` specifies the behavior of the `WatcherV4`.
1581    pub fn r#get_watcher_v4(
1582        &self,
1583        mut watcher: fdomain_client::fidl::ServerEnd<WatcherV4Marker>,
1584        mut options: &WatcherOptionsV4,
1585    ) -> Result<(), fidl::Error> {
1586        StateV4ProxyInterface::r#get_watcher_v4(self, watcher, options)
1587    }
1588
1589    /// Initialize a watcher for IPv4 rules state.
1590    ///
1591    /// + request 'watcher' grants access to the `RuleWatcherV4` Protocol.
1592    /// + request `watch_options` specifies the behavior of the `RuleWatcherV4`.
1593    pub fn r#get_rule_watcher_v4(
1594        &self,
1595        mut watcher: fdomain_client::fidl::ServerEnd<RuleWatcherV4Marker>,
1596        mut options: &RuleWatcherOptionsV4,
1597    ) -> Result<(), fidl::Error> {
1598        StateV4ProxyInterface::r#get_rule_watcher_v4(self, watcher, options)
1599    }
1600}
1601
1602impl StateV4ProxyInterface for StateV4Proxy {
1603    fn r#get_watcher_v4(
1604        &self,
1605        mut watcher: fdomain_client::fidl::ServerEnd<WatcherV4Marker>,
1606        mut options: &WatcherOptionsV4,
1607    ) -> Result<(), fidl::Error> {
1608        self.client.send::<StateV4GetWatcherV4Request>(
1609            (watcher, options),
1610            0x30dcbe770492c20a,
1611            fidl::encoding::DynamicFlags::empty(),
1612        )
1613    }
1614
1615    fn r#get_rule_watcher_v4(
1616        &self,
1617        mut watcher: fdomain_client::fidl::ServerEnd<RuleWatcherV4Marker>,
1618        mut options: &RuleWatcherOptionsV4,
1619    ) -> Result<(), fidl::Error> {
1620        self.client.send::<StateV4GetRuleWatcherV4Request>(
1621            (watcher, options),
1622            0x2bbcc7012b5147a1,
1623            fidl::encoding::DynamicFlags::empty(),
1624        )
1625    }
1626}
1627
1628pub struct StateV4EventStream {
1629    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
1630}
1631
1632impl std::marker::Unpin for StateV4EventStream {}
1633
1634impl futures::stream::FusedStream for StateV4EventStream {
1635    fn is_terminated(&self) -> bool {
1636        self.event_receiver.is_terminated()
1637    }
1638}
1639
1640impl futures::Stream for StateV4EventStream {
1641    type Item = Result<StateV4Event, fidl::Error>;
1642
1643    fn poll_next(
1644        mut self: std::pin::Pin<&mut Self>,
1645        cx: &mut std::task::Context<'_>,
1646    ) -> std::task::Poll<Option<Self::Item>> {
1647        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1648            &mut self.event_receiver,
1649            cx
1650        )?) {
1651            Some(buf) => std::task::Poll::Ready(Some(StateV4Event::decode(buf))),
1652            None => std::task::Poll::Ready(None),
1653        }
1654    }
1655}
1656
1657#[derive(Debug)]
1658pub enum StateV4Event {}
1659
1660impl StateV4Event {
1661    /// Decodes a message buffer as a [`StateV4Event`].
1662    fn decode(
1663        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1664    ) -> Result<StateV4Event, fidl::Error> {
1665        let (bytes, _handles) = buf.split_mut();
1666        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1667        debug_assert_eq!(tx_header.tx_id, 0);
1668        match tx_header.ordinal {
1669            _ => Err(fidl::Error::UnknownOrdinal {
1670                ordinal: tx_header.ordinal,
1671                protocol_name: <StateV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1672            }),
1673        }
1674    }
1675}
1676
1677/// A Stream of incoming requests for fuchsia.net.routes/StateV4.
1678pub struct StateV4RequestStream {
1679    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1680    is_terminated: bool,
1681}
1682
1683impl std::marker::Unpin for StateV4RequestStream {}
1684
1685impl futures::stream::FusedStream for StateV4RequestStream {
1686    fn is_terminated(&self) -> bool {
1687        self.is_terminated
1688    }
1689}
1690
1691impl fdomain_client::fidl::RequestStream for StateV4RequestStream {
1692    type Protocol = StateV4Marker;
1693    type ControlHandle = StateV4ControlHandle;
1694
1695    fn from_channel(channel: fdomain_client::Channel) -> Self {
1696        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1697    }
1698
1699    fn control_handle(&self) -> Self::ControlHandle {
1700        StateV4ControlHandle { inner: self.inner.clone() }
1701    }
1702
1703    fn into_inner(
1704        self,
1705    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1706    {
1707        (self.inner, self.is_terminated)
1708    }
1709
1710    fn from_inner(
1711        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1712        is_terminated: bool,
1713    ) -> Self {
1714        Self { inner, is_terminated }
1715    }
1716}
1717
1718impl futures::Stream for StateV4RequestStream {
1719    type Item = Result<StateV4Request, fidl::Error>;
1720
1721    fn poll_next(
1722        mut self: std::pin::Pin<&mut Self>,
1723        cx: &mut std::task::Context<'_>,
1724    ) -> std::task::Poll<Option<Self::Item>> {
1725        let this = &mut *self;
1726        if this.inner.check_shutdown(cx) {
1727            this.is_terminated = true;
1728            return std::task::Poll::Ready(None);
1729        }
1730        if this.is_terminated {
1731            panic!("polled StateV4RequestStream after completion");
1732        }
1733        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1734            |bytes, handles| {
1735                match this.inner.channel().read_etc(cx, bytes, handles) {
1736                    std::task::Poll::Ready(Ok(())) => {}
1737                    std::task::Poll::Pending => return std::task::Poll::Pending,
1738                    std::task::Poll::Ready(Err(None)) => {
1739                        this.is_terminated = true;
1740                        return std::task::Poll::Ready(None);
1741                    }
1742                    std::task::Poll::Ready(Err(Some(e))) => {
1743                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1744                            e.into(),
1745                        ))));
1746                    }
1747                }
1748
1749                // A message has been received from the channel
1750                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1751
1752                std::task::Poll::Ready(Some(match header.ordinal {
1753                    0x30dcbe770492c20a => {
1754                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1755                        let mut req = fidl::new_empty!(
1756                            StateV4GetWatcherV4Request,
1757                            fdomain_client::fidl::FDomainResourceDialect
1758                        );
1759                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<StateV4GetWatcherV4Request>(&header, _body_bytes, handles, &mut req)?;
1760                        let control_handle = StateV4ControlHandle { inner: this.inner.clone() };
1761                        Ok(StateV4Request::GetWatcherV4 {
1762                            watcher: req.watcher,
1763                            options: req.options,
1764
1765                            control_handle,
1766                        })
1767                    }
1768                    0x2bbcc7012b5147a1 => {
1769                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1770                        let mut req = fidl::new_empty!(
1771                            StateV4GetRuleWatcherV4Request,
1772                            fdomain_client::fidl::FDomainResourceDialect
1773                        );
1774                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<StateV4GetRuleWatcherV4Request>(&header, _body_bytes, handles, &mut req)?;
1775                        let control_handle = StateV4ControlHandle { inner: this.inner.clone() };
1776                        Ok(StateV4Request::GetRuleWatcherV4 {
1777                            watcher: req.watcher,
1778                            options: req.options,
1779
1780                            control_handle,
1781                        })
1782                    }
1783                    _ => Err(fidl::Error::UnknownOrdinal {
1784                        ordinal: header.ordinal,
1785                        protocol_name:
1786                            <StateV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1787                    }),
1788                }))
1789            },
1790        )
1791    }
1792}
1793
1794/// Provides observability to the system's IPv4 routing state.
1795#[derive(Debug)]
1796pub enum StateV4Request {
1797    /// Initialize a watcher for IPv4 routing state.
1798    ///
1799    /// + request 'watcher' grants access to the `WatcherV4` Protocol.
1800    /// + request `watch_options` specifies the behavior of the `WatcherV4`.
1801    GetWatcherV4 {
1802        watcher: fdomain_client::fidl::ServerEnd<WatcherV4Marker>,
1803        options: WatcherOptionsV4,
1804        control_handle: StateV4ControlHandle,
1805    },
1806    /// Initialize a watcher for IPv4 rules state.
1807    ///
1808    /// + request 'watcher' grants access to the `RuleWatcherV4` Protocol.
1809    /// + request `watch_options` specifies the behavior of the `RuleWatcherV4`.
1810    GetRuleWatcherV4 {
1811        watcher: fdomain_client::fidl::ServerEnd<RuleWatcherV4Marker>,
1812        options: RuleWatcherOptionsV4,
1813        control_handle: StateV4ControlHandle,
1814    },
1815}
1816
1817impl StateV4Request {
1818    #[allow(irrefutable_let_patterns)]
1819    pub fn into_get_watcher_v4(
1820        self,
1821    ) -> Option<(
1822        fdomain_client::fidl::ServerEnd<WatcherV4Marker>,
1823        WatcherOptionsV4,
1824        StateV4ControlHandle,
1825    )> {
1826        if let StateV4Request::GetWatcherV4 { watcher, options, control_handle } = self {
1827            Some((watcher, options, control_handle))
1828        } else {
1829            None
1830        }
1831    }
1832
1833    #[allow(irrefutable_let_patterns)]
1834    pub fn into_get_rule_watcher_v4(
1835        self,
1836    ) -> Option<(
1837        fdomain_client::fidl::ServerEnd<RuleWatcherV4Marker>,
1838        RuleWatcherOptionsV4,
1839        StateV4ControlHandle,
1840    )> {
1841        if let StateV4Request::GetRuleWatcherV4 { watcher, options, control_handle } = self {
1842            Some((watcher, options, control_handle))
1843        } else {
1844            None
1845        }
1846    }
1847
1848    /// Name of the method defined in FIDL
1849    pub fn method_name(&self) -> &'static str {
1850        match *self {
1851            StateV4Request::GetWatcherV4 { .. } => "get_watcher_v4",
1852            StateV4Request::GetRuleWatcherV4 { .. } => "get_rule_watcher_v4",
1853        }
1854    }
1855}
1856
1857#[derive(Debug, Clone)]
1858pub struct StateV4ControlHandle {
1859    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1860}
1861
1862impl StateV4ControlHandle {
1863    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1864        self.inner.shutdown_with_epitaph(status.into())
1865    }
1866}
1867
1868impl fdomain_client::fidl::ControlHandle for StateV4ControlHandle {
1869    fn shutdown(&self) {
1870        self.inner.shutdown()
1871    }
1872
1873    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1874        self.inner.shutdown_with_epitaph(status)
1875    }
1876
1877    fn is_closed(&self) -> bool {
1878        self.inner.channel().is_closed()
1879    }
1880    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1881        self.inner.channel().on_closed()
1882    }
1883}
1884
1885impl StateV4ControlHandle {}
1886
1887#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1888pub struct StateV6Marker;
1889
1890impl fdomain_client::fidl::ProtocolMarker for StateV6Marker {
1891    type Proxy = StateV6Proxy;
1892    type RequestStream = StateV6RequestStream;
1893
1894    const DEBUG_NAME: &'static str = "fuchsia.net.routes.StateV6";
1895}
1896impl fdomain_client::fidl::DiscoverableProtocolMarker for StateV6Marker {}
1897
1898pub trait StateV6ProxyInterface: Send + Sync {
1899    fn r#get_watcher_v6(
1900        &self,
1901        watcher: fdomain_client::fidl::ServerEnd<WatcherV6Marker>,
1902        options: &WatcherOptionsV6,
1903    ) -> Result<(), fidl::Error>;
1904    fn r#get_rule_watcher_v6(
1905        &self,
1906        watcher: fdomain_client::fidl::ServerEnd<RuleWatcherV6Marker>,
1907        options: &RuleWatcherOptionsV6,
1908    ) -> Result<(), fidl::Error>;
1909}
1910
1911#[derive(Debug, Clone)]
1912pub struct StateV6Proxy {
1913    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
1914}
1915
1916impl fdomain_client::fidl::Proxy for StateV6Proxy {
1917    type Protocol = StateV6Marker;
1918
1919    fn from_channel(inner: fdomain_client::Channel) -> Self {
1920        Self::new(inner)
1921    }
1922
1923    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
1924        self.client.into_channel().map_err(|client| Self { client })
1925    }
1926
1927    fn as_channel(&self) -> &fdomain_client::Channel {
1928        self.client.as_channel()
1929    }
1930}
1931
1932impl StateV6Proxy {
1933    /// Create a new Proxy for fuchsia.net.routes/StateV6.
1934    pub fn new(channel: fdomain_client::Channel) -> Self {
1935        let protocol_name = <StateV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
1936        Self { client: fidl::client::Client::new(channel, protocol_name) }
1937    }
1938
1939    /// Get a Stream of events from the remote end of the protocol.
1940    ///
1941    /// # Panics
1942    ///
1943    /// Panics if the event stream was already taken.
1944    pub fn take_event_stream(&self) -> StateV6EventStream {
1945        StateV6EventStream { event_receiver: self.client.take_event_receiver() }
1946    }
1947
1948    /// Initialize a watcher for IPv6 routing state.
1949    ///
1950    /// + request 'watcher' grants access to the `WatcherV6` Protocol.
1951    /// + request `watch_options` specifies the behavior of the `WatcherV6`.
1952    pub fn r#get_watcher_v6(
1953        &self,
1954        mut watcher: fdomain_client::fidl::ServerEnd<WatcherV6Marker>,
1955        mut options: &WatcherOptionsV6,
1956    ) -> Result<(), fidl::Error> {
1957        StateV6ProxyInterface::r#get_watcher_v6(self, watcher, options)
1958    }
1959
1960    /// Initialize a watcher for IPv6 rules state.
1961    ///
1962    /// + request 'watcher' grants access to the `RuleWatcherV6` Protocol.
1963    /// + request `watch_options` specifies the behavior of the `RuleWatcherV6`.
1964    pub fn r#get_rule_watcher_v6(
1965        &self,
1966        mut watcher: fdomain_client::fidl::ServerEnd<RuleWatcherV6Marker>,
1967        mut options: &RuleWatcherOptionsV6,
1968    ) -> Result<(), fidl::Error> {
1969        StateV6ProxyInterface::r#get_rule_watcher_v6(self, watcher, options)
1970    }
1971}
1972
1973impl StateV6ProxyInterface for StateV6Proxy {
1974    fn r#get_watcher_v6(
1975        &self,
1976        mut watcher: fdomain_client::fidl::ServerEnd<WatcherV6Marker>,
1977        mut options: &WatcherOptionsV6,
1978    ) -> Result<(), fidl::Error> {
1979        self.client.send::<StateV6GetWatcherV6Request>(
1980            (watcher, options),
1981            0x777e3c40c98f586,
1982            fidl::encoding::DynamicFlags::empty(),
1983        )
1984    }
1985
1986    fn r#get_rule_watcher_v6(
1987        &self,
1988        mut watcher: fdomain_client::fidl::ServerEnd<RuleWatcherV6Marker>,
1989        mut options: &RuleWatcherOptionsV6,
1990    ) -> Result<(), fidl::Error> {
1991        self.client.send::<StateV6GetRuleWatcherV6Request>(
1992            (watcher, options),
1993            0x91433a23d464f6,
1994            fidl::encoding::DynamicFlags::empty(),
1995        )
1996    }
1997}
1998
1999pub struct StateV6EventStream {
2000    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
2001}
2002
2003impl std::marker::Unpin for StateV6EventStream {}
2004
2005impl futures::stream::FusedStream for StateV6EventStream {
2006    fn is_terminated(&self) -> bool {
2007        self.event_receiver.is_terminated()
2008    }
2009}
2010
2011impl futures::Stream for StateV6EventStream {
2012    type Item = Result<StateV6Event, fidl::Error>;
2013
2014    fn poll_next(
2015        mut self: std::pin::Pin<&mut Self>,
2016        cx: &mut std::task::Context<'_>,
2017    ) -> std::task::Poll<Option<Self::Item>> {
2018        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2019            &mut self.event_receiver,
2020            cx
2021        )?) {
2022            Some(buf) => std::task::Poll::Ready(Some(StateV6Event::decode(buf))),
2023            None => std::task::Poll::Ready(None),
2024        }
2025    }
2026}
2027
2028#[derive(Debug)]
2029pub enum StateV6Event {}
2030
2031impl StateV6Event {
2032    /// Decodes a message buffer as a [`StateV6Event`].
2033    fn decode(
2034        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2035    ) -> Result<StateV6Event, fidl::Error> {
2036        let (bytes, _handles) = buf.split_mut();
2037        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2038        debug_assert_eq!(tx_header.tx_id, 0);
2039        match tx_header.ordinal {
2040            _ => Err(fidl::Error::UnknownOrdinal {
2041                ordinal: tx_header.ordinal,
2042                protocol_name: <StateV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2043            }),
2044        }
2045    }
2046}
2047
2048/// A Stream of incoming requests for fuchsia.net.routes/StateV6.
2049pub struct StateV6RequestStream {
2050    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2051    is_terminated: bool,
2052}
2053
2054impl std::marker::Unpin for StateV6RequestStream {}
2055
2056impl futures::stream::FusedStream for StateV6RequestStream {
2057    fn is_terminated(&self) -> bool {
2058        self.is_terminated
2059    }
2060}
2061
2062impl fdomain_client::fidl::RequestStream for StateV6RequestStream {
2063    type Protocol = StateV6Marker;
2064    type ControlHandle = StateV6ControlHandle;
2065
2066    fn from_channel(channel: fdomain_client::Channel) -> Self {
2067        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2068    }
2069
2070    fn control_handle(&self) -> Self::ControlHandle {
2071        StateV6ControlHandle { inner: self.inner.clone() }
2072    }
2073
2074    fn into_inner(
2075        self,
2076    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
2077    {
2078        (self.inner, self.is_terminated)
2079    }
2080
2081    fn from_inner(
2082        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2083        is_terminated: bool,
2084    ) -> Self {
2085        Self { inner, is_terminated }
2086    }
2087}
2088
2089impl futures::Stream for StateV6RequestStream {
2090    type Item = Result<StateV6Request, fidl::Error>;
2091
2092    fn poll_next(
2093        mut self: std::pin::Pin<&mut Self>,
2094        cx: &mut std::task::Context<'_>,
2095    ) -> std::task::Poll<Option<Self::Item>> {
2096        let this = &mut *self;
2097        if this.inner.check_shutdown(cx) {
2098            this.is_terminated = true;
2099            return std::task::Poll::Ready(None);
2100        }
2101        if this.is_terminated {
2102            panic!("polled StateV6RequestStream after completion");
2103        }
2104        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
2105            |bytes, handles| {
2106                match this.inner.channel().read_etc(cx, bytes, handles) {
2107                    std::task::Poll::Ready(Ok(())) => {}
2108                    std::task::Poll::Pending => return std::task::Poll::Pending,
2109                    std::task::Poll::Ready(Err(None)) => {
2110                        this.is_terminated = true;
2111                        return std::task::Poll::Ready(None);
2112                    }
2113                    std::task::Poll::Ready(Err(Some(e))) => {
2114                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2115                            e.into(),
2116                        ))));
2117                    }
2118                }
2119
2120                // A message has been received from the channel
2121                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2122
2123                std::task::Poll::Ready(Some(match header.ordinal {
2124                    0x777e3c40c98f586 => {
2125                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2126                        let mut req = fidl::new_empty!(
2127                            StateV6GetWatcherV6Request,
2128                            fdomain_client::fidl::FDomainResourceDialect
2129                        );
2130                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<StateV6GetWatcherV6Request>(&header, _body_bytes, handles, &mut req)?;
2131                        let control_handle = StateV6ControlHandle { inner: this.inner.clone() };
2132                        Ok(StateV6Request::GetWatcherV6 {
2133                            watcher: req.watcher,
2134                            options: req.options,
2135
2136                            control_handle,
2137                        })
2138                    }
2139                    0x91433a23d464f6 => {
2140                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2141                        let mut req = fidl::new_empty!(
2142                            StateV6GetRuleWatcherV6Request,
2143                            fdomain_client::fidl::FDomainResourceDialect
2144                        );
2145                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<StateV6GetRuleWatcherV6Request>(&header, _body_bytes, handles, &mut req)?;
2146                        let control_handle = StateV6ControlHandle { inner: this.inner.clone() };
2147                        Ok(StateV6Request::GetRuleWatcherV6 {
2148                            watcher: req.watcher,
2149                            options: req.options,
2150
2151                            control_handle,
2152                        })
2153                    }
2154                    _ => Err(fidl::Error::UnknownOrdinal {
2155                        ordinal: header.ordinal,
2156                        protocol_name:
2157                            <StateV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2158                    }),
2159                }))
2160            },
2161        )
2162    }
2163}
2164
2165/// Provides observability to the system's IPv6 routing state.
2166#[derive(Debug)]
2167pub enum StateV6Request {
2168    /// Initialize a watcher for IPv6 routing state.
2169    ///
2170    /// + request 'watcher' grants access to the `WatcherV6` Protocol.
2171    /// + request `watch_options` specifies the behavior of the `WatcherV6`.
2172    GetWatcherV6 {
2173        watcher: fdomain_client::fidl::ServerEnd<WatcherV6Marker>,
2174        options: WatcherOptionsV6,
2175        control_handle: StateV6ControlHandle,
2176    },
2177    /// Initialize a watcher for IPv6 rules state.
2178    ///
2179    /// + request 'watcher' grants access to the `RuleWatcherV6` Protocol.
2180    /// + request `watch_options` specifies the behavior of the `RuleWatcherV6`.
2181    GetRuleWatcherV6 {
2182        watcher: fdomain_client::fidl::ServerEnd<RuleWatcherV6Marker>,
2183        options: RuleWatcherOptionsV6,
2184        control_handle: StateV6ControlHandle,
2185    },
2186}
2187
2188impl StateV6Request {
2189    #[allow(irrefutable_let_patterns)]
2190    pub fn into_get_watcher_v6(
2191        self,
2192    ) -> Option<(
2193        fdomain_client::fidl::ServerEnd<WatcherV6Marker>,
2194        WatcherOptionsV6,
2195        StateV6ControlHandle,
2196    )> {
2197        if let StateV6Request::GetWatcherV6 { watcher, options, control_handle } = self {
2198            Some((watcher, options, control_handle))
2199        } else {
2200            None
2201        }
2202    }
2203
2204    #[allow(irrefutable_let_patterns)]
2205    pub fn into_get_rule_watcher_v6(
2206        self,
2207    ) -> Option<(
2208        fdomain_client::fidl::ServerEnd<RuleWatcherV6Marker>,
2209        RuleWatcherOptionsV6,
2210        StateV6ControlHandle,
2211    )> {
2212        if let StateV6Request::GetRuleWatcherV6 { watcher, options, control_handle } = self {
2213            Some((watcher, options, control_handle))
2214        } else {
2215            None
2216        }
2217    }
2218
2219    /// Name of the method defined in FIDL
2220    pub fn method_name(&self) -> &'static str {
2221        match *self {
2222            StateV6Request::GetWatcherV6 { .. } => "get_watcher_v6",
2223            StateV6Request::GetRuleWatcherV6 { .. } => "get_rule_watcher_v6",
2224        }
2225    }
2226}
2227
2228#[derive(Debug, Clone)]
2229pub struct StateV6ControlHandle {
2230    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2231}
2232
2233impl StateV6ControlHandle {
2234    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2235        self.inner.shutdown_with_epitaph(status.into())
2236    }
2237}
2238
2239impl fdomain_client::fidl::ControlHandle for StateV6ControlHandle {
2240    fn shutdown(&self) {
2241        self.inner.shutdown()
2242    }
2243
2244    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2245        self.inner.shutdown_with_epitaph(status)
2246    }
2247
2248    fn is_closed(&self) -> bool {
2249        self.inner.channel().is_closed()
2250    }
2251    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
2252        self.inner.channel().on_closed()
2253    }
2254}
2255
2256impl StateV6ControlHandle {}
2257
2258#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2259pub struct WatcherV4Marker;
2260
2261impl fdomain_client::fidl::ProtocolMarker for WatcherV4Marker {
2262    type Proxy = WatcherV4Proxy;
2263    type RequestStream = WatcherV4RequestStream;
2264
2265    const DEBUG_NAME: &'static str = "(anonymous) WatcherV4";
2266}
2267
2268pub trait WatcherV4ProxyInterface: Send + Sync {
2269    type WatchResponseFut: std::future::Future<Output = Result<Vec<EventV4>, fidl::Error>> + Send;
2270    fn r#watch(&self) -> Self::WatchResponseFut;
2271}
2272
2273#[derive(Debug, Clone)]
2274pub struct WatcherV4Proxy {
2275    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
2276}
2277
2278impl fdomain_client::fidl::Proxy for WatcherV4Proxy {
2279    type Protocol = WatcherV4Marker;
2280
2281    fn from_channel(inner: fdomain_client::Channel) -> Self {
2282        Self::new(inner)
2283    }
2284
2285    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
2286        self.client.into_channel().map_err(|client| Self { client })
2287    }
2288
2289    fn as_channel(&self) -> &fdomain_client::Channel {
2290        self.client.as_channel()
2291    }
2292}
2293
2294impl WatcherV4Proxy {
2295    /// Create a new Proxy for fuchsia.net.routes/WatcherV4.
2296    pub fn new(channel: fdomain_client::Channel) -> Self {
2297        let protocol_name = <WatcherV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
2298        Self { client: fidl::client::Client::new(channel, protocol_name) }
2299    }
2300
2301    /// Get a Stream of events from the remote end of the protocol.
2302    ///
2303    /// # Panics
2304    ///
2305    /// Panics if the event stream was already taken.
2306    pub fn take_event_stream(&self) -> WatcherV4EventStream {
2307        WatcherV4EventStream { event_receiver: self.client.take_event_receiver() }
2308    }
2309
2310    /// Hanging-Get style API for observing routing changes.
2311    ///
2312    /// Clients must only have one pending `Watch` call at a time. Calling
2313    /// `Watch` while a request is already pending will cause the protocol to
2314    /// close.
2315    ///
2316    /// The first N events will always be `existing` where N is the number of
2317    /// IPv4 routes that already existed when the server-end of the protocol was
2318    /// initialized. The following event will be `idle` signaling the end of the
2319    /// `existing` events. At this point the client has watched all existing
2320    /// state and will never again observe an `existing` event.
2321    ///
2322    /// Events are returned in batches of up to `MAX_EVENTS` events. There is no
2323    /// correlation between the batch size/boundary and it's contents: it is
2324    /// perfectly valid for the server to split the block of `existing` events,
2325    /// across several batches. Clients should view this API as providing a
2326    /// stream of events, where batches are used to reduce IPC load on the
2327    /// system.
2328    ///
2329    /// - response `events` A vector of at most `MAX_EVENTS` events.
2330    pub fn r#watch(
2331        &self,
2332    ) -> fidl::client::QueryResponseFut<Vec<EventV4>, fdomain_client::fidl::FDomainResourceDialect>
2333    {
2334        WatcherV4ProxyInterface::r#watch(self)
2335    }
2336}
2337
2338impl WatcherV4ProxyInterface for WatcherV4Proxy {
2339    type WatchResponseFut =
2340        fidl::client::QueryResponseFut<Vec<EventV4>, fdomain_client::fidl::FDomainResourceDialect>;
2341    fn r#watch(&self) -> Self::WatchResponseFut {
2342        fn _decode(
2343            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2344        ) -> Result<Vec<EventV4>, fidl::Error> {
2345            let _response = fidl::client::decode_transaction_body::<
2346                WatcherV4WatchResponse,
2347                fdomain_client::fidl::FDomainResourceDialect,
2348                0x71f2fdee0b307ac2,
2349            >(_buf?)?;
2350            Ok(_response.events)
2351        }
2352        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<EventV4>>(
2353            (),
2354            0x71f2fdee0b307ac2,
2355            fidl::encoding::DynamicFlags::empty(),
2356            _decode,
2357        )
2358    }
2359}
2360
2361pub struct WatcherV4EventStream {
2362    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
2363}
2364
2365impl std::marker::Unpin for WatcherV4EventStream {}
2366
2367impl futures::stream::FusedStream for WatcherV4EventStream {
2368    fn is_terminated(&self) -> bool {
2369        self.event_receiver.is_terminated()
2370    }
2371}
2372
2373impl futures::Stream for WatcherV4EventStream {
2374    type Item = Result<WatcherV4Event, fidl::Error>;
2375
2376    fn poll_next(
2377        mut self: std::pin::Pin<&mut Self>,
2378        cx: &mut std::task::Context<'_>,
2379    ) -> std::task::Poll<Option<Self::Item>> {
2380        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2381            &mut self.event_receiver,
2382            cx
2383        )?) {
2384            Some(buf) => std::task::Poll::Ready(Some(WatcherV4Event::decode(buf))),
2385            None => std::task::Poll::Ready(None),
2386        }
2387    }
2388}
2389
2390#[derive(Debug)]
2391pub enum WatcherV4Event {}
2392
2393impl WatcherV4Event {
2394    /// Decodes a message buffer as a [`WatcherV4Event`].
2395    fn decode(
2396        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2397    ) -> Result<WatcherV4Event, fidl::Error> {
2398        let (bytes, _handles) = buf.split_mut();
2399        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2400        debug_assert_eq!(tx_header.tx_id, 0);
2401        match tx_header.ordinal {
2402            _ => Err(fidl::Error::UnknownOrdinal {
2403                ordinal: tx_header.ordinal,
2404                protocol_name:
2405                    <WatcherV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2406            }),
2407        }
2408    }
2409}
2410
2411/// A Stream of incoming requests for fuchsia.net.routes/WatcherV4.
2412pub struct WatcherV4RequestStream {
2413    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2414    is_terminated: bool,
2415}
2416
2417impl std::marker::Unpin for WatcherV4RequestStream {}
2418
2419impl futures::stream::FusedStream for WatcherV4RequestStream {
2420    fn is_terminated(&self) -> bool {
2421        self.is_terminated
2422    }
2423}
2424
2425impl fdomain_client::fidl::RequestStream for WatcherV4RequestStream {
2426    type Protocol = WatcherV4Marker;
2427    type ControlHandle = WatcherV4ControlHandle;
2428
2429    fn from_channel(channel: fdomain_client::Channel) -> Self {
2430        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2431    }
2432
2433    fn control_handle(&self) -> Self::ControlHandle {
2434        WatcherV4ControlHandle { inner: self.inner.clone() }
2435    }
2436
2437    fn into_inner(
2438        self,
2439    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
2440    {
2441        (self.inner, self.is_terminated)
2442    }
2443
2444    fn from_inner(
2445        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2446        is_terminated: bool,
2447    ) -> Self {
2448        Self { inner, is_terminated }
2449    }
2450}
2451
2452impl futures::Stream for WatcherV4RequestStream {
2453    type Item = Result<WatcherV4Request, fidl::Error>;
2454
2455    fn poll_next(
2456        mut self: std::pin::Pin<&mut Self>,
2457        cx: &mut std::task::Context<'_>,
2458    ) -> std::task::Poll<Option<Self::Item>> {
2459        let this = &mut *self;
2460        if this.inner.check_shutdown(cx) {
2461            this.is_terminated = true;
2462            return std::task::Poll::Ready(None);
2463        }
2464        if this.is_terminated {
2465            panic!("polled WatcherV4RequestStream after completion");
2466        }
2467        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
2468            |bytes, handles| {
2469                match this.inner.channel().read_etc(cx, bytes, handles) {
2470                    std::task::Poll::Ready(Ok(())) => {}
2471                    std::task::Poll::Pending => return std::task::Poll::Pending,
2472                    std::task::Poll::Ready(Err(None)) => {
2473                        this.is_terminated = true;
2474                        return std::task::Poll::Ready(None);
2475                    }
2476                    std::task::Poll::Ready(Err(Some(e))) => {
2477                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2478                            e.into(),
2479                        ))));
2480                    }
2481                }
2482
2483                // A message has been received from the channel
2484                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2485
2486                std::task::Poll::Ready(Some(match header.ordinal {
2487                    0x71f2fdee0b307ac2 => {
2488                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2489                        let mut req = fidl::new_empty!(
2490                            fidl::encoding::EmptyPayload,
2491                            fdomain_client::fidl::FDomainResourceDialect
2492                        );
2493                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2494                        let control_handle = WatcherV4ControlHandle { inner: this.inner.clone() };
2495                        Ok(WatcherV4Request::Watch {
2496                            responder: WatcherV4WatchResponder {
2497                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2498                                tx_id: header.tx_id,
2499                            },
2500                        })
2501                    }
2502                    _ => Err(fidl::Error::UnknownOrdinal {
2503                        ordinal: header.ordinal,
2504                        protocol_name:
2505                            <WatcherV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2506                    }),
2507                }))
2508            },
2509        )
2510    }
2511}
2512
2513/// An observer protocol for changes in system's IPv4 routing state.
2514#[derive(Debug)]
2515pub enum WatcherV4Request {
2516    /// Hanging-Get style API for observing routing changes.
2517    ///
2518    /// Clients must only have one pending `Watch` call at a time. Calling
2519    /// `Watch` while a request is already pending will cause the protocol to
2520    /// close.
2521    ///
2522    /// The first N events will always be `existing` where N is the number of
2523    /// IPv4 routes that already existed when the server-end of the protocol was
2524    /// initialized. The following event will be `idle` signaling the end of the
2525    /// `existing` events. At this point the client has watched all existing
2526    /// state and will never again observe an `existing` event.
2527    ///
2528    /// Events are returned in batches of up to `MAX_EVENTS` events. There is no
2529    /// correlation between the batch size/boundary and it's contents: it is
2530    /// perfectly valid for the server to split the block of `existing` events,
2531    /// across several batches. Clients should view this API as providing a
2532    /// stream of events, where batches are used to reduce IPC load on the
2533    /// system.
2534    ///
2535    /// - response `events` A vector of at most `MAX_EVENTS` events.
2536    Watch { responder: WatcherV4WatchResponder },
2537}
2538
2539impl WatcherV4Request {
2540    #[allow(irrefutable_let_patterns)]
2541    pub fn into_watch(self) -> Option<(WatcherV4WatchResponder)> {
2542        if let WatcherV4Request::Watch { responder } = self { Some((responder)) } else { None }
2543    }
2544
2545    /// Name of the method defined in FIDL
2546    pub fn method_name(&self) -> &'static str {
2547        match *self {
2548            WatcherV4Request::Watch { .. } => "watch",
2549        }
2550    }
2551}
2552
2553#[derive(Debug, Clone)]
2554pub struct WatcherV4ControlHandle {
2555    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2556}
2557
2558impl WatcherV4ControlHandle {
2559    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2560        self.inner.shutdown_with_epitaph(status.into())
2561    }
2562}
2563
2564impl fdomain_client::fidl::ControlHandle for WatcherV4ControlHandle {
2565    fn shutdown(&self) {
2566        self.inner.shutdown()
2567    }
2568
2569    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2570        self.inner.shutdown_with_epitaph(status)
2571    }
2572
2573    fn is_closed(&self) -> bool {
2574        self.inner.channel().is_closed()
2575    }
2576    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
2577        self.inner.channel().on_closed()
2578    }
2579}
2580
2581impl WatcherV4ControlHandle {}
2582
2583#[must_use = "FIDL methods require a response to be sent"]
2584#[derive(Debug)]
2585pub struct WatcherV4WatchResponder {
2586    control_handle: std::mem::ManuallyDrop<WatcherV4ControlHandle>,
2587    tx_id: u32,
2588}
2589
2590/// Set the the channel to be shutdown (see [`WatcherV4ControlHandle::shutdown`])
2591/// if the responder is dropped without sending a response, so that the client
2592/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2593impl std::ops::Drop for WatcherV4WatchResponder {
2594    fn drop(&mut self) {
2595        self.control_handle.shutdown();
2596        // Safety: drops once, never accessed again
2597        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2598    }
2599}
2600
2601impl fdomain_client::fidl::Responder for WatcherV4WatchResponder {
2602    type ControlHandle = WatcherV4ControlHandle;
2603
2604    fn control_handle(&self) -> &WatcherV4ControlHandle {
2605        &self.control_handle
2606    }
2607
2608    fn drop_without_shutdown(mut self) {
2609        // Safety: drops once, never accessed again due to mem::forget
2610        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2611        // Prevent Drop from running (which would shut down the channel)
2612        std::mem::forget(self);
2613    }
2614}
2615
2616impl WatcherV4WatchResponder {
2617    /// Sends a response to the FIDL transaction.
2618    ///
2619    /// Sets the channel to shutdown if an error occurs.
2620    pub fn send(self, mut events: &[EventV4]) -> Result<(), fidl::Error> {
2621        let _result = self.send_raw(events);
2622        if _result.is_err() {
2623            self.control_handle.shutdown();
2624        }
2625        self.drop_without_shutdown();
2626        _result
2627    }
2628
2629    /// Similar to "send" but does not shutdown the channel if an error occurs.
2630    pub fn send_no_shutdown_on_err(self, mut events: &[EventV4]) -> Result<(), fidl::Error> {
2631        let _result = self.send_raw(events);
2632        self.drop_without_shutdown();
2633        _result
2634    }
2635
2636    fn send_raw(&self, mut events: &[EventV4]) -> Result<(), fidl::Error> {
2637        self.control_handle.inner.send::<WatcherV4WatchResponse>(
2638            (events,),
2639            self.tx_id,
2640            0x71f2fdee0b307ac2,
2641            fidl::encoding::DynamicFlags::empty(),
2642        )
2643    }
2644}
2645
2646#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2647pub struct WatcherV6Marker;
2648
2649impl fdomain_client::fidl::ProtocolMarker for WatcherV6Marker {
2650    type Proxy = WatcherV6Proxy;
2651    type RequestStream = WatcherV6RequestStream;
2652
2653    const DEBUG_NAME: &'static str = "(anonymous) WatcherV6";
2654}
2655
2656pub trait WatcherV6ProxyInterface: Send + Sync {
2657    type WatchResponseFut: std::future::Future<Output = Result<Vec<EventV6>, fidl::Error>> + Send;
2658    fn r#watch(&self) -> Self::WatchResponseFut;
2659}
2660
2661#[derive(Debug, Clone)]
2662pub struct WatcherV6Proxy {
2663    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
2664}
2665
2666impl fdomain_client::fidl::Proxy for WatcherV6Proxy {
2667    type Protocol = WatcherV6Marker;
2668
2669    fn from_channel(inner: fdomain_client::Channel) -> Self {
2670        Self::new(inner)
2671    }
2672
2673    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
2674        self.client.into_channel().map_err(|client| Self { client })
2675    }
2676
2677    fn as_channel(&self) -> &fdomain_client::Channel {
2678        self.client.as_channel()
2679    }
2680}
2681
2682impl WatcherV6Proxy {
2683    /// Create a new Proxy for fuchsia.net.routes/WatcherV6.
2684    pub fn new(channel: fdomain_client::Channel) -> Self {
2685        let protocol_name = <WatcherV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
2686        Self { client: fidl::client::Client::new(channel, protocol_name) }
2687    }
2688
2689    /// Get a Stream of events from the remote end of the protocol.
2690    ///
2691    /// # Panics
2692    ///
2693    /// Panics if the event stream was already taken.
2694    pub fn take_event_stream(&self) -> WatcherV6EventStream {
2695        WatcherV6EventStream { event_receiver: self.client.take_event_receiver() }
2696    }
2697
2698    /// Hanging-Get style API for observing routing changes.
2699    ///
2700    /// Clients must only have one pending `Watch` call at a time. Calling
2701    /// `Watch` while a request is already pending will cause the protocol to
2702    /// close.
2703    ///
2704    /// The first N events will always be `existing` where N is the number of
2705    /// IPv6 routes that already existed when the server-end of the protocol was
2706    /// initialized. The following event will be `idle` signaling the end of the
2707    /// `existing` events. At this point the client has watched all existing
2708    /// state and will never again observe an `existing` event.
2709    ///
2710    /// Events are returned in batches of up to `MAX_EVENTS` events. There is no
2711    /// correlation between the batch size/boundary and it's contents: it is
2712    /// perfectly valid for the server to split the block of `existing` events,
2713    /// across several batches. Clients should view this API as providing a
2714    /// stream of events, where batches are used to reduce IPC load on the
2715    /// system.
2716    ///
2717    /// - response `events` A vector of at most `MAX_EVENTS` events.
2718    pub fn r#watch(
2719        &self,
2720    ) -> fidl::client::QueryResponseFut<Vec<EventV6>, fdomain_client::fidl::FDomainResourceDialect>
2721    {
2722        WatcherV6ProxyInterface::r#watch(self)
2723    }
2724}
2725
2726impl WatcherV6ProxyInterface for WatcherV6Proxy {
2727    type WatchResponseFut =
2728        fidl::client::QueryResponseFut<Vec<EventV6>, fdomain_client::fidl::FDomainResourceDialect>;
2729    fn r#watch(&self) -> Self::WatchResponseFut {
2730        fn _decode(
2731            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2732        ) -> Result<Vec<EventV6>, fidl::Error> {
2733            let _response = fidl::client::decode_transaction_body::<
2734                WatcherV6WatchResponse,
2735                fdomain_client::fidl::FDomainResourceDialect,
2736                0x82f5e48afc8811e,
2737            >(_buf?)?;
2738            Ok(_response.events)
2739        }
2740        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<EventV6>>(
2741            (),
2742            0x82f5e48afc8811e,
2743            fidl::encoding::DynamicFlags::empty(),
2744            _decode,
2745        )
2746    }
2747}
2748
2749pub struct WatcherV6EventStream {
2750    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
2751}
2752
2753impl std::marker::Unpin for WatcherV6EventStream {}
2754
2755impl futures::stream::FusedStream for WatcherV6EventStream {
2756    fn is_terminated(&self) -> bool {
2757        self.event_receiver.is_terminated()
2758    }
2759}
2760
2761impl futures::Stream for WatcherV6EventStream {
2762    type Item = Result<WatcherV6Event, fidl::Error>;
2763
2764    fn poll_next(
2765        mut self: std::pin::Pin<&mut Self>,
2766        cx: &mut std::task::Context<'_>,
2767    ) -> std::task::Poll<Option<Self::Item>> {
2768        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2769            &mut self.event_receiver,
2770            cx
2771        )?) {
2772            Some(buf) => std::task::Poll::Ready(Some(WatcherV6Event::decode(buf))),
2773            None => std::task::Poll::Ready(None),
2774        }
2775    }
2776}
2777
2778#[derive(Debug)]
2779pub enum WatcherV6Event {}
2780
2781impl WatcherV6Event {
2782    /// Decodes a message buffer as a [`WatcherV6Event`].
2783    fn decode(
2784        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2785    ) -> Result<WatcherV6Event, fidl::Error> {
2786        let (bytes, _handles) = buf.split_mut();
2787        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2788        debug_assert_eq!(tx_header.tx_id, 0);
2789        match tx_header.ordinal {
2790            _ => Err(fidl::Error::UnknownOrdinal {
2791                ordinal: tx_header.ordinal,
2792                protocol_name:
2793                    <WatcherV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2794            }),
2795        }
2796    }
2797}
2798
2799/// A Stream of incoming requests for fuchsia.net.routes/WatcherV6.
2800pub struct WatcherV6RequestStream {
2801    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2802    is_terminated: bool,
2803}
2804
2805impl std::marker::Unpin for WatcherV6RequestStream {}
2806
2807impl futures::stream::FusedStream for WatcherV6RequestStream {
2808    fn is_terminated(&self) -> bool {
2809        self.is_terminated
2810    }
2811}
2812
2813impl fdomain_client::fidl::RequestStream for WatcherV6RequestStream {
2814    type Protocol = WatcherV6Marker;
2815    type ControlHandle = WatcherV6ControlHandle;
2816
2817    fn from_channel(channel: fdomain_client::Channel) -> Self {
2818        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2819    }
2820
2821    fn control_handle(&self) -> Self::ControlHandle {
2822        WatcherV6ControlHandle { inner: self.inner.clone() }
2823    }
2824
2825    fn into_inner(
2826        self,
2827    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
2828    {
2829        (self.inner, self.is_terminated)
2830    }
2831
2832    fn from_inner(
2833        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2834        is_terminated: bool,
2835    ) -> Self {
2836        Self { inner, is_terminated }
2837    }
2838}
2839
2840impl futures::Stream for WatcherV6RequestStream {
2841    type Item = Result<WatcherV6Request, fidl::Error>;
2842
2843    fn poll_next(
2844        mut self: std::pin::Pin<&mut Self>,
2845        cx: &mut std::task::Context<'_>,
2846    ) -> std::task::Poll<Option<Self::Item>> {
2847        let this = &mut *self;
2848        if this.inner.check_shutdown(cx) {
2849            this.is_terminated = true;
2850            return std::task::Poll::Ready(None);
2851        }
2852        if this.is_terminated {
2853            panic!("polled WatcherV6RequestStream after completion");
2854        }
2855        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
2856            |bytes, handles| {
2857                match this.inner.channel().read_etc(cx, bytes, handles) {
2858                    std::task::Poll::Ready(Ok(())) => {}
2859                    std::task::Poll::Pending => return std::task::Poll::Pending,
2860                    std::task::Poll::Ready(Err(None)) => {
2861                        this.is_terminated = true;
2862                        return std::task::Poll::Ready(None);
2863                    }
2864                    std::task::Poll::Ready(Err(Some(e))) => {
2865                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2866                            e.into(),
2867                        ))));
2868                    }
2869                }
2870
2871                // A message has been received from the channel
2872                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2873
2874                std::task::Poll::Ready(Some(match header.ordinal {
2875                    0x82f5e48afc8811e => {
2876                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2877                        let mut req = fidl::new_empty!(
2878                            fidl::encoding::EmptyPayload,
2879                            fdomain_client::fidl::FDomainResourceDialect
2880                        );
2881                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2882                        let control_handle = WatcherV6ControlHandle { inner: this.inner.clone() };
2883                        Ok(WatcherV6Request::Watch {
2884                            responder: WatcherV6WatchResponder {
2885                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2886                                tx_id: header.tx_id,
2887                            },
2888                        })
2889                    }
2890                    _ => Err(fidl::Error::UnknownOrdinal {
2891                        ordinal: header.ordinal,
2892                        protocol_name:
2893                            <WatcherV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2894                    }),
2895                }))
2896            },
2897        )
2898    }
2899}
2900
2901/// An observer protocol for changes in system's IPv6 routing state.
2902#[derive(Debug)]
2903pub enum WatcherV6Request {
2904    /// Hanging-Get style API for observing routing changes.
2905    ///
2906    /// Clients must only have one pending `Watch` call at a time. Calling
2907    /// `Watch` while a request is already pending will cause the protocol to
2908    /// close.
2909    ///
2910    /// The first N events will always be `existing` where N is the number of
2911    /// IPv6 routes that already existed when the server-end of the protocol was
2912    /// initialized. The following event will be `idle` signaling the end of the
2913    /// `existing` events. At this point the client has watched all existing
2914    /// state and will never again observe an `existing` event.
2915    ///
2916    /// Events are returned in batches of up to `MAX_EVENTS` events. There is no
2917    /// correlation between the batch size/boundary and it's contents: it is
2918    /// perfectly valid for the server to split the block of `existing` events,
2919    /// across several batches. Clients should view this API as providing a
2920    /// stream of events, where batches are used to reduce IPC load on the
2921    /// system.
2922    ///
2923    /// - response `events` A vector of at most `MAX_EVENTS` events.
2924    Watch { responder: WatcherV6WatchResponder },
2925}
2926
2927impl WatcherV6Request {
2928    #[allow(irrefutable_let_patterns)]
2929    pub fn into_watch(self) -> Option<(WatcherV6WatchResponder)> {
2930        if let WatcherV6Request::Watch { responder } = self { Some((responder)) } else { None }
2931    }
2932
2933    /// Name of the method defined in FIDL
2934    pub fn method_name(&self) -> &'static str {
2935        match *self {
2936            WatcherV6Request::Watch { .. } => "watch",
2937        }
2938    }
2939}
2940
2941#[derive(Debug, Clone)]
2942pub struct WatcherV6ControlHandle {
2943    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2944}
2945
2946impl WatcherV6ControlHandle {
2947    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2948        self.inner.shutdown_with_epitaph(status.into())
2949    }
2950}
2951
2952impl fdomain_client::fidl::ControlHandle for WatcherV6ControlHandle {
2953    fn shutdown(&self) {
2954        self.inner.shutdown()
2955    }
2956
2957    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2958        self.inner.shutdown_with_epitaph(status)
2959    }
2960
2961    fn is_closed(&self) -> bool {
2962        self.inner.channel().is_closed()
2963    }
2964    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
2965        self.inner.channel().on_closed()
2966    }
2967}
2968
2969impl WatcherV6ControlHandle {}
2970
2971#[must_use = "FIDL methods require a response to be sent"]
2972#[derive(Debug)]
2973pub struct WatcherV6WatchResponder {
2974    control_handle: std::mem::ManuallyDrop<WatcherV6ControlHandle>,
2975    tx_id: u32,
2976}
2977
2978/// Set the the channel to be shutdown (see [`WatcherV6ControlHandle::shutdown`])
2979/// if the responder is dropped without sending a response, so that the client
2980/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2981impl std::ops::Drop for WatcherV6WatchResponder {
2982    fn drop(&mut self) {
2983        self.control_handle.shutdown();
2984        // Safety: drops once, never accessed again
2985        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2986    }
2987}
2988
2989impl fdomain_client::fidl::Responder for WatcherV6WatchResponder {
2990    type ControlHandle = WatcherV6ControlHandle;
2991
2992    fn control_handle(&self) -> &WatcherV6ControlHandle {
2993        &self.control_handle
2994    }
2995
2996    fn drop_without_shutdown(mut self) {
2997        // Safety: drops once, never accessed again due to mem::forget
2998        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2999        // Prevent Drop from running (which would shut down the channel)
3000        std::mem::forget(self);
3001    }
3002}
3003
3004impl WatcherV6WatchResponder {
3005    /// Sends a response to the FIDL transaction.
3006    ///
3007    /// Sets the channel to shutdown if an error occurs.
3008    pub fn send(self, mut events: &[EventV6]) -> Result<(), fidl::Error> {
3009        let _result = self.send_raw(events);
3010        if _result.is_err() {
3011            self.control_handle.shutdown();
3012        }
3013        self.drop_without_shutdown();
3014        _result
3015    }
3016
3017    /// Similar to "send" but does not shutdown the channel if an error occurs.
3018    pub fn send_no_shutdown_on_err(self, mut events: &[EventV6]) -> Result<(), fidl::Error> {
3019        let _result = self.send_raw(events);
3020        self.drop_without_shutdown();
3021        _result
3022    }
3023
3024    fn send_raw(&self, mut events: &[EventV6]) -> Result<(), fidl::Error> {
3025        self.control_handle.inner.send::<WatcherV6WatchResponse>(
3026            (events,),
3027            self.tx_id,
3028            0x82f5e48afc8811e,
3029            fidl::encoding::DynamicFlags::empty(),
3030        )
3031    }
3032}
3033
3034mod internal {
3035    use super::*;
3036
3037    impl fidl::encoding::ResourceTypeMarker for StateV4GetRuleWatcherV4Request {
3038        type Borrowed<'a> = &'a mut Self;
3039        fn take_or_borrow<'a>(
3040            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3041        ) -> Self::Borrowed<'a> {
3042            value
3043        }
3044    }
3045
3046    unsafe impl fidl::encoding::TypeMarker for StateV4GetRuleWatcherV4Request {
3047        type Owned = Self;
3048
3049        #[inline(always)]
3050        fn inline_align(_context: fidl::encoding::Context) -> usize {
3051            8
3052        }
3053
3054        #[inline(always)]
3055        fn inline_size(_context: fidl::encoding::Context) -> usize {
3056            24
3057        }
3058    }
3059
3060    unsafe impl
3061        fidl::encoding::Encode<
3062            StateV4GetRuleWatcherV4Request,
3063            fdomain_client::fidl::FDomainResourceDialect,
3064        > for &mut StateV4GetRuleWatcherV4Request
3065    {
3066        #[inline]
3067        unsafe fn encode(
3068            self,
3069            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3070            offset: usize,
3071            _depth: fidl::encoding::Depth,
3072        ) -> fidl::Result<()> {
3073            encoder.debug_check_bounds::<StateV4GetRuleWatcherV4Request>(offset);
3074            // Delegate to tuple encoding.
3075            fidl::encoding::Encode::<StateV4GetRuleWatcherV4Request, fdomain_client::fidl::FDomainResourceDialect>::encode(
3076                (
3077                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RuleWatcherV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
3078                    <RuleWatcherOptionsV4 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
3079                ),
3080                encoder, offset, _depth
3081            )
3082        }
3083    }
3084    unsafe impl<
3085        T0: fidl::encoding::Encode<
3086                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RuleWatcherV4Marker>>,
3087                fdomain_client::fidl::FDomainResourceDialect,
3088            >,
3089        T1: fidl::encoding::Encode<RuleWatcherOptionsV4, fdomain_client::fidl::FDomainResourceDialect>,
3090    >
3091        fidl::encoding::Encode<
3092            StateV4GetRuleWatcherV4Request,
3093            fdomain_client::fidl::FDomainResourceDialect,
3094        > for (T0, T1)
3095    {
3096        #[inline]
3097        unsafe fn encode(
3098            self,
3099            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3100            offset: usize,
3101            depth: fidl::encoding::Depth,
3102        ) -> fidl::Result<()> {
3103            encoder.debug_check_bounds::<StateV4GetRuleWatcherV4Request>(offset);
3104            // Zero out padding regions. There's no need to apply masks
3105            // because the unmasked parts will be overwritten by fields.
3106            unsafe {
3107                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3108                (ptr as *mut u64).write_unaligned(0);
3109            }
3110            // Write the fields.
3111            self.0.encode(encoder, offset + 0, depth)?;
3112            self.1.encode(encoder, offset + 8, depth)?;
3113            Ok(())
3114        }
3115    }
3116
3117    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
3118        for StateV4GetRuleWatcherV4Request
3119    {
3120        #[inline(always)]
3121        fn new_empty() -> Self {
3122            Self {
3123                watcher: fidl::new_empty!(
3124                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RuleWatcherV4Marker>>,
3125                    fdomain_client::fidl::FDomainResourceDialect
3126                ),
3127                options: fidl::new_empty!(
3128                    RuleWatcherOptionsV4,
3129                    fdomain_client::fidl::FDomainResourceDialect
3130                ),
3131            }
3132        }
3133
3134        #[inline]
3135        unsafe fn decode(
3136            &mut self,
3137            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3138            offset: usize,
3139            _depth: fidl::encoding::Depth,
3140        ) -> fidl::Result<()> {
3141            decoder.debug_check_bounds::<Self>(offset);
3142            // Verify that padding bytes are zero.
3143            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3144            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3145            let mask = 0xffffffff00000000u64;
3146            let maskedval = padval & mask;
3147            if maskedval != 0 {
3148                return Err(fidl::Error::NonZeroPadding {
3149                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3150                });
3151            }
3152            fidl::decode!(
3153                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RuleWatcherV4Marker>>,
3154                fdomain_client::fidl::FDomainResourceDialect,
3155                &mut self.watcher,
3156                decoder,
3157                offset + 0,
3158                _depth
3159            )?;
3160            fidl::decode!(
3161                RuleWatcherOptionsV4,
3162                fdomain_client::fidl::FDomainResourceDialect,
3163                &mut self.options,
3164                decoder,
3165                offset + 8,
3166                _depth
3167            )?;
3168            Ok(())
3169        }
3170    }
3171
3172    impl fidl::encoding::ResourceTypeMarker for StateV4GetWatcherV4Request {
3173        type Borrowed<'a> = &'a mut Self;
3174        fn take_or_borrow<'a>(
3175            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3176        ) -> Self::Borrowed<'a> {
3177            value
3178        }
3179    }
3180
3181    unsafe impl fidl::encoding::TypeMarker for StateV4GetWatcherV4Request {
3182        type Owned = Self;
3183
3184        #[inline(always)]
3185        fn inline_align(_context: fidl::encoding::Context) -> usize {
3186            8
3187        }
3188
3189        #[inline(always)]
3190        fn inline_size(_context: fidl::encoding::Context) -> usize {
3191            24
3192        }
3193    }
3194
3195    unsafe impl
3196        fidl::encoding::Encode<
3197            StateV4GetWatcherV4Request,
3198            fdomain_client::fidl::FDomainResourceDialect,
3199        > for &mut StateV4GetWatcherV4Request
3200    {
3201        #[inline]
3202        unsafe fn encode(
3203            self,
3204            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3205            offset: usize,
3206            _depth: fidl::encoding::Depth,
3207        ) -> fidl::Result<()> {
3208            encoder.debug_check_bounds::<StateV4GetWatcherV4Request>(offset);
3209            // Delegate to tuple encoding.
3210            fidl::encoding::Encode::<StateV4GetWatcherV4Request, fdomain_client::fidl::FDomainResourceDialect>::encode(
3211                (
3212                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<WatcherV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
3213                    <WatcherOptionsV4 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
3214                ),
3215                encoder, offset, _depth
3216            )
3217        }
3218    }
3219    unsafe impl<
3220        T0: fidl::encoding::Encode<
3221                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<WatcherV4Marker>>,
3222                fdomain_client::fidl::FDomainResourceDialect,
3223            >,
3224        T1: fidl::encoding::Encode<WatcherOptionsV4, fdomain_client::fidl::FDomainResourceDialect>,
3225    >
3226        fidl::encoding::Encode<
3227            StateV4GetWatcherV4Request,
3228            fdomain_client::fidl::FDomainResourceDialect,
3229        > for (T0, T1)
3230    {
3231        #[inline]
3232        unsafe fn encode(
3233            self,
3234            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3235            offset: usize,
3236            depth: fidl::encoding::Depth,
3237        ) -> fidl::Result<()> {
3238            encoder.debug_check_bounds::<StateV4GetWatcherV4Request>(offset);
3239            // Zero out padding regions. There's no need to apply masks
3240            // because the unmasked parts will be overwritten by fields.
3241            unsafe {
3242                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3243                (ptr as *mut u64).write_unaligned(0);
3244            }
3245            // Write the fields.
3246            self.0.encode(encoder, offset + 0, depth)?;
3247            self.1.encode(encoder, offset + 8, depth)?;
3248            Ok(())
3249        }
3250    }
3251
3252    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
3253        for StateV4GetWatcherV4Request
3254    {
3255        #[inline(always)]
3256        fn new_empty() -> Self {
3257            Self {
3258                watcher: fidl::new_empty!(
3259                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<WatcherV4Marker>>,
3260                    fdomain_client::fidl::FDomainResourceDialect
3261                ),
3262                options: fidl::new_empty!(
3263                    WatcherOptionsV4,
3264                    fdomain_client::fidl::FDomainResourceDialect
3265                ),
3266            }
3267        }
3268
3269        #[inline]
3270        unsafe fn decode(
3271            &mut self,
3272            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3273            offset: usize,
3274            _depth: fidl::encoding::Depth,
3275        ) -> fidl::Result<()> {
3276            decoder.debug_check_bounds::<Self>(offset);
3277            // Verify that padding bytes are zero.
3278            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3279            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3280            let mask = 0xffffffff00000000u64;
3281            let maskedval = padval & mask;
3282            if maskedval != 0 {
3283                return Err(fidl::Error::NonZeroPadding {
3284                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3285                });
3286            }
3287            fidl::decode!(
3288                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<WatcherV4Marker>>,
3289                fdomain_client::fidl::FDomainResourceDialect,
3290                &mut self.watcher,
3291                decoder,
3292                offset + 0,
3293                _depth
3294            )?;
3295            fidl::decode!(
3296                WatcherOptionsV4,
3297                fdomain_client::fidl::FDomainResourceDialect,
3298                &mut self.options,
3299                decoder,
3300                offset + 8,
3301                _depth
3302            )?;
3303            Ok(())
3304        }
3305    }
3306
3307    impl fidl::encoding::ResourceTypeMarker for StateV6GetRuleWatcherV6Request {
3308        type Borrowed<'a> = &'a mut Self;
3309        fn take_or_borrow<'a>(
3310            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3311        ) -> Self::Borrowed<'a> {
3312            value
3313        }
3314    }
3315
3316    unsafe impl fidl::encoding::TypeMarker for StateV6GetRuleWatcherV6Request {
3317        type Owned = Self;
3318
3319        #[inline(always)]
3320        fn inline_align(_context: fidl::encoding::Context) -> usize {
3321            8
3322        }
3323
3324        #[inline(always)]
3325        fn inline_size(_context: fidl::encoding::Context) -> usize {
3326            24
3327        }
3328    }
3329
3330    unsafe impl
3331        fidl::encoding::Encode<
3332            StateV6GetRuleWatcherV6Request,
3333            fdomain_client::fidl::FDomainResourceDialect,
3334        > for &mut StateV6GetRuleWatcherV6Request
3335    {
3336        #[inline]
3337        unsafe fn encode(
3338            self,
3339            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3340            offset: usize,
3341            _depth: fidl::encoding::Depth,
3342        ) -> fidl::Result<()> {
3343            encoder.debug_check_bounds::<StateV6GetRuleWatcherV6Request>(offset);
3344            // Delegate to tuple encoding.
3345            fidl::encoding::Encode::<StateV6GetRuleWatcherV6Request, fdomain_client::fidl::FDomainResourceDialect>::encode(
3346                (
3347                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RuleWatcherV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
3348                    <RuleWatcherOptionsV6 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
3349                ),
3350                encoder, offset, _depth
3351            )
3352        }
3353    }
3354    unsafe impl<
3355        T0: fidl::encoding::Encode<
3356                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RuleWatcherV6Marker>>,
3357                fdomain_client::fidl::FDomainResourceDialect,
3358            >,
3359        T1: fidl::encoding::Encode<RuleWatcherOptionsV6, fdomain_client::fidl::FDomainResourceDialect>,
3360    >
3361        fidl::encoding::Encode<
3362            StateV6GetRuleWatcherV6Request,
3363            fdomain_client::fidl::FDomainResourceDialect,
3364        > for (T0, T1)
3365    {
3366        #[inline]
3367        unsafe fn encode(
3368            self,
3369            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3370            offset: usize,
3371            depth: fidl::encoding::Depth,
3372        ) -> fidl::Result<()> {
3373            encoder.debug_check_bounds::<StateV6GetRuleWatcherV6Request>(offset);
3374            // Zero out padding regions. There's no need to apply masks
3375            // because the unmasked parts will be overwritten by fields.
3376            unsafe {
3377                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3378                (ptr as *mut u64).write_unaligned(0);
3379            }
3380            // Write the fields.
3381            self.0.encode(encoder, offset + 0, depth)?;
3382            self.1.encode(encoder, offset + 8, depth)?;
3383            Ok(())
3384        }
3385    }
3386
3387    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
3388        for StateV6GetRuleWatcherV6Request
3389    {
3390        #[inline(always)]
3391        fn new_empty() -> Self {
3392            Self {
3393                watcher: fidl::new_empty!(
3394                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RuleWatcherV6Marker>>,
3395                    fdomain_client::fidl::FDomainResourceDialect
3396                ),
3397                options: fidl::new_empty!(
3398                    RuleWatcherOptionsV6,
3399                    fdomain_client::fidl::FDomainResourceDialect
3400                ),
3401            }
3402        }
3403
3404        #[inline]
3405        unsafe fn decode(
3406            &mut self,
3407            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3408            offset: usize,
3409            _depth: fidl::encoding::Depth,
3410        ) -> fidl::Result<()> {
3411            decoder.debug_check_bounds::<Self>(offset);
3412            // Verify that padding bytes are zero.
3413            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3414            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3415            let mask = 0xffffffff00000000u64;
3416            let maskedval = padval & mask;
3417            if maskedval != 0 {
3418                return Err(fidl::Error::NonZeroPadding {
3419                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3420                });
3421            }
3422            fidl::decode!(
3423                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RuleWatcherV6Marker>>,
3424                fdomain_client::fidl::FDomainResourceDialect,
3425                &mut self.watcher,
3426                decoder,
3427                offset + 0,
3428                _depth
3429            )?;
3430            fidl::decode!(
3431                RuleWatcherOptionsV6,
3432                fdomain_client::fidl::FDomainResourceDialect,
3433                &mut self.options,
3434                decoder,
3435                offset + 8,
3436                _depth
3437            )?;
3438            Ok(())
3439        }
3440    }
3441
3442    impl fidl::encoding::ResourceTypeMarker for StateV6GetWatcherV6Request {
3443        type Borrowed<'a> = &'a mut Self;
3444        fn take_or_borrow<'a>(
3445            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3446        ) -> Self::Borrowed<'a> {
3447            value
3448        }
3449    }
3450
3451    unsafe impl fidl::encoding::TypeMarker for StateV6GetWatcherV6Request {
3452        type Owned = Self;
3453
3454        #[inline(always)]
3455        fn inline_align(_context: fidl::encoding::Context) -> usize {
3456            8
3457        }
3458
3459        #[inline(always)]
3460        fn inline_size(_context: fidl::encoding::Context) -> usize {
3461            24
3462        }
3463    }
3464
3465    unsafe impl
3466        fidl::encoding::Encode<
3467            StateV6GetWatcherV6Request,
3468            fdomain_client::fidl::FDomainResourceDialect,
3469        > for &mut StateV6GetWatcherV6Request
3470    {
3471        #[inline]
3472        unsafe fn encode(
3473            self,
3474            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3475            offset: usize,
3476            _depth: fidl::encoding::Depth,
3477        ) -> fidl::Result<()> {
3478            encoder.debug_check_bounds::<StateV6GetWatcherV6Request>(offset);
3479            // Delegate to tuple encoding.
3480            fidl::encoding::Encode::<StateV6GetWatcherV6Request, fdomain_client::fidl::FDomainResourceDialect>::encode(
3481                (
3482                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<WatcherV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.watcher),
3483                    <WatcherOptionsV6 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
3484                ),
3485                encoder, offset, _depth
3486            )
3487        }
3488    }
3489    unsafe impl<
3490        T0: fidl::encoding::Encode<
3491                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<WatcherV6Marker>>,
3492                fdomain_client::fidl::FDomainResourceDialect,
3493            >,
3494        T1: fidl::encoding::Encode<WatcherOptionsV6, fdomain_client::fidl::FDomainResourceDialect>,
3495    >
3496        fidl::encoding::Encode<
3497            StateV6GetWatcherV6Request,
3498            fdomain_client::fidl::FDomainResourceDialect,
3499        > for (T0, T1)
3500    {
3501        #[inline]
3502        unsafe fn encode(
3503            self,
3504            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3505            offset: usize,
3506            depth: fidl::encoding::Depth,
3507        ) -> fidl::Result<()> {
3508            encoder.debug_check_bounds::<StateV6GetWatcherV6Request>(offset);
3509            // Zero out padding regions. There's no need to apply masks
3510            // because the unmasked parts will be overwritten by fields.
3511            unsafe {
3512                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3513                (ptr as *mut u64).write_unaligned(0);
3514            }
3515            // Write the fields.
3516            self.0.encode(encoder, offset + 0, depth)?;
3517            self.1.encode(encoder, offset + 8, depth)?;
3518            Ok(())
3519        }
3520    }
3521
3522    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
3523        for StateV6GetWatcherV6Request
3524    {
3525        #[inline(always)]
3526        fn new_empty() -> Self {
3527            Self {
3528                watcher: fidl::new_empty!(
3529                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<WatcherV6Marker>>,
3530                    fdomain_client::fidl::FDomainResourceDialect
3531                ),
3532                options: fidl::new_empty!(
3533                    WatcherOptionsV6,
3534                    fdomain_client::fidl::FDomainResourceDialect
3535                ),
3536            }
3537        }
3538
3539        #[inline]
3540        unsafe fn decode(
3541            &mut self,
3542            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
3543            offset: usize,
3544            _depth: fidl::encoding::Depth,
3545        ) -> fidl::Result<()> {
3546            decoder.debug_check_bounds::<Self>(offset);
3547            // Verify that padding bytes are zero.
3548            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3549            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3550            let mask = 0xffffffff00000000u64;
3551            let maskedval = padval & mask;
3552            if maskedval != 0 {
3553                return Err(fidl::Error::NonZeroPadding {
3554                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3555                });
3556            }
3557            fidl::decode!(
3558                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<WatcherV6Marker>>,
3559                fdomain_client::fidl::FDomainResourceDialect,
3560                &mut self.watcher,
3561                decoder,
3562                offset + 0,
3563                _depth
3564            )?;
3565            fidl::decode!(
3566                WatcherOptionsV6,
3567                fdomain_client::fidl::FDomainResourceDialect,
3568                &mut self.options,
3569                decoder,
3570                offset + 8,
3571                _depth
3572            )?;
3573            Ok(())
3574        }
3575    }
3576}