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