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