Skip to main content

fdomain_fuchsia_net_routes_admin/
fdomain_fuchsia_net_routes_admin.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_admin_common::*;
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
14pub struct BaseRouteTableGetAuthorizationForRouteTableResponse {
15    pub credential: GrantForRouteTableAuthorization,
16}
17
18impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
19    for BaseRouteTableGetAuthorizationForRouteTableResponse
20{
21}
22
23#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
24pub struct GrantForRouteTableAuthorization {
25    /// The ID of the table this credential is authenticating.
26    pub table_id: u32,
27    /// The `EVENT` providing authentication over this route table.
28    pub token: fdomain_client::Event,
29}
30
31impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
32    for GrantForRouteTableAuthorization
33{
34}
35
36#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
37pub struct ProofOfRouteTableAuthorization {
38    pub table: u32,
39    pub token: fdomain_client::Event,
40}
41
42impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
43    for ProofOfRouteTableAuthorization
44{
45}
46
47#[derive(Debug, PartialEq)]
48pub struct RouteSetV4AddRouteRequest {
49    pub route: fdomain_fuchsia_net_routes::RouteV4,
50}
51
52impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for RouteSetV4AddRouteRequest {}
53
54#[derive(Debug, PartialEq)]
55pub struct RouteSetV4AuthenticateForInterfaceRequest {
56    pub credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
57}
58
59impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
60    for RouteSetV4AuthenticateForInterfaceRequest
61{
62}
63
64#[derive(Debug, PartialEq)]
65pub struct RouteSetV4RemoveRouteRequest {
66    pub route: fdomain_fuchsia_net_routes::RouteV4,
67}
68
69impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
70    for RouteSetV4RemoveRouteRequest
71{
72}
73
74#[derive(Debug, PartialEq)]
75pub struct RouteSetV6AddRouteRequest {
76    pub route: fdomain_fuchsia_net_routes::RouteV6,
77}
78
79impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for RouteSetV6AddRouteRequest {}
80
81#[derive(Debug, PartialEq)]
82pub struct RouteSetV6AuthenticateForInterfaceRequest {
83    pub credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
84}
85
86impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
87    for RouteSetV6AuthenticateForInterfaceRequest
88{
89}
90
91#[derive(Debug, PartialEq)]
92pub struct RouteSetV6RemoveRouteRequest {
93    pub route: fdomain_fuchsia_net_routes::RouteV6,
94}
95
96impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
97    for RouteSetV6RemoveRouteRequest
98{
99}
100
101#[derive(Debug, PartialEq)]
102pub struct RouteTableProviderV4GetInterfaceLocalTableRequest {
103    pub credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
104}
105
106impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
107    for RouteTableProviderV4GetInterfaceLocalTableRequest
108{
109}
110
111#[derive(Debug, PartialEq)]
112pub struct RouteTableProviderV4NewRouteTableRequest {
113    pub provider: fdomain_client::fidl::ServerEnd<RouteTableV4Marker>,
114    pub options: RouteTableOptionsV4,
115}
116
117impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
118    for RouteTableProviderV4NewRouteTableRequest
119{
120}
121
122#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
123pub struct RouteTableProviderV4GetInterfaceLocalTableResponse {
124    pub route_table: fdomain_client::fidl::ClientEnd<RouteTableV4Marker>,
125}
126
127impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
128    for RouteTableProviderV4GetInterfaceLocalTableResponse
129{
130}
131
132#[derive(Debug, PartialEq)]
133pub struct RouteTableProviderV6GetInterfaceLocalTableRequest {
134    pub credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
135}
136
137impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
138    for RouteTableProviderV6GetInterfaceLocalTableRequest
139{
140}
141
142#[derive(Debug, PartialEq)]
143pub struct RouteTableProviderV6NewRouteTableRequest {
144    pub provider: fdomain_client::fidl::ServerEnd<RouteTableV6Marker>,
145    pub options: RouteTableOptionsV6,
146}
147
148impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
149    for RouteTableProviderV6NewRouteTableRequest
150{
151}
152
153#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
154pub struct RouteTableProviderV6GetInterfaceLocalTableResponse {
155    pub route_table: fdomain_client::fidl::ClientEnd<RouteTableV6Marker>,
156}
157
158impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
159    for RouteTableProviderV6GetInterfaceLocalTableResponse
160{
161}
162
163#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
164pub struct RouteTableV4NewRouteSetRequest {
165    pub route_set: fdomain_client::fidl::ServerEnd<RouteSetV4Marker>,
166}
167
168impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
169    for RouteTableV4NewRouteSetRequest
170{
171}
172
173#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
174pub struct RouteTableV6NewRouteSetRequest {
175    pub route_set: fdomain_client::fidl::ServerEnd<RouteSetV6Marker>,
176}
177
178impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
179    for RouteTableV6NewRouteSetRequest
180{
181}
182
183#[derive(Debug, PartialEq)]
184pub struct RuleSetV4AddRuleRequest {
185    pub index: u32,
186    pub matcher: fdomain_fuchsia_net_routes::RuleMatcherV4,
187    pub action: fdomain_fuchsia_net_routes::RuleAction,
188}
189
190impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for RuleSetV4AddRuleRequest {}
191
192#[derive(Debug, PartialEq)]
193pub struct RuleSetV6AddRuleRequest {
194    pub index: u32,
195    pub matcher: fdomain_fuchsia_net_routes::RuleMatcherV6,
196    pub action: fdomain_fuchsia_net_routes::RuleAction,
197}
198
199impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect> for RuleSetV6AddRuleRequest {}
200
201#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
202pub struct RuleTableV4NewRuleSetRequest {
203    pub priority: u32,
204    pub rule_set: fdomain_client::fidl::ServerEnd<RuleSetV4Marker>,
205}
206
207impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
208    for RuleTableV4NewRuleSetRequest
209{
210}
211
212#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
213pub struct RuleTableV6NewRuleSetRequest {
214    pub priority: u32,
215    pub rule_set: fdomain_client::fidl::ServerEnd<RuleSetV6Marker>,
216}
217
218impl fidl::Standalone<fdomain_client::fidl::FDomainResourceDialect>
219    for RuleTableV6NewRuleSetRequest
220{
221}
222
223#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
224pub struct BaseRouteTableMarker;
225
226impl fdomain_client::fidl::ProtocolMarker for BaseRouteTableMarker {
227    type Proxy = BaseRouteTableProxy;
228    type RequestStream = BaseRouteTableRequestStream;
229
230    const DEBUG_NAME: &'static str = "(anonymous) BaseRouteTable";
231}
232pub type BaseRouteTableRemoveResult = Result<(), BaseRouteTableRemoveError>;
233
234pub trait BaseRouteTableProxyInterface: Send + Sync {
235    type GetTableIdResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
236    fn r#get_table_id(&self) -> Self::GetTableIdResponseFut;
237    fn r#detach(&self) -> Result<(), fidl::Error>;
238    type RemoveResponseFut: std::future::Future<Output = Result<BaseRouteTableRemoveResult, fidl::Error>>
239        + Send;
240    fn r#remove(&self) -> Self::RemoveResponseFut;
241    type GetAuthorizationForRouteTableResponseFut: std::future::Future<Output = Result<GrantForRouteTableAuthorization, fidl::Error>>
242        + Send;
243    fn r#get_authorization_for_route_table(&self)
244    -> Self::GetAuthorizationForRouteTableResponseFut;
245}
246
247#[derive(Debug, Clone)]
248pub struct BaseRouteTableProxy {
249    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
250}
251
252impl fdomain_client::fidl::Proxy for BaseRouteTableProxy {
253    type Protocol = BaseRouteTableMarker;
254
255    fn from_channel(inner: fdomain_client::Channel) -> Self {
256        Self::new(inner)
257    }
258
259    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
260        self.client.into_channel().map_err(|client| Self { client })
261    }
262
263    fn as_channel(&self) -> &fdomain_client::Channel {
264        self.client.as_channel()
265    }
266}
267
268impl BaseRouteTableProxy {
269    /// Create a new Proxy for fuchsia.net.routes.admin/BaseRouteTable.
270    pub fn new(channel: fdomain_client::Channel) -> Self {
271        let protocol_name =
272            <BaseRouteTableMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
273        Self { client: fidl::client::Client::new(channel, protocol_name) }
274    }
275
276    /// Get a Stream of events from the remote end of the protocol.
277    ///
278    /// # Panics
279    ///
280    /// Panics if the event stream was already taken.
281    pub fn take_event_stream(&self) -> BaseRouteTableEventStream {
282        BaseRouteTableEventStream { event_receiver: self.client.take_event_receiver() }
283    }
284
285    /// Gets the table ID for this table.
286    pub fn r#get_table_id(
287        &self,
288    ) -> fidl::client::QueryResponseFut<u32, fdomain_client::fidl::FDomainResourceDialect> {
289        BaseRouteTableProxyInterface::r#get_table_id(self)
290    }
291
292    /// Detaches the lifetime of the route table from the lifetime of the
293    /// client end of the channel.
294    ///
295    /// After this method is called, the route table will not be removed
296    /// if the client end is closed. It's a no-op if called on the main table.
297    pub fn r#detach(&self) -> Result<(), fidl::Error> {
298        BaseRouteTableProxyInterface::r#detach(self)
299    }
300
301    /// Removes the route table explicitly.
302    ///
303    /// This method cannot be called on the main table or an interface-local
304    /// table, an error will be returned if called. The server will close the
305    /// channel after this method successfully returns.
306    pub fn r#remove(
307        &self,
308    ) -> fidl::client::QueryResponseFut<
309        BaseRouteTableRemoveResult,
310        fdomain_client::fidl::FDomainResourceDialect,
311    > {
312        BaseRouteTableProxyInterface::r#remove(self)
313    }
314
315    /// Gets an authentication credential for this table.
316    ///
317    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
318    /// held by the server. This credential can be passed into
319    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
320    /// table. The `EVENT` is stable throughout the lifetime of the route table.
321    /// Clients may duplicate this `EVENT` to make multiple API calls, or
322    /// transfer the `EVENT` to other clients.
323    ///
324    /// - response `credential` the authorization credential for this table.
325    pub fn r#get_authorization_for_route_table(
326        &self,
327    ) -> fidl::client::QueryResponseFut<
328        GrantForRouteTableAuthorization,
329        fdomain_client::fidl::FDomainResourceDialect,
330    > {
331        BaseRouteTableProxyInterface::r#get_authorization_for_route_table(self)
332    }
333}
334
335impl BaseRouteTableProxyInterface for BaseRouteTableProxy {
336    type GetTableIdResponseFut =
337        fidl::client::QueryResponseFut<u32, fdomain_client::fidl::FDomainResourceDialect>;
338    fn r#get_table_id(&self) -> Self::GetTableIdResponseFut {
339        fn _decode(
340            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
341        ) -> Result<u32, fidl::Error> {
342            let _response = fidl::client::decode_transaction_body::<
343                BaseRouteTableGetTableIdResponse,
344                fdomain_client::fidl::FDomainResourceDialect,
345                0x7eab30c55edbfc15,
346            >(_buf?)?;
347            Ok(_response.table_id)
348        }
349        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
350            (),
351            0x7eab30c55edbfc15,
352            fidl::encoding::DynamicFlags::empty(),
353            _decode,
354        )
355    }
356
357    fn r#detach(&self) -> Result<(), fidl::Error> {
358        self.client.send::<fidl::encoding::EmptyPayload>(
359            (),
360            0x2853ab157285b384,
361            fidl::encoding::DynamicFlags::empty(),
362        )
363    }
364
365    type RemoveResponseFut = fidl::client::QueryResponseFut<
366        BaseRouteTableRemoveResult,
367        fdomain_client::fidl::FDomainResourceDialect,
368    >;
369    fn r#remove(&self) -> Self::RemoveResponseFut {
370        fn _decode(
371            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
372        ) -> Result<BaseRouteTableRemoveResult, fidl::Error> {
373            let _response = fidl::client::decode_transaction_body::<
374                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BaseRouteTableRemoveError>,
375                fdomain_client::fidl::FDomainResourceDialect,
376                0xc42e58a5fc79426,
377            >(_buf?)?;
378            Ok(_response.map(|x| x))
379        }
380        self.client
381            .send_query_and_decode::<fidl::encoding::EmptyPayload, BaseRouteTableRemoveResult>(
382                (),
383                0xc42e58a5fc79426,
384                fidl::encoding::DynamicFlags::empty(),
385                _decode,
386            )
387    }
388
389    type GetAuthorizationForRouteTableResponseFut = fidl::client::QueryResponseFut<
390        GrantForRouteTableAuthorization,
391        fdomain_client::fidl::FDomainResourceDialect,
392    >;
393    fn r#get_authorization_for_route_table(
394        &self,
395    ) -> Self::GetAuthorizationForRouteTableResponseFut {
396        fn _decode(
397            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
398        ) -> Result<GrantForRouteTableAuthorization, fidl::Error> {
399            let _response = fidl::client::decode_transaction_body::<
400                BaseRouteTableGetAuthorizationForRouteTableResponse,
401                fdomain_client::fidl::FDomainResourceDialect,
402                0x56a48c921ff3b6eb,
403            >(_buf?)?;
404            Ok(_response.credential)
405        }
406        self.client
407            .send_query_and_decode::<fidl::encoding::EmptyPayload, GrantForRouteTableAuthorization>(
408                (),
409                0x56a48c921ff3b6eb,
410                fidl::encoding::DynamicFlags::empty(),
411                _decode,
412            )
413    }
414}
415
416pub struct BaseRouteTableEventStream {
417    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
418}
419
420impl std::marker::Unpin for BaseRouteTableEventStream {}
421
422impl futures::stream::FusedStream for BaseRouteTableEventStream {
423    fn is_terminated(&self) -> bool {
424        self.event_receiver.is_terminated()
425    }
426}
427
428impl futures::Stream for BaseRouteTableEventStream {
429    type Item = Result<BaseRouteTableEvent, fidl::Error>;
430
431    fn poll_next(
432        mut self: std::pin::Pin<&mut Self>,
433        cx: &mut std::task::Context<'_>,
434    ) -> std::task::Poll<Option<Self::Item>> {
435        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
436            &mut self.event_receiver,
437            cx
438        )?) {
439            Some(buf) => std::task::Poll::Ready(Some(BaseRouteTableEvent::decode(buf))),
440            None => std::task::Poll::Ready(None),
441        }
442    }
443}
444
445#[derive(Debug)]
446pub enum BaseRouteTableEvent {}
447
448impl BaseRouteTableEvent {
449    /// Decodes a message buffer as a [`BaseRouteTableEvent`].
450    fn decode(
451        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
452    ) -> Result<BaseRouteTableEvent, fidl::Error> {
453        let (bytes, _handles) = buf.split_mut();
454        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
455        debug_assert_eq!(tx_header.tx_id, 0);
456        match tx_header.ordinal {
457            _ => Err(fidl::Error::UnknownOrdinal {
458                ordinal: tx_header.ordinal,
459                protocol_name:
460                    <BaseRouteTableMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
461            }),
462        }
463    }
464}
465
466/// A Stream of incoming requests for fuchsia.net.routes.admin/BaseRouteTable.
467pub struct BaseRouteTableRequestStream {
468    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
469    is_terminated: bool,
470}
471
472impl std::marker::Unpin for BaseRouteTableRequestStream {}
473
474impl futures::stream::FusedStream for BaseRouteTableRequestStream {
475    fn is_terminated(&self) -> bool {
476        self.is_terminated
477    }
478}
479
480impl fdomain_client::fidl::RequestStream for BaseRouteTableRequestStream {
481    type Protocol = BaseRouteTableMarker;
482    type ControlHandle = BaseRouteTableControlHandle;
483
484    fn from_channel(channel: fdomain_client::Channel) -> Self {
485        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
486    }
487
488    fn control_handle(&self) -> Self::ControlHandle {
489        BaseRouteTableControlHandle { inner: self.inner.clone() }
490    }
491
492    fn into_inner(
493        self,
494    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
495    {
496        (self.inner, self.is_terminated)
497    }
498
499    fn from_inner(
500        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
501        is_terminated: bool,
502    ) -> Self {
503        Self { inner, is_terminated }
504    }
505}
506
507impl futures::Stream for BaseRouteTableRequestStream {
508    type Item = Result<BaseRouteTableRequest, fidl::Error>;
509
510    fn poll_next(
511        mut self: std::pin::Pin<&mut Self>,
512        cx: &mut std::task::Context<'_>,
513    ) -> std::task::Poll<Option<Self::Item>> {
514        let this = &mut *self;
515        if this.inner.check_shutdown(cx) {
516            this.is_terminated = true;
517            return std::task::Poll::Ready(None);
518        }
519        if this.is_terminated {
520            panic!("polled BaseRouteTableRequestStream after completion");
521        }
522        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
523            |bytes, handles| {
524                match this.inner.channel().read_etc(cx, bytes, handles) {
525                    std::task::Poll::Ready(Ok(())) => {}
526                    std::task::Poll::Pending => return std::task::Poll::Pending,
527                    std::task::Poll::Ready(Err(None)) => {
528                        this.is_terminated = true;
529                        return std::task::Poll::Ready(None);
530                    }
531                    std::task::Poll::Ready(Err(Some(e))) => {
532                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
533                            e.into(),
534                        ))));
535                    }
536                }
537
538                // A message has been received from the channel
539                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
540
541                std::task::Poll::Ready(Some(match header.ordinal {
542                0x7eab30c55edbfc15 => {
543                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
544                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
545                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
546                    let control_handle = BaseRouteTableControlHandle {
547                        inner: this.inner.clone(),
548                    };
549                    Ok(BaseRouteTableRequest::GetTableId {
550                        responder: BaseRouteTableGetTableIdResponder {
551                            control_handle: std::mem::ManuallyDrop::new(control_handle),
552                            tx_id: header.tx_id,
553                        },
554                    })
555                }
556                0x2853ab157285b384 => {
557                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
558                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
559                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
560                    let control_handle = BaseRouteTableControlHandle {
561                        inner: this.inner.clone(),
562                    };
563                    Ok(BaseRouteTableRequest::Detach {
564                        control_handle,
565                    })
566                }
567                0xc42e58a5fc79426 => {
568                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
569                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
570                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
571                    let control_handle = BaseRouteTableControlHandle {
572                        inner: this.inner.clone(),
573                    };
574                    Ok(BaseRouteTableRequest::Remove {
575                        responder: BaseRouteTableRemoveResponder {
576                            control_handle: std::mem::ManuallyDrop::new(control_handle),
577                            tx_id: header.tx_id,
578                        },
579                    })
580                }
581                0x56a48c921ff3b6eb => {
582                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
583                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fdomain_client::fidl::FDomainResourceDialect);
584                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
585                    let control_handle = BaseRouteTableControlHandle {
586                        inner: this.inner.clone(),
587                    };
588                    Ok(BaseRouteTableRequest::GetAuthorizationForRouteTable {
589                        responder: BaseRouteTableGetAuthorizationForRouteTableResponder {
590                            control_handle: std::mem::ManuallyDrop::new(control_handle),
591                            tx_id: header.tx_id,
592                        },
593                    })
594                }
595                _ => Err(fidl::Error::UnknownOrdinal {
596                    ordinal: header.ordinal,
597                    protocol_name: <BaseRouteTableMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
598                }),
599            }))
600            },
601        )
602    }
603}
604
605/// Common base for `RouteTable` protocol that is IP version agnostic. This
606/// helps reduce FIDL duplication.
607#[derive(Debug)]
608pub enum BaseRouteTableRequest {
609    /// Gets the table ID for this table.
610    GetTableId { responder: BaseRouteTableGetTableIdResponder },
611    /// Detaches the lifetime of the route table from the lifetime of the
612    /// client end of the channel.
613    ///
614    /// After this method is called, the route table will not be removed
615    /// if the client end is closed. It's a no-op if called on the main table.
616    Detach { control_handle: BaseRouteTableControlHandle },
617    /// Removes the route table explicitly.
618    ///
619    /// This method cannot be called on the main table or an interface-local
620    /// table, an error will be returned if called. The server will close the
621    /// channel after this method successfully returns.
622    Remove { responder: BaseRouteTableRemoveResponder },
623    /// Gets an authentication credential for this table.
624    ///
625    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
626    /// held by the server. This credential can be passed into
627    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
628    /// table. The `EVENT` is stable throughout the lifetime of the route table.
629    /// Clients may duplicate this `EVENT` to make multiple API calls, or
630    /// transfer the `EVENT` to other clients.
631    ///
632    /// - response `credential` the authorization credential for this table.
633    GetAuthorizationForRouteTable {
634        responder: BaseRouteTableGetAuthorizationForRouteTableResponder,
635    },
636}
637
638impl BaseRouteTableRequest {
639    #[allow(irrefutable_let_patterns)]
640    pub fn into_get_table_id(self) -> Option<(BaseRouteTableGetTableIdResponder)> {
641        if let BaseRouteTableRequest::GetTableId { responder } = self {
642            Some((responder))
643        } else {
644            None
645        }
646    }
647
648    #[allow(irrefutable_let_patterns)]
649    pub fn into_detach(self) -> Option<(BaseRouteTableControlHandle)> {
650        if let BaseRouteTableRequest::Detach { control_handle } = self {
651            Some((control_handle))
652        } else {
653            None
654        }
655    }
656
657    #[allow(irrefutable_let_patterns)]
658    pub fn into_remove(self) -> Option<(BaseRouteTableRemoveResponder)> {
659        if let BaseRouteTableRequest::Remove { responder } = self {
660            Some((responder))
661        } else {
662            None
663        }
664    }
665
666    #[allow(irrefutable_let_patterns)]
667    pub fn into_get_authorization_for_route_table(
668        self,
669    ) -> Option<(BaseRouteTableGetAuthorizationForRouteTableResponder)> {
670        if let BaseRouteTableRequest::GetAuthorizationForRouteTable { responder } = self {
671            Some((responder))
672        } else {
673            None
674        }
675    }
676
677    /// Name of the method defined in FIDL
678    pub fn method_name(&self) -> &'static str {
679        match *self {
680            BaseRouteTableRequest::GetTableId { .. } => "get_table_id",
681            BaseRouteTableRequest::Detach { .. } => "detach",
682            BaseRouteTableRequest::Remove { .. } => "remove",
683            BaseRouteTableRequest::GetAuthorizationForRouteTable { .. } => {
684                "get_authorization_for_route_table"
685            }
686        }
687    }
688}
689
690#[derive(Debug, Clone)]
691pub struct BaseRouteTableControlHandle {
692    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
693}
694
695impl BaseRouteTableControlHandle {
696    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
697        self.inner.shutdown_with_epitaph(status.into())
698    }
699}
700
701impl fdomain_client::fidl::ControlHandle for BaseRouteTableControlHandle {
702    fn shutdown(&self) {
703        self.inner.shutdown()
704    }
705
706    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
707        self.inner.shutdown_with_epitaph(status)
708    }
709
710    fn is_closed(&self) -> bool {
711        self.inner.channel().is_closed()
712    }
713    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
714        self.inner.channel().on_closed()
715    }
716}
717
718impl BaseRouteTableControlHandle {}
719
720#[must_use = "FIDL methods require a response to be sent"]
721#[derive(Debug)]
722pub struct BaseRouteTableGetTableIdResponder {
723    control_handle: std::mem::ManuallyDrop<BaseRouteTableControlHandle>,
724    tx_id: u32,
725}
726
727/// Set the the channel to be shutdown (see [`BaseRouteTableControlHandle::shutdown`])
728/// if the responder is dropped without sending a response, so that the client
729/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
730impl std::ops::Drop for BaseRouteTableGetTableIdResponder {
731    fn drop(&mut self) {
732        self.control_handle.shutdown();
733        // Safety: drops once, never accessed again
734        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
735    }
736}
737
738impl fdomain_client::fidl::Responder for BaseRouteTableGetTableIdResponder {
739    type ControlHandle = BaseRouteTableControlHandle;
740
741    fn control_handle(&self) -> &BaseRouteTableControlHandle {
742        &self.control_handle
743    }
744
745    fn drop_without_shutdown(mut self) {
746        // Safety: drops once, never accessed again due to mem::forget
747        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
748        // Prevent Drop from running (which would shut down the channel)
749        std::mem::forget(self);
750    }
751}
752
753impl BaseRouteTableGetTableIdResponder {
754    /// Sends a response to the FIDL transaction.
755    ///
756    /// Sets the channel to shutdown if an error occurs.
757    pub fn send(self, mut table_id: u32) -> Result<(), fidl::Error> {
758        let _result = self.send_raw(table_id);
759        if _result.is_err() {
760            self.control_handle.shutdown();
761        }
762        self.drop_without_shutdown();
763        _result
764    }
765
766    /// Similar to "send" but does not shutdown the channel if an error occurs.
767    pub fn send_no_shutdown_on_err(self, mut table_id: u32) -> Result<(), fidl::Error> {
768        let _result = self.send_raw(table_id);
769        self.drop_without_shutdown();
770        _result
771    }
772
773    fn send_raw(&self, mut table_id: u32) -> Result<(), fidl::Error> {
774        self.control_handle.inner.send::<BaseRouteTableGetTableIdResponse>(
775            (table_id,),
776            self.tx_id,
777            0x7eab30c55edbfc15,
778            fidl::encoding::DynamicFlags::empty(),
779        )
780    }
781}
782
783#[must_use = "FIDL methods require a response to be sent"]
784#[derive(Debug)]
785pub struct BaseRouteTableRemoveResponder {
786    control_handle: std::mem::ManuallyDrop<BaseRouteTableControlHandle>,
787    tx_id: u32,
788}
789
790/// Set the the channel to be shutdown (see [`BaseRouteTableControlHandle::shutdown`])
791/// if the responder is dropped without sending a response, so that the client
792/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
793impl std::ops::Drop for BaseRouteTableRemoveResponder {
794    fn drop(&mut self) {
795        self.control_handle.shutdown();
796        // Safety: drops once, never accessed again
797        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
798    }
799}
800
801impl fdomain_client::fidl::Responder for BaseRouteTableRemoveResponder {
802    type ControlHandle = BaseRouteTableControlHandle;
803
804    fn control_handle(&self) -> &BaseRouteTableControlHandle {
805        &self.control_handle
806    }
807
808    fn drop_without_shutdown(mut self) {
809        // Safety: drops once, never accessed again due to mem::forget
810        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
811        // Prevent Drop from running (which would shut down the channel)
812        std::mem::forget(self);
813    }
814}
815
816impl BaseRouteTableRemoveResponder {
817    /// Sends a response to the FIDL transaction.
818    ///
819    /// Sets the channel to shutdown if an error occurs.
820    pub fn send(
821        self,
822        mut result: Result<(), BaseRouteTableRemoveError>,
823    ) -> Result<(), fidl::Error> {
824        let _result = self.send_raw(result);
825        if _result.is_err() {
826            self.control_handle.shutdown();
827        }
828        self.drop_without_shutdown();
829        _result
830    }
831
832    /// Similar to "send" but does not shutdown the channel if an error occurs.
833    pub fn send_no_shutdown_on_err(
834        self,
835        mut result: Result<(), BaseRouteTableRemoveError>,
836    ) -> Result<(), fidl::Error> {
837        let _result = self.send_raw(result);
838        self.drop_without_shutdown();
839        _result
840    }
841
842    fn send_raw(
843        &self,
844        mut result: Result<(), BaseRouteTableRemoveError>,
845    ) -> Result<(), fidl::Error> {
846        self.control_handle.inner.send::<fidl::encoding::ResultType<
847            fidl::encoding::EmptyStruct,
848            BaseRouteTableRemoveError,
849        >>(
850            result,
851            self.tx_id,
852            0xc42e58a5fc79426,
853            fidl::encoding::DynamicFlags::empty(),
854        )
855    }
856}
857
858#[must_use = "FIDL methods require a response to be sent"]
859#[derive(Debug)]
860pub struct BaseRouteTableGetAuthorizationForRouteTableResponder {
861    control_handle: std::mem::ManuallyDrop<BaseRouteTableControlHandle>,
862    tx_id: u32,
863}
864
865/// Set the the channel to be shutdown (see [`BaseRouteTableControlHandle::shutdown`])
866/// if the responder is dropped without sending a response, so that the client
867/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
868impl std::ops::Drop for BaseRouteTableGetAuthorizationForRouteTableResponder {
869    fn drop(&mut self) {
870        self.control_handle.shutdown();
871        // Safety: drops once, never accessed again
872        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
873    }
874}
875
876impl fdomain_client::fidl::Responder for BaseRouteTableGetAuthorizationForRouteTableResponder {
877    type ControlHandle = BaseRouteTableControlHandle;
878
879    fn control_handle(&self) -> &BaseRouteTableControlHandle {
880        &self.control_handle
881    }
882
883    fn drop_without_shutdown(mut self) {
884        // Safety: drops once, never accessed again due to mem::forget
885        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
886        // Prevent Drop from running (which would shut down the channel)
887        std::mem::forget(self);
888    }
889}
890
891impl BaseRouteTableGetAuthorizationForRouteTableResponder {
892    /// Sends a response to the FIDL transaction.
893    ///
894    /// Sets the channel to shutdown if an error occurs.
895    pub fn send(self, mut credential: GrantForRouteTableAuthorization) -> Result<(), fidl::Error> {
896        let _result = self.send_raw(credential);
897        if _result.is_err() {
898            self.control_handle.shutdown();
899        }
900        self.drop_without_shutdown();
901        _result
902    }
903
904    /// Similar to "send" but does not shutdown the channel if an error occurs.
905    pub fn send_no_shutdown_on_err(
906        self,
907        mut credential: GrantForRouteTableAuthorization,
908    ) -> Result<(), fidl::Error> {
909        let _result = self.send_raw(credential);
910        self.drop_without_shutdown();
911        _result
912    }
913
914    fn send_raw(&self, mut credential: GrantForRouteTableAuthorization) -> Result<(), fidl::Error> {
915        self.control_handle.inner.send::<BaseRouteTableGetAuthorizationForRouteTableResponse>(
916            (&mut credential,),
917            self.tx_id,
918            0x56a48c921ff3b6eb,
919            fidl::encoding::DynamicFlags::empty(),
920        )
921    }
922}
923
924#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
925pub struct BaseRuleSetMarker;
926
927impl fdomain_client::fidl::ProtocolMarker for BaseRuleSetMarker {
928    type Proxy = BaseRuleSetProxy;
929    type RequestStream = BaseRuleSetRequestStream;
930
931    const DEBUG_NAME: &'static str = "(anonymous) BaseRuleSet";
932}
933pub type BaseRuleSetAuthenticateForRouteTableResult = Result<(), AuthenticateForRouteTableError>;
934pub type BaseRuleSetRemoveRuleResult = Result<(), RuleSetError>;
935
936pub trait BaseRuleSetProxyInterface: Send + Sync {
937    type AuthenticateForRouteTableResponseFut: std::future::Future<
938            Output = Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error>,
939        > + Send;
940    fn r#authenticate_for_route_table(
941        &self,
942        table: u32,
943        token: fdomain_client::Event,
944    ) -> Self::AuthenticateForRouteTableResponseFut;
945    type RemoveRuleResponseFut: std::future::Future<Output = Result<BaseRuleSetRemoveRuleResult, fidl::Error>>
946        + Send;
947    fn r#remove_rule(&self, index: u32) -> Self::RemoveRuleResponseFut;
948    fn r#close(&self) -> Result<(), fidl::Error>;
949}
950
951#[derive(Debug, Clone)]
952pub struct BaseRuleSetProxy {
953    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
954}
955
956impl fdomain_client::fidl::Proxy for BaseRuleSetProxy {
957    type Protocol = BaseRuleSetMarker;
958
959    fn from_channel(inner: fdomain_client::Channel) -> Self {
960        Self::new(inner)
961    }
962
963    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
964        self.client.into_channel().map_err(|client| Self { client })
965    }
966
967    fn as_channel(&self) -> &fdomain_client::Channel {
968        self.client.as_channel()
969    }
970}
971
972impl BaseRuleSetProxy {
973    /// Create a new Proxy for fuchsia.net.routes.admin/BaseRuleSet.
974    pub fn new(channel: fdomain_client::Channel) -> Self {
975        let protocol_name = <BaseRuleSetMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
976        Self { client: fidl::client::Client::new(channel, protocol_name) }
977    }
978
979    /// Get a Stream of events from the remote end of the protocol.
980    ///
981    /// # Panics
982    ///
983    /// Panics if the event stream was already taken.
984    pub fn take_event_stream(&self) -> BaseRuleSetEventStream {
985        BaseRuleSetEventStream { event_receiver: self.client.take_event_receiver() }
986    }
987
988    /// Authenticates for a route table that will be used in an action.
989    pub fn r#authenticate_for_route_table(
990        &self,
991        mut table: u32,
992        mut token: fdomain_client::Event,
993    ) -> fidl::client::QueryResponseFut<
994        BaseRuleSetAuthenticateForRouteTableResult,
995        fdomain_client::fidl::FDomainResourceDialect,
996    > {
997        BaseRuleSetProxyInterface::r#authenticate_for_route_table(self, table, token)
998    }
999
1000    /// Removes a rule from this rule set.
1001    ///
1002    /// If the client tries to remove from an index that does not have a rule,
1003    /// the error `RULE_DOES_NOT_EXIST` will be returned.
1004    ///
1005    /// + request `index` the index of the rule.
1006    pub fn r#remove_rule(
1007        &self,
1008        mut index: u32,
1009    ) -> fidl::client::QueryResponseFut<
1010        BaseRuleSetRemoveRuleResult,
1011        fdomain_client::fidl::FDomainResourceDialect,
1012    > {
1013        BaseRuleSetProxyInterface::r#remove_rule(self, index)
1014    }
1015
1016    /// Removes all rules in the rule set and the underlying channel will be
1017    /// closed after the rules are removed.
1018    ///
1019    /// This method provides a way for synchronous closure.
1020    pub fn r#close(&self) -> Result<(), fidl::Error> {
1021        BaseRuleSetProxyInterface::r#close(self)
1022    }
1023}
1024
1025impl BaseRuleSetProxyInterface for BaseRuleSetProxy {
1026    type AuthenticateForRouteTableResponseFut = fidl::client::QueryResponseFut<
1027        BaseRuleSetAuthenticateForRouteTableResult,
1028        fdomain_client::fidl::FDomainResourceDialect,
1029    >;
1030    fn r#authenticate_for_route_table(
1031        &self,
1032        mut table: u32,
1033        mut token: fdomain_client::Event,
1034    ) -> Self::AuthenticateForRouteTableResponseFut {
1035        fn _decode(
1036            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1037        ) -> Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error> {
1038            let _response = fidl::client::decode_transaction_body::<
1039                fidl::encoding::ResultType<
1040                    fidl::encoding::EmptyStruct,
1041                    AuthenticateForRouteTableError,
1042                >,
1043                fdomain_client::fidl::FDomainResourceDialect,
1044                0x6fd845360ed9bc8f,
1045            >(_buf?)?;
1046            Ok(_response.map(|x| x))
1047        }
1048        self.client.send_query_and_decode::<
1049            ProofOfRouteTableAuthorization,
1050            BaseRuleSetAuthenticateForRouteTableResult,
1051        >(
1052            (table, token,),
1053            0x6fd845360ed9bc8f,
1054            fidl::encoding::DynamicFlags::empty(),
1055            _decode,
1056        )
1057    }
1058
1059    type RemoveRuleResponseFut = fidl::client::QueryResponseFut<
1060        BaseRuleSetRemoveRuleResult,
1061        fdomain_client::fidl::FDomainResourceDialect,
1062    >;
1063    fn r#remove_rule(&self, mut index: u32) -> Self::RemoveRuleResponseFut {
1064        fn _decode(
1065            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1066        ) -> Result<BaseRuleSetRemoveRuleResult, fidl::Error> {
1067            let _response = fidl::client::decode_transaction_body::<
1068                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
1069                fdomain_client::fidl::FDomainResourceDialect,
1070                0x2ae3d7e817cbff90,
1071            >(_buf?)?;
1072            Ok(_response.map(|x| x))
1073        }
1074        self.client
1075            .send_query_and_decode::<BaseRuleSetRemoveRuleRequest, BaseRuleSetRemoveRuleResult>(
1076                (index,),
1077                0x2ae3d7e817cbff90,
1078                fidl::encoding::DynamicFlags::empty(),
1079                _decode,
1080            )
1081    }
1082
1083    fn r#close(&self) -> Result<(), fidl::Error> {
1084        self.client.send::<fidl::encoding::EmptyPayload>(
1085            (),
1086            0x457e1753672d4073,
1087            fidl::encoding::DynamicFlags::empty(),
1088        )
1089    }
1090}
1091
1092pub struct BaseRuleSetEventStream {
1093    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
1094}
1095
1096impl std::marker::Unpin for BaseRuleSetEventStream {}
1097
1098impl futures::stream::FusedStream for BaseRuleSetEventStream {
1099    fn is_terminated(&self) -> bool {
1100        self.event_receiver.is_terminated()
1101    }
1102}
1103
1104impl futures::Stream for BaseRuleSetEventStream {
1105    type Item = Result<BaseRuleSetEvent, fidl::Error>;
1106
1107    fn poll_next(
1108        mut self: std::pin::Pin<&mut Self>,
1109        cx: &mut std::task::Context<'_>,
1110    ) -> std::task::Poll<Option<Self::Item>> {
1111        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1112            &mut self.event_receiver,
1113            cx
1114        )?) {
1115            Some(buf) => std::task::Poll::Ready(Some(BaseRuleSetEvent::decode(buf))),
1116            None => std::task::Poll::Ready(None),
1117        }
1118    }
1119}
1120
1121#[derive(Debug)]
1122pub enum BaseRuleSetEvent {}
1123
1124impl BaseRuleSetEvent {
1125    /// Decodes a message buffer as a [`BaseRuleSetEvent`].
1126    fn decode(
1127        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1128    ) -> Result<BaseRuleSetEvent, fidl::Error> {
1129        let (bytes, _handles) = buf.split_mut();
1130        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1131        debug_assert_eq!(tx_header.tx_id, 0);
1132        match tx_header.ordinal {
1133            _ => Err(fidl::Error::UnknownOrdinal {
1134                ordinal: tx_header.ordinal,
1135                protocol_name:
1136                    <BaseRuleSetMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1137            }),
1138        }
1139    }
1140}
1141
1142/// A Stream of incoming requests for fuchsia.net.routes.admin/BaseRuleSet.
1143pub struct BaseRuleSetRequestStream {
1144    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1145    is_terminated: bool,
1146}
1147
1148impl std::marker::Unpin for BaseRuleSetRequestStream {}
1149
1150impl futures::stream::FusedStream for BaseRuleSetRequestStream {
1151    fn is_terminated(&self) -> bool {
1152        self.is_terminated
1153    }
1154}
1155
1156impl fdomain_client::fidl::RequestStream for BaseRuleSetRequestStream {
1157    type Protocol = BaseRuleSetMarker;
1158    type ControlHandle = BaseRuleSetControlHandle;
1159
1160    fn from_channel(channel: fdomain_client::Channel) -> Self {
1161        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1162    }
1163
1164    fn control_handle(&self) -> Self::ControlHandle {
1165        BaseRuleSetControlHandle { inner: self.inner.clone() }
1166    }
1167
1168    fn into_inner(
1169        self,
1170    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1171    {
1172        (self.inner, self.is_terminated)
1173    }
1174
1175    fn from_inner(
1176        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1177        is_terminated: bool,
1178    ) -> Self {
1179        Self { inner, is_terminated }
1180    }
1181}
1182
1183impl futures::Stream for BaseRuleSetRequestStream {
1184    type Item = Result<BaseRuleSetRequest, fidl::Error>;
1185
1186    fn poll_next(
1187        mut self: std::pin::Pin<&mut Self>,
1188        cx: &mut std::task::Context<'_>,
1189    ) -> std::task::Poll<Option<Self::Item>> {
1190        let this = &mut *self;
1191        if this.inner.check_shutdown(cx) {
1192            this.is_terminated = true;
1193            return std::task::Poll::Ready(None);
1194        }
1195        if this.is_terminated {
1196            panic!("polled BaseRuleSetRequestStream after completion");
1197        }
1198        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1199            |bytes, handles| {
1200                match this.inner.channel().read_etc(cx, bytes, handles) {
1201                    std::task::Poll::Ready(Ok(())) => {}
1202                    std::task::Poll::Pending => return std::task::Poll::Pending,
1203                    std::task::Poll::Ready(Err(None)) => {
1204                        this.is_terminated = true;
1205                        return std::task::Poll::Ready(None);
1206                    }
1207                    std::task::Poll::Ready(Err(Some(e))) => {
1208                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1209                            e.into(),
1210                        ))));
1211                    }
1212                }
1213
1214                // A message has been received from the channel
1215                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1216
1217                std::task::Poll::Ready(Some(match header.ordinal {
1218                    0x6fd845360ed9bc8f => {
1219                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1220                        let mut req = fidl::new_empty!(
1221                            ProofOfRouteTableAuthorization,
1222                            fdomain_client::fidl::FDomainResourceDialect
1223                        );
1224                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<ProofOfRouteTableAuthorization>(&header, _body_bytes, handles, &mut req)?;
1225                        let control_handle = BaseRuleSetControlHandle { inner: this.inner.clone() };
1226                        Ok(BaseRuleSetRequest::AuthenticateForRouteTable {
1227                            table: req.table,
1228                            token: req.token,
1229
1230                            responder: BaseRuleSetAuthenticateForRouteTableResponder {
1231                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1232                                tx_id: header.tx_id,
1233                            },
1234                        })
1235                    }
1236                    0x2ae3d7e817cbff90 => {
1237                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1238                        let mut req = fidl::new_empty!(
1239                            BaseRuleSetRemoveRuleRequest,
1240                            fdomain_client::fidl::FDomainResourceDialect
1241                        );
1242                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<BaseRuleSetRemoveRuleRequest>(&header, _body_bytes, handles, &mut req)?;
1243                        let control_handle = BaseRuleSetControlHandle { inner: this.inner.clone() };
1244                        Ok(BaseRuleSetRequest::RemoveRule {
1245                            index: req.index,
1246
1247                            responder: BaseRuleSetRemoveRuleResponder {
1248                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1249                                tx_id: header.tx_id,
1250                            },
1251                        })
1252                    }
1253                    0x457e1753672d4073 => {
1254                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1255                        let mut req = fidl::new_empty!(
1256                            fidl::encoding::EmptyPayload,
1257                            fdomain_client::fidl::FDomainResourceDialect
1258                        );
1259                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1260                        let control_handle = BaseRuleSetControlHandle { inner: this.inner.clone() };
1261                        Ok(BaseRuleSetRequest::Close { control_handle })
1262                    }
1263                    _ => Err(fidl::Error::UnknownOrdinal {
1264                        ordinal: header.ordinal,
1265                        protocol_name:
1266                            <BaseRuleSetMarker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1267                    }),
1268                }))
1269            },
1270        )
1271    }
1272}
1273
1274/// Common base for `RuleSet` protocol that is IP version agnostic. This
1275/// helps reduce FIDL duplication.
1276#[derive(Debug)]
1277pub enum BaseRuleSetRequest {
1278    /// Authenticates for a route table that will be used in an action.
1279    AuthenticateForRouteTable {
1280        table: u32,
1281        token: fdomain_client::Event,
1282        responder: BaseRuleSetAuthenticateForRouteTableResponder,
1283    },
1284    /// Removes a rule from this rule set.
1285    ///
1286    /// If the client tries to remove from an index that does not have a rule,
1287    /// the error `RULE_DOES_NOT_EXIST` will be returned.
1288    ///
1289    /// + request `index` the index of the rule.
1290    RemoveRule { index: u32, responder: BaseRuleSetRemoveRuleResponder },
1291    /// Removes all rules in the rule set and the underlying channel will be
1292    /// closed after the rules are removed.
1293    ///
1294    /// This method provides a way for synchronous closure.
1295    Close { control_handle: BaseRuleSetControlHandle },
1296}
1297
1298impl BaseRuleSetRequest {
1299    #[allow(irrefutable_let_patterns)]
1300    pub fn into_authenticate_for_route_table(
1301        self,
1302    ) -> Option<(u32, fdomain_client::Event, BaseRuleSetAuthenticateForRouteTableResponder)> {
1303        if let BaseRuleSetRequest::AuthenticateForRouteTable { table, token, responder } = self {
1304            Some((table, token, responder))
1305        } else {
1306            None
1307        }
1308    }
1309
1310    #[allow(irrefutable_let_patterns)]
1311    pub fn into_remove_rule(self) -> Option<(u32, BaseRuleSetRemoveRuleResponder)> {
1312        if let BaseRuleSetRequest::RemoveRule { index, responder } = self {
1313            Some((index, responder))
1314        } else {
1315            None
1316        }
1317    }
1318
1319    #[allow(irrefutable_let_patterns)]
1320    pub fn into_close(self) -> Option<(BaseRuleSetControlHandle)> {
1321        if let BaseRuleSetRequest::Close { control_handle } = self {
1322            Some((control_handle))
1323        } else {
1324            None
1325        }
1326    }
1327
1328    /// Name of the method defined in FIDL
1329    pub fn method_name(&self) -> &'static str {
1330        match *self {
1331            BaseRuleSetRequest::AuthenticateForRouteTable { .. } => "authenticate_for_route_table",
1332            BaseRuleSetRequest::RemoveRule { .. } => "remove_rule",
1333            BaseRuleSetRequest::Close { .. } => "close",
1334        }
1335    }
1336}
1337
1338#[derive(Debug, Clone)]
1339pub struct BaseRuleSetControlHandle {
1340    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1341}
1342
1343impl BaseRuleSetControlHandle {
1344    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
1345        self.inner.shutdown_with_epitaph(status.into())
1346    }
1347}
1348
1349impl fdomain_client::fidl::ControlHandle for BaseRuleSetControlHandle {
1350    fn shutdown(&self) {
1351        self.inner.shutdown()
1352    }
1353
1354    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
1355        self.inner.shutdown_with_epitaph(status)
1356    }
1357
1358    fn is_closed(&self) -> bool {
1359        self.inner.channel().is_closed()
1360    }
1361    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
1362        self.inner.channel().on_closed()
1363    }
1364}
1365
1366impl BaseRuleSetControlHandle {}
1367
1368#[must_use = "FIDL methods require a response to be sent"]
1369#[derive(Debug)]
1370pub struct BaseRuleSetAuthenticateForRouteTableResponder {
1371    control_handle: std::mem::ManuallyDrop<BaseRuleSetControlHandle>,
1372    tx_id: u32,
1373}
1374
1375/// Set the the channel to be shutdown (see [`BaseRuleSetControlHandle::shutdown`])
1376/// if the responder is dropped without sending a response, so that the client
1377/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1378impl std::ops::Drop for BaseRuleSetAuthenticateForRouteTableResponder {
1379    fn drop(&mut self) {
1380        self.control_handle.shutdown();
1381        // Safety: drops once, never accessed again
1382        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1383    }
1384}
1385
1386impl fdomain_client::fidl::Responder for BaseRuleSetAuthenticateForRouteTableResponder {
1387    type ControlHandle = BaseRuleSetControlHandle;
1388
1389    fn control_handle(&self) -> &BaseRuleSetControlHandle {
1390        &self.control_handle
1391    }
1392
1393    fn drop_without_shutdown(mut self) {
1394        // Safety: drops once, never accessed again due to mem::forget
1395        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1396        // Prevent Drop from running (which would shut down the channel)
1397        std::mem::forget(self);
1398    }
1399}
1400
1401impl BaseRuleSetAuthenticateForRouteTableResponder {
1402    /// Sends a response to the FIDL transaction.
1403    ///
1404    /// Sets the channel to shutdown if an error occurs.
1405    pub fn send(
1406        self,
1407        mut result: Result<(), AuthenticateForRouteTableError>,
1408    ) -> Result<(), fidl::Error> {
1409        let _result = self.send_raw(result);
1410        if _result.is_err() {
1411            self.control_handle.shutdown();
1412        }
1413        self.drop_without_shutdown();
1414        _result
1415    }
1416
1417    /// Similar to "send" but does not shutdown the channel if an error occurs.
1418    pub fn send_no_shutdown_on_err(
1419        self,
1420        mut result: Result<(), AuthenticateForRouteTableError>,
1421    ) -> Result<(), fidl::Error> {
1422        let _result = self.send_raw(result);
1423        self.drop_without_shutdown();
1424        _result
1425    }
1426
1427    fn send_raw(
1428        &self,
1429        mut result: Result<(), AuthenticateForRouteTableError>,
1430    ) -> Result<(), fidl::Error> {
1431        self.control_handle.inner.send::<fidl::encoding::ResultType<
1432            fidl::encoding::EmptyStruct,
1433            AuthenticateForRouteTableError,
1434        >>(
1435            result,
1436            self.tx_id,
1437            0x6fd845360ed9bc8f,
1438            fidl::encoding::DynamicFlags::empty(),
1439        )
1440    }
1441}
1442
1443#[must_use = "FIDL methods require a response to be sent"]
1444#[derive(Debug)]
1445pub struct BaseRuleSetRemoveRuleResponder {
1446    control_handle: std::mem::ManuallyDrop<BaseRuleSetControlHandle>,
1447    tx_id: u32,
1448}
1449
1450/// Set the the channel to be shutdown (see [`BaseRuleSetControlHandle::shutdown`])
1451/// if the responder is dropped without sending a response, so that the client
1452/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1453impl std::ops::Drop for BaseRuleSetRemoveRuleResponder {
1454    fn drop(&mut self) {
1455        self.control_handle.shutdown();
1456        // Safety: drops once, never accessed again
1457        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1458    }
1459}
1460
1461impl fdomain_client::fidl::Responder for BaseRuleSetRemoveRuleResponder {
1462    type ControlHandle = BaseRuleSetControlHandle;
1463
1464    fn control_handle(&self) -> &BaseRuleSetControlHandle {
1465        &self.control_handle
1466    }
1467
1468    fn drop_without_shutdown(mut self) {
1469        // Safety: drops once, never accessed again due to mem::forget
1470        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1471        // Prevent Drop from running (which would shut down the channel)
1472        std::mem::forget(self);
1473    }
1474}
1475
1476impl BaseRuleSetRemoveRuleResponder {
1477    /// Sends a response to the FIDL transaction.
1478    ///
1479    /// Sets the channel to shutdown if an error occurs.
1480    pub fn send(self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
1481        let _result = self.send_raw(result);
1482        if _result.is_err() {
1483            self.control_handle.shutdown();
1484        }
1485        self.drop_without_shutdown();
1486        _result
1487    }
1488
1489    /// Similar to "send" but does not shutdown the channel if an error occurs.
1490    pub fn send_no_shutdown_on_err(
1491        self,
1492        mut result: Result<(), RuleSetError>,
1493    ) -> Result<(), fidl::Error> {
1494        let _result = self.send_raw(result);
1495        self.drop_without_shutdown();
1496        _result
1497    }
1498
1499    fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
1500        self.control_handle.inner.send::<fidl::encoding::ResultType<
1501            fidl::encoding::EmptyStruct,
1502            RuleSetError,
1503        >>(
1504            result,
1505            self.tx_id,
1506            0x2ae3d7e817cbff90,
1507            fidl::encoding::DynamicFlags::empty(),
1508        )
1509    }
1510}
1511
1512#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1513pub struct RouteSetV4Marker;
1514
1515impl fdomain_client::fidl::ProtocolMarker for RouteSetV4Marker {
1516    type Proxy = RouteSetV4Proxy;
1517    type RequestStream = RouteSetV4RequestStream;
1518
1519    const DEBUG_NAME: &'static str = "(anonymous) RouteSetV4";
1520}
1521pub type RouteSetV4AuthenticateForInterfaceResult = Result<(), AuthenticateForInterfaceError>;
1522pub type RouteSetV4AddRouteResult = Result<bool, RouteSetError>;
1523pub type RouteSetV4RemoveRouteResult = Result<bool, RouteSetError>;
1524
1525pub trait RouteSetV4ProxyInterface: Send + Sync {
1526    type AuthenticateForInterfaceResponseFut: std::future::Future<Output = Result<RouteSetV4AuthenticateForInterfaceResult, fidl::Error>>
1527        + Send;
1528    fn r#authenticate_for_interface(
1529        &self,
1530        credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
1531    ) -> Self::AuthenticateForInterfaceResponseFut;
1532    type AddRouteResponseFut: std::future::Future<Output = Result<RouteSetV4AddRouteResult, fidl::Error>>
1533        + Send;
1534    fn r#add_route(&self, route: &fdomain_fuchsia_net_routes::RouteV4)
1535    -> Self::AddRouteResponseFut;
1536    type RemoveRouteResponseFut: std::future::Future<Output = Result<RouteSetV4RemoveRouteResult, fidl::Error>>
1537        + Send;
1538    fn r#remove_route(
1539        &self,
1540        route: &fdomain_fuchsia_net_routes::RouteV4,
1541    ) -> Self::RemoveRouteResponseFut;
1542}
1543
1544#[derive(Debug, Clone)]
1545pub struct RouteSetV4Proxy {
1546    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
1547}
1548
1549impl fdomain_client::fidl::Proxy for RouteSetV4Proxy {
1550    type Protocol = RouteSetV4Marker;
1551
1552    fn from_channel(inner: fdomain_client::Channel) -> Self {
1553        Self::new(inner)
1554    }
1555
1556    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
1557        self.client.into_channel().map_err(|client| Self { client })
1558    }
1559
1560    fn as_channel(&self) -> &fdomain_client::Channel {
1561        self.client.as_channel()
1562    }
1563}
1564
1565impl RouteSetV4Proxy {
1566    /// Create a new Proxy for fuchsia.net.routes.admin/RouteSetV4.
1567    pub fn new(channel: fdomain_client::Channel) -> Self {
1568        let protocol_name = <RouteSetV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
1569        Self { client: fidl::client::Client::new(channel, protocol_name) }
1570    }
1571
1572    /// Get a Stream of events from the remote end of the protocol.
1573    ///
1574    /// # Panics
1575    ///
1576    /// Panics if the event stream was already taken.
1577    pub fn take_event_stream(&self) -> RouteSetV4EventStream {
1578        RouteSetV4EventStream { event_receiver: self.client.take_event_receiver() }
1579    }
1580
1581    /// Authenticate this route set to manage routes on the provided interface.
1582    /// Authentication is valid for the lifetime of the route set.
1583    ///
1584    /// + request `interface` the authentication credential for an interface.
1585    pub fn r#authenticate_for_interface(
1586        &self,
1587        mut credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
1588    ) -> fidl::client::QueryResponseFut<
1589        RouteSetV4AuthenticateForInterfaceResult,
1590        fdomain_client::fidl::FDomainResourceDialect,
1591    > {
1592        RouteSetV4ProxyInterface::r#authenticate_for_interface(self, credential)
1593    }
1594
1595    /// Adds a route to this route set.
1596    ///
1597    /// + request `route` the route to add.
1598    /// - response `did_add` true iff the route was added to this `RouteSet`
1599    ///            as a result of this call.
1600    pub fn r#add_route(
1601        &self,
1602        mut route: &fdomain_fuchsia_net_routes::RouteV4,
1603    ) -> fidl::client::QueryResponseFut<
1604        RouteSetV4AddRouteResult,
1605        fdomain_client::fidl::FDomainResourceDialect,
1606    > {
1607        RouteSetV4ProxyInterface::r#add_route(self, route)
1608    }
1609
1610    /// Removes a route from this route set.
1611    ///
1612    /// Note that if this route also exists other route sets, it will not be
1613    /// removed from the global routing table.
1614    ///
1615    /// + request `route` the route to remove.
1616    /// - response `did_remove` true iff the route was removed from this
1617    ///            `RouteSet` as a result of this call.
1618    pub fn r#remove_route(
1619        &self,
1620        mut route: &fdomain_fuchsia_net_routes::RouteV4,
1621    ) -> fidl::client::QueryResponseFut<
1622        RouteSetV4RemoveRouteResult,
1623        fdomain_client::fidl::FDomainResourceDialect,
1624    > {
1625        RouteSetV4ProxyInterface::r#remove_route(self, route)
1626    }
1627}
1628
1629impl RouteSetV4ProxyInterface for RouteSetV4Proxy {
1630    type AuthenticateForInterfaceResponseFut = fidl::client::QueryResponseFut<
1631        RouteSetV4AuthenticateForInterfaceResult,
1632        fdomain_client::fidl::FDomainResourceDialect,
1633    >;
1634    fn r#authenticate_for_interface(
1635        &self,
1636        mut credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
1637    ) -> Self::AuthenticateForInterfaceResponseFut {
1638        fn _decode(
1639            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1640        ) -> Result<RouteSetV4AuthenticateForInterfaceResult, fidl::Error> {
1641            let _response = fidl::client::decode_transaction_body::<
1642                fidl::encoding::ResultType<
1643                    fidl::encoding::EmptyStruct,
1644                    AuthenticateForInterfaceError,
1645                >,
1646                fdomain_client::fidl::FDomainResourceDialect,
1647                0x74841ceef127518e,
1648            >(_buf?)?;
1649            Ok(_response.map(|x| x))
1650        }
1651        self.client.send_query_and_decode::<
1652            RouteSetV4AuthenticateForInterfaceRequest,
1653            RouteSetV4AuthenticateForInterfaceResult,
1654        >(
1655            (&mut credential,),
1656            0x74841ceef127518e,
1657            fidl::encoding::DynamicFlags::empty(),
1658            _decode,
1659        )
1660    }
1661
1662    type AddRouteResponseFut = fidl::client::QueryResponseFut<
1663        RouteSetV4AddRouteResult,
1664        fdomain_client::fidl::FDomainResourceDialect,
1665    >;
1666    fn r#add_route(
1667        &self,
1668        mut route: &fdomain_fuchsia_net_routes::RouteV4,
1669    ) -> Self::AddRouteResponseFut {
1670        fn _decode(
1671            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1672        ) -> Result<RouteSetV4AddRouteResult, fidl::Error> {
1673            let _response = fidl::client::decode_transaction_body::<
1674                fidl::encoding::ResultType<RouteSetV4AddRouteResponse, RouteSetError>,
1675                fdomain_client::fidl::FDomainResourceDialect,
1676                0x4bd69e45539e8ec0,
1677            >(_buf?)?;
1678            Ok(_response.map(|x| x.did_add))
1679        }
1680        self.client.send_query_and_decode::<RouteSetV4AddRouteRequest, RouteSetV4AddRouteResult>(
1681            (route,),
1682            0x4bd69e45539e8ec0,
1683            fidl::encoding::DynamicFlags::empty(),
1684            _decode,
1685        )
1686    }
1687
1688    type RemoveRouteResponseFut = fidl::client::QueryResponseFut<
1689        RouteSetV4RemoveRouteResult,
1690        fdomain_client::fidl::FDomainResourceDialect,
1691    >;
1692    fn r#remove_route(
1693        &self,
1694        mut route: &fdomain_fuchsia_net_routes::RouteV4,
1695    ) -> Self::RemoveRouteResponseFut {
1696        fn _decode(
1697            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1698        ) -> Result<RouteSetV4RemoveRouteResult, fidl::Error> {
1699            let _response = fidl::client::decode_transaction_body::<
1700                fidl::encoding::ResultType<RouteSetV4RemoveRouteResponse, RouteSetError>,
1701                fdomain_client::fidl::FDomainResourceDialect,
1702                0x514f6880232f1665,
1703            >(_buf?)?;
1704            Ok(_response.map(|x| x.did_remove))
1705        }
1706        self.client
1707            .send_query_and_decode::<RouteSetV4RemoveRouteRequest, RouteSetV4RemoveRouteResult>(
1708                (route,),
1709                0x514f6880232f1665,
1710                fidl::encoding::DynamicFlags::empty(),
1711                _decode,
1712            )
1713    }
1714}
1715
1716pub struct RouteSetV4EventStream {
1717    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
1718}
1719
1720impl std::marker::Unpin for RouteSetV4EventStream {}
1721
1722impl futures::stream::FusedStream for RouteSetV4EventStream {
1723    fn is_terminated(&self) -> bool {
1724        self.event_receiver.is_terminated()
1725    }
1726}
1727
1728impl futures::Stream for RouteSetV4EventStream {
1729    type Item = Result<RouteSetV4Event, fidl::Error>;
1730
1731    fn poll_next(
1732        mut self: std::pin::Pin<&mut Self>,
1733        cx: &mut std::task::Context<'_>,
1734    ) -> std::task::Poll<Option<Self::Item>> {
1735        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1736            &mut self.event_receiver,
1737            cx
1738        )?) {
1739            Some(buf) => std::task::Poll::Ready(Some(RouteSetV4Event::decode(buf))),
1740            None => std::task::Poll::Ready(None),
1741        }
1742    }
1743}
1744
1745#[derive(Debug)]
1746pub enum RouteSetV4Event {}
1747
1748impl RouteSetV4Event {
1749    /// Decodes a message buffer as a [`RouteSetV4Event`].
1750    fn decode(
1751        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1752    ) -> Result<RouteSetV4Event, fidl::Error> {
1753        let (bytes, _handles) = buf.split_mut();
1754        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1755        debug_assert_eq!(tx_header.tx_id, 0);
1756        match tx_header.ordinal {
1757            _ => Err(fidl::Error::UnknownOrdinal {
1758                ordinal: tx_header.ordinal,
1759                protocol_name:
1760                    <RouteSetV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1761            }),
1762        }
1763    }
1764}
1765
1766/// A Stream of incoming requests for fuchsia.net.routes.admin/RouteSetV4.
1767pub struct RouteSetV4RequestStream {
1768    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1769    is_terminated: bool,
1770}
1771
1772impl std::marker::Unpin for RouteSetV4RequestStream {}
1773
1774impl futures::stream::FusedStream for RouteSetV4RequestStream {
1775    fn is_terminated(&self) -> bool {
1776        self.is_terminated
1777    }
1778}
1779
1780impl fdomain_client::fidl::RequestStream for RouteSetV4RequestStream {
1781    type Protocol = RouteSetV4Marker;
1782    type ControlHandle = RouteSetV4ControlHandle;
1783
1784    fn from_channel(channel: fdomain_client::Channel) -> Self {
1785        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1786    }
1787
1788    fn control_handle(&self) -> Self::ControlHandle {
1789        RouteSetV4ControlHandle { inner: self.inner.clone() }
1790    }
1791
1792    fn into_inner(
1793        self,
1794    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
1795    {
1796        (self.inner, self.is_terminated)
1797    }
1798
1799    fn from_inner(
1800        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
1801        is_terminated: bool,
1802    ) -> Self {
1803        Self { inner, is_terminated }
1804    }
1805}
1806
1807impl futures::Stream for RouteSetV4RequestStream {
1808    type Item = Result<RouteSetV4Request, fidl::Error>;
1809
1810    fn poll_next(
1811        mut self: std::pin::Pin<&mut Self>,
1812        cx: &mut std::task::Context<'_>,
1813    ) -> std::task::Poll<Option<Self::Item>> {
1814        let this = &mut *self;
1815        if this.inner.check_shutdown(cx) {
1816            this.is_terminated = true;
1817            return std::task::Poll::Ready(None);
1818        }
1819        if this.is_terminated {
1820            panic!("polled RouteSetV4RequestStream after completion");
1821        }
1822        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
1823            |bytes, handles| {
1824                match this.inner.channel().read_etc(cx, bytes, handles) {
1825                    std::task::Poll::Ready(Ok(())) => {}
1826                    std::task::Poll::Pending => return std::task::Poll::Pending,
1827                    std::task::Poll::Ready(Err(None)) => {
1828                        this.is_terminated = true;
1829                        return std::task::Poll::Ready(None);
1830                    }
1831                    std::task::Poll::Ready(Err(Some(e))) => {
1832                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1833                            e.into(),
1834                        ))));
1835                    }
1836                }
1837
1838                // A message has been received from the channel
1839                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1840
1841                std::task::Poll::Ready(Some(match header.ordinal {
1842                    0x74841ceef127518e => {
1843                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1844                        let mut req = fidl::new_empty!(
1845                            RouteSetV4AuthenticateForInterfaceRequest,
1846                            fdomain_client::fidl::FDomainResourceDialect
1847                        );
1848                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RouteSetV4AuthenticateForInterfaceRequest>(&header, _body_bytes, handles, &mut req)?;
1849                        let control_handle = RouteSetV4ControlHandle { inner: this.inner.clone() };
1850                        Ok(RouteSetV4Request::AuthenticateForInterface {
1851                            credential: req.credential,
1852
1853                            responder: RouteSetV4AuthenticateForInterfaceResponder {
1854                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1855                                tx_id: header.tx_id,
1856                            },
1857                        })
1858                    }
1859                    0x4bd69e45539e8ec0 => {
1860                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1861                        let mut req = fidl::new_empty!(
1862                            RouteSetV4AddRouteRequest,
1863                            fdomain_client::fidl::FDomainResourceDialect
1864                        );
1865                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RouteSetV4AddRouteRequest>(&header, _body_bytes, handles, &mut req)?;
1866                        let control_handle = RouteSetV4ControlHandle { inner: this.inner.clone() };
1867                        Ok(RouteSetV4Request::AddRoute {
1868                            route: req.route,
1869
1870                            responder: RouteSetV4AddRouteResponder {
1871                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1872                                tx_id: header.tx_id,
1873                            },
1874                        })
1875                    }
1876                    0x514f6880232f1665 => {
1877                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1878                        let mut req = fidl::new_empty!(
1879                            RouteSetV4RemoveRouteRequest,
1880                            fdomain_client::fidl::FDomainResourceDialect
1881                        );
1882                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RouteSetV4RemoveRouteRequest>(&header, _body_bytes, handles, &mut req)?;
1883                        let control_handle = RouteSetV4ControlHandle { inner: this.inner.clone() };
1884                        Ok(RouteSetV4Request::RemoveRoute {
1885                            route: req.route,
1886
1887                            responder: RouteSetV4RemoveRouteResponder {
1888                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1889                                tx_id: header.tx_id,
1890                            },
1891                        })
1892                    }
1893                    _ => Err(fidl::Error::UnknownOrdinal {
1894                        ordinal: header.ordinal,
1895                        protocol_name:
1896                            <RouteSetV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
1897                    }),
1898                }))
1899            },
1900        )
1901    }
1902}
1903
1904/// Provides mutable access over a set of system's IPv4 routes.
1905///
1906/// The system maintains a single global routing table. A route set offers an
1907/// isolated window into a subset of the global routing table: clients are free
1908/// to manage the routes within their own route set, but not the route set of
1909/// others. Thus the global routing table represents the union of all existing
1910/// route sets. A route must be removed from all route sets to which it belongs
1911/// before it will be removed from the global table.
1912///
1913/// This protocol encodes the lifetime of the route set. Closing the client end
1914/// removes the route set, and will also remove any routes that were
1915/// solely-owned by this route set.
1916///
1917/// Note that the system reserves the right to remove routes out from underneath
1918/// this route set. This will always manifest as a `removed` event on the
1919/// [`fuchsia.net.routes/WatcherV4`] protocol.
1920///
1921/// If the route table backing this route set is removed, then this protocol
1922/// will be closed with a `ZX_ERR_UNAVAILABLE` epitaph.
1923#[derive(Debug)]
1924pub enum RouteSetV4Request {
1925    /// Authenticate this route set to manage routes on the provided interface.
1926    /// Authentication is valid for the lifetime of the route set.
1927    ///
1928    /// + request `interface` the authentication credential for an interface.
1929    AuthenticateForInterface {
1930        credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
1931        responder: RouteSetV4AuthenticateForInterfaceResponder,
1932    },
1933    /// Adds a route to this route set.
1934    ///
1935    /// + request `route` the route to add.
1936    /// - response `did_add` true iff the route was added to this `RouteSet`
1937    ///            as a result of this call.
1938    AddRoute { route: fdomain_fuchsia_net_routes::RouteV4, responder: RouteSetV4AddRouteResponder },
1939    /// Removes a route from this route set.
1940    ///
1941    /// Note that if this route also exists other route sets, it will not be
1942    /// removed from the global routing table.
1943    ///
1944    /// + request `route` the route to remove.
1945    /// - response `did_remove` true iff the route was removed from this
1946    ///            `RouteSet` as a result of this call.
1947    RemoveRoute {
1948        route: fdomain_fuchsia_net_routes::RouteV4,
1949        responder: RouteSetV4RemoveRouteResponder,
1950    },
1951}
1952
1953impl RouteSetV4Request {
1954    #[allow(irrefutable_let_patterns)]
1955    pub fn into_authenticate_for_interface(
1956        self,
1957    ) -> Option<(
1958        fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
1959        RouteSetV4AuthenticateForInterfaceResponder,
1960    )> {
1961        if let RouteSetV4Request::AuthenticateForInterface { credential, responder } = self {
1962            Some((credential, responder))
1963        } else {
1964            None
1965        }
1966    }
1967
1968    #[allow(irrefutable_let_patterns)]
1969    pub fn into_add_route(
1970        self,
1971    ) -> Option<(fdomain_fuchsia_net_routes::RouteV4, RouteSetV4AddRouteResponder)> {
1972        if let RouteSetV4Request::AddRoute { route, responder } = self {
1973            Some((route, responder))
1974        } else {
1975            None
1976        }
1977    }
1978
1979    #[allow(irrefutable_let_patterns)]
1980    pub fn into_remove_route(
1981        self,
1982    ) -> Option<(fdomain_fuchsia_net_routes::RouteV4, RouteSetV4RemoveRouteResponder)> {
1983        if let RouteSetV4Request::RemoveRoute { route, responder } = self {
1984            Some((route, responder))
1985        } else {
1986            None
1987        }
1988    }
1989
1990    /// Name of the method defined in FIDL
1991    pub fn method_name(&self) -> &'static str {
1992        match *self {
1993            RouteSetV4Request::AuthenticateForInterface { .. } => "authenticate_for_interface",
1994            RouteSetV4Request::AddRoute { .. } => "add_route",
1995            RouteSetV4Request::RemoveRoute { .. } => "remove_route",
1996        }
1997    }
1998}
1999
2000#[derive(Debug, Clone)]
2001pub struct RouteSetV4ControlHandle {
2002    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2003}
2004
2005impl RouteSetV4ControlHandle {
2006    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2007        self.inner.shutdown_with_epitaph(status.into())
2008    }
2009}
2010
2011impl fdomain_client::fidl::ControlHandle for RouteSetV4ControlHandle {
2012    fn shutdown(&self) {
2013        self.inner.shutdown()
2014    }
2015
2016    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2017        self.inner.shutdown_with_epitaph(status)
2018    }
2019
2020    fn is_closed(&self) -> bool {
2021        self.inner.channel().is_closed()
2022    }
2023    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
2024        self.inner.channel().on_closed()
2025    }
2026}
2027
2028impl RouteSetV4ControlHandle {}
2029
2030#[must_use = "FIDL methods require a response to be sent"]
2031#[derive(Debug)]
2032pub struct RouteSetV4AuthenticateForInterfaceResponder {
2033    control_handle: std::mem::ManuallyDrop<RouteSetV4ControlHandle>,
2034    tx_id: u32,
2035}
2036
2037/// Set the the channel to be shutdown (see [`RouteSetV4ControlHandle::shutdown`])
2038/// if the responder is dropped without sending a response, so that the client
2039/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2040impl std::ops::Drop for RouteSetV4AuthenticateForInterfaceResponder {
2041    fn drop(&mut self) {
2042        self.control_handle.shutdown();
2043        // Safety: drops once, never accessed again
2044        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2045    }
2046}
2047
2048impl fdomain_client::fidl::Responder for RouteSetV4AuthenticateForInterfaceResponder {
2049    type ControlHandle = RouteSetV4ControlHandle;
2050
2051    fn control_handle(&self) -> &RouteSetV4ControlHandle {
2052        &self.control_handle
2053    }
2054
2055    fn drop_without_shutdown(mut self) {
2056        // Safety: drops once, never accessed again due to mem::forget
2057        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2058        // Prevent Drop from running (which would shut down the channel)
2059        std::mem::forget(self);
2060    }
2061}
2062
2063impl RouteSetV4AuthenticateForInterfaceResponder {
2064    /// Sends a response to the FIDL transaction.
2065    ///
2066    /// Sets the channel to shutdown if an error occurs.
2067    pub fn send(
2068        self,
2069        mut result: Result<(), AuthenticateForInterfaceError>,
2070    ) -> Result<(), fidl::Error> {
2071        let _result = self.send_raw(result);
2072        if _result.is_err() {
2073            self.control_handle.shutdown();
2074        }
2075        self.drop_without_shutdown();
2076        _result
2077    }
2078
2079    /// Similar to "send" but does not shutdown the channel if an error occurs.
2080    pub fn send_no_shutdown_on_err(
2081        self,
2082        mut result: Result<(), AuthenticateForInterfaceError>,
2083    ) -> Result<(), fidl::Error> {
2084        let _result = self.send_raw(result);
2085        self.drop_without_shutdown();
2086        _result
2087    }
2088
2089    fn send_raw(
2090        &self,
2091        mut result: Result<(), AuthenticateForInterfaceError>,
2092    ) -> Result<(), fidl::Error> {
2093        self.control_handle.inner.send::<fidl::encoding::ResultType<
2094            fidl::encoding::EmptyStruct,
2095            AuthenticateForInterfaceError,
2096        >>(
2097            result,
2098            self.tx_id,
2099            0x74841ceef127518e,
2100            fidl::encoding::DynamicFlags::empty(),
2101        )
2102    }
2103}
2104
2105#[must_use = "FIDL methods require a response to be sent"]
2106#[derive(Debug)]
2107pub struct RouteSetV4AddRouteResponder {
2108    control_handle: std::mem::ManuallyDrop<RouteSetV4ControlHandle>,
2109    tx_id: u32,
2110}
2111
2112/// Set the the channel to be shutdown (see [`RouteSetV4ControlHandle::shutdown`])
2113/// if the responder is dropped without sending a response, so that the client
2114/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2115impl std::ops::Drop for RouteSetV4AddRouteResponder {
2116    fn drop(&mut self) {
2117        self.control_handle.shutdown();
2118        // Safety: drops once, never accessed again
2119        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2120    }
2121}
2122
2123impl fdomain_client::fidl::Responder for RouteSetV4AddRouteResponder {
2124    type ControlHandle = RouteSetV4ControlHandle;
2125
2126    fn control_handle(&self) -> &RouteSetV4ControlHandle {
2127        &self.control_handle
2128    }
2129
2130    fn drop_without_shutdown(mut self) {
2131        // Safety: drops once, never accessed again due to mem::forget
2132        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2133        // Prevent Drop from running (which would shut down the channel)
2134        std::mem::forget(self);
2135    }
2136}
2137
2138impl RouteSetV4AddRouteResponder {
2139    /// Sends a response to the FIDL transaction.
2140    ///
2141    /// Sets the channel to shutdown if an error occurs.
2142    pub fn send(self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
2143        let _result = self.send_raw(result);
2144        if _result.is_err() {
2145            self.control_handle.shutdown();
2146        }
2147        self.drop_without_shutdown();
2148        _result
2149    }
2150
2151    /// Similar to "send" but does not shutdown the channel if an error occurs.
2152    pub fn send_no_shutdown_on_err(
2153        self,
2154        mut result: Result<bool, RouteSetError>,
2155    ) -> Result<(), fidl::Error> {
2156        let _result = self.send_raw(result);
2157        self.drop_without_shutdown();
2158        _result
2159    }
2160
2161    fn send_raw(&self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
2162        self.control_handle.inner.send::<fidl::encoding::ResultType<
2163            RouteSetV4AddRouteResponse,
2164            RouteSetError,
2165        >>(
2166            result.map(|did_add| (did_add,)),
2167            self.tx_id,
2168            0x4bd69e45539e8ec0,
2169            fidl::encoding::DynamicFlags::empty(),
2170        )
2171    }
2172}
2173
2174#[must_use = "FIDL methods require a response to be sent"]
2175#[derive(Debug)]
2176pub struct RouteSetV4RemoveRouteResponder {
2177    control_handle: std::mem::ManuallyDrop<RouteSetV4ControlHandle>,
2178    tx_id: u32,
2179}
2180
2181/// Set the the channel to be shutdown (see [`RouteSetV4ControlHandle::shutdown`])
2182/// if the responder is dropped without sending a response, so that the client
2183/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2184impl std::ops::Drop for RouteSetV4RemoveRouteResponder {
2185    fn drop(&mut self) {
2186        self.control_handle.shutdown();
2187        // Safety: drops once, never accessed again
2188        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2189    }
2190}
2191
2192impl fdomain_client::fidl::Responder for RouteSetV4RemoveRouteResponder {
2193    type ControlHandle = RouteSetV4ControlHandle;
2194
2195    fn control_handle(&self) -> &RouteSetV4ControlHandle {
2196        &self.control_handle
2197    }
2198
2199    fn drop_without_shutdown(mut self) {
2200        // Safety: drops once, never accessed again due to mem::forget
2201        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2202        // Prevent Drop from running (which would shut down the channel)
2203        std::mem::forget(self);
2204    }
2205}
2206
2207impl RouteSetV4RemoveRouteResponder {
2208    /// Sends a response to the FIDL transaction.
2209    ///
2210    /// Sets the channel to shutdown if an error occurs.
2211    pub fn send(self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
2212        let _result = self.send_raw(result);
2213        if _result.is_err() {
2214            self.control_handle.shutdown();
2215        }
2216        self.drop_without_shutdown();
2217        _result
2218    }
2219
2220    /// Similar to "send" but does not shutdown the channel if an error occurs.
2221    pub fn send_no_shutdown_on_err(
2222        self,
2223        mut result: Result<bool, RouteSetError>,
2224    ) -> Result<(), fidl::Error> {
2225        let _result = self.send_raw(result);
2226        self.drop_without_shutdown();
2227        _result
2228    }
2229
2230    fn send_raw(&self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
2231        self.control_handle.inner.send::<fidl::encoding::ResultType<
2232            RouteSetV4RemoveRouteResponse,
2233            RouteSetError,
2234        >>(
2235            result.map(|did_remove| (did_remove,)),
2236            self.tx_id,
2237            0x514f6880232f1665,
2238            fidl::encoding::DynamicFlags::empty(),
2239        )
2240    }
2241}
2242
2243#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2244pub struct RouteSetV6Marker;
2245
2246impl fdomain_client::fidl::ProtocolMarker for RouteSetV6Marker {
2247    type Proxy = RouteSetV6Proxy;
2248    type RequestStream = RouteSetV6RequestStream;
2249
2250    const DEBUG_NAME: &'static str = "(anonymous) RouteSetV6";
2251}
2252pub type RouteSetV6AuthenticateForInterfaceResult = Result<(), AuthenticateForInterfaceError>;
2253pub type RouteSetV6AddRouteResult = Result<bool, RouteSetError>;
2254pub type RouteSetV6RemoveRouteResult = Result<bool, RouteSetError>;
2255
2256pub trait RouteSetV6ProxyInterface: Send + Sync {
2257    type AuthenticateForInterfaceResponseFut: std::future::Future<Output = Result<RouteSetV6AuthenticateForInterfaceResult, fidl::Error>>
2258        + Send;
2259    fn r#authenticate_for_interface(
2260        &self,
2261        credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
2262    ) -> Self::AuthenticateForInterfaceResponseFut;
2263    type AddRouteResponseFut: std::future::Future<Output = Result<RouteSetV6AddRouteResult, fidl::Error>>
2264        + Send;
2265    fn r#add_route(&self, route: &fdomain_fuchsia_net_routes::RouteV6)
2266    -> Self::AddRouteResponseFut;
2267    type RemoveRouteResponseFut: std::future::Future<Output = Result<RouteSetV6RemoveRouteResult, fidl::Error>>
2268        + Send;
2269    fn r#remove_route(
2270        &self,
2271        route: &fdomain_fuchsia_net_routes::RouteV6,
2272    ) -> Self::RemoveRouteResponseFut;
2273}
2274
2275#[derive(Debug, Clone)]
2276pub struct RouteSetV6Proxy {
2277    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
2278}
2279
2280impl fdomain_client::fidl::Proxy for RouteSetV6Proxy {
2281    type Protocol = RouteSetV6Marker;
2282
2283    fn from_channel(inner: fdomain_client::Channel) -> Self {
2284        Self::new(inner)
2285    }
2286
2287    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
2288        self.client.into_channel().map_err(|client| Self { client })
2289    }
2290
2291    fn as_channel(&self) -> &fdomain_client::Channel {
2292        self.client.as_channel()
2293    }
2294}
2295
2296impl RouteSetV6Proxy {
2297    /// Create a new Proxy for fuchsia.net.routes.admin/RouteSetV6.
2298    pub fn new(channel: fdomain_client::Channel) -> Self {
2299        let protocol_name = <RouteSetV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
2300        Self { client: fidl::client::Client::new(channel, protocol_name) }
2301    }
2302
2303    /// Get a Stream of events from the remote end of the protocol.
2304    ///
2305    /// # Panics
2306    ///
2307    /// Panics if the event stream was already taken.
2308    pub fn take_event_stream(&self) -> RouteSetV6EventStream {
2309        RouteSetV6EventStream { event_receiver: self.client.take_event_receiver() }
2310    }
2311
2312    /// Authenticate this route set to manage routes on the provided interface.
2313    /// Authentication is valid for the lifetime of the route set.
2314    ///
2315    /// + request `interface` the authentication credential for an interface.
2316    pub fn r#authenticate_for_interface(
2317        &self,
2318        mut credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
2319    ) -> fidl::client::QueryResponseFut<
2320        RouteSetV6AuthenticateForInterfaceResult,
2321        fdomain_client::fidl::FDomainResourceDialect,
2322    > {
2323        RouteSetV6ProxyInterface::r#authenticate_for_interface(self, credential)
2324    }
2325
2326    /// Adds a route to this route set.
2327    ///
2328    /// + request `route` the route to add.
2329    /// - response `did_add` true iff the route was added to this `RouteSet`
2330    ///            as a result of this call.
2331    pub fn r#add_route(
2332        &self,
2333        mut route: &fdomain_fuchsia_net_routes::RouteV6,
2334    ) -> fidl::client::QueryResponseFut<
2335        RouteSetV6AddRouteResult,
2336        fdomain_client::fidl::FDomainResourceDialect,
2337    > {
2338        RouteSetV6ProxyInterface::r#add_route(self, route)
2339    }
2340
2341    /// Removes a route from this route set.
2342    ///
2343    /// Note that if this route also exists other route sets, it will not be
2344    /// removed from the global routing table.
2345    ///
2346    /// + request `route` the route to remove.
2347    /// - response `did_remove` true iff the route was removed from this
2348    ///            `RouteSet` as a result of this call.
2349    pub fn r#remove_route(
2350        &self,
2351        mut route: &fdomain_fuchsia_net_routes::RouteV6,
2352    ) -> fidl::client::QueryResponseFut<
2353        RouteSetV6RemoveRouteResult,
2354        fdomain_client::fidl::FDomainResourceDialect,
2355    > {
2356        RouteSetV6ProxyInterface::r#remove_route(self, route)
2357    }
2358}
2359
2360impl RouteSetV6ProxyInterface for RouteSetV6Proxy {
2361    type AuthenticateForInterfaceResponseFut = fidl::client::QueryResponseFut<
2362        RouteSetV6AuthenticateForInterfaceResult,
2363        fdomain_client::fidl::FDomainResourceDialect,
2364    >;
2365    fn r#authenticate_for_interface(
2366        &self,
2367        mut credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
2368    ) -> Self::AuthenticateForInterfaceResponseFut {
2369        fn _decode(
2370            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2371        ) -> Result<RouteSetV6AuthenticateForInterfaceResult, fidl::Error> {
2372            let _response = fidl::client::decode_transaction_body::<
2373                fidl::encoding::ResultType<
2374                    fidl::encoding::EmptyStruct,
2375                    AuthenticateForInterfaceError,
2376                >,
2377                fdomain_client::fidl::FDomainResourceDialect,
2378                0x7d63a6a7aed6f640,
2379            >(_buf?)?;
2380            Ok(_response.map(|x| x))
2381        }
2382        self.client.send_query_and_decode::<
2383            RouteSetV6AuthenticateForInterfaceRequest,
2384            RouteSetV6AuthenticateForInterfaceResult,
2385        >(
2386            (&mut credential,),
2387            0x7d63a6a7aed6f640,
2388            fidl::encoding::DynamicFlags::empty(),
2389            _decode,
2390        )
2391    }
2392
2393    type AddRouteResponseFut = fidl::client::QueryResponseFut<
2394        RouteSetV6AddRouteResult,
2395        fdomain_client::fidl::FDomainResourceDialect,
2396    >;
2397    fn r#add_route(
2398        &self,
2399        mut route: &fdomain_fuchsia_net_routes::RouteV6,
2400    ) -> Self::AddRouteResponseFut {
2401        fn _decode(
2402            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2403        ) -> Result<RouteSetV6AddRouteResult, fidl::Error> {
2404            let _response = fidl::client::decode_transaction_body::<
2405                fidl::encoding::ResultType<RouteSetV6AddRouteResponse, RouteSetError>,
2406                fdomain_client::fidl::FDomainResourceDialect,
2407                0x67a2bd2ee34ace2e,
2408            >(_buf?)?;
2409            Ok(_response.map(|x| x.did_add))
2410        }
2411        self.client.send_query_and_decode::<RouteSetV6AddRouteRequest, RouteSetV6AddRouteResult>(
2412            (route,),
2413            0x67a2bd2ee34ace2e,
2414            fidl::encoding::DynamicFlags::empty(),
2415            _decode,
2416        )
2417    }
2418
2419    type RemoveRouteResponseFut = fidl::client::QueryResponseFut<
2420        RouteSetV6RemoveRouteResult,
2421        fdomain_client::fidl::FDomainResourceDialect,
2422    >;
2423    fn r#remove_route(
2424        &self,
2425        mut route: &fdomain_fuchsia_net_routes::RouteV6,
2426    ) -> Self::RemoveRouteResponseFut {
2427        fn _decode(
2428            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2429        ) -> Result<RouteSetV6RemoveRouteResult, fidl::Error> {
2430            let _response = fidl::client::decode_transaction_body::<
2431                fidl::encoding::ResultType<RouteSetV6RemoveRouteResponse, RouteSetError>,
2432                fdomain_client::fidl::FDomainResourceDialect,
2433                0x4e5b7d4b1112cd82,
2434            >(_buf?)?;
2435            Ok(_response.map(|x| x.did_remove))
2436        }
2437        self.client
2438            .send_query_and_decode::<RouteSetV6RemoveRouteRequest, RouteSetV6RemoveRouteResult>(
2439                (route,),
2440                0x4e5b7d4b1112cd82,
2441                fidl::encoding::DynamicFlags::empty(),
2442                _decode,
2443            )
2444    }
2445}
2446
2447pub struct RouteSetV6EventStream {
2448    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
2449}
2450
2451impl std::marker::Unpin for RouteSetV6EventStream {}
2452
2453impl futures::stream::FusedStream for RouteSetV6EventStream {
2454    fn is_terminated(&self) -> bool {
2455        self.event_receiver.is_terminated()
2456    }
2457}
2458
2459impl futures::Stream for RouteSetV6EventStream {
2460    type Item = Result<RouteSetV6Event, fidl::Error>;
2461
2462    fn poll_next(
2463        mut self: std::pin::Pin<&mut Self>,
2464        cx: &mut std::task::Context<'_>,
2465    ) -> std::task::Poll<Option<Self::Item>> {
2466        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2467            &mut self.event_receiver,
2468            cx
2469        )?) {
2470            Some(buf) => std::task::Poll::Ready(Some(RouteSetV6Event::decode(buf))),
2471            None => std::task::Poll::Ready(None),
2472        }
2473    }
2474}
2475
2476#[derive(Debug)]
2477pub enum RouteSetV6Event {}
2478
2479impl RouteSetV6Event {
2480    /// Decodes a message buffer as a [`RouteSetV6Event`].
2481    fn decode(
2482        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2483    ) -> Result<RouteSetV6Event, fidl::Error> {
2484        let (bytes, _handles) = buf.split_mut();
2485        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2486        debug_assert_eq!(tx_header.tx_id, 0);
2487        match tx_header.ordinal {
2488            _ => Err(fidl::Error::UnknownOrdinal {
2489                ordinal: tx_header.ordinal,
2490                protocol_name:
2491                    <RouteSetV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2492            }),
2493        }
2494    }
2495}
2496
2497/// A Stream of incoming requests for fuchsia.net.routes.admin/RouteSetV6.
2498pub struct RouteSetV6RequestStream {
2499    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2500    is_terminated: bool,
2501}
2502
2503impl std::marker::Unpin for RouteSetV6RequestStream {}
2504
2505impl futures::stream::FusedStream for RouteSetV6RequestStream {
2506    fn is_terminated(&self) -> bool {
2507        self.is_terminated
2508    }
2509}
2510
2511impl fdomain_client::fidl::RequestStream for RouteSetV6RequestStream {
2512    type Protocol = RouteSetV6Marker;
2513    type ControlHandle = RouteSetV6ControlHandle;
2514
2515    fn from_channel(channel: fdomain_client::Channel) -> Self {
2516        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2517    }
2518
2519    fn control_handle(&self) -> Self::ControlHandle {
2520        RouteSetV6ControlHandle { inner: self.inner.clone() }
2521    }
2522
2523    fn into_inner(
2524        self,
2525    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
2526    {
2527        (self.inner, self.is_terminated)
2528    }
2529
2530    fn from_inner(
2531        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2532        is_terminated: bool,
2533    ) -> Self {
2534        Self { inner, is_terminated }
2535    }
2536}
2537
2538impl futures::Stream for RouteSetV6RequestStream {
2539    type Item = Result<RouteSetV6Request, fidl::Error>;
2540
2541    fn poll_next(
2542        mut self: std::pin::Pin<&mut Self>,
2543        cx: &mut std::task::Context<'_>,
2544    ) -> std::task::Poll<Option<Self::Item>> {
2545        let this = &mut *self;
2546        if this.inner.check_shutdown(cx) {
2547            this.is_terminated = true;
2548            return std::task::Poll::Ready(None);
2549        }
2550        if this.is_terminated {
2551            panic!("polled RouteSetV6RequestStream after completion");
2552        }
2553        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
2554            |bytes, handles| {
2555                match this.inner.channel().read_etc(cx, bytes, handles) {
2556                    std::task::Poll::Ready(Ok(())) => {}
2557                    std::task::Poll::Pending => return std::task::Poll::Pending,
2558                    std::task::Poll::Ready(Err(None)) => {
2559                        this.is_terminated = true;
2560                        return std::task::Poll::Ready(None);
2561                    }
2562                    std::task::Poll::Ready(Err(Some(e))) => {
2563                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2564                            e.into(),
2565                        ))));
2566                    }
2567                }
2568
2569                // A message has been received from the channel
2570                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2571
2572                std::task::Poll::Ready(Some(match header.ordinal {
2573                    0x7d63a6a7aed6f640 => {
2574                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2575                        let mut req = fidl::new_empty!(
2576                            RouteSetV6AuthenticateForInterfaceRequest,
2577                            fdomain_client::fidl::FDomainResourceDialect
2578                        );
2579                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RouteSetV6AuthenticateForInterfaceRequest>(&header, _body_bytes, handles, &mut req)?;
2580                        let control_handle = RouteSetV6ControlHandle { inner: this.inner.clone() };
2581                        Ok(RouteSetV6Request::AuthenticateForInterface {
2582                            credential: req.credential,
2583
2584                            responder: RouteSetV6AuthenticateForInterfaceResponder {
2585                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2586                                tx_id: header.tx_id,
2587                            },
2588                        })
2589                    }
2590                    0x67a2bd2ee34ace2e => {
2591                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2592                        let mut req = fidl::new_empty!(
2593                            RouteSetV6AddRouteRequest,
2594                            fdomain_client::fidl::FDomainResourceDialect
2595                        );
2596                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RouteSetV6AddRouteRequest>(&header, _body_bytes, handles, &mut req)?;
2597                        let control_handle = RouteSetV6ControlHandle { inner: this.inner.clone() };
2598                        Ok(RouteSetV6Request::AddRoute {
2599                            route: req.route,
2600
2601                            responder: RouteSetV6AddRouteResponder {
2602                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2603                                tx_id: header.tx_id,
2604                            },
2605                        })
2606                    }
2607                    0x4e5b7d4b1112cd82 => {
2608                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2609                        let mut req = fidl::new_empty!(
2610                            RouteSetV6RemoveRouteRequest,
2611                            fdomain_client::fidl::FDomainResourceDialect
2612                        );
2613                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RouteSetV6RemoveRouteRequest>(&header, _body_bytes, handles, &mut req)?;
2614                        let control_handle = RouteSetV6ControlHandle { inner: this.inner.clone() };
2615                        Ok(RouteSetV6Request::RemoveRoute {
2616                            route: req.route,
2617
2618                            responder: RouteSetV6RemoveRouteResponder {
2619                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2620                                tx_id: header.tx_id,
2621                            },
2622                        })
2623                    }
2624                    _ => Err(fidl::Error::UnknownOrdinal {
2625                        ordinal: header.ordinal,
2626                        protocol_name:
2627                            <RouteSetV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
2628                    }),
2629                }))
2630            },
2631        )
2632    }
2633}
2634
2635/// Provides mutable access over a set of system's IPv6 routes.
2636///
2637/// The system maintains a single global routing table. A route set offers an
2638/// isolated window into a subset of the global routing table: clients are free
2639/// to manage the routes within their own route set, but not the route set of
2640/// others. Thus the global routing table represents the union of all existing
2641/// route sets. A route must be removed from all route sets to which it belongs
2642/// before it will be removed from the global table.
2643///
2644/// This protocol encodes the lifetime of the route set. Closing the client end
2645/// removes the route set, and will also remove any routes that were
2646/// solely-owned by this route set.
2647///
2648/// Note that the system reserves the right to remove routes out from underneath
2649/// this route set. This will always manifest as a `removed` event on the
2650/// [`fuchsia.net.routes/WatcherV6`] protocol.
2651///
2652/// If the route table backing this route set is removed, then this protocol
2653/// will be closed with a `ZX_ERR_UNAVAILABLE` epitaph.
2654#[derive(Debug)]
2655pub enum RouteSetV6Request {
2656    /// Authenticate this route set to manage routes on the provided interface.
2657    /// Authentication is valid for the lifetime of the route set.
2658    ///
2659    /// + request `interface` the authentication credential for an interface.
2660    AuthenticateForInterface {
2661        credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
2662        responder: RouteSetV6AuthenticateForInterfaceResponder,
2663    },
2664    /// Adds a route to this route set.
2665    ///
2666    /// + request `route` the route to add.
2667    /// - response `did_add` true iff the route was added to this `RouteSet`
2668    ///            as a result of this call.
2669    AddRoute { route: fdomain_fuchsia_net_routes::RouteV6, responder: RouteSetV6AddRouteResponder },
2670    /// Removes a route from this route set.
2671    ///
2672    /// Note that if this route also exists other route sets, it will not be
2673    /// removed from the global routing table.
2674    ///
2675    /// + request `route` the route to remove.
2676    /// - response `did_remove` true iff the route was removed from this
2677    ///            `RouteSet` as a result of this call.
2678    RemoveRoute {
2679        route: fdomain_fuchsia_net_routes::RouteV6,
2680        responder: RouteSetV6RemoveRouteResponder,
2681    },
2682}
2683
2684impl RouteSetV6Request {
2685    #[allow(irrefutable_let_patterns)]
2686    pub fn into_authenticate_for_interface(
2687        self,
2688    ) -> Option<(
2689        fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
2690        RouteSetV6AuthenticateForInterfaceResponder,
2691    )> {
2692        if let RouteSetV6Request::AuthenticateForInterface { credential, responder } = self {
2693            Some((credential, responder))
2694        } else {
2695            None
2696        }
2697    }
2698
2699    #[allow(irrefutable_let_patterns)]
2700    pub fn into_add_route(
2701        self,
2702    ) -> Option<(fdomain_fuchsia_net_routes::RouteV6, RouteSetV6AddRouteResponder)> {
2703        if let RouteSetV6Request::AddRoute { route, responder } = self {
2704            Some((route, responder))
2705        } else {
2706            None
2707        }
2708    }
2709
2710    #[allow(irrefutable_let_patterns)]
2711    pub fn into_remove_route(
2712        self,
2713    ) -> Option<(fdomain_fuchsia_net_routes::RouteV6, RouteSetV6RemoveRouteResponder)> {
2714        if let RouteSetV6Request::RemoveRoute { route, responder } = self {
2715            Some((route, responder))
2716        } else {
2717            None
2718        }
2719    }
2720
2721    /// Name of the method defined in FIDL
2722    pub fn method_name(&self) -> &'static str {
2723        match *self {
2724            RouteSetV6Request::AuthenticateForInterface { .. } => "authenticate_for_interface",
2725            RouteSetV6Request::AddRoute { .. } => "add_route",
2726            RouteSetV6Request::RemoveRoute { .. } => "remove_route",
2727        }
2728    }
2729}
2730
2731#[derive(Debug, Clone)]
2732pub struct RouteSetV6ControlHandle {
2733    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
2734}
2735
2736impl RouteSetV6ControlHandle {
2737    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
2738        self.inner.shutdown_with_epitaph(status.into())
2739    }
2740}
2741
2742impl fdomain_client::fidl::ControlHandle for RouteSetV6ControlHandle {
2743    fn shutdown(&self) {
2744        self.inner.shutdown()
2745    }
2746
2747    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
2748        self.inner.shutdown_with_epitaph(status)
2749    }
2750
2751    fn is_closed(&self) -> bool {
2752        self.inner.channel().is_closed()
2753    }
2754    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
2755        self.inner.channel().on_closed()
2756    }
2757}
2758
2759impl RouteSetV6ControlHandle {}
2760
2761#[must_use = "FIDL methods require a response to be sent"]
2762#[derive(Debug)]
2763pub struct RouteSetV6AuthenticateForInterfaceResponder {
2764    control_handle: std::mem::ManuallyDrop<RouteSetV6ControlHandle>,
2765    tx_id: u32,
2766}
2767
2768/// Set the the channel to be shutdown (see [`RouteSetV6ControlHandle::shutdown`])
2769/// if the responder is dropped without sending a response, so that the client
2770/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2771impl std::ops::Drop for RouteSetV6AuthenticateForInterfaceResponder {
2772    fn drop(&mut self) {
2773        self.control_handle.shutdown();
2774        // Safety: drops once, never accessed again
2775        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2776    }
2777}
2778
2779impl fdomain_client::fidl::Responder for RouteSetV6AuthenticateForInterfaceResponder {
2780    type ControlHandle = RouteSetV6ControlHandle;
2781
2782    fn control_handle(&self) -> &RouteSetV6ControlHandle {
2783        &self.control_handle
2784    }
2785
2786    fn drop_without_shutdown(mut self) {
2787        // Safety: drops once, never accessed again due to mem::forget
2788        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2789        // Prevent Drop from running (which would shut down the channel)
2790        std::mem::forget(self);
2791    }
2792}
2793
2794impl RouteSetV6AuthenticateForInterfaceResponder {
2795    /// Sends a response to the FIDL transaction.
2796    ///
2797    /// Sets the channel to shutdown if an error occurs.
2798    pub fn send(
2799        self,
2800        mut result: Result<(), AuthenticateForInterfaceError>,
2801    ) -> Result<(), fidl::Error> {
2802        let _result = self.send_raw(result);
2803        if _result.is_err() {
2804            self.control_handle.shutdown();
2805        }
2806        self.drop_without_shutdown();
2807        _result
2808    }
2809
2810    /// Similar to "send" but does not shutdown the channel if an error occurs.
2811    pub fn send_no_shutdown_on_err(
2812        self,
2813        mut result: Result<(), AuthenticateForInterfaceError>,
2814    ) -> Result<(), fidl::Error> {
2815        let _result = self.send_raw(result);
2816        self.drop_without_shutdown();
2817        _result
2818    }
2819
2820    fn send_raw(
2821        &self,
2822        mut result: Result<(), AuthenticateForInterfaceError>,
2823    ) -> Result<(), fidl::Error> {
2824        self.control_handle.inner.send::<fidl::encoding::ResultType<
2825            fidl::encoding::EmptyStruct,
2826            AuthenticateForInterfaceError,
2827        >>(
2828            result,
2829            self.tx_id,
2830            0x7d63a6a7aed6f640,
2831            fidl::encoding::DynamicFlags::empty(),
2832        )
2833    }
2834}
2835
2836#[must_use = "FIDL methods require a response to be sent"]
2837#[derive(Debug)]
2838pub struct RouteSetV6AddRouteResponder {
2839    control_handle: std::mem::ManuallyDrop<RouteSetV6ControlHandle>,
2840    tx_id: u32,
2841}
2842
2843/// Set the the channel to be shutdown (see [`RouteSetV6ControlHandle::shutdown`])
2844/// if the responder is dropped without sending a response, so that the client
2845/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2846impl std::ops::Drop for RouteSetV6AddRouteResponder {
2847    fn drop(&mut self) {
2848        self.control_handle.shutdown();
2849        // Safety: drops once, never accessed again
2850        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2851    }
2852}
2853
2854impl fdomain_client::fidl::Responder for RouteSetV6AddRouteResponder {
2855    type ControlHandle = RouteSetV6ControlHandle;
2856
2857    fn control_handle(&self) -> &RouteSetV6ControlHandle {
2858        &self.control_handle
2859    }
2860
2861    fn drop_without_shutdown(mut self) {
2862        // Safety: drops once, never accessed again due to mem::forget
2863        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2864        // Prevent Drop from running (which would shut down the channel)
2865        std::mem::forget(self);
2866    }
2867}
2868
2869impl RouteSetV6AddRouteResponder {
2870    /// Sends a response to the FIDL transaction.
2871    ///
2872    /// Sets the channel to shutdown if an error occurs.
2873    pub fn send(self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
2874        let _result = self.send_raw(result);
2875        if _result.is_err() {
2876            self.control_handle.shutdown();
2877        }
2878        self.drop_without_shutdown();
2879        _result
2880    }
2881
2882    /// Similar to "send" but does not shutdown the channel if an error occurs.
2883    pub fn send_no_shutdown_on_err(
2884        self,
2885        mut result: Result<bool, RouteSetError>,
2886    ) -> Result<(), fidl::Error> {
2887        let _result = self.send_raw(result);
2888        self.drop_without_shutdown();
2889        _result
2890    }
2891
2892    fn send_raw(&self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
2893        self.control_handle.inner.send::<fidl::encoding::ResultType<
2894            RouteSetV6AddRouteResponse,
2895            RouteSetError,
2896        >>(
2897            result.map(|did_add| (did_add,)),
2898            self.tx_id,
2899            0x67a2bd2ee34ace2e,
2900            fidl::encoding::DynamicFlags::empty(),
2901        )
2902    }
2903}
2904
2905#[must_use = "FIDL methods require a response to be sent"]
2906#[derive(Debug)]
2907pub struct RouteSetV6RemoveRouteResponder {
2908    control_handle: std::mem::ManuallyDrop<RouteSetV6ControlHandle>,
2909    tx_id: u32,
2910}
2911
2912/// Set the the channel to be shutdown (see [`RouteSetV6ControlHandle::shutdown`])
2913/// if the responder is dropped without sending a response, so that the client
2914/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2915impl std::ops::Drop for RouteSetV6RemoveRouteResponder {
2916    fn drop(&mut self) {
2917        self.control_handle.shutdown();
2918        // Safety: drops once, never accessed again
2919        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2920    }
2921}
2922
2923impl fdomain_client::fidl::Responder for RouteSetV6RemoveRouteResponder {
2924    type ControlHandle = RouteSetV6ControlHandle;
2925
2926    fn control_handle(&self) -> &RouteSetV6ControlHandle {
2927        &self.control_handle
2928    }
2929
2930    fn drop_without_shutdown(mut self) {
2931        // Safety: drops once, never accessed again due to mem::forget
2932        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2933        // Prevent Drop from running (which would shut down the channel)
2934        std::mem::forget(self);
2935    }
2936}
2937
2938impl RouteSetV6RemoveRouteResponder {
2939    /// Sends a response to the FIDL transaction.
2940    ///
2941    /// Sets the channel to shutdown if an error occurs.
2942    pub fn send(self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
2943        let _result = self.send_raw(result);
2944        if _result.is_err() {
2945            self.control_handle.shutdown();
2946        }
2947        self.drop_without_shutdown();
2948        _result
2949    }
2950
2951    /// Similar to "send" but does not shutdown the channel if an error occurs.
2952    pub fn send_no_shutdown_on_err(
2953        self,
2954        mut result: Result<bool, RouteSetError>,
2955    ) -> Result<(), fidl::Error> {
2956        let _result = self.send_raw(result);
2957        self.drop_without_shutdown();
2958        _result
2959    }
2960
2961    fn send_raw(&self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
2962        self.control_handle.inner.send::<fidl::encoding::ResultType<
2963            RouteSetV6RemoveRouteResponse,
2964            RouteSetError,
2965        >>(
2966            result.map(|did_remove| (did_remove,)),
2967            self.tx_id,
2968            0x4e5b7d4b1112cd82,
2969            fidl::encoding::DynamicFlags::empty(),
2970        )
2971    }
2972}
2973
2974#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2975pub struct RouteTableProviderV4Marker;
2976
2977impl fdomain_client::fidl::ProtocolMarker for RouteTableProviderV4Marker {
2978    type Proxy = RouteTableProviderV4Proxy;
2979    type RequestStream = RouteTableProviderV4RequestStream;
2980
2981    const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RouteTableProviderV4";
2982}
2983impl fdomain_client::fidl::DiscoverableProtocolMarker for RouteTableProviderV4Marker {}
2984pub type RouteTableProviderV4GetInterfaceLocalTableResult =
2985    Result<fdomain_client::fidl::ClientEnd<RouteTableV4Marker>, GetInterfaceLocalTableError>;
2986
2987pub trait RouteTableProviderV4ProxyInterface: Send + Sync {
2988    fn r#new_route_table(
2989        &self,
2990        provider: fdomain_client::fidl::ServerEnd<RouteTableV4Marker>,
2991        options: &RouteTableOptionsV4,
2992    ) -> Result<(), fidl::Error>;
2993    type GetInterfaceLocalTableResponseFut: std::future::Future<
2994            Output = Result<RouteTableProviderV4GetInterfaceLocalTableResult, fidl::Error>,
2995        > + Send;
2996    fn r#get_interface_local_table(
2997        &self,
2998        credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
2999    ) -> Self::GetInterfaceLocalTableResponseFut;
3000}
3001
3002#[derive(Debug, Clone)]
3003pub struct RouteTableProviderV4Proxy {
3004    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
3005}
3006
3007impl fdomain_client::fidl::Proxy for RouteTableProviderV4Proxy {
3008    type Protocol = RouteTableProviderV4Marker;
3009
3010    fn from_channel(inner: fdomain_client::Channel) -> Self {
3011        Self::new(inner)
3012    }
3013
3014    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
3015        self.client.into_channel().map_err(|client| Self { client })
3016    }
3017
3018    fn as_channel(&self) -> &fdomain_client::Channel {
3019        self.client.as_channel()
3020    }
3021}
3022
3023impl RouteTableProviderV4Proxy {
3024    /// Create a new Proxy for fuchsia.net.routes.admin/RouteTableProviderV4.
3025    pub fn new(channel: fdomain_client::Channel) -> Self {
3026        let protocol_name =
3027            <RouteTableProviderV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
3028        Self { client: fidl::client::Client::new(channel, protocol_name) }
3029    }
3030
3031    /// Get a Stream of events from the remote end of the protocol.
3032    ///
3033    /// # Panics
3034    ///
3035    /// Panics if the event stream was already taken.
3036    pub fn take_event_stream(&self) -> RouteTableProviderV4EventStream {
3037        RouteTableProviderV4EventStream { event_receiver: self.client.take_event_receiver() }
3038    }
3039
3040    /// Creates a new route table. If the client end of the `provider` is
3041    /// closed, the route table is removed (unless detached).
3042    pub fn r#new_route_table(
3043        &self,
3044        mut provider: fdomain_client::fidl::ServerEnd<RouteTableV4Marker>,
3045        mut options: &RouteTableOptionsV4,
3046    ) -> Result<(), fidl::Error> {
3047        RouteTableProviderV4ProxyInterface::r#new_route_table(self, provider, options)
3048    }
3049
3050    /// Gets the interface-local route table for this interface.
3051    ///
3052    /// + request credential of the interface to get local route table.
3053    /// - response client end of the `RouteTableV4` protocol if successfully.
3054    ///
3055    /// This table is only removed after the interface is removed AND all
3056    /// outstanding `RouteTableV4` channels are closed.
3057    ///
3058    /// Calling detach on the route table is a no-op.
3059    pub fn r#get_interface_local_table(
3060        &self,
3061        mut credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
3062    ) -> fidl::client::QueryResponseFut<
3063        RouteTableProviderV4GetInterfaceLocalTableResult,
3064        fdomain_client::fidl::FDomainResourceDialect,
3065    > {
3066        RouteTableProviderV4ProxyInterface::r#get_interface_local_table(self, credential)
3067    }
3068}
3069
3070impl RouteTableProviderV4ProxyInterface for RouteTableProviderV4Proxy {
3071    fn r#new_route_table(
3072        &self,
3073        mut provider: fdomain_client::fidl::ServerEnd<RouteTableV4Marker>,
3074        mut options: &RouteTableOptionsV4,
3075    ) -> Result<(), fidl::Error> {
3076        self.client.send::<RouteTableProviderV4NewRouteTableRequest>(
3077            (provider, options),
3078            0x703bc0eaf98f07cf,
3079            fidl::encoding::DynamicFlags::empty(),
3080        )
3081    }
3082
3083    type GetInterfaceLocalTableResponseFut = fidl::client::QueryResponseFut<
3084        RouteTableProviderV4GetInterfaceLocalTableResult,
3085        fdomain_client::fidl::FDomainResourceDialect,
3086    >;
3087    fn r#get_interface_local_table(
3088        &self,
3089        mut credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
3090    ) -> Self::GetInterfaceLocalTableResponseFut {
3091        fn _decode(
3092            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3093        ) -> Result<RouteTableProviderV4GetInterfaceLocalTableResult, fidl::Error> {
3094            let _response = fidl::client::decode_transaction_body::<
3095                fidl::encoding::ResultType<
3096                    RouteTableProviderV4GetInterfaceLocalTableResponse,
3097                    GetInterfaceLocalTableError,
3098                >,
3099                fdomain_client::fidl::FDomainResourceDialect,
3100                0x2596721a63bbacbd,
3101            >(_buf?)?;
3102            Ok(_response.map(|x| x.route_table))
3103        }
3104        self.client.send_query_and_decode::<
3105            RouteTableProviderV4GetInterfaceLocalTableRequest,
3106            RouteTableProviderV4GetInterfaceLocalTableResult,
3107        >(
3108            (&mut credential,),
3109            0x2596721a63bbacbd,
3110            fidl::encoding::DynamicFlags::empty(),
3111            _decode,
3112        )
3113    }
3114}
3115
3116pub struct RouteTableProviderV4EventStream {
3117    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
3118}
3119
3120impl std::marker::Unpin for RouteTableProviderV4EventStream {}
3121
3122impl futures::stream::FusedStream for RouteTableProviderV4EventStream {
3123    fn is_terminated(&self) -> bool {
3124        self.event_receiver.is_terminated()
3125    }
3126}
3127
3128impl futures::Stream for RouteTableProviderV4EventStream {
3129    type Item = Result<RouteTableProviderV4Event, fidl::Error>;
3130
3131    fn poll_next(
3132        mut self: std::pin::Pin<&mut Self>,
3133        cx: &mut std::task::Context<'_>,
3134    ) -> std::task::Poll<Option<Self::Item>> {
3135        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3136            &mut self.event_receiver,
3137            cx
3138        )?) {
3139            Some(buf) => std::task::Poll::Ready(Some(RouteTableProviderV4Event::decode(buf))),
3140            None => std::task::Poll::Ready(None),
3141        }
3142    }
3143}
3144
3145#[derive(Debug)]
3146pub enum RouteTableProviderV4Event {}
3147
3148impl RouteTableProviderV4Event {
3149    /// Decodes a message buffer as a [`RouteTableProviderV4Event`].
3150    fn decode(
3151        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3152    ) -> Result<RouteTableProviderV4Event, fidl::Error> {
3153        let (bytes, _handles) = buf.split_mut();
3154        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3155        debug_assert_eq!(tx_header.tx_id, 0);
3156        match tx_header.ordinal {
3157            _ => Err(fidl::Error::UnknownOrdinal {
3158                ordinal: tx_header.ordinal,
3159                protocol_name:
3160                    <RouteTableProviderV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
3161            }),
3162        }
3163    }
3164}
3165
3166/// A Stream of incoming requests for fuchsia.net.routes.admin/RouteTableProviderV4.
3167pub struct RouteTableProviderV4RequestStream {
3168    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3169    is_terminated: bool,
3170}
3171
3172impl std::marker::Unpin for RouteTableProviderV4RequestStream {}
3173
3174impl futures::stream::FusedStream for RouteTableProviderV4RequestStream {
3175    fn is_terminated(&self) -> bool {
3176        self.is_terminated
3177    }
3178}
3179
3180impl fdomain_client::fidl::RequestStream for RouteTableProviderV4RequestStream {
3181    type Protocol = RouteTableProviderV4Marker;
3182    type ControlHandle = RouteTableProviderV4ControlHandle;
3183
3184    fn from_channel(channel: fdomain_client::Channel) -> Self {
3185        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3186    }
3187
3188    fn control_handle(&self) -> Self::ControlHandle {
3189        RouteTableProviderV4ControlHandle { inner: self.inner.clone() }
3190    }
3191
3192    fn into_inner(
3193        self,
3194    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
3195    {
3196        (self.inner, self.is_terminated)
3197    }
3198
3199    fn from_inner(
3200        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3201        is_terminated: bool,
3202    ) -> Self {
3203        Self { inner, is_terminated }
3204    }
3205}
3206
3207impl futures::Stream for RouteTableProviderV4RequestStream {
3208    type Item = Result<RouteTableProviderV4Request, fidl::Error>;
3209
3210    fn poll_next(
3211        mut self: std::pin::Pin<&mut Self>,
3212        cx: &mut std::task::Context<'_>,
3213    ) -> std::task::Poll<Option<Self::Item>> {
3214        let this = &mut *self;
3215        if this.inner.check_shutdown(cx) {
3216            this.is_terminated = true;
3217            return std::task::Poll::Ready(None);
3218        }
3219        if this.is_terminated {
3220            panic!("polled RouteTableProviderV4RequestStream after completion");
3221        }
3222        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
3223            |bytes, handles| {
3224                match this.inner.channel().read_etc(cx, bytes, handles) {
3225                    std::task::Poll::Ready(Ok(())) => {}
3226                    std::task::Poll::Pending => return std::task::Poll::Pending,
3227                    std::task::Poll::Ready(Err(None)) => {
3228                        this.is_terminated = true;
3229                        return std::task::Poll::Ready(None);
3230                    }
3231                    std::task::Poll::Ready(Err(Some(e))) => {
3232                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3233                            e.into(),
3234                        ))));
3235                    }
3236                }
3237
3238                // A message has been received from the channel
3239                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3240
3241                std::task::Poll::Ready(Some(match header.ordinal {
3242                0x703bc0eaf98f07cf => {
3243                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3244                    let mut req = fidl::new_empty!(RouteTableProviderV4NewRouteTableRequest, fdomain_client::fidl::FDomainResourceDialect);
3245                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RouteTableProviderV4NewRouteTableRequest>(&header, _body_bytes, handles, &mut req)?;
3246                    let control_handle = RouteTableProviderV4ControlHandle {
3247                        inner: this.inner.clone(),
3248                    };
3249                    Ok(RouteTableProviderV4Request::NewRouteTable {provider: req.provider,
3250options: req.options,
3251
3252                        control_handle,
3253                    })
3254                }
3255                0x2596721a63bbacbd => {
3256                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3257                    let mut req = fidl::new_empty!(RouteTableProviderV4GetInterfaceLocalTableRequest, fdomain_client::fidl::FDomainResourceDialect);
3258                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RouteTableProviderV4GetInterfaceLocalTableRequest>(&header, _body_bytes, handles, &mut req)?;
3259                    let control_handle = RouteTableProviderV4ControlHandle {
3260                        inner: this.inner.clone(),
3261                    };
3262                    Ok(RouteTableProviderV4Request::GetInterfaceLocalTable {credential: req.credential,
3263
3264                        responder: RouteTableProviderV4GetInterfaceLocalTableResponder {
3265                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3266                            tx_id: header.tx_id,
3267                        },
3268                    })
3269                }
3270                _ => Err(fidl::Error::UnknownOrdinal {
3271                    ordinal: header.ordinal,
3272                    protocol_name: <RouteTableProviderV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
3273                }),
3274            }))
3275            },
3276        )
3277    }
3278}
3279
3280/// This protocol allows the client to create route tables.
3281#[derive(Debug)]
3282pub enum RouteTableProviderV4Request {
3283    /// Creates a new route table. If the client end of the `provider` is
3284    /// closed, the route table is removed (unless detached).
3285    NewRouteTable {
3286        provider: fdomain_client::fidl::ServerEnd<RouteTableV4Marker>,
3287        options: RouteTableOptionsV4,
3288        control_handle: RouteTableProviderV4ControlHandle,
3289    },
3290    /// Gets the interface-local route table for this interface.
3291    ///
3292    /// + request credential of the interface to get local route table.
3293    /// - response client end of the `RouteTableV4` protocol if successfully.
3294    ///
3295    /// This table is only removed after the interface is removed AND all
3296    /// outstanding `RouteTableV4` channels are closed.
3297    ///
3298    /// Calling detach on the route table is a no-op.
3299    GetInterfaceLocalTable {
3300        credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
3301        responder: RouteTableProviderV4GetInterfaceLocalTableResponder,
3302    },
3303}
3304
3305impl RouteTableProviderV4Request {
3306    #[allow(irrefutable_let_patterns)]
3307    pub fn into_new_route_table(
3308        self,
3309    ) -> Option<(
3310        fdomain_client::fidl::ServerEnd<RouteTableV4Marker>,
3311        RouteTableOptionsV4,
3312        RouteTableProviderV4ControlHandle,
3313    )> {
3314        if let RouteTableProviderV4Request::NewRouteTable { provider, options, control_handle } =
3315            self
3316        {
3317            Some((provider, options, control_handle))
3318        } else {
3319            None
3320        }
3321    }
3322
3323    #[allow(irrefutable_let_patterns)]
3324    pub fn into_get_interface_local_table(
3325        self,
3326    ) -> Option<(
3327        fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
3328        RouteTableProviderV4GetInterfaceLocalTableResponder,
3329    )> {
3330        if let RouteTableProviderV4Request::GetInterfaceLocalTable { credential, responder } = self
3331        {
3332            Some((credential, responder))
3333        } else {
3334            None
3335        }
3336    }
3337
3338    /// Name of the method defined in FIDL
3339    pub fn method_name(&self) -> &'static str {
3340        match *self {
3341            RouteTableProviderV4Request::NewRouteTable { .. } => "new_route_table",
3342            RouteTableProviderV4Request::GetInterfaceLocalTable { .. } => {
3343                "get_interface_local_table"
3344            }
3345        }
3346    }
3347}
3348
3349#[derive(Debug, Clone)]
3350pub struct RouteTableProviderV4ControlHandle {
3351    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3352}
3353
3354impl RouteTableProviderV4ControlHandle {
3355    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3356        self.inner.shutdown_with_epitaph(status.into())
3357    }
3358}
3359
3360impl fdomain_client::fidl::ControlHandle for RouteTableProviderV4ControlHandle {
3361    fn shutdown(&self) {
3362        self.inner.shutdown()
3363    }
3364
3365    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3366        self.inner.shutdown_with_epitaph(status)
3367    }
3368
3369    fn is_closed(&self) -> bool {
3370        self.inner.channel().is_closed()
3371    }
3372    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
3373        self.inner.channel().on_closed()
3374    }
3375}
3376
3377impl RouteTableProviderV4ControlHandle {}
3378
3379#[must_use = "FIDL methods require a response to be sent"]
3380#[derive(Debug)]
3381pub struct RouteTableProviderV4GetInterfaceLocalTableResponder {
3382    control_handle: std::mem::ManuallyDrop<RouteTableProviderV4ControlHandle>,
3383    tx_id: u32,
3384}
3385
3386/// Set the the channel to be shutdown (see [`RouteTableProviderV4ControlHandle::shutdown`])
3387/// if the responder is dropped without sending a response, so that the client
3388/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3389impl std::ops::Drop for RouteTableProviderV4GetInterfaceLocalTableResponder {
3390    fn drop(&mut self) {
3391        self.control_handle.shutdown();
3392        // Safety: drops once, never accessed again
3393        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3394    }
3395}
3396
3397impl fdomain_client::fidl::Responder for RouteTableProviderV4GetInterfaceLocalTableResponder {
3398    type ControlHandle = RouteTableProviderV4ControlHandle;
3399
3400    fn control_handle(&self) -> &RouteTableProviderV4ControlHandle {
3401        &self.control_handle
3402    }
3403
3404    fn drop_without_shutdown(mut self) {
3405        // Safety: drops once, never accessed again due to mem::forget
3406        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3407        // Prevent Drop from running (which would shut down the channel)
3408        std::mem::forget(self);
3409    }
3410}
3411
3412impl RouteTableProviderV4GetInterfaceLocalTableResponder {
3413    /// Sends a response to the FIDL transaction.
3414    ///
3415    /// Sets the channel to shutdown if an error occurs.
3416    pub fn send(
3417        self,
3418        mut result: Result<
3419            fdomain_client::fidl::ClientEnd<RouteTableV4Marker>,
3420            GetInterfaceLocalTableError,
3421        >,
3422    ) -> Result<(), fidl::Error> {
3423        let _result = self.send_raw(result);
3424        if _result.is_err() {
3425            self.control_handle.shutdown();
3426        }
3427        self.drop_without_shutdown();
3428        _result
3429    }
3430
3431    /// Similar to "send" but does not shutdown the channel if an error occurs.
3432    pub fn send_no_shutdown_on_err(
3433        self,
3434        mut result: Result<
3435            fdomain_client::fidl::ClientEnd<RouteTableV4Marker>,
3436            GetInterfaceLocalTableError,
3437        >,
3438    ) -> Result<(), fidl::Error> {
3439        let _result = self.send_raw(result);
3440        self.drop_without_shutdown();
3441        _result
3442    }
3443
3444    fn send_raw(
3445        &self,
3446        mut result: Result<
3447            fdomain_client::fidl::ClientEnd<RouteTableV4Marker>,
3448            GetInterfaceLocalTableError,
3449        >,
3450    ) -> Result<(), fidl::Error> {
3451        self.control_handle.inner.send::<fidl::encoding::ResultType<
3452            RouteTableProviderV4GetInterfaceLocalTableResponse,
3453            GetInterfaceLocalTableError,
3454        >>(
3455            result.map(|route_table| (route_table,)),
3456            self.tx_id,
3457            0x2596721a63bbacbd,
3458            fidl::encoding::DynamicFlags::empty(),
3459        )
3460    }
3461}
3462
3463#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3464pub struct RouteTableProviderV6Marker;
3465
3466impl fdomain_client::fidl::ProtocolMarker for RouteTableProviderV6Marker {
3467    type Proxy = RouteTableProviderV6Proxy;
3468    type RequestStream = RouteTableProviderV6RequestStream;
3469
3470    const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RouteTableProviderV6";
3471}
3472impl fdomain_client::fidl::DiscoverableProtocolMarker for RouteTableProviderV6Marker {}
3473pub type RouteTableProviderV6GetInterfaceLocalTableResult =
3474    Result<fdomain_client::fidl::ClientEnd<RouteTableV6Marker>, GetInterfaceLocalTableError>;
3475
3476pub trait RouteTableProviderV6ProxyInterface: Send + Sync {
3477    fn r#new_route_table(
3478        &self,
3479        provider: fdomain_client::fidl::ServerEnd<RouteTableV6Marker>,
3480        options: &RouteTableOptionsV6,
3481    ) -> Result<(), fidl::Error>;
3482    type GetInterfaceLocalTableResponseFut: std::future::Future<
3483            Output = Result<RouteTableProviderV6GetInterfaceLocalTableResult, fidl::Error>,
3484        > + Send;
3485    fn r#get_interface_local_table(
3486        &self,
3487        credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
3488    ) -> Self::GetInterfaceLocalTableResponseFut;
3489}
3490
3491#[derive(Debug, Clone)]
3492pub struct RouteTableProviderV6Proxy {
3493    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
3494}
3495
3496impl fdomain_client::fidl::Proxy for RouteTableProviderV6Proxy {
3497    type Protocol = RouteTableProviderV6Marker;
3498
3499    fn from_channel(inner: fdomain_client::Channel) -> Self {
3500        Self::new(inner)
3501    }
3502
3503    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
3504        self.client.into_channel().map_err(|client| Self { client })
3505    }
3506
3507    fn as_channel(&self) -> &fdomain_client::Channel {
3508        self.client.as_channel()
3509    }
3510}
3511
3512impl RouteTableProviderV6Proxy {
3513    /// Create a new Proxy for fuchsia.net.routes.admin/RouteTableProviderV6.
3514    pub fn new(channel: fdomain_client::Channel) -> Self {
3515        let protocol_name =
3516            <RouteTableProviderV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
3517        Self { client: fidl::client::Client::new(channel, protocol_name) }
3518    }
3519
3520    /// Get a Stream of events from the remote end of the protocol.
3521    ///
3522    /// # Panics
3523    ///
3524    /// Panics if the event stream was already taken.
3525    pub fn take_event_stream(&self) -> RouteTableProviderV6EventStream {
3526        RouteTableProviderV6EventStream { event_receiver: self.client.take_event_receiver() }
3527    }
3528
3529    /// Creates a new route table. If the client end of the `provider` is
3530    /// closed, the route table is removed (unless detached).
3531    pub fn r#new_route_table(
3532        &self,
3533        mut provider: fdomain_client::fidl::ServerEnd<RouteTableV6Marker>,
3534        mut options: &RouteTableOptionsV6,
3535    ) -> Result<(), fidl::Error> {
3536        RouteTableProviderV6ProxyInterface::r#new_route_table(self, provider, options)
3537    }
3538
3539    /// Gets the interface-local route table for this interface.
3540    ///
3541    /// + request credential of the interface to get local route table.
3542    /// - response client end of the `RouteTableV6` protocol if successfully.
3543    ///
3544    /// This table is only removed after the interface is removed AND all
3545    /// outstanding `RouteTableV6` channels are closed.
3546    ///
3547    /// Calling detach on the route table is a no-op.
3548    pub fn r#get_interface_local_table(
3549        &self,
3550        mut credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
3551    ) -> fidl::client::QueryResponseFut<
3552        RouteTableProviderV6GetInterfaceLocalTableResult,
3553        fdomain_client::fidl::FDomainResourceDialect,
3554    > {
3555        RouteTableProviderV6ProxyInterface::r#get_interface_local_table(self, credential)
3556    }
3557}
3558
3559impl RouteTableProviderV6ProxyInterface for RouteTableProviderV6Proxy {
3560    fn r#new_route_table(
3561        &self,
3562        mut provider: fdomain_client::fidl::ServerEnd<RouteTableV6Marker>,
3563        mut options: &RouteTableOptionsV6,
3564    ) -> Result<(), fidl::Error> {
3565        self.client.send::<RouteTableProviderV6NewRouteTableRequest>(
3566            (provider, options),
3567            0x152b67b397a31ca,
3568            fidl::encoding::DynamicFlags::empty(),
3569        )
3570    }
3571
3572    type GetInterfaceLocalTableResponseFut = fidl::client::QueryResponseFut<
3573        RouteTableProviderV6GetInterfaceLocalTableResult,
3574        fdomain_client::fidl::FDomainResourceDialect,
3575    >;
3576    fn r#get_interface_local_table(
3577        &self,
3578        mut credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
3579    ) -> Self::GetInterfaceLocalTableResponseFut {
3580        fn _decode(
3581            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3582        ) -> Result<RouteTableProviderV6GetInterfaceLocalTableResult, fidl::Error> {
3583            let _response = fidl::client::decode_transaction_body::<
3584                fidl::encoding::ResultType<
3585                    RouteTableProviderV6GetInterfaceLocalTableResponse,
3586                    GetInterfaceLocalTableError,
3587                >,
3588                fdomain_client::fidl::FDomainResourceDialect,
3589                0x6f82c1d63c3081f5,
3590            >(_buf?)?;
3591            Ok(_response.map(|x| x.route_table))
3592        }
3593        self.client.send_query_and_decode::<
3594            RouteTableProviderV6GetInterfaceLocalTableRequest,
3595            RouteTableProviderV6GetInterfaceLocalTableResult,
3596        >(
3597            (&mut credential,),
3598            0x6f82c1d63c3081f5,
3599            fidl::encoding::DynamicFlags::empty(),
3600            _decode,
3601        )
3602    }
3603}
3604
3605pub struct RouteTableProviderV6EventStream {
3606    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
3607}
3608
3609impl std::marker::Unpin for RouteTableProviderV6EventStream {}
3610
3611impl futures::stream::FusedStream for RouteTableProviderV6EventStream {
3612    fn is_terminated(&self) -> bool {
3613        self.event_receiver.is_terminated()
3614    }
3615}
3616
3617impl futures::Stream for RouteTableProviderV6EventStream {
3618    type Item = Result<RouteTableProviderV6Event, fidl::Error>;
3619
3620    fn poll_next(
3621        mut self: std::pin::Pin<&mut Self>,
3622        cx: &mut std::task::Context<'_>,
3623    ) -> std::task::Poll<Option<Self::Item>> {
3624        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3625            &mut self.event_receiver,
3626            cx
3627        )?) {
3628            Some(buf) => std::task::Poll::Ready(Some(RouteTableProviderV6Event::decode(buf))),
3629            None => std::task::Poll::Ready(None),
3630        }
3631    }
3632}
3633
3634#[derive(Debug)]
3635pub enum RouteTableProviderV6Event {}
3636
3637impl RouteTableProviderV6Event {
3638    /// Decodes a message buffer as a [`RouteTableProviderV6Event`].
3639    fn decode(
3640        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3641    ) -> Result<RouteTableProviderV6Event, fidl::Error> {
3642        let (bytes, _handles) = buf.split_mut();
3643        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3644        debug_assert_eq!(tx_header.tx_id, 0);
3645        match tx_header.ordinal {
3646            _ => Err(fidl::Error::UnknownOrdinal {
3647                ordinal: tx_header.ordinal,
3648                protocol_name:
3649                    <RouteTableProviderV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
3650            }),
3651        }
3652    }
3653}
3654
3655/// A Stream of incoming requests for fuchsia.net.routes.admin/RouteTableProviderV6.
3656pub struct RouteTableProviderV6RequestStream {
3657    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3658    is_terminated: bool,
3659}
3660
3661impl std::marker::Unpin for RouteTableProviderV6RequestStream {}
3662
3663impl futures::stream::FusedStream for RouteTableProviderV6RequestStream {
3664    fn is_terminated(&self) -> bool {
3665        self.is_terminated
3666    }
3667}
3668
3669impl fdomain_client::fidl::RequestStream for RouteTableProviderV6RequestStream {
3670    type Protocol = RouteTableProviderV6Marker;
3671    type ControlHandle = RouteTableProviderV6ControlHandle;
3672
3673    fn from_channel(channel: fdomain_client::Channel) -> Self {
3674        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3675    }
3676
3677    fn control_handle(&self) -> Self::ControlHandle {
3678        RouteTableProviderV6ControlHandle { inner: self.inner.clone() }
3679    }
3680
3681    fn into_inner(
3682        self,
3683    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
3684    {
3685        (self.inner, self.is_terminated)
3686    }
3687
3688    fn from_inner(
3689        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3690        is_terminated: bool,
3691    ) -> Self {
3692        Self { inner, is_terminated }
3693    }
3694}
3695
3696impl futures::Stream for RouteTableProviderV6RequestStream {
3697    type Item = Result<RouteTableProviderV6Request, fidl::Error>;
3698
3699    fn poll_next(
3700        mut self: std::pin::Pin<&mut Self>,
3701        cx: &mut std::task::Context<'_>,
3702    ) -> std::task::Poll<Option<Self::Item>> {
3703        let this = &mut *self;
3704        if this.inner.check_shutdown(cx) {
3705            this.is_terminated = true;
3706            return std::task::Poll::Ready(None);
3707        }
3708        if this.is_terminated {
3709            panic!("polled RouteTableProviderV6RequestStream after completion");
3710        }
3711        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
3712            |bytes, handles| {
3713                match this.inner.channel().read_etc(cx, bytes, handles) {
3714                    std::task::Poll::Ready(Ok(())) => {}
3715                    std::task::Poll::Pending => return std::task::Poll::Pending,
3716                    std::task::Poll::Ready(Err(None)) => {
3717                        this.is_terminated = true;
3718                        return std::task::Poll::Ready(None);
3719                    }
3720                    std::task::Poll::Ready(Err(Some(e))) => {
3721                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3722                            e.into(),
3723                        ))));
3724                    }
3725                }
3726
3727                // A message has been received from the channel
3728                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3729
3730                std::task::Poll::Ready(Some(match header.ordinal {
3731                0x152b67b397a31ca => {
3732                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3733                    let mut req = fidl::new_empty!(RouteTableProviderV6NewRouteTableRequest, fdomain_client::fidl::FDomainResourceDialect);
3734                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RouteTableProviderV6NewRouteTableRequest>(&header, _body_bytes, handles, &mut req)?;
3735                    let control_handle = RouteTableProviderV6ControlHandle {
3736                        inner: this.inner.clone(),
3737                    };
3738                    Ok(RouteTableProviderV6Request::NewRouteTable {provider: req.provider,
3739options: req.options,
3740
3741                        control_handle,
3742                    })
3743                }
3744                0x6f82c1d63c3081f5 => {
3745                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3746                    let mut req = fidl::new_empty!(RouteTableProviderV6GetInterfaceLocalTableRequest, fdomain_client::fidl::FDomainResourceDialect);
3747                    fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RouteTableProviderV6GetInterfaceLocalTableRequest>(&header, _body_bytes, handles, &mut req)?;
3748                    let control_handle = RouteTableProviderV6ControlHandle {
3749                        inner: this.inner.clone(),
3750                    };
3751                    Ok(RouteTableProviderV6Request::GetInterfaceLocalTable {credential: req.credential,
3752
3753                        responder: RouteTableProviderV6GetInterfaceLocalTableResponder {
3754                            control_handle: std::mem::ManuallyDrop::new(control_handle),
3755                            tx_id: header.tx_id,
3756                        },
3757                    })
3758                }
3759                _ => Err(fidl::Error::UnknownOrdinal {
3760                    ordinal: header.ordinal,
3761                    protocol_name: <RouteTableProviderV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
3762                }),
3763            }))
3764            },
3765        )
3766    }
3767}
3768
3769/// This protocol allows the client to create route tables.
3770#[derive(Debug)]
3771pub enum RouteTableProviderV6Request {
3772    /// Creates a new route table. If the client end of the `provider` is
3773    /// closed, the route table is removed (unless detached).
3774    NewRouteTable {
3775        provider: fdomain_client::fidl::ServerEnd<RouteTableV6Marker>,
3776        options: RouteTableOptionsV6,
3777        control_handle: RouteTableProviderV6ControlHandle,
3778    },
3779    /// Gets the interface-local route table for this interface.
3780    ///
3781    /// + request credential of the interface to get local route table.
3782    /// - response client end of the `RouteTableV6` protocol if successfully.
3783    ///
3784    /// This table is only removed after the interface is removed AND all
3785    /// outstanding `RouteTableV6` channels are closed.
3786    ///
3787    /// Calling detach on the route table is a no-op.
3788    GetInterfaceLocalTable {
3789        credential: fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
3790        responder: RouteTableProviderV6GetInterfaceLocalTableResponder,
3791    },
3792}
3793
3794impl RouteTableProviderV6Request {
3795    #[allow(irrefutable_let_patterns)]
3796    pub fn into_new_route_table(
3797        self,
3798    ) -> Option<(
3799        fdomain_client::fidl::ServerEnd<RouteTableV6Marker>,
3800        RouteTableOptionsV6,
3801        RouteTableProviderV6ControlHandle,
3802    )> {
3803        if let RouteTableProviderV6Request::NewRouteTable { provider, options, control_handle } =
3804            self
3805        {
3806            Some((provider, options, control_handle))
3807        } else {
3808            None
3809        }
3810    }
3811
3812    #[allow(irrefutable_let_patterns)]
3813    pub fn into_get_interface_local_table(
3814        self,
3815    ) -> Option<(
3816        fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
3817        RouteTableProviderV6GetInterfaceLocalTableResponder,
3818    )> {
3819        if let RouteTableProviderV6Request::GetInterfaceLocalTable { credential, responder } = self
3820        {
3821            Some((credential, responder))
3822        } else {
3823            None
3824        }
3825    }
3826
3827    /// Name of the method defined in FIDL
3828    pub fn method_name(&self) -> &'static str {
3829        match *self {
3830            RouteTableProviderV6Request::NewRouteTable { .. } => "new_route_table",
3831            RouteTableProviderV6Request::GetInterfaceLocalTable { .. } => {
3832                "get_interface_local_table"
3833            }
3834        }
3835    }
3836}
3837
3838#[derive(Debug, Clone)]
3839pub struct RouteTableProviderV6ControlHandle {
3840    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
3841}
3842
3843impl RouteTableProviderV6ControlHandle {
3844    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
3845        self.inner.shutdown_with_epitaph(status.into())
3846    }
3847}
3848
3849impl fdomain_client::fidl::ControlHandle for RouteTableProviderV6ControlHandle {
3850    fn shutdown(&self) {
3851        self.inner.shutdown()
3852    }
3853
3854    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
3855        self.inner.shutdown_with_epitaph(status)
3856    }
3857
3858    fn is_closed(&self) -> bool {
3859        self.inner.channel().is_closed()
3860    }
3861    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
3862        self.inner.channel().on_closed()
3863    }
3864}
3865
3866impl RouteTableProviderV6ControlHandle {}
3867
3868#[must_use = "FIDL methods require a response to be sent"]
3869#[derive(Debug)]
3870pub struct RouteTableProviderV6GetInterfaceLocalTableResponder {
3871    control_handle: std::mem::ManuallyDrop<RouteTableProviderV6ControlHandle>,
3872    tx_id: u32,
3873}
3874
3875/// Set the the channel to be shutdown (see [`RouteTableProviderV6ControlHandle::shutdown`])
3876/// if the responder is dropped without sending a response, so that the client
3877/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3878impl std::ops::Drop for RouteTableProviderV6GetInterfaceLocalTableResponder {
3879    fn drop(&mut self) {
3880        self.control_handle.shutdown();
3881        // Safety: drops once, never accessed again
3882        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3883    }
3884}
3885
3886impl fdomain_client::fidl::Responder for RouteTableProviderV6GetInterfaceLocalTableResponder {
3887    type ControlHandle = RouteTableProviderV6ControlHandle;
3888
3889    fn control_handle(&self) -> &RouteTableProviderV6ControlHandle {
3890        &self.control_handle
3891    }
3892
3893    fn drop_without_shutdown(mut self) {
3894        // Safety: drops once, never accessed again due to mem::forget
3895        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3896        // Prevent Drop from running (which would shut down the channel)
3897        std::mem::forget(self);
3898    }
3899}
3900
3901impl RouteTableProviderV6GetInterfaceLocalTableResponder {
3902    /// Sends a response to the FIDL transaction.
3903    ///
3904    /// Sets the channel to shutdown if an error occurs.
3905    pub fn send(
3906        self,
3907        mut result: Result<
3908            fdomain_client::fidl::ClientEnd<RouteTableV6Marker>,
3909            GetInterfaceLocalTableError,
3910        >,
3911    ) -> Result<(), fidl::Error> {
3912        let _result = self.send_raw(result);
3913        if _result.is_err() {
3914            self.control_handle.shutdown();
3915        }
3916        self.drop_without_shutdown();
3917        _result
3918    }
3919
3920    /// Similar to "send" but does not shutdown the channel if an error occurs.
3921    pub fn send_no_shutdown_on_err(
3922        self,
3923        mut result: Result<
3924            fdomain_client::fidl::ClientEnd<RouteTableV6Marker>,
3925            GetInterfaceLocalTableError,
3926        >,
3927    ) -> Result<(), fidl::Error> {
3928        let _result = self.send_raw(result);
3929        self.drop_without_shutdown();
3930        _result
3931    }
3932
3933    fn send_raw(
3934        &self,
3935        mut result: Result<
3936            fdomain_client::fidl::ClientEnd<RouteTableV6Marker>,
3937            GetInterfaceLocalTableError,
3938        >,
3939    ) -> Result<(), fidl::Error> {
3940        self.control_handle.inner.send::<fidl::encoding::ResultType<
3941            RouteTableProviderV6GetInterfaceLocalTableResponse,
3942            GetInterfaceLocalTableError,
3943        >>(
3944            result.map(|route_table| (route_table,)),
3945            self.tx_id,
3946            0x6f82c1d63c3081f5,
3947            fidl::encoding::DynamicFlags::empty(),
3948        )
3949    }
3950}
3951
3952#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3953pub struct RouteTableV4Marker;
3954
3955impl fdomain_client::fidl::ProtocolMarker for RouteTableV4Marker {
3956    type Proxy = RouteTableV4Proxy;
3957    type RequestStream = RouteTableV4RequestStream;
3958
3959    const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RouteTableV4";
3960}
3961impl fdomain_client::fidl::DiscoverableProtocolMarker for RouteTableV4Marker {}
3962
3963pub trait RouteTableV4ProxyInterface: Send + Sync {
3964    type GetTableIdResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
3965    fn r#get_table_id(&self) -> Self::GetTableIdResponseFut;
3966    fn r#detach(&self) -> Result<(), fidl::Error>;
3967    type RemoveResponseFut: std::future::Future<Output = Result<BaseRouteTableRemoveResult, fidl::Error>>
3968        + Send;
3969    fn r#remove(&self) -> Self::RemoveResponseFut;
3970    type GetAuthorizationForRouteTableResponseFut: std::future::Future<Output = Result<GrantForRouteTableAuthorization, fidl::Error>>
3971        + Send;
3972    fn r#get_authorization_for_route_table(&self)
3973    -> Self::GetAuthorizationForRouteTableResponseFut;
3974    fn r#new_route_set(
3975        &self,
3976        route_set: fdomain_client::fidl::ServerEnd<RouteSetV4Marker>,
3977    ) -> Result<(), fidl::Error>;
3978}
3979
3980#[derive(Debug, Clone)]
3981pub struct RouteTableV4Proxy {
3982    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
3983}
3984
3985impl fdomain_client::fidl::Proxy for RouteTableV4Proxy {
3986    type Protocol = RouteTableV4Marker;
3987
3988    fn from_channel(inner: fdomain_client::Channel) -> Self {
3989        Self::new(inner)
3990    }
3991
3992    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
3993        self.client.into_channel().map_err(|client| Self { client })
3994    }
3995
3996    fn as_channel(&self) -> &fdomain_client::Channel {
3997        self.client.as_channel()
3998    }
3999}
4000
4001impl RouteTableV4Proxy {
4002    /// Create a new Proxy for fuchsia.net.routes.admin/RouteTableV4.
4003    pub fn new(channel: fdomain_client::Channel) -> Self {
4004        let protocol_name =
4005            <RouteTableV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
4006        Self { client: fidl::client::Client::new(channel, protocol_name) }
4007    }
4008
4009    /// Get a Stream of events from the remote end of the protocol.
4010    ///
4011    /// # Panics
4012    ///
4013    /// Panics if the event stream was already taken.
4014    pub fn take_event_stream(&self) -> RouteTableV4EventStream {
4015        RouteTableV4EventStream { event_receiver: self.client.take_event_receiver() }
4016    }
4017
4018    /// Gets the table ID for this table.
4019    pub fn r#get_table_id(
4020        &self,
4021    ) -> fidl::client::QueryResponseFut<u32, fdomain_client::fidl::FDomainResourceDialect> {
4022        RouteTableV4ProxyInterface::r#get_table_id(self)
4023    }
4024
4025    /// Detaches the lifetime of the route table from the lifetime of the
4026    /// client end of the channel.
4027    ///
4028    /// After this method is called, the route table will not be removed
4029    /// if the client end is closed. It's a no-op if called on the main table.
4030    pub fn r#detach(&self) -> Result<(), fidl::Error> {
4031        RouteTableV4ProxyInterface::r#detach(self)
4032    }
4033
4034    /// Removes the route table explicitly.
4035    ///
4036    /// This method cannot be called on the main table or an interface-local
4037    /// table, an error will be returned if called. The server will close the
4038    /// channel after this method successfully returns.
4039    pub fn r#remove(
4040        &self,
4041    ) -> fidl::client::QueryResponseFut<
4042        BaseRouteTableRemoveResult,
4043        fdomain_client::fidl::FDomainResourceDialect,
4044    > {
4045        RouteTableV4ProxyInterface::r#remove(self)
4046    }
4047
4048    /// Gets an authentication credential for this table.
4049    ///
4050    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
4051    /// held by the server. This credential can be passed into
4052    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
4053    /// table. The `EVENT` is stable throughout the lifetime of the route table.
4054    /// Clients may duplicate this `EVENT` to make multiple API calls, or
4055    /// transfer the `EVENT` to other clients.
4056    ///
4057    /// - response `credential` the authorization credential for this table.
4058    pub fn r#get_authorization_for_route_table(
4059        &self,
4060    ) -> fidl::client::QueryResponseFut<
4061        GrantForRouteTableAuthorization,
4062        fdomain_client::fidl::FDomainResourceDialect,
4063    > {
4064        RouteTableV4ProxyInterface::r#get_authorization_for_route_table(self)
4065    }
4066
4067    /// Creates an empty route set.
4068    ///
4069    /// + request `route_set` grants access to the [`RouteSetV4`] protocol.
4070    pub fn r#new_route_set(
4071        &self,
4072        mut route_set: fdomain_client::fidl::ServerEnd<RouteSetV4Marker>,
4073    ) -> Result<(), fidl::Error> {
4074        RouteTableV4ProxyInterface::r#new_route_set(self, route_set)
4075    }
4076}
4077
4078impl RouteTableV4ProxyInterface for RouteTableV4Proxy {
4079    type GetTableIdResponseFut =
4080        fidl::client::QueryResponseFut<u32, fdomain_client::fidl::FDomainResourceDialect>;
4081    fn r#get_table_id(&self) -> Self::GetTableIdResponseFut {
4082        fn _decode(
4083            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4084        ) -> Result<u32, fidl::Error> {
4085            let _response = fidl::client::decode_transaction_body::<
4086                BaseRouteTableGetTableIdResponse,
4087                fdomain_client::fidl::FDomainResourceDialect,
4088                0x7eab30c55edbfc15,
4089            >(_buf?)?;
4090            Ok(_response.table_id)
4091        }
4092        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
4093            (),
4094            0x7eab30c55edbfc15,
4095            fidl::encoding::DynamicFlags::empty(),
4096            _decode,
4097        )
4098    }
4099
4100    fn r#detach(&self) -> Result<(), fidl::Error> {
4101        self.client.send::<fidl::encoding::EmptyPayload>(
4102            (),
4103            0x2853ab157285b384,
4104            fidl::encoding::DynamicFlags::empty(),
4105        )
4106    }
4107
4108    type RemoveResponseFut = fidl::client::QueryResponseFut<
4109        BaseRouteTableRemoveResult,
4110        fdomain_client::fidl::FDomainResourceDialect,
4111    >;
4112    fn r#remove(&self) -> Self::RemoveResponseFut {
4113        fn _decode(
4114            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4115        ) -> Result<BaseRouteTableRemoveResult, fidl::Error> {
4116            let _response = fidl::client::decode_transaction_body::<
4117                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BaseRouteTableRemoveError>,
4118                fdomain_client::fidl::FDomainResourceDialect,
4119                0xc42e58a5fc79426,
4120            >(_buf?)?;
4121            Ok(_response.map(|x| x))
4122        }
4123        self.client
4124            .send_query_and_decode::<fidl::encoding::EmptyPayload, BaseRouteTableRemoveResult>(
4125                (),
4126                0xc42e58a5fc79426,
4127                fidl::encoding::DynamicFlags::empty(),
4128                _decode,
4129            )
4130    }
4131
4132    type GetAuthorizationForRouteTableResponseFut = fidl::client::QueryResponseFut<
4133        GrantForRouteTableAuthorization,
4134        fdomain_client::fidl::FDomainResourceDialect,
4135    >;
4136    fn r#get_authorization_for_route_table(
4137        &self,
4138    ) -> Self::GetAuthorizationForRouteTableResponseFut {
4139        fn _decode(
4140            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4141        ) -> Result<GrantForRouteTableAuthorization, fidl::Error> {
4142            let _response = fidl::client::decode_transaction_body::<
4143                BaseRouteTableGetAuthorizationForRouteTableResponse,
4144                fdomain_client::fidl::FDomainResourceDialect,
4145                0x56a48c921ff3b6eb,
4146            >(_buf?)?;
4147            Ok(_response.credential)
4148        }
4149        self.client
4150            .send_query_and_decode::<fidl::encoding::EmptyPayload, GrantForRouteTableAuthorization>(
4151                (),
4152                0x56a48c921ff3b6eb,
4153                fidl::encoding::DynamicFlags::empty(),
4154                _decode,
4155            )
4156    }
4157
4158    fn r#new_route_set(
4159        &self,
4160        mut route_set: fdomain_client::fidl::ServerEnd<RouteSetV4Marker>,
4161    ) -> Result<(), fidl::Error> {
4162        self.client.send::<RouteTableV4NewRouteSetRequest>(
4163            (route_set,),
4164            0x6aeb6d05698abedb,
4165            fidl::encoding::DynamicFlags::empty(),
4166        )
4167    }
4168}
4169
4170pub struct RouteTableV4EventStream {
4171    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
4172}
4173
4174impl std::marker::Unpin for RouteTableV4EventStream {}
4175
4176impl futures::stream::FusedStream for RouteTableV4EventStream {
4177    fn is_terminated(&self) -> bool {
4178        self.event_receiver.is_terminated()
4179    }
4180}
4181
4182impl futures::Stream for RouteTableV4EventStream {
4183    type Item = Result<RouteTableV4Event, fidl::Error>;
4184
4185    fn poll_next(
4186        mut self: std::pin::Pin<&mut Self>,
4187        cx: &mut std::task::Context<'_>,
4188    ) -> std::task::Poll<Option<Self::Item>> {
4189        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4190            &mut self.event_receiver,
4191            cx
4192        )?) {
4193            Some(buf) => std::task::Poll::Ready(Some(RouteTableV4Event::decode(buf))),
4194            None => std::task::Poll::Ready(None),
4195        }
4196    }
4197}
4198
4199#[derive(Debug)]
4200pub enum RouteTableV4Event {}
4201
4202impl RouteTableV4Event {
4203    /// Decodes a message buffer as a [`RouteTableV4Event`].
4204    fn decode(
4205        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4206    ) -> Result<RouteTableV4Event, fidl::Error> {
4207        let (bytes, _handles) = buf.split_mut();
4208        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4209        debug_assert_eq!(tx_header.tx_id, 0);
4210        match tx_header.ordinal {
4211            _ => Err(fidl::Error::UnknownOrdinal {
4212                ordinal: tx_header.ordinal,
4213                protocol_name:
4214                    <RouteTableV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
4215            }),
4216        }
4217    }
4218}
4219
4220/// A Stream of incoming requests for fuchsia.net.routes.admin/RouteTableV4.
4221pub struct RouteTableV4RequestStream {
4222    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
4223    is_terminated: bool,
4224}
4225
4226impl std::marker::Unpin for RouteTableV4RequestStream {}
4227
4228impl futures::stream::FusedStream for RouteTableV4RequestStream {
4229    fn is_terminated(&self) -> bool {
4230        self.is_terminated
4231    }
4232}
4233
4234impl fdomain_client::fidl::RequestStream for RouteTableV4RequestStream {
4235    type Protocol = RouteTableV4Marker;
4236    type ControlHandle = RouteTableV4ControlHandle;
4237
4238    fn from_channel(channel: fdomain_client::Channel) -> Self {
4239        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4240    }
4241
4242    fn control_handle(&self) -> Self::ControlHandle {
4243        RouteTableV4ControlHandle { inner: self.inner.clone() }
4244    }
4245
4246    fn into_inner(
4247        self,
4248    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
4249    {
4250        (self.inner, self.is_terminated)
4251    }
4252
4253    fn from_inner(
4254        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
4255        is_terminated: bool,
4256    ) -> Self {
4257        Self { inner, is_terminated }
4258    }
4259}
4260
4261impl futures::Stream for RouteTableV4RequestStream {
4262    type Item = Result<RouteTableV4Request, fidl::Error>;
4263
4264    fn poll_next(
4265        mut self: std::pin::Pin<&mut Self>,
4266        cx: &mut std::task::Context<'_>,
4267    ) -> std::task::Poll<Option<Self::Item>> {
4268        let this = &mut *self;
4269        if this.inner.check_shutdown(cx) {
4270            this.is_terminated = true;
4271            return std::task::Poll::Ready(None);
4272        }
4273        if this.is_terminated {
4274            panic!("polled RouteTableV4RequestStream after completion");
4275        }
4276        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
4277            |bytes, handles| {
4278                match this.inner.channel().read_etc(cx, bytes, handles) {
4279                    std::task::Poll::Ready(Ok(())) => {}
4280                    std::task::Poll::Pending => return std::task::Poll::Pending,
4281                    std::task::Poll::Ready(Err(None)) => {
4282                        this.is_terminated = true;
4283                        return std::task::Poll::Ready(None);
4284                    }
4285                    std::task::Poll::Ready(Err(Some(e))) => {
4286                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4287                            e.into(),
4288                        ))));
4289                    }
4290                }
4291
4292                // A message has been received from the channel
4293                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4294
4295                std::task::Poll::Ready(Some(match header.ordinal {
4296                    0x7eab30c55edbfc15 => {
4297                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4298                        let mut req = fidl::new_empty!(
4299                            fidl::encoding::EmptyPayload,
4300                            fdomain_client::fidl::FDomainResourceDialect
4301                        );
4302                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4303                        let control_handle =
4304                            RouteTableV4ControlHandle { inner: this.inner.clone() };
4305                        Ok(RouteTableV4Request::GetTableId {
4306                            responder: RouteTableV4GetTableIdResponder {
4307                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4308                                tx_id: header.tx_id,
4309                            },
4310                        })
4311                    }
4312                    0x2853ab157285b384 => {
4313                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4314                        let mut req = fidl::new_empty!(
4315                            fidl::encoding::EmptyPayload,
4316                            fdomain_client::fidl::FDomainResourceDialect
4317                        );
4318                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4319                        let control_handle =
4320                            RouteTableV4ControlHandle { inner: this.inner.clone() };
4321                        Ok(RouteTableV4Request::Detach { control_handle })
4322                    }
4323                    0xc42e58a5fc79426 => {
4324                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4325                        let mut req = fidl::new_empty!(
4326                            fidl::encoding::EmptyPayload,
4327                            fdomain_client::fidl::FDomainResourceDialect
4328                        );
4329                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4330                        let control_handle =
4331                            RouteTableV4ControlHandle { inner: this.inner.clone() };
4332                        Ok(RouteTableV4Request::Remove {
4333                            responder: RouteTableV4RemoveResponder {
4334                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4335                                tx_id: header.tx_id,
4336                            },
4337                        })
4338                    }
4339                    0x56a48c921ff3b6eb => {
4340                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
4341                        let mut req = fidl::new_empty!(
4342                            fidl::encoding::EmptyPayload,
4343                            fdomain_client::fidl::FDomainResourceDialect
4344                        );
4345                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
4346                        let control_handle =
4347                            RouteTableV4ControlHandle { inner: this.inner.clone() };
4348                        Ok(RouteTableV4Request::GetAuthorizationForRouteTable {
4349                            responder: RouteTableV4GetAuthorizationForRouteTableResponder {
4350                                control_handle: std::mem::ManuallyDrop::new(control_handle),
4351                                tx_id: header.tx_id,
4352                            },
4353                        })
4354                    }
4355                    0x6aeb6d05698abedb => {
4356                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4357                        let mut req = fidl::new_empty!(
4358                            RouteTableV4NewRouteSetRequest,
4359                            fdomain_client::fidl::FDomainResourceDialect
4360                        );
4361                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RouteTableV4NewRouteSetRequest>(&header, _body_bytes, handles, &mut req)?;
4362                        let control_handle =
4363                            RouteTableV4ControlHandle { inner: this.inner.clone() };
4364                        Ok(RouteTableV4Request::NewRouteSet {
4365                            route_set: req.route_set,
4366
4367                            control_handle,
4368                        })
4369                    }
4370                    _ => Err(fidl::Error::UnknownOrdinal {
4371                        ordinal: header.ordinal,
4372                        protocol_name:
4373                            <RouteTableV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
4374                    }),
4375                }))
4376            },
4377        )
4378    }
4379}
4380
4381/// Vends isolated administrative access to the system's IPv4 routing table.
4382///
4383/// A main route table is accessible through the discoverable [`RouteTableV4`]
4384/// protocol. Other tables can be installed using the `NewRouteTable` method
4385/// on [`RouteTableProviderV4`]. The [`RouteTableV4`] also encodes the lifetime
4386/// of the underlying route table, dropping the client end of the protocol
4387/// causes the underlying route table to be removed unless it is detached. The
4388/// main table is detached by default.
4389#[derive(Debug)]
4390pub enum RouteTableV4Request {
4391    /// Gets the table ID for this table.
4392    GetTableId { responder: RouteTableV4GetTableIdResponder },
4393    /// Detaches the lifetime of the route table from the lifetime of the
4394    /// client end of the channel.
4395    ///
4396    /// After this method is called, the route table will not be removed
4397    /// if the client end is closed. It's a no-op if called on the main table.
4398    Detach { control_handle: RouteTableV4ControlHandle },
4399    /// Removes the route table explicitly.
4400    ///
4401    /// This method cannot be called on the main table or an interface-local
4402    /// table, an error will be returned if called. The server will close the
4403    /// channel after this method successfully returns.
4404    Remove { responder: RouteTableV4RemoveResponder },
4405    /// Gets an authentication credential for this table.
4406    ///
4407    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
4408    /// held by the server. This credential can be passed into
4409    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
4410    /// table. The `EVENT` is stable throughout the lifetime of the route table.
4411    /// Clients may duplicate this `EVENT` to make multiple API calls, or
4412    /// transfer the `EVENT` to other clients.
4413    ///
4414    /// - response `credential` the authorization credential for this table.
4415    GetAuthorizationForRouteTable { responder: RouteTableV4GetAuthorizationForRouteTableResponder },
4416    /// Creates an empty route set.
4417    ///
4418    /// + request `route_set` grants access to the [`RouteSetV4`] protocol.
4419    NewRouteSet {
4420        route_set: fdomain_client::fidl::ServerEnd<RouteSetV4Marker>,
4421        control_handle: RouteTableV4ControlHandle,
4422    },
4423}
4424
4425impl RouteTableV4Request {
4426    #[allow(irrefutable_let_patterns)]
4427    pub fn into_get_table_id(self) -> Option<(RouteTableV4GetTableIdResponder)> {
4428        if let RouteTableV4Request::GetTableId { responder } = self {
4429            Some((responder))
4430        } else {
4431            None
4432        }
4433    }
4434
4435    #[allow(irrefutable_let_patterns)]
4436    pub fn into_detach(self) -> Option<(RouteTableV4ControlHandle)> {
4437        if let RouteTableV4Request::Detach { control_handle } = self {
4438            Some((control_handle))
4439        } else {
4440            None
4441        }
4442    }
4443
4444    #[allow(irrefutable_let_patterns)]
4445    pub fn into_remove(self) -> Option<(RouteTableV4RemoveResponder)> {
4446        if let RouteTableV4Request::Remove { responder } = self { Some((responder)) } else { None }
4447    }
4448
4449    #[allow(irrefutable_let_patterns)]
4450    pub fn into_get_authorization_for_route_table(
4451        self,
4452    ) -> Option<(RouteTableV4GetAuthorizationForRouteTableResponder)> {
4453        if let RouteTableV4Request::GetAuthorizationForRouteTable { responder } = self {
4454            Some((responder))
4455        } else {
4456            None
4457        }
4458    }
4459
4460    #[allow(irrefutable_let_patterns)]
4461    pub fn into_new_route_set(
4462        self,
4463    ) -> Option<(fdomain_client::fidl::ServerEnd<RouteSetV4Marker>, RouteTableV4ControlHandle)>
4464    {
4465        if let RouteTableV4Request::NewRouteSet { route_set, control_handle } = self {
4466            Some((route_set, control_handle))
4467        } else {
4468            None
4469        }
4470    }
4471
4472    /// Name of the method defined in FIDL
4473    pub fn method_name(&self) -> &'static str {
4474        match *self {
4475            RouteTableV4Request::GetTableId { .. } => "get_table_id",
4476            RouteTableV4Request::Detach { .. } => "detach",
4477            RouteTableV4Request::Remove { .. } => "remove",
4478            RouteTableV4Request::GetAuthorizationForRouteTable { .. } => {
4479                "get_authorization_for_route_table"
4480            }
4481            RouteTableV4Request::NewRouteSet { .. } => "new_route_set",
4482        }
4483    }
4484}
4485
4486#[derive(Debug, Clone)]
4487pub struct RouteTableV4ControlHandle {
4488    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
4489}
4490
4491impl RouteTableV4ControlHandle {
4492    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
4493        self.inner.shutdown_with_epitaph(status.into())
4494    }
4495}
4496
4497impl fdomain_client::fidl::ControlHandle for RouteTableV4ControlHandle {
4498    fn shutdown(&self) {
4499        self.inner.shutdown()
4500    }
4501
4502    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
4503        self.inner.shutdown_with_epitaph(status)
4504    }
4505
4506    fn is_closed(&self) -> bool {
4507        self.inner.channel().is_closed()
4508    }
4509    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
4510        self.inner.channel().on_closed()
4511    }
4512}
4513
4514impl RouteTableV4ControlHandle {}
4515
4516#[must_use = "FIDL methods require a response to be sent"]
4517#[derive(Debug)]
4518pub struct RouteTableV4GetTableIdResponder {
4519    control_handle: std::mem::ManuallyDrop<RouteTableV4ControlHandle>,
4520    tx_id: u32,
4521}
4522
4523/// Set the the channel to be shutdown (see [`RouteTableV4ControlHandle::shutdown`])
4524/// if the responder is dropped without sending a response, so that the client
4525/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4526impl std::ops::Drop for RouteTableV4GetTableIdResponder {
4527    fn drop(&mut self) {
4528        self.control_handle.shutdown();
4529        // Safety: drops once, never accessed again
4530        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4531    }
4532}
4533
4534impl fdomain_client::fidl::Responder for RouteTableV4GetTableIdResponder {
4535    type ControlHandle = RouteTableV4ControlHandle;
4536
4537    fn control_handle(&self) -> &RouteTableV4ControlHandle {
4538        &self.control_handle
4539    }
4540
4541    fn drop_without_shutdown(mut self) {
4542        // Safety: drops once, never accessed again due to mem::forget
4543        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4544        // Prevent Drop from running (which would shut down the channel)
4545        std::mem::forget(self);
4546    }
4547}
4548
4549impl RouteTableV4GetTableIdResponder {
4550    /// Sends a response to the FIDL transaction.
4551    ///
4552    /// Sets the channel to shutdown if an error occurs.
4553    pub fn send(self, mut table_id: u32) -> Result<(), fidl::Error> {
4554        let _result = self.send_raw(table_id);
4555        if _result.is_err() {
4556            self.control_handle.shutdown();
4557        }
4558        self.drop_without_shutdown();
4559        _result
4560    }
4561
4562    /// Similar to "send" but does not shutdown the channel if an error occurs.
4563    pub fn send_no_shutdown_on_err(self, mut table_id: u32) -> Result<(), fidl::Error> {
4564        let _result = self.send_raw(table_id);
4565        self.drop_without_shutdown();
4566        _result
4567    }
4568
4569    fn send_raw(&self, mut table_id: u32) -> Result<(), fidl::Error> {
4570        self.control_handle.inner.send::<BaseRouteTableGetTableIdResponse>(
4571            (table_id,),
4572            self.tx_id,
4573            0x7eab30c55edbfc15,
4574            fidl::encoding::DynamicFlags::empty(),
4575        )
4576    }
4577}
4578
4579#[must_use = "FIDL methods require a response to be sent"]
4580#[derive(Debug)]
4581pub struct RouteTableV4RemoveResponder {
4582    control_handle: std::mem::ManuallyDrop<RouteTableV4ControlHandle>,
4583    tx_id: u32,
4584}
4585
4586/// Set the the channel to be shutdown (see [`RouteTableV4ControlHandle::shutdown`])
4587/// if the responder is dropped without sending a response, so that the client
4588/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4589impl std::ops::Drop for RouteTableV4RemoveResponder {
4590    fn drop(&mut self) {
4591        self.control_handle.shutdown();
4592        // Safety: drops once, never accessed again
4593        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4594    }
4595}
4596
4597impl fdomain_client::fidl::Responder for RouteTableV4RemoveResponder {
4598    type ControlHandle = RouteTableV4ControlHandle;
4599
4600    fn control_handle(&self) -> &RouteTableV4ControlHandle {
4601        &self.control_handle
4602    }
4603
4604    fn drop_without_shutdown(mut self) {
4605        // Safety: drops once, never accessed again due to mem::forget
4606        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4607        // Prevent Drop from running (which would shut down the channel)
4608        std::mem::forget(self);
4609    }
4610}
4611
4612impl RouteTableV4RemoveResponder {
4613    /// Sends a response to the FIDL transaction.
4614    ///
4615    /// Sets the channel to shutdown if an error occurs.
4616    pub fn send(
4617        self,
4618        mut result: Result<(), BaseRouteTableRemoveError>,
4619    ) -> Result<(), fidl::Error> {
4620        let _result = self.send_raw(result);
4621        if _result.is_err() {
4622            self.control_handle.shutdown();
4623        }
4624        self.drop_without_shutdown();
4625        _result
4626    }
4627
4628    /// Similar to "send" but does not shutdown the channel if an error occurs.
4629    pub fn send_no_shutdown_on_err(
4630        self,
4631        mut result: Result<(), BaseRouteTableRemoveError>,
4632    ) -> Result<(), fidl::Error> {
4633        let _result = self.send_raw(result);
4634        self.drop_without_shutdown();
4635        _result
4636    }
4637
4638    fn send_raw(
4639        &self,
4640        mut result: Result<(), BaseRouteTableRemoveError>,
4641    ) -> Result<(), fidl::Error> {
4642        self.control_handle.inner.send::<fidl::encoding::ResultType<
4643            fidl::encoding::EmptyStruct,
4644            BaseRouteTableRemoveError,
4645        >>(
4646            result,
4647            self.tx_id,
4648            0xc42e58a5fc79426,
4649            fidl::encoding::DynamicFlags::empty(),
4650        )
4651    }
4652}
4653
4654#[must_use = "FIDL methods require a response to be sent"]
4655#[derive(Debug)]
4656pub struct RouteTableV4GetAuthorizationForRouteTableResponder {
4657    control_handle: std::mem::ManuallyDrop<RouteTableV4ControlHandle>,
4658    tx_id: u32,
4659}
4660
4661/// Set the the channel to be shutdown (see [`RouteTableV4ControlHandle::shutdown`])
4662/// if the responder is dropped without sending a response, so that the client
4663/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
4664impl std::ops::Drop for RouteTableV4GetAuthorizationForRouteTableResponder {
4665    fn drop(&mut self) {
4666        self.control_handle.shutdown();
4667        // Safety: drops once, never accessed again
4668        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4669    }
4670}
4671
4672impl fdomain_client::fidl::Responder for RouteTableV4GetAuthorizationForRouteTableResponder {
4673    type ControlHandle = RouteTableV4ControlHandle;
4674
4675    fn control_handle(&self) -> &RouteTableV4ControlHandle {
4676        &self.control_handle
4677    }
4678
4679    fn drop_without_shutdown(mut self) {
4680        // Safety: drops once, never accessed again due to mem::forget
4681        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
4682        // Prevent Drop from running (which would shut down the channel)
4683        std::mem::forget(self);
4684    }
4685}
4686
4687impl RouteTableV4GetAuthorizationForRouteTableResponder {
4688    /// Sends a response to the FIDL transaction.
4689    ///
4690    /// Sets the channel to shutdown if an error occurs.
4691    pub fn send(self, mut credential: GrantForRouteTableAuthorization) -> Result<(), fidl::Error> {
4692        let _result = self.send_raw(credential);
4693        if _result.is_err() {
4694            self.control_handle.shutdown();
4695        }
4696        self.drop_without_shutdown();
4697        _result
4698    }
4699
4700    /// Similar to "send" but does not shutdown the channel if an error occurs.
4701    pub fn send_no_shutdown_on_err(
4702        self,
4703        mut credential: GrantForRouteTableAuthorization,
4704    ) -> Result<(), fidl::Error> {
4705        let _result = self.send_raw(credential);
4706        self.drop_without_shutdown();
4707        _result
4708    }
4709
4710    fn send_raw(&self, mut credential: GrantForRouteTableAuthorization) -> Result<(), fidl::Error> {
4711        self.control_handle.inner.send::<BaseRouteTableGetAuthorizationForRouteTableResponse>(
4712            (&mut credential,),
4713            self.tx_id,
4714            0x56a48c921ff3b6eb,
4715            fidl::encoding::DynamicFlags::empty(),
4716        )
4717    }
4718}
4719
4720#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4721pub struct RouteTableV6Marker;
4722
4723impl fdomain_client::fidl::ProtocolMarker for RouteTableV6Marker {
4724    type Proxy = RouteTableV6Proxy;
4725    type RequestStream = RouteTableV6RequestStream;
4726
4727    const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RouteTableV6";
4728}
4729impl fdomain_client::fidl::DiscoverableProtocolMarker for RouteTableV6Marker {}
4730
4731pub trait RouteTableV6ProxyInterface: Send + Sync {
4732    type GetTableIdResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
4733    fn r#get_table_id(&self) -> Self::GetTableIdResponseFut;
4734    fn r#detach(&self) -> Result<(), fidl::Error>;
4735    type RemoveResponseFut: std::future::Future<Output = Result<BaseRouteTableRemoveResult, fidl::Error>>
4736        + Send;
4737    fn r#remove(&self) -> Self::RemoveResponseFut;
4738    type GetAuthorizationForRouteTableResponseFut: std::future::Future<Output = Result<GrantForRouteTableAuthorization, fidl::Error>>
4739        + Send;
4740    fn r#get_authorization_for_route_table(&self)
4741    -> Self::GetAuthorizationForRouteTableResponseFut;
4742    fn r#new_route_set(
4743        &self,
4744        route_set: fdomain_client::fidl::ServerEnd<RouteSetV6Marker>,
4745    ) -> Result<(), fidl::Error>;
4746}
4747
4748#[derive(Debug, Clone)]
4749pub struct RouteTableV6Proxy {
4750    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
4751}
4752
4753impl fdomain_client::fidl::Proxy for RouteTableV6Proxy {
4754    type Protocol = RouteTableV6Marker;
4755
4756    fn from_channel(inner: fdomain_client::Channel) -> Self {
4757        Self::new(inner)
4758    }
4759
4760    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
4761        self.client.into_channel().map_err(|client| Self { client })
4762    }
4763
4764    fn as_channel(&self) -> &fdomain_client::Channel {
4765        self.client.as_channel()
4766    }
4767}
4768
4769impl RouteTableV6Proxy {
4770    /// Create a new Proxy for fuchsia.net.routes.admin/RouteTableV6.
4771    pub fn new(channel: fdomain_client::Channel) -> Self {
4772        let protocol_name =
4773            <RouteTableV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
4774        Self { client: fidl::client::Client::new(channel, protocol_name) }
4775    }
4776
4777    /// Get a Stream of events from the remote end of the protocol.
4778    ///
4779    /// # Panics
4780    ///
4781    /// Panics if the event stream was already taken.
4782    pub fn take_event_stream(&self) -> RouteTableV6EventStream {
4783        RouteTableV6EventStream { event_receiver: self.client.take_event_receiver() }
4784    }
4785
4786    /// Gets the table ID for this table.
4787    pub fn r#get_table_id(
4788        &self,
4789    ) -> fidl::client::QueryResponseFut<u32, fdomain_client::fidl::FDomainResourceDialect> {
4790        RouteTableV6ProxyInterface::r#get_table_id(self)
4791    }
4792
4793    /// Detaches the lifetime of the route table from the lifetime of the
4794    /// client end of the channel.
4795    ///
4796    /// After this method is called, the route table will not be removed
4797    /// if the client end is closed. It's a no-op if called on the main table.
4798    pub fn r#detach(&self) -> Result<(), fidl::Error> {
4799        RouteTableV6ProxyInterface::r#detach(self)
4800    }
4801
4802    /// Removes the route table explicitly.
4803    ///
4804    /// This method cannot be called on the main table or an interface-local
4805    /// table, an error will be returned if called. The server will close the
4806    /// channel after this method successfully returns.
4807    pub fn r#remove(
4808        &self,
4809    ) -> fidl::client::QueryResponseFut<
4810        BaseRouteTableRemoveResult,
4811        fdomain_client::fidl::FDomainResourceDialect,
4812    > {
4813        RouteTableV6ProxyInterface::r#remove(self)
4814    }
4815
4816    /// Gets an authentication credential for this table.
4817    ///
4818    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
4819    /// held by the server. This credential can be passed into
4820    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
4821    /// table. The `EVENT` is stable throughout the lifetime of the route table.
4822    /// Clients may duplicate this `EVENT` to make multiple API calls, or
4823    /// transfer the `EVENT` to other clients.
4824    ///
4825    /// - response `credential` the authorization credential for this table.
4826    pub fn r#get_authorization_for_route_table(
4827        &self,
4828    ) -> fidl::client::QueryResponseFut<
4829        GrantForRouteTableAuthorization,
4830        fdomain_client::fidl::FDomainResourceDialect,
4831    > {
4832        RouteTableV6ProxyInterface::r#get_authorization_for_route_table(self)
4833    }
4834
4835    /// Creates an empty route set.
4836    ///
4837    /// + request `route_set` grants access to the [`RouteSetV6`] protocol.
4838    pub fn r#new_route_set(
4839        &self,
4840        mut route_set: fdomain_client::fidl::ServerEnd<RouteSetV6Marker>,
4841    ) -> Result<(), fidl::Error> {
4842        RouteTableV6ProxyInterface::r#new_route_set(self, route_set)
4843    }
4844}
4845
4846impl RouteTableV6ProxyInterface for RouteTableV6Proxy {
4847    type GetTableIdResponseFut =
4848        fidl::client::QueryResponseFut<u32, fdomain_client::fidl::FDomainResourceDialect>;
4849    fn r#get_table_id(&self) -> Self::GetTableIdResponseFut {
4850        fn _decode(
4851            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4852        ) -> Result<u32, fidl::Error> {
4853            let _response = fidl::client::decode_transaction_body::<
4854                BaseRouteTableGetTableIdResponse,
4855                fdomain_client::fidl::FDomainResourceDialect,
4856                0x7eab30c55edbfc15,
4857            >(_buf?)?;
4858            Ok(_response.table_id)
4859        }
4860        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
4861            (),
4862            0x7eab30c55edbfc15,
4863            fidl::encoding::DynamicFlags::empty(),
4864            _decode,
4865        )
4866    }
4867
4868    fn r#detach(&self) -> Result<(), fidl::Error> {
4869        self.client.send::<fidl::encoding::EmptyPayload>(
4870            (),
4871            0x2853ab157285b384,
4872            fidl::encoding::DynamicFlags::empty(),
4873        )
4874    }
4875
4876    type RemoveResponseFut = fidl::client::QueryResponseFut<
4877        BaseRouteTableRemoveResult,
4878        fdomain_client::fidl::FDomainResourceDialect,
4879    >;
4880    fn r#remove(&self) -> Self::RemoveResponseFut {
4881        fn _decode(
4882            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4883        ) -> Result<BaseRouteTableRemoveResult, fidl::Error> {
4884            let _response = fidl::client::decode_transaction_body::<
4885                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BaseRouteTableRemoveError>,
4886                fdomain_client::fidl::FDomainResourceDialect,
4887                0xc42e58a5fc79426,
4888            >(_buf?)?;
4889            Ok(_response.map(|x| x))
4890        }
4891        self.client
4892            .send_query_and_decode::<fidl::encoding::EmptyPayload, BaseRouteTableRemoveResult>(
4893                (),
4894                0xc42e58a5fc79426,
4895                fidl::encoding::DynamicFlags::empty(),
4896                _decode,
4897            )
4898    }
4899
4900    type GetAuthorizationForRouteTableResponseFut = fidl::client::QueryResponseFut<
4901        GrantForRouteTableAuthorization,
4902        fdomain_client::fidl::FDomainResourceDialect,
4903    >;
4904    fn r#get_authorization_for_route_table(
4905        &self,
4906    ) -> Self::GetAuthorizationForRouteTableResponseFut {
4907        fn _decode(
4908            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4909        ) -> Result<GrantForRouteTableAuthorization, fidl::Error> {
4910            let _response = fidl::client::decode_transaction_body::<
4911                BaseRouteTableGetAuthorizationForRouteTableResponse,
4912                fdomain_client::fidl::FDomainResourceDialect,
4913                0x56a48c921ff3b6eb,
4914            >(_buf?)?;
4915            Ok(_response.credential)
4916        }
4917        self.client
4918            .send_query_and_decode::<fidl::encoding::EmptyPayload, GrantForRouteTableAuthorization>(
4919                (),
4920                0x56a48c921ff3b6eb,
4921                fidl::encoding::DynamicFlags::empty(),
4922                _decode,
4923            )
4924    }
4925
4926    fn r#new_route_set(
4927        &self,
4928        mut route_set: fdomain_client::fidl::ServerEnd<RouteSetV6Marker>,
4929    ) -> Result<(), fidl::Error> {
4930        self.client.send::<RouteTableV6NewRouteSetRequest>(
4931            (route_set,),
4932            0x479aeaf9ad470141,
4933            fidl::encoding::DynamicFlags::empty(),
4934        )
4935    }
4936}
4937
4938pub struct RouteTableV6EventStream {
4939    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
4940}
4941
4942impl std::marker::Unpin for RouteTableV6EventStream {}
4943
4944impl futures::stream::FusedStream for RouteTableV6EventStream {
4945    fn is_terminated(&self) -> bool {
4946        self.event_receiver.is_terminated()
4947    }
4948}
4949
4950impl futures::Stream for RouteTableV6EventStream {
4951    type Item = Result<RouteTableV6Event, fidl::Error>;
4952
4953    fn poll_next(
4954        mut self: std::pin::Pin<&mut Self>,
4955        cx: &mut std::task::Context<'_>,
4956    ) -> std::task::Poll<Option<Self::Item>> {
4957        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4958            &mut self.event_receiver,
4959            cx
4960        )?) {
4961            Some(buf) => std::task::Poll::Ready(Some(RouteTableV6Event::decode(buf))),
4962            None => std::task::Poll::Ready(None),
4963        }
4964    }
4965}
4966
4967#[derive(Debug)]
4968pub enum RouteTableV6Event {}
4969
4970impl RouteTableV6Event {
4971    /// Decodes a message buffer as a [`RouteTableV6Event`].
4972    fn decode(
4973        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4974    ) -> Result<RouteTableV6Event, fidl::Error> {
4975        let (bytes, _handles) = buf.split_mut();
4976        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4977        debug_assert_eq!(tx_header.tx_id, 0);
4978        match tx_header.ordinal {
4979            _ => Err(fidl::Error::UnknownOrdinal {
4980                ordinal: tx_header.ordinal,
4981                protocol_name:
4982                    <RouteTableV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
4983            }),
4984        }
4985    }
4986}
4987
4988/// A Stream of incoming requests for fuchsia.net.routes.admin/RouteTableV6.
4989pub struct RouteTableV6RequestStream {
4990    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
4991    is_terminated: bool,
4992}
4993
4994impl std::marker::Unpin for RouteTableV6RequestStream {}
4995
4996impl futures::stream::FusedStream for RouteTableV6RequestStream {
4997    fn is_terminated(&self) -> bool {
4998        self.is_terminated
4999    }
5000}
5001
5002impl fdomain_client::fidl::RequestStream for RouteTableV6RequestStream {
5003    type Protocol = RouteTableV6Marker;
5004    type ControlHandle = RouteTableV6ControlHandle;
5005
5006    fn from_channel(channel: fdomain_client::Channel) -> Self {
5007        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5008    }
5009
5010    fn control_handle(&self) -> Self::ControlHandle {
5011        RouteTableV6ControlHandle { inner: self.inner.clone() }
5012    }
5013
5014    fn into_inner(
5015        self,
5016    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
5017    {
5018        (self.inner, self.is_terminated)
5019    }
5020
5021    fn from_inner(
5022        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
5023        is_terminated: bool,
5024    ) -> Self {
5025        Self { inner, is_terminated }
5026    }
5027}
5028
5029impl futures::Stream for RouteTableV6RequestStream {
5030    type Item = Result<RouteTableV6Request, fidl::Error>;
5031
5032    fn poll_next(
5033        mut self: std::pin::Pin<&mut Self>,
5034        cx: &mut std::task::Context<'_>,
5035    ) -> std::task::Poll<Option<Self::Item>> {
5036        let this = &mut *self;
5037        if this.inner.check_shutdown(cx) {
5038            this.is_terminated = true;
5039            return std::task::Poll::Ready(None);
5040        }
5041        if this.is_terminated {
5042            panic!("polled RouteTableV6RequestStream after completion");
5043        }
5044        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
5045            |bytes, handles| {
5046                match this.inner.channel().read_etc(cx, bytes, handles) {
5047                    std::task::Poll::Ready(Ok(())) => {}
5048                    std::task::Poll::Pending => return std::task::Poll::Pending,
5049                    std::task::Poll::Ready(Err(None)) => {
5050                        this.is_terminated = true;
5051                        return std::task::Poll::Ready(None);
5052                    }
5053                    std::task::Poll::Ready(Err(Some(e))) => {
5054                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5055                            e.into(),
5056                        ))));
5057                    }
5058                }
5059
5060                // A message has been received from the channel
5061                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5062
5063                std::task::Poll::Ready(Some(match header.ordinal {
5064                    0x7eab30c55edbfc15 => {
5065                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5066                        let mut req = fidl::new_empty!(
5067                            fidl::encoding::EmptyPayload,
5068                            fdomain_client::fidl::FDomainResourceDialect
5069                        );
5070                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5071                        let control_handle =
5072                            RouteTableV6ControlHandle { inner: this.inner.clone() };
5073                        Ok(RouteTableV6Request::GetTableId {
5074                            responder: RouteTableV6GetTableIdResponder {
5075                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5076                                tx_id: header.tx_id,
5077                            },
5078                        })
5079                    }
5080                    0x2853ab157285b384 => {
5081                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5082                        let mut req = fidl::new_empty!(
5083                            fidl::encoding::EmptyPayload,
5084                            fdomain_client::fidl::FDomainResourceDialect
5085                        );
5086                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5087                        let control_handle =
5088                            RouteTableV6ControlHandle { inner: this.inner.clone() };
5089                        Ok(RouteTableV6Request::Detach { control_handle })
5090                    }
5091                    0xc42e58a5fc79426 => {
5092                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5093                        let mut req = fidl::new_empty!(
5094                            fidl::encoding::EmptyPayload,
5095                            fdomain_client::fidl::FDomainResourceDialect
5096                        );
5097                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5098                        let control_handle =
5099                            RouteTableV6ControlHandle { inner: this.inner.clone() };
5100                        Ok(RouteTableV6Request::Remove {
5101                            responder: RouteTableV6RemoveResponder {
5102                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5103                                tx_id: header.tx_id,
5104                            },
5105                        })
5106                    }
5107                    0x56a48c921ff3b6eb => {
5108                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5109                        let mut req = fidl::new_empty!(
5110                            fidl::encoding::EmptyPayload,
5111                            fdomain_client::fidl::FDomainResourceDialect
5112                        );
5113                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5114                        let control_handle =
5115                            RouteTableV6ControlHandle { inner: this.inner.clone() };
5116                        Ok(RouteTableV6Request::GetAuthorizationForRouteTable {
5117                            responder: RouteTableV6GetAuthorizationForRouteTableResponder {
5118                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5119                                tx_id: header.tx_id,
5120                            },
5121                        })
5122                    }
5123                    0x479aeaf9ad470141 => {
5124                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5125                        let mut req = fidl::new_empty!(
5126                            RouteTableV6NewRouteSetRequest,
5127                            fdomain_client::fidl::FDomainResourceDialect
5128                        );
5129                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RouteTableV6NewRouteSetRequest>(&header, _body_bytes, handles, &mut req)?;
5130                        let control_handle =
5131                            RouteTableV6ControlHandle { inner: this.inner.clone() };
5132                        Ok(RouteTableV6Request::NewRouteSet {
5133                            route_set: req.route_set,
5134
5135                            control_handle,
5136                        })
5137                    }
5138                    _ => Err(fidl::Error::UnknownOrdinal {
5139                        ordinal: header.ordinal,
5140                        protocol_name:
5141                            <RouteTableV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
5142                    }),
5143                }))
5144            },
5145        )
5146    }
5147}
5148
5149/// Vends isolated administrative access to the system's IPv6 routing table.
5150///
5151/// A main route table is accessible through the discoverable [`RouteTableV6`]
5152/// protocol. Other tables can be installed using the `NewRouteTable` method
5153/// on [`RouteTableProviderV6`]. The [`RouteTableV6`] also encodes the lifetime
5154/// of the underlying route table, dropping the client end of the protocol
5155/// causes the underlying route table to be removed unless it is detached. The
5156/// main table is detached by default.
5157#[derive(Debug)]
5158pub enum RouteTableV6Request {
5159    /// Gets the table ID for this table.
5160    GetTableId { responder: RouteTableV6GetTableIdResponder },
5161    /// Detaches the lifetime of the route table from the lifetime of the
5162    /// client end of the channel.
5163    ///
5164    /// After this method is called, the route table will not be removed
5165    /// if the client end is closed. It's a no-op if called on the main table.
5166    Detach { control_handle: RouteTableV6ControlHandle },
5167    /// Removes the route table explicitly.
5168    ///
5169    /// This method cannot be called on the main table or an interface-local
5170    /// table, an error will be returned if called. The server will close the
5171    /// channel after this method successfully returns.
5172    Remove { responder: RouteTableV6RemoveResponder },
5173    /// Gets an authentication credential for this table.
5174    ///
5175    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
5176    /// held by the server. This credential can be passed into
5177    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
5178    /// table. The `EVENT` is stable throughout the lifetime of the route table.
5179    /// Clients may duplicate this `EVENT` to make multiple API calls, or
5180    /// transfer the `EVENT` to other clients.
5181    ///
5182    /// - response `credential` the authorization credential for this table.
5183    GetAuthorizationForRouteTable { responder: RouteTableV6GetAuthorizationForRouteTableResponder },
5184    /// Creates an empty route set.
5185    ///
5186    /// + request `route_set` grants access to the [`RouteSetV6`] protocol.
5187    NewRouteSet {
5188        route_set: fdomain_client::fidl::ServerEnd<RouteSetV6Marker>,
5189        control_handle: RouteTableV6ControlHandle,
5190    },
5191}
5192
5193impl RouteTableV6Request {
5194    #[allow(irrefutable_let_patterns)]
5195    pub fn into_get_table_id(self) -> Option<(RouteTableV6GetTableIdResponder)> {
5196        if let RouteTableV6Request::GetTableId { responder } = self {
5197            Some((responder))
5198        } else {
5199            None
5200        }
5201    }
5202
5203    #[allow(irrefutable_let_patterns)]
5204    pub fn into_detach(self) -> Option<(RouteTableV6ControlHandle)> {
5205        if let RouteTableV6Request::Detach { control_handle } = self {
5206            Some((control_handle))
5207        } else {
5208            None
5209        }
5210    }
5211
5212    #[allow(irrefutable_let_patterns)]
5213    pub fn into_remove(self) -> Option<(RouteTableV6RemoveResponder)> {
5214        if let RouteTableV6Request::Remove { responder } = self { Some((responder)) } else { None }
5215    }
5216
5217    #[allow(irrefutable_let_patterns)]
5218    pub fn into_get_authorization_for_route_table(
5219        self,
5220    ) -> Option<(RouteTableV6GetAuthorizationForRouteTableResponder)> {
5221        if let RouteTableV6Request::GetAuthorizationForRouteTable { responder } = self {
5222            Some((responder))
5223        } else {
5224            None
5225        }
5226    }
5227
5228    #[allow(irrefutable_let_patterns)]
5229    pub fn into_new_route_set(
5230        self,
5231    ) -> Option<(fdomain_client::fidl::ServerEnd<RouteSetV6Marker>, RouteTableV6ControlHandle)>
5232    {
5233        if let RouteTableV6Request::NewRouteSet { route_set, control_handle } = self {
5234            Some((route_set, control_handle))
5235        } else {
5236            None
5237        }
5238    }
5239
5240    /// Name of the method defined in FIDL
5241    pub fn method_name(&self) -> &'static str {
5242        match *self {
5243            RouteTableV6Request::GetTableId { .. } => "get_table_id",
5244            RouteTableV6Request::Detach { .. } => "detach",
5245            RouteTableV6Request::Remove { .. } => "remove",
5246            RouteTableV6Request::GetAuthorizationForRouteTable { .. } => {
5247                "get_authorization_for_route_table"
5248            }
5249            RouteTableV6Request::NewRouteSet { .. } => "new_route_set",
5250        }
5251    }
5252}
5253
5254#[derive(Debug, Clone)]
5255pub struct RouteTableV6ControlHandle {
5256    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
5257}
5258
5259impl RouteTableV6ControlHandle {
5260    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
5261        self.inner.shutdown_with_epitaph(status.into())
5262    }
5263}
5264
5265impl fdomain_client::fidl::ControlHandle for RouteTableV6ControlHandle {
5266    fn shutdown(&self) {
5267        self.inner.shutdown()
5268    }
5269
5270    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
5271        self.inner.shutdown_with_epitaph(status)
5272    }
5273
5274    fn is_closed(&self) -> bool {
5275        self.inner.channel().is_closed()
5276    }
5277    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
5278        self.inner.channel().on_closed()
5279    }
5280}
5281
5282impl RouteTableV6ControlHandle {}
5283
5284#[must_use = "FIDL methods require a response to be sent"]
5285#[derive(Debug)]
5286pub struct RouteTableV6GetTableIdResponder {
5287    control_handle: std::mem::ManuallyDrop<RouteTableV6ControlHandle>,
5288    tx_id: u32,
5289}
5290
5291/// Set the the channel to be shutdown (see [`RouteTableV6ControlHandle::shutdown`])
5292/// if the responder is dropped without sending a response, so that the client
5293/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5294impl std::ops::Drop for RouteTableV6GetTableIdResponder {
5295    fn drop(&mut self) {
5296        self.control_handle.shutdown();
5297        // Safety: drops once, never accessed again
5298        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5299    }
5300}
5301
5302impl fdomain_client::fidl::Responder for RouteTableV6GetTableIdResponder {
5303    type ControlHandle = RouteTableV6ControlHandle;
5304
5305    fn control_handle(&self) -> &RouteTableV6ControlHandle {
5306        &self.control_handle
5307    }
5308
5309    fn drop_without_shutdown(mut self) {
5310        // Safety: drops once, never accessed again due to mem::forget
5311        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5312        // Prevent Drop from running (which would shut down the channel)
5313        std::mem::forget(self);
5314    }
5315}
5316
5317impl RouteTableV6GetTableIdResponder {
5318    /// Sends a response to the FIDL transaction.
5319    ///
5320    /// Sets the channel to shutdown if an error occurs.
5321    pub fn send(self, mut table_id: u32) -> Result<(), fidl::Error> {
5322        let _result = self.send_raw(table_id);
5323        if _result.is_err() {
5324            self.control_handle.shutdown();
5325        }
5326        self.drop_without_shutdown();
5327        _result
5328    }
5329
5330    /// Similar to "send" but does not shutdown the channel if an error occurs.
5331    pub fn send_no_shutdown_on_err(self, mut table_id: u32) -> Result<(), fidl::Error> {
5332        let _result = self.send_raw(table_id);
5333        self.drop_without_shutdown();
5334        _result
5335    }
5336
5337    fn send_raw(&self, mut table_id: u32) -> Result<(), fidl::Error> {
5338        self.control_handle.inner.send::<BaseRouteTableGetTableIdResponse>(
5339            (table_id,),
5340            self.tx_id,
5341            0x7eab30c55edbfc15,
5342            fidl::encoding::DynamicFlags::empty(),
5343        )
5344    }
5345}
5346
5347#[must_use = "FIDL methods require a response to be sent"]
5348#[derive(Debug)]
5349pub struct RouteTableV6RemoveResponder {
5350    control_handle: std::mem::ManuallyDrop<RouteTableV6ControlHandle>,
5351    tx_id: u32,
5352}
5353
5354/// Set the the channel to be shutdown (see [`RouteTableV6ControlHandle::shutdown`])
5355/// if the responder is dropped without sending a response, so that the client
5356/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5357impl std::ops::Drop for RouteTableV6RemoveResponder {
5358    fn drop(&mut self) {
5359        self.control_handle.shutdown();
5360        // Safety: drops once, never accessed again
5361        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5362    }
5363}
5364
5365impl fdomain_client::fidl::Responder for RouteTableV6RemoveResponder {
5366    type ControlHandle = RouteTableV6ControlHandle;
5367
5368    fn control_handle(&self) -> &RouteTableV6ControlHandle {
5369        &self.control_handle
5370    }
5371
5372    fn drop_without_shutdown(mut self) {
5373        // Safety: drops once, never accessed again due to mem::forget
5374        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5375        // Prevent Drop from running (which would shut down the channel)
5376        std::mem::forget(self);
5377    }
5378}
5379
5380impl RouteTableV6RemoveResponder {
5381    /// Sends a response to the FIDL transaction.
5382    ///
5383    /// Sets the channel to shutdown if an error occurs.
5384    pub fn send(
5385        self,
5386        mut result: Result<(), BaseRouteTableRemoveError>,
5387    ) -> Result<(), fidl::Error> {
5388        let _result = self.send_raw(result);
5389        if _result.is_err() {
5390            self.control_handle.shutdown();
5391        }
5392        self.drop_without_shutdown();
5393        _result
5394    }
5395
5396    /// Similar to "send" but does not shutdown the channel if an error occurs.
5397    pub fn send_no_shutdown_on_err(
5398        self,
5399        mut result: Result<(), BaseRouteTableRemoveError>,
5400    ) -> Result<(), fidl::Error> {
5401        let _result = self.send_raw(result);
5402        self.drop_without_shutdown();
5403        _result
5404    }
5405
5406    fn send_raw(
5407        &self,
5408        mut result: Result<(), BaseRouteTableRemoveError>,
5409    ) -> Result<(), fidl::Error> {
5410        self.control_handle.inner.send::<fidl::encoding::ResultType<
5411            fidl::encoding::EmptyStruct,
5412            BaseRouteTableRemoveError,
5413        >>(
5414            result,
5415            self.tx_id,
5416            0xc42e58a5fc79426,
5417            fidl::encoding::DynamicFlags::empty(),
5418        )
5419    }
5420}
5421
5422#[must_use = "FIDL methods require a response to be sent"]
5423#[derive(Debug)]
5424pub struct RouteTableV6GetAuthorizationForRouteTableResponder {
5425    control_handle: std::mem::ManuallyDrop<RouteTableV6ControlHandle>,
5426    tx_id: u32,
5427}
5428
5429/// Set the the channel to be shutdown (see [`RouteTableV6ControlHandle::shutdown`])
5430/// if the responder is dropped without sending a response, so that the client
5431/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5432impl std::ops::Drop for RouteTableV6GetAuthorizationForRouteTableResponder {
5433    fn drop(&mut self) {
5434        self.control_handle.shutdown();
5435        // Safety: drops once, never accessed again
5436        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5437    }
5438}
5439
5440impl fdomain_client::fidl::Responder for RouteTableV6GetAuthorizationForRouteTableResponder {
5441    type ControlHandle = RouteTableV6ControlHandle;
5442
5443    fn control_handle(&self) -> &RouteTableV6ControlHandle {
5444        &self.control_handle
5445    }
5446
5447    fn drop_without_shutdown(mut self) {
5448        // Safety: drops once, never accessed again due to mem::forget
5449        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5450        // Prevent Drop from running (which would shut down the channel)
5451        std::mem::forget(self);
5452    }
5453}
5454
5455impl RouteTableV6GetAuthorizationForRouteTableResponder {
5456    /// Sends a response to the FIDL transaction.
5457    ///
5458    /// Sets the channel to shutdown if an error occurs.
5459    pub fn send(self, mut credential: GrantForRouteTableAuthorization) -> Result<(), fidl::Error> {
5460        let _result = self.send_raw(credential);
5461        if _result.is_err() {
5462            self.control_handle.shutdown();
5463        }
5464        self.drop_without_shutdown();
5465        _result
5466    }
5467
5468    /// Similar to "send" but does not shutdown the channel if an error occurs.
5469    pub fn send_no_shutdown_on_err(
5470        self,
5471        mut credential: GrantForRouteTableAuthorization,
5472    ) -> Result<(), fidl::Error> {
5473        let _result = self.send_raw(credential);
5474        self.drop_without_shutdown();
5475        _result
5476    }
5477
5478    fn send_raw(&self, mut credential: GrantForRouteTableAuthorization) -> Result<(), fidl::Error> {
5479        self.control_handle.inner.send::<BaseRouteTableGetAuthorizationForRouteTableResponse>(
5480            (&mut credential,),
5481            self.tx_id,
5482            0x56a48c921ff3b6eb,
5483            fidl::encoding::DynamicFlags::empty(),
5484        )
5485    }
5486}
5487
5488#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5489pub struct RuleSetV4Marker;
5490
5491impl fdomain_client::fidl::ProtocolMarker for RuleSetV4Marker {
5492    type Proxy = RuleSetV4Proxy;
5493    type RequestStream = RuleSetV4RequestStream;
5494
5495    const DEBUG_NAME: &'static str = "(anonymous) RuleSetV4";
5496}
5497pub type RuleSetV4AddRuleResult = Result<(), RuleSetError>;
5498
5499pub trait RuleSetV4ProxyInterface: Send + Sync {
5500    type AuthenticateForRouteTableResponseFut: std::future::Future<
5501            Output = Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error>,
5502        > + Send;
5503    fn r#authenticate_for_route_table(
5504        &self,
5505        table: u32,
5506        token: fdomain_client::Event,
5507    ) -> Self::AuthenticateForRouteTableResponseFut;
5508    type RemoveRuleResponseFut: std::future::Future<Output = Result<BaseRuleSetRemoveRuleResult, fidl::Error>>
5509        + Send;
5510    fn r#remove_rule(&self, index: u32) -> Self::RemoveRuleResponseFut;
5511    fn r#close(&self) -> Result<(), fidl::Error>;
5512    type AddRuleResponseFut: std::future::Future<Output = Result<RuleSetV4AddRuleResult, fidl::Error>>
5513        + Send;
5514    fn r#add_rule(
5515        &self,
5516        index: u32,
5517        matcher: &fdomain_fuchsia_net_routes::RuleMatcherV4,
5518        action: &fdomain_fuchsia_net_routes::RuleAction,
5519    ) -> Self::AddRuleResponseFut;
5520}
5521
5522#[derive(Debug, Clone)]
5523pub struct RuleSetV4Proxy {
5524    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
5525}
5526
5527impl fdomain_client::fidl::Proxy for RuleSetV4Proxy {
5528    type Protocol = RuleSetV4Marker;
5529
5530    fn from_channel(inner: fdomain_client::Channel) -> Self {
5531        Self::new(inner)
5532    }
5533
5534    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
5535        self.client.into_channel().map_err(|client| Self { client })
5536    }
5537
5538    fn as_channel(&self) -> &fdomain_client::Channel {
5539        self.client.as_channel()
5540    }
5541}
5542
5543impl RuleSetV4Proxy {
5544    /// Create a new Proxy for fuchsia.net.routes.admin/RuleSetV4.
5545    pub fn new(channel: fdomain_client::Channel) -> Self {
5546        let protocol_name = <RuleSetV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
5547        Self { client: fidl::client::Client::new(channel, protocol_name) }
5548    }
5549
5550    /// Get a Stream of events from the remote end of the protocol.
5551    ///
5552    /// # Panics
5553    ///
5554    /// Panics if the event stream was already taken.
5555    pub fn take_event_stream(&self) -> RuleSetV4EventStream {
5556        RuleSetV4EventStream { event_receiver: self.client.take_event_receiver() }
5557    }
5558
5559    /// Authenticates for a route table that will be used in an action.
5560    pub fn r#authenticate_for_route_table(
5561        &self,
5562        mut table: u32,
5563        mut token: fdomain_client::Event,
5564    ) -> fidl::client::QueryResponseFut<
5565        BaseRuleSetAuthenticateForRouteTableResult,
5566        fdomain_client::fidl::FDomainResourceDialect,
5567    > {
5568        RuleSetV4ProxyInterface::r#authenticate_for_route_table(self, table, token)
5569    }
5570
5571    /// Removes a rule from this rule set.
5572    ///
5573    /// If the client tries to remove from an index that does not have a rule,
5574    /// the error `RULE_DOES_NOT_EXIST` will be returned.
5575    ///
5576    /// + request `index` the index of the rule.
5577    pub fn r#remove_rule(
5578        &self,
5579        mut index: u32,
5580    ) -> fidl::client::QueryResponseFut<
5581        BaseRuleSetRemoveRuleResult,
5582        fdomain_client::fidl::FDomainResourceDialect,
5583    > {
5584        RuleSetV4ProxyInterface::r#remove_rule(self, index)
5585    }
5586
5587    /// Removes all rules in the rule set and the underlying channel will be
5588    /// closed after the rules are removed.
5589    ///
5590    /// This method provides a way for synchronous closure.
5591    pub fn r#close(&self) -> Result<(), fidl::Error> {
5592        RuleSetV4ProxyInterface::r#close(self)
5593    }
5594
5595    /// Adds a rule to this rule set.
5596    ///
5597    /// If there is already a rule at the provided `index`, `RULE_ALREADY_EXISTS`
5598    /// is returned.
5599    ///
5600    /// + request `index` where to insert the rule.
5601    /// + request `matcher` the matcher of the rule.
5602    /// + request `action` action of the rule.
5603    pub fn r#add_rule(
5604        &self,
5605        mut index: u32,
5606        mut matcher: &fdomain_fuchsia_net_routes::RuleMatcherV4,
5607        mut action: &fdomain_fuchsia_net_routes::RuleAction,
5608    ) -> fidl::client::QueryResponseFut<
5609        RuleSetV4AddRuleResult,
5610        fdomain_client::fidl::FDomainResourceDialect,
5611    > {
5612        RuleSetV4ProxyInterface::r#add_rule(self, index, matcher, action)
5613    }
5614}
5615
5616impl RuleSetV4ProxyInterface for RuleSetV4Proxy {
5617    type AuthenticateForRouteTableResponseFut = fidl::client::QueryResponseFut<
5618        BaseRuleSetAuthenticateForRouteTableResult,
5619        fdomain_client::fidl::FDomainResourceDialect,
5620    >;
5621    fn r#authenticate_for_route_table(
5622        &self,
5623        mut table: u32,
5624        mut token: fdomain_client::Event,
5625    ) -> Self::AuthenticateForRouteTableResponseFut {
5626        fn _decode(
5627            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5628        ) -> Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error> {
5629            let _response = fidl::client::decode_transaction_body::<
5630                fidl::encoding::ResultType<
5631                    fidl::encoding::EmptyStruct,
5632                    AuthenticateForRouteTableError,
5633                >,
5634                fdomain_client::fidl::FDomainResourceDialect,
5635                0x6fd845360ed9bc8f,
5636            >(_buf?)?;
5637            Ok(_response.map(|x| x))
5638        }
5639        self.client.send_query_and_decode::<
5640            ProofOfRouteTableAuthorization,
5641            BaseRuleSetAuthenticateForRouteTableResult,
5642        >(
5643            (table, token,),
5644            0x6fd845360ed9bc8f,
5645            fidl::encoding::DynamicFlags::empty(),
5646            _decode,
5647        )
5648    }
5649
5650    type RemoveRuleResponseFut = fidl::client::QueryResponseFut<
5651        BaseRuleSetRemoveRuleResult,
5652        fdomain_client::fidl::FDomainResourceDialect,
5653    >;
5654    fn r#remove_rule(&self, mut index: u32) -> Self::RemoveRuleResponseFut {
5655        fn _decode(
5656            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5657        ) -> Result<BaseRuleSetRemoveRuleResult, fidl::Error> {
5658            let _response = fidl::client::decode_transaction_body::<
5659                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
5660                fdomain_client::fidl::FDomainResourceDialect,
5661                0x2ae3d7e817cbff90,
5662            >(_buf?)?;
5663            Ok(_response.map(|x| x))
5664        }
5665        self.client
5666            .send_query_and_decode::<BaseRuleSetRemoveRuleRequest, BaseRuleSetRemoveRuleResult>(
5667                (index,),
5668                0x2ae3d7e817cbff90,
5669                fidl::encoding::DynamicFlags::empty(),
5670                _decode,
5671            )
5672    }
5673
5674    fn r#close(&self) -> Result<(), fidl::Error> {
5675        self.client.send::<fidl::encoding::EmptyPayload>(
5676            (),
5677            0x457e1753672d4073,
5678            fidl::encoding::DynamicFlags::empty(),
5679        )
5680    }
5681
5682    type AddRuleResponseFut = fidl::client::QueryResponseFut<
5683        RuleSetV4AddRuleResult,
5684        fdomain_client::fidl::FDomainResourceDialect,
5685    >;
5686    fn r#add_rule(
5687        &self,
5688        mut index: u32,
5689        mut matcher: &fdomain_fuchsia_net_routes::RuleMatcherV4,
5690        mut action: &fdomain_fuchsia_net_routes::RuleAction,
5691    ) -> Self::AddRuleResponseFut {
5692        fn _decode(
5693            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5694        ) -> Result<RuleSetV4AddRuleResult, fidl::Error> {
5695            let _response = fidl::client::decode_transaction_body::<
5696                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
5697                fdomain_client::fidl::FDomainResourceDialect,
5698                0x7f68325de94e80,
5699            >(_buf?)?;
5700            Ok(_response.map(|x| x))
5701        }
5702        self.client.send_query_and_decode::<RuleSetV4AddRuleRequest, RuleSetV4AddRuleResult>(
5703            (index, matcher, action),
5704            0x7f68325de94e80,
5705            fidl::encoding::DynamicFlags::empty(),
5706            _decode,
5707        )
5708    }
5709}
5710
5711pub struct RuleSetV4EventStream {
5712    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
5713}
5714
5715impl std::marker::Unpin for RuleSetV4EventStream {}
5716
5717impl futures::stream::FusedStream for RuleSetV4EventStream {
5718    fn is_terminated(&self) -> bool {
5719        self.event_receiver.is_terminated()
5720    }
5721}
5722
5723impl futures::Stream for RuleSetV4EventStream {
5724    type Item = Result<RuleSetV4Event, fidl::Error>;
5725
5726    fn poll_next(
5727        mut self: std::pin::Pin<&mut Self>,
5728        cx: &mut std::task::Context<'_>,
5729    ) -> std::task::Poll<Option<Self::Item>> {
5730        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5731            &mut self.event_receiver,
5732            cx
5733        )?) {
5734            Some(buf) => std::task::Poll::Ready(Some(RuleSetV4Event::decode(buf))),
5735            None => std::task::Poll::Ready(None),
5736        }
5737    }
5738}
5739
5740#[derive(Debug)]
5741pub enum RuleSetV4Event {}
5742
5743impl RuleSetV4Event {
5744    /// Decodes a message buffer as a [`RuleSetV4Event`].
5745    fn decode(
5746        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5747    ) -> Result<RuleSetV4Event, fidl::Error> {
5748        let (bytes, _handles) = buf.split_mut();
5749        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5750        debug_assert_eq!(tx_header.tx_id, 0);
5751        match tx_header.ordinal {
5752            _ => Err(fidl::Error::UnknownOrdinal {
5753                ordinal: tx_header.ordinal,
5754                protocol_name:
5755                    <RuleSetV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
5756            }),
5757        }
5758    }
5759}
5760
5761/// A Stream of incoming requests for fuchsia.net.routes.admin/RuleSetV4.
5762pub struct RuleSetV4RequestStream {
5763    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
5764    is_terminated: bool,
5765}
5766
5767impl std::marker::Unpin for RuleSetV4RequestStream {}
5768
5769impl futures::stream::FusedStream for RuleSetV4RequestStream {
5770    fn is_terminated(&self) -> bool {
5771        self.is_terminated
5772    }
5773}
5774
5775impl fdomain_client::fidl::RequestStream for RuleSetV4RequestStream {
5776    type Protocol = RuleSetV4Marker;
5777    type ControlHandle = RuleSetV4ControlHandle;
5778
5779    fn from_channel(channel: fdomain_client::Channel) -> Self {
5780        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5781    }
5782
5783    fn control_handle(&self) -> Self::ControlHandle {
5784        RuleSetV4ControlHandle { inner: self.inner.clone() }
5785    }
5786
5787    fn into_inner(
5788        self,
5789    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
5790    {
5791        (self.inner, self.is_terminated)
5792    }
5793
5794    fn from_inner(
5795        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
5796        is_terminated: bool,
5797    ) -> Self {
5798        Self { inner, is_terminated }
5799    }
5800}
5801
5802impl futures::Stream for RuleSetV4RequestStream {
5803    type Item = Result<RuleSetV4Request, fidl::Error>;
5804
5805    fn poll_next(
5806        mut self: std::pin::Pin<&mut Self>,
5807        cx: &mut std::task::Context<'_>,
5808    ) -> std::task::Poll<Option<Self::Item>> {
5809        let this = &mut *self;
5810        if this.inner.check_shutdown(cx) {
5811            this.is_terminated = true;
5812            return std::task::Poll::Ready(None);
5813        }
5814        if this.is_terminated {
5815            panic!("polled RuleSetV4RequestStream after completion");
5816        }
5817        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
5818            |bytes, handles| {
5819                match this.inner.channel().read_etc(cx, bytes, handles) {
5820                    std::task::Poll::Ready(Ok(())) => {}
5821                    std::task::Poll::Pending => return std::task::Poll::Pending,
5822                    std::task::Poll::Ready(Err(None)) => {
5823                        this.is_terminated = true;
5824                        return std::task::Poll::Ready(None);
5825                    }
5826                    std::task::Poll::Ready(Err(Some(e))) => {
5827                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5828                            e.into(),
5829                        ))));
5830                    }
5831                }
5832
5833                // A message has been received from the channel
5834                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5835
5836                std::task::Poll::Ready(Some(match header.ordinal {
5837                    0x6fd845360ed9bc8f => {
5838                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5839                        let mut req = fidl::new_empty!(
5840                            ProofOfRouteTableAuthorization,
5841                            fdomain_client::fidl::FDomainResourceDialect
5842                        );
5843                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<ProofOfRouteTableAuthorization>(&header, _body_bytes, handles, &mut req)?;
5844                        let control_handle = RuleSetV4ControlHandle { inner: this.inner.clone() };
5845                        Ok(RuleSetV4Request::AuthenticateForRouteTable {
5846                            table: req.table,
5847                            token: req.token,
5848
5849                            responder: RuleSetV4AuthenticateForRouteTableResponder {
5850                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5851                                tx_id: header.tx_id,
5852                            },
5853                        })
5854                    }
5855                    0x2ae3d7e817cbff90 => {
5856                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5857                        let mut req = fidl::new_empty!(
5858                            BaseRuleSetRemoveRuleRequest,
5859                            fdomain_client::fidl::FDomainResourceDialect
5860                        );
5861                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<BaseRuleSetRemoveRuleRequest>(&header, _body_bytes, handles, &mut req)?;
5862                        let control_handle = RuleSetV4ControlHandle { inner: this.inner.clone() };
5863                        Ok(RuleSetV4Request::RemoveRule {
5864                            index: req.index,
5865
5866                            responder: RuleSetV4RemoveRuleResponder {
5867                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5868                                tx_id: header.tx_id,
5869                            },
5870                        })
5871                    }
5872                    0x457e1753672d4073 => {
5873                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5874                        let mut req = fidl::new_empty!(
5875                            fidl::encoding::EmptyPayload,
5876                            fdomain_client::fidl::FDomainResourceDialect
5877                        );
5878                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5879                        let control_handle = RuleSetV4ControlHandle { inner: this.inner.clone() };
5880                        Ok(RuleSetV4Request::Close { control_handle })
5881                    }
5882                    0x7f68325de94e80 => {
5883                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5884                        let mut req = fidl::new_empty!(
5885                            RuleSetV4AddRuleRequest,
5886                            fdomain_client::fidl::FDomainResourceDialect
5887                        );
5888                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RuleSetV4AddRuleRequest>(&header, _body_bytes, handles, &mut req)?;
5889                        let control_handle = RuleSetV4ControlHandle { inner: this.inner.clone() };
5890                        Ok(RuleSetV4Request::AddRule {
5891                            index: req.index,
5892                            matcher: req.matcher,
5893                            action: req.action,
5894
5895                            responder: RuleSetV4AddRuleResponder {
5896                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5897                                tx_id: header.tx_id,
5898                            },
5899                        })
5900                    }
5901                    _ => Err(fidl::Error::UnknownOrdinal {
5902                        ordinal: header.ordinal,
5903                        protocol_name:
5904                            <RuleSetV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
5905                    }),
5906                }))
5907            },
5908        )
5909    }
5910}
5911
5912/// Provides mutable access over a set of the system's IPv4 route rules.
5913///
5914/// A `RuleSet` has a priority and a rule has an index. A global order among the
5915/// rules is determined first by the priority of the `RuleSet` the rule belongs
5916/// to, and then the index of the rule inside the `RuleSet`.
5917///
5918/// This protocol encodes the lifetime of the rule set. Closing the client end
5919/// removes the rule set, and all the rules that are owned by the rule set.
5920#[derive(Debug)]
5921pub enum RuleSetV4Request {
5922    /// Authenticates for a route table that will be used in an action.
5923    AuthenticateForRouteTable {
5924        table: u32,
5925        token: fdomain_client::Event,
5926        responder: RuleSetV4AuthenticateForRouteTableResponder,
5927    },
5928    /// Removes a rule from this rule set.
5929    ///
5930    /// If the client tries to remove from an index that does not have a rule,
5931    /// the error `RULE_DOES_NOT_EXIST` will be returned.
5932    ///
5933    /// + request `index` the index of the rule.
5934    RemoveRule { index: u32, responder: RuleSetV4RemoveRuleResponder },
5935    /// Removes all rules in the rule set and the underlying channel will be
5936    /// closed after the rules are removed.
5937    ///
5938    /// This method provides a way for synchronous closure.
5939    Close { control_handle: RuleSetV4ControlHandle },
5940    /// Adds a rule to this rule set.
5941    ///
5942    /// If there is already a rule at the provided `index`, `RULE_ALREADY_EXISTS`
5943    /// is returned.
5944    ///
5945    /// + request `index` where to insert the rule.
5946    /// + request `matcher` the matcher of the rule.
5947    /// + request `action` action of the rule.
5948    AddRule {
5949        index: u32,
5950        matcher: fdomain_fuchsia_net_routes::RuleMatcherV4,
5951        action: fdomain_fuchsia_net_routes::RuleAction,
5952        responder: RuleSetV4AddRuleResponder,
5953    },
5954}
5955
5956impl RuleSetV4Request {
5957    #[allow(irrefutable_let_patterns)]
5958    pub fn into_authenticate_for_route_table(
5959        self,
5960    ) -> Option<(u32, fdomain_client::Event, RuleSetV4AuthenticateForRouteTableResponder)> {
5961        if let RuleSetV4Request::AuthenticateForRouteTable { table, token, responder } = self {
5962            Some((table, token, responder))
5963        } else {
5964            None
5965        }
5966    }
5967
5968    #[allow(irrefutable_let_patterns)]
5969    pub fn into_remove_rule(self) -> Option<(u32, RuleSetV4RemoveRuleResponder)> {
5970        if let RuleSetV4Request::RemoveRule { index, responder } = self {
5971            Some((index, responder))
5972        } else {
5973            None
5974        }
5975    }
5976
5977    #[allow(irrefutable_let_patterns)]
5978    pub fn into_close(self) -> Option<(RuleSetV4ControlHandle)> {
5979        if let RuleSetV4Request::Close { control_handle } = self {
5980            Some((control_handle))
5981        } else {
5982            None
5983        }
5984    }
5985
5986    #[allow(irrefutable_let_patterns)]
5987    pub fn into_add_rule(
5988        self,
5989    ) -> Option<(
5990        u32,
5991        fdomain_fuchsia_net_routes::RuleMatcherV4,
5992        fdomain_fuchsia_net_routes::RuleAction,
5993        RuleSetV4AddRuleResponder,
5994    )> {
5995        if let RuleSetV4Request::AddRule { index, matcher, action, responder } = self {
5996            Some((index, matcher, action, responder))
5997        } else {
5998            None
5999        }
6000    }
6001
6002    /// Name of the method defined in FIDL
6003    pub fn method_name(&self) -> &'static str {
6004        match *self {
6005            RuleSetV4Request::AuthenticateForRouteTable { .. } => "authenticate_for_route_table",
6006            RuleSetV4Request::RemoveRule { .. } => "remove_rule",
6007            RuleSetV4Request::Close { .. } => "close",
6008            RuleSetV4Request::AddRule { .. } => "add_rule",
6009        }
6010    }
6011}
6012
6013#[derive(Debug, Clone)]
6014pub struct RuleSetV4ControlHandle {
6015    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
6016}
6017
6018impl RuleSetV4ControlHandle {
6019    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
6020        self.inner.shutdown_with_epitaph(status.into())
6021    }
6022}
6023
6024impl fdomain_client::fidl::ControlHandle for RuleSetV4ControlHandle {
6025    fn shutdown(&self) {
6026        self.inner.shutdown()
6027    }
6028
6029    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
6030        self.inner.shutdown_with_epitaph(status)
6031    }
6032
6033    fn is_closed(&self) -> bool {
6034        self.inner.channel().is_closed()
6035    }
6036    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
6037        self.inner.channel().on_closed()
6038    }
6039}
6040
6041impl RuleSetV4ControlHandle {}
6042
6043#[must_use = "FIDL methods require a response to be sent"]
6044#[derive(Debug)]
6045pub struct RuleSetV4AuthenticateForRouteTableResponder {
6046    control_handle: std::mem::ManuallyDrop<RuleSetV4ControlHandle>,
6047    tx_id: u32,
6048}
6049
6050/// Set the the channel to be shutdown (see [`RuleSetV4ControlHandle::shutdown`])
6051/// if the responder is dropped without sending a response, so that the client
6052/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6053impl std::ops::Drop for RuleSetV4AuthenticateForRouteTableResponder {
6054    fn drop(&mut self) {
6055        self.control_handle.shutdown();
6056        // Safety: drops once, never accessed again
6057        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6058    }
6059}
6060
6061impl fdomain_client::fidl::Responder for RuleSetV4AuthenticateForRouteTableResponder {
6062    type ControlHandle = RuleSetV4ControlHandle;
6063
6064    fn control_handle(&self) -> &RuleSetV4ControlHandle {
6065        &self.control_handle
6066    }
6067
6068    fn drop_without_shutdown(mut self) {
6069        // Safety: drops once, never accessed again due to mem::forget
6070        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6071        // Prevent Drop from running (which would shut down the channel)
6072        std::mem::forget(self);
6073    }
6074}
6075
6076impl RuleSetV4AuthenticateForRouteTableResponder {
6077    /// Sends a response to the FIDL transaction.
6078    ///
6079    /// Sets the channel to shutdown if an error occurs.
6080    pub fn send(
6081        self,
6082        mut result: Result<(), AuthenticateForRouteTableError>,
6083    ) -> Result<(), fidl::Error> {
6084        let _result = self.send_raw(result);
6085        if _result.is_err() {
6086            self.control_handle.shutdown();
6087        }
6088        self.drop_without_shutdown();
6089        _result
6090    }
6091
6092    /// Similar to "send" but does not shutdown the channel if an error occurs.
6093    pub fn send_no_shutdown_on_err(
6094        self,
6095        mut result: Result<(), AuthenticateForRouteTableError>,
6096    ) -> Result<(), fidl::Error> {
6097        let _result = self.send_raw(result);
6098        self.drop_without_shutdown();
6099        _result
6100    }
6101
6102    fn send_raw(
6103        &self,
6104        mut result: Result<(), AuthenticateForRouteTableError>,
6105    ) -> Result<(), fidl::Error> {
6106        self.control_handle.inner.send::<fidl::encoding::ResultType<
6107            fidl::encoding::EmptyStruct,
6108            AuthenticateForRouteTableError,
6109        >>(
6110            result,
6111            self.tx_id,
6112            0x6fd845360ed9bc8f,
6113            fidl::encoding::DynamicFlags::empty(),
6114        )
6115    }
6116}
6117
6118#[must_use = "FIDL methods require a response to be sent"]
6119#[derive(Debug)]
6120pub struct RuleSetV4RemoveRuleResponder {
6121    control_handle: std::mem::ManuallyDrop<RuleSetV4ControlHandle>,
6122    tx_id: u32,
6123}
6124
6125/// Set the the channel to be shutdown (see [`RuleSetV4ControlHandle::shutdown`])
6126/// if the responder is dropped without sending a response, so that the client
6127/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6128impl std::ops::Drop for RuleSetV4RemoveRuleResponder {
6129    fn drop(&mut self) {
6130        self.control_handle.shutdown();
6131        // Safety: drops once, never accessed again
6132        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6133    }
6134}
6135
6136impl fdomain_client::fidl::Responder for RuleSetV4RemoveRuleResponder {
6137    type ControlHandle = RuleSetV4ControlHandle;
6138
6139    fn control_handle(&self) -> &RuleSetV4ControlHandle {
6140        &self.control_handle
6141    }
6142
6143    fn drop_without_shutdown(mut self) {
6144        // Safety: drops once, never accessed again due to mem::forget
6145        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6146        // Prevent Drop from running (which would shut down the channel)
6147        std::mem::forget(self);
6148    }
6149}
6150
6151impl RuleSetV4RemoveRuleResponder {
6152    /// Sends a response to the FIDL transaction.
6153    ///
6154    /// Sets the channel to shutdown if an error occurs.
6155    pub fn send(self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
6156        let _result = self.send_raw(result);
6157        if _result.is_err() {
6158            self.control_handle.shutdown();
6159        }
6160        self.drop_without_shutdown();
6161        _result
6162    }
6163
6164    /// Similar to "send" but does not shutdown the channel if an error occurs.
6165    pub fn send_no_shutdown_on_err(
6166        self,
6167        mut result: Result<(), RuleSetError>,
6168    ) -> Result<(), fidl::Error> {
6169        let _result = self.send_raw(result);
6170        self.drop_without_shutdown();
6171        _result
6172    }
6173
6174    fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
6175        self.control_handle.inner.send::<fidl::encoding::ResultType<
6176            fidl::encoding::EmptyStruct,
6177            RuleSetError,
6178        >>(
6179            result,
6180            self.tx_id,
6181            0x2ae3d7e817cbff90,
6182            fidl::encoding::DynamicFlags::empty(),
6183        )
6184    }
6185}
6186
6187#[must_use = "FIDL methods require a response to be sent"]
6188#[derive(Debug)]
6189pub struct RuleSetV4AddRuleResponder {
6190    control_handle: std::mem::ManuallyDrop<RuleSetV4ControlHandle>,
6191    tx_id: u32,
6192}
6193
6194/// Set the the channel to be shutdown (see [`RuleSetV4ControlHandle::shutdown`])
6195/// if the responder is dropped without sending a response, so that the client
6196/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6197impl std::ops::Drop for RuleSetV4AddRuleResponder {
6198    fn drop(&mut self) {
6199        self.control_handle.shutdown();
6200        // Safety: drops once, never accessed again
6201        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6202    }
6203}
6204
6205impl fdomain_client::fidl::Responder for RuleSetV4AddRuleResponder {
6206    type ControlHandle = RuleSetV4ControlHandle;
6207
6208    fn control_handle(&self) -> &RuleSetV4ControlHandle {
6209        &self.control_handle
6210    }
6211
6212    fn drop_without_shutdown(mut self) {
6213        // Safety: drops once, never accessed again due to mem::forget
6214        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6215        // Prevent Drop from running (which would shut down the channel)
6216        std::mem::forget(self);
6217    }
6218}
6219
6220impl RuleSetV4AddRuleResponder {
6221    /// Sends a response to the FIDL transaction.
6222    ///
6223    /// Sets the channel to shutdown if an error occurs.
6224    pub fn send(self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
6225        let _result = self.send_raw(result);
6226        if _result.is_err() {
6227            self.control_handle.shutdown();
6228        }
6229        self.drop_without_shutdown();
6230        _result
6231    }
6232
6233    /// Similar to "send" but does not shutdown the channel if an error occurs.
6234    pub fn send_no_shutdown_on_err(
6235        self,
6236        mut result: Result<(), RuleSetError>,
6237    ) -> Result<(), fidl::Error> {
6238        let _result = self.send_raw(result);
6239        self.drop_without_shutdown();
6240        _result
6241    }
6242
6243    fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
6244        self.control_handle.inner.send::<fidl::encoding::ResultType<
6245            fidl::encoding::EmptyStruct,
6246            RuleSetError,
6247        >>(
6248            result,
6249            self.tx_id,
6250            0x7f68325de94e80,
6251            fidl::encoding::DynamicFlags::empty(),
6252        )
6253    }
6254}
6255
6256#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6257pub struct RuleSetV6Marker;
6258
6259impl fdomain_client::fidl::ProtocolMarker for RuleSetV6Marker {
6260    type Proxy = RuleSetV6Proxy;
6261    type RequestStream = RuleSetV6RequestStream;
6262
6263    const DEBUG_NAME: &'static str = "(anonymous) RuleSetV6";
6264}
6265pub type RuleSetV6AddRuleResult = Result<(), RuleSetError>;
6266
6267pub trait RuleSetV6ProxyInterface: Send + Sync {
6268    type AuthenticateForRouteTableResponseFut: std::future::Future<
6269            Output = Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error>,
6270        > + Send;
6271    fn r#authenticate_for_route_table(
6272        &self,
6273        table: u32,
6274        token: fdomain_client::Event,
6275    ) -> Self::AuthenticateForRouteTableResponseFut;
6276    type RemoveRuleResponseFut: std::future::Future<Output = Result<BaseRuleSetRemoveRuleResult, fidl::Error>>
6277        + Send;
6278    fn r#remove_rule(&self, index: u32) -> Self::RemoveRuleResponseFut;
6279    fn r#close(&self) -> Result<(), fidl::Error>;
6280    type AddRuleResponseFut: std::future::Future<Output = Result<RuleSetV6AddRuleResult, fidl::Error>>
6281        + Send;
6282    fn r#add_rule(
6283        &self,
6284        index: u32,
6285        matcher: &fdomain_fuchsia_net_routes::RuleMatcherV6,
6286        action: &fdomain_fuchsia_net_routes::RuleAction,
6287    ) -> Self::AddRuleResponseFut;
6288}
6289
6290#[derive(Debug, Clone)]
6291pub struct RuleSetV6Proxy {
6292    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
6293}
6294
6295impl fdomain_client::fidl::Proxy for RuleSetV6Proxy {
6296    type Protocol = RuleSetV6Marker;
6297
6298    fn from_channel(inner: fdomain_client::Channel) -> Self {
6299        Self::new(inner)
6300    }
6301
6302    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
6303        self.client.into_channel().map_err(|client| Self { client })
6304    }
6305
6306    fn as_channel(&self) -> &fdomain_client::Channel {
6307        self.client.as_channel()
6308    }
6309}
6310
6311impl RuleSetV6Proxy {
6312    /// Create a new Proxy for fuchsia.net.routes.admin/RuleSetV6.
6313    pub fn new(channel: fdomain_client::Channel) -> Self {
6314        let protocol_name = <RuleSetV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
6315        Self { client: fidl::client::Client::new(channel, protocol_name) }
6316    }
6317
6318    /// Get a Stream of events from the remote end of the protocol.
6319    ///
6320    /// # Panics
6321    ///
6322    /// Panics if the event stream was already taken.
6323    pub fn take_event_stream(&self) -> RuleSetV6EventStream {
6324        RuleSetV6EventStream { event_receiver: self.client.take_event_receiver() }
6325    }
6326
6327    /// Authenticates for a route table that will be used in an action.
6328    pub fn r#authenticate_for_route_table(
6329        &self,
6330        mut table: u32,
6331        mut token: fdomain_client::Event,
6332    ) -> fidl::client::QueryResponseFut<
6333        BaseRuleSetAuthenticateForRouteTableResult,
6334        fdomain_client::fidl::FDomainResourceDialect,
6335    > {
6336        RuleSetV6ProxyInterface::r#authenticate_for_route_table(self, table, token)
6337    }
6338
6339    /// Removes a rule from this rule set.
6340    ///
6341    /// If the client tries to remove from an index that does not have a rule,
6342    /// the error `RULE_DOES_NOT_EXIST` will be returned.
6343    ///
6344    /// + request `index` the index of the rule.
6345    pub fn r#remove_rule(
6346        &self,
6347        mut index: u32,
6348    ) -> fidl::client::QueryResponseFut<
6349        BaseRuleSetRemoveRuleResult,
6350        fdomain_client::fidl::FDomainResourceDialect,
6351    > {
6352        RuleSetV6ProxyInterface::r#remove_rule(self, index)
6353    }
6354
6355    /// Removes all rules in the rule set and the underlying channel will be
6356    /// closed after the rules are removed.
6357    ///
6358    /// This method provides a way for synchronous closure.
6359    pub fn r#close(&self) -> Result<(), fidl::Error> {
6360        RuleSetV6ProxyInterface::r#close(self)
6361    }
6362
6363    /// Adds a rule to this rule set.
6364    ///
6365    /// If there is already a rule at the provided `index`, `RULE_ALREADY_EXISTS`
6366    /// is returned.
6367    ///
6368    /// + request `index` where to insert the rule.
6369    /// + request `matcher` the matcher of the rule.
6370    /// + request `action` action of the rule.
6371    pub fn r#add_rule(
6372        &self,
6373        mut index: u32,
6374        mut matcher: &fdomain_fuchsia_net_routes::RuleMatcherV6,
6375        mut action: &fdomain_fuchsia_net_routes::RuleAction,
6376    ) -> fidl::client::QueryResponseFut<
6377        RuleSetV6AddRuleResult,
6378        fdomain_client::fidl::FDomainResourceDialect,
6379    > {
6380        RuleSetV6ProxyInterface::r#add_rule(self, index, matcher, action)
6381    }
6382}
6383
6384impl RuleSetV6ProxyInterface for RuleSetV6Proxy {
6385    type AuthenticateForRouteTableResponseFut = fidl::client::QueryResponseFut<
6386        BaseRuleSetAuthenticateForRouteTableResult,
6387        fdomain_client::fidl::FDomainResourceDialect,
6388    >;
6389    fn r#authenticate_for_route_table(
6390        &self,
6391        mut table: u32,
6392        mut token: fdomain_client::Event,
6393    ) -> Self::AuthenticateForRouteTableResponseFut {
6394        fn _decode(
6395            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6396        ) -> Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error> {
6397            let _response = fidl::client::decode_transaction_body::<
6398                fidl::encoding::ResultType<
6399                    fidl::encoding::EmptyStruct,
6400                    AuthenticateForRouteTableError,
6401                >,
6402                fdomain_client::fidl::FDomainResourceDialect,
6403                0x6fd845360ed9bc8f,
6404            >(_buf?)?;
6405            Ok(_response.map(|x| x))
6406        }
6407        self.client.send_query_and_decode::<
6408            ProofOfRouteTableAuthorization,
6409            BaseRuleSetAuthenticateForRouteTableResult,
6410        >(
6411            (table, token,),
6412            0x6fd845360ed9bc8f,
6413            fidl::encoding::DynamicFlags::empty(),
6414            _decode,
6415        )
6416    }
6417
6418    type RemoveRuleResponseFut = fidl::client::QueryResponseFut<
6419        BaseRuleSetRemoveRuleResult,
6420        fdomain_client::fidl::FDomainResourceDialect,
6421    >;
6422    fn r#remove_rule(&self, mut index: u32) -> Self::RemoveRuleResponseFut {
6423        fn _decode(
6424            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6425        ) -> Result<BaseRuleSetRemoveRuleResult, fidl::Error> {
6426            let _response = fidl::client::decode_transaction_body::<
6427                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
6428                fdomain_client::fidl::FDomainResourceDialect,
6429                0x2ae3d7e817cbff90,
6430            >(_buf?)?;
6431            Ok(_response.map(|x| x))
6432        }
6433        self.client
6434            .send_query_and_decode::<BaseRuleSetRemoveRuleRequest, BaseRuleSetRemoveRuleResult>(
6435                (index,),
6436                0x2ae3d7e817cbff90,
6437                fidl::encoding::DynamicFlags::empty(),
6438                _decode,
6439            )
6440    }
6441
6442    fn r#close(&self) -> Result<(), fidl::Error> {
6443        self.client.send::<fidl::encoding::EmptyPayload>(
6444            (),
6445            0x457e1753672d4073,
6446            fidl::encoding::DynamicFlags::empty(),
6447        )
6448    }
6449
6450    type AddRuleResponseFut = fidl::client::QueryResponseFut<
6451        RuleSetV6AddRuleResult,
6452        fdomain_client::fidl::FDomainResourceDialect,
6453    >;
6454    fn r#add_rule(
6455        &self,
6456        mut index: u32,
6457        mut matcher: &fdomain_fuchsia_net_routes::RuleMatcherV6,
6458        mut action: &fdomain_fuchsia_net_routes::RuleAction,
6459    ) -> Self::AddRuleResponseFut {
6460        fn _decode(
6461            mut _buf: Result<<fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6462        ) -> Result<RuleSetV6AddRuleResult, fidl::Error> {
6463            let _response = fidl::client::decode_transaction_body::<
6464                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
6465                fdomain_client::fidl::FDomainResourceDialect,
6466                0x946cad8f8a726b3,
6467            >(_buf?)?;
6468            Ok(_response.map(|x| x))
6469        }
6470        self.client.send_query_and_decode::<RuleSetV6AddRuleRequest, RuleSetV6AddRuleResult>(
6471            (index, matcher, action),
6472            0x946cad8f8a726b3,
6473            fidl::encoding::DynamicFlags::empty(),
6474            _decode,
6475        )
6476    }
6477}
6478
6479pub struct RuleSetV6EventStream {
6480    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
6481}
6482
6483impl std::marker::Unpin for RuleSetV6EventStream {}
6484
6485impl futures::stream::FusedStream for RuleSetV6EventStream {
6486    fn is_terminated(&self) -> bool {
6487        self.event_receiver.is_terminated()
6488    }
6489}
6490
6491impl futures::Stream for RuleSetV6EventStream {
6492    type Item = Result<RuleSetV6Event, fidl::Error>;
6493
6494    fn poll_next(
6495        mut self: std::pin::Pin<&mut Self>,
6496        cx: &mut std::task::Context<'_>,
6497    ) -> std::task::Poll<Option<Self::Item>> {
6498        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6499            &mut self.event_receiver,
6500            cx
6501        )?) {
6502            Some(buf) => std::task::Poll::Ready(Some(RuleSetV6Event::decode(buf))),
6503            None => std::task::Poll::Ready(None),
6504        }
6505    }
6506}
6507
6508#[derive(Debug)]
6509pub enum RuleSetV6Event {}
6510
6511impl RuleSetV6Event {
6512    /// Decodes a message buffer as a [`RuleSetV6Event`].
6513    fn decode(
6514        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6515    ) -> Result<RuleSetV6Event, fidl::Error> {
6516        let (bytes, _handles) = buf.split_mut();
6517        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6518        debug_assert_eq!(tx_header.tx_id, 0);
6519        match tx_header.ordinal {
6520            _ => Err(fidl::Error::UnknownOrdinal {
6521                ordinal: tx_header.ordinal,
6522                protocol_name:
6523                    <RuleSetV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
6524            }),
6525        }
6526    }
6527}
6528
6529/// A Stream of incoming requests for fuchsia.net.routes.admin/RuleSetV6.
6530pub struct RuleSetV6RequestStream {
6531    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
6532    is_terminated: bool,
6533}
6534
6535impl std::marker::Unpin for RuleSetV6RequestStream {}
6536
6537impl futures::stream::FusedStream for RuleSetV6RequestStream {
6538    fn is_terminated(&self) -> bool {
6539        self.is_terminated
6540    }
6541}
6542
6543impl fdomain_client::fidl::RequestStream for RuleSetV6RequestStream {
6544    type Protocol = RuleSetV6Marker;
6545    type ControlHandle = RuleSetV6ControlHandle;
6546
6547    fn from_channel(channel: fdomain_client::Channel) -> Self {
6548        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6549    }
6550
6551    fn control_handle(&self) -> Self::ControlHandle {
6552        RuleSetV6ControlHandle { inner: self.inner.clone() }
6553    }
6554
6555    fn into_inner(
6556        self,
6557    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
6558    {
6559        (self.inner, self.is_terminated)
6560    }
6561
6562    fn from_inner(
6563        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
6564        is_terminated: bool,
6565    ) -> Self {
6566        Self { inner, is_terminated }
6567    }
6568}
6569
6570impl futures::Stream for RuleSetV6RequestStream {
6571    type Item = Result<RuleSetV6Request, fidl::Error>;
6572
6573    fn poll_next(
6574        mut self: std::pin::Pin<&mut Self>,
6575        cx: &mut std::task::Context<'_>,
6576    ) -> std::task::Poll<Option<Self::Item>> {
6577        let this = &mut *self;
6578        if this.inner.check_shutdown(cx) {
6579            this.is_terminated = true;
6580            return std::task::Poll::Ready(None);
6581        }
6582        if this.is_terminated {
6583            panic!("polled RuleSetV6RequestStream after completion");
6584        }
6585        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
6586            |bytes, handles| {
6587                match this.inner.channel().read_etc(cx, bytes, handles) {
6588                    std::task::Poll::Ready(Ok(())) => {}
6589                    std::task::Poll::Pending => return std::task::Poll::Pending,
6590                    std::task::Poll::Ready(Err(None)) => {
6591                        this.is_terminated = true;
6592                        return std::task::Poll::Ready(None);
6593                    }
6594                    std::task::Poll::Ready(Err(Some(e))) => {
6595                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6596                            e.into(),
6597                        ))));
6598                    }
6599                }
6600
6601                // A message has been received from the channel
6602                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6603
6604                std::task::Poll::Ready(Some(match header.ordinal {
6605                    0x6fd845360ed9bc8f => {
6606                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6607                        let mut req = fidl::new_empty!(
6608                            ProofOfRouteTableAuthorization,
6609                            fdomain_client::fidl::FDomainResourceDialect
6610                        );
6611                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<ProofOfRouteTableAuthorization>(&header, _body_bytes, handles, &mut req)?;
6612                        let control_handle = RuleSetV6ControlHandle { inner: this.inner.clone() };
6613                        Ok(RuleSetV6Request::AuthenticateForRouteTable {
6614                            table: req.table,
6615                            token: req.token,
6616
6617                            responder: RuleSetV6AuthenticateForRouteTableResponder {
6618                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6619                                tx_id: header.tx_id,
6620                            },
6621                        })
6622                    }
6623                    0x2ae3d7e817cbff90 => {
6624                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6625                        let mut req = fidl::new_empty!(
6626                            BaseRuleSetRemoveRuleRequest,
6627                            fdomain_client::fidl::FDomainResourceDialect
6628                        );
6629                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<BaseRuleSetRemoveRuleRequest>(&header, _body_bytes, handles, &mut req)?;
6630                        let control_handle = RuleSetV6ControlHandle { inner: this.inner.clone() };
6631                        Ok(RuleSetV6Request::RemoveRule {
6632                            index: req.index,
6633
6634                            responder: RuleSetV6RemoveRuleResponder {
6635                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6636                                tx_id: header.tx_id,
6637                            },
6638                        })
6639                    }
6640                    0x457e1753672d4073 => {
6641                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6642                        let mut req = fidl::new_empty!(
6643                            fidl::encoding::EmptyPayload,
6644                            fdomain_client::fidl::FDomainResourceDialect
6645                        );
6646                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6647                        let control_handle = RuleSetV6ControlHandle { inner: this.inner.clone() };
6648                        Ok(RuleSetV6Request::Close { control_handle })
6649                    }
6650                    0x946cad8f8a726b3 => {
6651                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6652                        let mut req = fidl::new_empty!(
6653                            RuleSetV6AddRuleRequest,
6654                            fdomain_client::fidl::FDomainResourceDialect
6655                        );
6656                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RuleSetV6AddRuleRequest>(&header, _body_bytes, handles, &mut req)?;
6657                        let control_handle = RuleSetV6ControlHandle { inner: this.inner.clone() };
6658                        Ok(RuleSetV6Request::AddRule {
6659                            index: req.index,
6660                            matcher: req.matcher,
6661                            action: req.action,
6662
6663                            responder: RuleSetV6AddRuleResponder {
6664                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6665                                tx_id: header.tx_id,
6666                            },
6667                        })
6668                    }
6669                    _ => Err(fidl::Error::UnknownOrdinal {
6670                        ordinal: header.ordinal,
6671                        protocol_name:
6672                            <RuleSetV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
6673                    }),
6674                }))
6675            },
6676        )
6677    }
6678}
6679
6680/// Provides mutable access over a set of the system's IPv6 route rules.
6681///
6682/// A `RuleSet` has a priority and a rule has an index. A global order among the
6683/// rules is determined first by the priority of the `RuleSet` the rule belongs
6684/// to, and then the index of the rule inside the `RuleSet`.
6685///
6686/// This protocol encodes the lifetime of the rule set. Closing the client end
6687/// removes the rule set, and all the rules that are owned by the rule set.
6688#[derive(Debug)]
6689pub enum RuleSetV6Request {
6690    /// Authenticates for a route table that will be used in an action.
6691    AuthenticateForRouteTable {
6692        table: u32,
6693        token: fdomain_client::Event,
6694        responder: RuleSetV6AuthenticateForRouteTableResponder,
6695    },
6696    /// Removes a rule from this rule set.
6697    ///
6698    /// If the client tries to remove from an index that does not have a rule,
6699    /// the error `RULE_DOES_NOT_EXIST` will be returned.
6700    ///
6701    /// + request `index` the index of the rule.
6702    RemoveRule { index: u32, responder: RuleSetV6RemoveRuleResponder },
6703    /// Removes all rules in the rule set and the underlying channel will be
6704    /// closed after the rules are removed.
6705    ///
6706    /// This method provides a way for synchronous closure.
6707    Close { control_handle: RuleSetV6ControlHandle },
6708    /// Adds a rule to this rule set.
6709    ///
6710    /// If there is already a rule at the provided `index`, `RULE_ALREADY_EXISTS`
6711    /// is returned.
6712    ///
6713    /// + request `index` where to insert the rule.
6714    /// + request `matcher` the matcher of the rule.
6715    /// + request `action` action of the rule.
6716    AddRule {
6717        index: u32,
6718        matcher: fdomain_fuchsia_net_routes::RuleMatcherV6,
6719        action: fdomain_fuchsia_net_routes::RuleAction,
6720        responder: RuleSetV6AddRuleResponder,
6721    },
6722}
6723
6724impl RuleSetV6Request {
6725    #[allow(irrefutable_let_patterns)]
6726    pub fn into_authenticate_for_route_table(
6727        self,
6728    ) -> Option<(u32, fdomain_client::Event, RuleSetV6AuthenticateForRouteTableResponder)> {
6729        if let RuleSetV6Request::AuthenticateForRouteTable { table, token, responder } = self {
6730            Some((table, token, responder))
6731        } else {
6732            None
6733        }
6734    }
6735
6736    #[allow(irrefutable_let_patterns)]
6737    pub fn into_remove_rule(self) -> Option<(u32, RuleSetV6RemoveRuleResponder)> {
6738        if let RuleSetV6Request::RemoveRule { index, responder } = self {
6739            Some((index, responder))
6740        } else {
6741            None
6742        }
6743    }
6744
6745    #[allow(irrefutable_let_patterns)]
6746    pub fn into_close(self) -> Option<(RuleSetV6ControlHandle)> {
6747        if let RuleSetV6Request::Close { control_handle } = self {
6748            Some((control_handle))
6749        } else {
6750            None
6751        }
6752    }
6753
6754    #[allow(irrefutable_let_patterns)]
6755    pub fn into_add_rule(
6756        self,
6757    ) -> Option<(
6758        u32,
6759        fdomain_fuchsia_net_routes::RuleMatcherV6,
6760        fdomain_fuchsia_net_routes::RuleAction,
6761        RuleSetV6AddRuleResponder,
6762    )> {
6763        if let RuleSetV6Request::AddRule { index, matcher, action, responder } = self {
6764            Some((index, matcher, action, responder))
6765        } else {
6766            None
6767        }
6768    }
6769
6770    /// Name of the method defined in FIDL
6771    pub fn method_name(&self) -> &'static str {
6772        match *self {
6773            RuleSetV6Request::AuthenticateForRouteTable { .. } => "authenticate_for_route_table",
6774            RuleSetV6Request::RemoveRule { .. } => "remove_rule",
6775            RuleSetV6Request::Close { .. } => "close",
6776            RuleSetV6Request::AddRule { .. } => "add_rule",
6777        }
6778    }
6779}
6780
6781#[derive(Debug, Clone)]
6782pub struct RuleSetV6ControlHandle {
6783    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
6784}
6785
6786impl RuleSetV6ControlHandle {
6787    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
6788        self.inner.shutdown_with_epitaph(status.into())
6789    }
6790}
6791
6792impl fdomain_client::fidl::ControlHandle for RuleSetV6ControlHandle {
6793    fn shutdown(&self) {
6794        self.inner.shutdown()
6795    }
6796
6797    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
6798        self.inner.shutdown_with_epitaph(status)
6799    }
6800
6801    fn is_closed(&self) -> bool {
6802        self.inner.channel().is_closed()
6803    }
6804    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
6805        self.inner.channel().on_closed()
6806    }
6807}
6808
6809impl RuleSetV6ControlHandle {}
6810
6811#[must_use = "FIDL methods require a response to be sent"]
6812#[derive(Debug)]
6813pub struct RuleSetV6AuthenticateForRouteTableResponder {
6814    control_handle: std::mem::ManuallyDrop<RuleSetV6ControlHandle>,
6815    tx_id: u32,
6816}
6817
6818/// Set the the channel to be shutdown (see [`RuleSetV6ControlHandle::shutdown`])
6819/// if the responder is dropped without sending a response, so that the client
6820/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6821impl std::ops::Drop for RuleSetV6AuthenticateForRouteTableResponder {
6822    fn drop(&mut self) {
6823        self.control_handle.shutdown();
6824        // Safety: drops once, never accessed again
6825        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6826    }
6827}
6828
6829impl fdomain_client::fidl::Responder for RuleSetV6AuthenticateForRouteTableResponder {
6830    type ControlHandle = RuleSetV6ControlHandle;
6831
6832    fn control_handle(&self) -> &RuleSetV6ControlHandle {
6833        &self.control_handle
6834    }
6835
6836    fn drop_without_shutdown(mut self) {
6837        // Safety: drops once, never accessed again due to mem::forget
6838        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6839        // Prevent Drop from running (which would shut down the channel)
6840        std::mem::forget(self);
6841    }
6842}
6843
6844impl RuleSetV6AuthenticateForRouteTableResponder {
6845    /// Sends a response to the FIDL transaction.
6846    ///
6847    /// Sets the channel to shutdown if an error occurs.
6848    pub fn send(
6849        self,
6850        mut result: Result<(), AuthenticateForRouteTableError>,
6851    ) -> Result<(), fidl::Error> {
6852        let _result = self.send_raw(result);
6853        if _result.is_err() {
6854            self.control_handle.shutdown();
6855        }
6856        self.drop_without_shutdown();
6857        _result
6858    }
6859
6860    /// Similar to "send" but does not shutdown the channel if an error occurs.
6861    pub fn send_no_shutdown_on_err(
6862        self,
6863        mut result: Result<(), AuthenticateForRouteTableError>,
6864    ) -> Result<(), fidl::Error> {
6865        let _result = self.send_raw(result);
6866        self.drop_without_shutdown();
6867        _result
6868    }
6869
6870    fn send_raw(
6871        &self,
6872        mut result: Result<(), AuthenticateForRouteTableError>,
6873    ) -> Result<(), fidl::Error> {
6874        self.control_handle.inner.send::<fidl::encoding::ResultType<
6875            fidl::encoding::EmptyStruct,
6876            AuthenticateForRouteTableError,
6877        >>(
6878            result,
6879            self.tx_id,
6880            0x6fd845360ed9bc8f,
6881            fidl::encoding::DynamicFlags::empty(),
6882        )
6883    }
6884}
6885
6886#[must_use = "FIDL methods require a response to be sent"]
6887#[derive(Debug)]
6888pub struct RuleSetV6RemoveRuleResponder {
6889    control_handle: std::mem::ManuallyDrop<RuleSetV6ControlHandle>,
6890    tx_id: u32,
6891}
6892
6893/// Set the the channel to be shutdown (see [`RuleSetV6ControlHandle::shutdown`])
6894/// if the responder is dropped without sending a response, so that the client
6895/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6896impl std::ops::Drop for RuleSetV6RemoveRuleResponder {
6897    fn drop(&mut self) {
6898        self.control_handle.shutdown();
6899        // Safety: drops once, never accessed again
6900        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6901    }
6902}
6903
6904impl fdomain_client::fidl::Responder for RuleSetV6RemoveRuleResponder {
6905    type ControlHandle = RuleSetV6ControlHandle;
6906
6907    fn control_handle(&self) -> &RuleSetV6ControlHandle {
6908        &self.control_handle
6909    }
6910
6911    fn drop_without_shutdown(mut self) {
6912        // Safety: drops once, never accessed again due to mem::forget
6913        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6914        // Prevent Drop from running (which would shut down the channel)
6915        std::mem::forget(self);
6916    }
6917}
6918
6919impl RuleSetV6RemoveRuleResponder {
6920    /// Sends a response to the FIDL transaction.
6921    ///
6922    /// Sets the channel to shutdown if an error occurs.
6923    pub fn send(self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
6924        let _result = self.send_raw(result);
6925        if _result.is_err() {
6926            self.control_handle.shutdown();
6927        }
6928        self.drop_without_shutdown();
6929        _result
6930    }
6931
6932    /// Similar to "send" but does not shutdown the channel if an error occurs.
6933    pub fn send_no_shutdown_on_err(
6934        self,
6935        mut result: Result<(), RuleSetError>,
6936    ) -> Result<(), fidl::Error> {
6937        let _result = self.send_raw(result);
6938        self.drop_without_shutdown();
6939        _result
6940    }
6941
6942    fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
6943        self.control_handle.inner.send::<fidl::encoding::ResultType<
6944            fidl::encoding::EmptyStruct,
6945            RuleSetError,
6946        >>(
6947            result,
6948            self.tx_id,
6949            0x2ae3d7e817cbff90,
6950            fidl::encoding::DynamicFlags::empty(),
6951        )
6952    }
6953}
6954
6955#[must_use = "FIDL methods require a response to be sent"]
6956#[derive(Debug)]
6957pub struct RuleSetV6AddRuleResponder {
6958    control_handle: std::mem::ManuallyDrop<RuleSetV6ControlHandle>,
6959    tx_id: u32,
6960}
6961
6962/// Set the the channel to be shutdown (see [`RuleSetV6ControlHandle::shutdown`])
6963/// if the responder is dropped without sending a response, so that the client
6964/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6965impl std::ops::Drop for RuleSetV6AddRuleResponder {
6966    fn drop(&mut self) {
6967        self.control_handle.shutdown();
6968        // Safety: drops once, never accessed again
6969        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6970    }
6971}
6972
6973impl fdomain_client::fidl::Responder for RuleSetV6AddRuleResponder {
6974    type ControlHandle = RuleSetV6ControlHandle;
6975
6976    fn control_handle(&self) -> &RuleSetV6ControlHandle {
6977        &self.control_handle
6978    }
6979
6980    fn drop_without_shutdown(mut self) {
6981        // Safety: drops once, never accessed again due to mem::forget
6982        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6983        // Prevent Drop from running (which would shut down the channel)
6984        std::mem::forget(self);
6985    }
6986}
6987
6988impl RuleSetV6AddRuleResponder {
6989    /// Sends a response to the FIDL transaction.
6990    ///
6991    /// Sets the channel to shutdown if an error occurs.
6992    pub fn send(self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
6993        let _result = self.send_raw(result);
6994        if _result.is_err() {
6995            self.control_handle.shutdown();
6996        }
6997        self.drop_without_shutdown();
6998        _result
6999    }
7000
7001    /// Similar to "send" but does not shutdown the channel if an error occurs.
7002    pub fn send_no_shutdown_on_err(
7003        self,
7004        mut result: Result<(), RuleSetError>,
7005    ) -> Result<(), fidl::Error> {
7006        let _result = self.send_raw(result);
7007        self.drop_without_shutdown();
7008        _result
7009    }
7010
7011    fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
7012        self.control_handle.inner.send::<fidl::encoding::ResultType<
7013            fidl::encoding::EmptyStruct,
7014            RuleSetError,
7015        >>(
7016            result,
7017            self.tx_id,
7018            0x946cad8f8a726b3,
7019            fidl::encoding::DynamicFlags::empty(),
7020        )
7021    }
7022}
7023
7024#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7025pub struct RuleTableV4Marker;
7026
7027impl fdomain_client::fidl::ProtocolMarker for RuleTableV4Marker {
7028    type Proxy = RuleTableV4Proxy;
7029    type RequestStream = RuleTableV4RequestStream;
7030
7031    const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RuleTableV4";
7032}
7033impl fdomain_client::fidl::DiscoverableProtocolMarker for RuleTableV4Marker {}
7034
7035pub trait RuleTableV4ProxyInterface: Send + Sync {
7036    fn r#new_rule_set(
7037        &self,
7038        priority: u32,
7039        rule_set: fdomain_client::fidl::ServerEnd<RuleSetV4Marker>,
7040    ) -> Result<(), fidl::Error>;
7041}
7042
7043#[derive(Debug, Clone)]
7044pub struct RuleTableV4Proxy {
7045    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
7046}
7047
7048impl fdomain_client::fidl::Proxy for RuleTableV4Proxy {
7049    type Protocol = RuleTableV4Marker;
7050
7051    fn from_channel(inner: fdomain_client::Channel) -> Self {
7052        Self::new(inner)
7053    }
7054
7055    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
7056        self.client.into_channel().map_err(|client| Self { client })
7057    }
7058
7059    fn as_channel(&self) -> &fdomain_client::Channel {
7060        self.client.as_channel()
7061    }
7062}
7063
7064impl RuleTableV4Proxy {
7065    /// Create a new Proxy for fuchsia.net.routes.admin/RuleTableV4.
7066    pub fn new(channel: fdomain_client::Channel) -> Self {
7067        let protocol_name = <RuleTableV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
7068        Self { client: fidl::client::Client::new(channel, protocol_name) }
7069    }
7070
7071    /// Get a Stream of events from the remote end of the protocol.
7072    ///
7073    /// # Panics
7074    ///
7075    /// Panics if the event stream was already taken.
7076    pub fn take_event_stream(&self) -> RuleTableV4EventStream {
7077        RuleTableV4EventStream { event_receiver: self.client.take_event_receiver() }
7078    }
7079
7080    /// Returns an empty rule set at requested priority.
7081    ///
7082    /// Clients are free to manage the rules within their own rule set, but not
7083    /// the rule set of others. Only one rule set is allowed at each `priority`
7084    /// level. Channel is closed with `ZX_ERR_ALREADY_EXISTS` if there's already
7085    /// a rule set at the given `priority`.
7086    ///
7087    /// + request `priority` the priority of this `RuleSetV4`, all rule sets are
7088    ///   globally ordered according to this number.
7089    /// + request `rule_set` grants access to the `RuleSetV4` protocol.
7090    pub fn r#new_rule_set(
7091        &self,
7092        mut priority: u32,
7093        mut rule_set: fdomain_client::fidl::ServerEnd<RuleSetV4Marker>,
7094    ) -> Result<(), fidl::Error> {
7095        RuleTableV4ProxyInterface::r#new_rule_set(self, priority, rule_set)
7096    }
7097}
7098
7099impl RuleTableV4ProxyInterface for RuleTableV4Proxy {
7100    fn r#new_rule_set(
7101        &self,
7102        mut priority: u32,
7103        mut rule_set: fdomain_client::fidl::ServerEnd<RuleSetV4Marker>,
7104    ) -> Result<(), fidl::Error> {
7105        self.client.send::<RuleTableV4NewRuleSetRequest>(
7106            (priority, rule_set),
7107            0xa32a9097da46f3a,
7108            fidl::encoding::DynamicFlags::empty(),
7109        )
7110    }
7111}
7112
7113pub struct RuleTableV4EventStream {
7114    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
7115}
7116
7117impl std::marker::Unpin for RuleTableV4EventStream {}
7118
7119impl futures::stream::FusedStream for RuleTableV4EventStream {
7120    fn is_terminated(&self) -> bool {
7121        self.event_receiver.is_terminated()
7122    }
7123}
7124
7125impl futures::Stream for RuleTableV4EventStream {
7126    type Item = Result<RuleTableV4Event, fidl::Error>;
7127
7128    fn poll_next(
7129        mut self: std::pin::Pin<&mut Self>,
7130        cx: &mut std::task::Context<'_>,
7131    ) -> std::task::Poll<Option<Self::Item>> {
7132        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7133            &mut self.event_receiver,
7134            cx
7135        )?) {
7136            Some(buf) => std::task::Poll::Ready(Some(RuleTableV4Event::decode(buf))),
7137            None => std::task::Poll::Ready(None),
7138        }
7139    }
7140}
7141
7142#[derive(Debug)]
7143pub enum RuleTableV4Event {}
7144
7145impl RuleTableV4Event {
7146    /// Decodes a message buffer as a [`RuleTableV4Event`].
7147    fn decode(
7148        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7149    ) -> Result<RuleTableV4Event, fidl::Error> {
7150        let (bytes, _handles) = buf.split_mut();
7151        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7152        debug_assert_eq!(tx_header.tx_id, 0);
7153        match tx_header.ordinal {
7154            _ => Err(fidl::Error::UnknownOrdinal {
7155                ordinal: tx_header.ordinal,
7156                protocol_name:
7157                    <RuleTableV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
7158            }),
7159        }
7160    }
7161}
7162
7163/// A Stream of incoming requests for fuchsia.net.routes.admin/RuleTableV4.
7164pub struct RuleTableV4RequestStream {
7165    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
7166    is_terminated: bool,
7167}
7168
7169impl std::marker::Unpin for RuleTableV4RequestStream {}
7170
7171impl futures::stream::FusedStream for RuleTableV4RequestStream {
7172    fn is_terminated(&self) -> bool {
7173        self.is_terminated
7174    }
7175}
7176
7177impl fdomain_client::fidl::RequestStream for RuleTableV4RequestStream {
7178    type Protocol = RuleTableV4Marker;
7179    type ControlHandle = RuleTableV4ControlHandle;
7180
7181    fn from_channel(channel: fdomain_client::Channel) -> Self {
7182        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7183    }
7184
7185    fn control_handle(&self) -> Self::ControlHandle {
7186        RuleTableV4ControlHandle { inner: self.inner.clone() }
7187    }
7188
7189    fn into_inner(
7190        self,
7191    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
7192    {
7193        (self.inner, self.is_terminated)
7194    }
7195
7196    fn from_inner(
7197        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
7198        is_terminated: bool,
7199    ) -> Self {
7200        Self { inner, is_terminated }
7201    }
7202}
7203
7204impl futures::Stream for RuleTableV4RequestStream {
7205    type Item = Result<RuleTableV4Request, fidl::Error>;
7206
7207    fn poll_next(
7208        mut self: std::pin::Pin<&mut Self>,
7209        cx: &mut std::task::Context<'_>,
7210    ) -> std::task::Poll<Option<Self::Item>> {
7211        let this = &mut *self;
7212        if this.inner.check_shutdown(cx) {
7213            this.is_terminated = true;
7214            return std::task::Poll::Ready(None);
7215        }
7216        if this.is_terminated {
7217            panic!("polled RuleTableV4RequestStream after completion");
7218        }
7219        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
7220            |bytes, handles| {
7221                match this.inner.channel().read_etc(cx, bytes, handles) {
7222                    std::task::Poll::Ready(Ok(())) => {}
7223                    std::task::Poll::Pending => return std::task::Poll::Pending,
7224                    std::task::Poll::Ready(Err(None)) => {
7225                        this.is_terminated = true;
7226                        return std::task::Poll::Ready(None);
7227                    }
7228                    std::task::Poll::Ready(Err(Some(e))) => {
7229                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7230                            e.into(),
7231                        ))));
7232                    }
7233                }
7234
7235                // A message has been received from the channel
7236                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7237
7238                std::task::Poll::Ready(Some(match header.ordinal {
7239                    0xa32a9097da46f3a => {
7240                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
7241                        let mut req = fidl::new_empty!(
7242                            RuleTableV4NewRuleSetRequest,
7243                            fdomain_client::fidl::FDomainResourceDialect
7244                        );
7245                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RuleTableV4NewRuleSetRequest>(&header, _body_bytes, handles, &mut req)?;
7246                        let control_handle = RuleTableV4ControlHandle { inner: this.inner.clone() };
7247                        Ok(RuleTableV4Request::NewRuleSet {
7248                            priority: req.priority,
7249                            rule_set: req.rule_set,
7250
7251                            control_handle,
7252                        })
7253                    }
7254                    _ => Err(fidl::Error::UnknownOrdinal {
7255                        ordinal: header.ordinal,
7256                        protocol_name:
7257                            <RuleTableV4Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
7258                    }),
7259                }))
7260            },
7261        )
7262    }
7263}
7264
7265/// Gives isolated access to the system's policy routing rules.
7266#[derive(Debug)]
7267pub enum RuleTableV4Request {
7268    /// Returns an empty rule set at requested priority.
7269    ///
7270    /// Clients are free to manage the rules within their own rule set, but not
7271    /// the rule set of others. Only one rule set is allowed at each `priority`
7272    /// level. Channel is closed with `ZX_ERR_ALREADY_EXISTS` if there's already
7273    /// a rule set at the given `priority`.
7274    ///
7275    /// + request `priority` the priority of this `RuleSetV4`, all rule sets are
7276    ///   globally ordered according to this number.
7277    /// + request `rule_set` grants access to the `RuleSetV4` protocol.
7278    NewRuleSet {
7279        priority: u32,
7280        rule_set: fdomain_client::fidl::ServerEnd<RuleSetV4Marker>,
7281        control_handle: RuleTableV4ControlHandle,
7282    },
7283}
7284
7285impl RuleTableV4Request {
7286    #[allow(irrefutable_let_patterns)]
7287    pub fn into_new_rule_set(
7288        self,
7289    ) -> Option<(u32, fdomain_client::fidl::ServerEnd<RuleSetV4Marker>, RuleTableV4ControlHandle)>
7290    {
7291        if let RuleTableV4Request::NewRuleSet { priority, rule_set, control_handle } = self {
7292            Some((priority, rule_set, control_handle))
7293        } else {
7294            None
7295        }
7296    }
7297
7298    /// Name of the method defined in FIDL
7299    pub fn method_name(&self) -> &'static str {
7300        match *self {
7301            RuleTableV4Request::NewRuleSet { .. } => "new_rule_set",
7302        }
7303    }
7304}
7305
7306#[derive(Debug, Clone)]
7307pub struct RuleTableV4ControlHandle {
7308    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
7309}
7310
7311impl RuleTableV4ControlHandle {
7312    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
7313        self.inner.shutdown_with_epitaph(status.into())
7314    }
7315}
7316
7317impl fdomain_client::fidl::ControlHandle for RuleTableV4ControlHandle {
7318    fn shutdown(&self) {
7319        self.inner.shutdown()
7320    }
7321
7322    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
7323        self.inner.shutdown_with_epitaph(status)
7324    }
7325
7326    fn is_closed(&self) -> bool {
7327        self.inner.channel().is_closed()
7328    }
7329    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
7330        self.inner.channel().on_closed()
7331    }
7332}
7333
7334impl RuleTableV4ControlHandle {}
7335
7336#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7337pub struct RuleTableV6Marker;
7338
7339impl fdomain_client::fidl::ProtocolMarker for RuleTableV6Marker {
7340    type Proxy = RuleTableV6Proxy;
7341    type RequestStream = RuleTableV6RequestStream;
7342
7343    const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RuleTableV6";
7344}
7345impl fdomain_client::fidl::DiscoverableProtocolMarker for RuleTableV6Marker {}
7346
7347pub trait RuleTableV6ProxyInterface: Send + Sync {
7348    fn r#new_rule_set(
7349        &self,
7350        priority: u32,
7351        rule_set: fdomain_client::fidl::ServerEnd<RuleSetV6Marker>,
7352    ) -> Result<(), fidl::Error>;
7353}
7354
7355#[derive(Debug, Clone)]
7356pub struct RuleTableV6Proxy {
7357    client: fidl::client::Client<fdomain_client::fidl::FDomainResourceDialect>,
7358}
7359
7360impl fdomain_client::fidl::Proxy for RuleTableV6Proxy {
7361    type Protocol = RuleTableV6Marker;
7362
7363    fn from_channel(inner: fdomain_client::Channel) -> Self {
7364        Self::new(inner)
7365    }
7366
7367    fn into_channel(self) -> Result<fdomain_client::Channel, Self> {
7368        self.client.into_channel().map_err(|client| Self { client })
7369    }
7370
7371    fn as_channel(&self) -> &fdomain_client::Channel {
7372        self.client.as_channel()
7373    }
7374}
7375
7376impl RuleTableV6Proxy {
7377    /// Create a new Proxy for fuchsia.net.routes.admin/RuleTableV6.
7378    pub fn new(channel: fdomain_client::Channel) -> Self {
7379        let protocol_name = <RuleTableV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME;
7380        Self { client: fidl::client::Client::new(channel, protocol_name) }
7381    }
7382
7383    /// Get a Stream of events from the remote end of the protocol.
7384    ///
7385    /// # Panics
7386    ///
7387    /// Panics if the event stream was already taken.
7388    pub fn take_event_stream(&self) -> RuleTableV6EventStream {
7389        RuleTableV6EventStream { event_receiver: self.client.take_event_receiver() }
7390    }
7391
7392    /// Returns an empty rule set at requested priority.
7393    ///
7394    /// Clients are free to manage the rules within their own rule set, but not
7395    /// the rule set of others. Only one rule set is allowed at each `priority`
7396    /// level. Channel is closed with `ZX_ERR_ALREADY_EXISTS` if there's already
7397    /// a rule set at the given `priority`.
7398    ///
7399    /// + request `priority` the priority of this `RuleSetV6`, all rule sets are
7400    ///   globally ordered according to this number.
7401    /// + request `rule_set` grants access to the `RuleSetV6` protocol.
7402    pub fn r#new_rule_set(
7403        &self,
7404        mut priority: u32,
7405        mut rule_set: fdomain_client::fidl::ServerEnd<RuleSetV6Marker>,
7406    ) -> Result<(), fidl::Error> {
7407        RuleTableV6ProxyInterface::r#new_rule_set(self, priority, rule_set)
7408    }
7409}
7410
7411impl RuleTableV6ProxyInterface for RuleTableV6Proxy {
7412    fn r#new_rule_set(
7413        &self,
7414        mut priority: u32,
7415        mut rule_set: fdomain_client::fidl::ServerEnd<RuleSetV6Marker>,
7416    ) -> Result<(), fidl::Error> {
7417        self.client.send::<RuleTableV6NewRuleSetRequest>(
7418            (priority, rule_set),
7419            0x2261cc6eee9726a0,
7420            fidl::encoding::DynamicFlags::empty(),
7421        )
7422    }
7423}
7424
7425pub struct RuleTableV6EventStream {
7426    event_receiver: fidl::client::EventReceiver<fdomain_client::fidl::FDomainResourceDialect>,
7427}
7428
7429impl std::marker::Unpin for RuleTableV6EventStream {}
7430
7431impl futures::stream::FusedStream for RuleTableV6EventStream {
7432    fn is_terminated(&self) -> bool {
7433        self.event_receiver.is_terminated()
7434    }
7435}
7436
7437impl futures::Stream for RuleTableV6EventStream {
7438    type Item = Result<RuleTableV6Event, fidl::Error>;
7439
7440    fn poll_next(
7441        mut self: std::pin::Pin<&mut Self>,
7442        cx: &mut std::task::Context<'_>,
7443    ) -> std::task::Poll<Option<Self::Item>> {
7444        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7445            &mut self.event_receiver,
7446            cx
7447        )?) {
7448            Some(buf) => std::task::Poll::Ready(Some(RuleTableV6Event::decode(buf))),
7449            None => std::task::Poll::Ready(None),
7450        }
7451    }
7452}
7453
7454#[derive(Debug)]
7455pub enum RuleTableV6Event {}
7456
7457impl RuleTableV6Event {
7458    /// Decodes a message buffer as a [`RuleTableV6Event`].
7459    fn decode(
7460        mut buf: <fdomain_client::fidl::FDomainResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7461    ) -> Result<RuleTableV6Event, fidl::Error> {
7462        let (bytes, _handles) = buf.split_mut();
7463        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7464        debug_assert_eq!(tx_header.tx_id, 0);
7465        match tx_header.ordinal {
7466            _ => Err(fidl::Error::UnknownOrdinal {
7467                ordinal: tx_header.ordinal,
7468                protocol_name:
7469                    <RuleTableV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
7470            }),
7471        }
7472    }
7473}
7474
7475/// A Stream of incoming requests for fuchsia.net.routes.admin/RuleTableV6.
7476pub struct RuleTableV6RequestStream {
7477    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
7478    is_terminated: bool,
7479}
7480
7481impl std::marker::Unpin for RuleTableV6RequestStream {}
7482
7483impl futures::stream::FusedStream for RuleTableV6RequestStream {
7484    fn is_terminated(&self) -> bool {
7485        self.is_terminated
7486    }
7487}
7488
7489impl fdomain_client::fidl::RequestStream for RuleTableV6RequestStream {
7490    type Protocol = RuleTableV6Marker;
7491    type ControlHandle = RuleTableV6ControlHandle;
7492
7493    fn from_channel(channel: fdomain_client::Channel) -> Self {
7494        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7495    }
7496
7497    fn control_handle(&self) -> Self::ControlHandle {
7498        RuleTableV6ControlHandle { inner: self.inner.clone() }
7499    }
7500
7501    fn into_inner(
7502        self,
7503    ) -> (::std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>, bool)
7504    {
7505        (self.inner, self.is_terminated)
7506    }
7507
7508    fn from_inner(
7509        inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
7510        is_terminated: bool,
7511    ) -> Self {
7512        Self { inner, is_terminated }
7513    }
7514}
7515
7516impl futures::Stream for RuleTableV6RequestStream {
7517    type Item = Result<RuleTableV6Request, fidl::Error>;
7518
7519    fn poll_next(
7520        mut self: std::pin::Pin<&mut Self>,
7521        cx: &mut std::task::Context<'_>,
7522    ) -> std::task::Poll<Option<Self::Item>> {
7523        let this = &mut *self;
7524        if this.inner.check_shutdown(cx) {
7525            this.is_terminated = true;
7526            return std::task::Poll::Ready(None);
7527        }
7528        if this.is_terminated {
7529            panic!("polled RuleTableV6RequestStream after completion");
7530        }
7531        fidl::encoding::with_tls_decode_buf::<_, fdomain_client::fidl::FDomainResourceDialect>(
7532            |bytes, handles| {
7533                match this.inner.channel().read_etc(cx, bytes, handles) {
7534                    std::task::Poll::Ready(Ok(())) => {}
7535                    std::task::Poll::Pending => return std::task::Poll::Pending,
7536                    std::task::Poll::Ready(Err(None)) => {
7537                        this.is_terminated = true;
7538                        return std::task::Poll::Ready(None);
7539                    }
7540                    std::task::Poll::Ready(Err(Some(e))) => {
7541                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7542                            e.into(),
7543                        ))));
7544                    }
7545                }
7546
7547                // A message has been received from the channel
7548                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7549
7550                std::task::Poll::Ready(Some(match header.ordinal {
7551                    0x2261cc6eee9726a0 => {
7552                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
7553                        let mut req = fidl::new_empty!(
7554                            RuleTableV6NewRuleSetRequest,
7555                            fdomain_client::fidl::FDomainResourceDialect
7556                        );
7557                        fidl::encoding::Decoder::<fdomain_client::fidl::FDomainResourceDialect>::decode_into::<RuleTableV6NewRuleSetRequest>(&header, _body_bytes, handles, &mut req)?;
7558                        let control_handle = RuleTableV6ControlHandle { inner: this.inner.clone() };
7559                        Ok(RuleTableV6Request::NewRuleSet {
7560                            priority: req.priority,
7561                            rule_set: req.rule_set,
7562
7563                            control_handle,
7564                        })
7565                    }
7566                    _ => Err(fidl::Error::UnknownOrdinal {
7567                        ordinal: header.ordinal,
7568                        protocol_name:
7569                            <RuleTableV6Marker as fdomain_client::fidl::ProtocolMarker>::DEBUG_NAME,
7570                    }),
7571                }))
7572            },
7573        )
7574    }
7575}
7576
7577/// Gives isolated access to the system's policy routing rules.
7578#[derive(Debug)]
7579pub enum RuleTableV6Request {
7580    /// Returns an empty rule set at requested priority.
7581    ///
7582    /// Clients are free to manage the rules within their own rule set, but not
7583    /// the rule set of others. Only one rule set is allowed at each `priority`
7584    /// level. Channel is closed with `ZX_ERR_ALREADY_EXISTS` if there's already
7585    /// a rule set at the given `priority`.
7586    ///
7587    /// + request `priority` the priority of this `RuleSetV6`, all rule sets are
7588    ///   globally ordered according to this number.
7589    /// + request `rule_set` grants access to the `RuleSetV6` protocol.
7590    NewRuleSet {
7591        priority: u32,
7592        rule_set: fdomain_client::fidl::ServerEnd<RuleSetV6Marker>,
7593        control_handle: RuleTableV6ControlHandle,
7594    },
7595}
7596
7597impl RuleTableV6Request {
7598    #[allow(irrefutable_let_patterns)]
7599    pub fn into_new_rule_set(
7600        self,
7601    ) -> Option<(u32, fdomain_client::fidl::ServerEnd<RuleSetV6Marker>, RuleTableV6ControlHandle)>
7602    {
7603        if let RuleTableV6Request::NewRuleSet { priority, rule_set, control_handle } = self {
7604            Some((priority, rule_set, control_handle))
7605        } else {
7606            None
7607        }
7608    }
7609
7610    /// Name of the method defined in FIDL
7611    pub fn method_name(&self) -> &'static str {
7612        match *self {
7613            RuleTableV6Request::NewRuleSet { .. } => "new_rule_set",
7614        }
7615    }
7616}
7617
7618#[derive(Debug, Clone)]
7619pub struct RuleTableV6ControlHandle {
7620    inner: std::sync::Arc<fidl::ServeInner<fdomain_client::fidl::FDomainResourceDialect>>,
7621}
7622
7623impl RuleTableV6ControlHandle {
7624    pub fn shutdown_with_epitaph(&self, status: impl Into<fidl::Epitaph>) {
7625        self.inner.shutdown_with_epitaph(status.into())
7626    }
7627}
7628
7629impl fdomain_client::fidl::ControlHandle for RuleTableV6ControlHandle {
7630    fn shutdown(&self) {
7631        self.inner.shutdown()
7632    }
7633
7634    fn shutdown_with_epitaph(&self, status: fidl::Epitaph) {
7635        self.inner.shutdown_with_epitaph(status)
7636    }
7637
7638    fn is_closed(&self) -> bool {
7639        self.inner.channel().is_closed()
7640    }
7641    fn on_closed(&self) -> fdomain_client::OnFDomainSignals {
7642        self.inner.channel().on_closed()
7643    }
7644}
7645
7646impl RuleTableV6ControlHandle {}
7647
7648mod internal {
7649    use super::*;
7650
7651    impl fidl::encoding::ResourceTypeMarker for BaseRouteTableGetAuthorizationForRouteTableResponse {
7652        type Borrowed<'a> = &'a mut Self;
7653        fn take_or_borrow<'a>(
7654            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7655        ) -> Self::Borrowed<'a> {
7656            value
7657        }
7658    }
7659
7660    unsafe impl fidl::encoding::TypeMarker for BaseRouteTableGetAuthorizationForRouteTableResponse {
7661        type Owned = Self;
7662
7663        #[inline(always)]
7664        fn inline_align(_context: fidl::encoding::Context) -> usize {
7665            4
7666        }
7667
7668        #[inline(always)]
7669        fn inline_size(_context: fidl::encoding::Context) -> usize {
7670            8
7671        }
7672    }
7673
7674    unsafe impl
7675        fidl::encoding::Encode<
7676            BaseRouteTableGetAuthorizationForRouteTableResponse,
7677            fdomain_client::fidl::FDomainResourceDialect,
7678        > for &mut BaseRouteTableGetAuthorizationForRouteTableResponse
7679    {
7680        #[inline]
7681        unsafe fn encode(
7682            self,
7683            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
7684            offset: usize,
7685            _depth: fidl::encoding::Depth,
7686        ) -> fidl::Result<()> {
7687            encoder
7688                .debug_check_bounds::<BaseRouteTableGetAuthorizationForRouteTableResponse>(offset);
7689            // Delegate to tuple encoding.
7690            fidl::encoding::Encode::<BaseRouteTableGetAuthorizationForRouteTableResponse, fdomain_client::fidl::FDomainResourceDialect>::encode(
7691                (
7692                    <GrantForRouteTableAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
7693                ),
7694                encoder, offset, _depth
7695            )
7696        }
7697    }
7698    unsafe impl<
7699        T0: fidl::encoding::Encode<
7700                GrantForRouteTableAuthorization,
7701                fdomain_client::fidl::FDomainResourceDialect,
7702            >,
7703    >
7704        fidl::encoding::Encode<
7705            BaseRouteTableGetAuthorizationForRouteTableResponse,
7706            fdomain_client::fidl::FDomainResourceDialect,
7707        > for (T0,)
7708    {
7709        #[inline]
7710        unsafe fn encode(
7711            self,
7712            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
7713            offset: usize,
7714            depth: fidl::encoding::Depth,
7715        ) -> fidl::Result<()> {
7716            encoder
7717                .debug_check_bounds::<BaseRouteTableGetAuthorizationForRouteTableResponse>(offset);
7718            // Zero out padding regions. There's no need to apply masks
7719            // because the unmasked parts will be overwritten by fields.
7720            // Write the fields.
7721            self.0.encode(encoder, offset + 0, depth)?;
7722            Ok(())
7723        }
7724    }
7725
7726    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
7727        for BaseRouteTableGetAuthorizationForRouteTableResponse
7728    {
7729        #[inline(always)]
7730        fn new_empty() -> Self {
7731            Self {
7732                credential: fidl::new_empty!(
7733                    GrantForRouteTableAuthorization,
7734                    fdomain_client::fidl::FDomainResourceDialect
7735                ),
7736            }
7737        }
7738
7739        #[inline]
7740        unsafe fn decode(
7741            &mut self,
7742            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
7743            offset: usize,
7744            _depth: fidl::encoding::Depth,
7745        ) -> fidl::Result<()> {
7746            decoder.debug_check_bounds::<Self>(offset);
7747            // Verify that padding bytes are zero.
7748            fidl::decode!(
7749                GrantForRouteTableAuthorization,
7750                fdomain_client::fidl::FDomainResourceDialect,
7751                &mut self.credential,
7752                decoder,
7753                offset + 0,
7754                _depth
7755            )?;
7756            Ok(())
7757        }
7758    }
7759
7760    impl fidl::encoding::ResourceTypeMarker for GrantForRouteTableAuthorization {
7761        type Borrowed<'a> = &'a mut Self;
7762        fn take_or_borrow<'a>(
7763            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7764        ) -> Self::Borrowed<'a> {
7765            value
7766        }
7767    }
7768
7769    unsafe impl fidl::encoding::TypeMarker for GrantForRouteTableAuthorization {
7770        type Owned = Self;
7771
7772        #[inline(always)]
7773        fn inline_align(_context: fidl::encoding::Context) -> usize {
7774            4
7775        }
7776
7777        #[inline(always)]
7778        fn inline_size(_context: fidl::encoding::Context) -> usize {
7779            8
7780        }
7781    }
7782
7783    unsafe impl
7784        fidl::encoding::Encode<
7785            GrantForRouteTableAuthorization,
7786            fdomain_client::fidl::FDomainResourceDialect,
7787        > for &mut GrantForRouteTableAuthorization
7788    {
7789        #[inline]
7790        unsafe fn encode(
7791            self,
7792            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
7793            offset: usize,
7794            _depth: fidl::encoding::Depth,
7795        ) -> fidl::Result<()> {
7796            encoder.debug_check_bounds::<GrantForRouteTableAuthorization>(offset);
7797            // Delegate to tuple encoding.
7798            fidl::encoding::Encode::<
7799                GrantForRouteTableAuthorization,
7800                fdomain_client::fidl::FDomainResourceDialect,
7801            >::encode(
7802                (
7803                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.table_id),
7804                    <fidl::encoding::HandleType<
7805                        fdomain_client::Event,
7806                        { fidl::ObjectType::EVENT.into_raw() },
7807                        3,
7808                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
7809                        &mut self.token
7810                    ),
7811                ),
7812                encoder,
7813                offset,
7814                _depth,
7815            )
7816        }
7817    }
7818    unsafe impl<
7819        T0: fidl::encoding::Encode<u32, fdomain_client::fidl::FDomainResourceDialect>,
7820        T1: fidl::encoding::Encode<
7821                fidl::encoding::HandleType<
7822                    fdomain_client::Event,
7823                    { fidl::ObjectType::EVENT.into_raw() },
7824                    3,
7825                >,
7826                fdomain_client::fidl::FDomainResourceDialect,
7827            >,
7828    >
7829        fidl::encoding::Encode<
7830            GrantForRouteTableAuthorization,
7831            fdomain_client::fidl::FDomainResourceDialect,
7832        > for (T0, T1)
7833    {
7834        #[inline]
7835        unsafe fn encode(
7836            self,
7837            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
7838            offset: usize,
7839            depth: fidl::encoding::Depth,
7840        ) -> fidl::Result<()> {
7841            encoder.debug_check_bounds::<GrantForRouteTableAuthorization>(offset);
7842            // Zero out padding regions. There's no need to apply masks
7843            // because the unmasked parts will be overwritten by fields.
7844            // Write the fields.
7845            self.0.encode(encoder, offset + 0, depth)?;
7846            self.1.encode(encoder, offset + 4, depth)?;
7847            Ok(())
7848        }
7849    }
7850
7851    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
7852        for GrantForRouteTableAuthorization
7853    {
7854        #[inline(always)]
7855        fn new_empty() -> Self {
7856            Self {
7857                table_id: fidl::new_empty!(u32, fdomain_client::fidl::FDomainResourceDialect),
7858                token: fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Event, { fidl::ObjectType::EVENT.into_raw() }, 3>, fdomain_client::fidl::FDomainResourceDialect),
7859            }
7860        }
7861
7862        #[inline]
7863        unsafe fn decode(
7864            &mut self,
7865            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
7866            offset: usize,
7867            _depth: fidl::encoding::Depth,
7868        ) -> fidl::Result<()> {
7869            decoder.debug_check_bounds::<Self>(offset);
7870            // Verify that padding bytes are zero.
7871            fidl::decode!(
7872                u32,
7873                fdomain_client::fidl::FDomainResourceDialect,
7874                &mut self.table_id,
7875                decoder,
7876                offset + 0,
7877                _depth
7878            )?;
7879            fidl::decode!(fidl::encoding::HandleType<fdomain_client::Event, { fidl::ObjectType::EVENT.into_raw() }, 3>, fdomain_client::fidl::FDomainResourceDialect, &mut self.token, decoder, offset + 4, _depth)?;
7880            Ok(())
7881        }
7882    }
7883
7884    impl fidl::encoding::ResourceTypeMarker for ProofOfRouteTableAuthorization {
7885        type Borrowed<'a> = &'a mut Self;
7886        fn take_or_borrow<'a>(
7887            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
7888        ) -> Self::Borrowed<'a> {
7889            value
7890        }
7891    }
7892
7893    unsafe impl fidl::encoding::TypeMarker for ProofOfRouteTableAuthorization {
7894        type Owned = Self;
7895
7896        #[inline(always)]
7897        fn inline_align(_context: fidl::encoding::Context) -> usize {
7898            4
7899        }
7900
7901        #[inline(always)]
7902        fn inline_size(_context: fidl::encoding::Context) -> usize {
7903            8
7904        }
7905    }
7906
7907    unsafe impl
7908        fidl::encoding::Encode<
7909            ProofOfRouteTableAuthorization,
7910            fdomain_client::fidl::FDomainResourceDialect,
7911        > for &mut ProofOfRouteTableAuthorization
7912    {
7913        #[inline]
7914        unsafe fn encode(
7915            self,
7916            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
7917            offset: usize,
7918            _depth: fidl::encoding::Depth,
7919        ) -> fidl::Result<()> {
7920            encoder.debug_check_bounds::<ProofOfRouteTableAuthorization>(offset);
7921            // Delegate to tuple encoding.
7922            fidl::encoding::Encode::<
7923                ProofOfRouteTableAuthorization,
7924                fdomain_client::fidl::FDomainResourceDialect,
7925            >::encode(
7926                (
7927                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.table),
7928                    <fidl::encoding::HandleType<
7929                        fdomain_client::Event,
7930                        { fidl::ObjectType::EVENT.into_raw() },
7931                        0,
7932                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
7933                        &mut self.token
7934                    ),
7935                ),
7936                encoder,
7937                offset,
7938                _depth,
7939            )
7940        }
7941    }
7942    unsafe impl<
7943        T0: fidl::encoding::Encode<u32, fdomain_client::fidl::FDomainResourceDialect>,
7944        T1: fidl::encoding::Encode<
7945                fidl::encoding::HandleType<
7946                    fdomain_client::Event,
7947                    { fidl::ObjectType::EVENT.into_raw() },
7948                    0,
7949                >,
7950                fdomain_client::fidl::FDomainResourceDialect,
7951            >,
7952    >
7953        fidl::encoding::Encode<
7954            ProofOfRouteTableAuthorization,
7955            fdomain_client::fidl::FDomainResourceDialect,
7956        > for (T0, T1)
7957    {
7958        #[inline]
7959        unsafe fn encode(
7960            self,
7961            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
7962            offset: usize,
7963            depth: fidl::encoding::Depth,
7964        ) -> fidl::Result<()> {
7965            encoder.debug_check_bounds::<ProofOfRouteTableAuthorization>(offset);
7966            // Zero out padding regions. There's no need to apply masks
7967            // because the unmasked parts will be overwritten by fields.
7968            // Write the fields.
7969            self.0.encode(encoder, offset + 0, depth)?;
7970            self.1.encode(encoder, offset + 4, depth)?;
7971            Ok(())
7972        }
7973    }
7974
7975    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
7976        for ProofOfRouteTableAuthorization
7977    {
7978        #[inline(always)]
7979        fn new_empty() -> Self {
7980            Self {
7981                table: fidl::new_empty!(u32, fdomain_client::fidl::FDomainResourceDialect),
7982                token: fidl::new_empty!(fidl::encoding::HandleType<fdomain_client::Event, { fidl::ObjectType::EVENT.into_raw() }, 0>, fdomain_client::fidl::FDomainResourceDialect),
7983            }
7984        }
7985
7986        #[inline]
7987        unsafe fn decode(
7988            &mut self,
7989            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
7990            offset: usize,
7991            _depth: fidl::encoding::Depth,
7992        ) -> fidl::Result<()> {
7993            decoder.debug_check_bounds::<Self>(offset);
7994            // Verify that padding bytes are zero.
7995            fidl::decode!(
7996                u32,
7997                fdomain_client::fidl::FDomainResourceDialect,
7998                &mut self.table,
7999                decoder,
8000                offset + 0,
8001                _depth
8002            )?;
8003            fidl::decode!(fidl::encoding::HandleType<fdomain_client::Event, { fidl::ObjectType::EVENT.into_raw() }, 0>, fdomain_client::fidl::FDomainResourceDialect, &mut self.token, decoder, offset + 4, _depth)?;
8004            Ok(())
8005        }
8006    }
8007
8008    impl fidl::encoding::ResourceTypeMarker for RouteSetV4AddRouteRequest {
8009        type Borrowed<'a> = &'a mut Self;
8010        fn take_or_borrow<'a>(
8011            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8012        ) -> Self::Borrowed<'a> {
8013            value
8014        }
8015    }
8016
8017    unsafe impl fidl::encoding::TypeMarker for RouteSetV4AddRouteRequest {
8018        type Owned = Self;
8019
8020        #[inline(always)]
8021        fn inline_align(_context: fidl::encoding::Context) -> usize {
8022            8
8023        }
8024
8025        #[inline(always)]
8026        fn inline_size(_context: fidl::encoding::Context) -> usize {
8027            40
8028        }
8029    }
8030
8031    unsafe impl
8032        fidl::encoding::Encode<
8033            RouteSetV4AddRouteRequest,
8034            fdomain_client::fidl::FDomainResourceDialect,
8035        > for &mut RouteSetV4AddRouteRequest
8036    {
8037        #[inline]
8038        unsafe fn encode(
8039            self,
8040            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8041            offset: usize,
8042            _depth: fidl::encoding::Depth,
8043        ) -> fidl::Result<()> {
8044            encoder.debug_check_bounds::<RouteSetV4AddRouteRequest>(offset);
8045            // Delegate to tuple encoding.
8046            fidl::encoding::Encode::<
8047                RouteSetV4AddRouteRequest,
8048                fdomain_client::fidl::FDomainResourceDialect,
8049            >::encode(
8050                (<fdomain_fuchsia_net_routes::RouteV4 as fidl::encoding::ValueTypeMarker>::borrow(
8051                    &self.route,
8052                ),),
8053                encoder,
8054                offset,
8055                _depth,
8056            )
8057        }
8058    }
8059    unsafe impl<
8060        T0: fidl::encoding::Encode<
8061                fdomain_fuchsia_net_routes::RouteV4,
8062                fdomain_client::fidl::FDomainResourceDialect,
8063            >,
8064    >
8065        fidl::encoding::Encode<
8066            RouteSetV4AddRouteRequest,
8067            fdomain_client::fidl::FDomainResourceDialect,
8068        > for (T0,)
8069    {
8070        #[inline]
8071        unsafe fn encode(
8072            self,
8073            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8074            offset: usize,
8075            depth: fidl::encoding::Depth,
8076        ) -> fidl::Result<()> {
8077            encoder.debug_check_bounds::<RouteSetV4AddRouteRequest>(offset);
8078            // Zero out padding regions. There's no need to apply masks
8079            // because the unmasked parts will be overwritten by fields.
8080            // Write the fields.
8081            self.0.encode(encoder, offset + 0, depth)?;
8082            Ok(())
8083        }
8084    }
8085
8086    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
8087        for RouteSetV4AddRouteRequest
8088    {
8089        #[inline(always)]
8090        fn new_empty() -> Self {
8091            Self {
8092                route: fidl::new_empty!(
8093                    fdomain_fuchsia_net_routes::RouteV4,
8094                    fdomain_client::fidl::FDomainResourceDialect
8095                ),
8096            }
8097        }
8098
8099        #[inline]
8100        unsafe fn decode(
8101            &mut self,
8102            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8103            offset: usize,
8104            _depth: fidl::encoding::Depth,
8105        ) -> fidl::Result<()> {
8106            decoder.debug_check_bounds::<Self>(offset);
8107            // Verify that padding bytes are zero.
8108            fidl::decode!(
8109                fdomain_fuchsia_net_routes::RouteV4,
8110                fdomain_client::fidl::FDomainResourceDialect,
8111                &mut self.route,
8112                decoder,
8113                offset + 0,
8114                _depth
8115            )?;
8116            Ok(())
8117        }
8118    }
8119
8120    impl fidl::encoding::ResourceTypeMarker for RouteSetV4AuthenticateForInterfaceRequest {
8121        type Borrowed<'a> = &'a mut Self;
8122        fn take_or_borrow<'a>(
8123            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8124        ) -> Self::Borrowed<'a> {
8125            value
8126        }
8127    }
8128
8129    unsafe impl fidl::encoding::TypeMarker for RouteSetV4AuthenticateForInterfaceRequest {
8130        type Owned = Self;
8131
8132        #[inline(always)]
8133        fn inline_align(_context: fidl::encoding::Context) -> usize {
8134            8
8135        }
8136
8137        #[inline(always)]
8138        fn inline_size(_context: fidl::encoding::Context) -> usize {
8139            16
8140        }
8141    }
8142
8143    unsafe impl
8144        fidl::encoding::Encode<
8145            RouteSetV4AuthenticateForInterfaceRequest,
8146            fdomain_client::fidl::FDomainResourceDialect,
8147        > for &mut RouteSetV4AuthenticateForInterfaceRequest
8148    {
8149        #[inline]
8150        unsafe fn encode(
8151            self,
8152            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8153            offset: usize,
8154            _depth: fidl::encoding::Depth,
8155        ) -> fidl::Result<()> {
8156            encoder.debug_check_bounds::<RouteSetV4AuthenticateForInterfaceRequest>(offset);
8157            // Delegate to tuple encoding.
8158            fidl::encoding::Encode::<RouteSetV4AuthenticateForInterfaceRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
8159                (
8160                    <fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
8161                ),
8162                encoder, offset, _depth
8163            )
8164        }
8165    }
8166    unsafe impl<
8167        T0: fidl::encoding::Encode<
8168                fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
8169                fdomain_client::fidl::FDomainResourceDialect,
8170            >,
8171    >
8172        fidl::encoding::Encode<
8173            RouteSetV4AuthenticateForInterfaceRequest,
8174            fdomain_client::fidl::FDomainResourceDialect,
8175        > for (T0,)
8176    {
8177        #[inline]
8178        unsafe fn encode(
8179            self,
8180            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8181            offset: usize,
8182            depth: fidl::encoding::Depth,
8183        ) -> fidl::Result<()> {
8184            encoder.debug_check_bounds::<RouteSetV4AuthenticateForInterfaceRequest>(offset);
8185            // Zero out padding regions. There's no need to apply masks
8186            // because the unmasked parts will be overwritten by fields.
8187            // Write the fields.
8188            self.0.encode(encoder, offset + 0, depth)?;
8189            Ok(())
8190        }
8191    }
8192
8193    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
8194        for RouteSetV4AuthenticateForInterfaceRequest
8195    {
8196        #[inline(always)]
8197        fn new_empty() -> Self {
8198            Self {
8199                credential: fidl::new_empty!(
8200                    fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
8201                    fdomain_client::fidl::FDomainResourceDialect
8202                ),
8203            }
8204        }
8205
8206        #[inline]
8207        unsafe fn decode(
8208            &mut self,
8209            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8210            offset: usize,
8211            _depth: fidl::encoding::Depth,
8212        ) -> fidl::Result<()> {
8213            decoder.debug_check_bounds::<Self>(offset);
8214            // Verify that padding bytes are zero.
8215            fidl::decode!(
8216                fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
8217                fdomain_client::fidl::FDomainResourceDialect,
8218                &mut self.credential,
8219                decoder,
8220                offset + 0,
8221                _depth
8222            )?;
8223            Ok(())
8224        }
8225    }
8226
8227    impl fidl::encoding::ResourceTypeMarker for RouteSetV4RemoveRouteRequest {
8228        type Borrowed<'a> = &'a mut Self;
8229        fn take_or_borrow<'a>(
8230            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8231        ) -> Self::Borrowed<'a> {
8232            value
8233        }
8234    }
8235
8236    unsafe impl fidl::encoding::TypeMarker for RouteSetV4RemoveRouteRequest {
8237        type Owned = Self;
8238
8239        #[inline(always)]
8240        fn inline_align(_context: fidl::encoding::Context) -> usize {
8241            8
8242        }
8243
8244        #[inline(always)]
8245        fn inline_size(_context: fidl::encoding::Context) -> usize {
8246            40
8247        }
8248    }
8249
8250    unsafe impl
8251        fidl::encoding::Encode<
8252            RouteSetV4RemoveRouteRequest,
8253            fdomain_client::fidl::FDomainResourceDialect,
8254        > for &mut RouteSetV4RemoveRouteRequest
8255    {
8256        #[inline]
8257        unsafe fn encode(
8258            self,
8259            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8260            offset: usize,
8261            _depth: fidl::encoding::Depth,
8262        ) -> fidl::Result<()> {
8263            encoder.debug_check_bounds::<RouteSetV4RemoveRouteRequest>(offset);
8264            // Delegate to tuple encoding.
8265            fidl::encoding::Encode::<
8266                RouteSetV4RemoveRouteRequest,
8267                fdomain_client::fidl::FDomainResourceDialect,
8268            >::encode(
8269                (<fdomain_fuchsia_net_routes::RouteV4 as fidl::encoding::ValueTypeMarker>::borrow(
8270                    &self.route,
8271                ),),
8272                encoder,
8273                offset,
8274                _depth,
8275            )
8276        }
8277    }
8278    unsafe impl<
8279        T0: fidl::encoding::Encode<
8280                fdomain_fuchsia_net_routes::RouteV4,
8281                fdomain_client::fidl::FDomainResourceDialect,
8282            >,
8283    >
8284        fidl::encoding::Encode<
8285            RouteSetV4RemoveRouteRequest,
8286            fdomain_client::fidl::FDomainResourceDialect,
8287        > for (T0,)
8288    {
8289        #[inline]
8290        unsafe fn encode(
8291            self,
8292            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8293            offset: usize,
8294            depth: fidl::encoding::Depth,
8295        ) -> fidl::Result<()> {
8296            encoder.debug_check_bounds::<RouteSetV4RemoveRouteRequest>(offset);
8297            // Zero out padding regions. There's no need to apply masks
8298            // because the unmasked parts will be overwritten by fields.
8299            // Write the fields.
8300            self.0.encode(encoder, offset + 0, depth)?;
8301            Ok(())
8302        }
8303    }
8304
8305    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
8306        for RouteSetV4RemoveRouteRequest
8307    {
8308        #[inline(always)]
8309        fn new_empty() -> Self {
8310            Self {
8311                route: fidl::new_empty!(
8312                    fdomain_fuchsia_net_routes::RouteV4,
8313                    fdomain_client::fidl::FDomainResourceDialect
8314                ),
8315            }
8316        }
8317
8318        #[inline]
8319        unsafe fn decode(
8320            &mut self,
8321            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8322            offset: usize,
8323            _depth: fidl::encoding::Depth,
8324        ) -> fidl::Result<()> {
8325            decoder.debug_check_bounds::<Self>(offset);
8326            // Verify that padding bytes are zero.
8327            fidl::decode!(
8328                fdomain_fuchsia_net_routes::RouteV4,
8329                fdomain_client::fidl::FDomainResourceDialect,
8330                &mut self.route,
8331                decoder,
8332                offset + 0,
8333                _depth
8334            )?;
8335            Ok(())
8336        }
8337    }
8338
8339    impl fidl::encoding::ResourceTypeMarker for RouteSetV6AddRouteRequest {
8340        type Borrowed<'a> = &'a mut Self;
8341        fn take_or_borrow<'a>(
8342            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8343        ) -> Self::Borrowed<'a> {
8344            value
8345        }
8346    }
8347
8348    unsafe impl fidl::encoding::TypeMarker for RouteSetV6AddRouteRequest {
8349        type Owned = Self;
8350
8351        #[inline(always)]
8352        fn inline_align(_context: fidl::encoding::Context) -> usize {
8353            8
8354        }
8355
8356        #[inline(always)]
8357        fn inline_size(_context: fidl::encoding::Context) -> usize {
8358            56
8359        }
8360    }
8361
8362    unsafe impl
8363        fidl::encoding::Encode<
8364            RouteSetV6AddRouteRequest,
8365            fdomain_client::fidl::FDomainResourceDialect,
8366        > for &mut RouteSetV6AddRouteRequest
8367    {
8368        #[inline]
8369        unsafe fn encode(
8370            self,
8371            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8372            offset: usize,
8373            _depth: fidl::encoding::Depth,
8374        ) -> fidl::Result<()> {
8375            encoder.debug_check_bounds::<RouteSetV6AddRouteRequest>(offset);
8376            // Delegate to tuple encoding.
8377            fidl::encoding::Encode::<
8378                RouteSetV6AddRouteRequest,
8379                fdomain_client::fidl::FDomainResourceDialect,
8380            >::encode(
8381                (<fdomain_fuchsia_net_routes::RouteV6 as fidl::encoding::ValueTypeMarker>::borrow(
8382                    &self.route,
8383                ),),
8384                encoder,
8385                offset,
8386                _depth,
8387            )
8388        }
8389    }
8390    unsafe impl<
8391        T0: fidl::encoding::Encode<
8392                fdomain_fuchsia_net_routes::RouteV6,
8393                fdomain_client::fidl::FDomainResourceDialect,
8394            >,
8395    >
8396        fidl::encoding::Encode<
8397            RouteSetV6AddRouteRequest,
8398            fdomain_client::fidl::FDomainResourceDialect,
8399        > for (T0,)
8400    {
8401        #[inline]
8402        unsafe fn encode(
8403            self,
8404            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8405            offset: usize,
8406            depth: fidl::encoding::Depth,
8407        ) -> fidl::Result<()> {
8408            encoder.debug_check_bounds::<RouteSetV6AddRouteRequest>(offset);
8409            // Zero out padding regions. There's no need to apply masks
8410            // because the unmasked parts will be overwritten by fields.
8411            // Write the fields.
8412            self.0.encode(encoder, offset + 0, depth)?;
8413            Ok(())
8414        }
8415    }
8416
8417    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
8418        for RouteSetV6AddRouteRequest
8419    {
8420        #[inline(always)]
8421        fn new_empty() -> Self {
8422            Self {
8423                route: fidl::new_empty!(
8424                    fdomain_fuchsia_net_routes::RouteV6,
8425                    fdomain_client::fidl::FDomainResourceDialect
8426                ),
8427            }
8428        }
8429
8430        #[inline]
8431        unsafe fn decode(
8432            &mut self,
8433            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8434            offset: usize,
8435            _depth: fidl::encoding::Depth,
8436        ) -> fidl::Result<()> {
8437            decoder.debug_check_bounds::<Self>(offset);
8438            // Verify that padding bytes are zero.
8439            fidl::decode!(
8440                fdomain_fuchsia_net_routes::RouteV6,
8441                fdomain_client::fidl::FDomainResourceDialect,
8442                &mut self.route,
8443                decoder,
8444                offset + 0,
8445                _depth
8446            )?;
8447            Ok(())
8448        }
8449    }
8450
8451    impl fidl::encoding::ResourceTypeMarker for RouteSetV6AuthenticateForInterfaceRequest {
8452        type Borrowed<'a> = &'a mut Self;
8453        fn take_or_borrow<'a>(
8454            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8455        ) -> Self::Borrowed<'a> {
8456            value
8457        }
8458    }
8459
8460    unsafe impl fidl::encoding::TypeMarker for RouteSetV6AuthenticateForInterfaceRequest {
8461        type Owned = Self;
8462
8463        #[inline(always)]
8464        fn inline_align(_context: fidl::encoding::Context) -> usize {
8465            8
8466        }
8467
8468        #[inline(always)]
8469        fn inline_size(_context: fidl::encoding::Context) -> usize {
8470            16
8471        }
8472    }
8473
8474    unsafe impl
8475        fidl::encoding::Encode<
8476            RouteSetV6AuthenticateForInterfaceRequest,
8477            fdomain_client::fidl::FDomainResourceDialect,
8478        > for &mut RouteSetV6AuthenticateForInterfaceRequest
8479    {
8480        #[inline]
8481        unsafe fn encode(
8482            self,
8483            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8484            offset: usize,
8485            _depth: fidl::encoding::Depth,
8486        ) -> fidl::Result<()> {
8487            encoder.debug_check_bounds::<RouteSetV6AuthenticateForInterfaceRequest>(offset);
8488            // Delegate to tuple encoding.
8489            fidl::encoding::Encode::<RouteSetV6AuthenticateForInterfaceRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
8490                (
8491                    <fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
8492                ),
8493                encoder, offset, _depth
8494            )
8495        }
8496    }
8497    unsafe impl<
8498        T0: fidl::encoding::Encode<
8499                fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
8500                fdomain_client::fidl::FDomainResourceDialect,
8501            >,
8502    >
8503        fidl::encoding::Encode<
8504            RouteSetV6AuthenticateForInterfaceRequest,
8505            fdomain_client::fidl::FDomainResourceDialect,
8506        > for (T0,)
8507    {
8508        #[inline]
8509        unsafe fn encode(
8510            self,
8511            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8512            offset: usize,
8513            depth: fidl::encoding::Depth,
8514        ) -> fidl::Result<()> {
8515            encoder.debug_check_bounds::<RouteSetV6AuthenticateForInterfaceRequest>(offset);
8516            // Zero out padding regions. There's no need to apply masks
8517            // because the unmasked parts will be overwritten by fields.
8518            // Write the fields.
8519            self.0.encode(encoder, offset + 0, depth)?;
8520            Ok(())
8521        }
8522    }
8523
8524    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
8525        for RouteSetV6AuthenticateForInterfaceRequest
8526    {
8527        #[inline(always)]
8528        fn new_empty() -> Self {
8529            Self {
8530                credential: fidl::new_empty!(
8531                    fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
8532                    fdomain_client::fidl::FDomainResourceDialect
8533                ),
8534            }
8535        }
8536
8537        #[inline]
8538        unsafe fn decode(
8539            &mut self,
8540            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8541            offset: usize,
8542            _depth: fidl::encoding::Depth,
8543        ) -> fidl::Result<()> {
8544            decoder.debug_check_bounds::<Self>(offset);
8545            // Verify that padding bytes are zero.
8546            fidl::decode!(
8547                fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
8548                fdomain_client::fidl::FDomainResourceDialect,
8549                &mut self.credential,
8550                decoder,
8551                offset + 0,
8552                _depth
8553            )?;
8554            Ok(())
8555        }
8556    }
8557
8558    impl fidl::encoding::ResourceTypeMarker for RouteSetV6RemoveRouteRequest {
8559        type Borrowed<'a> = &'a mut Self;
8560        fn take_or_borrow<'a>(
8561            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8562        ) -> Self::Borrowed<'a> {
8563            value
8564        }
8565    }
8566
8567    unsafe impl fidl::encoding::TypeMarker for RouteSetV6RemoveRouteRequest {
8568        type Owned = Self;
8569
8570        #[inline(always)]
8571        fn inline_align(_context: fidl::encoding::Context) -> usize {
8572            8
8573        }
8574
8575        #[inline(always)]
8576        fn inline_size(_context: fidl::encoding::Context) -> usize {
8577            56
8578        }
8579    }
8580
8581    unsafe impl
8582        fidl::encoding::Encode<
8583            RouteSetV6RemoveRouteRequest,
8584            fdomain_client::fidl::FDomainResourceDialect,
8585        > for &mut RouteSetV6RemoveRouteRequest
8586    {
8587        #[inline]
8588        unsafe fn encode(
8589            self,
8590            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8591            offset: usize,
8592            _depth: fidl::encoding::Depth,
8593        ) -> fidl::Result<()> {
8594            encoder.debug_check_bounds::<RouteSetV6RemoveRouteRequest>(offset);
8595            // Delegate to tuple encoding.
8596            fidl::encoding::Encode::<
8597                RouteSetV6RemoveRouteRequest,
8598                fdomain_client::fidl::FDomainResourceDialect,
8599            >::encode(
8600                (<fdomain_fuchsia_net_routes::RouteV6 as fidl::encoding::ValueTypeMarker>::borrow(
8601                    &self.route,
8602                ),),
8603                encoder,
8604                offset,
8605                _depth,
8606            )
8607        }
8608    }
8609    unsafe impl<
8610        T0: fidl::encoding::Encode<
8611                fdomain_fuchsia_net_routes::RouteV6,
8612                fdomain_client::fidl::FDomainResourceDialect,
8613            >,
8614    >
8615        fidl::encoding::Encode<
8616            RouteSetV6RemoveRouteRequest,
8617            fdomain_client::fidl::FDomainResourceDialect,
8618        > for (T0,)
8619    {
8620        #[inline]
8621        unsafe fn encode(
8622            self,
8623            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8624            offset: usize,
8625            depth: fidl::encoding::Depth,
8626        ) -> fidl::Result<()> {
8627            encoder.debug_check_bounds::<RouteSetV6RemoveRouteRequest>(offset);
8628            // Zero out padding regions. There's no need to apply masks
8629            // because the unmasked parts will be overwritten by fields.
8630            // Write the fields.
8631            self.0.encode(encoder, offset + 0, depth)?;
8632            Ok(())
8633        }
8634    }
8635
8636    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
8637        for RouteSetV6RemoveRouteRequest
8638    {
8639        #[inline(always)]
8640        fn new_empty() -> Self {
8641            Self {
8642                route: fidl::new_empty!(
8643                    fdomain_fuchsia_net_routes::RouteV6,
8644                    fdomain_client::fidl::FDomainResourceDialect
8645                ),
8646            }
8647        }
8648
8649        #[inline]
8650        unsafe fn decode(
8651            &mut self,
8652            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8653            offset: usize,
8654            _depth: fidl::encoding::Depth,
8655        ) -> fidl::Result<()> {
8656            decoder.debug_check_bounds::<Self>(offset);
8657            // Verify that padding bytes are zero.
8658            fidl::decode!(
8659                fdomain_fuchsia_net_routes::RouteV6,
8660                fdomain_client::fidl::FDomainResourceDialect,
8661                &mut self.route,
8662                decoder,
8663                offset + 0,
8664                _depth
8665            )?;
8666            Ok(())
8667        }
8668    }
8669
8670    impl fidl::encoding::ResourceTypeMarker for RouteTableProviderV4GetInterfaceLocalTableRequest {
8671        type Borrowed<'a> = &'a mut Self;
8672        fn take_or_borrow<'a>(
8673            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8674        ) -> Self::Borrowed<'a> {
8675            value
8676        }
8677    }
8678
8679    unsafe impl fidl::encoding::TypeMarker for RouteTableProviderV4GetInterfaceLocalTableRequest {
8680        type Owned = Self;
8681
8682        #[inline(always)]
8683        fn inline_align(_context: fidl::encoding::Context) -> usize {
8684            8
8685        }
8686
8687        #[inline(always)]
8688        fn inline_size(_context: fidl::encoding::Context) -> usize {
8689            16
8690        }
8691    }
8692
8693    unsafe impl
8694        fidl::encoding::Encode<
8695            RouteTableProviderV4GetInterfaceLocalTableRequest,
8696            fdomain_client::fidl::FDomainResourceDialect,
8697        > for &mut RouteTableProviderV4GetInterfaceLocalTableRequest
8698    {
8699        #[inline]
8700        unsafe fn encode(
8701            self,
8702            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8703            offset: usize,
8704            _depth: fidl::encoding::Depth,
8705        ) -> fidl::Result<()> {
8706            encoder.debug_check_bounds::<RouteTableProviderV4GetInterfaceLocalTableRequest>(offset);
8707            // Delegate to tuple encoding.
8708            fidl::encoding::Encode::<RouteTableProviderV4GetInterfaceLocalTableRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
8709                (
8710                    <fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
8711                ),
8712                encoder, offset, _depth
8713            )
8714        }
8715    }
8716    unsafe impl<
8717        T0: fidl::encoding::Encode<
8718                fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
8719                fdomain_client::fidl::FDomainResourceDialect,
8720            >,
8721    >
8722        fidl::encoding::Encode<
8723            RouteTableProviderV4GetInterfaceLocalTableRequest,
8724            fdomain_client::fidl::FDomainResourceDialect,
8725        > for (T0,)
8726    {
8727        #[inline]
8728        unsafe fn encode(
8729            self,
8730            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8731            offset: usize,
8732            depth: fidl::encoding::Depth,
8733        ) -> fidl::Result<()> {
8734            encoder.debug_check_bounds::<RouteTableProviderV4GetInterfaceLocalTableRequest>(offset);
8735            // Zero out padding regions. There's no need to apply masks
8736            // because the unmasked parts will be overwritten by fields.
8737            // Write the fields.
8738            self.0.encode(encoder, offset + 0, depth)?;
8739            Ok(())
8740        }
8741    }
8742
8743    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
8744        for RouteTableProviderV4GetInterfaceLocalTableRequest
8745    {
8746        #[inline(always)]
8747        fn new_empty() -> Self {
8748            Self {
8749                credential: fidl::new_empty!(
8750                    fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
8751                    fdomain_client::fidl::FDomainResourceDialect
8752                ),
8753            }
8754        }
8755
8756        #[inline]
8757        unsafe fn decode(
8758            &mut self,
8759            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8760            offset: usize,
8761            _depth: fidl::encoding::Depth,
8762        ) -> fidl::Result<()> {
8763            decoder.debug_check_bounds::<Self>(offset);
8764            // Verify that padding bytes are zero.
8765            fidl::decode!(
8766                fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
8767                fdomain_client::fidl::FDomainResourceDialect,
8768                &mut self.credential,
8769                decoder,
8770                offset + 0,
8771                _depth
8772            )?;
8773            Ok(())
8774        }
8775    }
8776
8777    impl fidl::encoding::ResourceTypeMarker for RouteTableProviderV4NewRouteTableRequest {
8778        type Borrowed<'a> = &'a mut Self;
8779        fn take_or_borrow<'a>(
8780            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8781        ) -> Self::Borrowed<'a> {
8782            value
8783        }
8784    }
8785
8786    unsafe impl fidl::encoding::TypeMarker for RouteTableProviderV4NewRouteTableRequest {
8787        type Owned = Self;
8788
8789        #[inline(always)]
8790        fn inline_align(_context: fidl::encoding::Context) -> usize {
8791            8
8792        }
8793
8794        #[inline(always)]
8795        fn inline_size(_context: fidl::encoding::Context) -> usize {
8796            24
8797        }
8798    }
8799
8800    unsafe impl
8801        fidl::encoding::Encode<
8802            RouteTableProviderV4NewRouteTableRequest,
8803            fdomain_client::fidl::FDomainResourceDialect,
8804        > for &mut RouteTableProviderV4NewRouteTableRequest
8805    {
8806        #[inline]
8807        unsafe fn encode(
8808            self,
8809            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8810            offset: usize,
8811            _depth: fidl::encoding::Depth,
8812        ) -> fidl::Result<()> {
8813            encoder.debug_check_bounds::<RouteTableProviderV4NewRouteTableRequest>(offset);
8814            // Delegate to tuple encoding.
8815            fidl::encoding::Encode::<RouteTableProviderV4NewRouteTableRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
8816                (
8817                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteTableV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.provider),
8818                    <RouteTableOptionsV4 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
8819                ),
8820                encoder, offset, _depth
8821            )
8822        }
8823    }
8824    unsafe impl<
8825        T0: fidl::encoding::Encode<
8826                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteTableV4Marker>>,
8827                fdomain_client::fidl::FDomainResourceDialect,
8828            >,
8829        T1: fidl::encoding::Encode<RouteTableOptionsV4, fdomain_client::fidl::FDomainResourceDialect>,
8830    >
8831        fidl::encoding::Encode<
8832            RouteTableProviderV4NewRouteTableRequest,
8833            fdomain_client::fidl::FDomainResourceDialect,
8834        > for (T0, T1)
8835    {
8836        #[inline]
8837        unsafe fn encode(
8838            self,
8839            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8840            offset: usize,
8841            depth: fidl::encoding::Depth,
8842        ) -> fidl::Result<()> {
8843            encoder.debug_check_bounds::<RouteTableProviderV4NewRouteTableRequest>(offset);
8844            // Zero out padding regions. There's no need to apply masks
8845            // because the unmasked parts will be overwritten by fields.
8846            unsafe {
8847                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
8848                (ptr as *mut u64).write_unaligned(0);
8849            }
8850            // Write the fields.
8851            self.0.encode(encoder, offset + 0, depth)?;
8852            self.1.encode(encoder, offset + 8, depth)?;
8853            Ok(())
8854        }
8855    }
8856
8857    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
8858        for RouteTableProviderV4NewRouteTableRequest
8859    {
8860        #[inline(always)]
8861        fn new_empty() -> Self {
8862            Self {
8863                provider: fidl::new_empty!(
8864                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteTableV4Marker>>,
8865                    fdomain_client::fidl::FDomainResourceDialect
8866                ),
8867                options: fidl::new_empty!(
8868                    RouteTableOptionsV4,
8869                    fdomain_client::fidl::FDomainResourceDialect
8870                ),
8871            }
8872        }
8873
8874        #[inline]
8875        unsafe fn decode(
8876            &mut self,
8877            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8878            offset: usize,
8879            _depth: fidl::encoding::Depth,
8880        ) -> fidl::Result<()> {
8881            decoder.debug_check_bounds::<Self>(offset);
8882            // Verify that padding bytes are zero.
8883            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
8884            let padval = unsafe { (ptr as *const u64).read_unaligned() };
8885            let mask = 0xffffffff00000000u64;
8886            let maskedval = padval & mask;
8887            if maskedval != 0 {
8888                return Err(fidl::Error::NonZeroPadding {
8889                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
8890                });
8891            }
8892            fidl::decode!(
8893                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteTableV4Marker>>,
8894                fdomain_client::fidl::FDomainResourceDialect,
8895                &mut self.provider,
8896                decoder,
8897                offset + 0,
8898                _depth
8899            )?;
8900            fidl::decode!(
8901                RouteTableOptionsV4,
8902                fdomain_client::fidl::FDomainResourceDialect,
8903                &mut self.options,
8904                decoder,
8905                offset + 8,
8906                _depth
8907            )?;
8908            Ok(())
8909        }
8910    }
8911
8912    impl fidl::encoding::ResourceTypeMarker for RouteTableProviderV4GetInterfaceLocalTableResponse {
8913        type Borrowed<'a> = &'a mut Self;
8914        fn take_or_borrow<'a>(
8915            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
8916        ) -> Self::Borrowed<'a> {
8917            value
8918        }
8919    }
8920
8921    unsafe impl fidl::encoding::TypeMarker for RouteTableProviderV4GetInterfaceLocalTableResponse {
8922        type Owned = Self;
8923
8924        #[inline(always)]
8925        fn inline_align(_context: fidl::encoding::Context) -> usize {
8926            4
8927        }
8928
8929        #[inline(always)]
8930        fn inline_size(_context: fidl::encoding::Context) -> usize {
8931            4
8932        }
8933    }
8934
8935    unsafe impl
8936        fidl::encoding::Encode<
8937            RouteTableProviderV4GetInterfaceLocalTableResponse,
8938            fdomain_client::fidl::FDomainResourceDialect,
8939        > for &mut RouteTableProviderV4GetInterfaceLocalTableResponse
8940    {
8941        #[inline]
8942        unsafe fn encode(
8943            self,
8944            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8945            offset: usize,
8946            _depth: fidl::encoding::Depth,
8947        ) -> fidl::Result<()> {
8948            encoder
8949                .debug_check_bounds::<RouteTableProviderV4GetInterfaceLocalTableResponse>(offset);
8950            // Delegate to tuple encoding.
8951            fidl::encoding::Encode::<RouteTableProviderV4GetInterfaceLocalTableResponse, fdomain_client::fidl::FDomainResourceDialect>::encode(
8952                (
8953                    <fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<RouteTableV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.route_table),
8954                ),
8955                encoder, offset, _depth
8956            )
8957        }
8958    }
8959    unsafe impl<
8960        T0: fidl::encoding::Encode<
8961                fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<RouteTableV4Marker>>,
8962                fdomain_client::fidl::FDomainResourceDialect,
8963            >,
8964    >
8965        fidl::encoding::Encode<
8966            RouteTableProviderV4GetInterfaceLocalTableResponse,
8967            fdomain_client::fidl::FDomainResourceDialect,
8968        > for (T0,)
8969    {
8970        #[inline]
8971        unsafe fn encode(
8972            self,
8973            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
8974            offset: usize,
8975            depth: fidl::encoding::Depth,
8976        ) -> fidl::Result<()> {
8977            encoder
8978                .debug_check_bounds::<RouteTableProviderV4GetInterfaceLocalTableResponse>(offset);
8979            // Zero out padding regions. There's no need to apply masks
8980            // because the unmasked parts will be overwritten by fields.
8981            // Write the fields.
8982            self.0.encode(encoder, offset + 0, depth)?;
8983            Ok(())
8984        }
8985    }
8986
8987    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
8988        for RouteTableProviderV4GetInterfaceLocalTableResponse
8989    {
8990        #[inline(always)]
8991        fn new_empty() -> Self {
8992            Self {
8993                route_table: fidl::new_empty!(
8994                    fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<RouteTableV4Marker>>,
8995                    fdomain_client::fidl::FDomainResourceDialect
8996                ),
8997            }
8998        }
8999
9000        #[inline]
9001        unsafe fn decode(
9002            &mut self,
9003            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9004            offset: usize,
9005            _depth: fidl::encoding::Depth,
9006        ) -> fidl::Result<()> {
9007            decoder.debug_check_bounds::<Self>(offset);
9008            // Verify that padding bytes are zero.
9009            fidl::decode!(
9010                fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<RouteTableV4Marker>>,
9011                fdomain_client::fidl::FDomainResourceDialect,
9012                &mut self.route_table,
9013                decoder,
9014                offset + 0,
9015                _depth
9016            )?;
9017            Ok(())
9018        }
9019    }
9020
9021    impl fidl::encoding::ResourceTypeMarker for RouteTableProviderV6GetInterfaceLocalTableRequest {
9022        type Borrowed<'a> = &'a mut Self;
9023        fn take_or_borrow<'a>(
9024            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9025        ) -> Self::Borrowed<'a> {
9026            value
9027        }
9028    }
9029
9030    unsafe impl fidl::encoding::TypeMarker for RouteTableProviderV6GetInterfaceLocalTableRequest {
9031        type Owned = Self;
9032
9033        #[inline(always)]
9034        fn inline_align(_context: fidl::encoding::Context) -> usize {
9035            8
9036        }
9037
9038        #[inline(always)]
9039        fn inline_size(_context: fidl::encoding::Context) -> usize {
9040            16
9041        }
9042    }
9043
9044    unsafe impl
9045        fidl::encoding::Encode<
9046            RouteTableProviderV6GetInterfaceLocalTableRequest,
9047            fdomain_client::fidl::FDomainResourceDialect,
9048        > for &mut RouteTableProviderV6GetInterfaceLocalTableRequest
9049    {
9050        #[inline]
9051        unsafe fn encode(
9052            self,
9053            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9054            offset: usize,
9055            _depth: fidl::encoding::Depth,
9056        ) -> fidl::Result<()> {
9057            encoder.debug_check_bounds::<RouteTableProviderV6GetInterfaceLocalTableRequest>(offset);
9058            // Delegate to tuple encoding.
9059            fidl::encoding::Encode::<RouteTableProviderV6GetInterfaceLocalTableRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
9060                (
9061                    <fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
9062                ),
9063                encoder, offset, _depth
9064            )
9065        }
9066    }
9067    unsafe impl<
9068        T0: fidl::encoding::Encode<
9069                fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
9070                fdomain_client::fidl::FDomainResourceDialect,
9071            >,
9072    >
9073        fidl::encoding::Encode<
9074            RouteTableProviderV6GetInterfaceLocalTableRequest,
9075            fdomain_client::fidl::FDomainResourceDialect,
9076        > for (T0,)
9077    {
9078        #[inline]
9079        unsafe fn encode(
9080            self,
9081            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9082            offset: usize,
9083            depth: fidl::encoding::Depth,
9084        ) -> fidl::Result<()> {
9085            encoder.debug_check_bounds::<RouteTableProviderV6GetInterfaceLocalTableRequest>(offset);
9086            // Zero out padding regions. There's no need to apply masks
9087            // because the unmasked parts will be overwritten by fields.
9088            // Write the fields.
9089            self.0.encode(encoder, offset + 0, depth)?;
9090            Ok(())
9091        }
9092    }
9093
9094    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
9095        for RouteTableProviderV6GetInterfaceLocalTableRequest
9096    {
9097        #[inline(always)]
9098        fn new_empty() -> Self {
9099            Self {
9100                credential: fidl::new_empty!(
9101                    fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
9102                    fdomain_client::fidl::FDomainResourceDialect
9103                ),
9104            }
9105        }
9106
9107        #[inline]
9108        unsafe fn decode(
9109            &mut self,
9110            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9111            offset: usize,
9112            _depth: fidl::encoding::Depth,
9113        ) -> fidl::Result<()> {
9114            decoder.debug_check_bounds::<Self>(offset);
9115            // Verify that padding bytes are zero.
9116            fidl::decode!(
9117                fdomain_fuchsia_net_resources::ProofOfInterfaceAuthorization,
9118                fdomain_client::fidl::FDomainResourceDialect,
9119                &mut self.credential,
9120                decoder,
9121                offset + 0,
9122                _depth
9123            )?;
9124            Ok(())
9125        }
9126    }
9127
9128    impl fidl::encoding::ResourceTypeMarker for RouteTableProviderV6NewRouteTableRequest {
9129        type Borrowed<'a> = &'a mut Self;
9130        fn take_or_borrow<'a>(
9131            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9132        ) -> Self::Borrowed<'a> {
9133            value
9134        }
9135    }
9136
9137    unsafe impl fidl::encoding::TypeMarker for RouteTableProviderV6NewRouteTableRequest {
9138        type Owned = Self;
9139
9140        #[inline(always)]
9141        fn inline_align(_context: fidl::encoding::Context) -> usize {
9142            8
9143        }
9144
9145        #[inline(always)]
9146        fn inline_size(_context: fidl::encoding::Context) -> usize {
9147            24
9148        }
9149    }
9150
9151    unsafe impl
9152        fidl::encoding::Encode<
9153            RouteTableProviderV6NewRouteTableRequest,
9154            fdomain_client::fidl::FDomainResourceDialect,
9155        > for &mut RouteTableProviderV6NewRouteTableRequest
9156    {
9157        #[inline]
9158        unsafe fn encode(
9159            self,
9160            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9161            offset: usize,
9162            _depth: fidl::encoding::Depth,
9163        ) -> fidl::Result<()> {
9164            encoder.debug_check_bounds::<RouteTableProviderV6NewRouteTableRequest>(offset);
9165            // Delegate to tuple encoding.
9166            fidl::encoding::Encode::<RouteTableProviderV6NewRouteTableRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
9167                (
9168                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteTableV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.provider),
9169                    <RouteTableOptionsV6 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
9170                ),
9171                encoder, offset, _depth
9172            )
9173        }
9174    }
9175    unsafe impl<
9176        T0: fidl::encoding::Encode<
9177                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteTableV6Marker>>,
9178                fdomain_client::fidl::FDomainResourceDialect,
9179            >,
9180        T1: fidl::encoding::Encode<RouteTableOptionsV6, fdomain_client::fidl::FDomainResourceDialect>,
9181    >
9182        fidl::encoding::Encode<
9183            RouteTableProviderV6NewRouteTableRequest,
9184            fdomain_client::fidl::FDomainResourceDialect,
9185        > for (T0, T1)
9186    {
9187        #[inline]
9188        unsafe fn encode(
9189            self,
9190            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9191            offset: usize,
9192            depth: fidl::encoding::Depth,
9193        ) -> fidl::Result<()> {
9194            encoder.debug_check_bounds::<RouteTableProviderV6NewRouteTableRequest>(offset);
9195            // Zero out padding regions. There's no need to apply masks
9196            // because the unmasked parts will be overwritten by fields.
9197            unsafe {
9198                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
9199                (ptr as *mut u64).write_unaligned(0);
9200            }
9201            // Write the fields.
9202            self.0.encode(encoder, offset + 0, depth)?;
9203            self.1.encode(encoder, offset + 8, depth)?;
9204            Ok(())
9205        }
9206    }
9207
9208    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
9209        for RouteTableProviderV6NewRouteTableRequest
9210    {
9211        #[inline(always)]
9212        fn new_empty() -> Self {
9213            Self {
9214                provider: fidl::new_empty!(
9215                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteTableV6Marker>>,
9216                    fdomain_client::fidl::FDomainResourceDialect
9217                ),
9218                options: fidl::new_empty!(
9219                    RouteTableOptionsV6,
9220                    fdomain_client::fidl::FDomainResourceDialect
9221                ),
9222            }
9223        }
9224
9225        #[inline]
9226        unsafe fn decode(
9227            &mut self,
9228            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9229            offset: usize,
9230            _depth: fidl::encoding::Depth,
9231        ) -> fidl::Result<()> {
9232            decoder.debug_check_bounds::<Self>(offset);
9233            // Verify that padding bytes are zero.
9234            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
9235            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9236            let mask = 0xffffffff00000000u64;
9237            let maskedval = padval & mask;
9238            if maskedval != 0 {
9239                return Err(fidl::Error::NonZeroPadding {
9240                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
9241                });
9242            }
9243            fidl::decode!(
9244                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteTableV6Marker>>,
9245                fdomain_client::fidl::FDomainResourceDialect,
9246                &mut self.provider,
9247                decoder,
9248                offset + 0,
9249                _depth
9250            )?;
9251            fidl::decode!(
9252                RouteTableOptionsV6,
9253                fdomain_client::fidl::FDomainResourceDialect,
9254                &mut self.options,
9255                decoder,
9256                offset + 8,
9257                _depth
9258            )?;
9259            Ok(())
9260        }
9261    }
9262
9263    impl fidl::encoding::ResourceTypeMarker for RouteTableProviderV6GetInterfaceLocalTableResponse {
9264        type Borrowed<'a> = &'a mut Self;
9265        fn take_or_borrow<'a>(
9266            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9267        ) -> Self::Borrowed<'a> {
9268            value
9269        }
9270    }
9271
9272    unsafe impl fidl::encoding::TypeMarker for RouteTableProviderV6GetInterfaceLocalTableResponse {
9273        type Owned = Self;
9274
9275        #[inline(always)]
9276        fn inline_align(_context: fidl::encoding::Context) -> usize {
9277            4
9278        }
9279
9280        #[inline(always)]
9281        fn inline_size(_context: fidl::encoding::Context) -> usize {
9282            4
9283        }
9284    }
9285
9286    unsafe impl
9287        fidl::encoding::Encode<
9288            RouteTableProviderV6GetInterfaceLocalTableResponse,
9289            fdomain_client::fidl::FDomainResourceDialect,
9290        > for &mut RouteTableProviderV6GetInterfaceLocalTableResponse
9291    {
9292        #[inline]
9293        unsafe fn encode(
9294            self,
9295            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9296            offset: usize,
9297            _depth: fidl::encoding::Depth,
9298        ) -> fidl::Result<()> {
9299            encoder
9300                .debug_check_bounds::<RouteTableProviderV6GetInterfaceLocalTableResponse>(offset);
9301            // Delegate to tuple encoding.
9302            fidl::encoding::Encode::<RouteTableProviderV6GetInterfaceLocalTableResponse, fdomain_client::fidl::FDomainResourceDialect>::encode(
9303                (
9304                    <fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<RouteTableV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.route_table),
9305                ),
9306                encoder, offset, _depth
9307            )
9308        }
9309    }
9310    unsafe impl<
9311        T0: fidl::encoding::Encode<
9312                fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<RouteTableV6Marker>>,
9313                fdomain_client::fidl::FDomainResourceDialect,
9314            >,
9315    >
9316        fidl::encoding::Encode<
9317            RouteTableProviderV6GetInterfaceLocalTableResponse,
9318            fdomain_client::fidl::FDomainResourceDialect,
9319        > for (T0,)
9320    {
9321        #[inline]
9322        unsafe fn encode(
9323            self,
9324            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9325            offset: usize,
9326            depth: fidl::encoding::Depth,
9327        ) -> fidl::Result<()> {
9328            encoder
9329                .debug_check_bounds::<RouteTableProviderV6GetInterfaceLocalTableResponse>(offset);
9330            // Zero out padding regions. There's no need to apply masks
9331            // because the unmasked parts will be overwritten by fields.
9332            // Write the fields.
9333            self.0.encode(encoder, offset + 0, depth)?;
9334            Ok(())
9335        }
9336    }
9337
9338    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
9339        for RouteTableProviderV6GetInterfaceLocalTableResponse
9340    {
9341        #[inline(always)]
9342        fn new_empty() -> Self {
9343            Self {
9344                route_table: fidl::new_empty!(
9345                    fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<RouteTableV6Marker>>,
9346                    fdomain_client::fidl::FDomainResourceDialect
9347                ),
9348            }
9349        }
9350
9351        #[inline]
9352        unsafe fn decode(
9353            &mut self,
9354            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9355            offset: usize,
9356            _depth: fidl::encoding::Depth,
9357        ) -> fidl::Result<()> {
9358            decoder.debug_check_bounds::<Self>(offset);
9359            // Verify that padding bytes are zero.
9360            fidl::decode!(
9361                fidl::encoding::Endpoint<fdomain_client::fidl::ClientEnd<RouteTableV6Marker>>,
9362                fdomain_client::fidl::FDomainResourceDialect,
9363                &mut self.route_table,
9364                decoder,
9365                offset + 0,
9366                _depth
9367            )?;
9368            Ok(())
9369        }
9370    }
9371
9372    impl fidl::encoding::ResourceTypeMarker for RouteTableV4NewRouteSetRequest {
9373        type Borrowed<'a> = &'a mut Self;
9374        fn take_or_borrow<'a>(
9375            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9376        ) -> Self::Borrowed<'a> {
9377            value
9378        }
9379    }
9380
9381    unsafe impl fidl::encoding::TypeMarker for RouteTableV4NewRouteSetRequest {
9382        type Owned = Self;
9383
9384        #[inline(always)]
9385        fn inline_align(_context: fidl::encoding::Context) -> usize {
9386            4
9387        }
9388
9389        #[inline(always)]
9390        fn inline_size(_context: fidl::encoding::Context) -> usize {
9391            4
9392        }
9393    }
9394
9395    unsafe impl
9396        fidl::encoding::Encode<
9397            RouteTableV4NewRouteSetRequest,
9398            fdomain_client::fidl::FDomainResourceDialect,
9399        > for &mut RouteTableV4NewRouteSetRequest
9400    {
9401        #[inline]
9402        unsafe fn encode(
9403            self,
9404            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9405            offset: usize,
9406            _depth: fidl::encoding::Depth,
9407        ) -> fidl::Result<()> {
9408            encoder.debug_check_bounds::<RouteTableV4NewRouteSetRequest>(offset);
9409            // Delegate to tuple encoding.
9410            fidl::encoding::Encode::<RouteTableV4NewRouteSetRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
9411                (
9412                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteSetV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.route_set),
9413                ),
9414                encoder, offset, _depth
9415            )
9416        }
9417    }
9418    unsafe impl<
9419        T0: fidl::encoding::Encode<
9420                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteSetV4Marker>>,
9421                fdomain_client::fidl::FDomainResourceDialect,
9422            >,
9423    >
9424        fidl::encoding::Encode<
9425            RouteTableV4NewRouteSetRequest,
9426            fdomain_client::fidl::FDomainResourceDialect,
9427        > for (T0,)
9428    {
9429        #[inline]
9430        unsafe fn encode(
9431            self,
9432            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9433            offset: usize,
9434            depth: fidl::encoding::Depth,
9435        ) -> fidl::Result<()> {
9436            encoder.debug_check_bounds::<RouteTableV4NewRouteSetRequest>(offset);
9437            // Zero out padding regions. There's no need to apply masks
9438            // because the unmasked parts will be overwritten by fields.
9439            // Write the fields.
9440            self.0.encode(encoder, offset + 0, depth)?;
9441            Ok(())
9442        }
9443    }
9444
9445    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
9446        for RouteTableV4NewRouteSetRequest
9447    {
9448        #[inline(always)]
9449        fn new_empty() -> Self {
9450            Self {
9451                route_set: fidl::new_empty!(
9452                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteSetV4Marker>>,
9453                    fdomain_client::fidl::FDomainResourceDialect
9454                ),
9455            }
9456        }
9457
9458        #[inline]
9459        unsafe fn decode(
9460            &mut self,
9461            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9462            offset: usize,
9463            _depth: fidl::encoding::Depth,
9464        ) -> fidl::Result<()> {
9465            decoder.debug_check_bounds::<Self>(offset);
9466            // Verify that padding bytes are zero.
9467            fidl::decode!(
9468                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteSetV4Marker>>,
9469                fdomain_client::fidl::FDomainResourceDialect,
9470                &mut self.route_set,
9471                decoder,
9472                offset + 0,
9473                _depth
9474            )?;
9475            Ok(())
9476        }
9477    }
9478
9479    impl fidl::encoding::ResourceTypeMarker for RouteTableV6NewRouteSetRequest {
9480        type Borrowed<'a> = &'a mut Self;
9481        fn take_or_borrow<'a>(
9482            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9483        ) -> Self::Borrowed<'a> {
9484            value
9485        }
9486    }
9487
9488    unsafe impl fidl::encoding::TypeMarker for RouteTableV6NewRouteSetRequest {
9489        type Owned = Self;
9490
9491        #[inline(always)]
9492        fn inline_align(_context: fidl::encoding::Context) -> usize {
9493            4
9494        }
9495
9496        #[inline(always)]
9497        fn inline_size(_context: fidl::encoding::Context) -> usize {
9498            4
9499        }
9500    }
9501
9502    unsafe impl
9503        fidl::encoding::Encode<
9504            RouteTableV6NewRouteSetRequest,
9505            fdomain_client::fidl::FDomainResourceDialect,
9506        > for &mut RouteTableV6NewRouteSetRequest
9507    {
9508        #[inline]
9509        unsafe fn encode(
9510            self,
9511            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9512            offset: usize,
9513            _depth: fidl::encoding::Depth,
9514        ) -> fidl::Result<()> {
9515            encoder.debug_check_bounds::<RouteTableV6NewRouteSetRequest>(offset);
9516            // Delegate to tuple encoding.
9517            fidl::encoding::Encode::<RouteTableV6NewRouteSetRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
9518                (
9519                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteSetV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.route_set),
9520                ),
9521                encoder, offset, _depth
9522            )
9523        }
9524    }
9525    unsafe impl<
9526        T0: fidl::encoding::Encode<
9527                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteSetV6Marker>>,
9528                fdomain_client::fidl::FDomainResourceDialect,
9529            >,
9530    >
9531        fidl::encoding::Encode<
9532            RouteTableV6NewRouteSetRequest,
9533            fdomain_client::fidl::FDomainResourceDialect,
9534        > for (T0,)
9535    {
9536        #[inline]
9537        unsafe fn encode(
9538            self,
9539            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9540            offset: usize,
9541            depth: fidl::encoding::Depth,
9542        ) -> fidl::Result<()> {
9543            encoder.debug_check_bounds::<RouteTableV6NewRouteSetRequest>(offset);
9544            // Zero out padding regions. There's no need to apply masks
9545            // because the unmasked parts will be overwritten by fields.
9546            // Write the fields.
9547            self.0.encode(encoder, offset + 0, depth)?;
9548            Ok(())
9549        }
9550    }
9551
9552    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
9553        for RouteTableV6NewRouteSetRequest
9554    {
9555        #[inline(always)]
9556        fn new_empty() -> Self {
9557            Self {
9558                route_set: fidl::new_empty!(
9559                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteSetV6Marker>>,
9560                    fdomain_client::fidl::FDomainResourceDialect
9561                ),
9562            }
9563        }
9564
9565        #[inline]
9566        unsafe fn decode(
9567            &mut self,
9568            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9569            offset: usize,
9570            _depth: fidl::encoding::Depth,
9571        ) -> fidl::Result<()> {
9572            decoder.debug_check_bounds::<Self>(offset);
9573            // Verify that padding bytes are zero.
9574            fidl::decode!(
9575                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RouteSetV6Marker>>,
9576                fdomain_client::fidl::FDomainResourceDialect,
9577                &mut self.route_set,
9578                decoder,
9579                offset + 0,
9580                _depth
9581            )?;
9582            Ok(())
9583        }
9584    }
9585
9586    impl fidl::encoding::ResourceTypeMarker for RuleSetV4AddRuleRequest {
9587        type Borrowed<'a> = &'a mut Self;
9588        fn take_or_borrow<'a>(
9589            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9590        ) -> Self::Borrowed<'a> {
9591            value
9592        }
9593    }
9594
9595    unsafe impl fidl::encoding::TypeMarker for RuleSetV4AddRuleRequest {
9596        type Owned = Self;
9597
9598        #[inline(always)]
9599        fn inline_align(_context: fidl::encoding::Context) -> usize {
9600            8
9601        }
9602
9603        #[inline(always)]
9604        fn inline_size(_context: fidl::encoding::Context) -> usize {
9605            40
9606        }
9607    }
9608
9609    unsafe impl
9610        fidl::encoding::Encode<
9611            RuleSetV4AddRuleRequest,
9612            fdomain_client::fidl::FDomainResourceDialect,
9613        > for &mut RuleSetV4AddRuleRequest
9614    {
9615        #[inline]
9616        unsafe fn encode(
9617            self,
9618            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9619            offset: usize,
9620            _depth: fidl::encoding::Depth,
9621        ) -> fidl::Result<()> {
9622            encoder.debug_check_bounds::<RuleSetV4AddRuleRequest>(offset);
9623            // Delegate to tuple encoding.
9624            fidl::encoding::Encode::<RuleSetV4AddRuleRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
9625                (
9626                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.index),
9627                    <fdomain_fuchsia_net_routes::RuleMatcherV4 as fidl::encoding::ValueTypeMarker>::borrow(&self.matcher),
9628                    <fdomain_fuchsia_net_routes::RuleAction as fidl::encoding::ValueTypeMarker>::borrow(&self.action),
9629                ),
9630                encoder, offset, _depth
9631            )
9632        }
9633    }
9634    unsafe impl<
9635        T0: fidl::encoding::Encode<u32, fdomain_client::fidl::FDomainResourceDialect>,
9636        T1: fidl::encoding::Encode<
9637                fdomain_fuchsia_net_routes::RuleMatcherV4,
9638                fdomain_client::fidl::FDomainResourceDialect,
9639            >,
9640        T2: fidl::encoding::Encode<
9641                fdomain_fuchsia_net_routes::RuleAction,
9642                fdomain_client::fidl::FDomainResourceDialect,
9643            >,
9644    >
9645        fidl::encoding::Encode<
9646            RuleSetV4AddRuleRequest,
9647            fdomain_client::fidl::FDomainResourceDialect,
9648        > for (T0, T1, T2)
9649    {
9650        #[inline]
9651        unsafe fn encode(
9652            self,
9653            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9654            offset: usize,
9655            depth: fidl::encoding::Depth,
9656        ) -> fidl::Result<()> {
9657            encoder.debug_check_bounds::<RuleSetV4AddRuleRequest>(offset);
9658            // Zero out padding regions. There's no need to apply masks
9659            // because the unmasked parts will be overwritten by fields.
9660            unsafe {
9661                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
9662                (ptr as *mut u64).write_unaligned(0);
9663            }
9664            // Write the fields.
9665            self.0.encode(encoder, offset + 0, depth)?;
9666            self.1.encode(encoder, offset + 8, depth)?;
9667            self.2.encode(encoder, offset + 24, depth)?;
9668            Ok(())
9669        }
9670    }
9671
9672    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
9673        for RuleSetV4AddRuleRequest
9674    {
9675        #[inline(always)]
9676        fn new_empty() -> Self {
9677            Self {
9678                index: fidl::new_empty!(u32, fdomain_client::fidl::FDomainResourceDialect),
9679                matcher: fidl::new_empty!(
9680                    fdomain_fuchsia_net_routes::RuleMatcherV4,
9681                    fdomain_client::fidl::FDomainResourceDialect
9682                ),
9683                action: fidl::new_empty!(
9684                    fdomain_fuchsia_net_routes::RuleAction,
9685                    fdomain_client::fidl::FDomainResourceDialect
9686                ),
9687            }
9688        }
9689
9690        #[inline]
9691        unsafe fn decode(
9692            &mut self,
9693            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9694            offset: usize,
9695            _depth: fidl::encoding::Depth,
9696        ) -> fidl::Result<()> {
9697            decoder.debug_check_bounds::<Self>(offset);
9698            // Verify that padding bytes are zero.
9699            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
9700            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9701            let mask = 0xffffffff00000000u64;
9702            let maskedval = padval & mask;
9703            if maskedval != 0 {
9704                return Err(fidl::Error::NonZeroPadding {
9705                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
9706                });
9707            }
9708            fidl::decode!(
9709                u32,
9710                fdomain_client::fidl::FDomainResourceDialect,
9711                &mut self.index,
9712                decoder,
9713                offset + 0,
9714                _depth
9715            )?;
9716            fidl::decode!(
9717                fdomain_fuchsia_net_routes::RuleMatcherV4,
9718                fdomain_client::fidl::FDomainResourceDialect,
9719                &mut self.matcher,
9720                decoder,
9721                offset + 8,
9722                _depth
9723            )?;
9724            fidl::decode!(
9725                fdomain_fuchsia_net_routes::RuleAction,
9726                fdomain_client::fidl::FDomainResourceDialect,
9727                &mut self.action,
9728                decoder,
9729                offset + 24,
9730                _depth
9731            )?;
9732            Ok(())
9733        }
9734    }
9735
9736    impl fidl::encoding::ResourceTypeMarker for RuleSetV6AddRuleRequest {
9737        type Borrowed<'a> = &'a mut Self;
9738        fn take_or_borrow<'a>(
9739            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9740        ) -> Self::Borrowed<'a> {
9741            value
9742        }
9743    }
9744
9745    unsafe impl fidl::encoding::TypeMarker for RuleSetV6AddRuleRequest {
9746        type Owned = Self;
9747
9748        #[inline(always)]
9749        fn inline_align(_context: fidl::encoding::Context) -> usize {
9750            8
9751        }
9752
9753        #[inline(always)]
9754        fn inline_size(_context: fidl::encoding::Context) -> usize {
9755            40
9756        }
9757    }
9758
9759    unsafe impl
9760        fidl::encoding::Encode<
9761            RuleSetV6AddRuleRequest,
9762            fdomain_client::fidl::FDomainResourceDialect,
9763        > for &mut RuleSetV6AddRuleRequest
9764    {
9765        #[inline]
9766        unsafe fn encode(
9767            self,
9768            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9769            offset: usize,
9770            _depth: fidl::encoding::Depth,
9771        ) -> fidl::Result<()> {
9772            encoder.debug_check_bounds::<RuleSetV6AddRuleRequest>(offset);
9773            // Delegate to tuple encoding.
9774            fidl::encoding::Encode::<RuleSetV6AddRuleRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
9775                (
9776                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.index),
9777                    <fdomain_fuchsia_net_routes::RuleMatcherV6 as fidl::encoding::ValueTypeMarker>::borrow(&self.matcher),
9778                    <fdomain_fuchsia_net_routes::RuleAction as fidl::encoding::ValueTypeMarker>::borrow(&self.action),
9779                ),
9780                encoder, offset, _depth
9781            )
9782        }
9783    }
9784    unsafe impl<
9785        T0: fidl::encoding::Encode<u32, fdomain_client::fidl::FDomainResourceDialect>,
9786        T1: fidl::encoding::Encode<
9787                fdomain_fuchsia_net_routes::RuleMatcherV6,
9788                fdomain_client::fidl::FDomainResourceDialect,
9789            >,
9790        T2: fidl::encoding::Encode<
9791                fdomain_fuchsia_net_routes::RuleAction,
9792                fdomain_client::fidl::FDomainResourceDialect,
9793            >,
9794    >
9795        fidl::encoding::Encode<
9796            RuleSetV6AddRuleRequest,
9797            fdomain_client::fidl::FDomainResourceDialect,
9798        > for (T0, T1, T2)
9799    {
9800        #[inline]
9801        unsafe fn encode(
9802            self,
9803            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9804            offset: usize,
9805            depth: fidl::encoding::Depth,
9806        ) -> fidl::Result<()> {
9807            encoder.debug_check_bounds::<RuleSetV6AddRuleRequest>(offset);
9808            // Zero out padding regions. There's no need to apply masks
9809            // because the unmasked parts will be overwritten by fields.
9810            unsafe {
9811                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
9812                (ptr as *mut u64).write_unaligned(0);
9813            }
9814            // Write the fields.
9815            self.0.encode(encoder, offset + 0, depth)?;
9816            self.1.encode(encoder, offset + 8, depth)?;
9817            self.2.encode(encoder, offset + 24, depth)?;
9818            Ok(())
9819        }
9820    }
9821
9822    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
9823        for RuleSetV6AddRuleRequest
9824    {
9825        #[inline(always)]
9826        fn new_empty() -> Self {
9827            Self {
9828                index: fidl::new_empty!(u32, fdomain_client::fidl::FDomainResourceDialect),
9829                matcher: fidl::new_empty!(
9830                    fdomain_fuchsia_net_routes::RuleMatcherV6,
9831                    fdomain_client::fidl::FDomainResourceDialect
9832                ),
9833                action: fidl::new_empty!(
9834                    fdomain_fuchsia_net_routes::RuleAction,
9835                    fdomain_client::fidl::FDomainResourceDialect
9836                ),
9837            }
9838        }
9839
9840        #[inline]
9841        unsafe fn decode(
9842            &mut self,
9843            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9844            offset: usize,
9845            _depth: fidl::encoding::Depth,
9846        ) -> fidl::Result<()> {
9847            decoder.debug_check_bounds::<Self>(offset);
9848            // Verify that padding bytes are zero.
9849            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
9850            let padval = unsafe { (ptr as *const u64).read_unaligned() };
9851            let mask = 0xffffffff00000000u64;
9852            let maskedval = padval & mask;
9853            if maskedval != 0 {
9854                return Err(fidl::Error::NonZeroPadding {
9855                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
9856                });
9857            }
9858            fidl::decode!(
9859                u32,
9860                fdomain_client::fidl::FDomainResourceDialect,
9861                &mut self.index,
9862                decoder,
9863                offset + 0,
9864                _depth
9865            )?;
9866            fidl::decode!(
9867                fdomain_fuchsia_net_routes::RuleMatcherV6,
9868                fdomain_client::fidl::FDomainResourceDialect,
9869                &mut self.matcher,
9870                decoder,
9871                offset + 8,
9872                _depth
9873            )?;
9874            fidl::decode!(
9875                fdomain_fuchsia_net_routes::RuleAction,
9876                fdomain_client::fidl::FDomainResourceDialect,
9877                &mut self.action,
9878                decoder,
9879                offset + 24,
9880                _depth
9881            )?;
9882            Ok(())
9883        }
9884    }
9885
9886    impl fidl::encoding::ResourceTypeMarker for RuleTableV4NewRuleSetRequest {
9887        type Borrowed<'a> = &'a mut Self;
9888        fn take_or_borrow<'a>(
9889            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9890        ) -> Self::Borrowed<'a> {
9891            value
9892        }
9893    }
9894
9895    unsafe impl fidl::encoding::TypeMarker for RuleTableV4NewRuleSetRequest {
9896        type Owned = Self;
9897
9898        #[inline(always)]
9899        fn inline_align(_context: fidl::encoding::Context) -> usize {
9900            4
9901        }
9902
9903        #[inline(always)]
9904        fn inline_size(_context: fidl::encoding::Context) -> usize {
9905            8
9906        }
9907    }
9908
9909    unsafe impl
9910        fidl::encoding::Encode<
9911            RuleTableV4NewRuleSetRequest,
9912            fdomain_client::fidl::FDomainResourceDialect,
9913        > for &mut RuleTableV4NewRuleSetRequest
9914    {
9915        #[inline]
9916        unsafe fn encode(
9917            self,
9918            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9919            offset: usize,
9920            _depth: fidl::encoding::Depth,
9921        ) -> fidl::Result<()> {
9922            encoder.debug_check_bounds::<RuleTableV4NewRuleSetRequest>(offset);
9923            // Delegate to tuple encoding.
9924            fidl::encoding::Encode::<RuleTableV4NewRuleSetRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
9925                (
9926                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.priority),
9927                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RuleSetV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.rule_set),
9928                ),
9929                encoder, offset, _depth
9930            )
9931        }
9932    }
9933    unsafe impl<
9934        T0: fidl::encoding::Encode<u32, fdomain_client::fidl::FDomainResourceDialect>,
9935        T1: fidl::encoding::Encode<
9936                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RuleSetV4Marker>>,
9937                fdomain_client::fidl::FDomainResourceDialect,
9938            >,
9939    >
9940        fidl::encoding::Encode<
9941            RuleTableV4NewRuleSetRequest,
9942            fdomain_client::fidl::FDomainResourceDialect,
9943        > for (T0, T1)
9944    {
9945        #[inline]
9946        unsafe fn encode(
9947            self,
9948            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9949            offset: usize,
9950            depth: fidl::encoding::Depth,
9951        ) -> fidl::Result<()> {
9952            encoder.debug_check_bounds::<RuleTableV4NewRuleSetRequest>(offset);
9953            // Zero out padding regions. There's no need to apply masks
9954            // because the unmasked parts will be overwritten by fields.
9955            // Write the fields.
9956            self.0.encode(encoder, offset + 0, depth)?;
9957            self.1.encode(encoder, offset + 4, depth)?;
9958            Ok(())
9959        }
9960    }
9961
9962    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
9963        for RuleTableV4NewRuleSetRequest
9964    {
9965        #[inline(always)]
9966        fn new_empty() -> Self {
9967            Self {
9968                priority: fidl::new_empty!(u32, fdomain_client::fidl::FDomainResourceDialect),
9969                rule_set: fidl::new_empty!(
9970                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RuleSetV4Marker>>,
9971                    fdomain_client::fidl::FDomainResourceDialect
9972                ),
9973            }
9974        }
9975
9976        #[inline]
9977        unsafe fn decode(
9978            &mut self,
9979            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
9980            offset: usize,
9981            _depth: fidl::encoding::Depth,
9982        ) -> fidl::Result<()> {
9983            decoder.debug_check_bounds::<Self>(offset);
9984            // Verify that padding bytes are zero.
9985            fidl::decode!(
9986                u32,
9987                fdomain_client::fidl::FDomainResourceDialect,
9988                &mut self.priority,
9989                decoder,
9990                offset + 0,
9991                _depth
9992            )?;
9993            fidl::decode!(
9994                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RuleSetV4Marker>>,
9995                fdomain_client::fidl::FDomainResourceDialect,
9996                &mut self.rule_set,
9997                decoder,
9998                offset + 4,
9999                _depth
10000            )?;
10001            Ok(())
10002        }
10003    }
10004
10005    impl fidl::encoding::ResourceTypeMarker for RuleTableV6NewRuleSetRequest {
10006        type Borrowed<'a> = &'a mut Self;
10007        fn take_or_borrow<'a>(
10008            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10009        ) -> Self::Borrowed<'a> {
10010            value
10011        }
10012    }
10013
10014    unsafe impl fidl::encoding::TypeMarker for RuleTableV6NewRuleSetRequest {
10015        type Owned = Self;
10016
10017        #[inline(always)]
10018        fn inline_align(_context: fidl::encoding::Context) -> usize {
10019            4
10020        }
10021
10022        #[inline(always)]
10023        fn inline_size(_context: fidl::encoding::Context) -> usize {
10024            8
10025        }
10026    }
10027
10028    unsafe impl
10029        fidl::encoding::Encode<
10030            RuleTableV6NewRuleSetRequest,
10031            fdomain_client::fidl::FDomainResourceDialect,
10032        > for &mut RuleTableV6NewRuleSetRequest
10033    {
10034        #[inline]
10035        unsafe fn encode(
10036            self,
10037            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
10038            offset: usize,
10039            _depth: fidl::encoding::Depth,
10040        ) -> fidl::Result<()> {
10041            encoder.debug_check_bounds::<RuleTableV6NewRuleSetRequest>(offset);
10042            // Delegate to tuple encoding.
10043            fidl::encoding::Encode::<RuleTableV6NewRuleSetRequest, fdomain_client::fidl::FDomainResourceDialect>::encode(
10044                (
10045                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.priority),
10046                    <fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RuleSetV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.rule_set),
10047                ),
10048                encoder, offset, _depth
10049            )
10050        }
10051    }
10052    unsafe impl<
10053        T0: fidl::encoding::Encode<u32, fdomain_client::fidl::FDomainResourceDialect>,
10054        T1: fidl::encoding::Encode<
10055                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RuleSetV6Marker>>,
10056                fdomain_client::fidl::FDomainResourceDialect,
10057            >,
10058    >
10059        fidl::encoding::Encode<
10060            RuleTableV6NewRuleSetRequest,
10061            fdomain_client::fidl::FDomainResourceDialect,
10062        > for (T0, T1)
10063    {
10064        #[inline]
10065        unsafe fn encode(
10066            self,
10067            encoder: &mut fidl::encoding::Encoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
10068            offset: usize,
10069            depth: fidl::encoding::Depth,
10070        ) -> fidl::Result<()> {
10071            encoder.debug_check_bounds::<RuleTableV6NewRuleSetRequest>(offset);
10072            // Zero out padding regions. There's no need to apply masks
10073            // because the unmasked parts will be overwritten by fields.
10074            // Write the fields.
10075            self.0.encode(encoder, offset + 0, depth)?;
10076            self.1.encode(encoder, offset + 4, depth)?;
10077            Ok(())
10078        }
10079    }
10080
10081    impl fidl::encoding::Decode<Self, fdomain_client::fidl::FDomainResourceDialect>
10082        for RuleTableV6NewRuleSetRequest
10083    {
10084        #[inline(always)]
10085        fn new_empty() -> Self {
10086            Self {
10087                priority: fidl::new_empty!(u32, fdomain_client::fidl::FDomainResourceDialect),
10088                rule_set: fidl::new_empty!(
10089                    fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RuleSetV6Marker>>,
10090                    fdomain_client::fidl::FDomainResourceDialect
10091                ),
10092            }
10093        }
10094
10095        #[inline]
10096        unsafe fn decode(
10097            &mut self,
10098            decoder: &mut fidl::encoding::Decoder<'_, fdomain_client::fidl::FDomainResourceDialect>,
10099            offset: usize,
10100            _depth: fidl::encoding::Depth,
10101        ) -> fidl::Result<()> {
10102            decoder.debug_check_bounds::<Self>(offset);
10103            // Verify that padding bytes are zero.
10104            fidl::decode!(
10105                u32,
10106                fdomain_client::fidl::FDomainResourceDialect,
10107                &mut self.priority,
10108                decoder,
10109                offset + 0,
10110                _depth
10111            )?;
10112            fidl::decode!(
10113                fidl::encoding::Endpoint<fdomain_client::fidl::ServerEnd<RuleSetV6Marker>>,
10114                fdomain_client::fidl::FDomainResourceDialect,
10115                &mut self.rule_set,
10116                decoder,
10117                offset + 4,
10118                _depth
10119            )?;
10120            Ok(())
10121        }
10122    }
10123}