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_resources::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_resources::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_resources::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_resources::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 or an interface-local
322    /// table, an error will be returned if called. The server will close the
323    /// channel after this 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 or an interface-local
447    /// table, an error will be returned if called. The server will close the
448    /// channel after this 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 or an interface-local
770    /// table, an error will be returned if called. The server will close the
771    /// channel after this 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_resources::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_resources::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_resources::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_resources::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_resources::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_resources::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_resources::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_resources::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_resources::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_resources::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_resources::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_resources::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_resources::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_resources::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_resources::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_resources::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_resources::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_resources::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_resources::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_resources::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_resources::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_resources::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_resources::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_resources::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 or an interface-local
4839    /// table, an error will be returned if called. The server will close the
4840    /// channel after this 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 or an interface-local
4978    /// table, an error will be returned if called. The server will close the
4979    /// channel after this 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 or an interface-local
5342    /// table, an error will be returned if called. The server will close the
5343    /// channel after this 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 { Some((responder)) } else { None }
5387    }
5388
5389    #[allow(irrefutable_let_patterns)]
5390    pub fn into_get_authorization_for_route_table(
5391        self,
5392    ) -> Option<(RouteTableV4GetAuthorizationForRouteTableResponder)> {
5393        if let RouteTableV4Request::GetAuthorizationForRouteTable { responder } = self {
5394            Some((responder))
5395        } else {
5396            None
5397        }
5398    }
5399
5400    #[allow(irrefutable_let_patterns)]
5401    pub fn into_new_route_set(
5402        self,
5403    ) -> Option<(fidl::endpoints::ServerEnd<RouteSetV4Marker>, RouteTableV4ControlHandle)> {
5404        if let RouteTableV4Request::NewRouteSet { route_set, control_handle } = self {
5405            Some((route_set, control_handle))
5406        } else {
5407            None
5408        }
5409    }
5410
5411    /// Name of the method defined in FIDL
5412    pub fn method_name(&self) -> &'static str {
5413        match *self {
5414            RouteTableV4Request::GetTableId { .. } => "get_table_id",
5415            RouteTableV4Request::Detach { .. } => "detach",
5416            RouteTableV4Request::Remove { .. } => "remove",
5417            RouteTableV4Request::GetAuthorizationForRouteTable { .. } => {
5418                "get_authorization_for_route_table"
5419            }
5420            RouteTableV4Request::NewRouteSet { .. } => "new_route_set",
5421        }
5422    }
5423}
5424
5425#[derive(Debug, Clone)]
5426pub struct RouteTableV4ControlHandle {
5427    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5428}
5429
5430impl fidl::endpoints::ControlHandle for RouteTableV4ControlHandle {
5431    fn shutdown(&self) {
5432        self.inner.shutdown()
5433    }
5434    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5435        self.inner.shutdown_with_epitaph(status)
5436    }
5437
5438    fn is_closed(&self) -> bool {
5439        self.inner.channel().is_closed()
5440    }
5441    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5442        self.inner.channel().on_closed()
5443    }
5444
5445    #[cfg(target_os = "fuchsia")]
5446    fn signal_peer(
5447        &self,
5448        clear_mask: zx::Signals,
5449        set_mask: zx::Signals,
5450    ) -> Result<(), zx_status::Status> {
5451        use fidl::Peered;
5452        self.inner.channel().signal_peer(clear_mask, set_mask)
5453    }
5454}
5455
5456impl RouteTableV4ControlHandle {}
5457
5458#[must_use = "FIDL methods require a response to be sent"]
5459#[derive(Debug)]
5460pub struct RouteTableV4GetTableIdResponder {
5461    control_handle: std::mem::ManuallyDrop<RouteTableV4ControlHandle>,
5462    tx_id: u32,
5463}
5464
5465/// Set the the channel to be shutdown (see [`RouteTableV4ControlHandle::shutdown`])
5466/// if the responder is dropped without sending a response, so that the client
5467/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5468impl std::ops::Drop for RouteTableV4GetTableIdResponder {
5469    fn drop(&mut self) {
5470        self.control_handle.shutdown();
5471        // Safety: drops once, never accessed again
5472        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5473    }
5474}
5475
5476impl fidl::endpoints::Responder for RouteTableV4GetTableIdResponder {
5477    type ControlHandle = RouteTableV4ControlHandle;
5478
5479    fn control_handle(&self) -> &RouteTableV4ControlHandle {
5480        &self.control_handle
5481    }
5482
5483    fn drop_without_shutdown(mut self) {
5484        // Safety: drops once, never accessed again due to mem::forget
5485        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5486        // Prevent Drop from running (which would shut down the channel)
5487        std::mem::forget(self);
5488    }
5489}
5490
5491impl RouteTableV4GetTableIdResponder {
5492    /// Sends a response to the FIDL transaction.
5493    ///
5494    /// Sets the channel to shutdown if an error occurs.
5495    pub fn send(self, mut table_id: u32) -> Result<(), fidl::Error> {
5496        let _result = self.send_raw(table_id);
5497        if _result.is_err() {
5498            self.control_handle.shutdown();
5499        }
5500        self.drop_without_shutdown();
5501        _result
5502    }
5503
5504    /// Similar to "send" but does not shutdown the channel if an error occurs.
5505    pub fn send_no_shutdown_on_err(self, mut table_id: u32) -> Result<(), fidl::Error> {
5506        let _result = self.send_raw(table_id);
5507        self.drop_without_shutdown();
5508        _result
5509    }
5510
5511    fn send_raw(&self, mut table_id: u32) -> Result<(), fidl::Error> {
5512        self.control_handle.inner.send::<BaseRouteTableGetTableIdResponse>(
5513            (table_id,),
5514            self.tx_id,
5515            0x7eab30c55edbfc15,
5516            fidl::encoding::DynamicFlags::empty(),
5517        )
5518    }
5519}
5520
5521#[must_use = "FIDL methods require a response to be sent"]
5522#[derive(Debug)]
5523pub struct RouteTableV4RemoveResponder {
5524    control_handle: std::mem::ManuallyDrop<RouteTableV4ControlHandle>,
5525    tx_id: u32,
5526}
5527
5528/// Set the the channel to be shutdown (see [`RouteTableV4ControlHandle::shutdown`])
5529/// if the responder is dropped without sending a response, so that the client
5530/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5531impl std::ops::Drop for RouteTableV4RemoveResponder {
5532    fn drop(&mut self) {
5533        self.control_handle.shutdown();
5534        // Safety: drops once, never accessed again
5535        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5536    }
5537}
5538
5539impl fidl::endpoints::Responder for RouteTableV4RemoveResponder {
5540    type ControlHandle = RouteTableV4ControlHandle;
5541
5542    fn control_handle(&self) -> &RouteTableV4ControlHandle {
5543        &self.control_handle
5544    }
5545
5546    fn drop_without_shutdown(mut self) {
5547        // Safety: drops once, never accessed again due to mem::forget
5548        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5549        // Prevent Drop from running (which would shut down the channel)
5550        std::mem::forget(self);
5551    }
5552}
5553
5554impl RouteTableV4RemoveResponder {
5555    /// Sends a response to the FIDL transaction.
5556    ///
5557    /// Sets the channel to shutdown if an error occurs.
5558    pub fn send(
5559        self,
5560        mut result: Result<(), BaseRouteTableRemoveError>,
5561    ) -> Result<(), fidl::Error> {
5562        let _result = self.send_raw(result);
5563        if _result.is_err() {
5564            self.control_handle.shutdown();
5565        }
5566        self.drop_without_shutdown();
5567        _result
5568    }
5569
5570    /// Similar to "send" but does not shutdown the channel if an error occurs.
5571    pub fn send_no_shutdown_on_err(
5572        self,
5573        mut result: Result<(), BaseRouteTableRemoveError>,
5574    ) -> Result<(), fidl::Error> {
5575        let _result = self.send_raw(result);
5576        self.drop_without_shutdown();
5577        _result
5578    }
5579
5580    fn send_raw(
5581        &self,
5582        mut result: Result<(), BaseRouteTableRemoveError>,
5583    ) -> Result<(), fidl::Error> {
5584        self.control_handle.inner.send::<fidl::encoding::ResultType<
5585            fidl::encoding::EmptyStruct,
5586            BaseRouteTableRemoveError,
5587        >>(
5588            result,
5589            self.tx_id,
5590            0xc42e58a5fc79426,
5591            fidl::encoding::DynamicFlags::empty(),
5592        )
5593    }
5594}
5595
5596#[must_use = "FIDL methods require a response to be sent"]
5597#[derive(Debug)]
5598pub struct RouteTableV4GetAuthorizationForRouteTableResponder {
5599    control_handle: std::mem::ManuallyDrop<RouteTableV4ControlHandle>,
5600    tx_id: u32,
5601}
5602
5603/// Set the the channel to be shutdown (see [`RouteTableV4ControlHandle::shutdown`])
5604/// if the responder is dropped without sending a response, so that the client
5605/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5606impl std::ops::Drop for RouteTableV4GetAuthorizationForRouteTableResponder {
5607    fn drop(&mut self) {
5608        self.control_handle.shutdown();
5609        // Safety: drops once, never accessed again
5610        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5611    }
5612}
5613
5614impl fidl::endpoints::Responder for RouteTableV4GetAuthorizationForRouteTableResponder {
5615    type ControlHandle = RouteTableV4ControlHandle;
5616
5617    fn control_handle(&self) -> &RouteTableV4ControlHandle {
5618        &self.control_handle
5619    }
5620
5621    fn drop_without_shutdown(mut self) {
5622        // Safety: drops once, never accessed again due to mem::forget
5623        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5624        // Prevent Drop from running (which would shut down the channel)
5625        std::mem::forget(self);
5626    }
5627}
5628
5629impl RouteTableV4GetAuthorizationForRouteTableResponder {
5630    /// Sends a response to the FIDL transaction.
5631    ///
5632    /// Sets the channel to shutdown if an error occurs.
5633    pub fn send(self, mut credential: GrantForRouteTableAuthorization) -> Result<(), fidl::Error> {
5634        let _result = self.send_raw(credential);
5635        if _result.is_err() {
5636            self.control_handle.shutdown();
5637        }
5638        self.drop_without_shutdown();
5639        _result
5640    }
5641
5642    /// Similar to "send" but does not shutdown the channel if an error occurs.
5643    pub fn send_no_shutdown_on_err(
5644        self,
5645        mut credential: GrantForRouteTableAuthorization,
5646    ) -> Result<(), fidl::Error> {
5647        let _result = self.send_raw(credential);
5648        self.drop_without_shutdown();
5649        _result
5650    }
5651
5652    fn send_raw(&self, mut credential: GrantForRouteTableAuthorization) -> Result<(), fidl::Error> {
5653        self.control_handle.inner.send::<BaseRouteTableGetAuthorizationForRouteTableResponse>(
5654            (&mut credential,),
5655            self.tx_id,
5656            0x56a48c921ff3b6eb,
5657            fidl::encoding::DynamicFlags::empty(),
5658        )
5659    }
5660}
5661
5662#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5663pub struct RouteTableV6Marker;
5664
5665impl fidl::endpoints::ProtocolMarker for RouteTableV6Marker {
5666    type Proxy = RouteTableV6Proxy;
5667    type RequestStream = RouteTableV6RequestStream;
5668    #[cfg(target_os = "fuchsia")]
5669    type SynchronousProxy = RouteTableV6SynchronousProxy;
5670
5671    const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RouteTableV6";
5672}
5673impl fidl::endpoints::DiscoverableProtocolMarker for RouteTableV6Marker {}
5674
5675pub trait RouteTableV6ProxyInterface: Send + Sync {
5676    type GetTableIdResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
5677    fn r#get_table_id(&self) -> Self::GetTableIdResponseFut;
5678    fn r#detach(&self) -> Result<(), fidl::Error>;
5679    type RemoveResponseFut: std::future::Future<Output = Result<BaseRouteTableRemoveResult, fidl::Error>>
5680        + Send;
5681    fn r#remove(&self) -> Self::RemoveResponseFut;
5682    type GetAuthorizationForRouteTableResponseFut: std::future::Future<Output = Result<GrantForRouteTableAuthorization, fidl::Error>>
5683        + Send;
5684    fn r#get_authorization_for_route_table(&self)
5685    -> Self::GetAuthorizationForRouteTableResponseFut;
5686    fn r#new_route_set(
5687        &self,
5688        route_set: fidl::endpoints::ServerEnd<RouteSetV6Marker>,
5689    ) -> Result<(), fidl::Error>;
5690}
5691#[derive(Debug)]
5692#[cfg(target_os = "fuchsia")]
5693pub struct RouteTableV6SynchronousProxy {
5694    client: fidl::client::sync::Client,
5695}
5696
5697#[cfg(target_os = "fuchsia")]
5698impl fidl::endpoints::SynchronousProxy for RouteTableV6SynchronousProxy {
5699    type Proxy = RouteTableV6Proxy;
5700    type Protocol = RouteTableV6Marker;
5701
5702    fn from_channel(inner: fidl::Channel) -> Self {
5703        Self::new(inner)
5704    }
5705
5706    fn into_channel(self) -> fidl::Channel {
5707        self.client.into_channel()
5708    }
5709
5710    fn as_channel(&self) -> &fidl::Channel {
5711        self.client.as_channel()
5712    }
5713}
5714
5715#[cfg(target_os = "fuchsia")]
5716impl RouteTableV6SynchronousProxy {
5717    pub fn new(channel: fidl::Channel) -> Self {
5718        let protocol_name = <RouteTableV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5719        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5720    }
5721
5722    pub fn into_channel(self) -> fidl::Channel {
5723        self.client.into_channel()
5724    }
5725
5726    /// Waits until an event arrives and returns it. It is safe for other
5727    /// threads to make concurrent requests while waiting for an event.
5728    pub fn wait_for_event(
5729        &self,
5730        deadline: zx::MonotonicInstant,
5731    ) -> Result<RouteTableV6Event, fidl::Error> {
5732        RouteTableV6Event::decode(self.client.wait_for_event(deadline)?)
5733    }
5734
5735    /// Gets the table ID for this table.
5736    pub fn r#get_table_id(&self, ___deadline: zx::MonotonicInstant) -> Result<u32, fidl::Error> {
5737        let _response = self
5738            .client
5739            .send_query::<fidl::encoding::EmptyPayload, BaseRouteTableGetTableIdResponse>(
5740                (),
5741                0x7eab30c55edbfc15,
5742                fidl::encoding::DynamicFlags::empty(),
5743                ___deadline,
5744            )?;
5745        Ok(_response.table_id)
5746    }
5747
5748    /// Detaches the lifetime of the route table from the lifetime of the
5749    /// client end of the channel.
5750    ///
5751    /// After this method is called, the route table will not be removed
5752    /// if the client end is closed. It's a no-op if called on the main table.
5753    pub fn r#detach(&self) -> Result<(), fidl::Error> {
5754        self.client.send::<fidl::encoding::EmptyPayload>(
5755            (),
5756            0x2853ab157285b384,
5757            fidl::encoding::DynamicFlags::empty(),
5758        )
5759    }
5760
5761    /// Removes the route table explicitly.
5762    ///
5763    /// This method cannot be called on the main table or an interface-local
5764    /// table, an error will be returned if called. The server will close the
5765    /// channel after this method successfully returns.
5766    pub fn r#remove(
5767        &self,
5768        ___deadline: zx::MonotonicInstant,
5769    ) -> Result<BaseRouteTableRemoveResult, fidl::Error> {
5770        let _response =
5771            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
5772                fidl::encoding::EmptyStruct,
5773                BaseRouteTableRemoveError,
5774            >>(
5775                (),
5776                0xc42e58a5fc79426,
5777                fidl::encoding::DynamicFlags::empty(),
5778                ___deadline,
5779            )?;
5780        Ok(_response.map(|x| x))
5781    }
5782
5783    /// Gets an authentication credential for this table.
5784    ///
5785    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
5786    /// held by the server. This credential can be passed into
5787    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
5788    /// table. The `EVENT` is stable throughout the lifetime of the route table.
5789    /// Clients may duplicate this `EVENT` to make multiple API calls, or
5790    /// transfer the `EVENT` to other clients.
5791    ///
5792    /// - response `credential` the authorization credential for this table.
5793    pub fn r#get_authorization_for_route_table(
5794        &self,
5795        ___deadline: zx::MonotonicInstant,
5796    ) -> Result<GrantForRouteTableAuthorization, fidl::Error> {
5797        let _response = self.client.send_query::<
5798            fidl::encoding::EmptyPayload,
5799            BaseRouteTableGetAuthorizationForRouteTableResponse,
5800        >(
5801            (),
5802            0x56a48c921ff3b6eb,
5803            fidl::encoding::DynamicFlags::empty(),
5804            ___deadline,
5805        )?;
5806        Ok(_response.credential)
5807    }
5808
5809    /// Creates an empty route set.
5810    ///
5811    /// + request `route_set` grants access to the [`RouteSetV6`] protocol.
5812    pub fn r#new_route_set(
5813        &self,
5814        mut route_set: fidl::endpoints::ServerEnd<RouteSetV6Marker>,
5815    ) -> Result<(), fidl::Error> {
5816        self.client.send::<RouteTableV6NewRouteSetRequest>(
5817            (route_set,),
5818            0x479aeaf9ad470141,
5819            fidl::encoding::DynamicFlags::empty(),
5820        )
5821    }
5822}
5823
5824#[cfg(target_os = "fuchsia")]
5825impl From<RouteTableV6SynchronousProxy> for zx::Handle {
5826    fn from(value: RouteTableV6SynchronousProxy) -> Self {
5827        value.into_channel().into()
5828    }
5829}
5830
5831#[cfg(target_os = "fuchsia")]
5832impl From<fidl::Channel> for RouteTableV6SynchronousProxy {
5833    fn from(value: fidl::Channel) -> Self {
5834        Self::new(value)
5835    }
5836}
5837
5838#[cfg(target_os = "fuchsia")]
5839impl fidl::endpoints::FromClient for RouteTableV6SynchronousProxy {
5840    type Protocol = RouteTableV6Marker;
5841
5842    fn from_client(value: fidl::endpoints::ClientEnd<RouteTableV6Marker>) -> Self {
5843        Self::new(value.into_channel())
5844    }
5845}
5846
5847#[derive(Debug, Clone)]
5848pub struct RouteTableV6Proxy {
5849    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5850}
5851
5852impl fidl::endpoints::Proxy for RouteTableV6Proxy {
5853    type Protocol = RouteTableV6Marker;
5854
5855    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5856        Self::new(inner)
5857    }
5858
5859    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5860        self.client.into_channel().map_err(|client| Self { client })
5861    }
5862
5863    fn as_channel(&self) -> &::fidl::AsyncChannel {
5864        self.client.as_channel()
5865    }
5866}
5867
5868impl RouteTableV6Proxy {
5869    /// Create a new Proxy for fuchsia.net.routes.admin/RouteTableV6.
5870    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5871        let protocol_name = <RouteTableV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5872        Self { client: fidl::client::Client::new(channel, protocol_name) }
5873    }
5874
5875    /// Get a Stream of events from the remote end of the protocol.
5876    ///
5877    /// # Panics
5878    ///
5879    /// Panics if the event stream was already taken.
5880    pub fn take_event_stream(&self) -> RouteTableV6EventStream {
5881        RouteTableV6EventStream { event_receiver: self.client.take_event_receiver() }
5882    }
5883
5884    /// Gets the table ID for this table.
5885    pub fn r#get_table_id(
5886        &self,
5887    ) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
5888        RouteTableV6ProxyInterface::r#get_table_id(self)
5889    }
5890
5891    /// Detaches the lifetime of the route table from the lifetime of the
5892    /// client end of the channel.
5893    ///
5894    /// After this method is called, the route table will not be removed
5895    /// if the client end is closed. It's a no-op if called on the main table.
5896    pub fn r#detach(&self) -> Result<(), fidl::Error> {
5897        RouteTableV6ProxyInterface::r#detach(self)
5898    }
5899
5900    /// Removes the route table explicitly.
5901    ///
5902    /// This method cannot be called on the main table or an interface-local
5903    /// table, an error will be returned if called. The server will close the
5904    /// channel after this method successfully returns.
5905    pub fn r#remove(
5906        &self,
5907    ) -> fidl::client::QueryResponseFut<
5908        BaseRouteTableRemoveResult,
5909        fidl::encoding::DefaultFuchsiaResourceDialect,
5910    > {
5911        RouteTableV6ProxyInterface::r#remove(self)
5912    }
5913
5914    /// Gets an authentication credential for this table.
5915    ///
5916    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
5917    /// held by the server. This credential can be passed into
5918    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
5919    /// table. The `EVENT` is stable throughout the lifetime of the route table.
5920    /// Clients may duplicate this `EVENT` to make multiple API calls, or
5921    /// transfer the `EVENT` to other clients.
5922    ///
5923    /// - response `credential` the authorization credential for this table.
5924    pub fn r#get_authorization_for_route_table(
5925        &self,
5926    ) -> fidl::client::QueryResponseFut<
5927        GrantForRouteTableAuthorization,
5928        fidl::encoding::DefaultFuchsiaResourceDialect,
5929    > {
5930        RouteTableV6ProxyInterface::r#get_authorization_for_route_table(self)
5931    }
5932
5933    /// Creates an empty route set.
5934    ///
5935    /// + request `route_set` grants access to the [`RouteSetV6`] protocol.
5936    pub fn r#new_route_set(
5937        &self,
5938        mut route_set: fidl::endpoints::ServerEnd<RouteSetV6Marker>,
5939    ) -> Result<(), fidl::Error> {
5940        RouteTableV6ProxyInterface::r#new_route_set(self, route_set)
5941    }
5942}
5943
5944impl RouteTableV6ProxyInterface for RouteTableV6Proxy {
5945    type GetTableIdResponseFut =
5946        fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
5947    fn r#get_table_id(&self) -> Self::GetTableIdResponseFut {
5948        fn _decode(
5949            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5950        ) -> Result<u32, fidl::Error> {
5951            let _response = fidl::client::decode_transaction_body::<
5952                BaseRouteTableGetTableIdResponse,
5953                fidl::encoding::DefaultFuchsiaResourceDialect,
5954                0x7eab30c55edbfc15,
5955            >(_buf?)?;
5956            Ok(_response.table_id)
5957        }
5958        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
5959            (),
5960            0x7eab30c55edbfc15,
5961            fidl::encoding::DynamicFlags::empty(),
5962            _decode,
5963        )
5964    }
5965
5966    fn r#detach(&self) -> Result<(), fidl::Error> {
5967        self.client.send::<fidl::encoding::EmptyPayload>(
5968            (),
5969            0x2853ab157285b384,
5970            fidl::encoding::DynamicFlags::empty(),
5971        )
5972    }
5973
5974    type RemoveResponseFut = fidl::client::QueryResponseFut<
5975        BaseRouteTableRemoveResult,
5976        fidl::encoding::DefaultFuchsiaResourceDialect,
5977    >;
5978    fn r#remove(&self) -> Self::RemoveResponseFut {
5979        fn _decode(
5980            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5981        ) -> Result<BaseRouteTableRemoveResult, fidl::Error> {
5982            let _response = fidl::client::decode_transaction_body::<
5983                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BaseRouteTableRemoveError>,
5984                fidl::encoding::DefaultFuchsiaResourceDialect,
5985                0xc42e58a5fc79426,
5986            >(_buf?)?;
5987            Ok(_response.map(|x| x))
5988        }
5989        self.client
5990            .send_query_and_decode::<fidl::encoding::EmptyPayload, BaseRouteTableRemoveResult>(
5991                (),
5992                0xc42e58a5fc79426,
5993                fidl::encoding::DynamicFlags::empty(),
5994                _decode,
5995            )
5996    }
5997
5998    type GetAuthorizationForRouteTableResponseFut = fidl::client::QueryResponseFut<
5999        GrantForRouteTableAuthorization,
6000        fidl::encoding::DefaultFuchsiaResourceDialect,
6001    >;
6002    fn r#get_authorization_for_route_table(
6003        &self,
6004    ) -> Self::GetAuthorizationForRouteTableResponseFut {
6005        fn _decode(
6006            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6007        ) -> Result<GrantForRouteTableAuthorization, fidl::Error> {
6008            let _response = fidl::client::decode_transaction_body::<
6009                BaseRouteTableGetAuthorizationForRouteTableResponse,
6010                fidl::encoding::DefaultFuchsiaResourceDialect,
6011                0x56a48c921ff3b6eb,
6012            >(_buf?)?;
6013            Ok(_response.credential)
6014        }
6015        self.client
6016            .send_query_and_decode::<fidl::encoding::EmptyPayload, GrantForRouteTableAuthorization>(
6017                (),
6018                0x56a48c921ff3b6eb,
6019                fidl::encoding::DynamicFlags::empty(),
6020                _decode,
6021            )
6022    }
6023
6024    fn r#new_route_set(
6025        &self,
6026        mut route_set: fidl::endpoints::ServerEnd<RouteSetV6Marker>,
6027    ) -> Result<(), fidl::Error> {
6028        self.client.send::<RouteTableV6NewRouteSetRequest>(
6029            (route_set,),
6030            0x479aeaf9ad470141,
6031            fidl::encoding::DynamicFlags::empty(),
6032        )
6033    }
6034}
6035
6036pub struct RouteTableV6EventStream {
6037    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6038}
6039
6040impl std::marker::Unpin for RouteTableV6EventStream {}
6041
6042impl futures::stream::FusedStream for RouteTableV6EventStream {
6043    fn is_terminated(&self) -> bool {
6044        self.event_receiver.is_terminated()
6045    }
6046}
6047
6048impl futures::Stream for RouteTableV6EventStream {
6049    type Item = Result<RouteTableV6Event, fidl::Error>;
6050
6051    fn poll_next(
6052        mut self: std::pin::Pin<&mut Self>,
6053        cx: &mut std::task::Context<'_>,
6054    ) -> std::task::Poll<Option<Self::Item>> {
6055        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6056            &mut self.event_receiver,
6057            cx
6058        )?) {
6059            Some(buf) => std::task::Poll::Ready(Some(RouteTableV6Event::decode(buf))),
6060            None => std::task::Poll::Ready(None),
6061        }
6062    }
6063}
6064
6065#[derive(Debug)]
6066pub enum RouteTableV6Event {}
6067
6068impl RouteTableV6Event {
6069    /// Decodes a message buffer as a [`RouteTableV6Event`].
6070    fn decode(
6071        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6072    ) -> Result<RouteTableV6Event, fidl::Error> {
6073        let (bytes, _handles) = buf.split_mut();
6074        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6075        debug_assert_eq!(tx_header.tx_id, 0);
6076        match tx_header.ordinal {
6077            _ => Err(fidl::Error::UnknownOrdinal {
6078                ordinal: tx_header.ordinal,
6079                protocol_name: <RouteTableV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6080            }),
6081        }
6082    }
6083}
6084
6085/// A Stream of incoming requests for fuchsia.net.routes.admin/RouteTableV6.
6086pub struct RouteTableV6RequestStream {
6087    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6088    is_terminated: bool,
6089}
6090
6091impl std::marker::Unpin for RouteTableV6RequestStream {}
6092
6093impl futures::stream::FusedStream for RouteTableV6RequestStream {
6094    fn is_terminated(&self) -> bool {
6095        self.is_terminated
6096    }
6097}
6098
6099impl fidl::endpoints::RequestStream for RouteTableV6RequestStream {
6100    type Protocol = RouteTableV6Marker;
6101    type ControlHandle = RouteTableV6ControlHandle;
6102
6103    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6104        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6105    }
6106
6107    fn control_handle(&self) -> Self::ControlHandle {
6108        RouteTableV6ControlHandle { inner: self.inner.clone() }
6109    }
6110
6111    fn into_inner(
6112        self,
6113    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6114    {
6115        (self.inner, self.is_terminated)
6116    }
6117
6118    fn from_inner(
6119        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6120        is_terminated: bool,
6121    ) -> Self {
6122        Self { inner, is_terminated }
6123    }
6124}
6125
6126impl futures::Stream for RouteTableV6RequestStream {
6127    type Item = Result<RouteTableV6Request, fidl::Error>;
6128
6129    fn poll_next(
6130        mut self: std::pin::Pin<&mut Self>,
6131        cx: &mut std::task::Context<'_>,
6132    ) -> std::task::Poll<Option<Self::Item>> {
6133        let this = &mut *self;
6134        if this.inner.check_shutdown(cx) {
6135            this.is_terminated = true;
6136            return std::task::Poll::Ready(None);
6137        }
6138        if this.is_terminated {
6139            panic!("polled RouteTableV6RequestStream after completion");
6140        }
6141        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6142            |bytes, handles| {
6143                match this.inner.channel().read_etc(cx, bytes, handles) {
6144                    std::task::Poll::Ready(Ok(())) => {}
6145                    std::task::Poll::Pending => return std::task::Poll::Pending,
6146                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6147                        this.is_terminated = true;
6148                        return std::task::Poll::Ready(None);
6149                    }
6150                    std::task::Poll::Ready(Err(e)) => {
6151                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6152                            e.into(),
6153                        ))));
6154                    }
6155                }
6156
6157                // A message has been received from the channel
6158                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6159
6160                std::task::Poll::Ready(Some(match header.ordinal {
6161                    0x7eab30c55edbfc15 => {
6162                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6163                        let mut req = fidl::new_empty!(
6164                            fidl::encoding::EmptyPayload,
6165                            fidl::encoding::DefaultFuchsiaResourceDialect
6166                        );
6167                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6168                        let control_handle =
6169                            RouteTableV6ControlHandle { inner: this.inner.clone() };
6170                        Ok(RouteTableV6Request::GetTableId {
6171                            responder: RouteTableV6GetTableIdResponder {
6172                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6173                                tx_id: header.tx_id,
6174                            },
6175                        })
6176                    }
6177                    0x2853ab157285b384 => {
6178                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6179                        let mut req = fidl::new_empty!(
6180                            fidl::encoding::EmptyPayload,
6181                            fidl::encoding::DefaultFuchsiaResourceDialect
6182                        );
6183                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6184                        let control_handle =
6185                            RouteTableV6ControlHandle { inner: this.inner.clone() };
6186                        Ok(RouteTableV6Request::Detach { control_handle })
6187                    }
6188                    0xc42e58a5fc79426 => {
6189                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6190                        let mut req = fidl::new_empty!(
6191                            fidl::encoding::EmptyPayload,
6192                            fidl::encoding::DefaultFuchsiaResourceDialect
6193                        );
6194                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6195                        let control_handle =
6196                            RouteTableV6ControlHandle { inner: this.inner.clone() };
6197                        Ok(RouteTableV6Request::Remove {
6198                            responder: RouteTableV6RemoveResponder {
6199                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6200                                tx_id: header.tx_id,
6201                            },
6202                        })
6203                    }
6204                    0x56a48c921ff3b6eb => {
6205                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6206                        let mut req = fidl::new_empty!(
6207                            fidl::encoding::EmptyPayload,
6208                            fidl::encoding::DefaultFuchsiaResourceDialect
6209                        );
6210                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6211                        let control_handle =
6212                            RouteTableV6ControlHandle { inner: this.inner.clone() };
6213                        Ok(RouteTableV6Request::GetAuthorizationForRouteTable {
6214                            responder: RouteTableV6GetAuthorizationForRouteTableResponder {
6215                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6216                                tx_id: header.tx_id,
6217                            },
6218                        })
6219                    }
6220                    0x479aeaf9ad470141 => {
6221                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6222                        let mut req = fidl::new_empty!(
6223                            RouteTableV6NewRouteSetRequest,
6224                            fidl::encoding::DefaultFuchsiaResourceDialect
6225                        );
6226                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RouteTableV6NewRouteSetRequest>(&header, _body_bytes, handles, &mut req)?;
6227                        let control_handle =
6228                            RouteTableV6ControlHandle { inner: this.inner.clone() };
6229                        Ok(RouteTableV6Request::NewRouteSet {
6230                            route_set: req.route_set,
6231
6232                            control_handle,
6233                        })
6234                    }
6235                    _ => Err(fidl::Error::UnknownOrdinal {
6236                        ordinal: header.ordinal,
6237                        protocol_name:
6238                            <RouteTableV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6239                    }),
6240                }))
6241            },
6242        )
6243    }
6244}
6245
6246/// Vends isolated administrative access to the system's IPv6 routing table.
6247///
6248/// A main route table is accessible through the discoverable [`RouteTableV6`]
6249/// protocol. Other tables can be installed using the `NewRouteTable` method
6250/// on [`RouteTableProviderV6`]. The [`RouteTableV6`] also encodes the lifetime
6251/// of the underlying route table, dropping the client end of the protocol
6252/// causes the underlying route table to be removed unless it is detached. The
6253/// main table is detached by default.
6254#[derive(Debug)]
6255pub enum RouteTableV6Request {
6256    /// Gets the table ID for this table.
6257    GetTableId { responder: RouteTableV6GetTableIdResponder },
6258    /// Detaches the lifetime of the route table from the lifetime of the
6259    /// client end of the channel.
6260    ///
6261    /// After this method is called, the route table will not be removed
6262    /// if the client end is closed. It's a no-op if called on the main table.
6263    Detach { control_handle: RouteTableV6ControlHandle },
6264    /// Removes the route table explicitly.
6265    ///
6266    /// This method cannot be called on the main table or an interface-local
6267    /// table, an error will be returned if called. The server will close the
6268    /// channel after this method successfully returns.
6269    Remove { responder: RouteTableV6RemoveResponder },
6270    /// Gets an authentication credential for this table.
6271    ///
6272    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
6273    /// held by the server. This credential can be passed into
6274    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
6275    /// table. The `EVENT` is stable throughout the lifetime of the route table.
6276    /// Clients may duplicate this `EVENT` to make multiple API calls, or
6277    /// transfer the `EVENT` to other clients.
6278    ///
6279    /// - response `credential` the authorization credential for this table.
6280    GetAuthorizationForRouteTable { responder: RouteTableV6GetAuthorizationForRouteTableResponder },
6281    /// Creates an empty route set.
6282    ///
6283    /// + request `route_set` grants access to the [`RouteSetV6`] protocol.
6284    NewRouteSet {
6285        route_set: fidl::endpoints::ServerEnd<RouteSetV6Marker>,
6286        control_handle: RouteTableV6ControlHandle,
6287    },
6288}
6289
6290impl RouteTableV6Request {
6291    #[allow(irrefutable_let_patterns)]
6292    pub fn into_get_table_id(self) -> Option<(RouteTableV6GetTableIdResponder)> {
6293        if let RouteTableV6Request::GetTableId { responder } = self {
6294            Some((responder))
6295        } else {
6296            None
6297        }
6298    }
6299
6300    #[allow(irrefutable_let_patterns)]
6301    pub fn into_detach(self) -> Option<(RouteTableV6ControlHandle)> {
6302        if let RouteTableV6Request::Detach { control_handle } = self {
6303            Some((control_handle))
6304        } else {
6305            None
6306        }
6307    }
6308
6309    #[allow(irrefutable_let_patterns)]
6310    pub fn into_remove(self) -> Option<(RouteTableV6RemoveResponder)> {
6311        if let RouteTableV6Request::Remove { responder } = self { Some((responder)) } else { None }
6312    }
6313
6314    #[allow(irrefutable_let_patterns)]
6315    pub fn into_get_authorization_for_route_table(
6316        self,
6317    ) -> Option<(RouteTableV6GetAuthorizationForRouteTableResponder)> {
6318        if let RouteTableV6Request::GetAuthorizationForRouteTable { responder } = self {
6319            Some((responder))
6320        } else {
6321            None
6322        }
6323    }
6324
6325    #[allow(irrefutable_let_patterns)]
6326    pub fn into_new_route_set(
6327        self,
6328    ) -> Option<(fidl::endpoints::ServerEnd<RouteSetV6Marker>, RouteTableV6ControlHandle)> {
6329        if let RouteTableV6Request::NewRouteSet { route_set, control_handle } = self {
6330            Some((route_set, control_handle))
6331        } else {
6332            None
6333        }
6334    }
6335
6336    /// Name of the method defined in FIDL
6337    pub fn method_name(&self) -> &'static str {
6338        match *self {
6339            RouteTableV6Request::GetTableId { .. } => "get_table_id",
6340            RouteTableV6Request::Detach { .. } => "detach",
6341            RouteTableV6Request::Remove { .. } => "remove",
6342            RouteTableV6Request::GetAuthorizationForRouteTable { .. } => {
6343                "get_authorization_for_route_table"
6344            }
6345            RouteTableV6Request::NewRouteSet { .. } => "new_route_set",
6346        }
6347    }
6348}
6349
6350#[derive(Debug, Clone)]
6351pub struct RouteTableV6ControlHandle {
6352    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6353}
6354
6355impl fidl::endpoints::ControlHandle for RouteTableV6ControlHandle {
6356    fn shutdown(&self) {
6357        self.inner.shutdown()
6358    }
6359    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6360        self.inner.shutdown_with_epitaph(status)
6361    }
6362
6363    fn is_closed(&self) -> bool {
6364        self.inner.channel().is_closed()
6365    }
6366    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6367        self.inner.channel().on_closed()
6368    }
6369
6370    #[cfg(target_os = "fuchsia")]
6371    fn signal_peer(
6372        &self,
6373        clear_mask: zx::Signals,
6374        set_mask: zx::Signals,
6375    ) -> Result<(), zx_status::Status> {
6376        use fidl::Peered;
6377        self.inner.channel().signal_peer(clear_mask, set_mask)
6378    }
6379}
6380
6381impl RouteTableV6ControlHandle {}
6382
6383#[must_use = "FIDL methods require a response to be sent"]
6384#[derive(Debug)]
6385pub struct RouteTableV6GetTableIdResponder {
6386    control_handle: std::mem::ManuallyDrop<RouteTableV6ControlHandle>,
6387    tx_id: u32,
6388}
6389
6390/// Set the the channel to be shutdown (see [`RouteTableV6ControlHandle::shutdown`])
6391/// if the responder is dropped without sending a response, so that the client
6392/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6393impl std::ops::Drop for RouteTableV6GetTableIdResponder {
6394    fn drop(&mut self) {
6395        self.control_handle.shutdown();
6396        // Safety: drops once, never accessed again
6397        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6398    }
6399}
6400
6401impl fidl::endpoints::Responder for RouteTableV6GetTableIdResponder {
6402    type ControlHandle = RouteTableV6ControlHandle;
6403
6404    fn control_handle(&self) -> &RouteTableV6ControlHandle {
6405        &self.control_handle
6406    }
6407
6408    fn drop_without_shutdown(mut self) {
6409        // Safety: drops once, never accessed again due to mem::forget
6410        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6411        // Prevent Drop from running (which would shut down the channel)
6412        std::mem::forget(self);
6413    }
6414}
6415
6416impl RouteTableV6GetTableIdResponder {
6417    /// Sends a response to the FIDL transaction.
6418    ///
6419    /// Sets the channel to shutdown if an error occurs.
6420    pub fn send(self, mut table_id: u32) -> Result<(), fidl::Error> {
6421        let _result = self.send_raw(table_id);
6422        if _result.is_err() {
6423            self.control_handle.shutdown();
6424        }
6425        self.drop_without_shutdown();
6426        _result
6427    }
6428
6429    /// Similar to "send" but does not shutdown the channel if an error occurs.
6430    pub fn send_no_shutdown_on_err(self, mut table_id: u32) -> Result<(), fidl::Error> {
6431        let _result = self.send_raw(table_id);
6432        self.drop_without_shutdown();
6433        _result
6434    }
6435
6436    fn send_raw(&self, mut table_id: u32) -> Result<(), fidl::Error> {
6437        self.control_handle.inner.send::<BaseRouteTableGetTableIdResponse>(
6438            (table_id,),
6439            self.tx_id,
6440            0x7eab30c55edbfc15,
6441            fidl::encoding::DynamicFlags::empty(),
6442        )
6443    }
6444}
6445
6446#[must_use = "FIDL methods require a response to be sent"]
6447#[derive(Debug)]
6448pub struct RouteTableV6RemoveResponder {
6449    control_handle: std::mem::ManuallyDrop<RouteTableV6ControlHandle>,
6450    tx_id: u32,
6451}
6452
6453/// Set the the channel to be shutdown (see [`RouteTableV6ControlHandle::shutdown`])
6454/// if the responder is dropped without sending a response, so that the client
6455/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6456impl std::ops::Drop for RouteTableV6RemoveResponder {
6457    fn drop(&mut self) {
6458        self.control_handle.shutdown();
6459        // Safety: drops once, never accessed again
6460        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6461    }
6462}
6463
6464impl fidl::endpoints::Responder for RouteTableV6RemoveResponder {
6465    type ControlHandle = RouteTableV6ControlHandle;
6466
6467    fn control_handle(&self) -> &RouteTableV6ControlHandle {
6468        &self.control_handle
6469    }
6470
6471    fn drop_without_shutdown(mut self) {
6472        // Safety: drops once, never accessed again due to mem::forget
6473        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6474        // Prevent Drop from running (which would shut down the channel)
6475        std::mem::forget(self);
6476    }
6477}
6478
6479impl RouteTableV6RemoveResponder {
6480    /// Sends a response to the FIDL transaction.
6481    ///
6482    /// Sets the channel to shutdown if an error occurs.
6483    pub fn send(
6484        self,
6485        mut result: Result<(), BaseRouteTableRemoveError>,
6486    ) -> Result<(), fidl::Error> {
6487        let _result = self.send_raw(result);
6488        if _result.is_err() {
6489            self.control_handle.shutdown();
6490        }
6491        self.drop_without_shutdown();
6492        _result
6493    }
6494
6495    /// Similar to "send" but does not shutdown the channel if an error occurs.
6496    pub fn send_no_shutdown_on_err(
6497        self,
6498        mut result: Result<(), BaseRouteTableRemoveError>,
6499    ) -> Result<(), fidl::Error> {
6500        let _result = self.send_raw(result);
6501        self.drop_without_shutdown();
6502        _result
6503    }
6504
6505    fn send_raw(
6506        &self,
6507        mut result: Result<(), BaseRouteTableRemoveError>,
6508    ) -> Result<(), fidl::Error> {
6509        self.control_handle.inner.send::<fidl::encoding::ResultType<
6510            fidl::encoding::EmptyStruct,
6511            BaseRouteTableRemoveError,
6512        >>(
6513            result,
6514            self.tx_id,
6515            0xc42e58a5fc79426,
6516            fidl::encoding::DynamicFlags::empty(),
6517        )
6518    }
6519}
6520
6521#[must_use = "FIDL methods require a response to be sent"]
6522#[derive(Debug)]
6523pub struct RouteTableV6GetAuthorizationForRouteTableResponder {
6524    control_handle: std::mem::ManuallyDrop<RouteTableV6ControlHandle>,
6525    tx_id: u32,
6526}
6527
6528/// Set the the channel to be shutdown (see [`RouteTableV6ControlHandle::shutdown`])
6529/// if the responder is dropped without sending a response, so that the client
6530/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6531impl std::ops::Drop for RouteTableV6GetAuthorizationForRouteTableResponder {
6532    fn drop(&mut self) {
6533        self.control_handle.shutdown();
6534        // Safety: drops once, never accessed again
6535        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6536    }
6537}
6538
6539impl fidl::endpoints::Responder for RouteTableV6GetAuthorizationForRouteTableResponder {
6540    type ControlHandle = RouteTableV6ControlHandle;
6541
6542    fn control_handle(&self) -> &RouteTableV6ControlHandle {
6543        &self.control_handle
6544    }
6545
6546    fn drop_without_shutdown(mut self) {
6547        // Safety: drops once, never accessed again due to mem::forget
6548        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6549        // Prevent Drop from running (which would shut down the channel)
6550        std::mem::forget(self);
6551    }
6552}
6553
6554impl RouteTableV6GetAuthorizationForRouteTableResponder {
6555    /// Sends a response to the FIDL transaction.
6556    ///
6557    /// Sets the channel to shutdown if an error occurs.
6558    pub fn send(self, mut credential: GrantForRouteTableAuthorization) -> Result<(), fidl::Error> {
6559        let _result = self.send_raw(credential);
6560        if _result.is_err() {
6561            self.control_handle.shutdown();
6562        }
6563        self.drop_without_shutdown();
6564        _result
6565    }
6566
6567    /// Similar to "send" but does not shutdown the channel if an error occurs.
6568    pub fn send_no_shutdown_on_err(
6569        self,
6570        mut credential: GrantForRouteTableAuthorization,
6571    ) -> Result<(), fidl::Error> {
6572        let _result = self.send_raw(credential);
6573        self.drop_without_shutdown();
6574        _result
6575    }
6576
6577    fn send_raw(&self, mut credential: GrantForRouteTableAuthorization) -> Result<(), fidl::Error> {
6578        self.control_handle.inner.send::<BaseRouteTableGetAuthorizationForRouteTableResponse>(
6579            (&mut credential,),
6580            self.tx_id,
6581            0x56a48c921ff3b6eb,
6582            fidl::encoding::DynamicFlags::empty(),
6583        )
6584    }
6585}
6586
6587#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6588pub struct RuleSetV4Marker;
6589
6590impl fidl::endpoints::ProtocolMarker for RuleSetV4Marker {
6591    type Proxy = RuleSetV4Proxy;
6592    type RequestStream = RuleSetV4RequestStream;
6593    #[cfg(target_os = "fuchsia")]
6594    type SynchronousProxy = RuleSetV4SynchronousProxy;
6595
6596    const DEBUG_NAME: &'static str = "(anonymous) RuleSetV4";
6597}
6598pub type RuleSetV4AddRuleResult = Result<(), RuleSetError>;
6599
6600pub trait RuleSetV4ProxyInterface: Send + Sync {
6601    type AuthenticateForRouteTableResponseFut: std::future::Future<
6602            Output = Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error>,
6603        > + Send;
6604    fn r#authenticate_for_route_table(
6605        &self,
6606        table: u32,
6607        token: fidl::Event,
6608    ) -> Self::AuthenticateForRouteTableResponseFut;
6609    type RemoveRuleResponseFut: std::future::Future<Output = Result<BaseRuleSetRemoveRuleResult, fidl::Error>>
6610        + Send;
6611    fn r#remove_rule(&self, index: u32) -> Self::RemoveRuleResponseFut;
6612    fn r#close(&self) -> Result<(), fidl::Error>;
6613    type AddRuleResponseFut: std::future::Future<Output = Result<RuleSetV4AddRuleResult, fidl::Error>>
6614        + Send;
6615    fn r#add_rule(
6616        &self,
6617        index: u32,
6618        matcher: &fidl_fuchsia_net_routes::RuleMatcherV4,
6619        action: &fidl_fuchsia_net_routes::RuleAction,
6620    ) -> Self::AddRuleResponseFut;
6621}
6622#[derive(Debug)]
6623#[cfg(target_os = "fuchsia")]
6624pub struct RuleSetV4SynchronousProxy {
6625    client: fidl::client::sync::Client,
6626}
6627
6628#[cfg(target_os = "fuchsia")]
6629impl fidl::endpoints::SynchronousProxy for RuleSetV4SynchronousProxy {
6630    type Proxy = RuleSetV4Proxy;
6631    type Protocol = RuleSetV4Marker;
6632
6633    fn from_channel(inner: fidl::Channel) -> Self {
6634        Self::new(inner)
6635    }
6636
6637    fn into_channel(self) -> fidl::Channel {
6638        self.client.into_channel()
6639    }
6640
6641    fn as_channel(&self) -> &fidl::Channel {
6642        self.client.as_channel()
6643    }
6644}
6645
6646#[cfg(target_os = "fuchsia")]
6647impl RuleSetV4SynchronousProxy {
6648    pub fn new(channel: fidl::Channel) -> Self {
6649        let protocol_name = <RuleSetV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6650        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6651    }
6652
6653    pub fn into_channel(self) -> fidl::Channel {
6654        self.client.into_channel()
6655    }
6656
6657    /// Waits until an event arrives and returns it. It is safe for other
6658    /// threads to make concurrent requests while waiting for an event.
6659    pub fn wait_for_event(
6660        &self,
6661        deadline: zx::MonotonicInstant,
6662    ) -> Result<RuleSetV4Event, fidl::Error> {
6663        RuleSetV4Event::decode(self.client.wait_for_event(deadline)?)
6664    }
6665
6666    /// Authenticates for a route table that will be used in an action.
6667    pub fn r#authenticate_for_route_table(
6668        &self,
6669        mut table: u32,
6670        mut token: fidl::Event,
6671        ___deadline: zx::MonotonicInstant,
6672    ) -> Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error> {
6673        let _response =
6674            self.client.send_query::<ProofOfRouteTableAuthorization, fidl::encoding::ResultType<
6675                fidl::encoding::EmptyStruct,
6676                AuthenticateForRouteTableError,
6677            >>(
6678                (table, token),
6679                0x6fd845360ed9bc8f,
6680                fidl::encoding::DynamicFlags::empty(),
6681                ___deadline,
6682            )?;
6683        Ok(_response.map(|x| x))
6684    }
6685
6686    /// Removes a rule from this rule set.
6687    ///
6688    /// If the client tries to remove from an index that does not have a rule,
6689    /// the error `RULE_DOES_NOT_EXIST` will be returned.
6690    ///
6691    /// + request `index` the index of the rule.
6692    pub fn r#remove_rule(
6693        &self,
6694        mut index: u32,
6695        ___deadline: zx::MonotonicInstant,
6696    ) -> Result<BaseRuleSetRemoveRuleResult, fidl::Error> {
6697        let _response = self.client.send_query::<
6698            BaseRuleSetRemoveRuleRequest,
6699            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
6700        >(
6701            (index,),
6702            0x2ae3d7e817cbff90,
6703            fidl::encoding::DynamicFlags::empty(),
6704            ___deadline,
6705        )?;
6706        Ok(_response.map(|x| x))
6707    }
6708
6709    /// Removes all rules in the rule set and the underlying channel will be
6710    /// closed after the rules are removed.
6711    ///
6712    /// This method provides a way for synchronous closure.
6713    pub fn r#close(&self) -> Result<(), fidl::Error> {
6714        self.client.send::<fidl::encoding::EmptyPayload>(
6715            (),
6716            0x457e1753672d4073,
6717            fidl::encoding::DynamicFlags::empty(),
6718        )
6719    }
6720
6721    /// Adds a rule to this rule set.
6722    ///
6723    /// If there is already a rule at the provided `index`, `RULE_ALREADY_EXISTS`
6724    /// is returned.
6725    ///
6726    /// + request `index` where to insert the rule.
6727    /// + request `matcher` the matcher of the rule.
6728    /// + request `action` action of the rule.
6729    pub fn r#add_rule(
6730        &self,
6731        mut index: u32,
6732        mut matcher: &fidl_fuchsia_net_routes::RuleMatcherV4,
6733        mut action: &fidl_fuchsia_net_routes::RuleAction,
6734        ___deadline: zx::MonotonicInstant,
6735    ) -> Result<RuleSetV4AddRuleResult, fidl::Error> {
6736        let _response = self.client.send_query::<
6737            RuleSetV4AddRuleRequest,
6738            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
6739        >(
6740            (index, matcher, action,),
6741            0x7f68325de94e80,
6742            fidl::encoding::DynamicFlags::empty(),
6743            ___deadline,
6744        )?;
6745        Ok(_response.map(|x| x))
6746    }
6747}
6748
6749#[cfg(target_os = "fuchsia")]
6750impl From<RuleSetV4SynchronousProxy> for zx::Handle {
6751    fn from(value: RuleSetV4SynchronousProxy) -> Self {
6752        value.into_channel().into()
6753    }
6754}
6755
6756#[cfg(target_os = "fuchsia")]
6757impl From<fidl::Channel> for RuleSetV4SynchronousProxy {
6758    fn from(value: fidl::Channel) -> Self {
6759        Self::new(value)
6760    }
6761}
6762
6763#[cfg(target_os = "fuchsia")]
6764impl fidl::endpoints::FromClient for RuleSetV4SynchronousProxy {
6765    type Protocol = RuleSetV4Marker;
6766
6767    fn from_client(value: fidl::endpoints::ClientEnd<RuleSetV4Marker>) -> Self {
6768        Self::new(value.into_channel())
6769    }
6770}
6771
6772#[derive(Debug, Clone)]
6773pub struct RuleSetV4Proxy {
6774    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6775}
6776
6777impl fidl::endpoints::Proxy for RuleSetV4Proxy {
6778    type Protocol = RuleSetV4Marker;
6779
6780    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6781        Self::new(inner)
6782    }
6783
6784    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6785        self.client.into_channel().map_err(|client| Self { client })
6786    }
6787
6788    fn as_channel(&self) -> &::fidl::AsyncChannel {
6789        self.client.as_channel()
6790    }
6791}
6792
6793impl RuleSetV4Proxy {
6794    /// Create a new Proxy for fuchsia.net.routes.admin/RuleSetV4.
6795    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6796        let protocol_name = <RuleSetV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6797        Self { client: fidl::client::Client::new(channel, protocol_name) }
6798    }
6799
6800    /// Get a Stream of events from the remote end of the protocol.
6801    ///
6802    /// # Panics
6803    ///
6804    /// Panics if the event stream was already taken.
6805    pub fn take_event_stream(&self) -> RuleSetV4EventStream {
6806        RuleSetV4EventStream { event_receiver: self.client.take_event_receiver() }
6807    }
6808
6809    /// Authenticates for a route table that will be used in an action.
6810    pub fn r#authenticate_for_route_table(
6811        &self,
6812        mut table: u32,
6813        mut token: fidl::Event,
6814    ) -> fidl::client::QueryResponseFut<
6815        BaseRuleSetAuthenticateForRouteTableResult,
6816        fidl::encoding::DefaultFuchsiaResourceDialect,
6817    > {
6818        RuleSetV4ProxyInterface::r#authenticate_for_route_table(self, table, token)
6819    }
6820
6821    /// Removes a rule from this rule set.
6822    ///
6823    /// If the client tries to remove from an index that does not have a rule,
6824    /// the error `RULE_DOES_NOT_EXIST` will be returned.
6825    ///
6826    /// + request `index` the index of the rule.
6827    pub fn r#remove_rule(
6828        &self,
6829        mut index: u32,
6830    ) -> fidl::client::QueryResponseFut<
6831        BaseRuleSetRemoveRuleResult,
6832        fidl::encoding::DefaultFuchsiaResourceDialect,
6833    > {
6834        RuleSetV4ProxyInterface::r#remove_rule(self, index)
6835    }
6836
6837    /// Removes all rules in the rule set and the underlying channel will be
6838    /// closed after the rules are removed.
6839    ///
6840    /// This method provides a way for synchronous closure.
6841    pub fn r#close(&self) -> Result<(), fidl::Error> {
6842        RuleSetV4ProxyInterface::r#close(self)
6843    }
6844
6845    /// Adds a rule to this rule set.
6846    ///
6847    /// If there is already a rule at the provided `index`, `RULE_ALREADY_EXISTS`
6848    /// is returned.
6849    ///
6850    /// + request `index` where to insert the rule.
6851    /// + request `matcher` the matcher of the rule.
6852    /// + request `action` action of the rule.
6853    pub fn r#add_rule(
6854        &self,
6855        mut index: u32,
6856        mut matcher: &fidl_fuchsia_net_routes::RuleMatcherV4,
6857        mut action: &fidl_fuchsia_net_routes::RuleAction,
6858    ) -> fidl::client::QueryResponseFut<
6859        RuleSetV4AddRuleResult,
6860        fidl::encoding::DefaultFuchsiaResourceDialect,
6861    > {
6862        RuleSetV4ProxyInterface::r#add_rule(self, index, matcher, action)
6863    }
6864}
6865
6866impl RuleSetV4ProxyInterface for RuleSetV4Proxy {
6867    type AuthenticateForRouteTableResponseFut = fidl::client::QueryResponseFut<
6868        BaseRuleSetAuthenticateForRouteTableResult,
6869        fidl::encoding::DefaultFuchsiaResourceDialect,
6870    >;
6871    fn r#authenticate_for_route_table(
6872        &self,
6873        mut table: u32,
6874        mut token: fidl::Event,
6875    ) -> Self::AuthenticateForRouteTableResponseFut {
6876        fn _decode(
6877            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6878        ) -> Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error> {
6879            let _response = fidl::client::decode_transaction_body::<
6880                fidl::encoding::ResultType<
6881                    fidl::encoding::EmptyStruct,
6882                    AuthenticateForRouteTableError,
6883                >,
6884                fidl::encoding::DefaultFuchsiaResourceDialect,
6885                0x6fd845360ed9bc8f,
6886            >(_buf?)?;
6887            Ok(_response.map(|x| x))
6888        }
6889        self.client.send_query_and_decode::<
6890            ProofOfRouteTableAuthorization,
6891            BaseRuleSetAuthenticateForRouteTableResult,
6892        >(
6893            (table, token,),
6894            0x6fd845360ed9bc8f,
6895            fidl::encoding::DynamicFlags::empty(),
6896            _decode,
6897        )
6898    }
6899
6900    type RemoveRuleResponseFut = fidl::client::QueryResponseFut<
6901        BaseRuleSetRemoveRuleResult,
6902        fidl::encoding::DefaultFuchsiaResourceDialect,
6903    >;
6904    fn r#remove_rule(&self, mut index: u32) -> Self::RemoveRuleResponseFut {
6905        fn _decode(
6906            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6907        ) -> Result<BaseRuleSetRemoveRuleResult, fidl::Error> {
6908            let _response = fidl::client::decode_transaction_body::<
6909                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
6910                fidl::encoding::DefaultFuchsiaResourceDialect,
6911                0x2ae3d7e817cbff90,
6912            >(_buf?)?;
6913            Ok(_response.map(|x| x))
6914        }
6915        self.client
6916            .send_query_and_decode::<BaseRuleSetRemoveRuleRequest, BaseRuleSetRemoveRuleResult>(
6917                (index,),
6918                0x2ae3d7e817cbff90,
6919                fidl::encoding::DynamicFlags::empty(),
6920                _decode,
6921            )
6922    }
6923
6924    fn r#close(&self) -> Result<(), fidl::Error> {
6925        self.client.send::<fidl::encoding::EmptyPayload>(
6926            (),
6927            0x457e1753672d4073,
6928            fidl::encoding::DynamicFlags::empty(),
6929        )
6930    }
6931
6932    type AddRuleResponseFut = fidl::client::QueryResponseFut<
6933        RuleSetV4AddRuleResult,
6934        fidl::encoding::DefaultFuchsiaResourceDialect,
6935    >;
6936    fn r#add_rule(
6937        &self,
6938        mut index: u32,
6939        mut matcher: &fidl_fuchsia_net_routes::RuleMatcherV4,
6940        mut action: &fidl_fuchsia_net_routes::RuleAction,
6941    ) -> Self::AddRuleResponseFut {
6942        fn _decode(
6943            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6944        ) -> Result<RuleSetV4AddRuleResult, fidl::Error> {
6945            let _response = fidl::client::decode_transaction_body::<
6946                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
6947                fidl::encoding::DefaultFuchsiaResourceDialect,
6948                0x7f68325de94e80,
6949            >(_buf?)?;
6950            Ok(_response.map(|x| x))
6951        }
6952        self.client.send_query_and_decode::<RuleSetV4AddRuleRequest, RuleSetV4AddRuleResult>(
6953            (index, matcher, action),
6954            0x7f68325de94e80,
6955            fidl::encoding::DynamicFlags::empty(),
6956            _decode,
6957        )
6958    }
6959}
6960
6961pub struct RuleSetV4EventStream {
6962    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6963}
6964
6965impl std::marker::Unpin for RuleSetV4EventStream {}
6966
6967impl futures::stream::FusedStream for RuleSetV4EventStream {
6968    fn is_terminated(&self) -> bool {
6969        self.event_receiver.is_terminated()
6970    }
6971}
6972
6973impl futures::Stream for RuleSetV4EventStream {
6974    type Item = Result<RuleSetV4Event, fidl::Error>;
6975
6976    fn poll_next(
6977        mut self: std::pin::Pin<&mut Self>,
6978        cx: &mut std::task::Context<'_>,
6979    ) -> std::task::Poll<Option<Self::Item>> {
6980        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6981            &mut self.event_receiver,
6982            cx
6983        )?) {
6984            Some(buf) => std::task::Poll::Ready(Some(RuleSetV4Event::decode(buf))),
6985            None => std::task::Poll::Ready(None),
6986        }
6987    }
6988}
6989
6990#[derive(Debug)]
6991pub enum RuleSetV4Event {}
6992
6993impl RuleSetV4Event {
6994    /// Decodes a message buffer as a [`RuleSetV4Event`].
6995    fn decode(
6996        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6997    ) -> Result<RuleSetV4Event, fidl::Error> {
6998        let (bytes, _handles) = buf.split_mut();
6999        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7000        debug_assert_eq!(tx_header.tx_id, 0);
7001        match tx_header.ordinal {
7002            _ => Err(fidl::Error::UnknownOrdinal {
7003                ordinal: tx_header.ordinal,
7004                protocol_name: <RuleSetV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7005            }),
7006        }
7007    }
7008}
7009
7010/// A Stream of incoming requests for fuchsia.net.routes.admin/RuleSetV4.
7011pub struct RuleSetV4RequestStream {
7012    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7013    is_terminated: bool,
7014}
7015
7016impl std::marker::Unpin for RuleSetV4RequestStream {}
7017
7018impl futures::stream::FusedStream for RuleSetV4RequestStream {
7019    fn is_terminated(&self) -> bool {
7020        self.is_terminated
7021    }
7022}
7023
7024impl fidl::endpoints::RequestStream for RuleSetV4RequestStream {
7025    type Protocol = RuleSetV4Marker;
7026    type ControlHandle = RuleSetV4ControlHandle;
7027
7028    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7029        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7030    }
7031
7032    fn control_handle(&self) -> Self::ControlHandle {
7033        RuleSetV4ControlHandle { inner: self.inner.clone() }
7034    }
7035
7036    fn into_inner(
7037        self,
7038    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7039    {
7040        (self.inner, self.is_terminated)
7041    }
7042
7043    fn from_inner(
7044        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7045        is_terminated: bool,
7046    ) -> Self {
7047        Self { inner, is_terminated }
7048    }
7049}
7050
7051impl futures::Stream for RuleSetV4RequestStream {
7052    type Item = Result<RuleSetV4Request, fidl::Error>;
7053
7054    fn poll_next(
7055        mut self: std::pin::Pin<&mut Self>,
7056        cx: &mut std::task::Context<'_>,
7057    ) -> std::task::Poll<Option<Self::Item>> {
7058        let this = &mut *self;
7059        if this.inner.check_shutdown(cx) {
7060            this.is_terminated = true;
7061            return std::task::Poll::Ready(None);
7062        }
7063        if this.is_terminated {
7064            panic!("polled RuleSetV4RequestStream after completion");
7065        }
7066        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7067            |bytes, handles| {
7068                match this.inner.channel().read_etc(cx, bytes, handles) {
7069                    std::task::Poll::Ready(Ok(())) => {}
7070                    std::task::Poll::Pending => return std::task::Poll::Pending,
7071                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7072                        this.is_terminated = true;
7073                        return std::task::Poll::Ready(None);
7074                    }
7075                    std::task::Poll::Ready(Err(e)) => {
7076                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7077                            e.into(),
7078                        ))));
7079                    }
7080                }
7081
7082                // A message has been received from the channel
7083                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7084
7085                std::task::Poll::Ready(Some(match header.ordinal {
7086                    0x6fd845360ed9bc8f => {
7087                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7088                        let mut req = fidl::new_empty!(
7089                            ProofOfRouteTableAuthorization,
7090                            fidl::encoding::DefaultFuchsiaResourceDialect
7091                        );
7092                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProofOfRouteTableAuthorization>(&header, _body_bytes, handles, &mut req)?;
7093                        let control_handle = RuleSetV4ControlHandle { inner: this.inner.clone() };
7094                        Ok(RuleSetV4Request::AuthenticateForRouteTable {
7095                            table: req.table,
7096                            token: req.token,
7097
7098                            responder: RuleSetV4AuthenticateForRouteTableResponder {
7099                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7100                                tx_id: header.tx_id,
7101                            },
7102                        })
7103                    }
7104                    0x2ae3d7e817cbff90 => {
7105                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7106                        let mut req = fidl::new_empty!(
7107                            BaseRuleSetRemoveRuleRequest,
7108                            fidl::encoding::DefaultFuchsiaResourceDialect
7109                        );
7110                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BaseRuleSetRemoveRuleRequest>(&header, _body_bytes, handles, &mut req)?;
7111                        let control_handle = RuleSetV4ControlHandle { inner: this.inner.clone() };
7112                        Ok(RuleSetV4Request::RemoveRule {
7113                            index: req.index,
7114
7115                            responder: RuleSetV4RemoveRuleResponder {
7116                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7117                                tx_id: header.tx_id,
7118                            },
7119                        })
7120                    }
7121                    0x457e1753672d4073 => {
7122                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
7123                        let mut req = fidl::new_empty!(
7124                            fidl::encoding::EmptyPayload,
7125                            fidl::encoding::DefaultFuchsiaResourceDialect
7126                        );
7127                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7128                        let control_handle = RuleSetV4ControlHandle { inner: this.inner.clone() };
7129                        Ok(RuleSetV4Request::Close { control_handle })
7130                    }
7131                    0x7f68325de94e80 => {
7132                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7133                        let mut req = fidl::new_empty!(
7134                            RuleSetV4AddRuleRequest,
7135                            fidl::encoding::DefaultFuchsiaResourceDialect
7136                        );
7137                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RuleSetV4AddRuleRequest>(&header, _body_bytes, handles, &mut req)?;
7138                        let control_handle = RuleSetV4ControlHandle { inner: this.inner.clone() };
7139                        Ok(RuleSetV4Request::AddRule {
7140                            index: req.index,
7141                            matcher: req.matcher,
7142                            action: req.action,
7143
7144                            responder: RuleSetV4AddRuleResponder {
7145                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7146                                tx_id: header.tx_id,
7147                            },
7148                        })
7149                    }
7150                    _ => Err(fidl::Error::UnknownOrdinal {
7151                        ordinal: header.ordinal,
7152                        protocol_name:
7153                            <RuleSetV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7154                    }),
7155                }))
7156            },
7157        )
7158    }
7159}
7160
7161/// Provides mutable access over a set of the system's IPv4 route rules.
7162///
7163/// A `RuleSet` has a priority and a rule has an index. A global order among the
7164/// rules is determined first by the priority of the `RuleSet` the rule belongs
7165/// to, and then the index of the rule inside the `RuleSet`.
7166///
7167/// This protocol encodes the lifetime of the rule set. Closing the client end
7168/// removes the rule set, and all the rules that are owned by the rule set.
7169#[derive(Debug)]
7170pub enum RuleSetV4Request {
7171    /// Authenticates for a route table that will be used in an action.
7172    AuthenticateForRouteTable {
7173        table: u32,
7174        token: fidl::Event,
7175        responder: RuleSetV4AuthenticateForRouteTableResponder,
7176    },
7177    /// Removes a rule from this rule set.
7178    ///
7179    /// If the client tries to remove from an index that does not have a rule,
7180    /// the error `RULE_DOES_NOT_EXIST` will be returned.
7181    ///
7182    /// + request `index` the index of the rule.
7183    RemoveRule { index: u32, responder: RuleSetV4RemoveRuleResponder },
7184    /// Removes all rules in the rule set and the underlying channel will be
7185    /// closed after the rules are removed.
7186    ///
7187    /// This method provides a way for synchronous closure.
7188    Close { control_handle: RuleSetV4ControlHandle },
7189    /// Adds a rule to this rule set.
7190    ///
7191    /// If there is already a rule at the provided `index`, `RULE_ALREADY_EXISTS`
7192    /// is returned.
7193    ///
7194    /// + request `index` where to insert the rule.
7195    /// + request `matcher` the matcher of the rule.
7196    /// + request `action` action of the rule.
7197    AddRule {
7198        index: u32,
7199        matcher: fidl_fuchsia_net_routes::RuleMatcherV4,
7200        action: fidl_fuchsia_net_routes::RuleAction,
7201        responder: RuleSetV4AddRuleResponder,
7202    },
7203}
7204
7205impl RuleSetV4Request {
7206    #[allow(irrefutable_let_patterns)]
7207    pub fn into_authenticate_for_route_table(
7208        self,
7209    ) -> Option<(u32, fidl::Event, RuleSetV4AuthenticateForRouteTableResponder)> {
7210        if let RuleSetV4Request::AuthenticateForRouteTable { table, token, responder } = self {
7211            Some((table, token, responder))
7212        } else {
7213            None
7214        }
7215    }
7216
7217    #[allow(irrefutable_let_patterns)]
7218    pub fn into_remove_rule(self) -> Option<(u32, RuleSetV4RemoveRuleResponder)> {
7219        if let RuleSetV4Request::RemoveRule { index, responder } = self {
7220            Some((index, responder))
7221        } else {
7222            None
7223        }
7224    }
7225
7226    #[allow(irrefutable_let_patterns)]
7227    pub fn into_close(self) -> Option<(RuleSetV4ControlHandle)> {
7228        if let RuleSetV4Request::Close { control_handle } = self {
7229            Some((control_handle))
7230        } else {
7231            None
7232        }
7233    }
7234
7235    #[allow(irrefutable_let_patterns)]
7236    pub fn into_add_rule(
7237        self,
7238    ) -> Option<(
7239        u32,
7240        fidl_fuchsia_net_routes::RuleMatcherV4,
7241        fidl_fuchsia_net_routes::RuleAction,
7242        RuleSetV4AddRuleResponder,
7243    )> {
7244        if let RuleSetV4Request::AddRule { index, matcher, action, responder } = self {
7245            Some((index, matcher, action, responder))
7246        } else {
7247            None
7248        }
7249    }
7250
7251    /// Name of the method defined in FIDL
7252    pub fn method_name(&self) -> &'static str {
7253        match *self {
7254            RuleSetV4Request::AuthenticateForRouteTable { .. } => "authenticate_for_route_table",
7255            RuleSetV4Request::RemoveRule { .. } => "remove_rule",
7256            RuleSetV4Request::Close { .. } => "close",
7257            RuleSetV4Request::AddRule { .. } => "add_rule",
7258        }
7259    }
7260}
7261
7262#[derive(Debug, Clone)]
7263pub struct RuleSetV4ControlHandle {
7264    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7265}
7266
7267impl fidl::endpoints::ControlHandle for RuleSetV4ControlHandle {
7268    fn shutdown(&self) {
7269        self.inner.shutdown()
7270    }
7271    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7272        self.inner.shutdown_with_epitaph(status)
7273    }
7274
7275    fn is_closed(&self) -> bool {
7276        self.inner.channel().is_closed()
7277    }
7278    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7279        self.inner.channel().on_closed()
7280    }
7281
7282    #[cfg(target_os = "fuchsia")]
7283    fn signal_peer(
7284        &self,
7285        clear_mask: zx::Signals,
7286        set_mask: zx::Signals,
7287    ) -> Result<(), zx_status::Status> {
7288        use fidl::Peered;
7289        self.inner.channel().signal_peer(clear_mask, set_mask)
7290    }
7291}
7292
7293impl RuleSetV4ControlHandle {}
7294
7295#[must_use = "FIDL methods require a response to be sent"]
7296#[derive(Debug)]
7297pub struct RuleSetV4AuthenticateForRouteTableResponder {
7298    control_handle: std::mem::ManuallyDrop<RuleSetV4ControlHandle>,
7299    tx_id: u32,
7300}
7301
7302/// Set the the channel to be shutdown (see [`RuleSetV4ControlHandle::shutdown`])
7303/// if the responder is dropped without sending a response, so that the client
7304/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7305impl std::ops::Drop for RuleSetV4AuthenticateForRouteTableResponder {
7306    fn drop(&mut self) {
7307        self.control_handle.shutdown();
7308        // Safety: drops once, never accessed again
7309        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7310    }
7311}
7312
7313impl fidl::endpoints::Responder for RuleSetV4AuthenticateForRouteTableResponder {
7314    type ControlHandle = RuleSetV4ControlHandle;
7315
7316    fn control_handle(&self) -> &RuleSetV4ControlHandle {
7317        &self.control_handle
7318    }
7319
7320    fn drop_without_shutdown(mut self) {
7321        // Safety: drops once, never accessed again due to mem::forget
7322        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7323        // Prevent Drop from running (which would shut down the channel)
7324        std::mem::forget(self);
7325    }
7326}
7327
7328impl RuleSetV4AuthenticateForRouteTableResponder {
7329    /// Sends a response to the FIDL transaction.
7330    ///
7331    /// Sets the channel to shutdown if an error occurs.
7332    pub fn send(
7333        self,
7334        mut result: Result<(), AuthenticateForRouteTableError>,
7335    ) -> Result<(), fidl::Error> {
7336        let _result = self.send_raw(result);
7337        if _result.is_err() {
7338            self.control_handle.shutdown();
7339        }
7340        self.drop_without_shutdown();
7341        _result
7342    }
7343
7344    /// Similar to "send" but does not shutdown the channel if an error occurs.
7345    pub fn send_no_shutdown_on_err(
7346        self,
7347        mut result: Result<(), AuthenticateForRouteTableError>,
7348    ) -> Result<(), fidl::Error> {
7349        let _result = self.send_raw(result);
7350        self.drop_without_shutdown();
7351        _result
7352    }
7353
7354    fn send_raw(
7355        &self,
7356        mut result: Result<(), AuthenticateForRouteTableError>,
7357    ) -> Result<(), fidl::Error> {
7358        self.control_handle.inner.send::<fidl::encoding::ResultType<
7359            fidl::encoding::EmptyStruct,
7360            AuthenticateForRouteTableError,
7361        >>(
7362            result,
7363            self.tx_id,
7364            0x6fd845360ed9bc8f,
7365            fidl::encoding::DynamicFlags::empty(),
7366        )
7367    }
7368}
7369
7370#[must_use = "FIDL methods require a response to be sent"]
7371#[derive(Debug)]
7372pub struct RuleSetV4RemoveRuleResponder {
7373    control_handle: std::mem::ManuallyDrop<RuleSetV4ControlHandle>,
7374    tx_id: u32,
7375}
7376
7377/// Set the the channel to be shutdown (see [`RuleSetV4ControlHandle::shutdown`])
7378/// if the responder is dropped without sending a response, so that the client
7379/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7380impl std::ops::Drop for RuleSetV4RemoveRuleResponder {
7381    fn drop(&mut self) {
7382        self.control_handle.shutdown();
7383        // Safety: drops once, never accessed again
7384        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7385    }
7386}
7387
7388impl fidl::endpoints::Responder for RuleSetV4RemoveRuleResponder {
7389    type ControlHandle = RuleSetV4ControlHandle;
7390
7391    fn control_handle(&self) -> &RuleSetV4ControlHandle {
7392        &self.control_handle
7393    }
7394
7395    fn drop_without_shutdown(mut self) {
7396        // Safety: drops once, never accessed again due to mem::forget
7397        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7398        // Prevent Drop from running (which would shut down the channel)
7399        std::mem::forget(self);
7400    }
7401}
7402
7403impl RuleSetV4RemoveRuleResponder {
7404    /// Sends a response to the FIDL transaction.
7405    ///
7406    /// Sets the channel to shutdown if an error occurs.
7407    pub fn send(self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
7408        let _result = self.send_raw(result);
7409        if _result.is_err() {
7410            self.control_handle.shutdown();
7411        }
7412        self.drop_without_shutdown();
7413        _result
7414    }
7415
7416    /// Similar to "send" but does not shutdown the channel if an error occurs.
7417    pub fn send_no_shutdown_on_err(
7418        self,
7419        mut result: Result<(), RuleSetError>,
7420    ) -> Result<(), fidl::Error> {
7421        let _result = self.send_raw(result);
7422        self.drop_without_shutdown();
7423        _result
7424    }
7425
7426    fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
7427        self.control_handle.inner.send::<fidl::encoding::ResultType<
7428            fidl::encoding::EmptyStruct,
7429            RuleSetError,
7430        >>(
7431            result,
7432            self.tx_id,
7433            0x2ae3d7e817cbff90,
7434            fidl::encoding::DynamicFlags::empty(),
7435        )
7436    }
7437}
7438
7439#[must_use = "FIDL methods require a response to be sent"]
7440#[derive(Debug)]
7441pub struct RuleSetV4AddRuleResponder {
7442    control_handle: std::mem::ManuallyDrop<RuleSetV4ControlHandle>,
7443    tx_id: u32,
7444}
7445
7446/// Set the the channel to be shutdown (see [`RuleSetV4ControlHandle::shutdown`])
7447/// if the responder is dropped without sending a response, so that the client
7448/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7449impl std::ops::Drop for RuleSetV4AddRuleResponder {
7450    fn drop(&mut self) {
7451        self.control_handle.shutdown();
7452        // Safety: drops once, never accessed again
7453        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7454    }
7455}
7456
7457impl fidl::endpoints::Responder for RuleSetV4AddRuleResponder {
7458    type ControlHandle = RuleSetV4ControlHandle;
7459
7460    fn control_handle(&self) -> &RuleSetV4ControlHandle {
7461        &self.control_handle
7462    }
7463
7464    fn drop_without_shutdown(mut self) {
7465        // Safety: drops once, never accessed again due to mem::forget
7466        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7467        // Prevent Drop from running (which would shut down the channel)
7468        std::mem::forget(self);
7469    }
7470}
7471
7472impl RuleSetV4AddRuleResponder {
7473    /// Sends a response to the FIDL transaction.
7474    ///
7475    /// Sets the channel to shutdown if an error occurs.
7476    pub fn send(self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
7477        let _result = self.send_raw(result);
7478        if _result.is_err() {
7479            self.control_handle.shutdown();
7480        }
7481        self.drop_without_shutdown();
7482        _result
7483    }
7484
7485    /// Similar to "send" but does not shutdown the channel if an error occurs.
7486    pub fn send_no_shutdown_on_err(
7487        self,
7488        mut result: Result<(), RuleSetError>,
7489    ) -> Result<(), fidl::Error> {
7490        let _result = self.send_raw(result);
7491        self.drop_without_shutdown();
7492        _result
7493    }
7494
7495    fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
7496        self.control_handle.inner.send::<fidl::encoding::ResultType<
7497            fidl::encoding::EmptyStruct,
7498            RuleSetError,
7499        >>(
7500            result,
7501            self.tx_id,
7502            0x7f68325de94e80,
7503            fidl::encoding::DynamicFlags::empty(),
7504        )
7505    }
7506}
7507
7508#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7509pub struct RuleSetV6Marker;
7510
7511impl fidl::endpoints::ProtocolMarker for RuleSetV6Marker {
7512    type Proxy = RuleSetV6Proxy;
7513    type RequestStream = RuleSetV6RequestStream;
7514    #[cfg(target_os = "fuchsia")]
7515    type SynchronousProxy = RuleSetV6SynchronousProxy;
7516
7517    const DEBUG_NAME: &'static str = "(anonymous) RuleSetV6";
7518}
7519pub type RuleSetV6AddRuleResult = Result<(), RuleSetError>;
7520
7521pub trait RuleSetV6ProxyInterface: Send + Sync {
7522    type AuthenticateForRouteTableResponseFut: std::future::Future<
7523            Output = Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error>,
7524        > + Send;
7525    fn r#authenticate_for_route_table(
7526        &self,
7527        table: u32,
7528        token: fidl::Event,
7529    ) -> Self::AuthenticateForRouteTableResponseFut;
7530    type RemoveRuleResponseFut: std::future::Future<Output = Result<BaseRuleSetRemoveRuleResult, fidl::Error>>
7531        + Send;
7532    fn r#remove_rule(&self, index: u32) -> Self::RemoveRuleResponseFut;
7533    fn r#close(&self) -> Result<(), fidl::Error>;
7534    type AddRuleResponseFut: std::future::Future<Output = Result<RuleSetV6AddRuleResult, fidl::Error>>
7535        + Send;
7536    fn r#add_rule(
7537        &self,
7538        index: u32,
7539        matcher: &fidl_fuchsia_net_routes::RuleMatcherV6,
7540        action: &fidl_fuchsia_net_routes::RuleAction,
7541    ) -> Self::AddRuleResponseFut;
7542}
7543#[derive(Debug)]
7544#[cfg(target_os = "fuchsia")]
7545pub struct RuleSetV6SynchronousProxy {
7546    client: fidl::client::sync::Client,
7547}
7548
7549#[cfg(target_os = "fuchsia")]
7550impl fidl::endpoints::SynchronousProxy for RuleSetV6SynchronousProxy {
7551    type Proxy = RuleSetV6Proxy;
7552    type Protocol = RuleSetV6Marker;
7553
7554    fn from_channel(inner: fidl::Channel) -> Self {
7555        Self::new(inner)
7556    }
7557
7558    fn into_channel(self) -> fidl::Channel {
7559        self.client.into_channel()
7560    }
7561
7562    fn as_channel(&self) -> &fidl::Channel {
7563        self.client.as_channel()
7564    }
7565}
7566
7567#[cfg(target_os = "fuchsia")]
7568impl RuleSetV6SynchronousProxy {
7569    pub fn new(channel: fidl::Channel) -> Self {
7570        let protocol_name = <RuleSetV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7571        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7572    }
7573
7574    pub fn into_channel(self) -> fidl::Channel {
7575        self.client.into_channel()
7576    }
7577
7578    /// Waits until an event arrives and returns it. It is safe for other
7579    /// threads to make concurrent requests while waiting for an event.
7580    pub fn wait_for_event(
7581        &self,
7582        deadline: zx::MonotonicInstant,
7583    ) -> Result<RuleSetV6Event, fidl::Error> {
7584        RuleSetV6Event::decode(self.client.wait_for_event(deadline)?)
7585    }
7586
7587    /// Authenticates for a route table that will be used in an action.
7588    pub fn r#authenticate_for_route_table(
7589        &self,
7590        mut table: u32,
7591        mut token: fidl::Event,
7592        ___deadline: zx::MonotonicInstant,
7593    ) -> Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error> {
7594        let _response =
7595            self.client.send_query::<ProofOfRouteTableAuthorization, fidl::encoding::ResultType<
7596                fidl::encoding::EmptyStruct,
7597                AuthenticateForRouteTableError,
7598            >>(
7599                (table, token),
7600                0x6fd845360ed9bc8f,
7601                fidl::encoding::DynamicFlags::empty(),
7602                ___deadline,
7603            )?;
7604        Ok(_response.map(|x| x))
7605    }
7606
7607    /// Removes a rule from this rule set.
7608    ///
7609    /// If the client tries to remove from an index that does not have a rule,
7610    /// the error `RULE_DOES_NOT_EXIST` will be returned.
7611    ///
7612    /// + request `index` the index of the rule.
7613    pub fn r#remove_rule(
7614        &self,
7615        mut index: u32,
7616        ___deadline: zx::MonotonicInstant,
7617    ) -> Result<BaseRuleSetRemoveRuleResult, fidl::Error> {
7618        let _response = self.client.send_query::<
7619            BaseRuleSetRemoveRuleRequest,
7620            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
7621        >(
7622            (index,),
7623            0x2ae3d7e817cbff90,
7624            fidl::encoding::DynamicFlags::empty(),
7625            ___deadline,
7626        )?;
7627        Ok(_response.map(|x| x))
7628    }
7629
7630    /// Removes all rules in the rule set and the underlying channel will be
7631    /// closed after the rules are removed.
7632    ///
7633    /// This method provides a way for synchronous closure.
7634    pub fn r#close(&self) -> Result<(), fidl::Error> {
7635        self.client.send::<fidl::encoding::EmptyPayload>(
7636            (),
7637            0x457e1753672d4073,
7638            fidl::encoding::DynamicFlags::empty(),
7639        )
7640    }
7641
7642    /// Adds a rule to this rule set.
7643    ///
7644    /// If there is already a rule at the provided `index`, `RULE_ALREADY_EXISTS`
7645    /// is returned.
7646    ///
7647    /// + request `index` where to insert the rule.
7648    /// + request `matcher` the matcher of the rule.
7649    /// + request `action` action of the rule.
7650    pub fn r#add_rule(
7651        &self,
7652        mut index: u32,
7653        mut matcher: &fidl_fuchsia_net_routes::RuleMatcherV6,
7654        mut action: &fidl_fuchsia_net_routes::RuleAction,
7655        ___deadline: zx::MonotonicInstant,
7656    ) -> Result<RuleSetV6AddRuleResult, fidl::Error> {
7657        let _response = self.client.send_query::<
7658            RuleSetV6AddRuleRequest,
7659            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
7660        >(
7661            (index, matcher, action,),
7662            0x946cad8f8a726b3,
7663            fidl::encoding::DynamicFlags::empty(),
7664            ___deadline,
7665        )?;
7666        Ok(_response.map(|x| x))
7667    }
7668}
7669
7670#[cfg(target_os = "fuchsia")]
7671impl From<RuleSetV6SynchronousProxy> for zx::Handle {
7672    fn from(value: RuleSetV6SynchronousProxy) -> Self {
7673        value.into_channel().into()
7674    }
7675}
7676
7677#[cfg(target_os = "fuchsia")]
7678impl From<fidl::Channel> for RuleSetV6SynchronousProxy {
7679    fn from(value: fidl::Channel) -> Self {
7680        Self::new(value)
7681    }
7682}
7683
7684#[cfg(target_os = "fuchsia")]
7685impl fidl::endpoints::FromClient for RuleSetV6SynchronousProxy {
7686    type Protocol = RuleSetV6Marker;
7687
7688    fn from_client(value: fidl::endpoints::ClientEnd<RuleSetV6Marker>) -> Self {
7689        Self::new(value.into_channel())
7690    }
7691}
7692
7693#[derive(Debug, Clone)]
7694pub struct RuleSetV6Proxy {
7695    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7696}
7697
7698impl fidl::endpoints::Proxy for RuleSetV6Proxy {
7699    type Protocol = RuleSetV6Marker;
7700
7701    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7702        Self::new(inner)
7703    }
7704
7705    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7706        self.client.into_channel().map_err(|client| Self { client })
7707    }
7708
7709    fn as_channel(&self) -> &::fidl::AsyncChannel {
7710        self.client.as_channel()
7711    }
7712}
7713
7714impl RuleSetV6Proxy {
7715    /// Create a new Proxy for fuchsia.net.routes.admin/RuleSetV6.
7716    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7717        let protocol_name = <RuleSetV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7718        Self { client: fidl::client::Client::new(channel, protocol_name) }
7719    }
7720
7721    /// Get a Stream of events from the remote end of the protocol.
7722    ///
7723    /// # Panics
7724    ///
7725    /// Panics if the event stream was already taken.
7726    pub fn take_event_stream(&self) -> RuleSetV6EventStream {
7727        RuleSetV6EventStream { event_receiver: self.client.take_event_receiver() }
7728    }
7729
7730    /// Authenticates for a route table that will be used in an action.
7731    pub fn r#authenticate_for_route_table(
7732        &self,
7733        mut table: u32,
7734        mut token: fidl::Event,
7735    ) -> fidl::client::QueryResponseFut<
7736        BaseRuleSetAuthenticateForRouteTableResult,
7737        fidl::encoding::DefaultFuchsiaResourceDialect,
7738    > {
7739        RuleSetV6ProxyInterface::r#authenticate_for_route_table(self, table, token)
7740    }
7741
7742    /// Removes a rule from this rule set.
7743    ///
7744    /// If the client tries to remove from an index that does not have a rule,
7745    /// the error `RULE_DOES_NOT_EXIST` will be returned.
7746    ///
7747    /// + request `index` the index of the rule.
7748    pub fn r#remove_rule(
7749        &self,
7750        mut index: u32,
7751    ) -> fidl::client::QueryResponseFut<
7752        BaseRuleSetRemoveRuleResult,
7753        fidl::encoding::DefaultFuchsiaResourceDialect,
7754    > {
7755        RuleSetV6ProxyInterface::r#remove_rule(self, index)
7756    }
7757
7758    /// Removes all rules in the rule set and the underlying channel will be
7759    /// closed after the rules are removed.
7760    ///
7761    /// This method provides a way for synchronous closure.
7762    pub fn r#close(&self) -> Result<(), fidl::Error> {
7763        RuleSetV6ProxyInterface::r#close(self)
7764    }
7765
7766    /// Adds a rule to this rule set.
7767    ///
7768    /// If there is already a rule at the provided `index`, `RULE_ALREADY_EXISTS`
7769    /// is returned.
7770    ///
7771    /// + request `index` where to insert the rule.
7772    /// + request `matcher` the matcher of the rule.
7773    /// + request `action` action of the rule.
7774    pub fn r#add_rule(
7775        &self,
7776        mut index: u32,
7777        mut matcher: &fidl_fuchsia_net_routes::RuleMatcherV6,
7778        mut action: &fidl_fuchsia_net_routes::RuleAction,
7779    ) -> fidl::client::QueryResponseFut<
7780        RuleSetV6AddRuleResult,
7781        fidl::encoding::DefaultFuchsiaResourceDialect,
7782    > {
7783        RuleSetV6ProxyInterface::r#add_rule(self, index, matcher, action)
7784    }
7785}
7786
7787impl RuleSetV6ProxyInterface for RuleSetV6Proxy {
7788    type AuthenticateForRouteTableResponseFut = fidl::client::QueryResponseFut<
7789        BaseRuleSetAuthenticateForRouteTableResult,
7790        fidl::encoding::DefaultFuchsiaResourceDialect,
7791    >;
7792    fn r#authenticate_for_route_table(
7793        &self,
7794        mut table: u32,
7795        mut token: fidl::Event,
7796    ) -> Self::AuthenticateForRouteTableResponseFut {
7797        fn _decode(
7798            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7799        ) -> Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error> {
7800            let _response = fidl::client::decode_transaction_body::<
7801                fidl::encoding::ResultType<
7802                    fidl::encoding::EmptyStruct,
7803                    AuthenticateForRouteTableError,
7804                >,
7805                fidl::encoding::DefaultFuchsiaResourceDialect,
7806                0x6fd845360ed9bc8f,
7807            >(_buf?)?;
7808            Ok(_response.map(|x| x))
7809        }
7810        self.client.send_query_and_decode::<
7811            ProofOfRouteTableAuthorization,
7812            BaseRuleSetAuthenticateForRouteTableResult,
7813        >(
7814            (table, token,),
7815            0x6fd845360ed9bc8f,
7816            fidl::encoding::DynamicFlags::empty(),
7817            _decode,
7818        )
7819    }
7820
7821    type RemoveRuleResponseFut = fidl::client::QueryResponseFut<
7822        BaseRuleSetRemoveRuleResult,
7823        fidl::encoding::DefaultFuchsiaResourceDialect,
7824    >;
7825    fn r#remove_rule(&self, mut index: u32) -> Self::RemoveRuleResponseFut {
7826        fn _decode(
7827            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7828        ) -> Result<BaseRuleSetRemoveRuleResult, fidl::Error> {
7829            let _response = fidl::client::decode_transaction_body::<
7830                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
7831                fidl::encoding::DefaultFuchsiaResourceDialect,
7832                0x2ae3d7e817cbff90,
7833            >(_buf?)?;
7834            Ok(_response.map(|x| x))
7835        }
7836        self.client
7837            .send_query_and_decode::<BaseRuleSetRemoveRuleRequest, BaseRuleSetRemoveRuleResult>(
7838                (index,),
7839                0x2ae3d7e817cbff90,
7840                fidl::encoding::DynamicFlags::empty(),
7841                _decode,
7842            )
7843    }
7844
7845    fn r#close(&self) -> Result<(), fidl::Error> {
7846        self.client.send::<fidl::encoding::EmptyPayload>(
7847            (),
7848            0x457e1753672d4073,
7849            fidl::encoding::DynamicFlags::empty(),
7850        )
7851    }
7852
7853    type AddRuleResponseFut = fidl::client::QueryResponseFut<
7854        RuleSetV6AddRuleResult,
7855        fidl::encoding::DefaultFuchsiaResourceDialect,
7856    >;
7857    fn r#add_rule(
7858        &self,
7859        mut index: u32,
7860        mut matcher: &fidl_fuchsia_net_routes::RuleMatcherV6,
7861        mut action: &fidl_fuchsia_net_routes::RuleAction,
7862    ) -> Self::AddRuleResponseFut {
7863        fn _decode(
7864            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7865        ) -> Result<RuleSetV6AddRuleResult, fidl::Error> {
7866            let _response = fidl::client::decode_transaction_body::<
7867                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
7868                fidl::encoding::DefaultFuchsiaResourceDialect,
7869                0x946cad8f8a726b3,
7870            >(_buf?)?;
7871            Ok(_response.map(|x| x))
7872        }
7873        self.client.send_query_and_decode::<RuleSetV6AddRuleRequest, RuleSetV6AddRuleResult>(
7874            (index, matcher, action),
7875            0x946cad8f8a726b3,
7876            fidl::encoding::DynamicFlags::empty(),
7877            _decode,
7878        )
7879    }
7880}
7881
7882pub struct RuleSetV6EventStream {
7883    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7884}
7885
7886impl std::marker::Unpin for RuleSetV6EventStream {}
7887
7888impl futures::stream::FusedStream for RuleSetV6EventStream {
7889    fn is_terminated(&self) -> bool {
7890        self.event_receiver.is_terminated()
7891    }
7892}
7893
7894impl futures::Stream for RuleSetV6EventStream {
7895    type Item = Result<RuleSetV6Event, fidl::Error>;
7896
7897    fn poll_next(
7898        mut self: std::pin::Pin<&mut Self>,
7899        cx: &mut std::task::Context<'_>,
7900    ) -> std::task::Poll<Option<Self::Item>> {
7901        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7902            &mut self.event_receiver,
7903            cx
7904        )?) {
7905            Some(buf) => std::task::Poll::Ready(Some(RuleSetV6Event::decode(buf))),
7906            None => std::task::Poll::Ready(None),
7907        }
7908    }
7909}
7910
7911#[derive(Debug)]
7912pub enum RuleSetV6Event {}
7913
7914impl RuleSetV6Event {
7915    /// Decodes a message buffer as a [`RuleSetV6Event`].
7916    fn decode(
7917        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7918    ) -> Result<RuleSetV6Event, fidl::Error> {
7919        let (bytes, _handles) = buf.split_mut();
7920        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7921        debug_assert_eq!(tx_header.tx_id, 0);
7922        match tx_header.ordinal {
7923            _ => Err(fidl::Error::UnknownOrdinal {
7924                ordinal: tx_header.ordinal,
7925                protocol_name: <RuleSetV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7926            }),
7927        }
7928    }
7929}
7930
7931/// A Stream of incoming requests for fuchsia.net.routes.admin/RuleSetV6.
7932pub struct RuleSetV6RequestStream {
7933    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7934    is_terminated: bool,
7935}
7936
7937impl std::marker::Unpin for RuleSetV6RequestStream {}
7938
7939impl futures::stream::FusedStream for RuleSetV6RequestStream {
7940    fn is_terminated(&self) -> bool {
7941        self.is_terminated
7942    }
7943}
7944
7945impl fidl::endpoints::RequestStream for RuleSetV6RequestStream {
7946    type Protocol = RuleSetV6Marker;
7947    type ControlHandle = RuleSetV6ControlHandle;
7948
7949    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7950        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7951    }
7952
7953    fn control_handle(&self) -> Self::ControlHandle {
7954        RuleSetV6ControlHandle { inner: self.inner.clone() }
7955    }
7956
7957    fn into_inner(
7958        self,
7959    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7960    {
7961        (self.inner, self.is_terminated)
7962    }
7963
7964    fn from_inner(
7965        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7966        is_terminated: bool,
7967    ) -> Self {
7968        Self { inner, is_terminated }
7969    }
7970}
7971
7972impl futures::Stream for RuleSetV6RequestStream {
7973    type Item = Result<RuleSetV6Request, fidl::Error>;
7974
7975    fn poll_next(
7976        mut self: std::pin::Pin<&mut Self>,
7977        cx: &mut std::task::Context<'_>,
7978    ) -> std::task::Poll<Option<Self::Item>> {
7979        let this = &mut *self;
7980        if this.inner.check_shutdown(cx) {
7981            this.is_terminated = true;
7982            return std::task::Poll::Ready(None);
7983        }
7984        if this.is_terminated {
7985            panic!("polled RuleSetV6RequestStream after completion");
7986        }
7987        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7988            |bytes, handles| {
7989                match this.inner.channel().read_etc(cx, bytes, handles) {
7990                    std::task::Poll::Ready(Ok(())) => {}
7991                    std::task::Poll::Pending => return std::task::Poll::Pending,
7992                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7993                        this.is_terminated = true;
7994                        return std::task::Poll::Ready(None);
7995                    }
7996                    std::task::Poll::Ready(Err(e)) => {
7997                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7998                            e.into(),
7999                        ))));
8000                    }
8001                }
8002
8003                // A message has been received from the channel
8004                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8005
8006                std::task::Poll::Ready(Some(match header.ordinal {
8007                    0x6fd845360ed9bc8f => {
8008                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8009                        let mut req = fidl::new_empty!(
8010                            ProofOfRouteTableAuthorization,
8011                            fidl::encoding::DefaultFuchsiaResourceDialect
8012                        );
8013                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProofOfRouteTableAuthorization>(&header, _body_bytes, handles, &mut req)?;
8014                        let control_handle = RuleSetV6ControlHandle { inner: this.inner.clone() };
8015                        Ok(RuleSetV6Request::AuthenticateForRouteTable {
8016                            table: req.table,
8017                            token: req.token,
8018
8019                            responder: RuleSetV6AuthenticateForRouteTableResponder {
8020                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8021                                tx_id: header.tx_id,
8022                            },
8023                        })
8024                    }
8025                    0x2ae3d7e817cbff90 => {
8026                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8027                        let mut req = fidl::new_empty!(
8028                            BaseRuleSetRemoveRuleRequest,
8029                            fidl::encoding::DefaultFuchsiaResourceDialect
8030                        );
8031                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BaseRuleSetRemoveRuleRequest>(&header, _body_bytes, handles, &mut req)?;
8032                        let control_handle = RuleSetV6ControlHandle { inner: this.inner.clone() };
8033                        Ok(RuleSetV6Request::RemoveRule {
8034                            index: req.index,
8035
8036                            responder: RuleSetV6RemoveRuleResponder {
8037                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8038                                tx_id: header.tx_id,
8039                            },
8040                        })
8041                    }
8042                    0x457e1753672d4073 => {
8043                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8044                        let mut req = fidl::new_empty!(
8045                            fidl::encoding::EmptyPayload,
8046                            fidl::encoding::DefaultFuchsiaResourceDialect
8047                        );
8048                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
8049                        let control_handle = RuleSetV6ControlHandle { inner: this.inner.clone() };
8050                        Ok(RuleSetV6Request::Close { control_handle })
8051                    }
8052                    0x946cad8f8a726b3 => {
8053                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
8054                        let mut req = fidl::new_empty!(
8055                            RuleSetV6AddRuleRequest,
8056                            fidl::encoding::DefaultFuchsiaResourceDialect
8057                        );
8058                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RuleSetV6AddRuleRequest>(&header, _body_bytes, handles, &mut req)?;
8059                        let control_handle = RuleSetV6ControlHandle { inner: this.inner.clone() };
8060                        Ok(RuleSetV6Request::AddRule {
8061                            index: req.index,
8062                            matcher: req.matcher,
8063                            action: req.action,
8064
8065                            responder: RuleSetV6AddRuleResponder {
8066                                control_handle: std::mem::ManuallyDrop::new(control_handle),
8067                                tx_id: header.tx_id,
8068                            },
8069                        })
8070                    }
8071                    _ => Err(fidl::Error::UnknownOrdinal {
8072                        ordinal: header.ordinal,
8073                        protocol_name:
8074                            <RuleSetV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8075                    }),
8076                }))
8077            },
8078        )
8079    }
8080}
8081
8082/// Provides mutable access over a set of the system's IPv6 route rules.
8083///
8084/// A `RuleSet` has a priority and a rule has an index. A global order among the
8085/// rules is determined first by the priority of the `RuleSet` the rule belongs
8086/// to, and then the index of the rule inside the `RuleSet`.
8087///
8088/// This protocol encodes the lifetime of the rule set. Closing the client end
8089/// removes the rule set, and all the rules that are owned by the rule set.
8090#[derive(Debug)]
8091pub enum RuleSetV6Request {
8092    /// Authenticates for a route table that will be used in an action.
8093    AuthenticateForRouteTable {
8094        table: u32,
8095        token: fidl::Event,
8096        responder: RuleSetV6AuthenticateForRouteTableResponder,
8097    },
8098    /// Removes a rule from this rule set.
8099    ///
8100    /// If the client tries to remove from an index that does not have a rule,
8101    /// the error `RULE_DOES_NOT_EXIST` will be returned.
8102    ///
8103    /// + request `index` the index of the rule.
8104    RemoveRule { index: u32, responder: RuleSetV6RemoveRuleResponder },
8105    /// Removes all rules in the rule set and the underlying channel will be
8106    /// closed after the rules are removed.
8107    ///
8108    /// This method provides a way for synchronous closure.
8109    Close { control_handle: RuleSetV6ControlHandle },
8110    /// Adds a rule to this rule set.
8111    ///
8112    /// If there is already a rule at the provided `index`, `RULE_ALREADY_EXISTS`
8113    /// is returned.
8114    ///
8115    /// + request `index` where to insert the rule.
8116    /// + request `matcher` the matcher of the rule.
8117    /// + request `action` action of the rule.
8118    AddRule {
8119        index: u32,
8120        matcher: fidl_fuchsia_net_routes::RuleMatcherV6,
8121        action: fidl_fuchsia_net_routes::RuleAction,
8122        responder: RuleSetV6AddRuleResponder,
8123    },
8124}
8125
8126impl RuleSetV6Request {
8127    #[allow(irrefutable_let_patterns)]
8128    pub fn into_authenticate_for_route_table(
8129        self,
8130    ) -> Option<(u32, fidl::Event, RuleSetV6AuthenticateForRouteTableResponder)> {
8131        if let RuleSetV6Request::AuthenticateForRouteTable { table, token, responder } = self {
8132            Some((table, token, responder))
8133        } else {
8134            None
8135        }
8136    }
8137
8138    #[allow(irrefutable_let_patterns)]
8139    pub fn into_remove_rule(self) -> Option<(u32, RuleSetV6RemoveRuleResponder)> {
8140        if let RuleSetV6Request::RemoveRule { index, responder } = self {
8141            Some((index, responder))
8142        } else {
8143            None
8144        }
8145    }
8146
8147    #[allow(irrefutable_let_patterns)]
8148    pub fn into_close(self) -> Option<(RuleSetV6ControlHandle)> {
8149        if let RuleSetV6Request::Close { control_handle } = self {
8150            Some((control_handle))
8151        } else {
8152            None
8153        }
8154    }
8155
8156    #[allow(irrefutable_let_patterns)]
8157    pub fn into_add_rule(
8158        self,
8159    ) -> Option<(
8160        u32,
8161        fidl_fuchsia_net_routes::RuleMatcherV6,
8162        fidl_fuchsia_net_routes::RuleAction,
8163        RuleSetV6AddRuleResponder,
8164    )> {
8165        if let RuleSetV6Request::AddRule { index, matcher, action, responder } = self {
8166            Some((index, matcher, action, responder))
8167        } else {
8168            None
8169        }
8170    }
8171
8172    /// Name of the method defined in FIDL
8173    pub fn method_name(&self) -> &'static str {
8174        match *self {
8175            RuleSetV6Request::AuthenticateForRouteTable { .. } => "authenticate_for_route_table",
8176            RuleSetV6Request::RemoveRule { .. } => "remove_rule",
8177            RuleSetV6Request::Close { .. } => "close",
8178            RuleSetV6Request::AddRule { .. } => "add_rule",
8179        }
8180    }
8181}
8182
8183#[derive(Debug, Clone)]
8184pub struct RuleSetV6ControlHandle {
8185    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8186}
8187
8188impl fidl::endpoints::ControlHandle for RuleSetV6ControlHandle {
8189    fn shutdown(&self) {
8190        self.inner.shutdown()
8191    }
8192    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8193        self.inner.shutdown_with_epitaph(status)
8194    }
8195
8196    fn is_closed(&self) -> bool {
8197        self.inner.channel().is_closed()
8198    }
8199    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8200        self.inner.channel().on_closed()
8201    }
8202
8203    #[cfg(target_os = "fuchsia")]
8204    fn signal_peer(
8205        &self,
8206        clear_mask: zx::Signals,
8207        set_mask: zx::Signals,
8208    ) -> Result<(), zx_status::Status> {
8209        use fidl::Peered;
8210        self.inner.channel().signal_peer(clear_mask, set_mask)
8211    }
8212}
8213
8214impl RuleSetV6ControlHandle {}
8215
8216#[must_use = "FIDL methods require a response to be sent"]
8217#[derive(Debug)]
8218pub struct RuleSetV6AuthenticateForRouteTableResponder {
8219    control_handle: std::mem::ManuallyDrop<RuleSetV6ControlHandle>,
8220    tx_id: u32,
8221}
8222
8223/// Set the the channel to be shutdown (see [`RuleSetV6ControlHandle::shutdown`])
8224/// if the responder is dropped without sending a response, so that the client
8225/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8226impl std::ops::Drop for RuleSetV6AuthenticateForRouteTableResponder {
8227    fn drop(&mut self) {
8228        self.control_handle.shutdown();
8229        // Safety: drops once, never accessed again
8230        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8231    }
8232}
8233
8234impl fidl::endpoints::Responder for RuleSetV6AuthenticateForRouteTableResponder {
8235    type ControlHandle = RuleSetV6ControlHandle;
8236
8237    fn control_handle(&self) -> &RuleSetV6ControlHandle {
8238        &self.control_handle
8239    }
8240
8241    fn drop_without_shutdown(mut self) {
8242        // Safety: drops once, never accessed again due to mem::forget
8243        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8244        // Prevent Drop from running (which would shut down the channel)
8245        std::mem::forget(self);
8246    }
8247}
8248
8249impl RuleSetV6AuthenticateForRouteTableResponder {
8250    /// Sends a response to the FIDL transaction.
8251    ///
8252    /// Sets the channel to shutdown if an error occurs.
8253    pub fn send(
8254        self,
8255        mut result: Result<(), AuthenticateForRouteTableError>,
8256    ) -> Result<(), fidl::Error> {
8257        let _result = self.send_raw(result);
8258        if _result.is_err() {
8259            self.control_handle.shutdown();
8260        }
8261        self.drop_without_shutdown();
8262        _result
8263    }
8264
8265    /// Similar to "send" but does not shutdown the channel if an error occurs.
8266    pub fn send_no_shutdown_on_err(
8267        self,
8268        mut result: Result<(), AuthenticateForRouteTableError>,
8269    ) -> Result<(), fidl::Error> {
8270        let _result = self.send_raw(result);
8271        self.drop_without_shutdown();
8272        _result
8273    }
8274
8275    fn send_raw(
8276        &self,
8277        mut result: Result<(), AuthenticateForRouteTableError>,
8278    ) -> Result<(), fidl::Error> {
8279        self.control_handle.inner.send::<fidl::encoding::ResultType<
8280            fidl::encoding::EmptyStruct,
8281            AuthenticateForRouteTableError,
8282        >>(
8283            result,
8284            self.tx_id,
8285            0x6fd845360ed9bc8f,
8286            fidl::encoding::DynamicFlags::empty(),
8287        )
8288    }
8289}
8290
8291#[must_use = "FIDL methods require a response to be sent"]
8292#[derive(Debug)]
8293pub struct RuleSetV6RemoveRuleResponder {
8294    control_handle: std::mem::ManuallyDrop<RuleSetV6ControlHandle>,
8295    tx_id: u32,
8296}
8297
8298/// Set the the channel to be shutdown (see [`RuleSetV6ControlHandle::shutdown`])
8299/// if the responder is dropped without sending a response, so that the client
8300/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8301impl std::ops::Drop for RuleSetV6RemoveRuleResponder {
8302    fn drop(&mut self) {
8303        self.control_handle.shutdown();
8304        // Safety: drops once, never accessed again
8305        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8306    }
8307}
8308
8309impl fidl::endpoints::Responder for RuleSetV6RemoveRuleResponder {
8310    type ControlHandle = RuleSetV6ControlHandle;
8311
8312    fn control_handle(&self) -> &RuleSetV6ControlHandle {
8313        &self.control_handle
8314    }
8315
8316    fn drop_without_shutdown(mut self) {
8317        // Safety: drops once, never accessed again due to mem::forget
8318        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8319        // Prevent Drop from running (which would shut down the channel)
8320        std::mem::forget(self);
8321    }
8322}
8323
8324impl RuleSetV6RemoveRuleResponder {
8325    /// Sends a response to the FIDL transaction.
8326    ///
8327    /// Sets the channel to shutdown if an error occurs.
8328    pub fn send(self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
8329        let _result = self.send_raw(result);
8330        if _result.is_err() {
8331            self.control_handle.shutdown();
8332        }
8333        self.drop_without_shutdown();
8334        _result
8335    }
8336
8337    /// Similar to "send" but does not shutdown the channel if an error occurs.
8338    pub fn send_no_shutdown_on_err(
8339        self,
8340        mut result: Result<(), RuleSetError>,
8341    ) -> Result<(), fidl::Error> {
8342        let _result = self.send_raw(result);
8343        self.drop_without_shutdown();
8344        _result
8345    }
8346
8347    fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
8348        self.control_handle.inner.send::<fidl::encoding::ResultType<
8349            fidl::encoding::EmptyStruct,
8350            RuleSetError,
8351        >>(
8352            result,
8353            self.tx_id,
8354            0x2ae3d7e817cbff90,
8355            fidl::encoding::DynamicFlags::empty(),
8356        )
8357    }
8358}
8359
8360#[must_use = "FIDL methods require a response to be sent"]
8361#[derive(Debug)]
8362pub struct RuleSetV6AddRuleResponder {
8363    control_handle: std::mem::ManuallyDrop<RuleSetV6ControlHandle>,
8364    tx_id: u32,
8365}
8366
8367/// Set the the channel to be shutdown (see [`RuleSetV6ControlHandle::shutdown`])
8368/// if the responder is dropped without sending a response, so that the client
8369/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8370impl std::ops::Drop for RuleSetV6AddRuleResponder {
8371    fn drop(&mut self) {
8372        self.control_handle.shutdown();
8373        // Safety: drops once, never accessed again
8374        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8375    }
8376}
8377
8378impl fidl::endpoints::Responder for RuleSetV6AddRuleResponder {
8379    type ControlHandle = RuleSetV6ControlHandle;
8380
8381    fn control_handle(&self) -> &RuleSetV6ControlHandle {
8382        &self.control_handle
8383    }
8384
8385    fn drop_without_shutdown(mut self) {
8386        // Safety: drops once, never accessed again due to mem::forget
8387        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8388        // Prevent Drop from running (which would shut down the channel)
8389        std::mem::forget(self);
8390    }
8391}
8392
8393impl RuleSetV6AddRuleResponder {
8394    /// Sends a response to the FIDL transaction.
8395    ///
8396    /// Sets the channel to shutdown if an error occurs.
8397    pub fn send(self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
8398        let _result = self.send_raw(result);
8399        if _result.is_err() {
8400            self.control_handle.shutdown();
8401        }
8402        self.drop_without_shutdown();
8403        _result
8404    }
8405
8406    /// Similar to "send" but does not shutdown the channel if an error occurs.
8407    pub fn send_no_shutdown_on_err(
8408        self,
8409        mut result: Result<(), RuleSetError>,
8410    ) -> Result<(), fidl::Error> {
8411        let _result = self.send_raw(result);
8412        self.drop_without_shutdown();
8413        _result
8414    }
8415
8416    fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
8417        self.control_handle.inner.send::<fidl::encoding::ResultType<
8418            fidl::encoding::EmptyStruct,
8419            RuleSetError,
8420        >>(
8421            result,
8422            self.tx_id,
8423            0x946cad8f8a726b3,
8424            fidl::encoding::DynamicFlags::empty(),
8425        )
8426    }
8427}
8428
8429#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8430pub struct RuleTableV4Marker;
8431
8432impl fidl::endpoints::ProtocolMarker for RuleTableV4Marker {
8433    type Proxy = RuleTableV4Proxy;
8434    type RequestStream = RuleTableV4RequestStream;
8435    #[cfg(target_os = "fuchsia")]
8436    type SynchronousProxy = RuleTableV4SynchronousProxy;
8437
8438    const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RuleTableV4";
8439}
8440impl fidl::endpoints::DiscoverableProtocolMarker for RuleTableV4Marker {}
8441
8442pub trait RuleTableV4ProxyInterface: Send + Sync {
8443    fn r#new_rule_set(
8444        &self,
8445        priority: u32,
8446        rule_set: fidl::endpoints::ServerEnd<RuleSetV4Marker>,
8447    ) -> Result<(), fidl::Error>;
8448}
8449#[derive(Debug)]
8450#[cfg(target_os = "fuchsia")]
8451pub struct RuleTableV4SynchronousProxy {
8452    client: fidl::client::sync::Client,
8453}
8454
8455#[cfg(target_os = "fuchsia")]
8456impl fidl::endpoints::SynchronousProxy for RuleTableV4SynchronousProxy {
8457    type Proxy = RuleTableV4Proxy;
8458    type Protocol = RuleTableV4Marker;
8459
8460    fn from_channel(inner: fidl::Channel) -> Self {
8461        Self::new(inner)
8462    }
8463
8464    fn into_channel(self) -> fidl::Channel {
8465        self.client.into_channel()
8466    }
8467
8468    fn as_channel(&self) -> &fidl::Channel {
8469        self.client.as_channel()
8470    }
8471}
8472
8473#[cfg(target_os = "fuchsia")]
8474impl RuleTableV4SynchronousProxy {
8475    pub fn new(channel: fidl::Channel) -> Self {
8476        let protocol_name = <RuleTableV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8477        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8478    }
8479
8480    pub fn into_channel(self) -> fidl::Channel {
8481        self.client.into_channel()
8482    }
8483
8484    /// Waits until an event arrives and returns it. It is safe for other
8485    /// threads to make concurrent requests while waiting for an event.
8486    pub fn wait_for_event(
8487        &self,
8488        deadline: zx::MonotonicInstant,
8489    ) -> Result<RuleTableV4Event, fidl::Error> {
8490        RuleTableV4Event::decode(self.client.wait_for_event(deadline)?)
8491    }
8492
8493    /// Returns an empty rule set at requested priority.
8494    ///
8495    /// Clients are free to manage the rules within their own rule set, but not
8496    /// the rule set of others. Only one rule set is allowed at each `priority`
8497    /// level. Channel is closed with `ZX_ERR_ALREADY_EXISTS` if there's already
8498    /// a rule set at the given `priority`.
8499    ///
8500    /// + request `priority` the priority of this `RuleSetV4`, all rule sets are
8501    ///   globally ordered according to this number.
8502    /// + request `rule_set` grants access to the `RuleSetV4` protocol.
8503    pub fn r#new_rule_set(
8504        &self,
8505        mut priority: u32,
8506        mut rule_set: fidl::endpoints::ServerEnd<RuleSetV4Marker>,
8507    ) -> Result<(), fidl::Error> {
8508        self.client.send::<RuleTableV4NewRuleSetRequest>(
8509            (priority, rule_set),
8510            0xa32a9097da46f3a,
8511            fidl::encoding::DynamicFlags::empty(),
8512        )
8513    }
8514}
8515
8516#[cfg(target_os = "fuchsia")]
8517impl From<RuleTableV4SynchronousProxy> for zx::Handle {
8518    fn from(value: RuleTableV4SynchronousProxy) -> Self {
8519        value.into_channel().into()
8520    }
8521}
8522
8523#[cfg(target_os = "fuchsia")]
8524impl From<fidl::Channel> for RuleTableV4SynchronousProxy {
8525    fn from(value: fidl::Channel) -> Self {
8526        Self::new(value)
8527    }
8528}
8529
8530#[cfg(target_os = "fuchsia")]
8531impl fidl::endpoints::FromClient for RuleTableV4SynchronousProxy {
8532    type Protocol = RuleTableV4Marker;
8533
8534    fn from_client(value: fidl::endpoints::ClientEnd<RuleTableV4Marker>) -> Self {
8535        Self::new(value.into_channel())
8536    }
8537}
8538
8539#[derive(Debug, Clone)]
8540pub struct RuleTableV4Proxy {
8541    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8542}
8543
8544impl fidl::endpoints::Proxy for RuleTableV4Proxy {
8545    type Protocol = RuleTableV4Marker;
8546
8547    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8548        Self::new(inner)
8549    }
8550
8551    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8552        self.client.into_channel().map_err(|client| Self { client })
8553    }
8554
8555    fn as_channel(&self) -> &::fidl::AsyncChannel {
8556        self.client.as_channel()
8557    }
8558}
8559
8560impl RuleTableV4Proxy {
8561    /// Create a new Proxy for fuchsia.net.routes.admin/RuleTableV4.
8562    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8563        let protocol_name = <RuleTableV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8564        Self { client: fidl::client::Client::new(channel, protocol_name) }
8565    }
8566
8567    /// Get a Stream of events from the remote end of the protocol.
8568    ///
8569    /// # Panics
8570    ///
8571    /// Panics if the event stream was already taken.
8572    pub fn take_event_stream(&self) -> RuleTableV4EventStream {
8573        RuleTableV4EventStream { event_receiver: self.client.take_event_receiver() }
8574    }
8575
8576    /// Returns an empty rule set at requested priority.
8577    ///
8578    /// Clients are free to manage the rules within their own rule set, but not
8579    /// the rule set of others. Only one rule set is allowed at each `priority`
8580    /// level. Channel is closed with `ZX_ERR_ALREADY_EXISTS` if there's already
8581    /// a rule set at the given `priority`.
8582    ///
8583    /// + request `priority` the priority of this `RuleSetV4`, all rule sets are
8584    ///   globally ordered according to this number.
8585    /// + request `rule_set` grants access to the `RuleSetV4` protocol.
8586    pub fn r#new_rule_set(
8587        &self,
8588        mut priority: u32,
8589        mut rule_set: fidl::endpoints::ServerEnd<RuleSetV4Marker>,
8590    ) -> Result<(), fidl::Error> {
8591        RuleTableV4ProxyInterface::r#new_rule_set(self, priority, rule_set)
8592    }
8593}
8594
8595impl RuleTableV4ProxyInterface for RuleTableV4Proxy {
8596    fn r#new_rule_set(
8597        &self,
8598        mut priority: u32,
8599        mut rule_set: fidl::endpoints::ServerEnd<RuleSetV4Marker>,
8600    ) -> Result<(), fidl::Error> {
8601        self.client.send::<RuleTableV4NewRuleSetRequest>(
8602            (priority, rule_set),
8603            0xa32a9097da46f3a,
8604            fidl::encoding::DynamicFlags::empty(),
8605        )
8606    }
8607}
8608
8609pub struct RuleTableV4EventStream {
8610    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8611}
8612
8613impl std::marker::Unpin for RuleTableV4EventStream {}
8614
8615impl futures::stream::FusedStream for RuleTableV4EventStream {
8616    fn is_terminated(&self) -> bool {
8617        self.event_receiver.is_terminated()
8618    }
8619}
8620
8621impl futures::Stream for RuleTableV4EventStream {
8622    type Item = Result<RuleTableV4Event, fidl::Error>;
8623
8624    fn poll_next(
8625        mut self: std::pin::Pin<&mut Self>,
8626        cx: &mut std::task::Context<'_>,
8627    ) -> std::task::Poll<Option<Self::Item>> {
8628        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8629            &mut self.event_receiver,
8630            cx
8631        )?) {
8632            Some(buf) => std::task::Poll::Ready(Some(RuleTableV4Event::decode(buf))),
8633            None => std::task::Poll::Ready(None),
8634        }
8635    }
8636}
8637
8638#[derive(Debug)]
8639pub enum RuleTableV4Event {}
8640
8641impl RuleTableV4Event {
8642    /// Decodes a message buffer as a [`RuleTableV4Event`].
8643    fn decode(
8644        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8645    ) -> Result<RuleTableV4Event, fidl::Error> {
8646        let (bytes, _handles) = buf.split_mut();
8647        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8648        debug_assert_eq!(tx_header.tx_id, 0);
8649        match tx_header.ordinal {
8650            _ => Err(fidl::Error::UnknownOrdinal {
8651                ordinal: tx_header.ordinal,
8652                protocol_name: <RuleTableV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8653            }),
8654        }
8655    }
8656}
8657
8658/// A Stream of incoming requests for fuchsia.net.routes.admin/RuleTableV4.
8659pub struct RuleTableV4RequestStream {
8660    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8661    is_terminated: bool,
8662}
8663
8664impl std::marker::Unpin for RuleTableV4RequestStream {}
8665
8666impl futures::stream::FusedStream for RuleTableV4RequestStream {
8667    fn is_terminated(&self) -> bool {
8668        self.is_terminated
8669    }
8670}
8671
8672impl fidl::endpoints::RequestStream for RuleTableV4RequestStream {
8673    type Protocol = RuleTableV4Marker;
8674    type ControlHandle = RuleTableV4ControlHandle;
8675
8676    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8677        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8678    }
8679
8680    fn control_handle(&self) -> Self::ControlHandle {
8681        RuleTableV4ControlHandle { inner: self.inner.clone() }
8682    }
8683
8684    fn into_inner(
8685        self,
8686    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8687    {
8688        (self.inner, self.is_terminated)
8689    }
8690
8691    fn from_inner(
8692        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8693        is_terminated: bool,
8694    ) -> Self {
8695        Self { inner, is_terminated }
8696    }
8697}
8698
8699impl futures::Stream for RuleTableV4RequestStream {
8700    type Item = Result<RuleTableV4Request, fidl::Error>;
8701
8702    fn poll_next(
8703        mut self: std::pin::Pin<&mut Self>,
8704        cx: &mut std::task::Context<'_>,
8705    ) -> std::task::Poll<Option<Self::Item>> {
8706        let this = &mut *self;
8707        if this.inner.check_shutdown(cx) {
8708            this.is_terminated = true;
8709            return std::task::Poll::Ready(None);
8710        }
8711        if this.is_terminated {
8712            panic!("polled RuleTableV4RequestStream after completion");
8713        }
8714        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8715            |bytes, handles| {
8716                match this.inner.channel().read_etc(cx, bytes, handles) {
8717                    std::task::Poll::Ready(Ok(())) => {}
8718                    std::task::Poll::Pending => return std::task::Poll::Pending,
8719                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8720                        this.is_terminated = true;
8721                        return std::task::Poll::Ready(None);
8722                    }
8723                    std::task::Poll::Ready(Err(e)) => {
8724                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8725                            e.into(),
8726                        ))));
8727                    }
8728                }
8729
8730                // A message has been received from the channel
8731                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8732
8733                std::task::Poll::Ready(Some(match header.ordinal {
8734                    0xa32a9097da46f3a => {
8735                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8736                        let mut req = fidl::new_empty!(
8737                            RuleTableV4NewRuleSetRequest,
8738                            fidl::encoding::DefaultFuchsiaResourceDialect
8739                        );
8740                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RuleTableV4NewRuleSetRequest>(&header, _body_bytes, handles, &mut req)?;
8741                        let control_handle = RuleTableV4ControlHandle { inner: this.inner.clone() };
8742                        Ok(RuleTableV4Request::NewRuleSet {
8743                            priority: req.priority,
8744                            rule_set: req.rule_set,
8745
8746                            control_handle,
8747                        })
8748                    }
8749                    _ => Err(fidl::Error::UnknownOrdinal {
8750                        ordinal: header.ordinal,
8751                        protocol_name:
8752                            <RuleTableV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8753                    }),
8754                }))
8755            },
8756        )
8757    }
8758}
8759
8760/// Gives isolated access to the system's policy routing rules.
8761#[derive(Debug)]
8762pub enum RuleTableV4Request {
8763    /// Returns an empty rule set at requested priority.
8764    ///
8765    /// Clients are free to manage the rules within their own rule set, but not
8766    /// the rule set of others. Only one rule set is allowed at each `priority`
8767    /// level. Channel is closed with `ZX_ERR_ALREADY_EXISTS` if there's already
8768    /// a rule set at the given `priority`.
8769    ///
8770    /// + request `priority` the priority of this `RuleSetV4`, all rule sets are
8771    ///   globally ordered according to this number.
8772    /// + request `rule_set` grants access to the `RuleSetV4` protocol.
8773    NewRuleSet {
8774        priority: u32,
8775        rule_set: fidl::endpoints::ServerEnd<RuleSetV4Marker>,
8776        control_handle: RuleTableV4ControlHandle,
8777    },
8778}
8779
8780impl RuleTableV4Request {
8781    #[allow(irrefutable_let_patterns)]
8782    pub fn into_new_rule_set(
8783        self,
8784    ) -> Option<(u32, fidl::endpoints::ServerEnd<RuleSetV4Marker>, RuleTableV4ControlHandle)> {
8785        if let RuleTableV4Request::NewRuleSet { priority, rule_set, control_handle } = self {
8786            Some((priority, rule_set, control_handle))
8787        } else {
8788            None
8789        }
8790    }
8791
8792    /// Name of the method defined in FIDL
8793    pub fn method_name(&self) -> &'static str {
8794        match *self {
8795            RuleTableV4Request::NewRuleSet { .. } => "new_rule_set",
8796        }
8797    }
8798}
8799
8800#[derive(Debug, Clone)]
8801pub struct RuleTableV4ControlHandle {
8802    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8803}
8804
8805impl fidl::endpoints::ControlHandle for RuleTableV4ControlHandle {
8806    fn shutdown(&self) {
8807        self.inner.shutdown()
8808    }
8809    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8810        self.inner.shutdown_with_epitaph(status)
8811    }
8812
8813    fn is_closed(&self) -> bool {
8814        self.inner.channel().is_closed()
8815    }
8816    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8817        self.inner.channel().on_closed()
8818    }
8819
8820    #[cfg(target_os = "fuchsia")]
8821    fn signal_peer(
8822        &self,
8823        clear_mask: zx::Signals,
8824        set_mask: zx::Signals,
8825    ) -> Result<(), zx_status::Status> {
8826        use fidl::Peered;
8827        self.inner.channel().signal_peer(clear_mask, set_mask)
8828    }
8829}
8830
8831impl RuleTableV4ControlHandle {}
8832
8833#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8834pub struct RuleTableV6Marker;
8835
8836impl fidl::endpoints::ProtocolMarker for RuleTableV6Marker {
8837    type Proxy = RuleTableV6Proxy;
8838    type RequestStream = RuleTableV6RequestStream;
8839    #[cfg(target_os = "fuchsia")]
8840    type SynchronousProxy = RuleTableV6SynchronousProxy;
8841
8842    const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RuleTableV6";
8843}
8844impl fidl::endpoints::DiscoverableProtocolMarker for RuleTableV6Marker {}
8845
8846pub trait RuleTableV6ProxyInterface: Send + Sync {
8847    fn r#new_rule_set(
8848        &self,
8849        priority: u32,
8850        rule_set: fidl::endpoints::ServerEnd<RuleSetV6Marker>,
8851    ) -> Result<(), fidl::Error>;
8852}
8853#[derive(Debug)]
8854#[cfg(target_os = "fuchsia")]
8855pub struct RuleTableV6SynchronousProxy {
8856    client: fidl::client::sync::Client,
8857}
8858
8859#[cfg(target_os = "fuchsia")]
8860impl fidl::endpoints::SynchronousProxy for RuleTableV6SynchronousProxy {
8861    type Proxy = RuleTableV6Proxy;
8862    type Protocol = RuleTableV6Marker;
8863
8864    fn from_channel(inner: fidl::Channel) -> Self {
8865        Self::new(inner)
8866    }
8867
8868    fn into_channel(self) -> fidl::Channel {
8869        self.client.into_channel()
8870    }
8871
8872    fn as_channel(&self) -> &fidl::Channel {
8873        self.client.as_channel()
8874    }
8875}
8876
8877#[cfg(target_os = "fuchsia")]
8878impl RuleTableV6SynchronousProxy {
8879    pub fn new(channel: fidl::Channel) -> Self {
8880        let protocol_name = <RuleTableV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8881        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8882    }
8883
8884    pub fn into_channel(self) -> fidl::Channel {
8885        self.client.into_channel()
8886    }
8887
8888    /// Waits until an event arrives and returns it. It is safe for other
8889    /// threads to make concurrent requests while waiting for an event.
8890    pub fn wait_for_event(
8891        &self,
8892        deadline: zx::MonotonicInstant,
8893    ) -> Result<RuleTableV6Event, fidl::Error> {
8894        RuleTableV6Event::decode(self.client.wait_for_event(deadline)?)
8895    }
8896
8897    /// Returns an empty rule set at requested priority.
8898    ///
8899    /// Clients are free to manage the rules within their own rule set, but not
8900    /// the rule set of others. Only one rule set is allowed at each `priority`
8901    /// level. Channel is closed with `ZX_ERR_ALREADY_EXISTS` if there's already
8902    /// a rule set at the given `priority`.
8903    ///
8904    /// + request `priority` the priority of this `RuleSetV6`, all rule sets are
8905    ///   globally ordered according to this number.
8906    /// + request `rule_set` grants access to the `RuleSetV6` protocol.
8907    pub fn r#new_rule_set(
8908        &self,
8909        mut priority: u32,
8910        mut rule_set: fidl::endpoints::ServerEnd<RuleSetV6Marker>,
8911    ) -> Result<(), fidl::Error> {
8912        self.client.send::<RuleTableV6NewRuleSetRequest>(
8913            (priority, rule_set),
8914            0x2261cc6eee9726a0,
8915            fidl::encoding::DynamicFlags::empty(),
8916        )
8917    }
8918}
8919
8920#[cfg(target_os = "fuchsia")]
8921impl From<RuleTableV6SynchronousProxy> for zx::Handle {
8922    fn from(value: RuleTableV6SynchronousProxy) -> Self {
8923        value.into_channel().into()
8924    }
8925}
8926
8927#[cfg(target_os = "fuchsia")]
8928impl From<fidl::Channel> for RuleTableV6SynchronousProxy {
8929    fn from(value: fidl::Channel) -> Self {
8930        Self::new(value)
8931    }
8932}
8933
8934#[cfg(target_os = "fuchsia")]
8935impl fidl::endpoints::FromClient for RuleTableV6SynchronousProxy {
8936    type Protocol = RuleTableV6Marker;
8937
8938    fn from_client(value: fidl::endpoints::ClientEnd<RuleTableV6Marker>) -> Self {
8939        Self::new(value.into_channel())
8940    }
8941}
8942
8943#[derive(Debug, Clone)]
8944pub struct RuleTableV6Proxy {
8945    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8946}
8947
8948impl fidl::endpoints::Proxy for RuleTableV6Proxy {
8949    type Protocol = RuleTableV6Marker;
8950
8951    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8952        Self::new(inner)
8953    }
8954
8955    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8956        self.client.into_channel().map_err(|client| Self { client })
8957    }
8958
8959    fn as_channel(&self) -> &::fidl::AsyncChannel {
8960        self.client.as_channel()
8961    }
8962}
8963
8964impl RuleTableV6Proxy {
8965    /// Create a new Proxy for fuchsia.net.routes.admin/RuleTableV6.
8966    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8967        let protocol_name = <RuleTableV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8968        Self { client: fidl::client::Client::new(channel, protocol_name) }
8969    }
8970
8971    /// Get a Stream of events from the remote end of the protocol.
8972    ///
8973    /// # Panics
8974    ///
8975    /// Panics if the event stream was already taken.
8976    pub fn take_event_stream(&self) -> RuleTableV6EventStream {
8977        RuleTableV6EventStream { event_receiver: self.client.take_event_receiver() }
8978    }
8979
8980    /// Returns an empty rule set at requested priority.
8981    ///
8982    /// Clients are free to manage the rules within their own rule set, but not
8983    /// the rule set of others. Only one rule set is allowed at each `priority`
8984    /// level. Channel is closed with `ZX_ERR_ALREADY_EXISTS` if there's already
8985    /// a rule set at the given `priority`.
8986    ///
8987    /// + request `priority` the priority of this `RuleSetV6`, all rule sets are
8988    ///   globally ordered according to this number.
8989    /// + request `rule_set` grants access to the `RuleSetV6` protocol.
8990    pub fn r#new_rule_set(
8991        &self,
8992        mut priority: u32,
8993        mut rule_set: fidl::endpoints::ServerEnd<RuleSetV6Marker>,
8994    ) -> Result<(), fidl::Error> {
8995        RuleTableV6ProxyInterface::r#new_rule_set(self, priority, rule_set)
8996    }
8997}
8998
8999impl RuleTableV6ProxyInterface for RuleTableV6Proxy {
9000    fn r#new_rule_set(
9001        &self,
9002        mut priority: u32,
9003        mut rule_set: fidl::endpoints::ServerEnd<RuleSetV6Marker>,
9004    ) -> Result<(), fidl::Error> {
9005        self.client.send::<RuleTableV6NewRuleSetRequest>(
9006            (priority, rule_set),
9007            0x2261cc6eee9726a0,
9008            fidl::encoding::DynamicFlags::empty(),
9009        )
9010    }
9011}
9012
9013pub struct RuleTableV6EventStream {
9014    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
9015}
9016
9017impl std::marker::Unpin for RuleTableV6EventStream {}
9018
9019impl futures::stream::FusedStream for RuleTableV6EventStream {
9020    fn is_terminated(&self) -> bool {
9021        self.event_receiver.is_terminated()
9022    }
9023}
9024
9025impl futures::Stream for RuleTableV6EventStream {
9026    type Item = Result<RuleTableV6Event, fidl::Error>;
9027
9028    fn poll_next(
9029        mut self: std::pin::Pin<&mut Self>,
9030        cx: &mut std::task::Context<'_>,
9031    ) -> std::task::Poll<Option<Self::Item>> {
9032        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
9033            &mut self.event_receiver,
9034            cx
9035        )?) {
9036            Some(buf) => std::task::Poll::Ready(Some(RuleTableV6Event::decode(buf))),
9037            None => std::task::Poll::Ready(None),
9038        }
9039    }
9040}
9041
9042#[derive(Debug)]
9043pub enum RuleTableV6Event {}
9044
9045impl RuleTableV6Event {
9046    /// Decodes a message buffer as a [`RuleTableV6Event`].
9047    fn decode(
9048        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
9049    ) -> Result<RuleTableV6Event, fidl::Error> {
9050        let (bytes, _handles) = buf.split_mut();
9051        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9052        debug_assert_eq!(tx_header.tx_id, 0);
9053        match tx_header.ordinal {
9054            _ => Err(fidl::Error::UnknownOrdinal {
9055                ordinal: tx_header.ordinal,
9056                protocol_name: <RuleTableV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9057            }),
9058        }
9059    }
9060}
9061
9062/// A Stream of incoming requests for fuchsia.net.routes.admin/RuleTableV6.
9063pub struct RuleTableV6RequestStream {
9064    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9065    is_terminated: bool,
9066}
9067
9068impl std::marker::Unpin for RuleTableV6RequestStream {}
9069
9070impl futures::stream::FusedStream for RuleTableV6RequestStream {
9071    fn is_terminated(&self) -> bool {
9072        self.is_terminated
9073    }
9074}
9075
9076impl fidl::endpoints::RequestStream for RuleTableV6RequestStream {
9077    type Protocol = RuleTableV6Marker;
9078    type ControlHandle = RuleTableV6ControlHandle;
9079
9080    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
9081        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
9082    }
9083
9084    fn control_handle(&self) -> Self::ControlHandle {
9085        RuleTableV6ControlHandle { inner: self.inner.clone() }
9086    }
9087
9088    fn into_inner(
9089        self,
9090    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
9091    {
9092        (self.inner, self.is_terminated)
9093    }
9094
9095    fn from_inner(
9096        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9097        is_terminated: bool,
9098    ) -> Self {
9099        Self { inner, is_terminated }
9100    }
9101}
9102
9103impl futures::Stream for RuleTableV6RequestStream {
9104    type Item = Result<RuleTableV6Request, fidl::Error>;
9105
9106    fn poll_next(
9107        mut self: std::pin::Pin<&mut Self>,
9108        cx: &mut std::task::Context<'_>,
9109    ) -> std::task::Poll<Option<Self::Item>> {
9110        let this = &mut *self;
9111        if this.inner.check_shutdown(cx) {
9112            this.is_terminated = true;
9113            return std::task::Poll::Ready(None);
9114        }
9115        if this.is_terminated {
9116            panic!("polled RuleTableV6RequestStream after completion");
9117        }
9118        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
9119            |bytes, handles| {
9120                match this.inner.channel().read_etc(cx, bytes, handles) {
9121                    std::task::Poll::Ready(Ok(())) => {}
9122                    std::task::Poll::Pending => return std::task::Poll::Pending,
9123                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
9124                        this.is_terminated = true;
9125                        return std::task::Poll::Ready(None);
9126                    }
9127                    std::task::Poll::Ready(Err(e)) => {
9128                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
9129                            e.into(),
9130                        ))));
9131                    }
9132                }
9133
9134                // A message has been received from the channel
9135                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
9136
9137                std::task::Poll::Ready(Some(match header.ordinal {
9138                    0x2261cc6eee9726a0 => {
9139                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
9140                        let mut req = fidl::new_empty!(
9141                            RuleTableV6NewRuleSetRequest,
9142                            fidl::encoding::DefaultFuchsiaResourceDialect
9143                        );
9144                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RuleTableV6NewRuleSetRequest>(&header, _body_bytes, handles, &mut req)?;
9145                        let control_handle = RuleTableV6ControlHandle { inner: this.inner.clone() };
9146                        Ok(RuleTableV6Request::NewRuleSet {
9147                            priority: req.priority,
9148                            rule_set: req.rule_set,
9149
9150                            control_handle,
9151                        })
9152                    }
9153                    _ => Err(fidl::Error::UnknownOrdinal {
9154                        ordinal: header.ordinal,
9155                        protocol_name:
9156                            <RuleTableV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
9157                    }),
9158                }))
9159            },
9160        )
9161    }
9162}
9163
9164/// Gives isolated access to the system's policy routing rules.
9165#[derive(Debug)]
9166pub enum RuleTableV6Request {
9167    /// Returns an empty rule set at requested priority.
9168    ///
9169    /// Clients are free to manage the rules within their own rule set, but not
9170    /// the rule set of others. Only one rule set is allowed at each `priority`
9171    /// level. Channel is closed with `ZX_ERR_ALREADY_EXISTS` if there's already
9172    /// a rule set at the given `priority`.
9173    ///
9174    /// + request `priority` the priority of this `RuleSetV6`, all rule sets are
9175    ///   globally ordered according to this number.
9176    /// + request `rule_set` grants access to the `RuleSetV6` protocol.
9177    NewRuleSet {
9178        priority: u32,
9179        rule_set: fidl::endpoints::ServerEnd<RuleSetV6Marker>,
9180        control_handle: RuleTableV6ControlHandle,
9181    },
9182}
9183
9184impl RuleTableV6Request {
9185    #[allow(irrefutable_let_patterns)]
9186    pub fn into_new_rule_set(
9187        self,
9188    ) -> Option<(u32, fidl::endpoints::ServerEnd<RuleSetV6Marker>, RuleTableV6ControlHandle)> {
9189        if let RuleTableV6Request::NewRuleSet { priority, rule_set, control_handle } = self {
9190            Some((priority, rule_set, control_handle))
9191        } else {
9192            None
9193        }
9194    }
9195
9196    /// Name of the method defined in FIDL
9197    pub fn method_name(&self) -> &'static str {
9198        match *self {
9199            RuleTableV6Request::NewRuleSet { .. } => "new_rule_set",
9200        }
9201    }
9202}
9203
9204#[derive(Debug, Clone)]
9205pub struct RuleTableV6ControlHandle {
9206    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
9207}
9208
9209impl fidl::endpoints::ControlHandle for RuleTableV6ControlHandle {
9210    fn shutdown(&self) {
9211        self.inner.shutdown()
9212    }
9213    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
9214        self.inner.shutdown_with_epitaph(status)
9215    }
9216
9217    fn is_closed(&self) -> bool {
9218        self.inner.channel().is_closed()
9219    }
9220    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
9221        self.inner.channel().on_closed()
9222    }
9223
9224    #[cfg(target_os = "fuchsia")]
9225    fn signal_peer(
9226        &self,
9227        clear_mask: zx::Signals,
9228        set_mask: zx::Signals,
9229    ) -> Result<(), zx_status::Status> {
9230        use fidl::Peered;
9231        self.inner.channel().signal_peer(clear_mask, set_mask)
9232    }
9233}
9234
9235impl RuleTableV6ControlHandle {}
9236
9237mod internal {
9238    use super::*;
9239
9240    impl fidl::encoding::ResourceTypeMarker for BaseRouteTableGetAuthorizationForRouteTableResponse {
9241        type Borrowed<'a> = &'a mut Self;
9242        fn take_or_borrow<'a>(
9243            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9244        ) -> Self::Borrowed<'a> {
9245            value
9246        }
9247    }
9248
9249    unsafe impl fidl::encoding::TypeMarker for BaseRouteTableGetAuthorizationForRouteTableResponse {
9250        type Owned = Self;
9251
9252        #[inline(always)]
9253        fn inline_align(_context: fidl::encoding::Context) -> usize {
9254            4
9255        }
9256
9257        #[inline(always)]
9258        fn inline_size(_context: fidl::encoding::Context) -> usize {
9259            8
9260        }
9261    }
9262
9263    unsafe impl
9264        fidl::encoding::Encode<
9265            BaseRouteTableGetAuthorizationForRouteTableResponse,
9266            fidl::encoding::DefaultFuchsiaResourceDialect,
9267        > for &mut BaseRouteTableGetAuthorizationForRouteTableResponse
9268    {
9269        #[inline]
9270        unsafe fn encode(
9271            self,
9272            encoder: &mut fidl::encoding::Encoder<
9273                '_,
9274                fidl::encoding::DefaultFuchsiaResourceDialect,
9275            >,
9276            offset: usize,
9277            _depth: fidl::encoding::Depth,
9278        ) -> fidl::Result<()> {
9279            encoder
9280                .debug_check_bounds::<BaseRouteTableGetAuthorizationForRouteTableResponse>(offset);
9281            // Delegate to tuple encoding.
9282            fidl::encoding::Encode::<BaseRouteTableGetAuthorizationForRouteTableResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9283                (
9284                    <GrantForRouteTableAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
9285                ),
9286                encoder, offset, _depth
9287            )
9288        }
9289    }
9290    unsafe impl<
9291        T0: fidl::encoding::Encode<
9292                GrantForRouteTableAuthorization,
9293                fidl::encoding::DefaultFuchsiaResourceDialect,
9294            >,
9295    >
9296        fidl::encoding::Encode<
9297            BaseRouteTableGetAuthorizationForRouteTableResponse,
9298            fidl::encoding::DefaultFuchsiaResourceDialect,
9299        > for (T0,)
9300    {
9301        #[inline]
9302        unsafe fn encode(
9303            self,
9304            encoder: &mut fidl::encoding::Encoder<
9305                '_,
9306                fidl::encoding::DefaultFuchsiaResourceDialect,
9307            >,
9308            offset: usize,
9309            depth: fidl::encoding::Depth,
9310        ) -> fidl::Result<()> {
9311            encoder
9312                .debug_check_bounds::<BaseRouteTableGetAuthorizationForRouteTableResponse>(offset);
9313            // Zero out padding regions. There's no need to apply masks
9314            // because the unmasked parts will be overwritten by fields.
9315            // Write the fields.
9316            self.0.encode(encoder, offset + 0, depth)?;
9317            Ok(())
9318        }
9319    }
9320
9321    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9322        for BaseRouteTableGetAuthorizationForRouteTableResponse
9323    {
9324        #[inline(always)]
9325        fn new_empty() -> Self {
9326            Self {
9327                credential: fidl::new_empty!(
9328                    GrantForRouteTableAuthorization,
9329                    fidl::encoding::DefaultFuchsiaResourceDialect
9330                ),
9331            }
9332        }
9333
9334        #[inline]
9335        unsafe fn decode(
9336            &mut self,
9337            decoder: &mut fidl::encoding::Decoder<
9338                '_,
9339                fidl::encoding::DefaultFuchsiaResourceDialect,
9340            >,
9341            offset: usize,
9342            _depth: fidl::encoding::Depth,
9343        ) -> fidl::Result<()> {
9344            decoder.debug_check_bounds::<Self>(offset);
9345            // Verify that padding bytes are zero.
9346            fidl::decode!(
9347                GrantForRouteTableAuthorization,
9348                fidl::encoding::DefaultFuchsiaResourceDialect,
9349                &mut self.credential,
9350                decoder,
9351                offset + 0,
9352                _depth
9353            )?;
9354            Ok(())
9355        }
9356    }
9357
9358    impl fidl::encoding::ResourceTypeMarker for GrantForRouteTableAuthorization {
9359        type Borrowed<'a> = &'a mut Self;
9360        fn take_or_borrow<'a>(
9361            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9362        ) -> Self::Borrowed<'a> {
9363            value
9364        }
9365    }
9366
9367    unsafe impl fidl::encoding::TypeMarker for GrantForRouteTableAuthorization {
9368        type Owned = Self;
9369
9370        #[inline(always)]
9371        fn inline_align(_context: fidl::encoding::Context) -> usize {
9372            4
9373        }
9374
9375        #[inline(always)]
9376        fn inline_size(_context: fidl::encoding::Context) -> usize {
9377            8
9378        }
9379    }
9380
9381    unsafe impl
9382        fidl::encoding::Encode<
9383            GrantForRouteTableAuthorization,
9384            fidl::encoding::DefaultFuchsiaResourceDialect,
9385        > for &mut GrantForRouteTableAuthorization
9386    {
9387        #[inline]
9388        unsafe fn encode(
9389            self,
9390            encoder: &mut fidl::encoding::Encoder<
9391                '_,
9392                fidl::encoding::DefaultFuchsiaResourceDialect,
9393            >,
9394            offset: usize,
9395            _depth: fidl::encoding::Depth,
9396        ) -> fidl::Result<()> {
9397            encoder.debug_check_bounds::<GrantForRouteTableAuthorization>(offset);
9398            // Delegate to tuple encoding.
9399            fidl::encoding::Encode::<
9400                GrantForRouteTableAuthorization,
9401                fidl::encoding::DefaultFuchsiaResourceDialect,
9402            >::encode(
9403                (
9404                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.table_id),
9405                    <fidl::encoding::HandleType<
9406                        fidl::Event,
9407                        { fidl::ObjectType::EVENT.into_raw() },
9408                        3,
9409                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9410                        &mut self.token
9411                    ),
9412                ),
9413                encoder,
9414                offset,
9415                _depth,
9416            )
9417        }
9418    }
9419    unsafe impl<
9420        T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
9421        T1: fidl::encoding::Encode<
9422                fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 3>,
9423                fidl::encoding::DefaultFuchsiaResourceDialect,
9424            >,
9425    >
9426        fidl::encoding::Encode<
9427            GrantForRouteTableAuthorization,
9428            fidl::encoding::DefaultFuchsiaResourceDialect,
9429        > for (T0, T1)
9430    {
9431        #[inline]
9432        unsafe fn encode(
9433            self,
9434            encoder: &mut fidl::encoding::Encoder<
9435                '_,
9436                fidl::encoding::DefaultFuchsiaResourceDialect,
9437            >,
9438            offset: usize,
9439            depth: fidl::encoding::Depth,
9440        ) -> fidl::Result<()> {
9441            encoder.debug_check_bounds::<GrantForRouteTableAuthorization>(offset);
9442            // Zero out padding regions. There's no need to apply masks
9443            // because the unmasked parts will be overwritten by fields.
9444            // Write the fields.
9445            self.0.encode(encoder, offset + 0, depth)?;
9446            self.1.encode(encoder, offset + 4, depth)?;
9447            Ok(())
9448        }
9449    }
9450
9451    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9452        for GrantForRouteTableAuthorization
9453    {
9454        #[inline(always)]
9455        fn new_empty() -> Self {
9456            Self {
9457                table_id: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
9458                token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 3>, fidl::encoding::DefaultFuchsiaResourceDialect),
9459            }
9460        }
9461
9462        #[inline]
9463        unsafe fn decode(
9464            &mut self,
9465            decoder: &mut fidl::encoding::Decoder<
9466                '_,
9467                fidl::encoding::DefaultFuchsiaResourceDialect,
9468            >,
9469            offset: usize,
9470            _depth: fidl::encoding::Depth,
9471        ) -> fidl::Result<()> {
9472            decoder.debug_check_bounds::<Self>(offset);
9473            // Verify that padding bytes are zero.
9474            fidl::decode!(
9475                u32,
9476                fidl::encoding::DefaultFuchsiaResourceDialect,
9477                &mut self.table_id,
9478                decoder,
9479                offset + 0,
9480                _depth
9481            )?;
9482            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 3>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 4, _depth)?;
9483            Ok(())
9484        }
9485    }
9486
9487    impl fidl::encoding::ResourceTypeMarker for ProofOfRouteTableAuthorization {
9488        type Borrowed<'a> = &'a mut Self;
9489        fn take_or_borrow<'a>(
9490            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9491        ) -> Self::Borrowed<'a> {
9492            value
9493        }
9494    }
9495
9496    unsafe impl fidl::encoding::TypeMarker for ProofOfRouteTableAuthorization {
9497        type Owned = Self;
9498
9499        #[inline(always)]
9500        fn inline_align(_context: fidl::encoding::Context) -> usize {
9501            4
9502        }
9503
9504        #[inline(always)]
9505        fn inline_size(_context: fidl::encoding::Context) -> usize {
9506            8
9507        }
9508    }
9509
9510    unsafe impl
9511        fidl::encoding::Encode<
9512            ProofOfRouteTableAuthorization,
9513            fidl::encoding::DefaultFuchsiaResourceDialect,
9514        > for &mut ProofOfRouteTableAuthorization
9515    {
9516        #[inline]
9517        unsafe fn encode(
9518            self,
9519            encoder: &mut fidl::encoding::Encoder<
9520                '_,
9521                fidl::encoding::DefaultFuchsiaResourceDialect,
9522            >,
9523            offset: usize,
9524            _depth: fidl::encoding::Depth,
9525        ) -> fidl::Result<()> {
9526            encoder.debug_check_bounds::<ProofOfRouteTableAuthorization>(offset);
9527            // Delegate to tuple encoding.
9528            fidl::encoding::Encode::<
9529                ProofOfRouteTableAuthorization,
9530                fidl::encoding::DefaultFuchsiaResourceDialect,
9531            >::encode(
9532                (
9533                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.table),
9534                    <fidl::encoding::HandleType<
9535                        fidl::Event,
9536                        { fidl::ObjectType::EVENT.into_raw() },
9537                        0,
9538                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9539                        &mut self.token
9540                    ),
9541                ),
9542                encoder,
9543                offset,
9544                _depth,
9545            )
9546        }
9547    }
9548    unsafe impl<
9549        T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
9550        T1: fidl::encoding::Encode<
9551                fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 0>,
9552                fidl::encoding::DefaultFuchsiaResourceDialect,
9553            >,
9554    >
9555        fidl::encoding::Encode<
9556            ProofOfRouteTableAuthorization,
9557            fidl::encoding::DefaultFuchsiaResourceDialect,
9558        > for (T0, T1)
9559    {
9560        #[inline]
9561        unsafe fn encode(
9562            self,
9563            encoder: &mut fidl::encoding::Encoder<
9564                '_,
9565                fidl::encoding::DefaultFuchsiaResourceDialect,
9566            >,
9567            offset: usize,
9568            depth: fidl::encoding::Depth,
9569        ) -> fidl::Result<()> {
9570            encoder.debug_check_bounds::<ProofOfRouteTableAuthorization>(offset);
9571            // Zero out padding regions. There's no need to apply masks
9572            // because the unmasked parts will be overwritten by fields.
9573            // Write the fields.
9574            self.0.encode(encoder, offset + 0, depth)?;
9575            self.1.encode(encoder, offset + 4, depth)?;
9576            Ok(())
9577        }
9578    }
9579
9580    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9581        for ProofOfRouteTableAuthorization
9582    {
9583        #[inline(always)]
9584        fn new_empty() -> Self {
9585            Self {
9586                table: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
9587                token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 0>, fidl::encoding::DefaultFuchsiaResourceDialect),
9588            }
9589        }
9590
9591        #[inline]
9592        unsafe fn decode(
9593            &mut self,
9594            decoder: &mut fidl::encoding::Decoder<
9595                '_,
9596                fidl::encoding::DefaultFuchsiaResourceDialect,
9597            >,
9598            offset: usize,
9599            _depth: fidl::encoding::Depth,
9600        ) -> fidl::Result<()> {
9601            decoder.debug_check_bounds::<Self>(offset);
9602            // Verify that padding bytes are zero.
9603            fidl::decode!(
9604                u32,
9605                fidl::encoding::DefaultFuchsiaResourceDialect,
9606                &mut self.table,
9607                decoder,
9608                offset + 0,
9609                _depth
9610            )?;
9611            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 0>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 4, _depth)?;
9612            Ok(())
9613        }
9614    }
9615
9616    impl fidl::encoding::ResourceTypeMarker for RouteSetV4AddRouteRequest {
9617        type Borrowed<'a> = &'a mut Self;
9618        fn take_or_borrow<'a>(
9619            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9620        ) -> Self::Borrowed<'a> {
9621            value
9622        }
9623    }
9624
9625    unsafe impl fidl::encoding::TypeMarker for RouteSetV4AddRouteRequest {
9626        type Owned = Self;
9627
9628        #[inline(always)]
9629        fn inline_align(_context: fidl::encoding::Context) -> usize {
9630            8
9631        }
9632
9633        #[inline(always)]
9634        fn inline_size(_context: fidl::encoding::Context) -> usize {
9635            40
9636        }
9637    }
9638
9639    unsafe impl
9640        fidl::encoding::Encode<
9641            RouteSetV4AddRouteRequest,
9642            fidl::encoding::DefaultFuchsiaResourceDialect,
9643        > for &mut RouteSetV4AddRouteRequest
9644    {
9645        #[inline]
9646        unsafe fn encode(
9647            self,
9648            encoder: &mut fidl::encoding::Encoder<
9649                '_,
9650                fidl::encoding::DefaultFuchsiaResourceDialect,
9651            >,
9652            offset: usize,
9653            _depth: fidl::encoding::Depth,
9654        ) -> fidl::Result<()> {
9655            encoder.debug_check_bounds::<RouteSetV4AddRouteRequest>(offset);
9656            // Delegate to tuple encoding.
9657            fidl::encoding::Encode::<
9658                RouteSetV4AddRouteRequest,
9659                fidl::encoding::DefaultFuchsiaResourceDialect,
9660            >::encode(
9661                (<fidl_fuchsia_net_routes::RouteV4 as fidl::encoding::ValueTypeMarker>::borrow(
9662                    &self.route,
9663                ),),
9664                encoder,
9665                offset,
9666                _depth,
9667            )
9668        }
9669    }
9670    unsafe impl<
9671        T0: fidl::encoding::Encode<
9672                fidl_fuchsia_net_routes::RouteV4,
9673                fidl::encoding::DefaultFuchsiaResourceDialect,
9674            >,
9675    >
9676        fidl::encoding::Encode<
9677            RouteSetV4AddRouteRequest,
9678            fidl::encoding::DefaultFuchsiaResourceDialect,
9679        > for (T0,)
9680    {
9681        #[inline]
9682        unsafe fn encode(
9683            self,
9684            encoder: &mut fidl::encoding::Encoder<
9685                '_,
9686                fidl::encoding::DefaultFuchsiaResourceDialect,
9687            >,
9688            offset: usize,
9689            depth: fidl::encoding::Depth,
9690        ) -> fidl::Result<()> {
9691            encoder.debug_check_bounds::<RouteSetV4AddRouteRequest>(offset);
9692            // Zero out padding regions. There's no need to apply masks
9693            // because the unmasked parts will be overwritten by fields.
9694            // Write the fields.
9695            self.0.encode(encoder, offset + 0, depth)?;
9696            Ok(())
9697        }
9698    }
9699
9700    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9701        for RouteSetV4AddRouteRequest
9702    {
9703        #[inline(always)]
9704        fn new_empty() -> Self {
9705            Self {
9706                route: fidl::new_empty!(
9707                    fidl_fuchsia_net_routes::RouteV4,
9708                    fidl::encoding::DefaultFuchsiaResourceDialect
9709                ),
9710            }
9711        }
9712
9713        #[inline]
9714        unsafe fn decode(
9715            &mut self,
9716            decoder: &mut fidl::encoding::Decoder<
9717                '_,
9718                fidl::encoding::DefaultFuchsiaResourceDialect,
9719            >,
9720            offset: usize,
9721            _depth: fidl::encoding::Depth,
9722        ) -> fidl::Result<()> {
9723            decoder.debug_check_bounds::<Self>(offset);
9724            // Verify that padding bytes are zero.
9725            fidl::decode!(
9726                fidl_fuchsia_net_routes::RouteV4,
9727                fidl::encoding::DefaultFuchsiaResourceDialect,
9728                &mut self.route,
9729                decoder,
9730                offset + 0,
9731                _depth
9732            )?;
9733            Ok(())
9734        }
9735    }
9736
9737    impl fidl::encoding::ResourceTypeMarker for RouteSetV4AuthenticateForInterfaceRequest {
9738        type Borrowed<'a> = &'a mut Self;
9739        fn take_or_borrow<'a>(
9740            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9741        ) -> Self::Borrowed<'a> {
9742            value
9743        }
9744    }
9745
9746    unsafe impl fidl::encoding::TypeMarker for RouteSetV4AuthenticateForInterfaceRequest {
9747        type Owned = Self;
9748
9749        #[inline(always)]
9750        fn inline_align(_context: fidl::encoding::Context) -> usize {
9751            8
9752        }
9753
9754        #[inline(always)]
9755        fn inline_size(_context: fidl::encoding::Context) -> usize {
9756            16
9757        }
9758    }
9759
9760    unsafe impl
9761        fidl::encoding::Encode<
9762            RouteSetV4AuthenticateForInterfaceRequest,
9763            fidl::encoding::DefaultFuchsiaResourceDialect,
9764        > for &mut RouteSetV4AuthenticateForInterfaceRequest
9765    {
9766        #[inline]
9767        unsafe fn encode(
9768            self,
9769            encoder: &mut fidl::encoding::Encoder<
9770                '_,
9771                fidl::encoding::DefaultFuchsiaResourceDialect,
9772            >,
9773            offset: usize,
9774            _depth: fidl::encoding::Depth,
9775        ) -> fidl::Result<()> {
9776            encoder.debug_check_bounds::<RouteSetV4AuthenticateForInterfaceRequest>(offset);
9777            // Delegate to tuple encoding.
9778            fidl::encoding::Encode::<RouteSetV4AuthenticateForInterfaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9779                (
9780                    <fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
9781                ),
9782                encoder, offset, _depth
9783            )
9784        }
9785    }
9786    unsafe impl<
9787        T0: fidl::encoding::Encode<
9788                fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
9789                fidl::encoding::DefaultFuchsiaResourceDialect,
9790            >,
9791    >
9792        fidl::encoding::Encode<
9793            RouteSetV4AuthenticateForInterfaceRequest,
9794            fidl::encoding::DefaultFuchsiaResourceDialect,
9795        > for (T0,)
9796    {
9797        #[inline]
9798        unsafe fn encode(
9799            self,
9800            encoder: &mut fidl::encoding::Encoder<
9801                '_,
9802                fidl::encoding::DefaultFuchsiaResourceDialect,
9803            >,
9804            offset: usize,
9805            depth: fidl::encoding::Depth,
9806        ) -> fidl::Result<()> {
9807            encoder.debug_check_bounds::<RouteSetV4AuthenticateForInterfaceRequest>(offset);
9808            // Zero out padding regions. There's no need to apply masks
9809            // because the unmasked parts will be overwritten by fields.
9810            // Write the fields.
9811            self.0.encode(encoder, offset + 0, depth)?;
9812            Ok(())
9813        }
9814    }
9815
9816    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9817        for RouteSetV4AuthenticateForInterfaceRequest
9818    {
9819        #[inline(always)]
9820        fn new_empty() -> Self {
9821            Self {
9822                credential: fidl::new_empty!(
9823                    fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
9824                    fidl::encoding::DefaultFuchsiaResourceDialect
9825                ),
9826            }
9827        }
9828
9829        #[inline]
9830        unsafe fn decode(
9831            &mut self,
9832            decoder: &mut fidl::encoding::Decoder<
9833                '_,
9834                fidl::encoding::DefaultFuchsiaResourceDialect,
9835            >,
9836            offset: usize,
9837            _depth: fidl::encoding::Depth,
9838        ) -> fidl::Result<()> {
9839            decoder.debug_check_bounds::<Self>(offset);
9840            // Verify that padding bytes are zero.
9841            fidl::decode!(
9842                fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
9843                fidl::encoding::DefaultFuchsiaResourceDialect,
9844                &mut self.credential,
9845                decoder,
9846                offset + 0,
9847                _depth
9848            )?;
9849            Ok(())
9850        }
9851    }
9852
9853    impl fidl::encoding::ResourceTypeMarker for RouteSetV4RemoveRouteRequest {
9854        type Borrowed<'a> = &'a mut Self;
9855        fn take_or_borrow<'a>(
9856            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9857        ) -> Self::Borrowed<'a> {
9858            value
9859        }
9860    }
9861
9862    unsafe impl fidl::encoding::TypeMarker for RouteSetV4RemoveRouteRequest {
9863        type Owned = Self;
9864
9865        #[inline(always)]
9866        fn inline_align(_context: fidl::encoding::Context) -> usize {
9867            8
9868        }
9869
9870        #[inline(always)]
9871        fn inline_size(_context: fidl::encoding::Context) -> usize {
9872            40
9873        }
9874    }
9875
9876    unsafe impl
9877        fidl::encoding::Encode<
9878            RouteSetV4RemoveRouteRequest,
9879            fidl::encoding::DefaultFuchsiaResourceDialect,
9880        > for &mut RouteSetV4RemoveRouteRequest
9881    {
9882        #[inline]
9883        unsafe fn encode(
9884            self,
9885            encoder: &mut fidl::encoding::Encoder<
9886                '_,
9887                fidl::encoding::DefaultFuchsiaResourceDialect,
9888            >,
9889            offset: usize,
9890            _depth: fidl::encoding::Depth,
9891        ) -> fidl::Result<()> {
9892            encoder.debug_check_bounds::<RouteSetV4RemoveRouteRequest>(offset);
9893            // Delegate to tuple encoding.
9894            fidl::encoding::Encode::<
9895                RouteSetV4RemoveRouteRequest,
9896                fidl::encoding::DefaultFuchsiaResourceDialect,
9897            >::encode(
9898                (<fidl_fuchsia_net_routes::RouteV4 as fidl::encoding::ValueTypeMarker>::borrow(
9899                    &self.route,
9900                ),),
9901                encoder,
9902                offset,
9903                _depth,
9904            )
9905        }
9906    }
9907    unsafe impl<
9908        T0: fidl::encoding::Encode<
9909                fidl_fuchsia_net_routes::RouteV4,
9910                fidl::encoding::DefaultFuchsiaResourceDialect,
9911            >,
9912    >
9913        fidl::encoding::Encode<
9914            RouteSetV4RemoveRouteRequest,
9915            fidl::encoding::DefaultFuchsiaResourceDialect,
9916        > for (T0,)
9917    {
9918        #[inline]
9919        unsafe fn encode(
9920            self,
9921            encoder: &mut fidl::encoding::Encoder<
9922                '_,
9923                fidl::encoding::DefaultFuchsiaResourceDialect,
9924            >,
9925            offset: usize,
9926            depth: fidl::encoding::Depth,
9927        ) -> fidl::Result<()> {
9928            encoder.debug_check_bounds::<RouteSetV4RemoveRouteRequest>(offset);
9929            // Zero out padding regions. There's no need to apply masks
9930            // because the unmasked parts will be overwritten by fields.
9931            // Write the fields.
9932            self.0.encode(encoder, offset + 0, depth)?;
9933            Ok(())
9934        }
9935    }
9936
9937    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9938        for RouteSetV4RemoveRouteRequest
9939    {
9940        #[inline(always)]
9941        fn new_empty() -> Self {
9942            Self {
9943                route: fidl::new_empty!(
9944                    fidl_fuchsia_net_routes::RouteV4,
9945                    fidl::encoding::DefaultFuchsiaResourceDialect
9946                ),
9947            }
9948        }
9949
9950        #[inline]
9951        unsafe fn decode(
9952            &mut self,
9953            decoder: &mut fidl::encoding::Decoder<
9954                '_,
9955                fidl::encoding::DefaultFuchsiaResourceDialect,
9956            >,
9957            offset: usize,
9958            _depth: fidl::encoding::Depth,
9959        ) -> fidl::Result<()> {
9960            decoder.debug_check_bounds::<Self>(offset);
9961            // Verify that padding bytes are zero.
9962            fidl::decode!(
9963                fidl_fuchsia_net_routes::RouteV4,
9964                fidl::encoding::DefaultFuchsiaResourceDialect,
9965                &mut self.route,
9966                decoder,
9967                offset + 0,
9968                _depth
9969            )?;
9970            Ok(())
9971        }
9972    }
9973
9974    impl fidl::encoding::ResourceTypeMarker for RouteSetV6AddRouteRequest {
9975        type Borrowed<'a> = &'a mut Self;
9976        fn take_or_borrow<'a>(
9977            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9978        ) -> Self::Borrowed<'a> {
9979            value
9980        }
9981    }
9982
9983    unsafe impl fidl::encoding::TypeMarker for RouteSetV6AddRouteRequest {
9984        type Owned = Self;
9985
9986        #[inline(always)]
9987        fn inline_align(_context: fidl::encoding::Context) -> usize {
9988            8
9989        }
9990
9991        #[inline(always)]
9992        fn inline_size(_context: fidl::encoding::Context) -> usize {
9993            56
9994        }
9995    }
9996
9997    unsafe impl
9998        fidl::encoding::Encode<
9999            RouteSetV6AddRouteRequest,
10000            fidl::encoding::DefaultFuchsiaResourceDialect,
10001        > for &mut RouteSetV6AddRouteRequest
10002    {
10003        #[inline]
10004        unsafe fn encode(
10005            self,
10006            encoder: &mut fidl::encoding::Encoder<
10007                '_,
10008                fidl::encoding::DefaultFuchsiaResourceDialect,
10009            >,
10010            offset: usize,
10011            _depth: fidl::encoding::Depth,
10012        ) -> fidl::Result<()> {
10013            encoder.debug_check_bounds::<RouteSetV6AddRouteRequest>(offset);
10014            // Delegate to tuple encoding.
10015            fidl::encoding::Encode::<
10016                RouteSetV6AddRouteRequest,
10017                fidl::encoding::DefaultFuchsiaResourceDialect,
10018            >::encode(
10019                (<fidl_fuchsia_net_routes::RouteV6 as fidl::encoding::ValueTypeMarker>::borrow(
10020                    &self.route,
10021                ),),
10022                encoder,
10023                offset,
10024                _depth,
10025            )
10026        }
10027    }
10028    unsafe impl<
10029        T0: fidl::encoding::Encode<
10030                fidl_fuchsia_net_routes::RouteV6,
10031                fidl::encoding::DefaultFuchsiaResourceDialect,
10032            >,
10033    >
10034        fidl::encoding::Encode<
10035            RouteSetV6AddRouteRequest,
10036            fidl::encoding::DefaultFuchsiaResourceDialect,
10037        > for (T0,)
10038    {
10039        #[inline]
10040        unsafe fn encode(
10041            self,
10042            encoder: &mut fidl::encoding::Encoder<
10043                '_,
10044                fidl::encoding::DefaultFuchsiaResourceDialect,
10045            >,
10046            offset: usize,
10047            depth: fidl::encoding::Depth,
10048        ) -> fidl::Result<()> {
10049            encoder.debug_check_bounds::<RouteSetV6AddRouteRequest>(offset);
10050            // Zero out padding regions. There's no need to apply masks
10051            // because the unmasked parts will be overwritten by fields.
10052            // Write the fields.
10053            self.0.encode(encoder, offset + 0, depth)?;
10054            Ok(())
10055        }
10056    }
10057
10058    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10059        for RouteSetV6AddRouteRequest
10060    {
10061        #[inline(always)]
10062        fn new_empty() -> Self {
10063            Self {
10064                route: fidl::new_empty!(
10065                    fidl_fuchsia_net_routes::RouteV6,
10066                    fidl::encoding::DefaultFuchsiaResourceDialect
10067                ),
10068            }
10069        }
10070
10071        #[inline]
10072        unsafe fn decode(
10073            &mut self,
10074            decoder: &mut fidl::encoding::Decoder<
10075                '_,
10076                fidl::encoding::DefaultFuchsiaResourceDialect,
10077            >,
10078            offset: usize,
10079            _depth: fidl::encoding::Depth,
10080        ) -> fidl::Result<()> {
10081            decoder.debug_check_bounds::<Self>(offset);
10082            // Verify that padding bytes are zero.
10083            fidl::decode!(
10084                fidl_fuchsia_net_routes::RouteV6,
10085                fidl::encoding::DefaultFuchsiaResourceDialect,
10086                &mut self.route,
10087                decoder,
10088                offset + 0,
10089                _depth
10090            )?;
10091            Ok(())
10092        }
10093    }
10094
10095    impl fidl::encoding::ResourceTypeMarker for RouteSetV6AuthenticateForInterfaceRequest {
10096        type Borrowed<'a> = &'a mut Self;
10097        fn take_or_borrow<'a>(
10098            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10099        ) -> Self::Borrowed<'a> {
10100            value
10101        }
10102    }
10103
10104    unsafe impl fidl::encoding::TypeMarker for RouteSetV6AuthenticateForInterfaceRequest {
10105        type Owned = Self;
10106
10107        #[inline(always)]
10108        fn inline_align(_context: fidl::encoding::Context) -> usize {
10109            8
10110        }
10111
10112        #[inline(always)]
10113        fn inline_size(_context: fidl::encoding::Context) -> usize {
10114            16
10115        }
10116    }
10117
10118    unsafe impl
10119        fidl::encoding::Encode<
10120            RouteSetV6AuthenticateForInterfaceRequest,
10121            fidl::encoding::DefaultFuchsiaResourceDialect,
10122        > for &mut RouteSetV6AuthenticateForInterfaceRequest
10123    {
10124        #[inline]
10125        unsafe fn encode(
10126            self,
10127            encoder: &mut fidl::encoding::Encoder<
10128                '_,
10129                fidl::encoding::DefaultFuchsiaResourceDialect,
10130            >,
10131            offset: usize,
10132            _depth: fidl::encoding::Depth,
10133        ) -> fidl::Result<()> {
10134            encoder.debug_check_bounds::<RouteSetV6AuthenticateForInterfaceRequest>(offset);
10135            // Delegate to tuple encoding.
10136            fidl::encoding::Encode::<RouteSetV6AuthenticateForInterfaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10137                (
10138                    <fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
10139                ),
10140                encoder, offset, _depth
10141            )
10142        }
10143    }
10144    unsafe impl<
10145        T0: fidl::encoding::Encode<
10146                fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
10147                fidl::encoding::DefaultFuchsiaResourceDialect,
10148            >,
10149    >
10150        fidl::encoding::Encode<
10151            RouteSetV6AuthenticateForInterfaceRequest,
10152            fidl::encoding::DefaultFuchsiaResourceDialect,
10153        > for (T0,)
10154    {
10155        #[inline]
10156        unsafe fn encode(
10157            self,
10158            encoder: &mut fidl::encoding::Encoder<
10159                '_,
10160                fidl::encoding::DefaultFuchsiaResourceDialect,
10161            >,
10162            offset: usize,
10163            depth: fidl::encoding::Depth,
10164        ) -> fidl::Result<()> {
10165            encoder.debug_check_bounds::<RouteSetV6AuthenticateForInterfaceRequest>(offset);
10166            // Zero out padding regions. There's no need to apply masks
10167            // because the unmasked parts will be overwritten by fields.
10168            // Write the fields.
10169            self.0.encode(encoder, offset + 0, depth)?;
10170            Ok(())
10171        }
10172    }
10173
10174    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10175        for RouteSetV6AuthenticateForInterfaceRequest
10176    {
10177        #[inline(always)]
10178        fn new_empty() -> Self {
10179            Self {
10180                credential: fidl::new_empty!(
10181                    fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
10182                    fidl::encoding::DefaultFuchsiaResourceDialect
10183                ),
10184            }
10185        }
10186
10187        #[inline]
10188        unsafe fn decode(
10189            &mut self,
10190            decoder: &mut fidl::encoding::Decoder<
10191                '_,
10192                fidl::encoding::DefaultFuchsiaResourceDialect,
10193            >,
10194            offset: usize,
10195            _depth: fidl::encoding::Depth,
10196        ) -> fidl::Result<()> {
10197            decoder.debug_check_bounds::<Self>(offset);
10198            // Verify that padding bytes are zero.
10199            fidl::decode!(
10200                fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
10201                fidl::encoding::DefaultFuchsiaResourceDialect,
10202                &mut self.credential,
10203                decoder,
10204                offset + 0,
10205                _depth
10206            )?;
10207            Ok(())
10208        }
10209    }
10210
10211    impl fidl::encoding::ResourceTypeMarker for RouteSetV6RemoveRouteRequest {
10212        type Borrowed<'a> = &'a mut Self;
10213        fn take_or_borrow<'a>(
10214            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10215        ) -> Self::Borrowed<'a> {
10216            value
10217        }
10218    }
10219
10220    unsafe impl fidl::encoding::TypeMarker for RouteSetV6RemoveRouteRequest {
10221        type Owned = Self;
10222
10223        #[inline(always)]
10224        fn inline_align(_context: fidl::encoding::Context) -> usize {
10225            8
10226        }
10227
10228        #[inline(always)]
10229        fn inline_size(_context: fidl::encoding::Context) -> usize {
10230            56
10231        }
10232    }
10233
10234    unsafe impl
10235        fidl::encoding::Encode<
10236            RouteSetV6RemoveRouteRequest,
10237            fidl::encoding::DefaultFuchsiaResourceDialect,
10238        > for &mut RouteSetV6RemoveRouteRequest
10239    {
10240        #[inline]
10241        unsafe fn encode(
10242            self,
10243            encoder: &mut fidl::encoding::Encoder<
10244                '_,
10245                fidl::encoding::DefaultFuchsiaResourceDialect,
10246            >,
10247            offset: usize,
10248            _depth: fidl::encoding::Depth,
10249        ) -> fidl::Result<()> {
10250            encoder.debug_check_bounds::<RouteSetV6RemoveRouteRequest>(offset);
10251            // Delegate to tuple encoding.
10252            fidl::encoding::Encode::<
10253                RouteSetV6RemoveRouteRequest,
10254                fidl::encoding::DefaultFuchsiaResourceDialect,
10255            >::encode(
10256                (<fidl_fuchsia_net_routes::RouteV6 as fidl::encoding::ValueTypeMarker>::borrow(
10257                    &self.route,
10258                ),),
10259                encoder,
10260                offset,
10261                _depth,
10262            )
10263        }
10264    }
10265    unsafe impl<
10266        T0: fidl::encoding::Encode<
10267                fidl_fuchsia_net_routes::RouteV6,
10268                fidl::encoding::DefaultFuchsiaResourceDialect,
10269            >,
10270    >
10271        fidl::encoding::Encode<
10272            RouteSetV6RemoveRouteRequest,
10273            fidl::encoding::DefaultFuchsiaResourceDialect,
10274        > for (T0,)
10275    {
10276        #[inline]
10277        unsafe fn encode(
10278            self,
10279            encoder: &mut fidl::encoding::Encoder<
10280                '_,
10281                fidl::encoding::DefaultFuchsiaResourceDialect,
10282            >,
10283            offset: usize,
10284            depth: fidl::encoding::Depth,
10285        ) -> fidl::Result<()> {
10286            encoder.debug_check_bounds::<RouteSetV6RemoveRouteRequest>(offset);
10287            // Zero out padding regions. There's no need to apply masks
10288            // because the unmasked parts will be overwritten by fields.
10289            // Write the fields.
10290            self.0.encode(encoder, offset + 0, depth)?;
10291            Ok(())
10292        }
10293    }
10294
10295    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10296        for RouteSetV6RemoveRouteRequest
10297    {
10298        #[inline(always)]
10299        fn new_empty() -> Self {
10300            Self {
10301                route: fidl::new_empty!(
10302                    fidl_fuchsia_net_routes::RouteV6,
10303                    fidl::encoding::DefaultFuchsiaResourceDialect
10304                ),
10305            }
10306        }
10307
10308        #[inline]
10309        unsafe fn decode(
10310            &mut self,
10311            decoder: &mut fidl::encoding::Decoder<
10312                '_,
10313                fidl::encoding::DefaultFuchsiaResourceDialect,
10314            >,
10315            offset: usize,
10316            _depth: fidl::encoding::Depth,
10317        ) -> fidl::Result<()> {
10318            decoder.debug_check_bounds::<Self>(offset);
10319            // Verify that padding bytes are zero.
10320            fidl::decode!(
10321                fidl_fuchsia_net_routes::RouteV6,
10322                fidl::encoding::DefaultFuchsiaResourceDialect,
10323                &mut self.route,
10324                decoder,
10325                offset + 0,
10326                _depth
10327            )?;
10328            Ok(())
10329        }
10330    }
10331
10332    impl fidl::encoding::ResourceTypeMarker for RouteTableProviderV4GetInterfaceLocalTableRequest {
10333        type Borrowed<'a> = &'a mut Self;
10334        fn take_or_borrow<'a>(
10335            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10336        ) -> Self::Borrowed<'a> {
10337            value
10338        }
10339    }
10340
10341    unsafe impl fidl::encoding::TypeMarker for RouteTableProviderV4GetInterfaceLocalTableRequest {
10342        type Owned = Self;
10343
10344        #[inline(always)]
10345        fn inline_align(_context: fidl::encoding::Context) -> usize {
10346            8
10347        }
10348
10349        #[inline(always)]
10350        fn inline_size(_context: fidl::encoding::Context) -> usize {
10351            16
10352        }
10353    }
10354
10355    unsafe impl
10356        fidl::encoding::Encode<
10357            RouteTableProviderV4GetInterfaceLocalTableRequest,
10358            fidl::encoding::DefaultFuchsiaResourceDialect,
10359        > for &mut RouteTableProviderV4GetInterfaceLocalTableRequest
10360    {
10361        #[inline]
10362        unsafe fn encode(
10363            self,
10364            encoder: &mut fidl::encoding::Encoder<
10365                '_,
10366                fidl::encoding::DefaultFuchsiaResourceDialect,
10367            >,
10368            offset: usize,
10369            _depth: fidl::encoding::Depth,
10370        ) -> fidl::Result<()> {
10371            encoder.debug_check_bounds::<RouteTableProviderV4GetInterfaceLocalTableRequest>(offset);
10372            // Delegate to tuple encoding.
10373            fidl::encoding::Encode::<RouteTableProviderV4GetInterfaceLocalTableRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10374                (
10375                    <fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
10376                ),
10377                encoder, offset, _depth
10378            )
10379        }
10380    }
10381    unsafe impl<
10382        T0: fidl::encoding::Encode<
10383                fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
10384                fidl::encoding::DefaultFuchsiaResourceDialect,
10385            >,
10386    >
10387        fidl::encoding::Encode<
10388            RouteTableProviderV4GetInterfaceLocalTableRequest,
10389            fidl::encoding::DefaultFuchsiaResourceDialect,
10390        > for (T0,)
10391    {
10392        #[inline]
10393        unsafe fn encode(
10394            self,
10395            encoder: &mut fidl::encoding::Encoder<
10396                '_,
10397                fidl::encoding::DefaultFuchsiaResourceDialect,
10398            >,
10399            offset: usize,
10400            depth: fidl::encoding::Depth,
10401        ) -> fidl::Result<()> {
10402            encoder.debug_check_bounds::<RouteTableProviderV4GetInterfaceLocalTableRequest>(offset);
10403            // Zero out padding regions. There's no need to apply masks
10404            // because the unmasked parts will be overwritten by fields.
10405            // Write the fields.
10406            self.0.encode(encoder, offset + 0, depth)?;
10407            Ok(())
10408        }
10409    }
10410
10411    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10412        for RouteTableProviderV4GetInterfaceLocalTableRequest
10413    {
10414        #[inline(always)]
10415        fn new_empty() -> Self {
10416            Self {
10417                credential: fidl::new_empty!(
10418                    fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
10419                    fidl::encoding::DefaultFuchsiaResourceDialect
10420                ),
10421            }
10422        }
10423
10424        #[inline]
10425        unsafe fn decode(
10426            &mut self,
10427            decoder: &mut fidl::encoding::Decoder<
10428                '_,
10429                fidl::encoding::DefaultFuchsiaResourceDialect,
10430            >,
10431            offset: usize,
10432            _depth: fidl::encoding::Depth,
10433        ) -> fidl::Result<()> {
10434            decoder.debug_check_bounds::<Self>(offset);
10435            // Verify that padding bytes are zero.
10436            fidl::decode!(
10437                fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
10438                fidl::encoding::DefaultFuchsiaResourceDialect,
10439                &mut self.credential,
10440                decoder,
10441                offset + 0,
10442                _depth
10443            )?;
10444            Ok(())
10445        }
10446    }
10447
10448    impl fidl::encoding::ResourceTypeMarker for RouteTableProviderV4NewRouteTableRequest {
10449        type Borrowed<'a> = &'a mut Self;
10450        fn take_or_borrow<'a>(
10451            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10452        ) -> Self::Borrowed<'a> {
10453            value
10454        }
10455    }
10456
10457    unsafe impl fidl::encoding::TypeMarker for RouteTableProviderV4NewRouteTableRequest {
10458        type Owned = Self;
10459
10460        #[inline(always)]
10461        fn inline_align(_context: fidl::encoding::Context) -> usize {
10462            8
10463        }
10464
10465        #[inline(always)]
10466        fn inline_size(_context: fidl::encoding::Context) -> usize {
10467            24
10468        }
10469    }
10470
10471    unsafe impl
10472        fidl::encoding::Encode<
10473            RouteTableProviderV4NewRouteTableRequest,
10474            fidl::encoding::DefaultFuchsiaResourceDialect,
10475        > for &mut RouteTableProviderV4NewRouteTableRequest
10476    {
10477        #[inline]
10478        unsafe fn encode(
10479            self,
10480            encoder: &mut fidl::encoding::Encoder<
10481                '_,
10482                fidl::encoding::DefaultFuchsiaResourceDialect,
10483            >,
10484            offset: usize,
10485            _depth: fidl::encoding::Depth,
10486        ) -> fidl::Result<()> {
10487            encoder.debug_check_bounds::<RouteTableProviderV4NewRouteTableRequest>(offset);
10488            // Delegate to tuple encoding.
10489            fidl::encoding::Encode::<RouteTableProviderV4NewRouteTableRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10490                (
10491                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.provider),
10492                    <RouteTableOptionsV4 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
10493                ),
10494                encoder, offset, _depth
10495            )
10496        }
10497    }
10498    unsafe impl<
10499        T0: fidl::encoding::Encode<
10500                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV4Marker>>,
10501                fidl::encoding::DefaultFuchsiaResourceDialect,
10502            >,
10503        T1: fidl::encoding::Encode<RouteTableOptionsV4, fidl::encoding::DefaultFuchsiaResourceDialect>,
10504    >
10505        fidl::encoding::Encode<
10506            RouteTableProviderV4NewRouteTableRequest,
10507            fidl::encoding::DefaultFuchsiaResourceDialect,
10508        > for (T0, T1)
10509    {
10510        #[inline]
10511        unsafe fn encode(
10512            self,
10513            encoder: &mut fidl::encoding::Encoder<
10514                '_,
10515                fidl::encoding::DefaultFuchsiaResourceDialect,
10516            >,
10517            offset: usize,
10518            depth: fidl::encoding::Depth,
10519        ) -> fidl::Result<()> {
10520            encoder.debug_check_bounds::<RouteTableProviderV4NewRouteTableRequest>(offset);
10521            // Zero out padding regions. There's no need to apply masks
10522            // because the unmasked parts will be overwritten by fields.
10523            unsafe {
10524                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
10525                (ptr as *mut u64).write_unaligned(0);
10526            }
10527            // Write the fields.
10528            self.0.encode(encoder, offset + 0, depth)?;
10529            self.1.encode(encoder, offset + 8, depth)?;
10530            Ok(())
10531        }
10532    }
10533
10534    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10535        for RouteTableProviderV4NewRouteTableRequest
10536    {
10537        #[inline(always)]
10538        fn new_empty() -> Self {
10539            Self {
10540                provider: fidl::new_empty!(
10541                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV4Marker>>,
10542                    fidl::encoding::DefaultFuchsiaResourceDialect
10543                ),
10544                options: fidl::new_empty!(
10545                    RouteTableOptionsV4,
10546                    fidl::encoding::DefaultFuchsiaResourceDialect
10547                ),
10548            }
10549        }
10550
10551        #[inline]
10552        unsafe fn decode(
10553            &mut self,
10554            decoder: &mut fidl::encoding::Decoder<
10555                '_,
10556                fidl::encoding::DefaultFuchsiaResourceDialect,
10557            >,
10558            offset: usize,
10559            _depth: fidl::encoding::Depth,
10560        ) -> fidl::Result<()> {
10561            decoder.debug_check_bounds::<Self>(offset);
10562            // Verify that padding bytes are zero.
10563            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
10564            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10565            let mask = 0xffffffff00000000u64;
10566            let maskedval = padval & mask;
10567            if maskedval != 0 {
10568                return Err(fidl::Error::NonZeroPadding {
10569                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
10570                });
10571            }
10572            fidl::decode!(
10573                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV4Marker>>,
10574                fidl::encoding::DefaultFuchsiaResourceDialect,
10575                &mut self.provider,
10576                decoder,
10577                offset + 0,
10578                _depth
10579            )?;
10580            fidl::decode!(
10581                RouteTableOptionsV4,
10582                fidl::encoding::DefaultFuchsiaResourceDialect,
10583                &mut self.options,
10584                decoder,
10585                offset + 8,
10586                _depth
10587            )?;
10588            Ok(())
10589        }
10590    }
10591
10592    impl fidl::encoding::ResourceTypeMarker for RouteTableProviderV4GetInterfaceLocalTableResponse {
10593        type Borrowed<'a> = &'a mut Self;
10594        fn take_or_borrow<'a>(
10595            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10596        ) -> Self::Borrowed<'a> {
10597            value
10598        }
10599    }
10600
10601    unsafe impl fidl::encoding::TypeMarker for RouteTableProviderV4GetInterfaceLocalTableResponse {
10602        type Owned = Self;
10603
10604        #[inline(always)]
10605        fn inline_align(_context: fidl::encoding::Context) -> usize {
10606            4
10607        }
10608
10609        #[inline(always)]
10610        fn inline_size(_context: fidl::encoding::Context) -> usize {
10611            4
10612        }
10613    }
10614
10615    unsafe impl
10616        fidl::encoding::Encode<
10617            RouteTableProviderV4GetInterfaceLocalTableResponse,
10618            fidl::encoding::DefaultFuchsiaResourceDialect,
10619        > for &mut RouteTableProviderV4GetInterfaceLocalTableResponse
10620    {
10621        #[inline]
10622        unsafe fn encode(
10623            self,
10624            encoder: &mut fidl::encoding::Encoder<
10625                '_,
10626                fidl::encoding::DefaultFuchsiaResourceDialect,
10627            >,
10628            offset: usize,
10629            _depth: fidl::encoding::Depth,
10630        ) -> fidl::Result<()> {
10631            encoder
10632                .debug_check_bounds::<RouteTableProviderV4GetInterfaceLocalTableResponse>(offset);
10633            // Delegate to tuple encoding.
10634            fidl::encoding::Encode::<RouteTableProviderV4GetInterfaceLocalTableResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10635                (
10636                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RouteTableV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.route_table),
10637                ),
10638                encoder, offset, _depth
10639            )
10640        }
10641    }
10642    unsafe impl<
10643        T0: fidl::encoding::Encode<
10644                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RouteTableV4Marker>>,
10645                fidl::encoding::DefaultFuchsiaResourceDialect,
10646            >,
10647    >
10648        fidl::encoding::Encode<
10649            RouteTableProviderV4GetInterfaceLocalTableResponse,
10650            fidl::encoding::DefaultFuchsiaResourceDialect,
10651        > for (T0,)
10652    {
10653        #[inline]
10654        unsafe fn encode(
10655            self,
10656            encoder: &mut fidl::encoding::Encoder<
10657                '_,
10658                fidl::encoding::DefaultFuchsiaResourceDialect,
10659            >,
10660            offset: usize,
10661            depth: fidl::encoding::Depth,
10662        ) -> fidl::Result<()> {
10663            encoder
10664                .debug_check_bounds::<RouteTableProviderV4GetInterfaceLocalTableResponse>(offset);
10665            // Zero out padding regions. There's no need to apply masks
10666            // because the unmasked parts will be overwritten by fields.
10667            // Write the fields.
10668            self.0.encode(encoder, offset + 0, depth)?;
10669            Ok(())
10670        }
10671    }
10672
10673    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10674        for RouteTableProviderV4GetInterfaceLocalTableResponse
10675    {
10676        #[inline(always)]
10677        fn new_empty() -> Self {
10678            Self {
10679                route_table: fidl::new_empty!(
10680                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RouteTableV4Marker>>,
10681                    fidl::encoding::DefaultFuchsiaResourceDialect
10682                ),
10683            }
10684        }
10685
10686        #[inline]
10687        unsafe fn decode(
10688            &mut self,
10689            decoder: &mut fidl::encoding::Decoder<
10690                '_,
10691                fidl::encoding::DefaultFuchsiaResourceDialect,
10692            >,
10693            offset: usize,
10694            _depth: fidl::encoding::Depth,
10695        ) -> fidl::Result<()> {
10696            decoder.debug_check_bounds::<Self>(offset);
10697            // Verify that padding bytes are zero.
10698            fidl::decode!(
10699                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RouteTableV4Marker>>,
10700                fidl::encoding::DefaultFuchsiaResourceDialect,
10701                &mut self.route_table,
10702                decoder,
10703                offset + 0,
10704                _depth
10705            )?;
10706            Ok(())
10707        }
10708    }
10709
10710    impl fidl::encoding::ResourceTypeMarker for RouteTableProviderV6GetInterfaceLocalTableRequest {
10711        type Borrowed<'a> = &'a mut Self;
10712        fn take_or_borrow<'a>(
10713            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10714        ) -> Self::Borrowed<'a> {
10715            value
10716        }
10717    }
10718
10719    unsafe impl fidl::encoding::TypeMarker for RouteTableProviderV6GetInterfaceLocalTableRequest {
10720        type Owned = Self;
10721
10722        #[inline(always)]
10723        fn inline_align(_context: fidl::encoding::Context) -> usize {
10724            8
10725        }
10726
10727        #[inline(always)]
10728        fn inline_size(_context: fidl::encoding::Context) -> usize {
10729            16
10730        }
10731    }
10732
10733    unsafe impl
10734        fidl::encoding::Encode<
10735            RouteTableProviderV6GetInterfaceLocalTableRequest,
10736            fidl::encoding::DefaultFuchsiaResourceDialect,
10737        > for &mut RouteTableProviderV6GetInterfaceLocalTableRequest
10738    {
10739        #[inline]
10740        unsafe fn encode(
10741            self,
10742            encoder: &mut fidl::encoding::Encoder<
10743                '_,
10744                fidl::encoding::DefaultFuchsiaResourceDialect,
10745            >,
10746            offset: usize,
10747            _depth: fidl::encoding::Depth,
10748        ) -> fidl::Result<()> {
10749            encoder.debug_check_bounds::<RouteTableProviderV6GetInterfaceLocalTableRequest>(offset);
10750            // Delegate to tuple encoding.
10751            fidl::encoding::Encode::<RouteTableProviderV6GetInterfaceLocalTableRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10752                (
10753                    <fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
10754                ),
10755                encoder, offset, _depth
10756            )
10757        }
10758    }
10759    unsafe impl<
10760        T0: fidl::encoding::Encode<
10761                fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
10762                fidl::encoding::DefaultFuchsiaResourceDialect,
10763            >,
10764    >
10765        fidl::encoding::Encode<
10766            RouteTableProviderV6GetInterfaceLocalTableRequest,
10767            fidl::encoding::DefaultFuchsiaResourceDialect,
10768        > for (T0,)
10769    {
10770        #[inline]
10771        unsafe fn encode(
10772            self,
10773            encoder: &mut fidl::encoding::Encoder<
10774                '_,
10775                fidl::encoding::DefaultFuchsiaResourceDialect,
10776            >,
10777            offset: usize,
10778            depth: fidl::encoding::Depth,
10779        ) -> fidl::Result<()> {
10780            encoder.debug_check_bounds::<RouteTableProviderV6GetInterfaceLocalTableRequest>(offset);
10781            // Zero out padding regions. There's no need to apply masks
10782            // because the unmasked parts will be overwritten by fields.
10783            // Write the fields.
10784            self.0.encode(encoder, offset + 0, depth)?;
10785            Ok(())
10786        }
10787    }
10788
10789    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10790        for RouteTableProviderV6GetInterfaceLocalTableRequest
10791    {
10792        #[inline(always)]
10793        fn new_empty() -> Self {
10794            Self {
10795                credential: fidl::new_empty!(
10796                    fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
10797                    fidl::encoding::DefaultFuchsiaResourceDialect
10798                ),
10799            }
10800        }
10801
10802        #[inline]
10803        unsafe fn decode(
10804            &mut self,
10805            decoder: &mut fidl::encoding::Decoder<
10806                '_,
10807                fidl::encoding::DefaultFuchsiaResourceDialect,
10808            >,
10809            offset: usize,
10810            _depth: fidl::encoding::Depth,
10811        ) -> fidl::Result<()> {
10812            decoder.debug_check_bounds::<Self>(offset);
10813            // Verify that padding bytes are zero.
10814            fidl::decode!(
10815                fidl_fuchsia_net_resources::ProofOfInterfaceAuthorization,
10816                fidl::encoding::DefaultFuchsiaResourceDialect,
10817                &mut self.credential,
10818                decoder,
10819                offset + 0,
10820                _depth
10821            )?;
10822            Ok(())
10823        }
10824    }
10825
10826    impl fidl::encoding::ResourceTypeMarker for RouteTableProviderV6NewRouteTableRequest {
10827        type Borrowed<'a> = &'a mut Self;
10828        fn take_or_borrow<'a>(
10829            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10830        ) -> Self::Borrowed<'a> {
10831            value
10832        }
10833    }
10834
10835    unsafe impl fidl::encoding::TypeMarker for RouteTableProviderV6NewRouteTableRequest {
10836        type Owned = Self;
10837
10838        #[inline(always)]
10839        fn inline_align(_context: fidl::encoding::Context) -> usize {
10840            8
10841        }
10842
10843        #[inline(always)]
10844        fn inline_size(_context: fidl::encoding::Context) -> usize {
10845            24
10846        }
10847    }
10848
10849    unsafe impl
10850        fidl::encoding::Encode<
10851            RouteTableProviderV6NewRouteTableRequest,
10852            fidl::encoding::DefaultFuchsiaResourceDialect,
10853        > for &mut RouteTableProviderV6NewRouteTableRequest
10854    {
10855        #[inline]
10856        unsafe fn encode(
10857            self,
10858            encoder: &mut fidl::encoding::Encoder<
10859                '_,
10860                fidl::encoding::DefaultFuchsiaResourceDialect,
10861            >,
10862            offset: usize,
10863            _depth: fidl::encoding::Depth,
10864        ) -> fidl::Result<()> {
10865            encoder.debug_check_bounds::<RouteTableProviderV6NewRouteTableRequest>(offset);
10866            // Delegate to tuple encoding.
10867            fidl::encoding::Encode::<RouteTableProviderV6NewRouteTableRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10868                (
10869                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.provider),
10870                    <RouteTableOptionsV6 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
10871                ),
10872                encoder, offset, _depth
10873            )
10874        }
10875    }
10876    unsafe impl<
10877        T0: fidl::encoding::Encode<
10878                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV6Marker>>,
10879                fidl::encoding::DefaultFuchsiaResourceDialect,
10880            >,
10881        T1: fidl::encoding::Encode<RouteTableOptionsV6, fidl::encoding::DefaultFuchsiaResourceDialect>,
10882    >
10883        fidl::encoding::Encode<
10884            RouteTableProviderV6NewRouteTableRequest,
10885            fidl::encoding::DefaultFuchsiaResourceDialect,
10886        > for (T0, T1)
10887    {
10888        #[inline]
10889        unsafe fn encode(
10890            self,
10891            encoder: &mut fidl::encoding::Encoder<
10892                '_,
10893                fidl::encoding::DefaultFuchsiaResourceDialect,
10894            >,
10895            offset: usize,
10896            depth: fidl::encoding::Depth,
10897        ) -> fidl::Result<()> {
10898            encoder.debug_check_bounds::<RouteTableProviderV6NewRouteTableRequest>(offset);
10899            // Zero out padding regions. There's no need to apply masks
10900            // because the unmasked parts will be overwritten by fields.
10901            unsafe {
10902                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
10903                (ptr as *mut u64).write_unaligned(0);
10904            }
10905            // Write the fields.
10906            self.0.encode(encoder, offset + 0, depth)?;
10907            self.1.encode(encoder, offset + 8, depth)?;
10908            Ok(())
10909        }
10910    }
10911
10912    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10913        for RouteTableProviderV6NewRouteTableRequest
10914    {
10915        #[inline(always)]
10916        fn new_empty() -> Self {
10917            Self {
10918                provider: fidl::new_empty!(
10919                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV6Marker>>,
10920                    fidl::encoding::DefaultFuchsiaResourceDialect
10921                ),
10922                options: fidl::new_empty!(
10923                    RouteTableOptionsV6,
10924                    fidl::encoding::DefaultFuchsiaResourceDialect
10925                ),
10926            }
10927        }
10928
10929        #[inline]
10930        unsafe fn decode(
10931            &mut self,
10932            decoder: &mut fidl::encoding::Decoder<
10933                '_,
10934                fidl::encoding::DefaultFuchsiaResourceDialect,
10935            >,
10936            offset: usize,
10937            _depth: fidl::encoding::Depth,
10938        ) -> fidl::Result<()> {
10939            decoder.debug_check_bounds::<Self>(offset);
10940            // Verify that padding bytes are zero.
10941            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
10942            let padval = unsafe { (ptr as *const u64).read_unaligned() };
10943            let mask = 0xffffffff00000000u64;
10944            let maskedval = padval & mask;
10945            if maskedval != 0 {
10946                return Err(fidl::Error::NonZeroPadding {
10947                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
10948                });
10949            }
10950            fidl::decode!(
10951                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV6Marker>>,
10952                fidl::encoding::DefaultFuchsiaResourceDialect,
10953                &mut self.provider,
10954                decoder,
10955                offset + 0,
10956                _depth
10957            )?;
10958            fidl::decode!(
10959                RouteTableOptionsV6,
10960                fidl::encoding::DefaultFuchsiaResourceDialect,
10961                &mut self.options,
10962                decoder,
10963                offset + 8,
10964                _depth
10965            )?;
10966            Ok(())
10967        }
10968    }
10969
10970    impl fidl::encoding::ResourceTypeMarker for RouteTableProviderV6GetInterfaceLocalTableResponse {
10971        type Borrowed<'a> = &'a mut Self;
10972        fn take_or_borrow<'a>(
10973            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10974        ) -> Self::Borrowed<'a> {
10975            value
10976        }
10977    }
10978
10979    unsafe impl fidl::encoding::TypeMarker for RouteTableProviderV6GetInterfaceLocalTableResponse {
10980        type Owned = Self;
10981
10982        #[inline(always)]
10983        fn inline_align(_context: fidl::encoding::Context) -> usize {
10984            4
10985        }
10986
10987        #[inline(always)]
10988        fn inline_size(_context: fidl::encoding::Context) -> usize {
10989            4
10990        }
10991    }
10992
10993    unsafe impl
10994        fidl::encoding::Encode<
10995            RouteTableProviderV6GetInterfaceLocalTableResponse,
10996            fidl::encoding::DefaultFuchsiaResourceDialect,
10997        > for &mut RouteTableProviderV6GetInterfaceLocalTableResponse
10998    {
10999        #[inline]
11000        unsafe fn encode(
11001            self,
11002            encoder: &mut fidl::encoding::Encoder<
11003                '_,
11004                fidl::encoding::DefaultFuchsiaResourceDialect,
11005            >,
11006            offset: usize,
11007            _depth: fidl::encoding::Depth,
11008        ) -> fidl::Result<()> {
11009            encoder
11010                .debug_check_bounds::<RouteTableProviderV6GetInterfaceLocalTableResponse>(offset);
11011            // Delegate to tuple encoding.
11012            fidl::encoding::Encode::<RouteTableProviderV6GetInterfaceLocalTableResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11013                (
11014                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RouteTableV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.route_table),
11015                ),
11016                encoder, offset, _depth
11017            )
11018        }
11019    }
11020    unsafe impl<
11021        T0: fidl::encoding::Encode<
11022                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RouteTableV6Marker>>,
11023                fidl::encoding::DefaultFuchsiaResourceDialect,
11024            >,
11025    >
11026        fidl::encoding::Encode<
11027            RouteTableProviderV6GetInterfaceLocalTableResponse,
11028            fidl::encoding::DefaultFuchsiaResourceDialect,
11029        > for (T0,)
11030    {
11031        #[inline]
11032        unsafe fn encode(
11033            self,
11034            encoder: &mut fidl::encoding::Encoder<
11035                '_,
11036                fidl::encoding::DefaultFuchsiaResourceDialect,
11037            >,
11038            offset: usize,
11039            depth: fidl::encoding::Depth,
11040        ) -> fidl::Result<()> {
11041            encoder
11042                .debug_check_bounds::<RouteTableProviderV6GetInterfaceLocalTableResponse>(offset);
11043            // Zero out padding regions. There's no need to apply masks
11044            // because the unmasked parts will be overwritten by fields.
11045            // Write the fields.
11046            self.0.encode(encoder, offset + 0, depth)?;
11047            Ok(())
11048        }
11049    }
11050
11051    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11052        for RouteTableProviderV6GetInterfaceLocalTableResponse
11053    {
11054        #[inline(always)]
11055        fn new_empty() -> Self {
11056            Self {
11057                route_table: fidl::new_empty!(
11058                    fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RouteTableV6Marker>>,
11059                    fidl::encoding::DefaultFuchsiaResourceDialect
11060                ),
11061            }
11062        }
11063
11064        #[inline]
11065        unsafe fn decode(
11066            &mut self,
11067            decoder: &mut fidl::encoding::Decoder<
11068                '_,
11069                fidl::encoding::DefaultFuchsiaResourceDialect,
11070            >,
11071            offset: usize,
11072            _depth: fidl::encoding::Depth,
11073        ) -> fidl::Result<()> {
11074            decoder.debug_check_bounds::<Self>(offset);
11075            // Verify that padding bytes are zero.
11076            fidl::decode!(
11077                fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<RouteTableV6Marker>>,
11078                fidl::encoding::DefaultFuchsiaResourceDialect,
11079                &mut self.route_table,
11080                decoder,
11081                offset + 0,
11082                _depth
11083            )?;
11084            Ok(())
11085        }
11086    }
11087
11088    impl fidl::encoding::ResourceTypeMarker for RouteTableV4NewRouteSetRequest {
11089        type Borrowed<'a> = &'a mut Self;
11090        fn take_or_borrow<'a>(
11091            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11092        ) -> Self::Borrowed<'a> {
11093            value
11094        }
11095    }
11096
11097    unsafe impl fidl::encoding::TypeMarker for RouteTableV4NewRouteSetRequest {
11098        type Owned = Self;
11099
11100        #[inline(always)]
11101        fn inline_align(_context: fidl::encoding::Context) -> usize {
11102            4
11103        }
11104
11105        #[inline(always)]
11106        fn inline_size(_context: fidl::encoding::Context) -> usize {
11107            4
11108        }
11109    }
11110
11111    unsafe impl
11112        fidl::encoding::Encode<
11113            RouteTableV4NewRouteSetRequest,
11114            fidl::encoding::DefaultFuchsiaResourceDialect,
11115        > for &mut RouteTableV4NewRouteSetRequest
11116    {
11117        #[inline]
11118        unsafe fn encode(
11119            self,
11120            encoder: &mut fidl::encoding::Encoder<
11121                '_,
11122                fidl::encoding::DefaultFuchsiaResourceDialect,
11123            >,
11124            offset: usize,
11125            _depth: fidl::encoding::Depth,
11126        ) -> fidl::Result<()> {
11127            encoder.debug_check_bounds::<RouteTableV4NewRouteSetRequest>(offset);
11128            // Delegate to tuple encoding.
11129            fidl::encoding::Encode::<RouteTableV4NewRouteSetRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11130                (
11131                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.route_set),
11132                ),
11133                encoder, offset, _depth
11134            )
11135        }
11136    }
11137    unsafe impl<
11138        T0: fidl::encoding::Encode<
11139                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV4Marker>>,
11140                fidl::encoding::DefaultFuchsiaResourceDialect,
11141            >,
11142    >
11143        fidl::encoding::Encode<
11144            RouteTableV4NewRouteSetRequest,
11145            fidl::encoding::DefaultFuchsiaResourceDialect,
11146        > for (T0,)
11147    {
11148        #[inline]
11149        unsafe fn encode(
11150            self,
11151            encoder: &mut fidl::encoding::Encoder<
11152                '_,
11153                fidl::encoding::DefaultFuchsiaResourceDialect,
11154            >,
11155            offset: usize,
11156            depth: fidl::encoding::Depth,
11157        ) -> fidl::Result<()> {
11158            encoder.debug_check_bounds::<RouteTableV4NewRouteSetRequest>(offset);
11159            // Zero out padding regions. There's no need to apply masks
11160            // because the unmasked parts will be overwritten by fields.
11161            // Write the fields.
11162            self.0.encode(encoder, offset + 0, depth)?;
11163            Ok(())
11164        }
11165    }
11166
11167    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11168        for RouteTableV4NewRouteSetRequest
11169    {
11170        #[inline(always)]
11171        fn new_empty() -> Self {
11172            Self {
11173                route_set: fidl::new_empty!(
11174                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV4Marker>>,
11175                    fidl::encoding::DefaultFuchsiaResourceDialect
11176                ),
11177            }
11178        }
11179
11180        #[inline]
11181        unsafe fn decode(
11182            &mut self,
11183            decoder: &mut fidl::encoding::Decoder<
11184                '_,
11185                fidl::encoding::DefaultFuchsiaResourceDialect,
11186            >,
11187            offset: usize,
11188            _depth: fidl::encoding::Depth,
11189        ) -> fidl::Result<()> {
11190            decoder.debug_check_bounds::<Self>(offset);
11191            // Verify that padding bytes are zero.
11192            fidl::decode!(
11193                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV4Marker>>,
11194                fidl::encoding::DefaultFuchsiaResourceDialect,
11195                &mut self.route_set,
11196                decoder,
11197                offset + 0,
11198                _depth
11199            )?;
11200            Ok(())
11201        }
11202    }
11203
11204    impl fidl::encoding::ResourceTypeMarker for RouteTableV6NewRouteSetRequest {
11205        type Borrowed<'a> = &'a mut Self;
11206        fn take_or_borrow<'a>(
11207            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11208        ) -> Self::Borrowed<'a> {
11209            value
11210        }
11211    }
11212
11213    unsafe impl fidl::encoding::TypeMarker for RouteTableV6NewRouteSetRequest {
11214        type Owned = Self;
11215
11216        #[inline(always)]
11217        fn inline_align(_context: fidl::encoding::Context) -> usize {
11218            4
11219        }
11220
11221        #[inline(always)]
11222        fn inline_size(_context: fidl::encoding::Context) -> usize {
11223            4
11224        }
11225    }
11226
11227    unsafe impl
11228        fidl::encoding::Encode<
11229            RouteTableV6NewRouteSetRequest,
11230            fidl::encoding::DefaultFuchsiaResourceDialect,
11231        > for &mut RouteTableV6NewRouteSetRequest
11232    {
11233        #[inline]
11234        unsafe fn encode(
11235            self,
11236            encoder: &mut fidl::encoding::Encoder<
11237                '_,
11238                fidl::encoding::DefaultFuchsiaResourceDialect,
11239            >,
11240            offset: usize,
11241            _depth: fidl::encoding::Depth,
11242        ) -> fidl::Result<()> {
11243            encoder.debug_check_bounds::<RouteTableV6NewRouteSetRequest>(offset);
11244            // Delegate to tuple encoding.
11245            fidl::encoding::Encode::<RouteTableV6NewRouteSetRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11246                (
11247                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.route_set),
11248                ),
11249                encoder, offset, _depth
11250            )
11251        }
11252    }
11253    unsafe impl<
11254        T0: fidl::encoding::Encode<
11255                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV6Marker>>,
11256                fidl::encoding::DefaultFuchsiaResourceDialect,
11257            >,
11258    >
11259        fidl::encoding::Encode<
11260            RouteTableV6NewRouteSetRequest,
11261            fidl::encoding::DefaultFuchsiaResourceDialect,
11262        > for (T0,)
11263    {
11264        #[inline]
11265        unsafe fn encode(
11266            self,
11267            encoder: &mut fidl::encoding::Encoder<
11268                '_,
11269                fidl::encoding::DefaultFuchsiaResourceDialect,
11270            >,
11271            offset: usize,
11272            depth: fidl::encoding::Depth,
11273        ) -> fidl::Result<()> {
11274            encoder.debug_check_bounds::<RouteTableV6NewRouteSetRequest>(offset);
11275            // Zero out padding regions. There's no need to apply masks
11276            // because the unmasked parts will be overwritten by fields.
11277            // Write the fields.
11278            self.0.encode(encoder, offset + 0, depth)?;
11279            Ok(())
11280        }
11281    }
11282
11283    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11284        for RouteTableV6NewRouteSetRequest
11285    {
11286        #[inline(always)]
11287        fn new_empty() -> Self {
11288            Self {
11289                route_set: fidl::new_empty!(
11290                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV6Marker>>,
11291                    fidl::encoding::DefaultFuchsiaResourceDialect
11292                ),
11293            }
11294        }
11295
11296        #[inline]
11297        unsafe fn decode(
11298            &mut self,
11299            decoder: &mut fidl::encoding::Decoder<
11300                '_,
11301                fidl::encoding::DefaultFuchsiaResourceDialect,
11302            >,
11303            offset: usize,
11304            _depth: fidl::encoding::Depth,
11305        ) -> fidl::Result<()> {
11306            decoder.debug_check_bounds::<Self>(offset);
11307            // Verify that padding bytes are zero.
11308            fidl::decode!(
11309                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV6Marker>>,
11310                fidl::encoding::DefaultFuchsiaResourceDialect,
11311                &mut self.route_set,
11312                decoder,
11313                offset + 0,
11314                _depth
11315            )?;
11316            Ok(())
11317        }
11318    }
11319
11320    impl fidl::encoding::ResourceTypeMarker for RuleSetV4AddRuleRequest {
11321        type Borrowed<'a> = &'a mut Self;
11322        fn take_or_borrow<'a>(
11323            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11324        ) -> Self::Borrowed<'a> {
11325            value
11326        }
11327    }
11328
11329    unsafe impl fidl::encoding::TypeMarker for RuleSetV4AddRuleRequest {
11330        type Owned = Self;
11331
11332        #[inline(always)]
11333        fn inline_align(_context: fidl::encoding::Context) -> usize {
11334            8
11335        }
11336
11337        #[inline(always)]
11338        fn inline_size(_context: fidl::encoding::Context) -> usize {
11339            40
11340        }
11341    }
11342
11343    unsafe impl
11344        fidl::encoding::Encode<
11345            RuleSetV4AddRuleRequest,
11346            fidl::encoding::DefaultFuchsiaResourceDialect,
11347        > for &mut RuleSetV4AddRuleRequest
11348    {
11349        #[inline]
11350        unsafe fn encode(
11351            self,
11352            encoder: &mut fidl::encoding::Encoder<
11353                '_,
11354                fidl::encoding::DefaultFuchsiaResourceDialect,
11355            >,
11356            offset: usize,
11357            _depth: fidl::encoding::Depth,
11358        ) -> fidl::Result<()> {
11359            encoder.debug_check_bounds::<RuleSetV4AddRuleRequest>(offset);
11360            // Delegate to tuple encoding.
11361            fidl::encoding::Encode::<RuleSetV4AddRuleRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11362                (
11363                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.index),
11364                    <fidl_fuchsia_net_routes::RuleMatcherV4 as fidl::encoding::ValueTypeMarker>::borrow(&self.matcher),
11365                    <fidl_fuchsia_net_routes::RuleAction as fidl::encoding::ValueTypeMarker>::borrow(&self.action),
11366                ),
11367                encoder, offset, _depth
11368            )
11369        }
11370    }
11371    unsafe impl<
11372        T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
11373        T1: fidl::encoding::Encode<
11374                fidl_fuchsia_net_routes::RuleMatcherV4,
11375                fidl::encoding::DefaultFuchsiaResourceDialect,
11376            >,
11377        T2: fidl::encoding::Encode<
11378                fidl_fuchsia_net_routes::RuleAction,
11379                fidl::encoding::DefaultFuchsiaResourceDialect,
11380            >,
11381    >
11382        fidl::encoding::Encode<
11383            RuleSetV4AddRuleRequest,
11384            fidl::encoding::DefaultFuchsiaResourceDialect,
11385        > for (T0, T1, T2)
11386    {
11387        #[inline]
11388        unsafe fn encode(
11389            self,
11390            encoder: &mut fidl::encoding::Encoder<
11391                '_,
11392                fidl::encoding::DefaultFuchsiaResourceDialect,
11393            >,
11394            offset: usize,
11395            depth: fidl::encoding::Depth,
11396        ) -> fidl::Result<()> {
11397            encoder.debug_check_bounds::<RuleSetV4AddRuleRequest>(offset);
11398            // Zero out padding regions. There's no need to apply masks
11399            // because the unmasked parts will be overwritten by fields.
11400            unsafe {
11401                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
11402                (ptr as *mut u64).write_unaligned(0);
11403            }
11404            // Write the fields.
11405            self.0.encode(encoder, offset + 0, depth)?;
11406            self.1.encode(encoder, offset + 8, depth)?;
11407            self.2.encode(encoder, offset + 24, depth)?;
11408            Ok(())
11409        }
11410    }
11411
11412    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11413        for RuleSetV4AddRuleRequest
11414    {
11415        #[inline(always)]
11416        fn new_empty() -> Self {
11417            Self {
11418                index: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
11419                matcher: fidl::new_empty!(
11420                    fidl_fuchsia_net_routes::RuleMatcherV4,
11421                    fidl::encoding::DefaultFuchsiaResourceDialect
11422                ),
11423                action: fidl::new_empty!(
11424                    fidl_fuchsia_net_routes::RuleAction,
11425                    fidl::encoding::DefaultFuchsiaResourceDialect
11426                ),
11427            }
11428        }
11429
11430        #[inline]
11431        unsafe fn decode(
11432            &mut self,
11433            decoder: &mut fidl::encoding::Decoder<
11434                '_,
11435                fidl::encoding::DefaultFuchsiaResourceDialect,
11436            >,
11437            offset: usize,
11438            _depth: fidl::encoding::Depth,
11439        ) -> fidl::Result<()> {
11440            decoder.debug_check_bounds::<Self>(offset);
11441            // Verify that padding bytes are zero.
11442            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
11443            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11444            let mask = 0xffffffff00000000u64;
11445            let maskedval = padval & mask;
11446            if maskedval != 0 {
11447                return Err(fidl::Error::NonZeroPadding {
11448                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
11449                });
11450            }
11451            fidl::decode!(
11452                u32,
11453                fidl::encoding::DefaultFuchsiaResourceDialect,
11454                &mut self.index,
11455                decoder,
11456                offset + 0,
11457                _depth
11458            )?;
11459            fidl::decode!(
11460                fidl_fuchsia_net_routes::RuleMatcherV4,
11461                fidl::encoding::DefaultFuchsiaResourceDialect,
11462                &mut self.matcher,
11463                decoder,
11464                offset + 8,
11465                _depth
11466            )?;
11467            fidl::decode!(
11468                fidl_fuchsia_net_routes::RuleAction,
11469                fidl::encoding::DefaultFuchsiaResourceDialect,
11470                &mut self.action,
11471                decoder,
11472                offset + 24,
11473                _depth
11474            )?;
11475            Ok(())
11476        }
11477    }
11478
11479    impl fidl::encoding::ResourceTypeMarker for RuleSetV6AddRuleRequest {
11480        type Borrowed<'a> = &'a mut Self;
11481        fn take_or_borrow<'a>(
11482            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11483        ) -> Self::Borrowed<'a> {
11484            value
11485        }
11486    }
11487
11488    unsafe impl fidl::encoding::TypeMarker for RuleSetV6AddRuleRequest {
11489        type Owned = Self;
11490
11491        #[inline(always)]
11492        fn inline_align(_context: fidl::encoding::Context) -> usize {
11493            8
11494        }
11495
11496        #[inline(always)]
11497        fn inline_size(_context: fidl::encoding::Context) -> usize {
11498            40
11499        }
11500    }
11501
11502    unsafe impl
11503        fidl::encoding::Encode<
11504            RuleSetV6AddRuleRequest,
11505            fidl::encoding::DefaultFuchsiaResourceDialect,
11506        > for &mut RuleSetV6AddRuleRequest
11507    {
11508        #[inline]
11509        unsafe fn encode(
11510            self,
11511            encoder: &mut fidl::encoding::Encoder<
11512                '_,
11513                fidl::encoding::DefaultFuchsiaResourceDialect,
11514            >,
11515            offset: usize,
11516            _depth: fidl::encoding::Depth,
11517        ) -> fidl::Result<()> {
11518            encoder.debug_check_bounds::<RuleSetV6AddRuleRequest>(offset);
11519            // Delegate to tuple encoding.
11520            fidl::encoding::Encode::<RuleSetV6AddRuleRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11521                (
11522                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.index),
11523                    <fidl_fuchsia_net_routes::RuleMatcherV6 as fidl::encoding::ValueTypeMarker>::borrow(&self.matcher),
11524                    <fidl_fuchsia_net_routes::RuleAction as fidl::encoding::ValueTypeMarker>::borrow(&self.action),
11525                ),
11526                encoder, offset, _depth
11527            )
11528        }
11529    }
11530    unsafe impl<
11531        T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
11532        T1: fidl::encoding::Encode<
11533                fidl_fuchsia_net_routes::RuleMatcherV6,
11534                fidl::encoding::DefaultFuchsiaResourceDialect,
11535            >,
11536        T2: fidl::encoding::Encode<
11537                fidl_fuchsia_net_routes::RuleAction,
11538                fidl::encoding::DefaultFuchsiaResourceDialect,
11539            >,
11540    >
11541        fidl::encoding::Encode<
11542            RuleSetV6AddRuleRequest,
11543            fidl::encoding::DefaultFuchsiaResourceDialect,
11544        > for (T0, T1, T2)
11545    {
11546        #[inline]
11547        unsafe fn encode(
11548            self,
11549            encoder: &mut fidl::encoding::Encoder<
11550                '_,
11551                fidl::encoding::DefaultFuchsiaResourceDialect,
11552            >,
11553            offset: usize,
11554            depth: fidl::encoding::Depth,
11555        ) -> fidl::Result<()> {
11556            encoder.debug_check_bounds::<RuleSetV6AddRuleRequest>(offset);
11557            // Zero out padding regions. There's no need to apply masks
11558            // because the unmasked parts will be overwritten by fields.
11559            unsafe {
11560                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
11561                (ptr as *mut u64).write_unaligned(0);
11562            }
11563            // Write the fields.
11564            self.0.encode(encoder, offset + 0, depth)?;
11565            self.1.encode(encoder, offset + 8, depth)?;
11566            self.2.encode(encoder, offset + 24, depth)?;
11567            Ok(())
11568        }
11569    }
11570
11571    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11572        for RuleSetV6AddRuleRequest
11573    {
11574        #[inline(always)]
11575        fn new_empty() -> Self {
11576            Self {
11577                index: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
11578                matcher: fidl::new_empty!(
11579                    fidl_fuchsia_net_routes::RuleMatcherV6,
11580                    fidl::encoding::DefaultFuchsiaResourceDialect
11581                ),
11582                action: fidl::new_empty!(
11583                    fidl_fuchsia_net_routes::RuleAction,
11584                    fidl::encoding::DefaultFuchsiaResourceDialect
11585                ),
11586            }
11587        }
11588
11589        #[inline]
11590        unsafe fn decode(
11591            &mut self,
11592            decoder: &mut fidl::encoding::Decoder<
11593                '_,
11594                fidl::encoding::DefaultFuchsiaResourceDialect,
11595            >,
11596            offset: usize,
11597            _depth: fidl::encoding::Depth,
11598        ) -> fidl::Result<()> {
11599            decoder.debug_check_bounds::<Self>(offset);
11600            // Verify that padding bytes are zero.
11601            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
11602            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11603            let mask = 0xffffffff00000000u64;
11604            let maskedval = padval & mask;
11605            if maskedval != 0 {
11606                return Err(fidl::Error::NonZeroPadding {
11607                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
11608                });
11609            }
11610            fidl::decode!(
11611                u32,
11612                fidl::encoding::DefaultFuchsiaResourceDialect,
11613                &mut self.index,
11614                decoder,
11615                offset + 0,
11616                _depth
11617            )?;
11618            fidl::decode!(
11619                fidl_fuchsia_net_routes::RuleMatcherV6,
11620                fidl::encoding::DefaultFuchsiaResourceDialect,
11621                &mut self.matcher,
11622                decoder,
11623                offset + 8,
11624                _depth
11625            )?;
11626            fidl::decode!(
11627                fidl_fuchsia_net_routes::RuleAction,
11628                fidl::encoding::DefaultFuchsiaResourceDialect,
11629                &mut self.action,
11630                decoder,
11631                offset + 24,
11632                _depth
11633            )?;
11634            Ok(())
11635        }
11636    }
11637
11638    impl fidl::encoding::ResourceTypeMarker for RuleTableV4NewRuleSetRequest {
11639        type Borrowed<'a> = &'a mut Self;
11640        fn take_or_borrow<'a>(
11641            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11642        ) -> Self::Borrowed<'a> {
11643            value
11644        }
11645    }
11646
11647    unsafe impl fidl::encoding::TypeMarker for RuleTableV4NewRuleSetRequest {
11648        type Owned = Self;
11649
11650        #[inline(always)]
11651        fn inline_align(_context: fidl::encoding::Context) -> usize {
11652            4
11653        }
11654
11655        #[inline(always)]
11656        fn inline_size(_context: fidl::encoding::Context) -> usize {
11657            8
11658        }
11659    }
11660
11661    unsafe impl
11662        fidl::encoding::Encode<
11663            RuleTableV4NewRuleSetRequest,
11664            fidl::encoding::DefaultFuchsiaResourceDialect,
11665        > for &mut RuleTableV4NewRuleSetRequest
11666    {
11667        #[inline]
11668        unsafe fn encode(
11669            self,
11670            encoder: &mut fidl::encoding::Encoder<
11671                '_,
11672                fidl::encoding::DefaultFuchsiaResourceDialect,
11673            >,
11674            offset: usize,
11675            _depth: fidl::encoding::Depth,
11676        ) -> fidl::Result<()> {
11677            encoder.debug_check_bounds::<RuleTableV4NewRuleSetRequest>(offset);
11678            // Delegate to tuple encoding.
11679            fidl::encoding::Encode::<RuleTableV4NewRuleSetRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11680                (
11681                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.priority),
11682                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.rule_set),
11683                ),
11684                encoder, offset, _depth
11685            )
11686        }
11687    }
11688    unsafe impl<
11689        T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
11690        T1: fidl::encoding::Encode<
11691                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV4Marker>>,
11692                fidl::encoding::DefaultFuchsiaResourceDialect,
11693            >,
11694    >
11695        fidl::encoding::Encode<
11696            RuleTableV4NewRuleSetRequest,
11697            fidl::encoding::DefaultFuchsiaResourceDialect,
11698        > for (T0, T1)
11699    {
11700        #[inline]
11701        unsafe fn encode(
11702            self,
11703            encoder: &mut fidl::encoding::Encoder<
11704                '_,
11705                fidl::encoding::DefaultFuchsiaResourceDialect,
11706            >,
11707            offset: usize,
11708            depth: fidl::encoding::Depth,
11709        ) -> fidl::Result<()> {
11710            encoder.debug_check_bounds::<RuleTableV4NewRuleSetRequest>(offset);
11711            // Zero out padding regions. There's no need to apply masks
11712            // because the unmasked parts will be overwritten by fields.
11713            // Write the fields.
11714            self.0.encode(encoder, offset + 0, depth)?;
11715            self.1.encode(encoder, offset + 4, depth)?;
11716            Ok(())
11717        }
11718    }
11719
11720    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11721        for RuleTableV4NewRuleSetRequest
11722    {
11723        #[inline(always)]
11724        fn new_empty() -> Self {
11725            Self {
11726                priority: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
11727                rule_set: fidl::new_empty!(
11728                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV4Marker>>,
11729                    fidl::encoding::DefaultFuchsiaResourceDialect
11730                ),
11731            }
11732        }
11733
11734        #[inline]
11735        unsafe fn decode(
11736            &mut self,
11737            decoder: &mut fidl::encoding::Decoder<
11738                '_,
11739                fidl::encoding::DefaultFuchsiaResourceDialect,
11740            >,
11741            offset: usize,
11742            _depth: fidl::encoding::Depth,
11743        ) -> fidl::Result<()> {
11744            decoder.debug_check_bounds::<Self>(offset);
11745            // Verify that padding bytes are zero.
11746            fidl::decode!(
11747                u32,
11748                fidl::encoding::DefaultFuchsiaResourceDialect,
11749                &mut self.priority,
11750                decoder,
11751                offset + 0,
11752                _depth
11753            )?;
11754            fidl::decode!(
11755                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV4Marker>>,
11756                fidl::encoding::DefaultFuchsiaResourceDialect,
11757                &mut self.rule_set,
11758                decoder,
11759                offset + 4,
11760                _depth
11761            )?;
11762            Ok(())
11763        }
11764    }
11765
11766    impl fidl::encoding::ResourceTypeMarker for RuleTableV6NewRuleSetRequest {
11767        type Borrowed<'a> = &'a mut Self;
11768        fn take_or_borrow<'a>(
11769            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11770        ) -> Self::Borrowed<'a> {
11771            value
11772        }
11773    }
11774
11775    unsafe impl fidl::encoding::TypeMarker for RuleTableV6NewRuleSetRequest {
11776        type Owned = Self;
11777
11778        #[inline(always)]
11779        fn inline_align(_context: fidl::encoding::Context) -> usize {
11780            4
11781        }
11782
11783        #[inline(always)]
11784        fn inline_size(_context: fidl::encoding::Context) -> usize {
11785            8
11786        }
11787    }
11788
11789    unsafe impl
11790        fidl::encoding::Encode<
11791            RuleTableV6NewRuleSetRequest,
11792            fidl::encoding::DefaultFuchsiaResourceDialect,
11793        > for &mut RuleTableV6NewRuleSetRequest
11794    {
11795        #[inline]
11796        unsafe fn encode(
11797            self,
11798            encoder: &mut fidl::encoding::Encoder<
11799                '_,
11800                fidl::encoding::DefaultFuchsiaResourceDialect,
11801            >,
11802            offset: usize,
11803            _depth: fidl::encoding::Depth,
11804        ) -> fidl::Result<()> {
11805            encoder.debug_check_bounds::<RuleTableV6NewRuleSetRequest>(offset);
11806            // Delegate to tuple encoding.
11807            fidl::encoding::Encode::<RuleTableV6NewRuleSetRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11808                (
11809                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.priority),
11810                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.rule_set),
11811                ),
11812                encoder, offset, _depth
11813            )
11814        }
11815    }
11816    unsafe impl<
11817        T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
11818        T1: fidl::encoding::Encode<
11819                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV6Marker>>,
11820                fidl::encoding::DefaultFuchsiaResourceDialect,
11821            >,
11822    >
11823        fidl::encoding::Encode<
11824            RuleTableV6NewRuleSetRequest,
11825            fidl::encoding::DefaultFuchsiaResourceDialect,
11826        > for (T0, T1)
11827    {
11828        #[inline]
11829        unsafe fn encode(
11830            self,
11831            encoder: &mut fidl::encoding::Encoder<
11832                '_,
11833                fidl::encoding::DefaultFuchsiaResourceDialect,
11834            >,
11835            offset: usize,
11836            depth: fidl::encoding::Depth,
11837        ) -> fidl::Result<()> {
11838            encoder.debug_check_bounds::<RuleTableV6NewRuleSetRequest>(offset);
11839            // Zero out padding regions. There's no need to apply masks
11840            // because the unmasked parts will be overwritten by fields.
11841            // Write the fields.
11842            self.0.encode(encoder, offset + 0, depth)?;
11843            self.1.encode(encoder, offset + 4, depth)?;
11844            Ok(())
11845        }
11846    }
11847
11848    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11849        for RuleTableV6NewRuleSetRequest
11850    {
11851        #[inline(always)]
11852        fn new_empty() -> Self {
11853            Self {
11854                priority: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
11855                rule_set: fidl::new_empty!(
11856                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV6Marker>>,
11857                    fidl::encoding::DefaultFuchsiaResourceDialect
11858                ),
11859            }
11860        }
11861
11862        #[inline]
11863        unsafe fn decode(
11864            &mut self,
11865            decoder: &mut fidl::encoding::Decoder<
11866                '_,
11867                fidl::encoding::DefaultFuchsiaResourceDialect,
11868            >,
11869            offset: usize,
11870            _depth: fidl::encoding::Depth,
11871        ) -> fidl::Result<()> {
11872            decoder.debug_check_bounds::<Self>(offset);
11873            // Verify that padding bytes are zero.
11874            fidl::decode!(
11875                u32,
11876                fidl::encoding::DefaultFuchsiaResourceDialect,
11877                &mut self.priority,
11878                decoder,
11879                offset + 0,
11880                _depth
11881            )?;
11882            fidl::decode!(
11883                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV6Marker>>,
11884                fidl::encoding::DefaultFuchsiaResourceDialect,
11885                &mut self.rule_set,
11886                decoder,
11887                offset + 4,
11888                _depth
11889            )?;
11890            Ok(())
11891        }
11892    }
11893}