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 _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13/// Error type returned when failing to authenticate an interface for a route
14/// set.
15#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
16pub enum AuthenticateForInterfaceError {
17    /// The provided
18    /// [`fuchsia.net.interfaces.admin/ProofOfinterfaceAuthorization`] was
19    /// invalid. This may happen if:
20    ///   - the provided proof's `interface_id' is unknown to the system,
21    ///   - the provided proof's `token` is unknown to the system, or
22    ///   - the provided proof`s `token` is not associated with the proof's
23    ///     `interface_id` (e.g., the `token` authenticates a different
24    ///     interface).
25    InvalidAuthentication,
26    #[doc(hidden)]
27    __SourceBreaking { unknown_ordinal: u32 },
28}
29
30/// Pattern that matches an unknown `AuthenticateForInterfaceError` member.
31#[macro_export]
32macro_rules! AuthenticateForInterfaceErrorUnknown {
33    () => {
34        _
35    };
36}
37
38impl AuthenticateForInterfaceError {
39    #[inline]
40    pub fn from_primitive(prim: u32) -> Option<Self> {
41        match prim {
42            1 => Some(Self::InvalidAuthentication),
43            _ => None,
44        }
45    }
46
47    #[inline]
48    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
49        match prim {
50            1 => Self::InvalidAuthentication,
51            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
52        }
53    }
54
55    #[inline]
56    pub fn unknown() -> Self {
57        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
58    }
59
60    #[inline]
61    pub const fn into_primitive(self) -> u32 {
62        match self {
63            Self::InvalidAuthentication => 1,
64            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
65        }
66    }
67
68    #[inline]
69    pub fn is_unknown(&self) -> bool {
70        match self {
71            Self::__SourceBreaking { unknown_ordinal: _ } => true,
72            _ => false,
73        }
74    }
75}
76
77/// Error type returned when failing to authenticate a route table for a
78/// rules set.
79#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
80pub enum AuthenticateForRouteTableError {
81    /// The provided authentication proof is invalid.
82    /// This may happen if:
83    ///   - the provided proof's `table_id' is unknown to the system,
84    ///   - the provided proof's `token` is unknown to the system, or
85    ///   - the provided proof`s `token` is not associated with the
86    ///     `table_id` (e.g., the `token` authenticates a different
87    ///     route table).
88    InvalidAuthentication,
89    #[doc(hidden)]
90    __SourceBreaking { unknown_ordinal: u32 },
91}
92
93/// Pattern that matches an unknown `AuthenticateForRouteTableError` member.
94#[macro_export]
95macro_rules! AuthenticateForRouteTableErrorUnknown {
96    () => {
97        _
98    };
99}
100
101impl AuthenticateForRouteTableError {
102    #[inline]
103    pub fn from_primitive(prim: u32) -> Option<Self> {
104        match prim {
105            1 => Some(Self::InvalidAuthentication),
106            _ => None,
107        }
108    }
109
110    #[inline]
111    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
112        match prim {
113            1 => Self::InvalidAuthentication,
114            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
115        }
116    }
117
118    #[inline]
119    pub fn unknown() -> Self {
120        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
121    }
122
123    #[inline]
124    pub const fn into_primitive(self) -> u32 {
125        match self {
126            Self::InvalidAuthentication => 1,
127            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
128        }
129    }
130
131    #[inline]
132    pub fn is_unknown(&self) -> bool {
133        match self {
134            Self::__SourceBreaking { unknown_ordinal: _ } => true,
135            _ => false,
136        }
137    }
138}
139
140#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
141pub enum BaseRouteTableRemoveError {
142    InvalidOpOnMainTable,
143    #[doc(hidden)]
144    __SourceBreaking {
145        unknown_ordinal: u32,
146    },
147}
148
149/// Pattern that matches an unknown `BaseRouteTableRemoveError` member.
150#[macro_export]
151macro_rules! BaseRouteTableRemoveErrorUnknown {
152    () => {
153        _
154    };
155}
156
157impl BaseRouteTableRemoveError {
158    #[inline]
159    pub fn from_primitive(prim: u32) -> Option<Self> {
160        match prim {
161            1 => Some(Self::InvalidOpOnMainTable),
162            _ => None,
163        }
164    }
165
166    #[inline]
167    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
168        match prim {
169            1 => Self::InvalidOpOnMainTable,
170            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
171        }
172    }
173
174    #[inline]
175    pub fn unknown() -> Self {
176        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
177    }
178
179    #[inline]
180    pub const fn into_primitive(self) -> u32 {
181        match self {
182            Self::InvalidOpOnMainTable => 1,
183            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
184        }
185    }
186
187    #[inline]
188    pub fn is_unknown(&self) -> bool {
189        match self {
190            Self::__SourceBreaking { unknown_ordinal: _ } => true,
191            _ => false,
192        }
193    }
194}
195
196/// Error type returned when failing to manipulate a route set.
197#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
198pub enum RouteSetError {
199    /// The route set attempted to add/remove a route that uses an
200    /// unauthenticated interface. Clients must first authenticate the route set
201    /// for a particular interface by calling `AuthenticateForInterface`, before
202    /// managing routes over the interface.
203    Unauthenticated,
204    /// This route specified a destination subnet that is invalid.
205    /// E.g. the prefixlen was invalid, or the subnet's host bits were set.
206    InvalidDestinationSubnet,
207    /// This route specified a target whose next-hop address is invalid.
208    /// Next-hop addresses must be unicast addresses.
209    InvalidNextHop,
210    /// The route set attempted to add/remove a route with an unsupported
211    /// `RouteAction` variant.
212    UnsupportedAction,
213    /// The route set attempted to add/remove a route that uses an interface
214    /// that was previously authenticated, but no longer exists.
215    PreviouslyAuthenticatedInterfaceNoLongerExists,
216    /// The route set attempted to add/remove a route that was missing required
217    /// specified properties.
218    MissingRouteProperties,
219    /// The route set attempted to add/remove a route that was missing a
220    /// metric.
221    MissingMetric,
222    #[doc(hidden)]
223    __SourceBreaking { unknown_ordinal: u32 },
224}
225
226/// Pattern that matches an unknown `RouteSetError` member.
227#[macro_export]
228macro_rules! RouteSetErrorUnknown {
229    () => {
230        _
231    };
232}
233
234impl RouteSetError {
235    #[inline]
236    pub fn from_primitive(prim: u32) -> Option<Self> {
237        match prim {
238            1 => Some(Self::Unauthenticated),
239            2 => Some(Self::InvalidDestinationSubnet),
240            3 => Some(Self::InvalidNextHop),
241            4 => Some(Self::UnsupportedAction),
242            5 => Some(Self::PreviouslyAuthenticatedInterfaceNoLongerExists),
243            6 => Some(Self::MissingRouteProperties),
244            7 => Some(Self::MissingMetric),
245            _ => None,
246        }
247    }
248
249    #[inline]
250    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
251        match prim {
252            1 => Self::Unauthenticated,
253            2 => Self::InvalidDestinationSubnet,
254            3 => Self::InvalidNextHop,
255            4 => Self::UnsupportedAction,
256            5 => Self::PreviouslyAuthenticatedInterfaceNoLongerExists,
257            6 => Self::MissingRouteProperties,
258            7 => Self::MissingMetric,
259            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
260        }
261    }
262
263    #[inline]
264    pub fn unknown() -> Self {
265        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
266    }
267
268    #[inline]
269    pub const fn into_primitive(self) -> u32 {
270        match self {
271            Self::Unauthenticated => 1,
272            Self::InvalidDestinationSubnet => 2,
273            Self::InvalidNextHop => 3,
274            Self::UnsupportedAction => 4,
275            Self::PreviouslyAuthenticatedInterfaceNoLongerExists => 5,
276            Self::MissingRouteProperties => 6,
277            Self::MissingMetric => 7,
278            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
279        }
280    }
281
282    #[inline]
283    pub fn is_unknown(&self) -> bool {
284        match self {
285            Self::__SourceBreaking { unknown_ordinal: _ } => true,
286            _ => false,
287        }
288    }
289}
290
291/// Possible errors for operating the rule set.
292#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
293pub enum RuleSetError {
294    /// Tried to install a rule referencing a route table that was not authorized
295    /// through `AuthenticateForRouteTable`.
296    Unauthenticated,
297    /// The action is invalid, for example, the action contains an invalid route
298    /// table.
299    InvalidAction,
300    /// Tried to install a rule at an index that already has an existing rule.
301    RuleAlreadyExists,
302    /// Tried to remove a rule at an index that does not have an existing rule.
303    RuleDoesNotExist,
304    /// The matcher is misconfigured because the base part is missing.
305    BaseMatcherMissing,
306    /// The matcher is invalid, there are parts of the matcher that are mutually exclusive.
307    InvalidMatcher,
308    #[doc(hidden)]
309    __SourceBreaking { unknown_ordinal: u32 },
310}
311
312/// Pattern that matches an unknown `RuleSetError` member.
313#[macro_export]
314macro_rules! RuleSetErrorUnknown {
315    () => {
316        _
317    };
318}
319
320impl RuleSetError {
321    #[inline]
322    pub fn from_primitive(prim: u32) -> Option<Self> {
323        match prim {
324            1 => Some(Self::Unauthenticated),
325            2 => Some(Self::InvalidAction),
326            3 => Some(Self::RuleAlreadyExists),
327            4 => Some(Self::RuleDoesNotExist),
328            5 => Some(Self::BaseMatcherMissing),
329            6 => Some(Self::InvalidMatcher),
330            _ => None,
331        }
332    }
333
334    #[inline]
335    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
336        match prim {
337            1 => Self::Unauthenticated,
338            2 => Self::InvalidAction,
339            3 => Self::RuleAlreadyExists,
340            4 => Self::RuleDoesNotExist,
341            5 => Self::BaseMatcherMissing,
342            6 => Self::InvalidMatcher,
343            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
344        }
345    }
346
347    #[inline]
348    pub fn unknown() -> Self {
349        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
350    }
351
352    #[inline]
353    pub const fn into_primitive(self) -> u32 {
354        match self {
355            Self::Unauthenticated => 1,
356            Self::InvalidAction => 2,
357            Self::RuleAlreadyExists => 3,
358            Self::RuleDoesNotExist => 4,
359            Self::BaseMatcherMissing => 5,
360            Self::InvalidMatcher => 6,
361            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
362        }
363    }
364
365    #[inline]
366    pub fn is_unknown(&self) -> bool {
367        match self {
368            Self::__SourceBreaking { unknown_ordinal: _ } => true,
369            _ => false,
370        }
371    }
372}
373
374#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
375pub struct BaseRouteTableGetAuthorizationForRouteTableResponse {
376    pub credential: GrantForRouteTableAuthorization,
377}
378
379impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
380    for BaseRouteTableGetAuthorizationForRouteTableResponse
381{
382}
383
384#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
385#[repr(C)]
386pub struct BaseRouteTableGetTableIdResponse {
387    pub table_id: u32,
388}
389
390impl fidl::Persistable for BaseRouteTableGetTableIdResponse {}
391
392#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
393#[repr(C)]
394pub struct BaseRuleSetRemoveRuleRequest {
395    pub index: u32,
396}
397
398impl fidl::Persistable for BaseRuleSetRemoveRuleRequest {}
399
400#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
401pub struct GrantForRouteTableAuthorization {
402    /// The ID of the table this credential is authenticating.
403    pub table_id: u32,
404    /// The `EVENT` providing authentication over this route table.
405    pub token: fidl::Event,
406}
407
408impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
409    for GrantForRouteTableAuthorization
410{
411}
412
413#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
414pub struct ProofOfRouteTableAuthorization {
415    pub table: u32,
416    pub token: fidl::Event,
417}
418
419impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
420    for ProofOfRouteTableAuthorization
421{
422}
423
424#[derive(Debug, PartialEq)]
425pub struct RouteSetV4AddRouteRequest {
426    pub route: fidl_fuchsia_net_routes::RouteV4,
427}
428
429impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RouteSetV4AddRouteRequest {}
430
431#[derive(Debug, PartialEq)]
432pub struct RouteSetV4AuthenticateForInterfaceRequest {
433    pub credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
434}
435
436impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
437    for RouteSetV4AuthenticateForInterfaceRequest
438{
439}
440
441#[derive(Debug, PartialEq)]
442pub struct RouteSetV4RemoveRouteRequest {
443    pub route: fidl_fuchsia_net_routes::RouteV4,
444}
445
446impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
447    for RouteSetV4RemoveRouteRequest
448{
449}
450
451#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
452pub struct RouteSetV4AddRouteResponse {
453    pub did_add: bool,
454}
455
456impl fidl::Persistable for RouteSetV4AddRouteResponse {}
457
458#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
459pub struct RouteSetV4RemoveRouteResponse {
460    pub did_remove: bool,
461}
462
463impl fidl::Persistable for RouteSetV4RemoveRouteResponse {}
464
465#[derive(Debug, PartialEq)]
466pub struct RouteSetV6AddRouteRequest {
467    pub route: fidl_fuchsia_net_routes::RouteV6,
468}
469
470impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RouteSetV6AddRouteRequest {}
471
472#[derive(Debug, PartialEq)]
473pub struct RouteSetV6AuthenticateForInterfaceRequest {
474    pub credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
475}
476
477impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
478    for RouteSetV6AuthenticateForInterfaceRequest
479{
480}
481
482#[derive(Debug, PartialEq)]
483pub struct RouteSetV6RemoveRouteRequest {
484    pub route: fidl_fuchsia_net_routes::RouteV6,
485}
486
487impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
488    for RouteSetV6RemoveRouteRequest
489{
490}
491
492#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
493pub struct RouteSetV6AddRouteResponse {
494    pub did_add: bool,
495}
496
497impl fidl::Persistable for RouteSetV6AddRouteResponse {}
498
499#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
500pub struct RouteSetV6RemoveRouteResponse {
501    pub did_remove: bool,
502}
503
504impl fidl::Persistable for RouteSetV6RemoveRouteResponse {}
505
506#[derive(Debug, PartialEq)]
507pub struct RouteTableProviderV4NewRouteTableRequest {
508    pub provider: fidl::endpoints::ServerEnd<RouteTableV4Marker>,
509    pub options: RouteTableOptionsV4,
510}
511
512impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
513    for RouteTableProviderV4NewRouteTableRequest
514{
515}
516
517#[derive(Debug, PartialEq)]
518pub struct RouteTableProviderV6NewRouteTableRequest {
519    pub provider: fidl::endpoints::ServerEnd<RouteTableV6Marker>,
520    pub options: RouteTableOptionsV6,
521}
522
523impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
524    for RouteTableProviderV6NewRouteTableRequest
525{
526}
527
528#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
529pub struct RouteTableV4NewRouteSetRequest {
530    pub route_set: fidl::endpoints::ServerEnd<RouteSetV4Marker>,
531}
532
533impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
534    for RouteTableV4NewRouteSetRequest
535{
536}
537
538#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
539pub struct RouteTableV6NewRouteSetRequest {
540    pub route_set: fidl::endpoints::ServerEnd<RouteSetV6Marker>,
541}
542
543impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
544    for RouteTableV6NewRouteSetRequest
545{
546}
547
548#[derive(Debug, PartialEq)]
549pub struct RuleSetV4AddRuleRequest {
550    pub index: u32,
551    pub matcher: fidl_fuchsia_net_routes::RuleMatcherV4,
552    pub action: fidl_fuchsia_net_routes::RuleAction,
553}
554
555impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RuleSetV4AddRuleRequest {}
556
557#[derive(Debug, PartialEq)]
558pub struct RuleSetV6AddRuleRequest {
559    pub index: u32,
560    pub matcher: fidl_fuchsia_net_routes::RuleMatcherV6,
561    pub action: fidl_fuchsia_net_routes::RuleAction,
562}
563
564impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for RuleSetV6AddRuleRequest {}
565
566#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
567pub struct RuleTableV4NewRuleSetRequest {
568    pub priority: u32,
569    pub rule_set: fidl::endpoints::ServerEnd<RuleSetV4Marker>,
570}
571
572impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
573    for RuleTableV4NewRuleSetRequest
574{
575}
576
577#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
578pub struct RuleTableV6NewRuleSetRequest {
579    pub priority: u32,
580    pub rule_set: fidl::endpoints::ServerEnd<RuleSetV6Marker>,
581}
582
583impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
584    for RuleTableV6NewRuleSetRequest
585{
586}
587
588#[derive(Clone, Debug, Default, PartialEq)]
589pub struct RouteTableOptionsV4 {
590    /// This name is optional and only used for debugging purposes.
591    pub name: Option<String>,
592    #[doc(hidden)]
593    pub __source_breaking: fidl::marker::SourceBreaking,
594}
595
596impl fidl::Persistable for RouteTableOptionsV4 {}
597
598#[derive(Clone, Debug, Default, PartialEq)]
599pub struct RouteTableOptionsV6 {
600    /// This name is optional and only used for debugging purposes.
601    pub name: Option<String>,
602    #[doc(hidden)]
603    pub __source_breaking: fidl::marker::SourceBreaking,
604}
605
606impl fidl::Persistable for RouteTableOptionsV6 {}
607
608#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
609pub struct BaseRouteTableMarker;
610
611impl fidl::endpoints::ProtocolMarker for BaseRouteTableMarker {
612    type Proxy = BaseRouteTableProxy;
613    type RequestStream = BaseRouteTableRequestStream;
614    #[cfg(target_os = "fuchsia")]
615    type SynchronousProxy = BaseRouteTableSynchronousProxy;
616
617    const DEBUG_NAME: &'static str = "(anonymous) BaseRouteTable";
618}
619pub type BaseRouteTableRemoveResult = Result<(), BaseRouteTableRemoveError>;
620
621pub trait BaseRouteTableProxyInterface: Send + Sync {
622    type GetTableIdResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
623    fn r#get_table_id(&self) -> Self::GetTableIdResponseFut;
624    fn r#detach(&self) -> Result<(), fidl::Error>;
625    type RemoveResponseFut: std::future::Future<Output = Result<BaseRouteTableRemoveResult, fidl::Error>>
626        + Send;
627    fn r#remove(&self) -> Self::RemoveResponseFut;
628    type GetAuthorizationForRouteTableResponseFut: std::future::Future<Output = Result<GrantForRouteTableAuthorization, fidl::Error>>
629        + Send;
630    fn r#get_authorization_for_route_table(&self)
631        -> Self::GetAuthorizationForRouteTableResponseFut;
632}
633#[derive(Debug)]
634#[cfg(target_os = "fuchsia")]
635pub struct BaseRouteTableSynchronousProxy {
636    client: fidl::client::sync::Client,
637}
638
639#[cfg(target_os = "fuchsia")]
640impl fidl::endpoints::SynchronousProxy for BaseRouteTableSynchronousProxy {
641    type Proxy = BaseRouteTableProxy;
642    type Protocol = BaseRouteTableMarker;
643
644    fn from_channel(inner: fidl::Channel) -> Self {
645        Self::new(inner)
646    }
647
648    fn into_channel(self) -> fidl::Channel {
649        self.client.into_channel()
650    }
651
652    fn as_channel(&self) -> &fidl::Channel {
653        self.client.as_channel()
654    }
655}
656
657#[cfg(target_os = "fuchsia")]
658impl BaseRouteTableSynchronousProxy {
659    pub fn new(channel: fidl::Channel) -> Self {
660        let protocol_name = <BaseRouteTableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
661        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
662    }
663
664    pub fn into_channel(self) -> fidl::Channel {
665        self.client.into_channel()
666    }
667
668    /// Waits until an event arrives and returns it. It is safe for other
669    /// threads to make concurrent requests while waiting for an event.
670    pub fn wait_for_event(
671        &self,
672        deadline: zx::MonotonicInstant,
673    ) -> Result<BaseRouteTableEvent, fidl::Error> {
674        BaseRouteTableEvent::decode(self.client.wait_for_event(deadline)?)
675    }
676
677    /// Gets the table ID for this table.
678    pub fn r#get_table_id(&self, ___deadline: zx::MonotonicInstant) -> Result<u32, fidl::Error> {
679        let _response = self
680            .client
681            .send_query::<fidl::encoding::EmptyPayload, BaseRouteTableGetTableIdResponse>(
682                (),
683                0x7eab30c55edbfc15,
684                fidl::encoding::DynamicFlags::empty(),
685                ___deadline,
686            )?;
687        Ok(_response.table_id)
688    }
689
690    /// Detaches the lifetime of the route table from the lifetime of the
691    /// client end of the channel.
692    ///
693    /// After this method is called, the route table will not be removed
694    /// if the client end is closed. It's a no-op if called on the main table.
695    pub fn r#detach(&self) -> Result<(), fidl::Error> {
696        self.client.send::<fidl::encoding::EmptyPayload>(
697            (),
698            0x2853ab157285b384,
699            fidl::encoding::DynamicFlags::empty(),
700        )
701    }
702
703    /// Removes the route table explicitly.
704    ///
705    /// This method cannot be called on the main table, an error will be
706    /// returned if called. The server will close the channel after this
707    /// method successfully returns.
708    pub fn r#remove(
709        &self,
710        ___deadline: zx::MonotonicInstant,
711    ) -> Result<BaseRouteTableRemoveResult, fidl::Error> {
712        let _response =
713            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
714                fidl::encoding::EmptyStruct,
715                BaseRouteTableRemoveError,
716            >>(
717                (),
718                0xc42e58a5fc79426,
719                fidl::encoding::DynamicFlags::empty(),
720                ___deadline,
721            )?;
722        Ok(_response.map(|x| x))
723    }
724
725    /// Gets an authentication credential for this table.
726    ///
727    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
728    /// held by the server. This credential can be passed into
729    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
730    /// table. The `EVENT` is stable throughout the lifetime of the route table.
731    /// Clients may duplicate this `EVENT` to make multiple API calls, or
732    /// transfer the `EVENT` to other clients.
733    ///
734    /// - response `credential` the authorization credential for this table.
735    pub fn r#get_authorization_for_route_table(
736        &self,
737        ___deadline: zx::MonotonicInstant,
738    ) -> Result<GrantForRouteTableAuthorization, fidl::Error> {
739        let _response = self.client.send_query::<
740            fidl::encoding::EmptyPayload,
741            BaseRouteTableGetAuthorizationForRouteTableResponse,
742        >(
743            (),
744            0x56a48c921ff3b6eb,
745            fidl::encoding::DynamicFlags::empty(),
746            ___deadline,
747        )?;
748        Ok(_response.credential)
749    }
750}
751
752#[derive(Debug, Clone)]
753pub struct BaseRouteTableProxy {
754    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
755}
756
757impl fidl::endpoints::Proxy for BaseRouteTableProxy {
758    type Protocol = BaseRouteTableMarker;
759
760    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
761        Self::new(inner)
762    }
763
764    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
765        self.client.into_channel().map_err(|client| Self { client })
766    }
767
768    fn as_channel(&self) -> &::fidl::AsyncChannel {
769        self.client.as_channel()
770    }
771}
772
773impl BaseRouteTableProxy {
774    /// Create a new Proxy for fuchsia.net.routes.admin/BaseRouteTable.
775    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
776        let protocol_name = <BaseRouteTableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
777        Self { client: fidl::client::Client::new(channel, protocol_name) }
778    }
779
780    /// Get a Stream of events from the remote end of the protocol.
781    ///
782    /// # Panics
783    ///
784    /// Panics if the event stream was already taken.
785    pub fn take_event_stream(&self) -> BaseRouteTableEventStream {
786        BaseRouteTableEventStream { event_receiver: self.client.take_event_receiver() }
787    }
788
789    /// Gets the table ID for this table.
790    pub fn r#get_table_id(
791        &self,
792    ) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
793        BaseRouteTableProxyInterface::r#get_table_id(self)
794    }
795
796    /// Detaches the lifetime of the route table from the lifetime of the
797    /// client end of the channel.
798    ///
799    /// After this method is called, the route table will not be removed
800    /// if the client end is closed. It's a no-op if called on the main table.
801    pub fn r#detach(&self) -> Result<(), fidl::Error> {
802        BaseRouteTableProxyInterface::r#detach(self)
803    }
804
805    /// Removes the route table explicitly.
806    ///
807    /// This method cannot be called on the main table, an error will be
808    /// returned if called. The server will close the channel after this
809    /// method successfully returns.
810    pub fn r#remove(
811        &self,
812    ) -> fidl::client::QueryResponseFut<
813        BaseRouteTableRemoveResult,
814        fidl::encoding::DefaultFuchsiaResourceDialect,
815    > {
816        BaseRouteTableProxyInterface::r#remove(self)
817    }
818
819    /// Gets an authentication credential for this table.
820    ///
821    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
822    /// held by the server. This credential can be passed into
823    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
824    /// table. The `EVENT` is stable throughout the lifetime of the route table.
825    /// Clients may duplicate this `EVENT` to make multiple API calls, or
826    /// transfer the `EVENT` to other clients.
827    ///
828    /// - response `credential` the authorization credential for this table.
829    pub fn r#get_authorization_for_route_table(
830        &self,
831    ) -> fidl::client::QueryResponseFut<
832        GrantForRouteTableAuthorization,
833        fidl::encoding::DefaultFuchsiaResourceDialect,
834    > {
835        BaseRouteTableProxyInterface::r#get_authorization_for_route_table(self)
836    }
837}
838
839impl BaseRouteTableProxyInterface for BaseRouteTableProxy {
840    type GetTableIdResponseFut =
841        fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
842    fn r#get_table_id(&self) -> Self::GetTableIdResponseFut {
843        fn _decode(
844            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
845        ) -> Result<u32, fidl::Error> {
846            let _response = fidl::client::decode_transaction_body::<
847                BaseRouteTableGetTableIdResponse,
848                fidl::encoding::DefaultFuchsiaResourceDialect,
849                0x7eab30c55edbfc15,
850            >(_buf?)?;
851            Ok(_response.table_id)
852        }
853        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
854            (),
855            0x7eab30c55edbfc15,
856            fidl::encoding::DynamicFlags::empty(),
857            _decode,
858        )
859    }
860
861    fn r#detach(&self) -> Result<(), fidl::Error> {
862        self.client.send::<fidl::encoding::EmptyPayload>(
863            (),
864            0x2853ab157285b384,
865            fidl::encoding::DynamicFlags::empty(),
866        )
867    }
868
869    type RemoveResponseFut = fidl::client::QueryResponseFut<
870        BaseRouteTableRemoveResult,
871        fidl::encoding::DefaultFuchsiaResourceDialect,
872    >;
873    fn r#remove(&self) -> Self::RemoveResponseFut {
874        fn _decode(
875            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
876        ) -> Result<BaseRouteTableRemoveResult, fidl::Error> {
877            let _response = fidl::client::decode_transaction_body::<
878                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BaseRouteTableRemoveError>,
879                fidl::encoding::DefaultFuchsiaResourceDialect,
880                0xc42e58a5fc79426,
881            >(_buf?)?;
882            Ok(_response.map(|x| x))
883        }
884        self.client
885            .send_query_and_decode::<fidl::encoding::EmptyPayload, BaseRouteTableRemoveResult>(
886                (),
887                0xc42e58a5fc79426,
888                fidl::encoding::DynamicFlags::empty(),
889                _decode,
890            )
891    }
892
893    type GetAuthorizationForRouteTableResponseFut = fidl::client::QueryResponseFut<
894        GrantForRouteTableAuthorization,
895        fidl::encoding::DefaultFuchsiaResourceDialect,
896    >;
897    fn r#get_authorization_for_route_table(
898        &self,
899    ) -> Self::GetAuthorizationForRouteTableResponseFut {
900        fn _decode(
901            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
902        ) -> Result<GrantForRouteTableAuthorization, fidl::Error> {
903            let _response = fidl::client::decode_transaction_body::<
904                BaseRouteTableGetAuthorizationForRouteTableResponse,
905                fidl::encoding::DefaultFuchsiaResourceDialect,
906                0x56a48c921ff3b6eb,
907            >(_buf?)?;
908            Ok(_response.credential)
909        }
910        self.client
911            .send_query_and_decode::<fidl::encoding::EmptyPayload, GrantForRouteTableAuthorization>(
912                (),
913                0x56a48c921ff3b6eb,
914                fidl::encoding::DynamicFlags::empty(),
915                _decode,
916            )
917    }
918}
919
920pub struct BaseRouteTableEventStream {
921    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
922}
923
924impl std::marker::Unpin for BaseRouteTableEventStream {}
925
926impl futures::stream::FusedStream for BaseRouteTableEventStream {
927    fn is_terminated(&self) -> bool {
928        self.event_receiver.is_terminated()
929    }
930}
931
932impl futures::Stream for BaseRouteTableEventStream {
933    type Item = Result<BaseRouteTableEvent, fidl::Error>;
934
935    fn poll_next(
936        mut self: std::pin::Pin<&mut Self>,
937        cx: &mut std::task::Context<'_>,
938    ) -> std::task::Poll<Option<Self::Item>> {
939        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
940            &mut self.event_receiver,
941            cx
942        )?) {
943            Some(buf) => std::task::Poll::Ready(Some(BaseRouteTableEvent::decode(buf))),
944            None => std::task::Poll::Ready(None),
945        }
946    }
947}
948
949#[derive(Debug)]
950pub enum BaseRouteTableEvent {}
951
952impl BaseRouteTableEvent {
953    /// Decodes a message buffer as a [`BaseRouteTableEvent`].
954    fn decode(
955        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
956    ) -> Result<BaseRouteTableEvent, fidl::Error> {
957        let (bytes, _handles) = buf.split_mut();
958        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
959        debug_assert_eq!(tx_header.tx_id, 0);
960        match tx_header.ordinal {
961            _ => Err(fidl::Error::UnknownOrdinal {
962                ordinal: tx_header.ordinal,
963                protocol_name:
964                    <BaseRouteTableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
965            }),
966        }
967    }
968}
969
970/// A Stream of incoming requests for fuchsia.net.routes.admin/BaseRouteTable.
971pub struct BaseRouteTableRequestStream {
972    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
973    is_terminated: bool,
974}
975
976impl std::marker::Unpin for BaseRouteTableRequestStream {}
977
978impl futures::stream::FusedStream for BaseRouteTableRequestStream {
979    fn is_terminated(&self) -> bool {
980        self.is_terminated
981    }
982}
983
984impl fidl::endpoints::RequestStream for BaseRouteTableRequestStream {
985    type Protocol = BaseRouteTableMarker;
986    type ControlHandle = BaseRouteTableControlHandle;
987
988    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
989        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
990    }
991
992    fn control_handle(&self) -> Self::ControlHandle {
993        BaseRouteTableControlHandle { inner: self.inner.clone() }
994    }
995
996    fn into_inner(
997        self,
998    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
999    {
1000        (self.inner, self.is_terminated)
1001    }
1002
1003    fn from_inner(
1004        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1005        is_terminated: bool,
1006    ) -> Self {
1007        Self { inner, is_terminated }
1008    }
1009}
1010
1011impl futures::Stream for BaseRouteTableRequestStream {
1012    type Item = Result<BaseRouteTableRequest, fidl::Error>;
1013
1014    fn poll_next(
1015        mut self: std::pin::Pin<&mut Self>,
1016        cx: &mut std::task::Context<'_>,
1017    ) -> std::task::Poll<Option<Self::Item>> {
1018        let this = &mut *self;
1019        if this.inner.check_shutdown(cx) {
1020            this.is_terminated = true;
1021            return std::task::Poll::Ready(None);
1022        }
1023        if this.is_terminated {
1024            panic!("polled BaseRouteTableRequestStream after completion");
1025        }
1026        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1027            |bytes, handles| {
1028                match this.inner.channel().read_etc(cx, bytes, handles) {
1029                    std::task::Poll::Ready(Ok(())) => {}
1030                    std::task::Poll::Pending => return std::task::Poll::Pending,
1031                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1032                        this.is_terminated = true;
1033                        return std::task::Poll::Ready(None);
1034                    }
1035                    std::task::Poll::Ready(Err(e)) => {
1036                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1037                            e.into(),
1038                        ))))
1039                    }
1040                }
1041
1042                // A message has been received from the channel
1043                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1044
1045                std::task::Poll::Ready(Some(match header.ordinal {
1046                    0x7eab30c55edbfc15 => {
1047                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1048                        let mut req = fidl::new_empty!(
1049                            fidl::encoding::EmptyPayload,
1050                            fidl::encoding::DefaultFuchsiaResourceDialect
1051                        );
1052                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1053                        let control_handle =
1054                            BaseRouteTableControlHandle { inner: this.inner.clone() };
1055                        Ok(BaseRouteTableRequest::GetTableId {
1056                            responder: BaseRouteTableGetTableIdResponder {
1057                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1058                                tx_id: header.tx_id,
1059                            },
1060                        })
1061                    }
1062                    0x2853ab157285b384 => {
1063                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1064                        let mut req = fidl::new_empty!(
1065                            fidl::encoding::EmptyPayload,
1066                            fidl::encoding::DefaultFuchsiaResourceDialect
1067                        );
1068                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1069                        let control_handle =
1070                            BaseRouteTableControlHandle { inner: this.inner.clone() };
1071                        Ok(BaseRouteTableRequest::Detach { control_handle })
1072                    }
1073                    0xc42e58a5fc79426 => {
1074                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1075                        let mut req = fidl::new_empty!(
1076                            fidl::encoding::EmptyPayload,
1077                            fidl::encoding::DefaultFuchsiaResourceDialect
1078                        );
1079                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1080                        let control_handle =
1081                            BaseRouteTableControlHandle { inner: this.inner.clone() };
1082                        Ok(BaseRouteTableRequest::Remove {
1083                            responder: BaseRouteTableRemoveResponder {
1084                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1085                                tx_id: header.tx_id,
1086                            },
1087                        })
1088                    }
1089                    0x56a48c921ff3b6eb => {
1090                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1091                        let mut req = fidl::new_empty!(
1092                            fidl::encoding::EmptyPayload,
1093                            fidl::encoding::DefaultFuchsiaResourceDialect
1094                        );
1095                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1096                        let control_handle =
1097                            BaseRouteTableControlHandle { inner: this.inner.clone() };
1098                        Ok(BaseRouteTableRequest::GetAuthorizationForRouteTable {
1099                            responder: BaseRouteTableGetAuthorizationForRouteTableResponder {
1100                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1101                                tx_id: header.tx_id,
1102                            },
1103                        })
1104                    }
1105                    _ => Err(fidl::Error::UnknownOrdinal {
1106                        ordinal: header.ordinal,
1107                        protocol_name:
1108                            <BaseRouteTableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1109                    }),
1110                }))
1111            },
1112        )
1113    }
1114}
1115
1116/// Common base for `RouteTable` protocol that is IP version agnostic. This
1117/// helps reduce FIDL duplication.
1118#[derive(Debug)]
1119pub enum BaseRouteTableRequest {
1120    /// Gets the table ID for this table.
1121    GetTableId { responder: BaseRouteTableGetTableIdResponder },
1122    /// Detaches the lifetime of the route table from the lifetime of the
1123    /// client end of the channel.
1124    ///
1125    /// After this method is called, the route table will not be removed
1126    /// if the client end is closed. It's a no-op if called on the main table.
1127    Detach { control_handle: BaseRouteTableControlHandle },
1128    /// Removes the route table explicitly.
1129    ///
1130    /// This method cannot be called on the main table, an error will be
1131    /// returned if called. The server will close the channel after this
1132    /// method successfully returns.
1133    Remove { responder: BaseRouteTableRemoveResponder },
1134    /// Gets an authentication credential for this table.
1135    ///
1136    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
1137    /// held by the server. This credential can be passed into
1138    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
1139    /// table. The `EVENT` is stable throughout the lifetime of the route table.
1140    /// Clients may duplicate this `EVENT` to make multiple API calls, or
1141    /// transfer the `EVENT` to other clients.
1142    ///
1143    /// - response `credential` the authorization credential for this table.
1144    GetAuthorizationForRouteTable {
1145        responder: BaseRouteTableGetAuthorizationForRouteTableResponder,
1146    },
1147}
1148
1149impl BaseRouteTableRequest {
1150    #[allow(irrefutable_let_patterns)]
1151    pub fn into_get_table_id(self) -> Option<(BaseRouteTableGetTableIdResponder)> {
1152        if let BaseRouteTableRequest::GetTableId { responder } = self {
1153            Some((responder))
1154        } else {
1155            None
1156        }
1157    }
1158
1159    #[allow(irrefutable_let_patterns)]
1160    pub fn into_detach(self) -> Option<(BaseRouteTableControlHandle)> {
1161        if let BaseRouteTableRequest::Detach { control_handle } = self {
1162            Some((control_handle))
1163        } else {
1164            None
1165        }
1166    }
1167
1168    #[allow(irrefutable_let_patterns)]
1169    pub fn into_remove(self) -> Option<(BaseRouteTableRemoveResponder)> {
1170        if let BaseRouteTableRequest::Remove { responder } = self {
1171            Some((responder))
1172        } else {
1173            None
1174        }
1175    }
1176
1177    #[allow(irrefutable_let_patterns)]
1178    pub fn into_get_authorization_for_route_table(
1179        self,
1180    ) -> Option<(BaseRouteTableGetAuthorizationForRouteTableResponder)> {
1181        if let BaseRouteTableRequest::GetAuthorizationForRouteTable { responder } = self {
1182            Some((responder))
1183        } else {
1184            None
1185        }
1186    }
1187
1188    /// Name of the method defined in FIDL
1189    pub fn method_name(&self) -> &'static str {
1190        match *self {
1191            BaseRouteTableRequest::GetTableId { .. } => "get_table_id",
1192            BaseRouteTableRequest::Detach { .. } => "detach",
1193            BaseRouteTableRequest::Remove { .. } => "remove",
1194            BaseRouteTableRequest::GetAuthorizationForRouteTable { .. } => {
1195                "get_authorization_for_route_table"
1196            }
1197        }
1198    }
1199}
1200
1201#[derive(Debug, Clone)]
1202pub struct BaseRouteTableControlHandle {
1203    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1204}
1205
1206impl fidl::endpoints::ControlHandle for BaseRouteTableControlHandle {
1207    fn shutdown(&self) {
1208        self.inner.shutdown()
1209    }
1210    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1211        self.inner.shutdown_with_epitaph(status)
1212    }
1213
1214    fn is_closed(&self) -> bool {
1215        self.inner.channel().is_closed()
1216    }
1217    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1218        self.inner.channel().on_closed()
1219    }
1220
1221    #[cfg(target_os = "fuchsia")]
1222    fn signal_peer(
1223        &self,
1224        clear_mask: zx::Signals,
1225        set_mask: zx::Signals,
1226    ) -> Result<(), zx_status::Status> {
1227        use fidl::Peered;
1228        self.inner.channel().signal_peer(clear_mask, set_mask)
1229    }
1230}
1231
1232impl BaseRouteTableControlHandle {}
1233
1234#[must_use = "FIDL methods require a response to be sent"]
1235#[derive(Debug)]
1236pub struct BaseRouteTableGetTableIdResponder {
1237    control_handle: std::mem::ManuallyDrop<BaseRouteTableControlHandle>,
1238    tx_id: u32,
1239}
1240
1241/// Set the the channel to be shutdown (see [`BaseRouteTableControlHandle::shutdown`])
1242/// if the responder is dropped without sending a response, so that the client
1243/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1244impl std::ops::Drop for BaseRouteTableGetTableIdResponder {
1245    fn drop(&mut self) {
1246        self.control_handle.shutdown();
1247        // Safety: drops once, never accessed again
1248        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1249    }
1250}
1251
1252impl fidl::endpoints::Responder for BaseRouteTableGetTableIdResponder {
1253    type ControlHandle = BaseRouteTableControlHandle;
1254
1255    fn control_handle(&self) -> &BaseRouteTableControlHandle {
1256        &self.control_handle
1257    }
1258
1259    fn drop_without_shutdown(mut self) {
1260        // Safety: drops once, never accessed again due to mem::forget
1261        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1262        // Prevent Drop from running (which would shut down the channel)
1263        std::mem::forget(self);
1264    }
1265}
1266
1267impl BaseRouteTableGetTableIdResponder {
1268    /// Sends a response to the FIDL transaction.
1269    ///
1270    /// Sets the channel to shutdown if an error occurs.
1271    pub fn send(self, mut table_id: u32) -> Result<(), fidl::Error> {
1272        let _result = self.send_raw(table_id);
1273        if _result.is_err() {
1274            self.control_handle.shutdown();
1275        }
1276        self.drop_without_shutdown();
1277        _result
1278    }
1279
1280    /// Similar to "send" but does not shutdown the channel if an error occurs.
1281    pub fn send_no_shutdown_on_err(self, mut table_id: u32) -> Result<(), fidl::Error> {
1282        let _result = self.send_raw(table_id);
1283        self.drop_without_shutdown();
1284        _result
1285    }
1286
1287    fn send_raw(&self, mut table_id: u32) -> Result<(), fidl::Error> {
1288        self.control_handle.inner.send::<BaseRouteTableGetTableIdResponse>(
1289            (table_id,),
1290            self.tx_id,
1291            0x7eab30c55edbfc15,
1292            fidl::encoding::DynamicFlags::empty(),
1293        )
1294    }
1295}
1296
1297#[must_use = "FIDL methods require a response to be sent"]
1298#[derive(Debug)]
1299pub struct BaseRouteTableRemoveResponder {
1300    control_handle: std::mem::ManuallyDrop<BaseRouteTableControlHandle>,
1301    tx_id: u32,
1302}
1303
1304/// Set the the channel to be shutdown (see [`BaseRouteTableControlHandle::shutdown`])
1305/// if the responder is dropped without sending a response, so that the client
1306/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1307impl std::ops::Drop for BaseRouteTableRemoveResponder {
1308    fn drop(&mut self) {
1309        self.control_handle.shutdown();
1310        // Safety: drops once, never accessed again
1311        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1312    }
1313}
1314
1315impl fidl::endpoints::Responder for BaseRouteTableRemoveResponder {
1316    type ControlHandle = BaseRouteTableControlHandle;
1317
1318    fn control_handle(&self) -> &BaseRouteTableControlHandle {
1319        &self.control_handle
1320    }
1321
1322    fn drop_without_shutdown(mut self) {
1323        // Safety: drops once, never accessed again due to mem::forget
1324        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1325        // Prevent Drop from running (which would shut down the channel)
1326        std::mem::forget(self);
1327    }
1328}
1329
1330impl BaseRouteTableRemoveResponder {
1331    /// Sends a response to the FIDL transaction.
1332    ///
1333    /// Sets the channel to shutdown if an error occurs.
1334    pub fn send(
1335        self,
1336        mut result: Result<(), BaseRouteTableRemoveError>,
1337    ) -> Result<(), fidl::Error> {
1338        let _result = self.send_raw(result);
1339        if _result.is_err() {
1340            self.control_handle.shutdown();
1341        }
1342        self.drop_without_shutdown();
1343        _result
1344    }
1345
1346    /// Similar to "send" but does not shutdown the channel if an error occurs.
1347    pub fn send_no_shutdown_on_err(
1348        self,
1349        mut result: Result<(), BaseRouteTableRemoveError>,
1350    ) -> Result<(), fidl::Error> {
1351        let _result = self.send_raw(result);
1352        self.drop_without_shutdown();
1353        _result
1354    }
1355
1356    fn send_raw(
1357        &self,
1358        mut result: Result<(), BaseRouteTableRemoveError>,
1359    ) -> Result<(), fidl::Error> {
1360        self.control_handle.inner.send::<fidl::encoding::ResultType<
1361            fidl::encoding::EmptyStruct,
1362            BaseRouteTableRemoveError,
1363        >>(
1364            result,
1365            self.tx_id,
1366            0xc42e58a5fc79426,
1367            fidl::encoding::DynamicFlags::empty(),
1368        )
1369    }
1370}
1371
1372#[must_use = "FIDL methods require a response to be sent"]
1373#[derive(Debug)]
1374pub struct BaseRouteTableGetAuthorizationForRouteTableResponder {
1375    control_handle: std::mem::ManuallyDrop<BaseRouteTableControlHandle>,
1376    tx_id: u32,
1377}
1378
1379/// Set the the channel to be shutdown (see [`BaseRouteTableControlHandle::shutdown`])
1380/// if the responder is dropped without sending a response, so that the client
1381/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1382impl std::ops::Drop for BaseRouteTableGetAuthorizationForRouteTableResponder {
1383    fn drop(&mut self) {
1384        self.control_handle.shutdown();
1385        // Safety: drops once, never accessed again
1386        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1387    }
1388}
1389
1390impl fidl::endpoints::Responder for BaseRouteTableGetAuthorizationForRouteTableResponder {
1391    type ControlHandle = BaseRouteTableControlHandle;
1392
1393    fn control_handle(&self) -> &BaseRouteTableControlHandle {
1394        &self.control_handle
1395    }
1396
1397    fn drop_without_shutdown(mut self) {
1398        // Safety: drops once, never accessed again due to mem::forget
1399        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1400        // Prevent Drop from running (which would shut down the channel)
1401        std::mem::forget(self);
1402    }
1403}
1404
1405impl BaseRouteTableGetAuthorizationForRouteTableResponder {
1406    /// Sends a response to the FIDL transaction.
1407    ///
1408    /// Sets the channel to shutdown if an error occurs.
1409    pub fn send(self, mut credential: GrantForRouteTableAuthorization) -> Result<(), fidl::Error> {
1410        let _result = self.send_raw(credential);
1411        if _result.is_err() {
1412            self.control_handle.shutdown();
1413        }
1414        self.drop_without_shutdown();
1415        _result
1416    }
1417
1418    /// Similar to "send" but does not shutdown the channel if an error occurs.
1419    pub fn send_no_shutdown_on_err(
1420        self,
1421        mut credential: GrantForRouteTableAuthorization,
1422    ) -> Result<(), fidl::Error> {
1423        let _result = self.send_raw(credential);
1424        self.drop_without_shutdown();
1425        _result
1426    }
1427
1428    fn send_raw(&self, mut credential: GrantForRouteTableAuthorization) -> Result<(), fidl::Error> {
1429        self.control_handle.inner.send::<BaseRouteTableGetAuthorizationForRouteTableResponse>(
1430            (&mut credential,),
1431            self.tx_id,
1432            0x56a48c921ff3b6eb,
1433            fidl::encoding::DynamicFlags::empty(),
1434        )
1435    }
1436}
1437
1438#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1439pub struct BaseRuleSetMarker;
1440
1441impl fidl::endpoints::ProtocolMarker for BaseRuleSetMarker {
1442    type Proxy = BaseRuleSetProxy;
1443    type RequestStream = BaseRuleSetRequestStream;
1444    #[cfg(target_os = "fuchsia")]
1445    type SynchronousProxy = BaseRuleSetSynchronousProxy;
1446
1447    const DEBUG_NAME: &'static str = "(anonymous) BaseRuleSet";
1448}
1449pub type BaseRuleSetAuthenticateForRouteTableResult = Result<(), AuthenticateForRouteTableError>;
1450pub type BaseRuleSetRemoveRuleResult = Result<(), RuleSetError>;
1451
1452pub trait BaseRuleSetProxyInterface: Send + Sync {
1453    type AuthenticateForRouteTableResponseFut: std::future::Future<
1454            Output = Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error>,
1455        > + Send;
1456    fn r#authenticate_for_route_table(
1457        &self,
1458        table: u32,
1459        token: fidl::Event,
1460    ) -> Self::AuthenticateForRouteTableResponseFut;
1461    type RemoveRuleResponseFut: std::future::Future<Output = Result<BaseRuleSetRemoveRuleResult, fidl::Error>>
1462        + Send;
1463    fn r#remove_rule(&self, index: u32) -> Self::RemoveRuleResponseFut;
1464    fn r#close(&self) -> Result<(), fidl::Error>;
1465}
1466#[derive(Debug)]
1467#[cfg(target_os = "fuchsia")]
1468pub struct BaseRuleSetSynchronousProxy {
1469    client: fidl::client::sync::Client,
1470}
1471
1472#[cfg(target_os = "fuchsia")]
1473impl fidl::endpoints::SynchronousProxy for BaseRuleSetSynchronousProxy {
1474    type Proxy = BaseRuleSetProxy;
1475    type Protocol = BaseRuleSetMarker;
1476
1477    fn from_channel(inner: fidl::Channel) -> Self {
1478        Self::new(inner)
1479    }
1480
1481    fn into_channel(self) -> fidl::Channel {
1482        self.client.into_channel()
1483    }
1484
1485    fn as_channel(&self) -> &fidl::Channel {
1486        self.client.as_channel()
1487    }
1488}
1489
1490#[cfg(target_os = "fuchsia")]
1491impl BaseRuleSetSynchronousProxy {
1492    pub fn new(channel: fidl::Channel) -> Self {
1493        let protocol_name = <BaseRuleSetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1494        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1495    }
1496
1497    pub fn into_channel(self) -> fidl::Channel {
1498        self.client.into_channel()
1499    }
1500
1501    /// Waits until an event arrives and returns it. It is safe for other
1502    /// threads to make concurrent requests while waiting for an event.
1503    pub fn wait_for_event(
1504        &self,
1505        deadline: zx::MonotonicInstant,
1506    ) -> Result<BaseRuleSetEvent, fidl::Error> {
1507        BaseRuleSetEvent::decode(self.client.wait_for_event(deadline)?)
1508    }
1509
1510    /// Authenticates for a route table that will be used in an action.
1511    pub fn r#authenticate_for_route_table(
1512        &self,
1513        mut table: u32,
1514        mut token: fidl::Event,
1515        ___deadline: zx::MonotonicInstant,
1516    ) -> Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error> {
1517        let _response =
1518            self.client.send_query::<ProofOfRouteTableAuthorization, fidl::encoding::ResultType<
1519                fidl::encoding::EmptyStruct,
1520                AuthenticateForRouteTableError,
1521            >>(
1522                (table, token),
1523                0x6fd845360ed9bc8f,
1524                fidl::encoding::DynamicFlags::empty(),
1525                ___deadline,
1526            )?;
1527        Ok(_response.map(|x| x))
1528    }
1529
1530    /// Removes a rule from this rule set.
1531    ///
1532    /// If the client tries to remove from an index that does not have a rule,
1533    /// the error `RULE_DOES_NOT_EXIST` will be returned.
1534    ///
1535    /// + request `index` the index of the rule.
1536    pub fn r#remove_rule(
1537        &self,
1538        mut index: u32,
1539        ___deadline: zx::MonotonicInstant,
1540    ) -> Result<BaseRuleSetRemoveRuleResult, fidl::Error> {
1541        let _response = self.client.send_query::<
1542            BaseRuleSetRemoveRuleRequest,
1543            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
1544        >(
1545            (index,),
1546            0x2ae3d7e817cbff90,
1547            fidl::encoding::DynamicFlags::empty(),
1548            ___deadline,
1549        )?;
1550        Ok(_response.map(|x| x))
1551    }
1552
1553    /// Removes all rules in the rule set and the underlying channel will be
1554    /// closed after the rules are removed.
1555    ///
1556    /// This method provides a way for synchronous closure.
1557    pub fn r#close(&self) -> Result<(), fidl::Error> {
1558        self.client.send::<fidl::encoding::EmptyPayload>(
1559            (),
1560            0x457e1753672d4073,
1561            fidl::encoding::DynamicFlags::empty(),
1562        )
1563    }
1564}
1565
1566#[derive(Debug, Clone)]
1567pub struct BaseRuleSetProxy {
1568    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1569}
1570
1571impl fidl::endpoints::Proxy for BaseRuleSetProxy {
1572    type Protocol = BaseRuleSetMarker;
1573
1574    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1575        Self::new(inner)
1576    }
1577
1578    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1579        self.client.into_channel().map_err(|client| Self { client })
1580    }
1581
1582    fn as_channel(&self) -> &::fidl::AsyncChannel {
1583        self.client.as_channel()
1584    }
1585}
1586
1587impl BaseRuleSetProxy {
1588    /// Create a new Proxy for fuchsia.net.routes.admin/BaseRuleSet.
1589    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1590        let protocol_name = <BaseRuleSetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1591        Self { client: fidl::client::Client::new(channel, protocol_name) }
1592    }
1593
1594    /// Get a Stream of events from the remote end of the protocol.
1595    ///
1596    /// # Panics
1597    ///
1598    /// Panics if the event stream was already taken.
1599    pub fn take_event_stream(&self) -> BaseRuleSetEventStream {
1600        BaseRuleSetEventStream { event_receiver: self.client.take_event_receiver() }
1601    }
1602
1603    /// Authenticates for a route table that will be used in an action.
1604    pub fn r#authenticate_for_route_table(
1605        &self,
1606        mut table: u32,
1607        mut token: fidl::Event,
1608    ) -> fidl::client::QueryResponseFut<
1609        BaseRuleSetAuthenticateForRouteTableResult,
1610        fidl::encoding::DefaultFuchsiaResourceDialect,
1611    > {
1612        BaseRuleSetProxyInterface::r#authenticate_for_route_table(self, table, token)
1613    }
1614
1615    /// Removes a rule from this rule set.
1616    ///
1617    /// If the client tries to remove from an index that does not have a rule,
1618    /// the error `RULE_DOES_NOT_EXIST` will be returned.
1619    ///
1620    /// + request `index` the index of the rule.
1621    pub fn r#remove_rule(
1622        &self,
1623        mut index: u32,
1624    ) -> fidl::client::QueryResponseFut<
1625        BaseRuleSetRemoveRuleResult,
1626        fidl::encoding::DefaultFuchsiaResourceDialect,
1627    > {
1628        BaseRuleSetProxyInterface::r#remove_rule(self, index)
1629    }
1630
1631    /// Removes all rules in the rule set and the underlying channel will be
1632    /// closed after the rules are removed.
1633    ///
1634    /// This method provides a way for synchronous closure.
1635    pub fn r#close(&self) -> Result<(), fidl::Error> {
1636        BaseRuleSetProxyInterface::r#close(self)
1637    }
1638}
1639
1640impl BaseRuleSetProxyInterface for BaseRuleSetProxy {
1641    type AuthenticateForRouteTableResponseFut = fidl::client::QueryResponseFut<
1642        BaseRuleSetAuthenticateForRouteTableResult,
1643        fidl::encoding::DefaultFuchsiaResourceDialect,
1644    >;
1645    fn r#authenticate_for_route_table(
1646        &self,
1647        mut table: u32,
1648        mut token: fidl::Event,
1649    ) -> Self::AuthenticateForRouteTableResponseFut {
1650        fn _decode(
1651            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1652        ) -> Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error> {
1653            let _response = fidl::client::decode_transaction_body::<
1654                fidl::encoding::ResultType<
1655                    fidl::encoding::EmptyStruct,
1656                    AuthenticateForRouteTableError,
1657                >,
1658                fidl::encoding::DefaultFuchsiaResourceDialect,
1659                0x6fd845360ed9bc8f,
1660            >(_buf?)?;
1661            Ok(_response.map(|x| x))
1662        }
1663        self.client.send_query_and_decode::<
1664            ProofOfRouteTableAuthorization,
1665            BaseRuleSetAuthenticateForRouteTableResult,
1666        >(
1667            (table, token,),
1668            0x6fd845360ed9bc8f,
1669            fidl::encoding::DynamicFlags::empty(),
1670            _decode,
1671        )
1672    }
1673
1674    type RemoveRuleResponseFut = fidl::client::QueryResponseFut<
1675        BaseRuleSetRemoveRuleResult,
1676        fidl::encoding::DefaultFuchsiaResourceDialect,
1677    >;
1678    fn r#remove_rule(&self, mut index: u32) -> Self::RemoveRuleResponseFut {
1679        fn _decode(
1680            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1681        ) -> Result<BaseRuleSetRemoveRuleResult, fidl::Error> {
1682            let _response = fidl::client::decode_transaction_body::<
1683                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
1684                fidl::encoding::DefaultFuchsiaResourceDialect,
1685                0x2ae3d7e817cbff90,
1686            >(_buf?)?;
1687            Ok(_response.map(|x| x))
1688        }
1689        self.client
1690            .send_query_and_decode::<BaseRuleSetRemoveRuleRequest, BaseRuleSetRemoveRuleResult>(
1691                (index,),
1692                0x2ae3d7e817cbff90,
1693                fidl::encoding::DynamicFlags::empty(),
1694                _decode,
1695            )
1696    }
1697
1698    fn r#close(&self) -> Result<(), fidl::Error> {
1699        self.client.send::<fidl::encoding::EmptyPayload>(
1700            (),
1701            0x457e1753672d4073,
1702            fidl::encoding::DynamicFlags::empty(),
1703        )
1704    }
1705}
1706
1707pub struct BaseRuleSetEventStream {
1708    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1709}
1710
1711impl std::marker::Unpin for BaseRuleSetEventStream {}
1712
1713impl futures::stream::FusedStream for BaseRuleSetEventStream {
1714    fn is_terminated(&self) -> bool {
1715        self.event_receiver.is_terminated()
1716    }
1717}
1718
1719impl futures::Stream for BaseRuleSetEventStream {
1720    type Item = Result<BaseRuleSetEvent, fidl::Error>;
1721
1722    fn poll_next(
1723        mut self: std::pin::Pin<&mut Self>,
1724        cx: &mut std::task::Context<'_>,
1725    ) -> std::task::Poll<Option<Self::Item>> {
1726        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1727            &mut self.event_receiver,
1728            cx
1729        )?) {
1730            Some(buf) => std::task::Poll::Ready(Some(BaseRuleSetEvent::decode(buf))),
1731            None => std::task::Poll::Ready(None),
1732        }
1733    }
1734}
1735
1736#[derive(Debug)]
1737pub enum BaseRuleSetEvent {}
1738
1739impl BaseRuleSetEvent {
1740    /// Decodes a message buffer as a [`BaseRuleSetEvent`].
1741    fn decode(
1742        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1743    ) -> Result<BaseRuleSetEvent, fidl::Error> {
1744        let (bytes, _handles) = buf.split_mut();
1745        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1746        debug_assert_eq!(tx_header.tx_id, 0);
1747        match tx_header.ordinal {
1748            _ => Err(fidl::Error::UnknownOrdinal {
1749                ordinal: tx_header.ordinal,
1750                protocol_name: <BaseRuleSetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1751            }),
1752        }
1753    }
1754}
1755
1756/// A Stream of incoming requests for fuchsia.net.routes.admin/BaseRuleSet.
1757pub struct BaseRuleSetRequestStream {
1758    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1759    is_terminated: bool,
1760}
1761
1762impl std::marker::Unpin for BaseRuleSetRequestStream {}
1763
1764impl futures::stream::FusedStream for BaseRuleSetRequestStream {
1765    fn is_terminated(&self) -> bool {
1766        self.is_terminated
1767    }
1768}
1769
1770impl fidl::endpoints::RequestStream for BaseRuleSetRequestStream {
1771    type Protocol = BaseRuleSetMarker;
1772    type ControlHandle = BaseRuleSetControlHandle;
1773
1774    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1775        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1776    }
1777
1778    fn control_handle(&self) -> Self::ControlHandle {
1779        BaseRuleSetControlHandle { inner: self.inner.clone() }
1780    }
1781
1782    fn into_inner(
1783        self,
1784    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1785    {
1786        (self.inner, self.is_terminated)
1787    }
1788
1789    fn from_inner(
1790        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1791        is_terminated: bool,
1792    ) -> Self {
1793        Self { inner, is_terminated }
1794    }
1795}
1796
1797impl futures::Stream for BaseRuleSetRequestStream {
1798    type Item = Result<BaseRuleSetRequest, fidl::Error>;
1799
1800    fn poll_next(
1801        mut self: std::pin::Pin<&mut Self>,
1802        cx: &mut std::task::Context<'_>,
1803    ) -> std::task::Poll<Option<Self::Item>> {
1804        let this = &mut *self;
1805        if this.inner.check_shutdown(cx) {
1806            this.is_terminated = true;
1807            return std::task::Poll::Ready(None);
1808        }
1809        if this.is_terminated {
1810            panic!("polled BaseRuleSetRequestStream after completion");
1811        }
1812        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1813            |bytes, handles| {
1814                match this.inner.channel().read_etc(cx, bytes, handles) {
1815                    std::task::Poll::Ready(Ok(())) => {}
1816                    std::task::Poll::Pending => return std::task::Poll::Pending,
1817                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1818                        this.is_terminated = true;
1819                        return std::task::Poll::Ready(None);
1820                    }
1821                    std::task::Poll::Ready(Err(e)) => {
1822                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1823                            e.into(),
1824                        ))))
1825                    }
1826                }
1827
1828                // A message has been received from the channel
1829                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1830
1831                std::task::Poll::Ready(Some(match header.ordinal {
1832                    0x6fd845360ed9bc8f => {
1833                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1834                        let mut req = fidl::new_empty!(
1835                            ProofOfRouteTableAuthorization,
1836                            fidl::encoding::DefaultFuchsiaResourceDialect
1837                        );
1838                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProofOfRouteTableAuthorization>(&header, _body_bytes, handles, &mut req)?;
1839                        let control_handle = BaseRuleSetControlHandle { inner: this.inner.clone() };
1840                        Ok(BaseRuleSetRequest::AuthenticateForRouteTable {
1841                            table: req.table,
1842                            token: req.token,
1843
1844                            responder: BaseRuleSetAuthenticateForRouteTableResponder {
1845                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1846                                tx_id: header.tx_id,
1847                            },
1848                        })
1849                    }
1850                    0x2ae3d7e817cbff90 => {
1851                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1852                        let mut req = fidl::new_empty!(
1853                            BaseRuleSetRemoveRuleRequest,
1854                            fidl::encoding::DefaultFuchsiaResourceDialect
1855                        );
1856                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BaseRuleSetRemoveRuleRequest>(&header, _body_bytes, handles, &mut req)?;
1857                        let control_handle = BaseRuleSetControlHandle { inner: this.inner.clone() };
1858                        Ok(BaseRuleSetRequest::RemoveRule {
1859                            index: req.index,
1860
1861                            responder: BaseRuleSetRemoveRuleResponder {
1862                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1863                                tx_id: header.tx_id,
1864                            },
1865                        })
1866                    }
1867                    0x457e1753672d4073 => {
1868                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1869                        let mut req = fidl::new_empty!(
1870                            fidl::encoding::EmptyPayload,
1871                            fidl::encoding::DefaultFuchsiaResourceDialect
1872                        );
1873                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1874                        let control_handle = BaseRuleSetControlHandle { inner: this.inner.clone() };
1875                        Ok(BaseRuleSetRequest::Close { control_handle })
1876                    }
1877                    _ => Err(fidl::Error::UnknownOrdinal {
1878                        ordinal: header.ordinal,
1879                        protocol_name:
1880                            <BaseRuleSetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1881                    }),
1882                }))
1883            },
1884        )
1885    }
1886}
1887
1888/// Common base for `RuleSet` protocol that is IP version agnostic. This
1889/// helps reduce FIDL duplication.
1890#[derive(Debug)]
1891pub enum BaseRuleSetRequest {
1892    /// Authenticates for a route table that will be used in an action.
1893    AuthenticateForRouteTable {
1894        table: u32,
1895        token: fidl::Event,
1896        responder: BaseRuleSetAuthenticateForRouteTableResponder,
1897    },
1898    /// Removes a rule from this rule set.
1899    ///
1900    /// If the client tries to remove from an index that does not have a rule,
1901    /// the error `RULE_DOES_NOT_EXIST` will be returned.
1902    ///
1903    /// + request `index` the index of the rule.
1904    RemoveRule { index: u32, responder: BaseRuleSetRemoveRuleResponder },
1905    /// Removes all rules in the rule set and the underlying channel will be
1906    /// closed after the rules are removed.
1907    ///
1908    /// This method provides a way for synchronous closure.
1909    Close { control_handle: BaseRuleSetControlHandle },
1910}
1911
1912impl BaseRuleSetRequest {
1913    #[allow(irrefutable_let_patterns)]
1914    pub fn into_authenticate_for_route_table(
1915        self,
1916    ) -> Option<(u32, fidl::Event, BaseRuleSetAuthenticateForRouteTableResponder)> {
1917        if let BaseRuleSetRequest::AuthenticateForRouteTable { table, token, responder } = self {
1918            Some((table, token, responder))
1919        } else {
1920            None
1921        }
1922    }
1923
1924    #[allow(irrefutable_let_patterns)]
1925    pub fn into_remove_rule(self) -> Option<(u32, BaseRuleSetRemoveRuleResponder)> {
1926        if let BaseRuleSetRequest::RemoveRule { index, responder } = self {
1927            Some((index, responder))
1928        } else {
1929            None
1930        }
1931    }
1932
1933    #[allow(irrefutable_let_patterns)]
1934    pub fn into_close(self) -> Option<(BaseRuleSetControlHandle)> {
1935        if let BaseRuleSetRequest::Close { control_handle } = self {
1936            Some((control_handle))
1937        } else {
1938            None
1939        }
1940    }
1941
1942    /// Name of the method defined in FIDL
1943    pub fn method_name(&self) -> &'static str {
1944        match *self {
1945            BaseRuleSetRequest::AuthenticateForRouteTable { .. } => "authenticate_for_route_table",
1946            BaseRuleSetRequest::RemoveRule { .. } => "remove_rule",
1947            BaseRuleSetRequest::Close { .. } => "close",
1948        }
1949    }
1950}
1951
1952#[derive(Debug, Clone)]
1953pub struct BaseRuleSetControlHandle {
1954    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1955}
1956
1957impl fidl::endpoints::ControlHandle for BaseRuleSetControlHandle {
1958    fn shutdown(&self) {
1959        self.inner.shutdown()
1960    }
1961    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1962        self.inner.shutdown_with_epitaph(status)
1963    }
1964
1965    fn is_closed(&self) -> bool {
1966        self.inner.channel().is_closed()
1967    }
1968    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1969        self.inner.channel().on_closed()
1970    }
1971
1972    #[cfg(target_os = "fuchsia")]
1973    fn signal_peer(
1974        &self,
1975        clear_mask: zx::Signals,
1976        set_mask: zx::Signals,
1977    ) -> Result<(), zx_status::Status> {
1978        use fidl::Peered;
1979        self.inner.channel().signal_peer(clear_mask, set_mask)
1980    }
1981}
1982
1983impl BaseRuleSetControlHandle {}
1984
1985#[must_use = "FIDL methods require a response to be sent"]
1986#[derive(Debug)]
1987pub struct BaseRuleSetAuthenticateForRouteTableResponder {
1988    control_handle: std::mem::ManuallyDrop<BaseRuleSetControlHandle>,
1989    tx_id: u32,
1990}
1991
1992/// Set the the channel to be shutdown (see [`BaseRuleSetControlHandle::shutdown`])
1993/// if the responder is dropped without sending a response, so that the client
1994/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1995impl std::ops::Drop for BaseRuleSetAuthenticateForRouteTableResponder {
1996    fn drop(&mut self) {
1997        self.control_handle.shutdown();
1998        // Safety: drops once, never accessed again
1999        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2000    }
2001}
2002
2003impl fidl::endpoints::Responder for BaseRuleSetAuthenticateForRouteTableResponder {
2004    type ControlHandle = BaseRuleSetControlHandle;
2005
2006    fn control_handle(&self) -> &BaseRuleSetControlHandle {
2007        &self.control_handle
2008    }
2009
2010    fn drop_without_shutdown(mut self) {
2011        // Safety: drops once, never accessed again due to mem::forget
2012        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2013        // Prevent Drop from running (which would shut down the channel)
2014        std::mem::forget(self);
2015    }
2016}
2017
2018impl BaseRuleSetAuthenticateForRouteTableResponder {
2019    /// Sends a response to the FIDL transaction.
2020    ///
2021    /// Sets the channel to shutdown if an error occurs.
2022    pub fn send(
2023        self,
2024        mut result: Result<(), AuthenticateForRouteTableError>,
2025    ) -> Result<(), fidl::Error> {
2026        let _result = self.send_raw(result);
2027        if _result.is_err() {
2028            self.control_handle.shutdown();
2029        }
2030        self.drop_without_shutdown();
2031        _result
2032    }
2033
2034    /// Similar to "send" but does not shutdown the channel if an error occurs.
2035    pub fn send_no_shutdown_on_err(
2036        self,
2037        mut result: Result<(), AuthenticateForRouteTableError>,
2038    ) -> Result<(), fidl::Error> {
2039        let _result = self.send_raw(result);
2040        self.drop_without_shutdown();
2041        _result
2042    }
2043
2044    fn send_raw(
2045        &self,
2046        mut result: Result<(), AuthenticateForRouteTableError>,
2047    ) -> Result<(), fidl::Error> {
2048        self.control_handle.inner.send::<fidl::encoding::ResultType<
2049            fidl::encoding::EmptyStruct,
2050            AuthenticateForRouteTableError,
2051        >>(
2052            result,
2053            self.tx_id,
2054            0x6fd845360ed9bc8f,
2055            fidl::encoding::DynamicFlags::empty(),
2056        )
2057    }
2058}
2059
2060#[must_use = "FIDL methods require a response to be sent"]
2061#[derive(Debug)]
2062pub struct BaseRuleSetRemoveRuleResponder {
2063    control_handle: std::mem::ManuallyDrop<BaseRuleSetControlHandle>,
2064    tx_id: u32,
2065}
2066
2067/// Set the the channel to be shutdown (see [`BaseRuleSetControlHandle::shutdown`])
2068/// if the responder is dropped without sending a response, so that the client
2069/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2070impl std::ops::Drop for BaseRuleSetRemoveRuleResponder {
2071    fn drop(&mut self) {
2072        self.control_handle.shutdown();
2073        // Safety: drops once, never accessed again
2074        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2075    }
2076}
2077
2078impl fidl::endpoints::Responder for BaseRuleSetRemoveRuleResponder {
2079    type ControlHandle = BaseRuleSetControlHandle;
2080
2081    fn control_handle(&self) -> &BaseRuleSetControlHandle {
2082        &self.control_handle
2083    }
2084
2085    fn drop_without_shutdown(mut self) {
2086        // Safety: drops once, never accessed again due to mem::forget
2087        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2088        // Prevent Drop from running (which would shut down the channel)
2089        std::mem::forget(self);
2090    }
2091}
2092
2093impl BaseRuleSetRemoveRuleResponder {
2094    /// Sends a response to the FIDL transaction.
2095    ///
2096    /// Sets the channel to shutdown if an error occurs.
2097    pub fn send(self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
2098        let _result = self.send_raw(result);
2099        if _result.is_err() {
2100            self.control_handle.shutdown();
2101        }
2102        self.drop_without_shutdown();
2103        _result
2104    }
2105
2106    /// Similar to "send" but does not shutdown the channel if an error occurs.
2107    pub fn send_no_shutdown_on_err(
2108        self,
2109        mut result: Result<(), RuleSetError>,
2110    ) -> Result<(), fidl::Error> {
2111        let _result = self.send_raw(result);
2112        self.drop_without_shutdown();
2113        _result
2114    }
2115
2116    fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
2117        self.control_handle.inner.send::<fidl::encoding::ResultType<
2118            fidl::encoding::EmptyStruct,
2119            RuleSetError,
2120        >>(
2121            result,
2122            self.tx_id,
2123            0x2ae3d7e817cbff90,
2124            fidl::encoding::DynamicFlags::empty(),
2125        )
2126    }
2127}
2128
2129#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2130pub struct RouteSetV4Marker;
2131
2132impl fidl::endpoints::ProtocolMarker for RouteSetV4Marker {
2133    type Proxy = RouteSetV4Proxy;
2134    type RequestStream = RouteSetV4RequestStream;
2135    #[cfg(target_os = "fuchsia")]
2136    type SynchronousProxy = RouteSetV4SynchronousProxy;
2137
2138    const DEBUG_NAME: &'static str = "(anonymous) RouteSetV4";
2139}
2140pub type RouteSetV4AuthenticateForInterfaceResult = Result<(), AuthenticateForInterfaceError>;
2141pub type RouteSetV4AddRouteResult = Result<bool, RouteSetError>;
2142pub type RouteSetV4RemoveRouteResult = Result<bool, RouteSetError>;
2143
2144pub trait RouteSetV4ProxyInterface: Send + Sync {
2145    type AuthenticateForInterfaceResponseFut: std::future::Future<Output = Result<RouteSetV4AuthenticateForInterfaceResult, fidl::Error>>
2146        + Send;
2147    fn r#authenticate_for_interface(
2148        &self,
2149        credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
2150    ) -> Self::AuthenticateForInterfaceResponseFut;
2151    type AddRouteResponseFut: std::future::Future<Output = Result<RouteSetV4AddRouteResult, fidl::Error>>
2152        + Send;
2153    fn r#add_route(&self, route: &fidl_fuchsia_net_routes::RouteV4) -> Self::AddRouteResponseFut;
2154    type RemoveRouteResponseFut: std::future::Future<Output = Result<RouteSetV4RemoveRouteResult, fidl::Error>>
2155        + Send;
2156    fn r#remove_route(
2157        &self,
2158        route: &fidl_fuchsia_net_routes::RouteV4,
2159    ) -> Self::RemoveRouteResponseFut;
2160}
2161#[derive(Debug)]
2162#[cfg(target_os = "fuchsia")]
2163pub struct RouteSetV4SynchronousProxy {
2164    client: fidl::client::sync::Client,
2165}
2166
2167#[cfg(target_os = "fuchsia")]
2168impl fidl::endpoints::SynchronousProxy for RouteSetV4SynchronousProxy {
2169    type Proxy = RouteSetV4Proxy;
2170    type Protocol = RouteSetV4Marker;
2171
2172    fn from_channel(inner: fidl::Channel) -> Self {
2173        Self::new(inner)
2174    }
2175
2176    fn into_channel(self) -> fidl::Channel {
2177        self.client.into_channel()
2178    }
2179
2180    fn as_channel(&self) -> &fidl::Channel {
2181        self.client.as_channel()
2182    }
2183}
2184
2185#[cfg(target_os = "fuchsia")]
2186impl RouteSetV4SynchronousProxy {
2187    pub fn new(channel: fidl::Channel) -> Self {
2188        let protocol_name = <RouteSetV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2189        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2190    }
2191
2192    pub fn into_channel(self) -> fidl::Channel {
2193        self.client.into_channel()
2194    }
2195
2196    /// Waits until an event arrives and returns it. It is safe for other
2197    /// threads to make concurrent requests while waiting for an event.
2198    pub fn wait_for_event(
2199        &self,
2200        deadline: zx::MonotonicInstant,
2201    ) -> Result<RouteSetV4Event, fidl::Error> {
2202        RouteSetV4Event::decode(self.client.wait_for_event(deadline)?)
2203    }
2204
2205    /// Authenticate this route set to manage routes on the provided interface.
2206    /// Authentication is valid for the lifetime of the route set.
2207    ///
2208    /// + request `interface` the authentication credential for an interface.
2209    pub fn r#authenticate_for_interface(
2210        &self,
2211        mut credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
2212        ___deadline: zx::MonotonicInstant,
2213    ) -> Result<RouteSetV4AuthenticateForInterfaceResult, fidl::Error> {
2214        let _response = self
2215            .client
2216            .send_query::<RouteSetV4AuthenticateForInterfaceRequest, fidl::encoding::ResultType<
2217                fidl::encoding::EmptyStruct,
2218                AuthenticateForInterfaceError,
2219            >>(
2220                (&mut credential,),
2221                0x74841ceef127518e,
2222                fidl::encoding::DynamicFlags::empty(),
2223                ___deadline,
2224            )?;
2225        Ok(_response.map(|x| x))
2226    }
2227
2228    /// Adds a route to this route set.
2229    ///
2230    /// + request `route` the route to add.
2231    /// - response `did_add` true iff the route was added to this `RouteSet`
2232    ///            as a result of this call.
2233    pub fn r#add_route(
2234        &self,
2235        mut route: &fidl_fuchsia_net_routes::RouteV4,
2236        ___deadline: zx::MonotonicInstant,
2237    ) -> Result<RouteSetV4AddRouteResult, fidl::Error> {
2238        let _response = self.client.send_query::<
2239            RouteSetV4AddRouteRequest,
2240            fidl::encoding::ResultType<RouteSetV4AddRouteResponse, RouteSetError>,
2241        >(
2242            (route,),
2243            0x4bd69e45539e8ec0,
2244            fidl::encoding::DynamicFlags::empty(),
2245            ___deadline,
2246        )?;
2247        Ok(_response.map(|x| x.did_add))
2248    }
2249
2250    /// Removes a route from this route set.
2251    ///
2252    /// Note that if this route also exists other route sets, it will not be
2253    /// removed from the global routing table.
2254    ///
2255    /// + request `route` the route to remove.
2256    /// - response `did_remove` true iff the route was removed from this
2257    ///            `RouteSet` as a result of this call.
2258    pub fn r#remove_route(
2259        &self,
2260        mut route: &fidl_fuchsia_net_routes::RouteV4,
2261        ___deadline: zx::MonotonicInstant,
2262    ) -> Result<RouteSetV4RemoveRouteResult, fidl::Error> {
2263        let _response = self.client.send_query::<
2264            RouteSetV4RemoveRouteRequest,
2265            fidl::encoding::ResultType<RouteSetV4RemoveRouteResponse, RouteSetError>,
2266        >(
2267            (route,),
2268            0x514f6880232f1665,
2269            fidl::encoding::DynamicFlags::empty(),
2270            ___deadline,
2271        )?;
2272        Ok(_response.map(|x| x.did_remove))
2273    }
2274}
2275
2276#[derive(Debug, Clone)]
2277pub struct RouteSetV4Proxy {
2278    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2279}
2280
2281impl fidl::endpoints::Proxy for RouteSetV4Proxy {
2282    type Protocol = RouteSetV4Marker;
2283
2284    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2285        Self::new(inner)
2286    }
2287
2288    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2289        self.client.into_channel().map_err(|client| Self { client })
2290    }
2291
2292    fn as_channel(&self) -> &::fidl::AsyncChannel {
2293        self.client.as_channel()
2294    }
2295}
2296
2297impl RouteSetV4Proxy {
2298    /// Create a new Proxy for fuchsia.net.routes.admin/RouteSetV4.
2299    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2300        let protocol_name = <RouteSetV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2301        Self { client: fidl::client::Client::new(channel, protocol_name) }
2302    }
2303
2304    /// Get a Stream of events from the remote end of the protocol.
2305    ///
2306    /// # Panics
2307    ///
2308    /// Panics if the event stream was already taken.
2309    pub fn take_event_stream(&self) -> RouteSetV4EventStream {
2310        RouteSetV4EventStream { event_receiver: self.client.take_event_receiver() }
2311    }
2312
2313    /// Authenticate this route set to manage routes on the provided interface.
2314    /// Authentication is valid for the lifetime of the route set.
2315    ///
2316    /// + request `interface` the authentication credential for an interface.
2317    pub fn r#authenticate_for_interface(
2318        &self,
2319        mut credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
2320    ) -> fidl::client::QueryResponseFut<
2321        RouteSetV4AuthenticateForInterfaceResult,
2322        fidl::encoding::DefaultFuchsiaResourceDialect,
2323    > {
2324        RouteSetV4ProxyInterface::r#authenticate_for_interface(self, credential)
2325    }
2326
2327    /// Adds a route to this route set.
2328    ///
2329    /// + request `route` the route to add.
2330    /// - response `did_add` true iff the route was added to this `RouteSet`
2331    ///            as a result of this call.
2332    pub fn r#add_route(
2333        &self,
2334        mut route: &fidl_fuchsia_net_routes::RouteV4,
2335    ) -> fidl::client::QueryResponseFut<
2336        RouteSetV4AddRouteResult,
2337        fidl::encoding::DefaultFuchsiaResourceDialect,
2338    > {
2339        RouteSetV4ProxyInterface::r#add_route(self, route)
2340    }
2341
2342    /// Removes a route from this route set.
2343    ///
2344    /// Note that if this route also exists other route sets, it will not be
2345    /// removed from the global routing table.
2346    ///
2347    /// + request `route` the route to remove.
2348    /// - response `did_remove` true iff the route was removed from this
2349    ///            `RouteSet` as a result of this call.
2350    pub fn r#remove_route(
2351        &self,
2352        mut route: &fidl_fuchsia_net_routes::RouteV4,
2353    ) -> fidl::client::QueryResponseFut<
2354        RouteSetV4RemoveRouteResult,
2355        fidl::encoding::DefaultFuchsiaResourceDialect,
2356    > {
2357        RouteSetV4ProxyInterface::r#remove_route(self, route)
2358    }
2359}
2360
2361impl RouteSetV4ProxyInterface for RouteSetV4Proxy {
2362    type AuthenticateForInterfaceResponseFut = fidl::client::QueryResponseFut<
2363        RouteSetV4AuthenticateForInterfaceResult,
2364        fidl::encoding::DefaultFuchsiaResourceDialect,
2365    >;
2366    fn r#authenticate_for_interface(
2367        &self,
2368        mut credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
2369    ) -> Self::AuthenticateForInterfaceResponseFut {
2370        fn _decode(
2371            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2372        ) -> Result<RouteSetV4AuthenticateForInterfaceResult, fidl::Error> {
2373            let _response = fidl::client::decode_transaction_body::<
2374                fidl::encoding::ResultType<
2375                    fidl::encoding::EmptyStruct,
2376                    AuthenticateForInterfaceError,
2377                >,
2378                fidl::encoding::DefaultFuchsiaResourceDialect,
2379                0x74841ceef127518e,
2380            >(_buf?)?;
2381            Ok(_response.map(|x| x))
2382        }
2383        self.client.send_query_and_decode::<
2384            RouteSetV4AuthenticateForInterfaceRequest,
2385            RouteSetV4AuthenticateForInterfaceResult,
2386        >(
2387            (&mut credential,),
2388            0x74841ceef127518e,
2389            fidl::encoding::DynamicFlags::empty(),
2390            _decode,
2391        )
2392    }
2393
2394    type AddRouteResponseFut = fidl::client::QueryResponseFut<
2395        RouteSetV4AddRouteResult,
2396        fidl::encoding::DefaultFuchsiaResourceDialect,
2397    >;
2398    fn r#add_route(
2399        &self,
2400        mut route: &fidl_fuchsia_net_routes::RouteV4,
2401    ) -> Self::AddRouteResponseFut {
2402        fn _decode(
2403            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2404        ) -> Result<RouteSetV4AddRouteResult, fidl::Error> {
2405            let _response = fidl::client::decode_transaction_body::<
2406                fidl::encoding::ResultType<RouteSetV4AddRouteResponse, RouteSetError>,
2407                fidl::encoding::DefaultFuchsiaResourceDialect,
2408                0x4bd69e45539e8ec0,
2409            >(_buf?)?;
2410            Ok(_response.map(|x| x.did_add))
2411        }
2412        self.client.send_query_and_decode::<RouteSetV4AddRouteRequest, RouteSetV4AddRouteResult>(
2413            (route,),
2414            0x4bd69e45539e8ec0,
2415            fidl::encoding::DynamicFlags::empty(),
2416            _decode,
2417        )
2418    }
2419
2420    type RemoveRouteResponseFut = fidl::client::QueryResponseFut<
2421        RouteSetV4RemoveRouteResult,
2422        fidl::encoding::DefaultFuchsiaResourceDialect,
2423    >;
2424    fn r#remove_route(
2425        &self,
2426        mut route: &fidl_fuchsia_net_routes::RouteV4,
2427    ) -> Self::RemoveRouteResponseFut {
2428        fn _decode(
2429            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2430        ) -> Result<RouteSetV4RemoveRouteResult, fidl::Error> {
2431            let _response = fidl::client::decode_transaction_body::<
2432                fidl::encoding::ResultType<RouteSetV4RemoveRouteResponse, RouteSetError>,
2433                fidl::encoding::DefaultFuchsiaResourceDialect,
2434                0x514f6880232f1665,
2435            >(_buf?)?;
2436            Ok(_response.map(|x| x.did_remove))
2437        }
2438        self.client
2439            .send_query_and_decode::<RouteSetV4RemoveRouteRequest, RouteSetV4RemoveRouteResult>(
2440                (route,),
2441                0x514f6880232f1665,
2442                fidl::encoding::DynamicFlags::empty(),
2443                _decode,
2444            )
2445    }
2446}
2447
2448pub struct RouteSetV4EventStream {
2449    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2450}
2451
2452impl std::marker::Unpin for RouteSetV4EventStream {}
2453
2454impl futures::stream::FusedStream for RouteSetV4EventStream {
2455    fn is_terminated(&self) -> bool {
2456        self.event_receiver.is_terminated()
2457    }
2458}
2459
2460impl futures::Stream for RouteSetV4EventStream {
2461    type Item = Result<RouteSetV4Event, fidl::Error>;
2462
2463    fn poll_next(
2464        mut self: std::pin::Pin<&mut Self>,
2465        cx: &mut std::task::Context<'_>,
2466    ) -> std::task::Poll<Option<Self::Item>> {
2467        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2468            &mut self.event_receiver,
2469            cx
2470        )?) {
2471            Some(buf) => std::task::Poll::Ready(Some(RouteSetV4Event::decode(buf))),
2472            None => std::task::Poll::Ready(None),
2473        }
2474    }
2475}
2476
2477#[derive(Debug)]
2478pub enum RouteSetV4Event {}
2479
2480impl RouteSetV4Event {
2481    /// Decodes a message buffer as a [`RouteSetV4Event`].
2482    fn decode(
2483        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2484    ) -> Result<RouteSetV4Event, fidl::Error> {
2485        let (bytes, _handles) = buf.split_mut();
2486        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2487        debug_assert_eq!(tx_header.tx_id, 0);
2488        match tx_header.ordinal {
2489            _ => Err(fidl::Error::UnknownOrdinal {
2490                ordinal: tx_header.ordinal,
2491                protocol_name: <RouteSetV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2492            }),
2493        }
2494    }
2495}
2496
2497/// A Stream of incoming requests for fuchsia.net.routes.admin/RouteSetV4.
2498pub struct RouteSetV4RequestStream {
2499    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2500    is_terminated: bool,
2501}
2502
2503impl std::marker::Unpin for RouteSetV4RequestStream {}
2504
2505impl futures::stream::FusedStream for RouteSetV4RequestStream {
2506    fn is_terminated(&self) -> bool {
2507        self.is_terminated
2508    }
2509}
2510
2511impl fidl::endpoints::RequestStream for RouteSetV4RequestStream {
2512    type Protocol = RouteSetV4Marker;
2513    type ControlHandle = RouteSetV4ControlHandle;
2514
2515    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2516        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2517    }
2518
2519    fn control_handle(&self) -> Self::ControlHandle {
2520        RouteSetV4ControlHandle { inner: self.inner.clone() }
2521    }
2522
2523    fn into_inner(
2524        self,
2525    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2526    {
2527        (self.inner, self.is_terminated)
2528    }
2529
2530    fn from_inner(
2531        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2532        is_terminated: bool,
2533    ) -> Self {
2534        Self { inner, is_terminated }
2535    }
2536}
2537
2538impl futures::Stream for RouteSetV4RequestStream {
2539    type Item = Result<RouteSetV4Request, fidl::Error>;
2540
2541    fn poll_next(
2542        mut self: std::pin::Pin<&mut Self>,
2543        cx: &mut std::task::Context<'_>,
2544    ) -> std::task::Poll<Option<Self::Item>> {
2545        let this = &mut *self;
2546        if this.inner.check_shutdown(cx) {
2547            this.is_terminated = true;
2548            return std::task::Poll::Ready(None);
2549        }
2550        if this.is_terminated {
2551            panic!("polled RouteSetV4RequestStream after completion");
2552        }
2553        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2554            |bytes, handles| {
2555                match this.inner.channel().read_etc(cx, bytes, handles) {
2556                    std::task::Poll::Ready(Ok(())) => {}
2557                    std::task::Poll::Pending => return std::task::Poll::Pending,
2558                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2559                        this.is_terminated = true;
2560                        return std::task::Poll::Ready(None);
2561                    }
2562                    std::task::Poll::Ready(Err(e)) => {
2563                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2564                            e.into(),
2565                        ))))
2566                    }
2567                }
2568
2569                // A message has been received from the channel
2570                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2571
2572                std::task::Poll::Ready(Some(match header.ordinal {
2573                    0x74841ceef127518e => {
2574                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2575                        let mut req = fidl::new_empty!(
2576                            RouteSetV4AuthenticateForInterfaceRequest,
2577                            fidl::encoding::DefaultFuchsiaResourceDialect
2578                        );
2579                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RouteSetV4AuthenticateForInterfaceRequest>(&header, _body_bytes, handles, &mut req)?;
2580                        let control_handle = RouteSetV4ControlHandle { inner: this.inner.clone() };
2581                        Ok(RouteSetV4Request::AuthenticateForInterface {
2582                            credential: req.credential,
2583
2584                            responder: RouteSetV4AuthenticateForInterfaceResponder {
2585                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2586                                tx_id: header.tx_id,
2587                            },
2588                        })
2589                    }
2590                    0x4bd69e45539e8ec0 => {
2591                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2592                        let mut req = fidl::new_empty!(
2593                            RouteSetV4AddRouteRequest,
2594                            fidl::encoding::DefaultFuchsiaResourceDialect
2595                        );
2596                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RouteSetV4AddRouteRequest>(&header, _body_bytes, handles, &mut req)?;
2597                        let control_handle = RouteSetV4ControlHandle { inner: this.inner.clone() };
2598                        Ok(RouteSetV4Request::AddRoute {
2599                            route: req.route,
2600
2601                            responder: RouteSetV4AddRouteResponder {
2602                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2603                                tx_id: header.tx_id,
2604                            },
2605                        })
2606                    }
2607                    0x514f6880232f1665 => {
2608                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2609                        let mut req = fidl::new_empty!(
2610                            RouteSetV4RemoveRouteRequest,
2611                            fidl::encoding::DefaultFuchsiaResourceDialect
2612                        );
2613                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RouteSetV4RemoveRouteRequest>(&header, _body_bytes, handles, &mut req)?;
2614                        let control_handle = RouteSetV4ControlHandle { inner: this.inner.clone() };
2615                        Ok(RouteSetV4Request::RemoveRoute {
2616                            route: req.route,
2617
2618                            responder: RouteSetV4RemoveRouteResponder {
2619                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2620                                tx_id: header.tx_id,
2621                            },
2622                        })
2623                    }
2624                    _ => Err(fidl::Error::UnknownOrdinal {
2625                        ordinal: header.ordinal,
2626                        protocol_name:
2627                            <RouteSetV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2628                    }),
2629                }))
2630            },
2631        )
2632    }
2633}
2634
2635/// Provides mutable access over a set of system's IPv4 routes.
2636///
2637/// The system maintains a single global routing table. A route set offers an
2638/// isolated window into a subset of the global routing table: clients are free
2639/// to manage the routes within their own route set, but not the route set of
2640/// others. Thus the global routing table represents the union of all existing
2641/// route sets. A route must be removed from all route sets to which it belongs
2642/// before it will be removed from the global table.
2643///
2644/// This protocol encodes the lifetime of the route set. Closing the client end
2645/// removes the route set, and will also remove any routes that were
2646/// solely-owned by this route set.
2647///
2648/// Note that the system reserves the right to remove routes out from underneath
2649/// this route set. This will always manifest as a `removed` event on the
2650/// [`fuchsia.net.routes/WatcherV4`] protocol.
2651///
2652/// If the route table backing this route set is removed, then this protocol
2653/// will be closed with a `ZX_ERR_UNAVAILABLE` epitaph.
2654#[derive(Debug)]
2655pub enum RouteSetV4Request {
2656    /// Authenticate this route set to manage routes on the provided interface.
2657    /// Authentication is valid for the lifetime of the route set.
2658    ///
2659    /// + request `interface` the authentication credential for an interface.
2660    AuthenticateForInterface {
2661        credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
2662        responder: RouteSetV4AuthenticateForInterfaceResponder,
2663    },
2664    /// Adds a route to this route set.
2665    ///
2666    /// + request `route` the route to add.
2667    /// - response `did_add` true iff the route was added to this `RouteSet`
2668    ///            as a result of this call.
2669    AddRoute { route: fidl_fuchsia_net_routes::RouteV4, responder: RouteSetV4AddRouteResponder },
2670    /// Removes a route from this route set.
2671    ///
2672    /// Note that if this route also exists other route sets, it will not be
2673    /// removed from the global routing table.
2674    ///
2675    /// + request `route` the route to remove.
2676    /// - response `did_remove` true iff the route was removed from this
2677    ///            `RouteSet` as a result of this call.
2678    RemoveRoute {
2679        route: fidl_fuchsia_net_routes::RouteV4,
2680        responder: RouteSetV4RemoveRouteResponder,
2681    },
2682}
2683
2684impl RouteSetV4Request {
2685    #[allow(irrefutable_let_patterns)]
2686    pub fn into_authenticate_for_interface(
2687        self,
2688    ) -> Option<(
2689        fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
2690        RouteSetV4AuthenticateForInterfaceResponder,
2691    )> {
2692        if let RouteSetV4Request::AuthenticateForInterface { credential, responder } = self {
2693            Some((credential, responder))
2694        } else {
2695            None
2696        }
2697    }
2698
2699    #[allow(irrefutable_let_patterns)]
2700    pub fn into_add_route(
2701        self,
2702    ) -> Option<(fidl_fuchsia_net_routes::RouteV4, RouteSetV4AddRouteResponder)> {
2703        if let RouteSetV4Request::AddRoute { route, responder } = self {
2704            Some((route, responder))
2705        } else {
2706            None
2707        }
2708    }
2709
2710    #[allow(irrefutable_let_patterns)]
2711    pub fn into_remove_route(
2712        self,
2713    ) -> Option<(fidl_fuchsia_net_routes::RouteV4, RouteSetV4RemoveRouteResponder)> {
2714        if let RouteSetV4Request::RemoveRoute { route, responder } = self {
2715            Some((route, responder))
2716        } else {
2717            None
2718        }
2719    }
2720
2721    /// Name of the method defined in FIDL
2722    pub fn method_name(&self) -> &'static str {
2723        match *self {
2724            RouteSetV4Request::AuthenticateForInterface { .. } => "authenticate_for_interface",
2725            RouteSetV4Request::AddRoute { .. } => "add_route",
2726            RouteSetV4Request::RemoveRoute { .. } => "remove_route",
2727        }
2728    }
2729}
2730
2731#[derive(Debug, Clone)]
2732pub struct RouteSetV4ControlHandle {
2733    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2734}
2735
2736impl fidl::endpoints::ControlHandle for RouteSetV4ControlHandle {
2737    fn shutdown(&self) {
2738        self.inner.shutdown()
2739    }
2740    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2741        self.inner.shutdown_with_epitaph(status)
2742    }
2743
2744    fn is_closed(&self) -> bool {
2745        self.inner.channel().is_closed()
2746    }
2747    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2748        self.inner.channel().on_closed()
2749    }
2750
2751    #[cfg(target_os = "fuchsia")]
2752    fn signal_peer(
2753        &self,
2754        clear_mask: zx::Signals,
2755        set_mask: zx::Signals,
2756    ) -> Result<(), zx_status::Status> {
2757        use fidl::Peered;
2758        self.inner.channel().signal_peer(clear_mask, set_mask)
2759    }
2760}
2761
2762impl RouteSetV4ControlHandle {}
2763
2764#[must_use = "FIDL methods require a response to be sent"]
2765#[derive(Debug)]
2766pub struct RouteSetV4AuthenticateForInterfaceResponder {
2767    control_handle: std::mem::ManuallyDrop<RouteSetV4ControlHandle>,
2768    tx_id: u32,
2769}
2770
2771/// Set the the channel to be shutdown (see [`RouteSetV4ControlHandle::shutdown`])
2772/// if the responder is dropped without sending a response, so that the client
2773/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2774impl std::ops::Drop for RouteSetV4AuthenticateForInterfaceResponder {
2775    fn drop(&mut self) {
2776        self.control_handle.shutdown();
2777        // Safety: drops once, never accessed again
2778        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2779    }
2780}
2781
2782impl fidl::endpoints::Responder for RouteSetV4AuthenticateForInterfaceResponder {
2783    type ControlHandle = RouteSetV4ControlHandle;
2784
2785    fn control_handle(&self) -> &RouteSetV4ControlHandle {
2786        &self.control_handle
2787    }
2788
2789    fn drop_without_shutdown(mut self) {
2790        // Safety: drops once, never accessed again due to mem::forget
2791        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2792        // Prevent Drop from running (which would shut down the channel)
2793        std::mem::forget(self);
2794    }
2795}
2796
2797impl RouteSetV4AuthenticateForInterfaceResponder {
2798    /// Sends a response to the FIDL transaction.
2799    ///
2800    /// Sets the channel to shutdown if an error occurs.
2801    pub fn send(
2802        self,
2803        mut result: Result<(), AuthenticateForInterfaceError>,
2804    ) -> Result<(), fidl::Error> {
2805        let _result = self.send_raw(result);
2806        if _result.is_err() {
2807            self.control_handle.shutdown();
2808        }
2809        self.drop_without_shutdown();
2810        _result
2811    }
2812
2813    /// Similar to "send" but does not shutdown the channel if an error occurs.
2814    pub fn send_no_shutdown_on_err(
2815        self,
2816        mut result: Result<(), AuthenticateForInterfaceError>,
2817    ) -> Result<(), fidl::Error> {
2818        let _result = self.send_raw(result);
2819        self.drop_without_shutdown();
2820        _result
2821    }
2822
2823    fn send_raw(
2824        &self,
2825        mut result: Result<(), AuthenticateForInterfaceError>,
2826    ) -> Result<(), fidl::Error> {
2827        self.control_handle.inner.send::<fidl::encoding::ResultType<
2828            fidl::encoding::EmptyStruct,
2829            AuthenticateForInterfaceError,
2830        >>(
2831            result,
2832            self.tx_id,
2833            0x74841ceef127518e,
2834            fidl::encoding::DynamicFlags::empty(),
2835        )
2836    }
2837}
2838
2839#[must_use = "FIDL methods require a response to be sent"]
2840#[derive(Debug)]
2841pub struct RouteSetV4AddRouteResponder {
2842    control_handle: std::mem::ManuallyDrop<RouteSetV4ControlHandle>,
2843    tx_id: u32,
2844}
2845
2846/// Set the the channel to be shutdown (see [`RouteSetV4ControlHandle::shutdown`])
2847/// if the responder is dropped without sending a response, so that the client
2848/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2849impl std::ops::Drop for RouteSetV4AddRouteResponder {
2850    fn drop(&mut self) {
2851        self.control_handle.shutdown();
2852        // Safety: drops once, never accessed again
2853        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2854    }
2855}
2856
2857impl fidl::endpoints::Responder for RouteSetV4AddRouteResponder {
2858    type ControlHandle = RouteSetV4ControlHandle;
2859
2860    fn control_handle(&self) -> &RouteSetV4ControlHandle {
2861        &self.control_handle
2862    }
2863
2864    fn drop_without_shutdown(mut self) {
2865        // Safety: drops once, never accessed again due to mem::forget
2866        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2867        // Prevent Drop from running (which would shut down the channel)
2868        std::mem::forget(self);
2869    }
2870}
2871
2872impl RouteSetV4AddRouteResponder {
2873    /// Sends a response to the FIDL transaction.
2874    ///
2875    /// Sets the channel to shutdown if an error occurs.
2876    pub fn send(self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
2877        let _result = self.send_raw(result);
2878        if _result.is_err() {
2879            self.control_handle.shutdown();
2880        }
2881        self.drop_without_shutdown();
2882        _result
2883    }
2884
2885    /// Similar to "send" but does not shutdown the channel if an error occurs.
2886    pub fn send_no_shutdown_on_err(
2887        self,
2888        mut result: Result<bool, RouteSetError>,
2889    ) -> Result<(), fidl::Error> {
2890        let _result = self.send_raw(result);
2891        self.drop_without_shutdown();
2892        _result
2893    }
2894
2895    fn send_raw(&self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
2896        self.control_handle.inner.send::<fidl::encoding::ResultType<
2897            RouteSetV4AddRouteResponse,
2898            RouteSetError,
2899        >>(
2900            result.map(|did_add| (did_add,)),
2901            self.tx_id,
2902            0x4bd69e45539e8ec0,
2903            fidl::encoding::DynamicFlags::empty(),
2904        )
2905    }
2906}
2907
2908#[must_use = "FIDL methods require a response to be sent"]
2909#[derive(Debug)]
2910pub struct RouteSetV4RemoveRouteResponder {
2911    control_handle: std::mem::ManuallyDrop<RouteSetV4ControlHandle>,
2912    tx_id: u32,
2913}
2914
2915/// Set the the channel to be shutdown (see [`RouteSetV4ControlHandle::shutdown`])
2916/// if the responder is dropped without sending a response, so that the client
2917/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2918impl std::ops::Drop for RouteSetV4RemoveRouteResponder {
2919    fn drop(&mut self) {
2920        self.control_handle.shutdown();
2921        // Safety: drops once, never accessed again
2922        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2923    }
2924}
2925
2926impl fidl::endpoints::Responder for RouteSetV4RemoveRouteResponder {
2927    type ControlHandle = RouteSetV4ControlHandle;
2928
2929    fn control_handle(&self) -> &RouteSetV4ControlHandle {
2930        &self.control_handle
2931    }
2932
2933    fn drop_without_shutdown(mut self) {
2934        // Safety: drops once, never accessed again due to mem::forget
2935        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2936        // Prevent Drop from running (which would shut down the channel)
2937        std::mem::forget(self);
2938    }
2939}
2940
2941impl RouteSetV4RemoveRouteResponder {
2942    /// Sends a response to the FIDL transaction.
2943    ///
2944    /// Sets the channel to shutdown if an error occurs.
2945    pub fn send(self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
2946        let _result = self.send_raw(result);
2947        if _result.is_err() {
2948            self.control_handle.shutdown();
2949        }
2950        self.drop_without_shutdown();
2951        _result
2952    }
2953
2954    /// Similar to "send" but does not shutdown the channel if an error occurs.
2955    pub fn send_no_shutdown_on_err(
2956        self,
2957        mut result: Result<bool, RouteSetError>,
2958    ) -> Result<(), fidl::Error> {
2959        let _result = self.send_raw(result);
2960        self.drop_without_shutdown();
2961        _result
2962    }
2963
2964    fn send_raw(&self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
2965        self.control_handle.inner.send::<fidl::encoding::ResultType<
2966            RouteSetV4RemoveRouteResponse,
2967            RouteSetError,
2968        >>(
2969            result.map(|did_remove| (did_remove,)),
2970            self.tx_id,
2971            0x514f6880232f1665,
2972            fidl::encoding::DynamicFlags::empty(),
2973        )
2974    }
2975}
2976
2977#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2978pub struct RouteSetV6Marker;
2979
2980impl fidl::endpoints::ProtocolMarker for RouteSetV6Marker {
2981    type Proxy = RouteSetV6Proxy;
2982    type RequestStream = RouteSetV6RequestStream;
2983    #[cfg(target_os = "fuchsia")]
2984    type SynchronousProxy = RouteSetV6SynchronousProxy;
2985
2986    const DEBUG_NAME: &'static str = "(anonymous) RouteSetV6";
2987}
2988pub type RouteSetV6AuthenticateForInterfaceResult = Result<(), AuthenticateForInterfaceError>;
2989pub type RouteSetV6AddRouteResult = Result<bool, RouteSetError>;
2990pub type RouteSetV6RemoveRouteResult = Result<bool, RouteSetError>;
2991
2992pub trait RouteSetV6ProxyInterface: Send + Sync {
2993    type AuthenticateForInterfaceResponseFut: std::future::Future<Output = Result<RouteSetV6AuthenticateForInterfaceResult, fidl::Error>>
2994        + Send;
2995    fn r#authenticate_for_interface(
2996        &self,
2997        credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
2998    ) -> Self::AuthenticateForInterfaceResponseFut;
2999    type AddRouteResponseFut: std::future::Future<Output = Result<RouteSetV6AddRouteResult, fidl::Error>>
3000        + Send;
3001    fn r#add_route(&self, route: &fidl_fuchsia_net_routes::RouteV6) -> Self::AddRouteResponseFut;
3002    type RemoveRouteResponseFut: std::future::Future<Output = Result<RouteSetV6RemoveRouteResult, fidl::Error>>
3003        + Send;
3004    fn r#remove_route(
3005        &self,
3006        route: &fidl_fuchsia_net_routes::RouteV6,
3007    ) -> Self::RemoveRouteResponseFut;
3008}
3009#[derive(Debug)]
3010#[cfg(target_os = "fuchsia")]
3011pub struct RouteSetV6SynchronousProxy {
3012    client: fidl::client::sync::Client,
3013}
3014
3015#[cfg(target_os = "fuchsia")]
3016impl fidl::endpoints::SynchronousProxy for RouteSetV6SynchronousProxy {
3017    type Proxy = RouteSetV6Proxy;
3018    type Protocol = RouteSetV6Marker;
3019
3020    fn from_channel(inner: fidl::Channel) -> Self {
3021        Self::new(inner)
3022    }
3023
3024    fn into_channel(self) -> fidl::Channel {
3025        self.client.into_channel()
3026    }
3027
3028    fn as_channel(&self) -> &fidl::Channel {
3029        self.client.as_channel()
3030    }
3031}
3032
3033#[cfg(target_os = "fuchsia")]
3034impl RouteSetV6SynchronousProxy {
3035    pub fn new(channel: fidl::Channel) -> Self {
3036        let protocol_name = <RouteSetV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3037        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3038    }
3039
3040    pub fn into_channel(self) -> fidl::Channel {
3041        self.client.into_channel()
3042    }
3043
3044    /// Waits until an event arrives and returns it. It is safe for other
3045    /// threads to make concurrent requests while waiting for an event.
3046    pub fn wait_for_event(
3047        &self,
3048        deadline: zx::MonotonicInstant,
3049    ) -> Result<RouteSetV6Event, fidl::Error> {
3050        RouteSetV6Event::decode(self.client.wait_for_event(deadline)?)
3051    }
3052
3053    /// Authenticate this route set to manage routes on the provided interface.
3054    /// Authentication is valid for the lifetime of the route set.
3055    ///
3056    /// + request `interface` the authentication credential for an interface.
3057    pub fn r#authenticate_for_interface(
3058        &self,
3059        mut credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
3060        ___deadline: zx::MonotonicInstant,
3061    ) -> Result<RouteSetV6AuthenticateForInterfaceResult, fidl::Error> {
3062        let _response = self
3063            .client
3064            .send_query::<RouteSetV6AuthenticateForInterfaceRequest, fidl::encoding::ResultType<
3065                fidl::encoding::EmptyStruct,
3066                AuthenticateForInterfaceError,
3067            >>(
3068                (&mut credential,),
3069                0x7d63a6a7aed6f640,
3070                fidl::encoding::DynamicFlags::empty(),
3071                ___deadline,
3072            )?;
3073        Ok(_response.map(|x| x))
3074    }
3075
3076    /// Adds a route to this route set.
3077    ///
3078    /// + request `route` the route to add.
3079    /// - response `did_add` true iff the route was added to this `RouteSet`
3080    ///            as a result of this call.
3081    pub fn r#add_route(
3082        &self,
3083        mut route: &fidl_fuchsia_net_routes::RouteV6,
3084        ___deadline: zx::MonotonicInstant,
3085    ) -> Result<RouteSetV6AddRouteResult, fidl::Error> {
3086        let _response = self.client.send_query::<
3087            RouteSetV6AddRouteRequest,
3088            fidl::encoding::ResultType<RouteSetV6AddRouteResponse, RouteSetError>,
3089        >(
3090            (route,),
3091            0x67a2bd2ee34ace2e,
3092            fidl::encoding::DynamicFlags::empty(),
3093            ___deadline,
3094        )?;
3095        Ok(_response.map(|x| x.did_add))
3096    }
3097
3098    /// Removes a route from this route set.
3099    ///
3100    /// Note that if this route also exists other route sets, it will not be
3101    /// removed from the global routing table.
3102    ///
3103    /// + request `route` the route to remove.
3104    /// - response `did_remove` true iff the route was removed from this
3105    ///            `RouteSet` as a result of this call.
3106    pub fn r#remove_route(
3107        &self,
3108        mut route: &fidl_fuchsia_net_routes::RouteV6,
3109        ___deadline: zx::MonotonicInstant,
3110    ) -> Result<RouteSetV6RemoveRouteResult, fidl::Error> {
3111        let _response = self.client.send_query::<
3112            RouteSetV6RemoveRouteRequest,
3113            fidl::encoding::ResultType<RouteSetV6RemoveRouteResponse, RouteSetError>,
3114        >(
3115            (route,),
3116            0x4e5b7d4b1112cd82,
3117            fidl::encoding::DynamicFlags::empty(),
3118            ___deadline,
3119        )?;
3120        Ok(_response.map(|x| x.did_remove))
3121    }
3122}
3123
3124#[derive(Debug, Clone)]
3125pub struct RouteSetV6Proxy {
3126    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3127}
3128
3129impl fidl::endpoints::Proxy for RouteSetV6Proxy {
3130    type Protocol = RouteSetV6Marker;
3131
3132    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3133        Self::new(inner)
3134    }
3135
3136    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3137        self.client.into_channel().map_err(|client| Self { client })
3138    }
3139
3140    fn as_channel(&self) -> &::fidl::AsyncChannel {
3141        self.client.as_channel()
3142    }
3143}
3144
3145impl RouteSetV6Proxy {
3146    /// Create a new Proxy for fuchsia.net.routes.admin/RouteSetV6.
3147    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3148        let protocol_name = <RouteSetV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3149        Self { client: fidl::client::Client::new(channel, protocol_name) }
3150    }
3151
3152    /// Get a Stream of events from the remote end of the protocol.
3153    ///
3154    /// # Panics
3155    ///
3156    /// Panics if the event stream was already taken.
3157    pub fn take_event_stream(&self) -> RouteSetV6EventStream {
3158        RouteSetV6EventStream { event_receiver: self.client.take_event_receiver() }
3159    }
3160
3161    /// Authenticate this route set to manage routes on the provided interface.
3162    /// Authentication is valid for the lifetime of the route set.
3163    ///
3164    /// + request `interface` the authentication credential for an interface.
3165    pub fn r#authenticate_for_interface(
3166        &self,
3167        mut credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
3168    ) -> fidl::client::QueryResponseFut<
3169        RouteSetV6AuthenticateForInterfaceResult,
3170        fidl::encoding::DefaultFuchsiaResourceDialect,
3171    > {
3172        RouteSetV6ProxyInterface::r#authenticate_for_interface(self, credential)
3173    }
3174
3175    /// Adds a route to this route set.
3176    ///
3177    /// + request `route` the route to add.
3178    /// - response `did_add` true iff the route was added to this `RouteSet`
3179    ///            as a result of this call.
3180    pub fn r#add_route(
3181        &self,
3182        mut route: &fidl_fuchsia_net_routes::RouteV6,
3183    ) -> fidl::client::QueryResponseFut<
3184        RouteSetV6AddRouteResult,
3185        fidl::encoding::DefaultFuchsiaResourceDialect,
3186    > {
3187        RouteSetV6ProxyInterface::r#add_route(self, route)
3188    }
3189
3190    /// Removes a route from this route set.
3191    ///
3192    /// Note that if this route also exists other route sets, it will not be
3193    /// removed from the global routing table.
3194    ///
3195    /// + request `route` the route to remove.
3196    /// - response `did_remove` true iff the route was removed from this
3197    ///            `RouteSet` as a result of this call.
3198    pub fn r#remove_route(
3199        &self,
3200        mut route: &fidl_fuchsia_net_routes::RouteV6,
3201    ) -> fidl::client::QueryResponseFut<
3202        RouteSetV6RemoveRouteResult,
3203        fidl::encoding::DefaultFuchsiaResourceDialect,
3204    > {
3205        RouteSetV6ProxyInterface::r#remove_route(self, route)
3206    }
3207}
3208
3209impl RouteSetV6ProxyInterface for RouteSetV6Proxy {
3210    type AuthenticateForInterfaceResponseFut = fidl::client::QueryResponseFut<
3211        RouteSetV6AuthenticateForInterfaceResult,
3212        fidl::encoding::DefaultFuchsiaResourceDialect,
3213    >;
3214    fn r#authenticate_for_interface(
3215        &self,
3216        mut credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
3217    ) -> Self::AuthenticateForInterfaceResponseFut {
3218        fn _decode(
3219            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3220        ) -> Result<RouteSetV6AuthenticateForInterfaceResult, fidl::Error> {
3221            let _response = fidl::client::decode_transaction_body::<
3222                fidl::encoding::ResultType<
3223                    fidl::encoding::EmptyStruct,
3224                    AuthenticateForInterfaceError,
3225                >,
3226                fidl::encoding::DefaultFuchsiaResourceDialect,
3227                0x7d63a6a7aed6f640,
3228            >(_buf?)?;
3229            Ok(_response.map(|x| x))
3230        }
3231        self.client.send_query_and_decode::<
3232            RouteSetV6AuthenticateForInterfaceRequest,
3233            RouteSetV6AuthenticateForInterfaceResult,
3234        >(
3235            (&mut credential,),
3236            0x7d63a6a7aed6f640,
3237            fidl::encoding::DynamicFlags::empty(),
3238            _decode,
3239        )
3240    }
3241
3242    type AddRouteResponseFut = fidl::client::QueryResponseFut<
3243        RouteSetV6AddRouteResult,
3244        fidl::encoding::DefaultFuchsiaResourceDialect,
3245    >;
3246    fn r#add_route(
3247        &self,
3248        mut route: &fidl_fuchsia_net_routes::RouteV6,
3249    ) -> Self::AddRouteResponseFut {
3250        fn _decode(
3251            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3252        ) -> Result<RouteSetV6AddRouteResult, fidl::Error> {
3253            let _response = fidl::client::decode_transaction_body::<
3254                fidl::encoding::ResultType<RouteSetV6AddRouteResponse, RouteSetError>,
3255                fidl::encoding::DefaultFuchsiaResourceDialect,
3256                0x67a2bd2ee34ace2e,
3257            >(_buf?)?;
3258            Ok(_response.map(|x| x.did_add))
3259        }
3260        self.client.send_query_and_decode::<RouteSetV6AddRouteRequest, RouteSetV6AddRouteResult>(
3261            (route,),
3262            0x67a2bd2ee34ace2e,
3263            fidl::encoding::DynamicFlags::empty(),
3264            _decode,
3265        )
3266    }
3267
3268    type RemoveRouteResponseFut = fidl::client::QueryResponseFut<
3269        RouteSetV6RemoveRouteResult,
3270        fidl::encoding::DefaultFuchsiaResourceDialect,
3271    >;
3272    fn r#remove_route(
3273        &self,
3274        mut route: &fidl_fuchsia_net_routes::RouteV6,
3275    ) -> Self::RemoveRouteResponseFut {
3276        fn _decode(
3277            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
3278        ) -> Result<RouteSetV6RemoveRouteResult, fidl::Error> {
3279            let _response = fidl::client::decode_transaction_body::<
3280                fidl::encoding::ResultType<RouteSetV6RemoveRouteResponse, RouteSetError>,
3281                fidl::encoding::DefaultFuchsiaResourceDialect,
3282                0x4e5b7d4b1112cd82,
3283            >(_buf?)?;
3284            Ok(_response.map(|x| x.did_remove))
3285        }
3286        self.client
3287            .send_query_and_decode::<RouteSetV6RemoveRouteRequest, RouteSetV6RemoveRouteResult>(
3288                (route,),
3289                0x4e5b7d4b1112cd82,
3290                fidl::encoding::DynamicFlags::empty(),
3291                _decode,
3292            )
3293    }
3294}
3295
3296pub struct RouteSetV6EventStream {
3297    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3298}
3299
3300impl std::marker::Unpin for RouteSetV6EventStream {}
3301
3302impl futures::stream::FusedStream for RouteSetV6EventStream {
3303    fn is_terminated(&self) -> bool {
3304        self.event_receiver.is_terminated()
3305    }
3306}
3307
3308impl futures::Stream for RouteSetV6EventStream {
3309    type Item = Result<RouteSetV6Event, fidl::Error>;
3310
3311    fn poll_next(
3312        mut self: std::pin::Pin<&mut Self>,
3313        cx: &mut std::task::Context<'_>,
3314    ) -> std::task::Poll<Option<Self::Item>> {
3315        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3316            &mut self.event_receiver,
3317            cx
3318        )?) {
3319            Some(buf) => std::task::Poll::Ready(Some(RouteSetV6Event::decode(buf))),
3320            None => std::task::Poll::Ready(None),
3321        }
3322    }
3323}
3324
3325#[derive(Debug)]
3326pub enum RouteSetV6Event {}
3327
3328impl RouteSetV6Event {
3329    /// Decodes a message buffer as a [`RouteSetV6Event`].
3330    fn decode(
3331        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3332    ) -> Result<RouteSetV6Event, fidl::Error> {
3333        let (bytes, _handles) = buf.split_mut();
3334        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3335        debug_assert_eq!(tx_header.tx_id, 0);
3336        match tx_header.ordinal {
3337            _ => Err(fidl::Error::UnknownOrdinal {
3338                ordinal: tx_header.ordinal,
3339                protocol_name: <RouteSetV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3340            }),
3341        }
3342    }
3343}
3344
3345/// A Stream of incoming requests for fuchsia.net.routes.admin/RouteSetV6.
3346pub struct RouteSetV6RequestStream {
3347    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3348    is_terminated: bool,
3349}
3350
3351impl std::marker::Unpin for RouteSetV6RequestStream {}
3352
3353impl futures::stream::FusedStream for RouteSetV6RequestStream {
3354    fn is_terminated(&self) -> bool {
3355        self.is_terminated
3356    }
3357}
3358
3359impl fidl::endpoints::RequestStream for RouteSetV6RequestStream {
3360    type Protocol = RouteSetV6Marker;
3361    type ControlHandle = RouteSetV6ControlHandle;
3362
3363    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3364        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3365    }
3366
3367    fn control_handle(&self) -> Self::ControlHandle {
3368        RouteSetV6ControlHandle { inner: self.inner.clone() }
3369    }
3370
3371    fn into_inner(
3372        self,
3373    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3374    {
3375        (self.inner, self.is_terminated)
3376    }
3377
3378    fn from_inner(
3379        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3380        is_terminated: bool,
3381    ) -> Self {
3382        Self { inner, is_terminated }
3383    }
3384}
3385
3386impl futures::Stream for RouteSetV6RequestStream {
3387    type Item = Result<RouteSetV6Request, fidl::Error>;
3388
3389    fn poll_next(
3390        mut self: std::pin::Pin<&mut Self>,
3391        cx: &mut std::task::Context<'_>,
3392    ) -> std::task::Poll<Option<Self::Item>> {
3393        let this = &mut *self;
3394        if this.inner.check_shutdown(cx) {
3395            this.is_terminated = true;
3396            return std::task::Poll::Ready(None);
3397        }
3398        if this.is_terminated {
3399            panic!("polled RouteSetV6RequestStream after completion");
3400        }
3401        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3402            |bytes, handles| {
3403                match this.inner.channel().read_etc(cx, bytes, handles) {
3404                    std::task::Poll::Ready(Ok(())) => {}
3405                    std::task::Poll::Pending => return std::task::Poll::Pending,
3406                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3407                        this.is_terminated = true;
3408                        return std::task::Poll::Ready(None);
3409                    }
3410                    std::task::Poll::Ready(Err(e)) => {
3411                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3412                            e.into(),
3413                        ))))
3414                    }
3415                }
3416
3417                // A message has been received from the channel
3418                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3419
3420                std::task::Poll::Ready(Some(match header.ordinal {
3421                    0x7d63a6a7aed6f640 => {
3422                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3423                        let mut req = fidl::new_empty!(
3424                            RouteSetV6AuthenticateForInterfaceRequest,
3425                            fidl::encoding::DefaultFuchsiaResourceDialect
3426                        );
3427                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RouteSetV6AuthenticateForInterfaceRequest>(&header, _body_bytes, handles, &mut req)?;
3428                        let control_handle = RouteSetV6ControlHandle { inner: this.inner.clone() };
3429                        Ok(RouteSetV6Request::AuthenticateForInterface {
3430                            credential: req.credential,
3431
3432                            responder: RouteSetV6AuthenticateForInterfaceResponder {
3433                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3434                                tx_id: header.tx_id,
3435                            },
3436                        })
3437                    }
3438                    0x67a2bd2ee34ace2e => {
3439                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3440                        let mut req = fidl::new_empty!(
3441                            RouteSetV6AddRouteRequest,
3442                            fidl::encoding::DefaultFuchsiaResourceDialect
3443                        );
3444                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RouteSetV6AddRouteRequest>(&header, _body_bytes, handles, &mut req)?;
3445                        let control_handle = RouteSetV6ControlHandle { inner: this.inner.clone() };
3446                        Ok(RouteSetV6Request::AddRoute {
3447                            route: req.route,
3448
3449                            responder: RouteSetV6AddRouteResponder {
3450                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3451                                tx_id: header.tx_id,
3452                            },
3453                        })
3454                    }
3455                    0x4e5b7d4b1112cd82 => {
3456                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
3457                        let mut req = fidl::new_empty!(
3458                            RouteSetV6RemoveRouteRequest,
3459                            fidl::encoding::DefaultFuchsiaResourceDialect
3460                        );
3461                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RouteSetV6RemoveRouteRequest>(&header, _body_bytes, handles, &mut req)?;
3462                        let control_handle = RouteSetV6ControlHandle { inner: this.inner.clone() };
3463                        Ok(RouteSetV6Request::RemoveRoute {
3464                            route: req.route,
3465
3466                            responder: RouteSetV6RemoveRouteResponder {
3467                                control_handle: std::mem::ManuallyDrop::new(control_handle),
3468                                tx_id: header.tx_id,
3469                            },
3470                        })
3471                    }
3472                    _ => Err(fidl::Error::UnknownOrdinal {
3473                        ordinal: header.ordinal,
3474                        protocol_name:
3475                            <RouteSetV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3476                    }),
3477                }))
3478            },
3479        )
3480    }
3481}
3482
3483/// Provides mutable access over a set of system's IPv6 routes.
3484///
3485/// The system maintains a single global routing table. A route set offers an
3486/// isolated window into a subset of the global routing table: clients are free
3487/// to manage the routes within their own route set, but not the route set of
3488/// others. Thus the global routing table represents the union of all existing
3489/// route sets. A route must be removed from all route sets to which it belongs
3490/// before it will be removed from the global table.
3491///
3492/// This protocol encodes the lifetime of the route set. Closing the client end
3493/// removes the route set, and will also remove any routes that were
3494/// solely-owned by this route set.
3495///
3496/// Note that the system reserves the right to remove routes out from underneath
3497/// this route set. This will always manifest as a `removed` event on the
3498/// [`fuchsia.net.routes/WatcherV6`] protocol.
3499///
3500/// If the route table backing this route set is removed, then this protocol
3501/// will be closed with a `ZX_ERR_UNAVAILABLE` epitaph.
3502#[derive(Debug)]
3503pub enum RouteSetV6Request {
3504    /// Authenticate this route set to manage routes on the provided interface.
3505    /// Authentication is valid for the lifetime of the route set.
3506    ///
3507    /// + request `interface` the authentication credential for an interface.
3508    AuthenticateForInterface {
3509        credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
3510        responder: RouteSetV6AuthenticateForInterfaceResponder,
3511    },
3512    /// Adds a route to this route set.
3513    ///
3514    /// + request `route` the route to add.
3515    /// - response `did_add` true iff the route was added to this `RouteSet`
3516    ///            as a result of this call.
3517    AddRoute { route: fidl_fuchsia_net_routes::RouteV6, responder: RouteSetV6AddRouteResponder },
3518    /// Removes a route from this route set.
3519    ///
3520    /// Note that if this route also exists other route sets, it will not be
3521    /// removed from the global routing table.
3522    ///
3523    /// + request `route` the route to remove.
3524    /// - response `did_remove` true iff the route was removed from this
3525    ///            `RouteSet` as a result of this call.
3526    RemoveRoute {
3527        route: fidl_fuchsia_net_routes::RouteV6,
3528        responder: RouteSetV6RemoveRouteResponder,
3529    },
3530}
3531
3532impl RouteSetV6Request {
3533    #[allow(irrefutable_let_patterns)]
3534    pub fn into_authenticate_for_interface(
3535        self,
3536    ) -> Option<(
3537        fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
3538        RouteSetV6AuthenticateForInterfaceResponder,
3539    )> {
3540        if let RouteSetV6Request::AuthenticateForInterface { credential, responder } = self {
3541            Some((credential, responder))
3542        } else {
3543            None
3544        }
3545    }
3546
3547    #[allow(irrefutable_let_patterns)]
3548    pub fn into_add_route(
3549        self,
3550    ) -> Option<(fidl_fuchsia_net_routes::RouteV6, RouteSetV6AddRouteResponder)> {
3551        if let RouteSetV6Request::AddRoute { route, responder } = self {
3552            Some((route, responder))
3553        } else {
3554            None
3555        }
3556    }
3557
3558    #[allow(irrefutable_let_patterns)]
3559    pub fn into_remove_route(
3560        self,
3561    ) -> Option<(fidl_fuchsia_net_routes::RouteV6, RouteSetV6RemoveRouteResponder)> {
3562        if let RouteSetV6Request::RemoveRoute { route, responder } = self {
3563            Some((route, responder))
3564        } else {
3565            None
3566        }
3567    }
3568
3569    /// Name of the method defined in FIDL
3570    pub fn method_name(&self) -> &'static str {
3571        match *self {
3572            RouteSetV6Request::AuthenticateForInterface { .. } => "authenticate_for_interface",
3573            RouteSetV6Request::AddRoute { .. } => "add_route",
3574            RouteSetV6Request::RemoveRoute { .. } => "remove_route",
3575        }
3576    }
3577}
3578
3579#[derive(Debug, Clone)]
3580pub struct RouteSetV6ControlHandle {
3581    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3582}
3583
3584impl fidl::endpoints::ControlHandle for RouteSetV6ControlHandle {
3585    fn shutdown(&self) {
3586        self.inner.shutdown()
3587    }
3588    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3589        self.inner.shutdown_with_epitaph(status)
3590    }
3591
3592    fn is_closed(&self) -> bool {
3593        self.inner.channel().is_closed()
3594    }
3595    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3596        self.inner.channel().on_closed()
3597    }
3598
3599    #[cfg(target_os = "fuchsia")]
3600    fn signal_peer(
3601        &self,
3602        clear_mask: zx::Signals,
3603        set_mask: zx::Signals,
3604    ) -> Result<(), zx_status::Status> {
3605        use fidl::Peered;
3606        self.inner.channel().signal_peer(clear_mask, set_mask)
3607    }
3608}
3609
3610impl RouteSetV6ControlHandle {}
3611
3612#[must_use = "FIDL methods require a response to be sent"]
3613#[derive(Debug)]
3614pub struct RouteSetV6AuthenticateForInterfaceResponder {
3615    control_handle: std::mem::ManuallyDrop<RouteSetV6ControlHandle>,
3616    tx_id: u32,
3617}
3618
3619/// Set the the channel to be shutdown (see [`RouteSetV6ControlHandle::shutdown`])
3620/// if the responder is dropped without sending a response, so that the client
3621/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3622impl std::ops::Drop for RouteSetV6AuthenticateForInterfaceResponder {
3623    fn drop(&mut self) {
3624        self.control_handle.shutdown();
3625        // Safety: drops once, never accessed again
3626        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3627    }
3628}
3629
3630impl fidl::endpoints::Responder for RouteSetV6AuthenticateForInterfaceResponder {
3631    type ControlHandle = RouteSetV6ControlHandle;
3632
3633    fn control_handle(&self) -> &RouteSetV6ControlHandle {
3634        &self.control_handle
3635    }
3636
3637    fn drop_without_shutdown(mut self) {
3638        // Safety: drops once, never accessed again due to mem::forget
3639        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3640        // Prevent Drop from running (which would shut down the channel)
3641        std::mem::forget(self);
3642    }
3643}
3644
3645impl RouteSetV6AuthenticateForInterfaceResponder {
3646    /// Sends a response to the FIDL transaction.
3647    ///
3648    /// Sets the channel to shutdown if an error occurs.
3649    pub fn send(
3650        self,
3651        mut result: Result<(), AuthenticateForInterfaceError>,
3652    ) -> Result<(), fidl::Error> {
3653        let _result = self.send_raw(result);
3654        if _result.is_err() {
3655            self.control_handle.shutdown();
3656        }
3657        self.drop_without_shutdown();
3658        _result
3659    }
3660
3661    /// Similar to "send" but does not shutdown the channel if an error occurs.
3662    pub fn send_no_shutdown_on_err(
3663        self,
3664        mut result: Result<(), AuthenticateForInterfaceError>,
3665    ) -> Result<(), fidl::Error> {
3666        let _result = self.send_raw(result);
3667        self.drop_without_shutdown();
3668        _result
3669    }
3670
3671    fn send_raw(
3672        &self,
3673        mut result: Result<(), AuthenticateForInterfaceError>,
3674    ) -> Result<(), fidl::Error> {
3675        self.control_handle.inner.send::<fidl::encoding::ResultType<
3676            fidl::encoding::EmptyStruct,
3677            AuthenticateForInterfaceError,
3678        >>(
3679            result,
3680            self.tx_id,
3681            0x7d63a6a7aed6f640,
3682            fidl::encoding::DynamicFlags::empty(),
3683        )
3684    }
3685}
3686
3687#[must_use = "FIDL methods require a response to be sent"]
3688#[derive(Debug)]
3689pub struct RouteSetV6AddRouteResponder {
3690    control_handle: std::mem::ManuallyDrop<RouteSetV6ControlHandle>,
3691    tx_id: u32,
3692}
3693
3694/// Set the the channel to be shutdown (see [`RouteSetV6ControlHandle::shutdown`])
3695/// if the responder is dropped without sending a response, so that the client
3696/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3697impl std::ops::Drop for RouteSetV6AddRouteResponder {
3698    fn drop(&mut self) {
3699        self.control_handle.shutdown();
3700        // Safety: drops once, never accessed again
3701        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3702    }
3703}
3704
3705impl fidl::endpoints::Responder for RouteSetV6AddRouteResponder {
3706    type ControlHandle = RouteSetV6ControlHandle;
3707
3708    fn control_handle(&self) -> &RouteSetV6ControlHandle {
3709        &self.control_handle
3710    }
3711
3712    fn drop_without_shutdown(mut self) {
3713        // Safety: drops once, never accessed again due to mem::forget
3714        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3715        // Prevent Drop from running (which would shut down the channel)
3716        std::mem::forget(self);
3717    }
3718}
3719
3720impl RouteSetV6AddRouteResponder {
3721    /// Sends a response to the FIDL transaction.
3722    ///
3723    /// Sets the channel to shutdown if an error occurs.
3724    pub fn send(self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
3725        let _result = self.send_raw(result);
3726        if _result.is_err() {
3727            self.control_handle.shutdown();
3728        }
3729        self.drop_without_shutdown();
3730        _result
3731    }
3732
3733    /// Similar to "send" but does not shutdown the channel if an error occurs.
3734    pub fn send_no_shutdown_on_err(
3735        self,
3736        mut result: Result<bool, RouteSetError>,
3737    ) -> Result<(), fidl::Error> {
3738        let _result = self.send_raw(result);
3739        self.drop_without_shutdown();
3740        _result
3741    }
3742
3743    fn send_raw(&self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
3744        self.control_handle.inner.send::<fidl::encoding::ResultType<
3745            RouteSetV6AddRouteResponse,
3746            RouteSetError,
3747        >>(
3748            result.map(|did_add| (did_add,)),
3749            self.tx_id,
3750            0x67a2bd2ee34ace2e,
3751            fidl::encoding::DynamicFlags::empty(),
3752        )
3753    }
3754}
3755
3756#[must_use = "FIDL methods require a response to be sent"]
3757#[derive(Debug)]
3758pub struct RouteSetV6RemoveRouteResponder {
3759    control_handle: std::mem::ManuallyDrop<RouteSetV6ControlHandle>,
3760    tx_id: u32,
3761}
3762
3763/// Set the the channel to be shutdown (see [`RouteSetV6ControlHandle::shutdown`])
3764/// if the responder is dropped without sending a response, so that the client
3765/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3766impl std::ops::Drop for RouteSetV6RemoveRouteResponder {
3767    fn drop(&mut self) {
3768        self.control_handle.shutdown();
3769        // Safety: drops once, never accessed again
3770        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3771    }
3772}
3773
3774impl fidl::endpoints::Responder for RouteSetV6RemoveRouteResponder {
3775    type ControlHandle = RouteSetV6ControlHandle;
3776
3777    fn control_handle(&self) -> &RouteSetV6ControlHandle {
3778        &self.control_handle
3779    }
3780
3781    fn drop_without_shutdown(mut self) {
3782        // Safety: drops once, never accessed again due to mem::forget
3783        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3784        // Prevent Drop from running (which would shut down the channel)
3785        std::mem::forget(self);
3786    }
3787}
3788
3789impl RouteSetV6RemoveRouteResponder {
3790    /// Sends a response to the FIDL transaction.
3791    ///
3792    /// Sets the channel to shutdown if an error occurs.
3793    pub fn send(self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
3794        let _result = self.send_raw(result);
3795        if _result.is_err() {
3796            self.control_handle.shutdown();
3797        }
3798        self.drop_without_shutdown();
3799        _result
3800    }
3801
3802    /// Similar to "send" but does not shutdown the channel if an error occurs.
3803    pub fn send_no_shutdown_on_err(
3804        self,
3805        mut result: Result<bool, RouteSetError>,
3806    ) -> Result<(), fidl::Error> {
3807        let _result = self.send_raw(result);
3808        self.drop_without_shutdown();
3809        _result
3810    }
3811
3812    fn send_raw(&self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
3813        self.control_handle.inner.send::<fidl::encoding::ResultType<
3814            RouteSetV6RemoveRouteResponse,
3815            RouteSetError,
3816        >>(
3817            result.map(|did_remove| (did_remove,)),
3818            self.tx_id,
3819            0x4e5b7d4b1112cd82,
3820            fidl::encoding::DynamicFlags::empty(),
3821        )
3822    }
3823}
3824
3825#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3826pub struct RouteTableProviderV4Marker;
3827
3828impl fidl::endpoints::ProtocolMarker for RouteTableProviderV4Marker {
3829    type Proxy = RouteTableProviderV4Proxy;
3830    type RequestStream = RouteTableProviderV4RequestStream;
3831    #[cfg(target_os = "fuchsia")]
3832    type SynchronousProxy = RouteTableProviderV4SynchronousProxy;
3833
3834    const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RouteTableProviderV4";
3835}
3836impl fidl::endpoints::DiscoverableProtocolMarker for RouteTableProviderV4Marker {}
3837
3838pub trait RouteTableProviderV4ProxyInterface: Send + Sync {
3839    fn r#new_route_table(
3840        &self,
3841        provider: fidl::endpoints::ServerEnd<RouteTableV4Marker>,
3842        options: &RouteTableOptionsV4,
3843    ) -> Result<(), fidl::Error>;
3844}
3845#[derive(Debug)]
3846#[cfg(target_os = "fuchsia")]
3847pub struct RouteTableProviderV4SynchronousProxy {
3848    client: fidl::client::sync::Client,
3849}
3850
3851#[cfg(target_os = "fuchsia")]
3852impl fidl::endpoints::SynchronousProxy for RouteTableProviderV4SynchronousProxy {
3853    type Proxy = RouteTableProviderV4Proxy;
3854    type Protocol = RouteTableProviderV4Marker;
3855
3856    fn from_channel(inner: fidl::Channel) -> Self {
3857        Self::new(inner)
3858    }
3859
3860    fn into_channel(self) -> fidl::Channel {
3861        self.client.into_channel()
3862    }
3863
3864    fn as_channel(&self) -> &fidl::Channel {
3865        self.client.as_channel()
3866    }
3867}
3868
3869#[cfg(target_os = "fuchsia")]
3870impl RouteTableProviderV4SynchronousProxy {
3871    pub fn new(channel: fidl::Channel) -> Self {
3872        let protocol_name =
3873            <RouteTableProviderV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3874        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3875    }
3876
3877    pub fn into_channel(self) -> fidl::Channel {
3878        self.client.into_channel()
3879    }
3880
3881    /// Waits until an event arrives and returns it. It is safe for other
3882    /// threads to make concurrent requests while waiting for an event.
3883    pub fn wait_for_event(
3884        &self,
3885        deadline: zx::MonotonicInstant,
3886    ) -> Result<RouteTableProviderV4Event, fidl::Error> {
3887        RouteTableProviderV4Event::decode(self.client.wait_for_event(deadline)?)
3888    }
3889
3890    /// Creates a new route table. If the client end of the `provider` is
3891    /// closed, the route table is removed (unless detached).
3892    pub fn r#new_route_table(
3893        &self,
3894        mut provider: fidl::endpoints::ServerEnd<RouteTableV4Marker>,
3895        mut options: &RouteTableOptionsV4,
3896    ) -> Result<(), fidl::Error> {
3897        self.client.send::<RouteTableProviderV4NewRouteTableRequest>(
3898            (provider, options),
3899            0x703bc0eaf98f07cf,
3900            fidl::encoding::DynamicFlags::empty(),
3901        )
3902    }
3903}
3904
3905#[derive(Debug, Clone)]
3906pub struct RouteTableProviderV4Proxy {
3907    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3908}
3909
3910impl fidl::endpoints::Proxy for RouteTableProviderV4Proxy {
3911    type Protocol = RouteTableProviderV4Marker;
3912
3913    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3914        Self::new(inner)
3915    }
3916
3917    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3918        self.client.into_channel().map_err(|client| Self { client })
3919    }
3920
3921    fn as_channel(&self) -> &::fidl::AsyncChannel {
3922        self.client.as_channel()
3923    }
3924}
3925
3926impl RouteTableProviderV4Proxy {
3927    /// Create a new Proxy for fuchsia.net.routes.admin/RouteTableProviderV4.
3928    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3929        let protocol_name =
3930            <RouteTableProviderV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3931        Self { client: fidl::client::Client::new(channel, protocol_name) }
3932    }
3933
3934    /// Get a Stream of events from the remote end of the protocol.
3935    ///
3936    /// # Panics
3937    ///
3938    /// Panics if the event stream was already taken.
3939    pub fn take_event_stream(&self) -> RouteTableProviderV4EventStream {
3940        RouteTableProviderV4EventStream { event_receiver: self.client.take_event_receiver() }
3941    }
3942
3943    /// Creates a new route table. If the client end of the `provider` is
3944    /// closed, the route table is removed (unless detached).
3945    pub fn r#new_route_table(
3946        &self,
3947        mut provider: fidl::endpoints::ServerEnd<RouteTableV4Marker>,
3948        mut options: &RouteTableOptionsV4,
3949    ) -> Result<(), fidl::Error> {
3950        RouteTableProviderV4ProxyInterface::r#new_route_table(self, provider, options)
3951    }
3952}
3953
3954impl RouteTableProviderV4ProxyInterface for RouteTableProviderV4Proxy {
3955    fn r#new_route_table(
3956        &self,
3957        mut provider: fidl::endpoints::ServerEnd<RouteTableV4Marker>,
3958        mut options: &RouteTableOptionsV4,
3959    ) -> Result<(), fidl::Error> {
3960        self.client.send::<RouteTableProviderV4NewRouteTableRequest>(
3961            (provider, options),
3962            0x703bc0eaf98f07cf,
3963            fidl::encoding::DynamicFlags::empty(),
3964        )
3965    }
3966}
3967
3968pub struct RouteTableProviderV4EventStream {
3969    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3970}
3971
3972impl std::marker::Unpin for RouteTableProviderV4EventStream {}
3973
3974impl futures::stream::FusedStream for RouteTableProviderV4EventStream {
3975    fn is_terminated(&self) -> bool {
3976        self.event_receiver.is_terminated()
3977    }
3978}
3979
3980impl futures::Stream for RouteTableProviderV4EventStream {
3981    type Item = Result<RouteTableProviderV4Event, fidl::Error>;
3982
3983    fn poll_next(
3984        mut self: std::pin::Pin<&mut Self>,
3985        cx: &mut std::task::Context<'_>,
3986    ) -> std::task::Poll<Option<Self::Item>> {
3987        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3988            &mut self.event_receiver,
3989            cx
3990        )?) {
3991            Some(buf) => std::task::Poll::Ready(Some(RouteTableProviderV4Event::decode(buf))),
3992            None => std::task::Poll::Ready(None),
3993        }
3994    }
3995}
3996
3997#[derive(Debug)]
3998pub enum RouteTableProviderV4Event {}
3999
4000impl RouteTableProviderV4Event {
4001    /// Decodes a message buffer as a [`RouteTableProviderV4Event`].
4002    fn decode(
4003        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4004    ) -> Result<RouteTableProviderV4Event, fidl::Error> {
4005        let (bytes, _handles) = buf.split_mut();
4006        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4007        debug_assert_eq!(tx_header.tx_id, 0);
4008        match tx_header.ordinal {
4009            _ => Err(fidl::Error::UnknownOrdinal {
4010                ordinal: tx_header.ordinal,
4011                protocol_name:
4012                    <RouteTableProviderV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4013            }),
4014        }
4015    }
4016}
4017
4018/// A Stream of incoming requests for fuchsia.net.routes.admin/RouteTableProviderV4.
4019pub struct RouteTableProviderV4RequestStream {
4020    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4021    is_terminated: bool,
4022}
4023
4024impl std::marker::Unpin for RouteTableProviderV4RequestStream {}
4025
4026impl futures::stream::FusedStream for RouteTableProviderV4RequestStream {
4027    fn is_terminated(&self) -> bool {
4028        self.is_terminated
4029    }
4030}
4031
4032impl fidl::endpoints::RequestStream for RouteTableProviderV4RequestStream {
4033    type Protocol = RouteTableProviderV4Marker;
4034    type ControlHandle = RouteTableProviderV4ControlHandle;
4035
4036    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4037        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4038    }
4039
4040    fn control_handle(&self) -> Self::ControlHandle {
4041        RouteTableProviderV4ControlHandle { inner: self.inner.clone() }
4042    }
4043
4044    fn into_inner(
4045        self,
4046    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4047    {
4048        (self.inner, self.is_terminated)
4049    }
4050
4051    fn from_inner(
4052        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4053        is_terminated: bool,
4054    ) -> Self {
4055        Self { inner, is_terminated }
4056    }
4057}
4058
4059impl futures::Stream for RouteTableProviderV4RequestStream {
4060    type Item = Result<RouteTableProviderV4Request, fidl::Error>;
4061
4062    fn poll_next(
4063        mut self: std::pin::Pin<&mut Self>,
4064        cx: &mut std::task::Context<'_>,
4065    ) -> std::task::Poll<Option<Self::Item>> {
4066        let this = &mut *self;
4067        if this.inner.check_shutdown(cx) {
4068            this.is_terminated = true;
4069            return std::task::Poll::Ready(None);
4070        }
4071        if this.is_terminated {
4072            panic!("polled RouteTableProviderV4RequestStream after completion");
4073        }
4074        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4075            |bytes, handles| {
4076                match this.inner.channel().read_etc(cx, bytes, handles) {
4077                    std::task::Poll::Ready(Ok(())) => {}
4078                    std::task::Poll::Pending => return std::task::Poll::Pending,
4079                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4080                        this.is_terminated = true;
4081                        return std::task::Poll::Ready(None);
4082                    }
4083                    std::task::Poll::Ready(Err(e)) => {
4084                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4085                            e.into(),
4086                        ))))
4087                    }
4088                }
4089
4090                // A message has been received from the channel
4091                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4092
4093                std::task::Poll::Ready(Some(match header.ordinal {
4094                0x703bc0eaf98f07cf => {
4095                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4096                    let mut req = fidl::new_empty!(RouteTableProviderV4NewRouteTableRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4097                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RouteTableProviderV4NewRouteTableRequest>(&header, _body_bytes, handles, &mut req)?;
4098                    let control_handle = RouteTableProviderV4ControlHandle {
4099                        inner: this.inner.clone(),
4100                    };
4101                    Ok(RouteTableProviderV4Request::NewRouteTable {provider: req.provider,
4102options: req.options,
4103
4104                        control_handle,
4105                    })
4106                }
4107                _ => Err(fidl::Error::UnknownOrdinal {
4108                    ordinal: header.ordinal,
4109                    protocol_name: <RouteTableProviderV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4110                }),
4111            }))
4112            },
4113        )
4114    }
4115}
4116
4117/// This protocol allows the client to create route tables.
4118#[derive(Debug)]
4119pub enum RouteTableProviderV4Request {
4120    /// Creates a new route table. If the client end of the `provider` is
4121    /// closed, the route table is removed (unless detached).
4122    NewRouteTable {
4123        provider: fidl::endpoints::ServerEnd<RouteTableV4Marker>,
4124        options: RouteTableOptionsV4,
4125        control_handle: RouteTableProviderV4ControlHandle,
4126    },
4127}
4128
4129impl RouteTableProviderV4Request {
4130    #[allow(irrefutable_let_patterns)]
4131    pub fn into_new_route_table(
4132        self,
4133    ) -> Option<(
4134        fidl::endpoints::ServerEnd<RouteTableV4Marker>,
4135        RouteTableOptionsV4,
4136        RouteTableProviderV4ControlHandle,
4137    )> {
4138        if let RouteTableProviderV4Request::NewRouteTable { provider, options, control_handle } =
4139            self
4140        {
4141            Some((provider, options, control_handle))
4142        } else {
4143            None
4144        }
4145    }
4146
4147    /// Name of the method defined in FIDL
4148    pub fn method_name(&self) -> &'static str {
4149        match *self {
4150            RouteTableProviderV4Request::NewRouteTable { .. } => "new_route_table",
4151        }
4152    }
4153}
4154
4155#[derive(Debug, Clone)]
4156pub struct RouteTableProviderV4ControlHandle {
4157    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4158}
4159
4160impl fidl::endpoints::ControlHandle for RouteTableProviderV4ControlHandle {
4161    fn shutdown(&self) {
4162        self.inner.shutdown()
4163    }
4164    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4165        self.inner.shutdown_with_epitaph(status)
4166    }
4167
4168    fn is_closed(&self) -> bool {
4169        self.inner.channel().is_closed()
4170    }
4171    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4172        self.inner.channel().on_closed()
4173    }
4174
4175    #[cfg(target_os = "fuchsia")]
4176    fn signal_peer(
4177        &self,
4178        clear_mask: zx::Signals,
4179        set_mask: zx::Signals,
4180    ) -> Result<(), zx_status::Status> {
4181        use fidl::Peered;
4182        self.inner.channel().signal_peer(clear_mask, set_mask)
4183    }
4184}
4185
4186impl RouteTableProviderV4ControlHandle {}
4187
4188#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4189pub struct RouteTableProviderV6Marker;
4190
4191impl fidl::endpoints::ProtocolMarker for RouteTableProviderV6Marker {
4192    type Proxy = RouteTableProviderV6Proxy;
4193    type RequestStream = RouteTableProviderV6RequestStream;
4194    #[cfg(target_os = "fuchsia")]
4195    type SynchronousProxy = RouteTableProviderV6SynchronousProxy;
4196
4197    const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RouteTableProviderV6";
4198}
4199impl fidl::endpoints::DiscoverableProtocolMarker for RouteTableProviderV6Marker {}
4200
4201pub trait RouteTableProviderV6ProxyInterface: Send + Sync {
4202    fn r#new_route_table(
4203        &self,
4204        provider: fidl::endpoints::ServerEnd<RouteTableV6Marker>,
4205        options: &RouteTableOptionsV6,
4206    ) -> Result<(), fidl::Error>;
4207}
4208#[derive(Debug)]
4209#[cfg(target_os = "fuchsia")]
4210pub struct RouteTableProviderV6SynchronousProxy {
4211    client: fidl::client::sync::Client,
4212}
4213
4214#[cfg(target_os = "fuchsia")]
4215impl fidl::endpoints::SynchronousProxy for RouteTableProviderV6SynchronousProxy {
4216    type Proxy = RouteTableProviderV6Proxy;
4217    type Protocol = RouteTableProviderV6Marker;
4218
4219    fn from_channel(inner: fidl::Channel) -> Self {
4220        Self::new(inner)
4221    }
4222
4223    fn into_channel(self) -> fidl::Channel {
4224        self.client.into_channel()
4225    }
4226
4227    fn as_channel(&self) -> &fidl::Channel {
4228        self.client.as_channel()
4229    }
4230}
4231
4232#[cfg(target_os = "fuchsia")]
4233impl RouteTableProviderV6SynchronousProxy {
4234    pub fn new(channel: fidl::Channel) -> Self {
4235        let protocol_name =
4236            <RouteTableProviderV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4237        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4238    }
4239
4240    pub fn into_channel(self) -> fidl::Channel {
4241        self.client.into_channel()
4242    }
4243
4244    /// Waits until an event arrives and returns it. It is safe for other
4245    /// threads to make concurrent requests while waiting for an event.
4246    pub fn wait_for_event(
4247        &self,
4248        deadline: zx::MonotonicInstant,
4249    ) -> Result<RouteTableProviderV6Event, fidl::Error> {
4250        RouteTableProviderV6Event::decode(self.client.wait_for_event(deadline)?)
4251    }
4252
4253    /// Creates a new route table. If the client end of the `provider` is
4254    /// closed, the route table is removed (unless detached).
4255    pub fn r#new_route_table(
4256        &self,
4257        mut provider: fidl::endpoints::ServerEnd<RouteTableV6Marker>,
4258        mut options: &RouteTableOptionsV6,
4259    ) -> Result<(), fidl::Error> {
4260        self.client.send::<RouteTableProviderV6NewRouteTableRequest>(
4261            (provider, options),
4262            0x152b67b397a31ca,
4263            fidl::encoding::DynamicFlags::empty(),
4264        )
4265    }
4266}
4267
4268#[derive(Debug, Clone)]
4269pub struct RouteTableProviderV6Proxy {
4270    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4271}
4272
4273impl fidl::endpoints::Proxy for RouteTableProviderV6Proxy {
4274    type Protocol = RouteTableProviderV6Marker;
4275
4276    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4277        Self::new(inner)
4278    }
4279
4280    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4281        self.client.into_channel().map_err(|client| Self { client })
4282    }
4283
4284    fn as_channel(&self) -> &::fidl::AsyncChannel {
4285        self.client.as_channel()
4286    }
4287}
4288
4289impl RouteTableProviderV6Proxy {
4290    /// Create a new Proxy for fuchsia.net.routes.admin/RouteTableProviderV6.
4291    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4292        let protocol_name =
4293            <RouteTableProviderV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4294        Self { client: fidl::client::Client::new(channel, protocol_name) }
4295    }
4296
4297    /// Get a Stream of events from the remote end of the protocol.
4298    ///
4299    /// # Panics
4300    ///
4301    /// Panics if the event stream was already taken.
4302    pub fn take_event_stream(&self) -> RouteTableProviderV6EventStream {
4303        RouteTableProviderV6EventStream { event_receiver: self.client.take_event_receiver() }
4304    }
4305
4306    /// Creates a new route table. If the client end of the `provider` is
4307    /// closed, the route table is removed (unless detached).
4308    pub fn r#new_route_table(
4309        &self,
4310        mut provider: fidl::endpoints::ServerEnd<RouteTableV6Marker>,
4311        mut options: &RouteTableOptionsV6,
4312    ) -> Result<(), fidl::Error> {
4313        RouteTableProviderV6ProxyInterface::r#new_route_table(self, provider, options)
4314    }
4315}
4316
4317impl RouteTableProviderV6ProxyInterface for RouteTableProviderV6Proxy {
4318    fn r#new_route_table(
4319        &self,
4320        mut provider: fidl::endpoints::ServerEnd<RouteTableV6Marker>,
4321        mut options: &RouteTableOptionsV6,
4322    ) -> Result<(), fidl::Error> {
4323        self.client.send::<RouteTableProviderV6NewRouteTableRequest>(
4324            (provider, options),
4325            0x152b67b397a31ca,
4326            fidl::encoding::DynamicFlags::empty(),
4327        )
4328    }
4329}
4330
4331pub struct RouteTableProviderV6EventStream {
4332    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4333}
4334
4335impl std::marker::Unpin for RouteTableProviderV6EventStream {}
4336
4337impl futures::stream::FusedStream for RouteTableProviderV6EventStream {
4338    fn is_terminated(&self) -> bool {
4339        self.event_receiver.is_terminated()
4340    }
4341}
4342
4343impl futures::Stream for RouteTableProviderV6EventStream {
4344    type Item = Result<RouteTableProviderV6Event, fidl::Error>;
4345
4346    fn poll_next(
4347        mut self: std::pin::Pin<&mut Self>,
4348        cx: &mut std::task::Context<'_>,
4349    ) -> std::task::Poll<Option<Self::Item>> {
4350        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4351            &mut self.event_receiver,
4352            cx
4353        )?) {
4354            Some(buf) => std::task::Poll::Ready(Some(RouteTableProviderV6Event::decode(buf))),
4355            None => std::task::Poll::Ready(None),
4356        }
4357    }
4358}
4359
4360#[derive(Debug)]
4361pub enum RouteTableProviderV6Event {}
4362
4363impl RouteTableProviderV6Event {
4364    /// Decodes a message buffer as a [`RouteTableProviderV6Event`].
4365    fn decode(
4366        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4367    ) -> Result<RouteTableProviderV6Event, fidl::Error> {
4368        let (bytes, _handles) = buf.split_mut();
4369        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4370        debug_assert_eq!(tx_header.tx_id, 0);
4371        match tx_header.ordinal {
4372            _ => Err(fidl::Error::UnknownOrdinal {
4373                ordinal: tx_header.ordinal,
4374                protocol_name:
4375                    <RouteTableProviderV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4376            }),
4377        }
4378    }
4379}
4380
4381/// A Stream of incoming requests for fuchsia.net.routes.admin/RouteTableProviderV6.
4382pub struct RouteTableProviderV6RequestStream {
4383    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4384    is_terminated: bool,
4385}
4386
4387impl std::marker::Unpin for RouteTableProviderV6RequestStream {}
4388
4389impl futures::stream::FusedStream for RouteTableProviderV6RequestStream {
4390    fn is_terminated(&self) -> bool {
4391        self.is_terminated
4392    }
4393}
4394
4395impl fidl::endpoints::RequestStream for RouteTableProviderV6RequestStream {
4396    type Protocol = RouteTableProviderV6Marker;
4397    type ControlHandle = RouteTableProviderV6ControlHandle;
4398
4399    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4400        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4401    }
4402
4403    fn control_handle(&self) -> Self::ControlHandle {
4404        RouteTableProviderV6ControlHandle { inner: self.inner.clone() }
4405    }
4406
4407    fn into_inner(
4408        self,
4409    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4410    {
4411        (self.inner, self.is_terminated)
4412    }
4413
4414    fn from_inner(
4415        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4416        is_terminated: bool,
4417    ) -> Self {
4418        Self { inner, is_terminated }
4419    }
4420}
4421
4422impl futures::Stream for RouteTableProviderV6RequestStream {
4423    type Item = Result<RouteTableProviderV6Request, fidl::Error>;
4424
4425    fn poll_next(
4426        mut self: std::pin::Pin<&mut Self>,
4427        cx: &mut std::task::Context<'_>,
4428    ) -> std::task::Poll<Option<Self::Item>> {
4429        let this = &mut *self;
4430        if this.inner.check_shutdown(cx) {
4431            this.is_terminated = true;
4432            return std::task::Poll::Ready(None);
4433        }
4434        if this.is_terminated {
4435            panic!("polled RouteTableProviderV6RequestStream after completion");
4436        }
4437        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
4438            |bytes, handles| {
4439                match this.inner.channel().read_etc(cx, bytes, handles) {
4440                    std::task::Poll::Ready(Ok(())) => {}
4441                    std::task::Poll::Pending => return std::task::Poll::Pending,
4442                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
4443                        this.is_terminated = true;
4444                        return std::task::Poll::Ready(None);
4445                    }
4446                    std::task::Poll::Ready(Err(e)) => {
4447                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
4448                            e.into(),
4449                        ))))
4450                    }
4451                }
4452
4453                // A message has been received from the channel
4454                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4455
4456                std::task::Poll::Ready(Some(match header.ordinal {
4457                0x152b67b397a31ca => {
4458                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
4459                    let mut req = fidl::new_empty!(RouteTableProviderV6NewRouteTableRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
4460                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RouteTableProviderV6NewRouteTableRequest>(&header, _body_bytes, handles, &mut req)?;
4461                    let control_handle = RouteTableProviderV6ControlHandle {
4462                        inner: this.inner.clone(),
4463                    };
4464                    Ok(RouteTableProviderV6Request::NewRouteTable {provider: req.provider,
4465options: req.options,
4466
4467                        control_handle,
4468                    })
4469                }
4470                _ => Err(fidl::Error::UnknownOrdinal {
4471                    ordinal: header.ordinal,
4472                    protocol_name: <RouteTableProviderV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4473                }),
4474            }))
4475            },
4476        )
4477    }
4478}
4479
4480/// This protocol allows the client to create route tables.
4481#[derive(Debug)]
4482pub enum RouteTableProviderV6Request {
4483    /// Creates a new route table. If the client end of the `provider` is
4484    /// closed, the route table is removed (unless detached).
4485    NewRouteTable {
4486        provider: fidl::endpoints::ServerEnd<RouteTableV6Marker>,
4487        options: RouteTableOptionsV6,
4488        control_handle: RouteTableProviderV6ControlHandle,
4489    },
4490}
4491
4492impl RouteTableProviderV6Request {
4493    #[allow(irrefutable_let_patterns)]
4494    pub fn into_new_route_table(
4495        self,
4496    ) -> Option<(
4497        fidl::endpoints::ServerEnd<RouteTableV6Marker>,
4498        RouteTableOptionsV6,
4499        RouteTableProviderV6ControlHandle,
4500    )> {
4501        if let RouteTableProviderV6Request::NewRouteTable { provider, options, control_handle } =
4502            self
4503        {
4504            Some((provider, options, control_handle))
4505        } else {
4506            None
4507        }
4508    }
4509
4510    /// Name of the method defined in FIDL
4511    pub fn method_name(&self) -> &'static str {
4512        match *self {
4513            RouteTableProviderV6Request::NewRouteTable { .. } => "new_route_table",
4514        }
4515    }
4516}
4517
4518#[derive(Debug, Clone)]
4519pub struct RouteTableProviderV6ControlHandle {
4520    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4521}
4522
4523impl fidl::endpoints::ControlHandle for RouteTableProviderV6ControlHandle {
4524    fn shutdown(&self) {
4525        self.inner.shutdown()
4526    }
4527    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
4528        self.inner.shutdown_with_epitaph(status)
4529    }
4530
4531    fn is_closed(&self) -> bool {
4532        self.inner.channel().is_closed()
4533    }
4534    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
4535        self.inner.channel().on_closed()
4536    }
4537
4538    #[cfg(target_os = "fuchsia")]
4539    fn signal_peer(
4540        &self,
4541        clear_mask: zx::Signals,
4542        set_mask: zx::Signals,
4543    ) -> Result<(), zx_status::Status> {
4544        use fidl::Peered;
4545        self.inner.channel().signal_peer(clear_mask, set_mask)
4546    }
4547}
4548
4549impl RouteTableProviderV6ControlHandle {}
4550
4551#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
4552pub struct RouteTableV4Marker;
4553
4554impl fidl::endpoints::ProtocolMarker for RouteTableV4Marker {
4555    type Proxy = RouteTableV4Proxy;
4556    type RequestStream = RouteTableV4RequestStream;
4557    #[cfg(target_os = "fuchsia")]
4558    type SynchronousProxy = RouteTableV4SynchronousProxy;
4559
4560    const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RouteTableV4";
4561}
4562impl fidl::endpoints::DiscoverableProtocolMarker for RouteTableV4Marker {}
4563
4564pub trait RouteTableV4ProxyInterface: Send + Sync {
4565    type GetTableIdResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
4566    fn r#get_table_id(&self) -> Self::GetTableIdResponseFut;
4567    fn r#detach(&self) -> Result<(), fidl::Error>;
4568    type RemoveResponseFut: std::future::Future<Output = Result<BaseRouteTableRemoveResult, fidl::Error>>
4569        + Send;
4570    fn r#remove(&self) -> Self::RemoveResponseFut;
4571    type GetAuthorizationForRouteTableResponseFut: std::future::Future<Output = Result<GrantForRouteTableAuthorization, fidl::Error>>
4572        + Send;
4573    fn r#get_authorization_for_route_table(&self)
4574        -> Self::GetAuthorizationForRouteTableResponseFut;
4575    fn r#new_route_set(
4576        &self,
4577        route_set: fidl::endpoints::ServerEnd<RouteSetV4Marker>,
4578    ) -> Result<(), fidl::Error>;
4579}
4580#[derive(Debug)]
4581#[cfg(target_os = "fuchsia")]
4582pub struct RouteTableV4SynchronousProxy {
4583    client: fidl::client::sync::Client,
4584}
4585
4586#[cfg(target_os = "fuchsia")]
4587impl fidl::endpoints::SynchronousProxy for RouteTableV4SynchronousProxy {
4588    type Proxy = RouteTableV4Proxy;
4589    type Protocol = RouteTableV4Marker;
4590
4591    fn from_channel(inner: fidl::Channel) -> Self {
4592        Self::new(inner)
4593    }
4594
4595    fn into_channel(self) -> fidl::Channel {
4596        self.client.into_channel()
4597    }
4598
4599    fn as_channel(&self) -> &fidl::Channel {
4600        self.client.as_channel()
4601    }
4602}
4603
4604#[cfg(target_os = "fuchsia")]
4605impl RouteTableV4SynchronousProxy {
4606    pub fn new(channel: fidl::Channel) -> Self {
4607        let protocol_name = <RouteTableV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4608        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
4609    }
4610
4611    pub fn into_channel(self) -> fidl::Channel {
4612        self.client.into_channel()
4613    }
4614
4615    /// Waits until an event arrives and returns it. It is safe for other
4616    /// threads to make concurrent requests while waiting for an event.
4617    pub fn wait_for_event(
4618        &self,
4619        deadline: zx::MonotonicInstant,
4620    ) -> Result<RouteTableV4Event, fidl::Error> {
4621        RouteTableV4Event::decode(self.client.wait_for_event(deadline)?)
4622    }
4623
4624    /// Gets the table ID for this table.
4625    pub fn r#get_table_id(&self, ___deadline: zx::MonotonicInstant) -> Result<u32, fidl::Error> {
4626        let _response = self
4627            .client
4628            .send_query::<fidl::encoding::EmptyPayload, BaseRouteTableGetTableIdResponse>(
4629                (),
4630                0x7eab30c55edbfc15,
4631                fidl::encoding::DynamicFlags::empty(),
4632                ___deadline,
4633            )?;
4634        Ok(_response.table_id)
4635    }
4636
4637    /// Detaches the lifetime of the route table from the lifetime of the
4638    /// client end of the channel.
4639    ///
4640    /// After this method is called, the route table will not be removed
4641    /// if the client end is closed. It's a no-op if called on the main table.
4642    pub fn r#detach(&self) -> Result<(), fidl::Error> {
4643        self.client.send::<fidl::encoding::EmptyPayload>(
4644            (),
4645            0x2853ab157285b384,
4646            fidl::encoding::DynamicFlags::empty(),
4647        )
4648    }
4649
4650    /// Removes the route table explicitly.
4651    ///
4652    /// This method cannot be called on the main table, an error will be
4653    /// returned if called. The server will close the channel after this
4654    /// method successfully returns.
4655    pub fn r#remove(
4656        &self,
4657        ___deadline: zx::MonotonicInstant,
4658    ) -> Result<BaseRouteTableRemoveResult, fidl::Error> {
4659        let _response =
4660            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
4661                fidl::encoding::EmptyStruct,
4662                BaseRouteTableRemoveError,
4663            >>(
4664                (),
4665                0xc42e58a5fc79426,
4666                fidl::encoding::DynamicFlags::empty(),
4667                ___deadline,
4668            )?;
4669        Ok(_response.map(|x| x))
4670    }
4671
4672    /// Gets an authentication credential for this table.
4673    ///
4674    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
4675    /// held by the server. This credential can be passed into
4676    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
4677    /// table. The `EVENT` is stable throughout the lifetime of the route table.
4678    /// Clients may duplicate this `EVENT` to make multiple API calls, or
4679    /// transfer the `EVENT` to other clients.
4680    ///
4681    /// - response `credential` the authorization credential for this table.
4682    pub fn r#get_authorization_for_route_table(
4683        &self,
4684        ___deadline: zx::MonotonicInstant,
4685    ) -> Result<GrantForRouteTableAuthorization, fidl::Error> {
4686        let _response = self.client.send_query::<
4687            fidl::encoding::EmptyPayload,
4688            BaseRouteTableGetAuthorizationForRouteTableResponse,
4689        >(
4690            (),
4691            0x56a48c921ff3b6eb,
4692            fidl::encoding::DynamicFlags::empty(),
4693            ___deadline,
4694        )?;
4695        Ok(_response.credential)
4696    }
4697
4698    /// Creates an empty route set.
4699    ///
4700    /// + request `route_set` grants access to the [`RouteSetV4`] protocol.
4701    pub fn r#new_route_set(
4702        &self,
4703        mut route_set: fidl::endpoints::ServerEnd<RouteSetV4Marker>,
4704    ) -> Result<(), fidl::Error> {
4705        self.client.send::<RouteTableV4NewRouteSetRequest>(
4706            (route_set,),
4707            0x6aeb6d05698abedb,
4708            fidl::encoding::DynamicFlags::empty(),
4709        )
4710    }
4711}
4712
4713#[derive(Debug, Clone)]
4714pub struct RouteTableV4Proxy {
4715    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
4716}
4717
4718impl fidl::endpoints::Proxy for RouteTableV4Proxy {
4719    type Protocol = RouteTableV4Marker;
4720
4721    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
4722        Self::new(inner)
4723    }
4724
4725    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
4726        self.client.into_channel().map_err(|client| Self { client })
4727    }
4728
4729    fn as_channel(&self) -> &::fidl::AsyncChannel {
4730        self.client.as_channel()
4731    }
4732}
4733
4734impl RouteTableV4Proxy {
4735    /// Create a new Proxy for fuchsia.net.routes.admin/RouteTableV4.
4736    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
4737        let protocol_name = <RouteTableV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
4738        Self { client: fidl::client::Client::new(channel, protocol_name) }
4739    }
4740
4741    /// Get a Stream of events from the remote end of the protocol.
4742    ///
4743    /// # Panics
4744    ///
4745    /// Panics if the event stream was already taken.
4746    pub fn take_event_stream(&self) -> RouteTableV4EventStream {
4747        RouteTableV4EventStream { event_receiver: self.client.take_event_receiver() }
4748    }
4749
4750    /// Gets the table ID for this table.
4751    pub fn r#get_table_id(
4752        &self,
4753    ) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
4754        RouteTableV4ProxyInterface::r#get_table_id(self)
4755    }
4756
4757    /// Detaches the lifetime of the route table from the lifetime of the
4758    /// client end of the channel.
4759    ///
4760    /// After this method is called, the route table will not be removed
4761    /// if the client end is closed. It's a no-op if called on the main table.
4762    pub fn r#detach(&self) -> Result<(), fidl::Error> {
4763        RouteTableV4ProxyInterface::r#detach(self)
4764    }
4765
4766    /// Removes the route table explicitly.
4767    ///
4768    /// This method cannot be called on the main table, an error will be
4769    /// returned if called. The server will close the channel after this
4770    /// method successfully returns.
4771    pub fn r#remove(
4772        &self,
4773    ) -> fidl::client::QueryResponseFut<
4774        BaseRouteTableRemoveResult,
4775        fidl::encoding::DefaultFuchsiaResourceDialect,
4776    > {
4777        RouteTableV4ProxyInterface::r#remove(self)
4778    }
4779
4780    /// Gets an authentication credential for this table.
4781    ///
4782    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
4783    /// held by the server. This credential can be passed into
4784    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
4785    /// table. The `EVENT` is stable throughout the lifetime of the route table.
4786    /// Clients may duplicate this `EVENT` to make multiple API calls, or
4787    /// transfer the `EVENT` to other clients.
4788    ///
4789    /// - response `credential` the authorization credential for this table.
4790    pub fn r#get_authorization_for_route_table(
4791        &self,
4792    ) -> fidl::client::QueryResponseFut<
4793        GrantForRouteTableAuthorization,
4794        fidl::encoding::DefaultFuchsiaResourceDialect,
4795    > {
4796        RouteTableV4ProxyInterface::r#get_authorization_for_route_table(self)
4797    }
4798
4799    /// Creates an empty route set.
4800    ///
4801    /// + request `route_set` grants access to the [`RouteSetV4`] protocol.
4802    pub fn r#new_route_set(
4803        &self,
4804        mut route_set: fidl::endpoints::ServerEnd<RouteSetV4Marker>,
4805    ) -> Result<(), fidl::Error> {
4806        RouteTableV4ProxyInterface::r#new_route_set(self, route_set)
4807    }
4808}
4809
4810impl RouteTableV4ProxyInterface for RouteTableV4Proxy {
4811    type GetTableIdResponseFut =
4812        fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
4813    fn r#get_table_id(&self) -> Self::GetTableIdResponseFut {
4814        fn _decode(
4815            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4816        ) -> Result<u32, fidl::Error> {
4817            let _response = fidl::client::decode_transaction_body::<
4818                BaseRouteTableGetTableIdResponse,
4819                fidl::encoding::DefaultFuchsiaResourceDialect,
4820                0x7eab30c55edbfc15,
4821            >(_buf?)?;
4822            Ok(_response.table_id)
4823        }
4824        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
4825            (),
4826            0x7eab30c55edbfc15,
4827            fidl::encoding::DynamicFlags::empty(),
4828            _decode,
4829        )
4830    }
4831
4832    fn r#detach(&self) -> Result<(), fidl::Error> {
4833        self.client.send::<fidl::encoding::EmptyPayload>(
4834            (),
4835            0x2853ab157285b384,
4836            fidl::encoding::DynamicFlags::empty(),
4837        )
4838    }
4839
4840    type RemoveResponseFut = fidl::client::QueryResponseFut<
4841        BaseRouteTableRemoveResult,
4842        fidl::encoding::DefaultFuchsiaResourceDialect,
4843    >;
4844    fn r#remove(&self) -> Self::RemoveResponseFut {
4845        fn _decode(
4846            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4847        ) -> Result<BaseRouteTableRemoveResult, fidl::Error> {
4848            let _response = fidl::client::decode_transaction_body::<
4849                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BaseRouteTableRemoveError>,
4850                fidl::encoding::DefaultFuchsiaResourceDialect,
4851                0xc42e58a5fc79426,
4852            >(_buf?)?;
4853            Ok(_response.map(|x| x))
4854        }
4855        self.client
4856            .send_query_and_decode::<fidl::encoding::EmptyPayload, BaseRouteTableRemoveResult>(
4857                (),
4858                0xc42e58a5fc79426,
4859                fidl::encoding::DynamicFlags::empty(),
4860                _decode,
4861            )
4862    }
4863
4864    type GetAuthorizationForRouteTableResponseFut = fidl::client::QueryResponseFut<
4865        GrantForRouteTableAuthorization,
4866        fidl::encoding::DefaultFuchsiaResourceDialect,
4867    >;
4868    fn r#get_authorization_for_route_table(
4869        &self,
4870    ) -> Self::GetAuthorizationForRouteTableResponseFut {
4871        fn _decode(
4872            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
4873        ) -> Result<GrantForRouteTableAuthorization, fidl::Error> {
4874            let _response = fidl::client::decode_transaction_body::<
4875                BaseRouteTableGetAuthorizationForRouteTableResponse,
4876                fidl::encoding::DefaultFuchsiaResourceDialect,
4877                0x56a48c921ff3b6eb,
4878            >(_buf?)?;
4879            Ok(_response.credential)
4880        }
4881        self.client
4882            .send_query_and_decode::<fidl::encoding::EmptyPayload, GrantForRouteTableAuthorization>(
4883                (),
4884                0x56a48c921ff3b6eb,
4885                fidl::encoding::DynamicFlags::empty(),
4886                _decode,
4887            )
4888    }
4889
4890    fn r#new_route_set(
4891        &self,
4892        mut route_set: fidl::endpoints::ServerEnd<RouteSetV4Marker>,
4893    ) -> Result<(), fidl::Error> {
4894        self.client.send::<RouteTableV4NewRouteSetRequest>(
4895            (route_set,),
4896            0x6aeb6d05698abedb,
4897            fidl::encoding::DynamicFlags::empty(),
4898        )
4899    }
4900}
4901
4902pub struct RouteTableV4EventStream {
4903    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
4904}
4905
4906impl std::marker::Unpin for RouteTableV4EventStream {}
4907
4908impl futures::stream::FusedStream for RouteTableV4EventStream {
4909    fn is_terminated(&self) -> bool {
4910        self.event_receiver.is_terminated()
4911    }
4912}
4913
4914impl futures::Stream for RouteTableV4EventStream {
4915    type Item = Result<RouteTableV4Event, fidl::Error>;
4916
4917    fn poll_next(
4918        mut self: std::pin::Pin<&mut Self>,
4919        cx: &mut std::task::Context<'_>,
4920    ) -> std::task::Poll<Option<Self::Item>> {
4921        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
4922            &mut self.event_receiver,
4923            cx
4924        )?) {
4925            Some(buf) => std::task::Poll::Ready(Some(RouteTableV4Event::decode(buf))),
4926            None => std::task::Poll::Ready(None),
4927        }
4928    }
4929}
4930
4931#[derive(Debug)]
4932pub enum RouteTableV4Event {}
4933
4934impl RouteTableV4Event {
4935    /// Decodes a message buffer as a [`RouteTableV4Event`].
4936    fn decode(
4937        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
4938    ) -> Result<RouteTableV4Event, fidl::Error> {
4939        let (bytes, _handles) = buf.split_mut();
4940        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
4941        debug_assert_eq!(tx_header.tx_id, 0);
4942        match tx_header.ordinal {
4943            _ => Err(fidl::Error::UnknownOrdinal {
4944                ordinal: tx_header.ordinal,
4945                protocol_name: <RouteTableV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
4946            }),
4947        }
4948    }
4949}
4950
4951/// A Stream of incoming requests for fuchsia.net.routes.admin/RouteTableV4.
4952pub struct RouteTableV4RequestStream {
4953    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4954    is_terminated: bool,
4955}
4956
4957impl std::marker::Unpin for RouteTableV4RequestStream {}
4958
4959impl futures::stream::FusedStream for RouteTableV4RequestStream {
4960    fn is_terminated(&self) -> bool {
4961        self.is_terminated
4962    }
4963}
4964
4965impl fidl::endpoints::RequestStream for RouteTableV4RequestStream {
4966    type Protocol = RouteTableV4Marker;
4967    type ControlHandle = RouteTableV4ControlHandle;
4968
4969    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
4970        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
4971    }
4972
4973    fn control_handle(&self) -> Self::ControlHandle {
4974        RouteTableV4ControlHandle { inner: self.inner.clone() }
4975    }
4976
4977    fn into_inner(
4978        self,
4979    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
4980    {
4981        (self.inner, self.is_terminated)
4982    }
4983
4984    fn from_inner(
4985        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
4986        is_terminated: bool,
4987    ) -> Self {
4988        Self { inner, is_terminated }
4989    }
4990}
4991
4992impl futures::Stream for RouteTableV4RequestStream {
4993    type Item = Result<RouteTableV4Request, fidl::Error>;
4994
4995    fn poll_next(
4996        mut self: std::pin::Pin<&mut Self>,
4997        cx: &mut std::task::Context<'_>,
4998    ) -> std::task::Poll<Option<Self::Item>> {
4999        let this = &mut *self;
5000        if this.inner.check_shutdown(cx) {
5001            this.is_terminated = true;
5002            return std::task::Poll::Ready(None);
5003        }
5004        if this.is_terminated {
5005            panic!("polled RouteTableV4RequestStream after completion");
5006        }
5007        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5008            |bytes, handles| {
5009                match this.inner.channel().read_etc(cx, bytes, handles) {
5010                    std::task::Poll::Ready(Ok(())) => {}
5011                    std::task::Poll::Pending => return std::task::Poll::Pending,
5012                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5013                        this.is_terminated = true;
5014                        return std::task::Poll::Ready(None);
5015                    }
5016                    std::task::Poll::Ready(Err(e)) => {
5017                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5018                            e.into(),
5019                        ))))
5020                    }
5021                }
5022
5023                // A message has been received from the channel
5024                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5025
5026                std::task::Poll::Ready(Some(match header.ordinal {
5027                    0x7eab30c55edbfc15 => {
5028                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5029                        let mut req = fidl::new_empty!(
5030                            fidl::encoding::EmptyPayload,
5031                            fidl::encoding::DefaultFuchsiaResourceDialect
5032                        );
5033                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5034                        let control_handle =
5035                            RouteTableV4ControlHandle { inner: this.inner.clone() };
5036                        Ok(RouteTableV4Request::GetTableId {
5037                            responder: RouteTableV4GetTableIdResponder {
5038                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5039                                tx_id: header.tx_id,
5040                            },
5041                        })
5042                    }
5043                    0x2853ab157285b384 => {
5044                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5045                        let mut req = fidl::new_empty!(
5046                            fidl::encoding::EmptyPayload,
5047                            fidl::encoding::DefaultFuchsiaResourceDialect
5048                        );
5049                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5050                        let control_handle =
5051                            RouteTableV4ControlHandle { inner: this.inner.clone() };
5052                        Ok(RouteTableV4Request::Detach { control_handle })
5053                    }
5054                    0xc42e58a5fc79426 => {
5055                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5056                        let mut req = fidl::new_empty!(
5057                            fidl::encoding::EmptyPayload,
5058                            fidl::encoding::DefaultFuchsiaResourceDialect
5059                        );
5060                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5061                        let control_handle =
5062                            RouteTableV4ControlHandle { inner: this.inner.clone() };
5063                        Ok(RouteTableV4Request::Remove {
5064                            responder: RouteTableV4RemoveResponder {
5065                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5066                                tx_id: header.tx_id,
5067                            },
5068                        })
5069                    }
5070                    0x56a48c921ff3b6eb => {
5071                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5072                        let mut req = fidl::new_empty!(
5073                            fidl::encoding::EmptyPayload,
5074                            fidl::encoding::DefaultFuchsiaResourceDialect
5075                        );
5076                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5077                        let control_handle =
5078                            RouteTableV4ControlHandle { inner: this.inner.clone() };
5079                        Ok(RouteTableV4Request::GetAuthorizationForRouteTable {
5080                            responder: RouteTableV4GetAuthorizationForRouteTableResponder {
5081                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5082                                tx_id: header.tx_id,
5083                            },
5084                        })
5085                    }
5086                    0x6aeb6d05698abedb => {
5087                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5088                        let mut req = fidl::new_empty!(
5089                            RouteTableV4NewRouteSetRequest,
5090                            fidl::encoding::DefaultFuchsiaResourceDialect
5091                        );
5092                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RouteTableV4NewRouteSetRequest>(&header, _body_bytes, handles, &mut req)?;
5093                        let control_handle =
5094                            RouteTableV4ControlHandle { inner: this.inner.clone() };
5095                        Ok(RouteTableV4Request::NewRouteSet {
5096                            route_set: req.route_set,
5097
5098                            control_handle,
5099                        })
5100                    }
5101                    _ => Err(fidl::Error::UnknownOrdinal {
5102                        ordinal: header.ordinal,
5103                        protocol_name:
5104                            <RouteTableV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5105                    }),
5106                }))
5107            },
5108        )
5109    }
5110}
5111
5112/// Vends isolated administrative access to the system's IPv4 routing table.
5113///
5114/// A main route table is accessible through the discoverable [`RouteTableV4`]
5115/// protocol. Other tables can be installed using the `NewRouteTable` method
5116/// on [`RouteTableProviderV4`]. The [`RouteTableV4`] also encodes the lifetime
5117/// of the underlying route table, dropping the client end of the protocol
5118/// causes the underlying route table to be removed unless it is detached. The
5119/// main table is detached by default.
5120#[derive(Debug)]
5121pub enum RouteTableV4Request {
5122    /// Gets the table ID for this table.
5123    GetTableId { responder: RouteTableV4GetTableIdResponder },
5124    /// Detaches the lifetime of the route table from the lifetime of the
5125    /// client end of the channel.
5126    ///
5127    /// After this method is called, the route table will not be removed
5128    /// if the client end is closed. It's a no-op if called on the main table.
5129    Detach { control_handle: RouteTableV4ControlHandle },
5130    /// Removes the route table explicitly.
5131    ///
5132    /// This method cannot be called on the main table, an error will be
5133    /// returned if called. The server will close the channel after this
5134    /// method successfully returns.
5135    Remove { responder: RouteTableV4RemoveResponder },
5136    /// Gets an authentication credential for this table.
5137    ///
5138    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
5139    /// held by the server. This credential can be passed into
5140    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
5141    /// table. The `EVENT` is stable throughout the lifetime of the route table.
5142    /// Clients may duplicate this `EVENT` to make multiple API calls, or
5143    /// transfer the `EVENT` to other clients.
5144    ///
5145    /// - response `credential` the authorization credential for this table.
5146    GetAuthorizationForRouteTable { responder: RouteTableV4GetAuthorizationForRouteTableResponder },
5147    /// Creates an empty route set.
5148    ///
5149    /// + request `route_set` grants access to the [`RouteSetV4`] protocol.
5150    NewRouteSet {
5151        route_set: fidl::endpoints::ServerEnd<RouteSetV4Marker>,
5152        control_handle: RouteTableV4ControlHandle,
5153    },
5154}
5155
5156impl RouteTableV4Request {
5157    #[allow(irrefutable_let_patterns)]
5158    pub fn into_get_table_id(self) -> Option<(RouteTableV4GetTableIdResponder)> {
5159        if let RouteTableV4Request::GetTableId { responder } = self {
5160            Some((responder))
5161        } else {
5162            None
5163        }
5164    }
5165
5166    #[allow(irrefutable_let_patterns)]
5167    pub fn into_detach(self) -> Option<(RouteTableV4ControlHandle)> {
5168        if let RouteTableV4Request::Detach { control_handle } = self {
5169            Some((control_handle))
5170        } else {
5171            None
5172        }
5173    }
5174
5175    #[allow(irrefutable_let_patterns)]
5176    pub fn into_remove(self) -> Option<(RouteTableV4RemoveResponder)> {
5177        if let RouteTableV4Request::Remove { responder } = self {
5178            Some((responder))
5179        } else {
5180            None
5181        }
5182    }
5183
5184    #[allow(irrefutable_let_patterns)]
5185    pub fn into_get_authorization_for_route_table(
5186        self,
5187    ) -> Option<(RouteTableV4GetAuthorizationForRouteTableResponder)> {
5188        if let RouteTableV4Request::GetAuthorizationForRouteTable { responder } = self {
5189            Some((responder))
5190        } else {
5191            None
5192        }
5193    }
5194
5195    #[allow(irrefutable_let_patterns)]
5196    pub fn into_new_route_set(
5197        self,
5198    ) -> Option<(fidl::endpoints::ServerEnd<RouteSetV4Marker>, RouteTableV4ControlHandle)> {
5199        if let RouteTableV4Request::NewRouteSet { route_set, control_handle } = self {
5200            Some((route_set, control_handle))
5201        } else {
5202            None
5203        }
5204    }
5205
5206    /// Name of the method defined in FIDL
5207    pub fn method_name(&self) -> &'static str {
5208        match *self {
5209            RouteTableV4Request::GetTableId { .. } => "get_table_id",
5210            RouteTableV4Request::Detach { .. } => "detach",
5211            RouteTableV4Request::Remove { .. } => "remove",
5212            RouteTableV4Request::GetAuthorizationForRouteTable { .. } => {
5213                "get_authorization_for_route_table"
5214            }
5215            RouteTableV4Request::NewRouteSet { .. } => "new_route_set",
5216        }
5217    }
5218}
5219
5220#[derive(Debug, Clone)]
5221pub struct RouteTableV4ControlHandle {
5222    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5223}
5224
5225impl fidl::endpoints::ControlHandle for RouteTableV4ControlHandle {
5226    fn shutdown(&self) {
5227        self.inner.shutdown()
5228    }
5229    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
5230        self.inner.shutdown_with_epitaph(status)
5231    }
5232
5233    fn is_closed(&self) -> bool {
5234        self.inner.channel().is_closed()
5235    }
5236    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
5237        self.inner.channel().on_closed()
5238    }
5239
5240    #[cfg(target_os = "fuchsia")]
5241    fn signal_peer(
5242        &self,
5243        clear_mask: zx::Signals,
5244        set_mask: zx::Signals,
5245    ) -> Result<(), zx_status::Status> {
5246        use fidl::Peered;
5247        self.inner.channel().signal_peer(clear_mask, set_mask)
5248    }
5249}
5250
5251impl RouteTableV4ControlHandle {}
5252
5253#[must_use = "FIDL methods require a response to be sent"]
5254#[derive(Debug)]
5255pub struct RouteTableV4GetTableIdResponder {
5256    control_handle: std::mem::ManuallyDrop<RouteTableV4ControlHandle>,
5257    tx_id: u32,
5258}
5259
5260/// Set the the channel to be shutdown (see [`RouteTableV4ControlHandle::shutdown`])
5261/// if the responder is dropped without sending a response, so that the client
5262/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5263impl std::ops::Drop for RouteTableV4GetTableIdResponder {
5264    fn drop(&mut self) {
5265        self.control_handle.shutdown();
5266        // Safety: drops once, never accessed again
5267        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5268    }
5269}
5270
5271impl fidl::endpoints::Responder for RouteTableV4GetTableIdResponder {
5272    type ControlHandle = RouteTableV4ControlHandle;
5273
5274    fn control_handle(&self) -> &RouteTableV4ControlHandle {
5275        &self.control_handle
5276    }
5277
5278    fn drop_without_shutdown(mut self) {
5279        // Safety: drops once, never accessed again due to mem::forget
5280        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5281        // Prevent Drop from running (which would shut down the channel)
5282        std::mem::forget(self);
5283    }
5284}
5285
5286impl RouteTableV4GetTableIdResponder {
5287    /// Sends a response to the FIDL transaction.
5288    ///
5289    /// Sets the channel to shutdown if an error occurs.
5290    pub fn send(self, mut table_id: u32) -> Result<(), fidl::Error> {
5291        let _result = self.send_raw(table_id);
5292        if _result.is_err() {
5293            self.control_handle.shutdown();
5294        }
5295        self.drop_without_shutdown();
5296        _result
5297    }
5298
5299    /// Similar to "send" but does not shutdown the channel if an error occurs.
5300    pub fn send_no_shutdown_on_err(self, mut table_id: u32) -> Result<(), fidl::Error> {
5301        let _result = self.send_raw(table_id);
5302        self.drop_without_shutdown();
5303        _result
5304    }
5305
5306    fn send_raw(&self, mut table_id: u32) -> Result<(), fidl::Error> {
5307        self.control_handle.inner.send::<BaseRouteTableGetTableIdResponse>(
5308            (table_id,),
5309            self.tx_id,
5310            0x7eab30c55edbfc15,
5311            fidl::encoding::DynamicFlags::empty(),
5312        )
5313    }
5314}
5315
5316#[must_use = "FIDL methods require a response to be sent"]
5317#[derive(Debug)]
5318pub struct RouteTableV4RemoveResponder {
5319    control_handle: std::mem::ManuallyDrop<RouteTableV4ControlHandle>,
5320    tx_id: u32,
5321}
5322
5323/// Set the the channel to be shutdown (see [`RouteTableV4ControlHandle::shutdown`])
5324/// if the responder is dropped without sending a response, so that the client
5325/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5326impl std::ops::Drop for RouteTableV4RemoveResponder {
5327    fn drop(&mut self) {
5328        self.control_handle.shutdown();
5329        // Safety: drops once, never accessed again
5330        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5331    }
5332}
5333
5334impl fidl::endpoints::Responder for RouteTableV4RemoveResponder {
5335    type ControlHandle = RouteTableV4ControlHandle;
5336
5337    fn control_handle(&self) -> &RouteTableV4ControlHandle {
5338        &self.control_handle
5339    }
5340
5341    fn drop_without_shutdown(mut self) {
5342        // Safety: drops once, never accessed again due to mem::forget
5343        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5344        // Prevent Drop from running (which would shut down the channel)
5345        std::mem::forget(self);
5346    }
5347}
5348
5349impl RouteTableV4RemoveResponder {
5350    /// Sends a response to the FIDL transaction.
5351    ///
5352    /// Sets the channel to shutdown if an error occurs.
5353    pub fn send(
5354        self,
5355        mut result: Result<(), BaseRouteTableRemoveError>,
5356    ) -> Result<(), fidl::Error> {
5357        let _result = self.send_raw(result);
5358        if _result.is_err() {
5359            self.control_handle.shutdown();
5360        }
5361        self.drop_without_shutdown();
5362        _result
5363    }
5364
5365    /// Similar to "send" but does not shutdown the channel if an error occurs.
5366    pub fn send_no_shutdown_on_err(
5367        self,
5368        mut result: Result<(), BaseRouteTableRemoveError>,
5369    ) -> Result<(), fidl::Error> {
5370        let _result = self.send_raw(result);
5371        self.drop_without_shutdown();
5372        _result
5373    }
5374
5375    fn send_raw(
5376        &self,
5377        mut result: Result<(), BaseRouteTableRemoveError>,
5378    ) -> Result<(), fidl::Error> {
5379        self.control_handle.inner.send::<fidl::encoding::ResultType<
5380            fidl::encoding::EmptyStruct,
5381            BaseRouteTableRemoveError,
5382        >>(
5383            result,
5384            self.tx_id,
5385            0xc42e58a5fc79426,
5386            fidl::encoding::DynamicFlags::empty(),
5387        )
5388    }
5389}
5390
5391#[must_use = "FIDL methods require a response to be sent"]
5392#[derive(Debug)]
5393pub struct RouteTableV4GetAuthorizationForRouteTableResponder {
5394    control_handle: std::mem::ManuallyDrop<RouteTableV4ControlHandle>,
5395    tx_id: u32,
5396}
5397
5398/// Set the the channel to be shutdown (see [`RouteTableV4ControlHandle::shutdown`])
5399/// if the responder is dropped without sending a response, so that the client
5400/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
5401impl std::ops::Drop for RouteTableV4GetAuthorizationForRouteTableResponder {
5402    fn drop(&mut self) {
5403        self.control_handle.shutdown();
5404        // Safety: drops once, never accessed again
5405        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5406    }
5407}
5408
5409impl fidl::endpoints::Responder for RouteTableV4GetAuthorizationForRouteTableResponder {
5410    type ControlHandle = RouteTableV4ControlHandle;
5411
5412    fn control_handle(&self) -> &RouteTableV4ControlHandle {
5413        &self.control_handle
5414    }
5415
5416    fn drop_without_shutdown(mut self) {
5417        // Safety: drops once, never accessed again due to mem::forget
5418        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
5419        // Prevent Drop from running (which would shut down the channel)
5420        std::mem::forget(self);
5421    }
5422}
5423
5424impl RouteTableV4GetAuthorizationForRouteTableResponder {
5425    /// Sends a response to the FIDL transaction.
5426    ///
5427    /// Sets the channel to shutdown if an error occurs.
5428    pub fn send(self, mut credential: GrantForRouteTableAuthorization) -> Result<(), fidl::Error> {
5429        let _result = self.send_raw(credential);
5430        if _result.is_err() {
5431            self.control_handle.shutdown();
5432        }
5433        self.drop_without_shutdown();
5434        _result
5435    }
5436
5437    /// Similar to "send" but does not shutdown the channel if an error occurs.
5438    pub fn send_no_shutdown_on_err(
5439        self,
5440        mut credential: GrantForRouteTableAuthorization,
5441    ) -> Result<(), fidl::Error> {
5442        let _result = self.send_raw(credential);
5443        self.drop_without_shutdown();
5444        _result
5445    }
5446
5447    fn send_raw(&self, mut credential: GrantForRouteTableAuthorization) -> Result<(), fidl::Error> {
5448        self.control_handle.inner.send::<BaseRouteTableGetAuthorizationForRouteTableResponse>(
5449            (&mut credential,),
5450            self.tx_id,
5451            0x56a48c921ff3b6eb,
5452            fidl::encoding::DynamicFlags::empty(),
5453        )
5454    }
5455}
5456
5457#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
5458pub struct RouteTableV6Marker;
5459
5460impl fidl::endpoints::ProtocolMarker for RouteTableV6Marker {
5461    type Proxy = RouteTableV6Proxy;
5462    type RequestStream = RouteTableV6RequestStream;
5463    #[cfg(target_os = "fuchsia")]
5464    type SynchronousProxy = RouteTableV6SynchronousProxy;
5465
5466    const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RouteTableV6";
5467}
5468impl fidl::endpoints::DiscoverableProtocolMarker for RouteTableV6Marker {}
5469
5470pub trait RouteTableV6ProxyInterface: Send + Sync {
5471    type GetTableIdResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
5472    fn r#get_table_id(&self) -> Self::GetTableIdResponseFut;
5473    fn r#detach(&self) -> Result<(), fidl::Error>;
5474    type RemoveResponseFut: std::future::Future<Output = Result<BaseRouteTableRemoveResult, fidl::Error>>
5475        + Send;
5476    fn r#remove(&self) -> Self::RemoveResponseFut;
5477    type GetAuthorizationForRouteTableResponseFut: std::future::Future<Output = Result<GrantForRouteTableAuthorization, fidl::Error>>
5478        + Send;
5479    fn r#get_authorization_for_route_table(&self)
5480        -> Self::GetAuthorizationForRouteTableResponseFut;
5481    fn r#new_route_set(
5482        &self,
5483        route_set: fidl::endpoints::ServerEnd<RouteSetV6Marker>,
5484    ) -> Result<(), fidl::Error>;
5485}
5486#[derive(Debug)]
5487#[cfg(target_os = "fuchsia")]
5488pub struct RouteTableV6SynchronousProxy {
5489    client: fidl::client::sync::Client,
5490}
5491
5492#[cfg(target_os = "fuchsia")]
5493impl fidl::endpoints::SynchronousProxy for RouteTableV6SynchronousProxy {
5494    type Proxy = RouteTableV6Proxy;
5495    type Protocol = RouteTableV6Marker;
5496
5497    fn from_channel(inner: fidl::Channel) -> Self {
5498        Self::new(inner)
5499    }
5500
5501    fn into_channel(self) -> fidl::Channel {
5502        self.client.into_channel()
5503    }
5504
5505    fn as_channel(&self) -> &fidl::Channel {
5506        self.client.as_channel()
5507    }
5508}
5509
5510#[cfg(target_os = "fuchsia")]
5511impl RouteTableV6SynchronousProxy {
5512    pub fn new(channel: fidl::Channel) -> Self {
5513        let protocol_name = <RouteTableV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5514        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
5515    }
5516
5517    pub fn into_channel(self) -> fidl::Channel {
5518        self.client.into_channel()
5519    }
5520
5521    /// Waits until an event arrives and returns it. It is safe for other
5522    /// threads to make concurrent requests while waiting for an event.
5523    pub fn wait_for_event(
5524        &self,
5525        deadline: zx::MonotonicInstant,
5526    ) -> Result<RouteTableV6Event, fidl::Error> {
5527        RouteTableV6Event::decode(self.client.wait_for_event(deadline)?)
5528    }
5529
5530    /// Gets the table ID for this table.
5531    pub fn r#get_table_id(&self, ___deadline: zx::MonotonicInstant) -> Result<u32, fidl::Error> {
5532        let _response = self
5533            .client
5534            .send_query::<fidl::encoding::EmptyPayload, BaseRouteTableGetTableIdResponse>(
5535                (),
5536                0x7eab30c55edbfc15,
5537                fidl::encoding::DynamicFlags::empty(),
5538                ___deadline,
5539            )?;
5540        Ok(_response.table_id)
5541    }
5542
5543    /// Detaches the lifetime of the route table from the lifetime of the
5544    /// client end of the channel.
5545    ///
5546    /// After this method is called, the route table will not be removed
5547    /// if the client end is closed. It's a no-op if called on the main table.
5548    pub fn r#detach(&self) -> Result<(), fidl::Error> {
5549        self.client.send::<fidl::encoding::EmptyPayload>(
5550            (),
5551            0x2853ab157285b384,
5552            fidl::encoding::DynamicFlags::empty(),
5553        )
5554    }
5555
5556    /// Removes the route table explicitly.
5557    ///
5558    /// This method cannot be called on the main table, an error will be
5559    /// returned if called. The server will close the channel after this
5560    /// method successfully returns.
5561    pub fn r#remove(
5562        &self,
5563        ___deadline: zx::MonotonicInstant,
5564    ) -> Result<BaseRouteTableRemoveResult, fidl::Error> {
5565        let _response =
5566            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
5567                fidl::encoding::EmptyStruct,
5568                BaseRouteTableRemoveError,
5569            >>(
5570                (),
5571                0xc42e58a5fc79426,
5572                fidl::encoding::DynamicFlags::empty(),
5573                ___deadline,
5574            )?;
5575        Ok(_response.map(|x| x))
5576    }
5577
5578    /// Gets an authentication credential for this table.
5579    ///
5580    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
5581    /// held by the server. This credential can be passed into
5582    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
5583    /// table. The `EVENT` is stable throughout the lifetime of the route table.
5584    /// Clients may duplicate this `EVENT` to make multiple API calls, or
5585    /// transfer the `EVENT` to other clients.
5586    ///
5587    /// - response `credential` the authorization credential for this table.
5588    pub fn r#get_authorization_for_route_table(
5589        &self,
5590        ___deadline: zx::MonotonicInstant,
5591    ) -> Result<GrantForRouteTableAuthorization, fidl::Error> {
5592        let _response = self.client.send_query::<
5593            fidl::encoding::EmptyPayload,
5594            BaseRouteTableGetAuthorizationForRouteTableResponse,
5595        >(
5596            (),
5597            0x56a48c921ff3b6eb,
5598            fidl::encoding::DynamicFlags::empty(),
5599            ___deadline,
5600        )?;
5601        Ok(_response.credential)
5602    }
5603
5604    /// Creates an empty route set.
5605    ///
5606    /// + request `route_set` grants access to the [`RouteSetV6`] protocol.
5607    pub fn r#new_route_set(
5608        &self,
5609        mut route_set: fidl::endpoints::ServerEnd<RouteSetV6Marker>,
5610    ) -> Result<(), fidl::Error> {
5611        self.client.send::<RouteTableV6NewRouteSetRequest>(
5612            (route_set,),
5613            0x479aeaf9ad470141,
5614            fidl::encoding::DynamicFlags::empty(),
5615        )
5616    }
5617}
5618
5619#[derive(Debug, Clone)]
5620pub struct RouteTableV6Proxy {
5621    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
5622}
5623
5624impl fidl::endpoints::Proxy for RouteTableV6Proxy {
5625    type Protocol = RouteTableV6Marker;
5626
5627    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
5628        Self::new(inner)
5629    }
5630
5631    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
5632        self.client.into_channel().map_err(|client| Self { client })
5633    }
5634
5635    fn as_channel(&self) -> &::fidl::AsyncChannel {
5636        self.client.as_channel()
5637    }
5638}
5639
5640impl RouteTableV6Proxy {
5641    /// Create a new Proxy for fuchsia.net.routes.admin/RouteTableV6.
5642    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
5643        let protocol_name = <RouteTableV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
5644        Self { client: fidl::client::Client::new(channel, protocol_name) }
5645    }
5646
5647    /// Get a Stream of events from the remote end of the protocol.
5648    ///
5649    /// # Panics
5650    ///
5651    /// Panics if the event stream was already taken.
5652    pub fn take_event_stream(&self) -> RouteTableV6EventStream {
5653        RouteTableV6EventStream { event_receiver: self.client.take_event_receiver() }
5654    }
5655
5656    /// Gets the table ID for this table.
5657    pub fn r#get_table_id(
5658        &self,
5659    ) -> fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect> {
5660        RouteTableV6ProxyInterface::r#get_table_id(self)
5661    }
5662
5663    /// Detaches the lifetime of the route table from the lifetime of the
5664    /// client end of the channel.
5665    ///
5666    /// After this method is called, the route table will not be removed
5667    /// if the client end is closed. It's a no-op if called on the main table.
5668    pub fn r#detach(&self) -> Result<(), fidl::Error> {
5669        RouteTableV6ProxyInterface::r#detach(self)
5670    }
5671
5672    /// Removes the route table explicitly.
5673    ///
5674    /// This method cannot be called on the main table, an error will be
5675    /// returned if called. The server will close the channel after this
5676    /// method successfully returns.
5677    pub fn r#remove(
5678        &self,
5679    ) -> fidl::client::QueryResponseFut<
5680        BaseRouteTableRemoveResult,
5681        fidl::encoding::DefaultFuchsiaResourceDialect,
5682    > {
5683        RouteTableV6ProxyInterface::r#remove(self)
5684    }
5685
5686    /// Gets an authentication credential for this table.
5687    ///
5688    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
5689    /// held by the server. This credential can be passed into
5690    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
5691    /// table. The `EVENT` is stable throughout the lifetime of the route table.
5692    /// Clients may duplicate this `EVENT` to make multiple API calls, or
5693    /// transfer the `EVENT` to other clients.
5694    ///
5695    /// - response `credential` the authorization credential for this table.
5696    pub fn r#get_authorization_for_route_table(
5697        &self,
5698    ) -> fidl::client::QueryResponseFut<
5699        GrantForRouteTableAuthorization,
5700        fidl::encoding::DefaultFuchsiaResourceDialect,
5701    > {
5702        RouteTableV6ProxyInterface::r#get_authorization_for_route_table(self)
5703    }
5704
5705    /// Creates an empty route set.
5706    ///
5707    /// + request `route_set` grants access to the [`RouteSetV6`] protocol.
5708    pub fn r#new_route_set(
5709        &self,
5710        mut route_set: fidl::endpoints::ServerEnd<RouteSetV6Marker>,
5711    ) -> Result<(), fidl::Error> {
5712        RouteTableV6ProxyInterface::r#new_route_set(self, route_set)
5713    }
5714}
5715
5716impl RouteTableV6ProxyInterface for RouteTableV6Proxy {
5717    type GetTableIdResponseFut =
5718        fidl::client::QueryResponseFut<u32, fidl::encoding::DefaultFuchsiaResourceDialect>;
5719    fn r#get_table_id(&self) -> Self::GetTableIdResponseFut {
5720        fn _decode(
5721            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5722        ) -> Result<u32, fidl::Error> {
5723            let _response = fidl::client::decode_transaction_body::<
5724                BaseRouteTableGetTableIdResponse,
5725                fidl::encoding::DefaultFuchsiaResourceDialect,
5726                0x7eab30c55edbfc15,
5727            >(_buf?)?;
5728            Ok(_response.table_id)
5729        }
5730        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
5731            (),
5732            0x7eab30c55edbfc15,
5733            fidl::encoding::DynamicFlags::empty(),
5734            _decode,
5735        )
5736    }
5737
5738    fn r#detach(&self) -> Result<(), fidl::Error> {
5739        self.client.send::<fidl::encoding::EmptyPayload>(
5740            (),
5741            0x2853ab157285b384,
5742            fidl::encoding::DynamicFlags::empty(),
5743        )
5744    }
5745
5746    type RemoveResponseFut = fidl::client::QueryResponseFut<
5747        BaseRouteTableRemoveResult,
5748        fidl::encoding::DefaultFuchsiaResourceDialect,
5749    >;
5750    fn r#remove(&self) -> Self::RemoveResponseFut {
5751        fn _decode(
5752            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5753        ) -> Result<BaseRouteTableRemoveResult, fidl::Error> {
5754            let _response = fidl::client::decode_transaction_body::<
5755                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BaseRouteTableRemoveError>,
5756                fidl::encoding::DefaultFuchsiaResourceDialect,
5757                0xc42e58a5fc79426,
5758            >(_buf?)?;
5759            Ok(_response.map(|x| x))
5760        }
5761        self.client
5762            .send_query_and_decode::<fidl::encoding::EmptyPayload, BaseRouteTableRemoveResult>(
5763                (),
5764                0xc42e58a5fc79426,
5765                fidl::encoding::DynamicFlags::empty(),
5766                _decode,
5767            )
5768    }
5769
5770    type GetAuthorizationForRouteTableResponseFut = fidl::client::QueryResponseFut<
5771        GrantForRouteTableAuthorization,
5772        fidl::encoding::DefaultFuchsiaResourceDialect,
5773    >;
5774    fn r#get_authorization_for_route_table(
5775        &self,
5776    ) -> Self::GetAuthorizationForRouteTableResponseFut {
5777        fn _decode(
5778            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
5779        ) -> Result<GrantForRouteTableAuthorization, fidl::Error> {
5780            let _response = fidl::client::decode_transaction_body::<
5781                BaseRouteTableGetAuthorizationForRouteTableResponse,
5782                fidl::encoding::DefaultFuchsiaResourceDialect,
5783                0x56a48c921ff3b6eb,
5784            >(_buf?)?;
5785            Ok(_response.credential)
5786        }
5787        self.client
5788            .send_query_and_decode::<fidl::encoding::EmptyPayload, GrantForRouteTableAuthorization>(
5789                (),
5790                0x56a48c921ff3b6eb,
5791                fidl::encoding::DynamicFlags::empty(),
5792                _decode,
5793            )
5794    }
5795
5796    fn r#new_route_set(
5797        &self,
5798        mut route_set: fidl::endpoints::ServerEnd<RouteSetV6Marker>,
5799    ) -> Result<(), fidl::Error> {
5800        self.client.send::<RouteTableV6NewRouteSetRequest>(
5801            (route_set,),
5802            0x479aeaf9ad470141,
5803            fidl::encoding::DynamicFlags::empty(),
5804        )
5805    }
5806}
5807
5808pub struct RouteTableV6EventStream {
5809    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
5810}
5811
5812impl std::marker::Unpin for RouteTableV6EventStream {}
5813
5814impl futures::stream::FusedStream for RouteTableV6EventStream {
5815    fn is_terminated(&self) -> bool {
5816        self.event_receiver.is_terminated()
5817    }
5818}
5819
5820impl futures::Stream for RouteTableV6EventStream {
5821    type Item = Result<RouteTableV6Event, fidl::Error>;
5822
5823    fn poll_next(
5824        mut self: std::pin::Pin<&mut Self>,
5825        cx: &mut std::task::Context<'_>,
5826    ) -> std::task::Poll<Option<Self::Item>> {
5827        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
5828            &mut self.event_receiver,
5829            cx
5830        )?) {
5831            Some(buf) => std::task::Poll::Ready(Some(RouteTableV6Event::decode(buf))),
5832            None => std::task::Poll::Ready(None),
5833        }
5834    }
5835}
5836
5837#[derive(Debug)]
5838pub enum RouteTableV6Event {}
5839
5840impl RouteTableV6Event {
5841    /// Decodes a message buffer as a [`RouteTableV6Event`].
5842    fn decode(
5843        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
5844    ) -> Result<RouteTableV6Event, fidl::Error> {
5845        let (bytes, _handles) = buf.split_mut();
5846        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5847        debug_assert_eq!(tx_header.tx_id, 0);
5848        match tx_header.ordinal {
5849            _ => Err(fidl::Error::UnknownOrdinal {
5850                ordinal: tx_header.ordinal,
5851                protocol_name: <RouteTableV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
5852            }),
5853        }
5854    }
5855}
5856
5857/// A Stream of incoming requests for fuchsia.net.routes.admin/RouteTableV6.
5858pub struct RouteTableV6RequestStream {
5859    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5860    is_terminated: bool,
5861}
5862
5863impl std::marker::Unpin for RouteTableV6RequestStream {}
5864
5865impl futures::stream::FusedStream for RouteTableV6RequestStream {
5866    fn is_terminated(&self) -> bool {
5867        self.is_terminated
5868    }
5869}
5870
5871impl fidl::endpoints::RequestStream for RouteTableV6RequestStream {
5872    type Protocol = RouteTableV6Marker;
5873    type ControlHandle = RouteTableV6ControlHandle;
5874
5875    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
5876        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
5877    }
5878
5879    fn control_handle(&self) -> Self::ControlHandle {
5880        RouteTableV6ControlHandle { inner: self.inner.clone() }
5881    }
5882
5883    fn into_inner(
5884        self,
5885    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
5886    {
5887        (self.inner, self.is_terminated)
5888    }
5889
5890    fn from_inner(
5891        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
5892        is_terminated: bool,
5893    ) -> Self {
5894        Self { inner, is_terminated }
5895    }
5896}
5897
5898impl futures::Stream for RouteTableV6RequestStream {
5899    type Item = Result<RouteTableV6Request, fidl::Error>;
5900
5901    fn poll_next(
5902        mut self: std::pin::Pin<&mut Self>,
5903        cx: &mut std::task::Context<'_>,
5904    ) -> std::task::Poll<Option<Self::Item>> {
5905        let this = &mut *self;
5906        if this.inner.check_shutdown(cx) {
5907            this.is_terminated = true;
5908            return std::task::Poll::Ready(None);
5909        }
5910        if this.is_terminated {
5911            panic!("polled RouteTableV6RequestStream after completion");
5912        }
5913        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
5914            |bytes, handles| {
5915                match this.inner.channel().read_etc(cx, bytes, handles) {
5916                    std::task::Poll::Ready(Ok(())) => {}
5917                    std::task::Poll::Pending => return std::task::Poll::Pending,
5918                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
5919                        this.is_terminated = true;
5920                        return std::task::Poll::Ready(None);
5921                    }
5922                    std::task::Poll::Ready(Err(e)) => {
5923                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
5924                            e.into(),
5925                        ))))
5926                    }
5927                }
5928
5929                // A message has been received from the channel
5930                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
5931
5932                std::task::Poll::Ready(Some(match header.ordinal {
5933                    0x7eab30c55edbfc15 => {
5934                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5935                        let mut req = fidl::new_empty!(
5936                            fidl::encoding::EmptyPayload,
5937                            fidl::encoding::DefaultFuchsiaResourceDialect
5938                        );
5939                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5940                        let control_handle =
5941                            RouteTableV6ControlHandle { inner: this.inner.clone() };
5942                        Ok(RouteTableV6Request::GetTableId {
5943                            responder: RouteTableV6GetTableIdResponder {
5944                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5945                                tx_id: header.tx_id,
5946                            },
5947                        })
5948                    }
5949                    0x2853ab157285b384 => {
5950                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5951                        let mut req = fidl::new_empty!(
5952                            fidl::encoding::EmptyPayload,
5953                            fidl::encoding::DefaultFuchsiaResourceDialect
5954                        );
5955                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5956                        let control_handle =
5957                            RouteTableV6ControlHandle { inner: this.inner.clone() };
5958                        Ok(RouteTableV6Request::Detach { control_handle })
5959                    }
5960                    0xc42e58a5fc79426 => {
5961                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5962                        let mut req = fidl::new_empty!(
5963                            fidl::encoding::EmptyPayload,
5964                            fidl::encoding::DefaultFuchsiaResourceDialect
5965                        );
5966                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5967                        let control_handle =
5968                            RouteTableV6ControlHandle { inner: this.inner.clone() };
5969                        Ok(RouteTableV6Request::Remove {
5970                            responder: RouteTableV6RemoveResponder {
5971                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5972                                tx_id: header.tx_id,
5973                            },
5974                        })
5975                    }
5976                    0x56a48c921ff3b6eb => {
5977                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
5978                        let mut req = fidl::new_empty!(
5979                            fidl::encoding::EmptyPayload,
5980                            fidl::encoding::DefaultFuchsiaResourceDialect
5981                        );
5982                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
5983                        let control_handle =
5984                            RouteTableV6ControlHandle { inner: this.inner.clone() };
5985                        Ok(RouteTableV6Request::GetAuthorizationForRouteTable {
5986                            responder: RouteTableV6GetAuthorizationForRouteTableResponder {
5987                                control_handle: std::mem::ManuallyDrop::new(control_handle),
5988                                tx_id: header.tx_id,
5989                            },
5990                        })
5991                    }
5992                    0x479aeaf9ad470141 => {
5993                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
5994                        let mut req = fidl::new_empty!(
5995                            RouteTableV6NewRouteSetRequest,
5996                            fidl::encoding::DefaultFuchsiaResourceDialect
5997                        );
5998                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RouteTableV6NewRouteSetRequest>(&header, _body_bytes, handles, &mut req)?;
5999                        let control_handle =
6000                            RouteTableV6ControlHandle { inner: this.inner.clone() };
6001                        Ok(RouteTableV6Request::NewRouteSet {
6002                            route_set: req.route_set,
6003
6004                            control_handle,
6005                        })
6006                    }
6007                    _ => Err(fidl::Error::UnknownOrdinal {
6008                        ordinal: header.ordinal,
6009                        protocol_name:
6010                            <RouteTableV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6011                    }),
6012                }))
6013            },
6014        )
6015    }
6016}
6017
6018/// Vends isolated administrative access to the system's IPv6 routing table.
6019///
6020/// A main route table is accessible through the discoverable [`RouteTableV6`]
6021/// protocol. Other tables can be installed using the `NewRouteTable` method
6022/// on [`RouteTableProviderV6`]. The [`RouteTableV6`] also encodes the lifetime
6023/// of the underlying route table, dropping the client end of the protocol
6024/// causes the underlying route table to be removed unless it is detached. The
6025/// main table is detached by default.
6026#[derive(Debug)]
6027pub enum RouteTableV6Request {
6028    /// Gets the table ID for this table.
6029    GetTableId { responder: RouteTableV6GetTableIdResponder },
6030    /// Detaches the lifetime of the route table from the lifetime of the
6031    /// client end of the channel.
6032    ///
6033    /// After this method is called, the route table will not be removed
6034    /// if the client end is closed. It's a no-op if called on the main table.
6035    Detach { control_handle: RouteTableV6ControlHandle },
6036    /// Removes the route table explicitly.
6037    ///
6038    /// This method cannot be called on the main table, an error will be
6039    /// returned if called. The server will close the channel after this
6040    /// method successfully returns.
6041    Remove { responder: RouteTableV6RemoveResponder },
6042    /// Gets an authentication credential for this table.
6043    ///
6044    /// The credential contains a [`zx::handle::EVENT`], whose duplicate is
6045    /// held by the server. This credential can be passed into
6046    /// `fuchsia.net.routes.admin` API calls to prove ownership of this route
6047    /// table. The `EVENT` is stable throughout the lifetime of the route table.
6048    /// Clients may duplicate this `EVENT` to make multiple API calls, or
6049    /// transfer the `EVENT` to other clients.
6050    ///
6051    /// - response `credential` the authorization credential for this table.
6052    GetAuthorizationForRouteTable { responder: RouteTableV6GetAuthorizationForRouteTableResponder },
6053    /// Creates an empty route set.
6054    ///
6055    /// + request `route_set` grants access to the [`RouteSetV6`] protocol.
6056    NewRouteSet {
6057        route_set: fidl::endpoints::ServerEnd<RouteSetV6Marker>,
6058        control_handle: RouteTableV6ControlHandle,
6059    },
6060}
6061
6062impl RouteTableV6Request {
6063    #[allow(irrefutable_let_patterns)]
6064    pub fn into_get_table_id(self) -> Option<(RouteTableV6GetTableIdResponder)> {
6065        if let RouteTableV6Request::GetTableId { responder } = self {
6066            Some((responder))
6067        } else {
6068            None
6069        }
6070    }
6071
6072    #[allow(irrefutable_let_patterns)]
6073    pub fn into_detach(self) -> Option<(RouteTableV6ControlHandle)> {
6074        if let RouteTableV6Request::Detach { control_handle } = self {
6075            Some((control_handle))
6076        } else {
6077            None
6078        }
6079    }
6080
6081    #[allow(irrefutable_let_patterns)]
6082    pub fn into_remove(self) -> Option<(RouteTableV6RemoveResponder)> {
6083        if let RouteTableV6Request::Remove { responder } = self {
6084            Some((responder))
6085        } else {
6086            None
6087        }
6088    }
6089
6090    #[allow(irrefutable_let_patterns)]
6091    pub fn into_get_authorization_for_route_table(
6092        self,
6093    ) -> Option<(RouteTableV6GetAuthorizationForRouteTableResponder)> {
6094        if let RouteTableV6Request::GetAuthorizationForRouteTable { responder } = self {
6095            Some((responder))
6096        } else {
6097            None
6098        }
6099    }
6100
6101    #[allow(irrefutable_let_patterns)]
6102    pub fn into_new_route_set(
6103        self,
6104    ) -> Option<(fidl::endpoints::ServerEnd<RouteSetV6Marker>, RouteTableV6ControlHandle)> {
6105        if let RouteTableV6Request::NewRouteSet { route_set, control_handle } = self {
6106            Some((route_set, control_handle))
6107        } else {
6108            None
6109        }
6110    }
6111
6112    /// Name of the method defined in FIDL
6113    pub fn method_name(&self) -> &'static str {
6114        match *self {
6115            RouteTableV6Request::GetTableId { .. } => "get_table_id",
6116            RouteTableV6Request::Detach { .. } => "detach",
6117            RouteTableV6Request::Remove { .. } => "remove",
6118            RouteTableV6Request::GetAuthorizationForRouteTable { .. } => {
6119                "get_authorization_for_route_table"
6120            }
6121            RouteTableV6Request::NewRouteSet { .. } => "new_route_set",
6122        }
6123    }
6124}
6125
6126#[derive(Debug, Clone)]
6127pub struct RouteTableV6ControlHandle {
6128    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6129}
6130
6131impl fidl::endpoints::ControlHandle for RouteTableV6ControlHandle {
6132    fn shutdown(&self) {
6133        self.inner.shutdown()
6134    }
6135    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
6136        self.inner.shutdown_with_epitaph(status)
6137    }
6138
6139    fn is_closed(&self) -> bool {
6140        self.inner.channel().is_closed()
6141    }
6142    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
6143        self.inner.channel().on_closed()
6144    }
6145
6146    #[cfg(target_os = "fuchsia")]
6147    fn signal_peer(
6148        &self,
6149        clear_mask: zx::Signals,
6150        set_mask: zx::Signals,
6151    ) -> Result<(), zx_status::Status> {
6152        use fidl::Peered;
6153        self.inner.channel().signal_peer(clear_mask, set_mask)
6154    }
6155}
6156
6157impl RouteTableV6ControlHandle {}
6158
6159#[must_use = "FIDL methods require a response to be sent"]
6160#[derive(Debug)]
6161pub struct RouteTableV6GetTableIdResponder {
6162    control_handle: std::mem::ManuallyDrop<RouteTableV6ControlHandle>,
6163    tx_id: u32,
6164}
6165
6166/// Set the the channel to be shutdown (see [`RouteTableV6ControlHandle::shutdown`])
6167/// if the responder is dropped without sending a response, so that the client
6168/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6169impl std::ops::Drop for RouteTableV6GetTableIdResponder {
6170    fn drop(&mut self) {
6171        self.control_handle.shutdown();
6172        // Safety: drops once, never accessed again
6173        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6174    }
6175}
6176
6177impl fidl::endpoints::Responder for RouteTableV6GetTableIdResponder {
6178    type ControlHandle = RouteTableV6ControlHandle;
6179
6180    fn control_handle(&self) -> &RouteTableV6ControlHandle {
6181        &self.control_handle
6182    }
6183
6184    fn drop_without_shutdown(mut self) {
6185        // Safety: drops once, never accessed again due to mem::forget
6186        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6187        // Prevent Drop from running (which would shut down the channel)
6188        std::mem::forget(self);
6189    }
6190}
6191
6192impl RouteTableV6GetTableIdResponder {
6193    /// Sends a response to the FIDL transaction.
6194    ///
6195    /// Sets the channel to shutdown if an error occurs.
6196    pub fn send(self, mut table_id: u32) -> Result<(), fidl::Error> {
6197        let _result = self.send_raw(table_id);
6198        if _result.is_err() {
6199            self.control_handle.shutdown();
6200        }
6201        self.drop_without_shutdown();
6202        _result
6203    }
6204
6205    /// Similar to "send" but does not shutdown the channel if an error occurs.
6206    pub fn send_no_shutdown_on_err(self, mut table_id: u32) -> Result<(), fidl::Error> {
6207        let _result = self.send_raw(table_id);
6208        self.drop_without_shutdown();
6209        _result
6210    }
6211
6212    fn send_raw(&self, mut table_id: u32) -> Result<(), fidl::Error> {
6213        self.control_handle.inner.send::<BaseRouteTableGetTableIdResponse>(
6214            (table_id,),
6215            self.tx_id,
6216            0x7eab30c55edbfc15,
6217            fidl::encoding::DynamicFlags::empty(),
6218        )
6219    }
6220}
6221
6222#[must_use = "FIDL methods require a response to be sent"]
6223#[derive(Debug)]
6224pub struct RouteTableV6RemoveResponder {
6225    control_handle: std::mem::ManuallyDrop<RouteTableV6ControlHandle>,
6226    tx_id: u32,
6227}
6228
6229/// Set the the channel to be shutdown (see [`RouteTableV6ControlHandle::shutdown`])
6230/// if the responder is dropped without sending a response, so that the client
6231/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6232impl std::ops::Drop for RouteTableV6RemoveResponder {
6233    fn drop(&mut self) {
6234        self.control_handle.shutdown();
6235        // Safety: drops once, never accessed again
6236        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6237    }
6238}
6239
6240impl fidl::endpoints::Responder for RouteTableV6RemoveResponder {
6241    type ControlHandle = RouteTableV6ControlHandle;
6242
6243    fn control_handle(&self) -> &RouteTableV6ControlHandle {
6244        &self.control_handle
6245    }
6246
6247    fn drop_without_shutdown(mut self) {
6248        // Safety: drops once, never accessed again due to mem::forget
6249        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6250        // Prevent Drop from running (which would shut down the channel)
6251        std::mem::forget(self);
6252    }
6253}
6254
6255impl RouteTableV6RemoveResponder {
6256    /// Sends a response to the FIDL transaction.
6257    ///
6258    /// Sets the channel to shutdown if an error occurs.
6259    pub fn send(
6260        self,
6261        mut result: Result<(), BaseRouteTableRemoveError>,
6262    ) -> Result<(), fidl::Error> {
6263        let _result = self.send_raw(result);
6264        if _result.is_err() {
6265            self.control_handle.shutdown();
6266        }
6267        self.drop_without_shutdown();
6268        _result
6269    }
6270
6271    /// Similar to "send" but does not shutdown the channel if an error occurs.
6272    pub fn send_no_shutdown_on_err(
6273        self,
6274        mut result: Result<(), BaseRouteTableRemoveError>,
6275    ) -> Result<(), fidl::Error> {
6276        let _result = self.send_raw(result);
6277        self.drop_without_shutdown();
6278        _result
6279    }
6280
6281    fn send_raw(
6282        &self,
6283        mut result: Result<(), BaseRouteTableRemoveError>,
6284    ) -> Result<(), fidl::Error> {
6285        self.control_handle.inner.send::<fidl::encoding::ResultType<
6286            fidl::encoding::EmptyStruct,
6287            BaseRouteTableRemoveError,
6288        >>(
6289            result,
6290            self.tx_id,
6291            0xc42e58a5fc79426,
6292            fidl::encoding::DynamicFlags::empty(),
6293        )
6294    }
6295}
6296
6297#[must_use = "FIDL methods require a response to be sent"]
6298#[derive(Debug)]
6299pub struct RouteTableV6GetAuthorizationForRouteTableResponder {
6300    control_handle: std::mem::ManuallyDrop<RouteTableV6ControlHandle>,
6301    tx_id: u32,
6302}
6303
6304/// Set the the channel to be shutdown (see [`RouteTableV6ControlHandle::shutdown`])
6305/// if the responder is dropped without sending a response, so that the client
6306/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
6307impl std::ops::Drop for RouteTableV6GetAuthorizationForRouteTableResponder {
6308    fn drop(&mut self) {
6309        self.control_handle.shutdown();
6310        // Safety: drops once, never accessed again
6311        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6312    }
6313}
6314
6315impl fidl::endpoints::Responder for RouteTableV6GetAuthorizationForRouteTableResponder {
6316    type ControlHandle = RouteTableV6ControlHandle;
6317
6318    fn control_handle(&self) -> &RouteTableV6ControlHandle {
6319        &self.control_handle
6320    }
6321
6322    fn drop_without_shutdown(mut self) {
6323        // Safety: drops once, never accessed again due to mem::forget
6324        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
6325        // Prevent Drop from running (which would shut down the channel)
6326        std::mem::forget(self);
6327    }
6328}
6329
6330impl RouteTableV6GetAuthorizationForRouteTableResponder {
6331    /// Sends a response to the FIDL transaction.
6332    ///
6333    /// Sets the channel to shutdown if an error occurs.
6334    pub fn send(self, mut credential: GrantForRouteTableAuthorization) -> Result<(), fidl::Error> {
6335        let _result = self.send_raw(credential);
6336        if _result.is_err() {
6337            self.control_handle.shutdown();
6338        }
6339        self.drop_without_shutdown();
6340        _result
6341    }
6342
6343    /// Similar to "send" but does not shutdown the channel if an error occurs.
6344    pub fn send_no_shutdown_on_err(
6345        self,
6346        mut credential: GrantForRouteTableAuthorization,
6347    ) -> Result<(), fidl::Error> {
6348        let _result = self.send_raw(credential);
6349        self.drop_without_shutdown();
6350        _result
6351    }
6352
6353    fn send_raw(&self, mut credential: GrantForRouteTableAuthorization) -> Result<(), fidl::Error> {
6354        self.control_handle.inner.send::<BaseRouteTableGetAuthorizationForRouteTableResponse>(
6355            (&mut credential,),
6356            self.tx_id,
6357            0x56a48c921ff3b6eb,
6358            fidl::encoding::DynamicFlags::empty(),
6359        )
6360    }
6361}
6362
6363#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
6364pub struct RuleSetV4Marker;
6365
6366impl fidl::endpoints::ProtocolMarker for RuleSetV4Marker {
6367    type Proxy = RuleSetV4Proxy;
6368    type RequestStream = RuleSetV4RequestStream;
6369    #[cfg(target_os = "fuchsia")]
6370    type SynchronousProxy = RuleSetV4SynchronousProxy;
6371
6372    const DEBUG_NAME: &'static str = "(anonymous) RuleSetV4";
6373}
6374pub type RuleSetV4AddRuleResult = Result<(), RuleSetError>;
6375
6376pub trait RuleSetV4ProxyInterface: Send + Sync {
6377    type AuthenticateForRouteTableResponseFut: std::future::Future<
6378            Output = Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error>,
6379        > + Send;
6380    fn r#authenticate_for_route_table(
6381        &self,
6382        table: u32,
6383        token: fidl::Event,
6384    ) -> Self::AuthenticateForRouteTableResponseFut;
6385    type RemoveRuleResponseFut: std::future::Future<Output = Result<BaseRuleSetRemoveRuleResult, fidl::Error>>
6386        + Send;
6387    fn r#remove_rule(&self, index: u32) -> Self::RemoveRuleResponseFut;
6388    fn r#close(&self) -> Result<(), fidl::Error>;
6389    type AddRuleResponseFut: std::future::Future<Output = Result<RuleSetV4AddRuleResult, fidl::Error>>
6390        + Send;
6391    fn r#add_rule(
6392        &self,
6393        index: u32,
6394        matcher: &fidl_fuchsia_net_routes::RuleMatcherV4,
6395        action: &fidl_fuchsia_net_routes::RuleAction,
6396    ) -> Self::AddRuleResponseFut;
6397}
6398#[derive(Debug)]
6399#[cfg(target_os = "fuchsia")]
6400pub struct RuleSetV4SynchronousProxy {
6401    client: fidl::client::sync::Client,
6402}
6403
6404#[cfg(target_os = "fuchsia")]
6405impl fidl::endpoints::SynchronousProxy for RuleSetV4SynchronousProxy {
6406    type Proxy = RuleSetV4Proxy;
6407    type Protocol = RuleSetV4Marker;
6408
6409    fn from_channel(inner: fidl::Channel) -> Self {
6410        Self::new(inner)
6411    }
6412
6413    fn into_channel(self) -> fidl::Channel {
6414        self.client.into_channel()
6415    }
6416
6417    fn as_channel(&self) -> &fidl::Channel {
6418        self.client.as_channel()
6419    }
6420}
6421
6422#[cfg(target_os = "fuchsia")]
6423impl RuleSetV4SynchronousProxy {
6424    pub fn new(channel: fidl::Channel) -> Self {
6425        let protocol_name = <RuleSetV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6426        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
6427    }
6428
6429    pub fn into_channel(self) -> fidl::Channel {
6430        self.client.into_channel()
6431    }
6432
6433    /// Waits until an event arrives and returns it. It is safe for other
6434    /// threads to make concurrent requests while waiting for an event.
6435    pub fn wait_for_event(
6436        &self,
6437        deadline: zx::MonotonicInstant,
6438    ) -> Result<RuleSetV4Event, fidl::Error> {
6439        RuleSetV4Event::decode(self.client.wait_for_event(deadline)?)
6440    }
6441
6442    /// Authenticates for a route table that will be used in an action.
6443    pub fn r#authenticate_for_route_table(
6444        &self,
6445        mut table: u32,
6446        mut token: fidl::Event,
6447        ___deadline: zx::MonotonicInstant,
6448    ) -> Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error> {
6449        let _response =
6450            self.client.send_query::<ProofOfRouteTableAuthorization, fidl::encoding::ResultType<
6451                fidl::encoding::EmptyStruct,
6452                AuthenticateForRouteTableError,
6453            >>(
6454                (table, token),
6455                0x6fd845360ed9bc8f,
6456                fidl::encoding::DynamicFlags::empty(),
6457                ___deadline,
6458            )?;
6459        Ok(_response.map(|x| x))
6460    }
6461
6462    /// Removes a rule from this rule set.
6463    ///
6464    /// If the client tries to remove from an index that does not have a rule,
6465    /// the error `RULE_DOES_NOT_EXIST` will be returned.
6466    ///
6467    /// + request `index` the index of the rule.
6468    pub fn r#remove_rule(
6469        &self,
6470        mut index: u32,
6471        ___deadline: zx::MonotonicInstant,
6472    ) -> Result<BaseRuleSetRemoveRuleResult, fidl::Error> {
6473        let _response = self.client.send_query::<
6474            BaseRuleSetRemoveRuleRequest,
6475            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
6476        >(
6477            (index,),
6478            0x2ae3d7e817cbff90,
6479            fidl::encoding::DynamicFlags::empty(),
6480            ___deadline,
6481        )?;
6482        Ok(_response.map(|x| x))
6483    }
6484
6485    /// Removes all rules in the rule set and the underlying channel will be
6486    /// closed after the rules are removed.
6487    ///
6488    /// This method provides a way for synchronous closure.
6489    pub fn r#close(&self) -> Result<(), fidl::Error> {
6490        self.client.send::<fidl::encoding::EmptyPayload>(
6491            (),
6492            0x457e1753672d4073,
6493            fidl::encoding::DynamicFlags::empty(),
6494        )
6495    }
6496
6497    /// Adds a rule to this rule set.
6498    ///
6499    /// If there is already a rule at the provided `index`, `RULE_ALREADY_EXISTS`
6500    /// is returned.
6501    ///
6502    /// + request `index` where to insert the rule.
6503    /// + request `matcher` the matcher of the rule.
6504    /// + request `action` action of the rule.
6505    pub fn r#add_rule(
6506        &self,
6507        mut index: u32,
6508        mut matcher: &fidl_fuchsia_net_routes::RuleMatcherV4,
6509        mut action: &fidl_fuchsia_net_routes::RuleAction,
6510        ___deadline: zx::MonotonicInstant,
6511    ) -> Result<RuleSetV4AddRuleResult, fidl::Error> {
6512        let _response = self.client.send_query::<
6513            RuleSetV4AddRuleRequest,
6514            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
6515        >(
6516            (index, matcher, action,),
6517            0x7f68325de94e80,
6518            fidl::encoding::DynamicFlags::empty(),
6519            ___deadline,
6520        )?;
6521        Ok(_response.map(|x| x))
6522    }
6523}
6524
6525#[derive(Debug, Clone)]
6526pub struct RuleSetV4Proxy {
6527    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
6528}
6529
6530impl fidl::endpoints::Proxy for RuleSetV4Proxy {
6531    type Protocol = RuleSetV4Marker;
6532
6533    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
6534        Self::new(inner)
6535    }
6536
6537    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
6538        self.client.into_channel().map_err(|client| Self { client })
6539    }
6540
6541    fn as_channel(&self) -> &::fidl::AsyncChannel {
6542        self.client.as_channel()
6543    }
6544}
6545
6546impl RuleSetV4Proxy {
6547    /// Create a new Proxy for fuchsia.net.routes.admin/RuleSetV4.
6548    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
6549        let protocol_name = <RuleSetV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
6550        Self { client: fidl::client::Client::new(channel, protocol_name) }
6551    }
6552
6553    /// Get a Stream of events from the remote end of the protocol.
6554    ///
6555    /// # Panics
6556    ///
6557    /// Panics if the event stream was already taken.
6558    pub fn take_event_stream(&self) -> RuleSetV4EventStream {
6559        RuleSetV4EventStream { event_receiver: self.client.take_event_receiver() }
6560    }
6561
6562    /// Authenticates for a route table that will be used in an action.
6563    pub fn r#authenticate_for_route_table(
6564        &self,
6565        mut table: u32,
6566        mut token: fidl::Event,
6567    ) -> fidl::client::QueryResponseFut<
6568        BaseRuleSetAuthenticateForRouteTableResult,
6569        fidl::encoding::DefaultFuchsiaResourceDialect,
6570    > {
6571        RuleSetV4ProxyInterface::r#authenticate_for_route_table(self, table, token)
6572    }
6573
6574    /// Removes a rule from this rule set.
6575    ///
6576    /// If the client tries to remove from an index that does not have a rule,
6577    /// the error `RULE_DOES_NOT_EXIST` will be returned.
6578    ///
6579    /// + request `index` the index of the rule.
6580    pub fn r#remove_rule(
6581        &self,
6582        mut index: u32,
6583    ) -> fidl::client::QueryResponseFut<
6584        BaseRuleSetRemoveRuleResult,
6585        fidl::encoding::DefaultFuchsiaResourceDialect,
6586    > {
6587        RuleSetV4ProxyInterface::r#remove_rule(self, index)
6588    }
6589
6590    /// Removes all rules in the rule set and the underlying channel will be
6591    /// closed after the rules are removed.
6592    ///
6593    /// This method provides a way for synchronous closure.
6594    pub fn r#close(&self) -> Result<(), fidl::Error> {
6595        RuleSetV4ProxyInterface::r#close(self)
6596    }
6597
6598    /// Adds a rule to this rule set.
6599    ///
6600    /// If there is already a rule at the provided `index`, `RULE_ALREADY_EXISTS`
6601    /// is returned.
6602    ///
6603    /// + request `index` where to insert the rule.
6604    /// + request `matcher` the matcher of the rule.
6605    /// + request `action` action of the rule.
6606    pub fn r#add_rule(
6607        &self,
6608        mut index: u32,
6609        mut matcher: &fidl_fuchsia_net_routes::RuleMatcherV4,
6610        mut action: &fidl_fuchsia_net_routes::RuleAction,
6611    ) -> fidl::client::QueryResponseFut<
6612        RuleSetV4AddRuleResult,
6613        fidl::encoding::DefaultFuchsiaResourceDialect,
6614    > {
6615        RuleSetV4ProxyInterface::r#add_rule(self, index, matcher, action)
6616    }
6617}
6618
6619impl RuleSetV4ProxyInterface for RuleSetV4Proxy {
6620    type AuthenticateForRouteTableResponseFut = fidl::client::QueryResponseFut<
6621        BaseRuleSetAuthenticateForRouteTableResult,
6622        fidl::encoding::DefaultFuchsiaResourceDialect,
6623    >;
6624    fn r#authenticate_for_route_table(
6625        &self,
6626        mut table: u32,
6627        mut token: fidl::Event,
6628    ) -> Self::AuthenticateForRouteTableResponseFut {
6629        fn _decode(
6630            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6631        ) -> Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error> {
6632            let _response = fidl::client::decode_transaction_body::<
6633                fidl::encoding::ResultType<
6634                    fidl::encoding::EmptyStruct,
6635                    AuthenticateForRouteTableError,
6636                >,
6637                fidl::encoding::DefaultFuchsiaResourceDialect,
6638                0x6fd845360ed9bc8f,
6639            >(_buf?)?;
6640            Ok(_response.map(|x| x))
6641        }
6642        self.client.send_query_and_decode::<
6643            ProofOfRouteTableAuthorization,
6644            BaseRuleSetAuthenticateForRouteTableResult,
6645        >(
6646            (table, token,),
6647            0x6fd845360ed9bc8f,
6648            fidl::encoding::DynamicFlags::empty(),
6649            _decode,
6650        )
6651    }
6652
6653    type RemoveRuleResponseFut = fidl::client::QueryResponseFut<
6654        BaseRuleSetRemoveRuleResult,
6655        fidl::encoding::DefaultFuchsiaResourceDialect,
6656    >;
6657    fn r#remove_rule(&self, mut index: u32) -> Self::RemoveRuleResponseFut {
6658        fn _decode(
6659            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6660        ) -> Result<BaseRuleSetRemoveRuleResult, fidl::Error> {
6661            let _response = fidl::client::decode_transaction_body::<
6662                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
6663                fidl::encoding::DefaultFuchsiaResourceDialect,
6664                0x2ae3d7e817cbff90,
6665            >(_buf?)?;
6666            Ok(_response.map(|x| x))
6667        }
6668        self.client
6669            .send_query_and_decode::<BaseRuleSetRemoveRuleRequest, BaseRuleSetRemoveRuleResult>(
6670                (index,),
6671                0x2ae3d7e817cbff90,
6672                fidl::encoding::DynamicFlags::empty(),
6673                _decode,
6674            )
6675    }
6676
6677    fn r#close(&self) -> Result<(), fidl::Error> {
6678        self.client.send::<fidl::encoding::EmptyPayload>(
6679            (),
6680            0x457e1753672d4073,
6681            fidl::encoding::DynamicFlags::empty(),
6682        )
6683    }
6684
6685    type AddRuleResponseFut = fidl::client::QueryResponseFut<
6686        RuleSetV4AddRuleResult,
6687        fidl::encoding::DefaultFuchsiaResourceDialect,
6688    >;
6689    fn r#add_rule(
6690        &self,
6691        mut index: u32,
6692        mut matcher: &fidl_fuchsia_net_routes::RuleMatcherV4,
6693        mut action: &fidl_fuchsia_net_routes::RuleAction,
6694    ) -> Self::AddRuleResponseFut {
6695        fn _decode(
6696            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
6697        ) -> Result<RuleSetV4AddRuleResult, fidl::Error> {
6698            let _response = fidl::client::decode_transaction_body::<
6699                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
6700                fidl::encoding::DefaultFuchsiaResourceDialect,
6701                0x7f68325de94e80,
6702            >(_buf?)?;
6703            Ok(_response.map(|x| x))
6704        }
6705        self.client.send_query_and_decode::<RuleSetV4AddRuleRequest, RuleSetV4AddRuleResult>(
6706            (index, matcher, action),
6707            0x7f68325de94e80,
6708            fidl::encoding::DynamicFlags::empty(),
6709            _decode,
6710        )
6711    }
6712}
6713
6714pub struct RuleSetV4EventStream {
6715    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
6716}
6717
6718impl std::marker::Unpin for RuleSetV4EventStream {}
6719
6720impl futures::stream::FusedStream for RuleSetV4EventStream {
6721    fn is_terminated(&self) -> bool {
6722        self.event_receiver.is_terminated()
6723    }
6724}
6725
6726impl futures::Stream for RuleSetV4EventStream {
6727    type Item = Result<RuleSetV4Event, fidl::Error>;
6728
6729    fn poll_next(
6730        mut self: std::pin::Pin<&mut Self>,
6731        cx: &mut std::task::Context<'_>,
6732    ) -> std::task::Poll<Option<Self::Item>> {
6733        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
6734            &mut self.event_receiver,
6735            cx
6736        )?) {
6737            Some(buf) => std::task::Poll::Ready(Some(RuleSetV4Event::decode(buf))),
6738            None => std::task::Poll::Ready(None),
6739        }
6740    }
6741}
6742
6743#[derive(Debug)]
6744pub enum RuleSetV4Event {}
6745
6746impl RuleSetV4Event {
6747    /// Decodes a message buffer as a [`RuleSetV4Event`].
6748    fn decode(
6749        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
6750    ) -> Result<RuleSetV4Event, fidl::Error> {
6751        let (bytes, _handles) = buf.split_mut();
6752        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6753        debug_assert_eq!(tx_header.tx_id, 0);
6754        match tx_header.ordinal {
6755            _ => Err(fidl::Error::UnknownOrdinal {
6756                ordinal: tx_header.ordinal,
6757                protocol_name: <RuleSetV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6758            }),
6759        }
6760    }
6761}
6762
6763/// A Stream of incoming requests for fuchsia.net.routes.admin/RuleSetV4.
6764pub struct RuleSetV4RequestStream {
6765    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6766    is_terminated: bool,
6767}
6768
6769impl std::marker::Unpin for RuleSetV4RequestStream {}
6770
6771impl futures::stream::FusedStream for RuleSetV4RequestStream {
6772    fn is_terminated(&self) -> bool {
6773        self.is_terminated
6774    }
6775}
6776
6777impl fidl::endpoints::RequestStream for RuleSetV4RequestStream {
6778    type Protocol = RuleSetV4Marker;
6779    type ControlHandle = RuleSetV4ControlHandle;
6780
6781    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
6782        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
6783    }
6784
6785    fn control_handle(&self) -> Self::ControlHandle {
6786        RuleSetV4ControlHandle { inner: self.inner.clone() }
6787    }
6788
6789    fn into_inner(
6790        self,
6791    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
6792    {
6793        (self.inner, self.is_terminated)
6794    }
6795
6796    fn from_inner(
6797        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
6798        is_terminated: bool,
6799    ) -> Self {
6800        Self { inner, is_terminated }
6801    }
6802}
6803
6804impl futures::Stream for RuleSetV4RequestStream {
6805    type Item = Result<RuleSetV4Request, fidl::Error>;
6806
6807    fn poll_next(
6808        mut self: std::pin::Pin<&mut Self>,
6809        cx: &mut std::task::Context<'_>,
6810    ) -> std::task::Poll<Option<Self::Item>> {
6811        let this = &mut *self;
6812        if this.inner.check_shutdown(cx) {
6813            this.is_terminated = true;
6814            return std::task::Poll::Ready(None);
6815        }
6816        if this.is_terminated {
6817            panic!("polled RuleSetV4RequestStream after completion");
6818        }
6819        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
6820            |bytes, handles| {
6821                match this.inner.channel().read_etc(cx, bytes, handles) {
6822                    std::task::Poll::Ready(Ok(())) => {}
6823                    std::task::Poll::Pending => return std::task::Poll::Pending,
6824                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
6825                        this.is_terminated = true;
6826                        return std::task::Poll::Ready(None);
6827                    }
6828                    std::task::Poll::Ready(Err(e)) => {
6829                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
6830                            e.into(),
6831                        ))))
6832                    }
6833                }
6834
6835                // A message has been received from the channel
6836                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
6837
6838                std::task::Poll::Ready(Some(match header.ordinal {
6839                    0x6fd845360ed9bc8f => {
6840                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6841                        let mut req = fidl::new_empty!(
6842                            ProofOfRouteTableAuthorization,
6843                            fidl::encoding::DefaultFuchsiaResourceDialect
6844                        );
6845                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProofOfRouteTableAuthorization>(&header, _body_bytes, handles, &mut req)?;
6846                        let control_handle = RuleSetV4ControlHandle { inner: this.inner.clone() };
6847                        Ok(RuleSetV4Request::AuthenticateForRouteTable {
6848                            table: req.table,
6849                            token: req.token,
6850
6851                            responder: RuleSetV4AuthenticateForRouteTableResponder {
6852                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6853                                tx_id: header.tx_id,
6854                            },
6855                        })
6856                    }
6857                    0x2ae3d7e817cbff90 => {
6858                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6859                        let mut req = fidl::new_empty!(
6860                            BaseRuleSetRemoveRuleRequest,
6861                            fidl::encoding::DefaultFuchsiaResourceDialect
6862                        );
6863                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BaseRuleSetRemoveRuleRequest>(&header, _body_bytes, handles, &mut req)?;
6864                        let control_handle = RuleSetV4ControlHandle { inner: this.inner.clone() };
6865                        Ok(RuleSetV4Request::RemoveRule {
6866                            index: req.index,
6867
6868                            responder: RuleSetV4RemoveRuleResponder {
6869                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6870                                tx_id: header.tx_id,
6871                            },
6872                        })
6873                    }
6874                    0x457e1753672d4073 => {
6875                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
6876                        let mut req = fidl::new_empty!(
6877                            fidl::encoding::EmptyPayload,
6878                            fidl::encoding::DefaultFuchsiaResourceDialect
6879                        );
6880                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
6881                        let control_handle = RuleSetV4ControlHandle { inner: this.inner.clone() };
6882                        Ok(RuleSetV4Request::Close { control_handle })
6883                    }
6884                    0x7f68325de94e80 => {
6885                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
6886                        let mut req = fidl::new_empty!(
6887                            RuleSetV4AddRuleRequest,
6888                            fidl::encoding::DefaultFuchsiaResourceDialect
6889                        );
6890                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RuleSetV4AddRuleRequest>(&header, _body_bytes, handles, &mut req)?;
6891                        let control_handle = RuleSetV4ControlHandle { inner: this.inner.clone() };
6892                        Ok(RuleSetV4Request::AddRule {
6893                            index: req.index,
6894                            matcher: req.matcher,
6895                            action: req.action,
6896
6897                            responder: RuleSetV4AddRuleResponder {
6898                                control_handle: std::mem::ManuallyDrop::new(control_handle),
6899                                tx_id: header.tx_id,
6900                            },
6901                        })
6902                    }
6903                    _ => Err(fidl::Error::UnknownOrdinal {
6904                        ordinal: header.ordinal,
6905                        protocol_name:
6906                            <RuleSetV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
6907                    }),
6908                }))
6909            },
6910        )
6911    }
6912}
6913
6914/// Provides mutable access over a set of the system's IPv4 route rules.
6915///
6916/// A `RuleSet` has a priority and a rule has an index. A global order among the
6917/// rules is determined first by the priority of the `RuleSet` the rule belongs
6918/// to, and then the index of the rule inside the `RuleSet`.
6919///
6920/// This protocol encodes the lifetime of the rule set. Closing the client end
6921/// removes the rule set, and all the rules that are owned by the rule set.
6922#[derive(Debug)]
6923pub enum RuleSetV4Request {
6924    /// Authenticates for a route table that will be used in an action.
6925    AuthenticateForRouteTable {
6926        table: u32,
6927        token: fidl::Event,
6928        responder: RuleSetV4AuthenticateForRouteTableResponder,
6929    },
6930    /// Removes a rule from this rule set.
6931    ///
6932    /// If the client tries to remove from an index that does not have a rule,
6933    /// the error `RULE_DOES_NOT_EXIST` will be returned.
6934    ///
6935    /// + request `index` the index of the rule.
6936    RemoveRule { index: u32, responder: RuleSetV4RemoveRuleResponder },
6937    /// Removes all rules in the rule set and the underlying channel will be
6938    /// closed after the rules are removed.
6939    ///
6940    /// This method provides a way for synchronous closure.
6941    Close { control_handle: RuleSetV4ControlHandle },
6942    /// Adds a rule to this rule set.
6943    ///
6944    /// If there is already a rule at the provided `index`, `RULE_ALREADY_EXISTS`
6945    /// is returned.
6946    ///
6947    /// + request `index` where to insert the rule.
6948    /// + request `matcher` the matcher of the rule.
6949    /// + request `action` action of the rule.
6950    AddRule {
6951        index: u32,
6952        matcher: fidl_fuchsia_net_routes::RuleMatcherV4,
6953        action: fidl_fuchsia_net_routes::RuleAction,
6954        responder: RuleSetV4AddRuleResponder,
6955    },
6956}
6957
6958impl RuleSetV4Request {
6959    #[allow(irrefutable_let_patterns)]
6960    pub fn into_authenticate_for_route_table(
6961        self,
6962    ) -> Option<(u32, fidl::Event, RuleSetV4AuthenticateForRouteTableResponder)> {
6963        if let RuleSetV4Request::AuthenticateForRouteTable { table, token, responder } = self {
6964            Some((table, token, responder))
6965        } else {
6966            None
6967        }
6968    }
6969
6970    #[allow(irrefutable_let_patterns)]
6971    pub fn into_remove_rule(self) -> Option<(u32, RuleSetV4RemoveRuleResponder)> {
6972        if let RuleSetV4Request::RemoveRule { index, responder } = self {
6973            Some((index, responder))
6974        } else {
6975            None
6976        }
6977    }
6978
6979    #[allow(irrefutable_let_patterns)]
6980    pub fn into_close(self) -> Option<(RuleSetV4ControlHandle)> {
6981        if let RuleSetV4Request::Close { control_handle } = self {
6982            Some((control_handle))
6983        } else {
6984            None
6985        }
6986    }
6987
6988    #[allow(irrefutable_let_patterns)]
6989    pub fn into_add_rule(
6990        self,
6991    ) -> Option<(
6992        u32,
6993        fidl_fuchsia_net_routes::RuleMatcherV4,
6994        fidl_fuchsia_net_routes::RuleAction,
6995        RuleSetV4AddRuleResponder,
6996    )> {
6997        if let RuleSetV4Request::AddRule { index, matcher, action, responder } = self {
6998            Some((index, matcher, action, responder))
6999        } else {
7000            None
7001        }
7002    }
7003
7004    /// Name of the method defined in FIDL
7005    pub fn method_name(&self) -> &'static str {
7006        match *self {
7007            RuleSetV4Request::AuthenticateForRouteTable { .. } => "authenticate_for_route_table",
7008            RuleSetV4Request::RemoveRule { .. } => "remove_rule",
7009            RuleSetV4Request::Close { .. } => "close",
7010            RuleSetV4Request::AddRule { .. } => "add_rule",
7011        }
7012    }
7013}
7014
7015#[derive(Debug, Clone)]
7016pub struct RuleSetV4ControlHandle {
7017    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7018}
7019
7020impl fidl::endpoints::ControlHandle for RuleSetV4ControlHandle {
7021    fn shutdown(&self) {
7022        self.inner.shutdown()
7023    }
7024    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7025        self.inner.shutdown_with_epitaph(status)
7026    }
7027
7028    fn is_closed(&self) -> bool {
7029        self.inner.channel().is_closed()
7030    }
7031    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7032        self.inner.channel().on_closed()
7033    }
7034
7035    #[cfg(target_os = "fuchsia")]
7036    fn signal_peer(
7037        &self,
7038        clear_mask: zx::Signals,
7039        set_mask: zx::Signals,
7040    ) -> Result<(), zx_status::Status> {
7041        use fidl::Peered;
7042        self.inner.channel().signal_peer(clear_mask, set_mask)
7043    }
7044}
7045
7046impl RuleSetV4ControlHandle {}
7047
7048#[must_use = "FIDL methods require a response to be sent"]
7049#[derive(Debug)]
7050pub struct RuleSetV4AuthenticateForRouteTableResponder {
7051    control_handle: std::mem::ManuallyDrop<RuleSetV4ControlHandle>,
7052    tx_id: u32,
7053}
7054
7055/// Set the the channel to be shutdown (see [`RuleSetV4ControlHandle::shutdown`])
7056/// if the responder is dropped without sending a response, so that the client
7057/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7058impl std::ops::Drop for RuleSetV4AuthenticateForRouteTableResponder {
7059    fn drop(&mut self) {
7060        self.control_handle.shutdown();
7061        // Safety: drops once, never accessed again
7062        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7063    }
7064}
7065
7066impl fidl::endpoints::Responder for RuleSetV4AuthenticateForRouteTableResponder {
7067    type ControlHandle = RuleSetV4ControlHandle;
7068
7069    fn control_handle(&self) -> &RuleSetV4ControlHandle {
7070        &self.control_handle
7071    }
7072
7073    fn drop_without_shutdown(mut self) {
7074        // Safety: drops once, never accessed again due to mem::forget
7075        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7076        // Prevent Drop from running (which would shut down the channel)
7077        std::mem::forget(self);
7078    }
7079}
7080
7081impl RuleSetV4AuthenticateForRouteTableResponder {
7082    /// Sends a response to the FIDL transaction.
7083    ///
7084    /// Sets the channel to shutdown if an error occurs.
7085    pub fn send(
7086        self,
7087        mut result: Result<(), AuthenticateForRouteTableError>,
7088    ) -> Result<(), fidl::Error> {
7089        let _result = self.send_raw(result);
7090        if _result.is_err() {
7091            self.control_handle.shutdown();
7092        }
7093        self.drop_without_shutdown();
7094        _result
7095    }
7096
7097    /// Similar to "send" but does not shutdown the channel if an error occurs.
7098    pub fn send_no_shutdown_on_err(
7099        self,
7100        mut result: Result<(), AuthenticateForRouteTableError>,
7101    ) -> Result<(), fidl::Error> {
7102        let _result = self.send_raw(result);
7103        self.drop_without_shutdown();
7104        _result
7105    }
7106
7107    fn send_raw(
7108        &self,
7109        mut result: Result<(), AuthenticateForRouteTableError>,
7110    ) -> Result<(), fidl::Error> {
7111        self.control_handle.inner.send::<fidl::encoding::ResultType<
7112            fidl::encoding::EmptyStruct,
7113            AuthenticateForRouteTableError,
7114        >>(
7115            result,
7116            self.tx_id,
7117            0x6fd845360ed9bc8f,
7118            fidl::encoding::DynamicFlags::empty(),
7119        )
7120    }
7121}
7122
7123#[must_use = "FIDL methods require a response to be sent"]
7124#[derive(Debug)]
7125pub struct RuleSetV4RemoveRuleResponder {
7126    control_handle: std::mem::ManuallyDrop<RuleSetV4ControlHandle>,
7127    tx_id: u32,
7128}
7129
7130/// Set the the channel to be shutdown (see [`RuleSetV4ControlHandle::shutdown`])
7131/// if the responder is dropped without sending a response, so that the client
7132/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7133impl std::ops::Drop for RuleSetV4RemoveRuleResponder {
7134    fn drop(&mut self) {
7135        self.control_handle.shutdown();
7136        // Safety: drops once, never accessed again
7137        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7138    }
7139}
7140
7141impl fidl::endpoints::Responder for RuleSetV4RemoveRuleResponder {
7142    type ControlHandle = RuleSetV4ControlHandle;
7143
7144    fn control_handle(&self) -> &RuleSetV4ControlHandle {
7145        &self.control_handle
7146    }
7147
7148    fn drop_without_shutdown(mut self) {
7149        // Safety: drops once, never accessed again due to mem::forget
7150        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7151        // Prevent Drop from running (which would shut down the channel)
7152        std::mem::forget(self);
7153    }
7154}
7155
7156impl RuleSetV4RemoveRuleResponder {
7157    /// Sends a response to the FIDL transaction.
7158    ///
7159    /// Sets the channel to shutdown if an error occurs.
7160    pub fn send(self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
7161        let _result = self.send_raw(result);
7162        if _result.is_err() {
7163            self.control_handle.shutdown();
7164        }
7165        self.drop_without_shutdown();
7166        _result
7167    }
7168
7169    /// Similar to "send" but does not shutdown the channel if an error occurs.
7170    pub fn send_no_shutdown_on_err(
7171        self,
7172        mut result: Result<(), RuleSetError>,
7173    ) -> Result<(), fidl::Error> {
7174        let _result = self.send_raw(result);
7175        self.drop_without_shutdown();
7176        _result
7177    }
7178
7179    fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
7180        self.control_handle.inner.send::<fidl::encoding::ResultType<
7181            fidl::encoding::EmptyStruct,
7182            RuleSetError,
7183        >>(
7184            result,
7185            self.tx_id,
7186            0x2ae3d7e817cbff90,
7187            fidl::encoding::DynamicFlags::empty(),
7188        )
7189    }
7190}
7191
7192#[must_use = "FIDL methods require a response to be sent"]
7193#[derive(Debug)]
7194pub struct RuleSetV4AddRuleResponder {
7195    control_handle: std::mem::ManuallyDrop<RuleSetV4ControlHandle>,
7196    tx_id: u32,
7197}
7198
7199/// Set the the channel to be shutdown (see [`RuleSetV4ControlHandle::shutdown`])
7200/// if the responder is dropped without sending a response, so that the client
7201/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7202impl std::ops::Drop for RuleSetV4AddRuleResponder {
7203    fn drop(&mut self) {
7204        self.control_handle.shutdown();
7205        // Safety: drops once, never accessed again
7206        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7207    }
7208}
7209
7210impl fidl::endpoints::Responder for RuleSetV4AddRuleResponder {
7211    type ControlHandle = RuleSetV4ControlHandle;
7212
7213    fn control_handle(&self) -> &RuleSetV4ControlHandle {
7214        &self.control_handle
7215    }
7216
7217    fn drop_without_shutdown(mut self) {
7218        // Safety: drops once, never accessed again due to mem::forget
7219        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7220        // Prevent Drop from running (which would shut down the channel)
7221        std::mem::forget(self);
7222    }
7223}
7224
7225impl RuleSetV4AddRuleResponder {
7226    /// Sends a response to the FIDL transaction.
7227    ///
7228    /// Sets the channel to shutdown if an error occurs.
7229    pub fn send(self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
7230        let _result = self.send_raw(result);
7231        if _result.is_err() {
7232            self.control_handle.shutdown();
7233        }
7234        self.drop_without_shutdown();
7235        _result
7236    }
7237
7238    /// Similar to "send" but does not shutdown the channel if an error occurs.
7239    pub fn send_no_shutdown_on_err(
7240        self,
7241        mut result: Result<(), RuleSetError>,
7242    ) -> Result<(), fidl::Error> {
7243        let _result = self.send_raw(result);
7244        self.drop_without_shutdown();
7245        _result
7246    }
7247
7248    fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
7249        self.control_handle.inner.send::<fidl::encoding::ResultType<
7250            fidl::encoding::EmptyStruct,
7251            RuleSetError,
7252        >>(
7253            result,
7254            self.tx_id,
7255            0x7f68325de94e80,
7256            fidl::encoding::DynamicFlags::empty(),
7257        )
7258    }
7259}
7260
7261#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
7262pub struct RuleSetV6Marker;
7263
7264impl fidl::endpoints::ProtocolMarker for RuleSetV6Marker {
7265    type Proxy = RuleSetV6Proxy;
7266    type RequestStream = RuleSetV6RequestStream;
7267    #[cfg(target_os = "fuchsia")]
7268    type SynchronousProxy = RuleSetV6SynchronousProxy;
7269
7270    const DEBUG_NAME: &'static str = "(anonymous) RuleSetV6";
7271}
7272pub type RuleSetV6AddRuleResult = Result<(), RuleSetError>;
7273
7274pub trait RuleSetV6ProxyInterface: Send + Sync {
7275    type AuthenticateForRouteTableResponseFut: std::future::Future<
7276            Output = Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error>,
7277        > + Send;
7278    fn r#authenticate_for_route_table(
7279        &self,
7280        table: u32,
7281        token: fidl::Event,
7282    ) -> Self::AuthenticateForRouteTableResponseFut;
7283    type RemoveRuleResponseFut: std::future::Future<Output = Result<BaseRuleSetRemoveRuleResult, fidl::Error>>
7284        + Send;
7285    fn r#remove_rule(&self, index: u32) -> Self::RemoveRuleResponseFut;
7286    fn r#close(&self) -> Result<(), fidl::Error>;
7287    type AddRuleResponseFut: std::future::Future<Output = Result<RuleSetV6AddRuleResult, fidl::Error>>
7288        + Send;
7289    fn r#add_rule(
7290        &self,
7291        index: u32,
7292        matcher: &fidl_fuchsia_net_routes::RuleMatcherV6,
7293        action: &fidl_fuchsia_net_routes::RuleAction,
7294    ) -> Self::AddRuleResponseFut;
7295}
7296#[derive(Debug)]
7297#[cfg(target_os = "fuchsia")]
7298pub struct RuleSetV6SynchronousProxy {
7299    client: fidl::client::sync::Client,
7300}
7301
7302#[cfg(target_os = "fuchsia")]
7303impl fidl::endpoints::SynchronousProxy for RuleSetV6SynchronousProxy {
7304    type Proxy = RuleSetV6Proxy;
7305    type Protocol = RuleSetV6Marker;
7306
7307    fn from_channel(inner: fidl::Channel) -> Self {
7308        Self::new(inner)
7309    }
7310
7311    fn into_channel(self) -> fidl::Channel {
7312        self.client.into_channel()
7313    }
7314
7315    fn as_channel(&self) -> &fidl::Channel {
7316        self.client.as_channel()
7317    }
7318}
7319
7320#[cfg(target_os = "fuchsia")]
7321impl RuleSetV6SynchronousProxy {
7322    pub fn new(channel: fidl::Channel) -> Self {
7323        let protocol_name = <RuleSetV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7324        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
7325    }
7326
7327    pub fn into_channel(self) -> fidl::Channel {
7328        self.client.into_channel()
7329    }
7330
7331    /// Waits until an event arrives and returns it. It is safe for other
7332    /// threads to make concurrent requests while waiting for an event.
7333    pub fn wait_for_event(
7334        &self,
7335        deadline: zx::MonotonicInstant,
7336    ) -> Result<RuleSetV6Event, fidl::Error> {
7337        RuleSetV6Event::decode(self.client.wait_for_event(deadline)?)
7338    }
7339
7340    /// Authenticates for a route table that will be used in an action.
7341    pub fn r#authenticate_for_route_table(
7342        &self,
7343        mut table: u32,
7344        mut token: fidl::Event,
7345        ___deadline: zx::MonotonicInstant,
7346    ) -> Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error> {
7347        let _response =
7348            self.client.send_query::<ProofOfRouteTableAuthorization, fidl::encoding::ResultType<
7349                fidl::encoding::EmptyStruct,
7350                AuthenticateForRouteTableError,
7351            >>(
7352                (table, token),
7353                0x6fd845360ed9bc8f,
7354                fidl::encoding::DynamicFlags::empty(),
7355                ___deadline,
7356            )?;
7357        Ok(_response.map(|x| x))
7358    }
7359
7360    /// Removes a rule from this rule set.
7361    ///
7362    /// If the client tries to remove from an index that does not have a rule,
7363    /// the error `RULE_DOES_NOT_EXIST` will be returned.
7364    ///
7365    /// + request `index` the index of the rule.
7366    pub fn r#remove_rule(
7367        &self,
7368        mut index: u32,
7369        ___deadline: zx::MonotonicInstant,
7370    ) -> Result<BaseRuleSetRemoveRuleResult, fidl::Error> {
7371        let _response = self.client.send_query::<
7372            BaseRuleSetRemoveRuleRequest,
7373            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
7374        >(
7375            (index,),
7376            0x2ae3d7e817cbff90,
7377            fidl::encoding::DynamicFlags::empty(),
7378            ___deadline,
7379        )?;
7380        Ok(_response.map(|x| x))
7381    }
7382
7383    /// Removes all rules in the rule set and the underlying channel will be
7384    /// closed after the rules are removed.
7385    ///
7386    /// This method provides a way for synchronous closure.
7387    pub fn r#close(&self) -> Result<(), fidl::Error> {
7388        self.client.send::<fidl::encoding::EmptyPayload>(
7389            (),
7390            0x457e1753672d4073,
7391            fidl::encoding::DynamicFlags::empty(),
7392        )
7393    }
7394
7395    /// Adds a rule to this rule set.
7396    ///
7397    /// If there is already a rule at the provided `index`, `RULE_ALREADY_EXISTS`
7398    /// is returned.
7399    ///
7400    /// + request `index` where to insert the rule.
7401    /// + request `matcher` the matcher of the rule.
7402    /// + request `action` action of the rule.
7403    pub fn r#add_rule(
7404        &self,
7405        mut index: u32,
7406        mut matcher: &fidl_fuchsia_net_routes::RuleMatcherV6,
7407        mut action: &fidl_fuchsia_net_routes::RuleAction,
7408        ___deadline: zx::MonotonicInstant,
7409    ) -> Result<RuleSetV6AddRuleResult, fidl::Error> {
7410        let _response = self.client.send_query::<
7411            RuleSetV6AddRuleRequest,
7412            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
7413        >(
7414            (index, matcher, action,),
7415            0x946cad8f8a726b3,
7416            fidl::encoding::DynamicFlags::empty(),
7417            ___deadline,
7418        )?;
7419        Ok(_response.map(|x| x))
7420    }
7421}
7422
7423#[derive(Debug, Clone)]
7424pub struct RuleSetV6Proxy {
7425    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
7426}
7427
7428impl fidl::endpoints::Proxy for RuleSetV6Proxy {
7429    type Protocol = RuleSetV6Marker;
7430
7431    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
7432        Self::new(inner)
7433    }
7434
7435    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
7436        self.client.into_channel().map_err(|client| Self { client })
7437    }
7438
7439    fn as_channel(&self) -> &::fidl::AsyncChannel {
7440        self.client.as_channel()
7441    }
7442}
7443
7444impl RuleSetV6Proxy {
7445    /// Create a new Proxy for fuchsia.net.routes.admin/RuleSetV6.
7446    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
7447        let protocol_name = <RuleSetV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
7448        Self { client: fidl::client::Client::new(channel, protocol_name) }
7449    }
7450
7451    /// Get a Stream of events from the remote end of the protocol.
7452    ///
7453    /// # Panics
7454    ///
7455    /// Panics if the event stream was already taken.
7456    pub fn take_event_stream(&self) -> RuleSetV6EventStream {
7457        RuleSetV6EventStream { event_receiver: self.client.take_event_receiver() }
7458    }
7459
7460    /// Authenticates for a route table that will be used in an action.
7461    pub fn r#authenticate_for_route_table(
7462        &self,
7463        mut table: u32,
7464        mut token: fidl::Event,
7465    ) -> fidl::client::QueryResponseFut<
7466        BaseRuleSetAuthenticateForRouteTableResult,
7467        fidl::encoding::DefaultFuchsiaResourceDialect,
7468    > {
7469        RuleSetV6ProxyInterface::r#authenticate_for_route_table(self, table, token)
7470    }
7471
7472    /// Removes a rule from this rule set.
7473    ///
7474    /// If the client tries to remove from an index that does not have a rule,
7475    /// the error `RULE_DOES_NOT_EXIST` will be returned.
7476    ///
7477    /// + request `index` the index of the rule.
7478    pub fn r#remove_rule(
7479        &self,
7480        mut index: u32,
7481    ) -> fidl::client::QueryResponseFut<
7482        BaseRuleSetRemoveRuleResult,
7483        fidl::encoding::DefaultFuchsiaResourceDialect,
7484    > {
7485        RuleSetV6ProxyInterface::r#remove_rule(self, index)
7486    }
7487
7488    /// Removes all rules in the rule set and the underlying channel will be
7489    /// closed after the rules are removed.
7490    ///
7491    /// This method provides a way for synchronous closure.
7492    pub fn r#close(&self) -> Result<(), fidl::Error> {
7493        RuleSetV6ProxyInterface::r#close(self)
7494    }
7495
7496    /// Adds a rule to this rule set.
7497    ///
7498    /// If there is already a rule at the provided `index`, `RULE_ALREADY_EXISTS`
7499    /// is returned.
7500    ///
7501    /// + request `index` where to insert the rule.
7502    /// + request `matcher` the matcher of the rule.
7503    /// + request `action` action of the rule.
7504    pub fn r#add_rule(
7505        &self,
7506        mut index: u32,
7507        mut matcher: &fidl_fuchsia_net_routes::RuleMatcherV6,
7508        mut action: &fidl_fuchsia_net_routes::RuleAction,
7509    ) -> fidl::client::QueryResponseFut<
7510        RuleSetV6AddRuleResult,
7511        fidl::encoding::DefaultFuchsiaResourceDialect,
7512    > {
7513        RuleSetV6ProxyInterface::r#add_rule(self, index, matcher, action)
7514    }
7515}
7516
7517impl RuleSetV6ProxyInterface for RuleSetV6Proxy {
7518    type AuthenticateForRouteTableResponseFut = fidl::client::QueryResponseFut<
7519        BaseRuleSetAuthenticateForRouteTableResult,
7520        fidl::encoding::DefaultFuchsiaResourceDialect,
7521    >;
7522    fn r#authenticate_for_route_table(
7523        &self,
7524        mut table: u32,
7525        mut token: fidl::Event,
7526    ) -> Self::AuthenticateForRouteTableResponseFut {
7527        fn _decode(
7528            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7529        ) -> Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error> {
7530            let _response = fidl::client::decode_transaction_body::<
7531                fidl::encoding::ResultType<
7532                    fidl::encoding::EmptyStruct,
7533                    AuthenticateForRouteTableError,
7534                >,
7535                fidl::encoding::DefaultFuchsiaResourceDialect,
7536                0x6fd845360ed9bc8f,
7537            >(_buf?)?;
7538            Ok(_response.map(|x| x))
7539        }
7540        self.client.send_query_and_decode::<
7541            ProofOfRouteTableAuthorization,
7542            BaseRuleSetAuthenticateForRouteTableResult,
7543        >(
7544            (table, token,),
7545            0x6fd845360ed9bc8f,
7546            fidl::encoding::DynamicFlags::empty(),
7547            _decode,
7548        )
7549    }
7550
7551    type RemoveRuleResponseFut = fidl::client::QueryResponseFut<
7552        BaseRuleSetRemoveRuleResult,
7553        fidl::encoding::DefaultFuchsiaResourceDialect,
7554    >;
7555    fn r#remove_rule(&self, mut index: u32) -> Self::RemoveRuleResponseFut {
7556        fn _decode(
7557            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7558        ) -> Result<BaseRuleSetRemoveRuleResult, fidl::Error> {
7559            let _response = fidl::client::decode_transaction_body::<
7560                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
7561                fidl::encoding::DefaultFuchsiaResourceDialect,
7562                0x2ae3d7e817cbff90,
7563            >(_buf?)?;
7564            Ok(_response.map(|x| x))
7565        }
7566        self.client
7567            .send_query_and_decode::<BaseRuleSetRemoveRuleRequest, BaseRuleSetRemoveRuleResult>(
7568                (index,),
7569                0x2ae3d7e817cbff90,
7570                fidl::encoding::DynamicFlags::empty(),
7571                _decode,
7572            )
7573    }
7574
7575    fn r#close(&self) -> Result<(), fidl::Error> {
7576        self.client.send::<fidl::encoding::EmptyPayload>(
7577            (),
7578            0x457e1753672d4073,
7579            fidl::encoding::DynamicFlags::empty(),
7580        )
7581    }
7582
7583    type AddRuleResponseFut = fidl::client::QueryResponseFut<
7584        RuleSetV6AddRuleResult,
7585        fidl::encoding::DefaultFuchsiaResourceDialect,
7586    >;
7587    fn r#add_rule(
7588        &self,
7589        mut index: u32,
7590        mut matcher: &fidl_fuchsia_net_routes::RuleMatcherV6,
7591        mut action: &fidl_fuchsia_net_routes::RuleAction,
7592    ) -> Self::AddRuleResponseFut {
7593        fn _decode(
7594            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
7595        ) -> Result<RuleSetV6AddRuleResult, fidl::Error> {
7596            let _response = fidl::client::decode_transaction_body::<
7597                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
7598                fidl::encoding::DefaultFuchsiaResourceDialect,
7599                0x946cad8f8a726b3,
7600            >(_buf?)?;
7601            Ok(_response.map(|x| x))
7602        }
7603        self.client.send_query_and_decode::<RuleSetV6AddRuleRequest, RuleSetV6AddRuleResult>(
7604            (index, matcher, action),
7605            0x946cad8f8a726b3,
7606            fidl::encoding::DynamicFlags::empty(),
7607            _decode,
7608        )
7609    }
7610}
7611
7612pub struct RuleSetV6EventStream {
7613    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
7614}
7615
7616impl std::marker::Unpin for RuleSetV6EventStream {}
7617
7618impl futures::stream::FusedStream for RuleSetV6EventStream {
7619    fn is_terminated(&self) -> bool {
7620        self.event_receiver.is_terminated()
7621    }
7622}
7623
7624impl futures::Stream for RuleSetV6EventStream {
7625    type Item = Result<RuleSetV6Event, fidl::Error>;
7626
7627    fn poll_next(
7628        mut self: std::pin::Pin<&mut Self>,
7629        cx: &mut std::task::Context<'_>,
7630    ) -> std::task::Poll<Option<Self::Item>> {
7631        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
7632            &mut self.event_receiver,
7633            cx
7634        )?) {
7635            Some(buf) => std::task::Poll::Ready(Some(RuleSetV6Event::decode(buf))),
7636            None => std::task::Poll::Ready(None),
7637        }
7638    }
7639}
7640
7641#[derive(Debug)]
7642pub enum RuleSetV6Event {}
7643
7644impl RuleSetV6Event {
7645    /// Decodes a message buffer as a [`RuleSetV6Event`].
7646    fn decode(
7647        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
7648    ) -> Result<RuleSetV6Event, fidl::Error> {
7649        let (bytes, _handles) = buf.split_mut();
7650        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7651        debug_assert_eq!(tx_header.tx_id, 0);
7652        match tx_header.ordinal {
7653            _ => Err(fidl::Error::UnknownOrdinal {
7654                ordinal: tx_header.ordinal,
7655                protocol_name: <RuleSetV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7656            }),
7657        }
7658    }
7659}
7660
7661/// A Stream of incoming requests for fuchsia.net.routes.admin/RuleSetV6.
7662pub struct RuleSetV6RequestStream {
7663    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7664    is_terminated: bool,
7665}
7666
7667impl std::marker::Unpin for RuleSetV6RequestStream {}
7668
7669impl futures::stream::FusedStream for RuleSetV6RequestStream {
7670    fn is_terminated(&self) -> bool {
7671        self.is_terminated
7672    }
7673}
7674
7675impl fidl::endpoints::RequestStream for RuleSetV6RequestStream {
7676    type Protocol = RuleSetV6Marker;
7677    type ControlHandle = RuleSetV6ControlHandle;
7678
7679    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
7680        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
7681    }
7682
7683    fn control_handle(&self) -> Self::ControlHandle {
7684        RuleSetV6ControlHandle { inner: self.inner.clone() }
7685    }
7686
7687    fn into_inner(
7688        self,
7689    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
7690    {
7691        (self.inner, self.is_terminated)
7692    }
7693
7694    fn from_inner(
7695        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7696        is_terminated: bool,
7697    ) -> Self {
7698        Self { inner, is_terminated }
7699    }
7700}
7701
7702impl futures::Stream for RuleSetV6RequestStream {
7703    type Item = Result<RuleSetV6Request, fidl::Error>;
7704
7705    fn poll_next(
7706        mut self: std::pin::Pin<&mut Self>,
7707        cx: &mut std::task::Context<'_>,
7708    ) -> std::task::Poll<Option<Self::Item>> {
7709        let this = &mut *self;
7710        if this.inner.check_shutdown(cx) {
7711            this.is_terminated = true;
7712            return std::task::Poll::Ready(None);
7713        }
7714        if this.is_terminated {
7715            panic!("polled RuleSetV6RequestStream after completion");
7716        }
7717        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
7718            |bytes, handles| {
7719                match this.inner.channel().read_etc(cx, bytes, handles) {
7720                    std::task::Poll::Ready(Ok(())) => {}
7721                    std::task::Poll::Pending => return std::task::Poll::Pending,
7722                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
7723                        this.is_terminated = true;
7724                        return std::task::Poll::Ready(None);
7725                    }
7726                    std::task::Poll::Ready(Err(e)) => {
7727                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
7728                            e.into(),
7729                        ))))
7730                    }
7731                }
7732
7733                // A message has been received from the channel
7734                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
7735
7736                std::task::Poll::Ready(Some(match header.ordinal {
7737                    0x6fd845360ed9bc8f => {
7738                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7739                        let mut req = fidl::new_empty!(
7740                            ProofOfRouteTableAuthorization,
7741                            fidl::encoding::DefaultFuchsiaResourceDialect
7742                        );
7743                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProofOfRouteTableAuthorization>(&header, _body_bytes, handles, &mut req)?;
7744                        let control_handle = RuleSetV6ControlHandle { inner: this.inner.clone() };
7745                        Ok(RuleSetV6Request::AuthenticateForRouteTable {
7746                            table: req.table,
7747                            token: req.token,
7748
7749                            responder: RuleSetV6AuthenticateForRouteTableResponder {
7750                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7751                                tx_id: header.tx_id,
7752                            },
7753                        })
7754                    }
7755                    0x2ae3d7e817cbff90 => {
7756                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7757                        let mut req = fidl::new_empty!(
7758                            BaseRuleSetRemoveRuleRequest,
7759                            fidl::encoding::DefaultFuchsiaResourceDialect
7760                        );
7761                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<BaseRuleSetRemoveRuleRequest>(&header, _body_bytes, handles, &mut req)?;
7762                        let control_handle = RuleSetV6ControlHandle { inner: this.inner.clone() };
7763                        Ok(RuleSetV6Request::RemoveRule {
7764                            index: req.index,
7765
7766                            responder: RuleSetV6RemoveRuleResponder {
7767                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7768                                tx_id: header.tx_id,
7769                            },
7770                        })
7771                    }
7772                    0x457e1753672d4073 => {
7773                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
7774                        let mut req = fidl::new_empty!(
7775                            fidl::encoding::EmptyPayload,
7776                            fidl::encoding::DefaultFuchsiaResourceDialect
7777                        );
7778                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
7779                        let control_handle = RuleSetV6ControlHandle { inner: this.inner.clone() };
7780                        Ok(RuleSetV6Request::Close { control_handle })
7781                    }
7782                    0x946cad8f8a726b3 => {
7783                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
7784                        let mut req = fidl::new_empty!(
7785                            RuleSetV6AddRuleRequest,
7786                            fidl::encoding::DefaultFuchsiaResourceDialect
7787                        );
7788                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RuleSetV6AddRuleRequest>(&header, _body_bytes, handles, &mut req)?;
7789                        let control_handle = RuleSetV6ControlHandle { inner: this.inner.clone() };
7790                        Ok(RuleSetV6Request::AddRule {
7791                            index: req.index,
7792                            matcher: req.matcher,
7793                            action: req.action,
7794
7795                            responder: RuleSetV6AddRuleResponder {
7796                                control_handle: std::mem::ManuallyDrop::new(control_handle),
7797                                tx_id: header.tx_id,
7798                            },
7799                        })
7800                    }
7801                    _ => Err(fidl::Error::UnknownOrdinal {
7802                        ordinal: header.ordinal,
7803                        protocol_name:
7804                            <RuleSetV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
7805                    }),
7806                }))
7807            },
7808        )
7809    }
7810}
7811
7812/// Provides mutable access over a set of the system's IPv6 route rules.
7813///
7814/// A `RuleSet` has a priority and a rule has an index. A global order among the
7815/// rules is determined first by the priority of the `RuleSet` the rule belongs
7816/// to, and then the index of the rule inside the `RuleSet`.
7817///
7818/// This protocol encodes the lifetime of the rule set. Closing the client end
7819/// removes the rule set, and all the rules that are owned by the rule set.
7820#[derive(Debug)]
7821pub enum RuleSetV6Request {
7822    /// Authenticates for a route table that will be used in an action.
7823    AuthenticateForRouteTable {
7824        table: u32,
7825        token: fidl::Event,
7826        responder: RuleSetV6AuthenticateForRouteTableResponder,
7827    },
7828    /// Removes a rule from this rule set.
7829    ///
7830    /// If the client tries to remove from an index that does not have a rule,
7831    /// the error `RULE_DOES_NOT_EXIST` will be returned.
7832    ///
7833    /// + request `index` the index of the rule.
7834    RemoveRule { index: u32, responder: RuleSetV6RemoveRuleResponder },
7835    /// Removes all rules in the rule set and the underlying channel will be
7836    /// closed after the rules are removed.
7837    ///
7838    /// This method provides a way for synchronous closure.
7839    Close { control_handle: RuleSetV6ControlHandle },
7840    /// Adds a rule to this rule set.
7841    ///
7842    /// If there is already a rule at the provided `index`, `RULE_ALREADY_EXISTS`
7843    /// is returned.
7844    ///
7845    /// + request `index` where to insert the rule.
7846    /// + request `matcher` the matcher of the rule.
7847    /// + request `action` action of the rule.
7848    AddRule {
7849        index: u32,
7850        matcher: fidl_fuchsia_net_routes::RuleMatcherV6,
7851        action: fidl_fuchsia_net_routes::RuleAction,
7852        responder: RuleSetV6AddRuleResponder,
7853    },
7854}
7855
7856impl RuleSetV6Request {
7857    #[allow(irrefutable_let_patterns)]
7858    pub fn into_authenticate_for_route_table(
7859        self,
7860    ) -> Option<(u32, fidl::Event, RuleSetV6AuthenticateForRouteTableResponder)> {
7861        if let RuleSetV6Request::AuthenticateForRouteTable { table, token, responder } = self {
7862            Some((table, token, responder))
7863        } else {
7864            None
7865        }
7866    }
7867
7868    #[allow(irrefutable_let_patterns)]
7869    pub fn into_remove_rule(self) -> Option<(u32, RuleSetV6RemoveRuleResponder)> {
7870        if let RuleSetV6Request::RemoveRule { index, responder } = self {
7871            Some((index, responder))
7872        } else {
7873            None
7874        }
7875    }
7876
7877    #[allow(irrefutable_let_patterns)]
7878    pub fn into_close(self) -> Option<(RuleSetV6ControlHandle)> {
7879        if let RuleSetV6Request::Close { control_handle } = self {
7880            Some((control_handle))
7881        } else {
7882            None
7883        }
7884    }
7885
7886    #[allow(irrefutable_let_patterns)]
7887    pub fn into_add_rule(
7888        self,
7889    ) -> Option<(
7890        u32,
7891        fidl_fuchsia_net_routes::RuleMatcherV6,
7892        fidl_fuchsia_net_routes::RuleAction,
7893        RuleSetV6AddRuleResponder,
7894    )> {
7895        if let RuleSetV6Request::AddRule { index, matcher, action, responder } = self {
7896            Some((index, matcher, action, responder))
7897        } else {
7898            None
7899        }
7900    }
7901
7902    /// Name of the method defined in FIDL
7903    pub fn method_name(&self) -> &'static str {
7904        match *self {
7905            RuleSetV6Request::AuthenticateForRouteTable { .. } => "authenticate_for_route_table",
7906            RuleSetV6Request::RemoveRule { .. } => "remove_rule",
7907            RuleSetV6Request::Close { .. } => "close",
7908            RuleSetV6Request::AddRule { .. } => "add_rule",
7909        }
7910    }
7911}
7912
7913#[derive(Debug, Clone)]
7914pub struct RuleSetV6ControlHandle {
7915    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
7916}
7917
7918impl fidl::endpoints::ControlHandle for RuleSetV6ControlHandle {
7919    fn shutdown(&self) {
7920        self.inner.shutdown()
7921    }
7922    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
7923        self.inner.shutdown_with_epitaph(status)
7924    }
7925
7926    fn is_closed(&self) -> bool {
7927        self.inner.channel().is_closed()
7928    }
7929    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
7930        self.inner.channel().on_closed()
7931    }
7932
7933    #[cfg(target_os = "fuchsia")]
7934    fn signal_peer(
7935        &self,
7936        clear_mask: zx::Signals,
7937        set_mask: zx::Signals,
7938    ) -> Result<(), zx_status::Status> {
7939        use fidl::Peered;
7940        self.inner.channel().signal_peer(clear_mask, set_mask)
7941    }
7942}
7943
7944impl RuleSetV6ControlHandle {}
7945
7946#[must_use = "FIDL methods require a response to be sent"]
7947#[derive(Debug)]
7948pub struct RuleSetV6AuthenticateForRouteTableResponder {
7949    control_handle: std::mem::ManuallyDrop<RuleSetV6ControlHandle>,
7950    tx_id: u32,
7951}
7952
7953/// Set the the channel to be shutdown (see [`RuleSetV6ControlHandle::shutdown`])
7954/// if the responder is dropped without sending a response, so that the client
7955/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
7956impl std::ops::Drop for RuleSetV6AuthenticateForRouteTableResponder {
7957    fn drop(&mut self) {
7958        self.control_handle.shutdown();
7959        // Safety: drops once, never accessed again
7960        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7961    }
7962}
7963
7964impl fidl::endpoints::Responder for RuleSetV6AuthenticateForRouteTableResponder {
7965    type ControlHandle = RuleSetV6ControlHandle;
7966
7967    fn control_handle(&self) -> &RuleSetV6ControlHandle {
7968        &self.control_handle
7969    }
7970
7971    fn drop_without_shutdown(mut self) {
7972        // Safety: drops once, never accessed again due to mem::forget
7973        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
7974        // Prevent Drop from running (which would shut down the channel)
7975        std::mem::forget(self);
7976    }
7977}
7978
7979impl RuleSetV6AuthenticateForRouteTableResponder {
7980    /// Sends a response to the FIDL transaction.
7981    ///
7982    /// Sets the channel to shutdown if an error occurs.
7983    pub fn send(
7984        self,
7985        mut result: Result<(), AuthenticateForRouteTableError>,
7986    ) -> Result<(), fidl::Error> {
7987        let _result = self.send_raw(result);
7988        if _result.is_err() {
7989            self.control_handle.shutdown();
7990        }
7991        self.drop_without_shutdown();
7992        _result
7993    }
7994
7995    /// Similar to "send" but does not shutdown the channel if an error occurs.
7996    pub fn send_no_shutdown_on_err(
7997        self,
7998        mut result: Result<(), AuthenticateForRouteTableError>,
7999    ) -> Result<(), fidl::Error> {
8000        let _result = self.send_raw(result);
8001        self.drop_without_shutdown();
8002        _result
8003    }
8004
8005    fn send_raw(
8006        &self,
8007        mut result: Result<(), AuthenticateForRouteTableError>,
8008    ) -> Result<(), fidl::Error> {
8009        self.control_handle.inner.send::<fidl::encoding::ResultType<
8010            fidl::encoding::EmptyStruct,
8011            AuthenticateForRouteTableError,
8012        >>(
8013            result,
8014            self.tx_id,
8015            0x6fd845360ed9bc8f,
8016            fidl::encoding::DynamicFlags::empty(),
8017        )
8018    }
8019}
8020
8021#[must_use = "FIDL methods require a response to be sent"]
8022#[derive(Debug)]
8023pub struct RuleSetV6RemoveRuleResponder {
8024    control_handle: std::mem::ManuallyDrop<RuleSetV6ControlHandle>,
8025    tx_id: u32,
8026}
8027
8028/// Set the the channel to be shutdown (see [`RuleSetV6ControlHandle::shutdown`])
8029/// if the responder is dropped without sending a response, so that the client
8030/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8031impl std::ops::Drop for RuleSetV6RemoveRuleResponder {
8032    fn drop(&mut self) {
8033        self.control_handle.shutdown();
8034        // Safety: drops once, never accessed again
8035        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8036    }
8037}
8038
8039impl fidl::endpoints::Responder for RuleSetV6RemoveRuleResponder {
8040    type ControlHandle = RuleSetV6ControlHandle;
8041
8042    fn control_handle(&self) -> &RuleSetV6ControlHandle {
8043        &self.control_handle
8044    }
8045
8046    fn drop_without_shutdown(mut self) {
8047        // Safety: drops once, never accessed again due to mem::forget
8048        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8049        // Prevent Drop from running (which would shut down the channel)
8050        std::mem::forget(self);
8051    }
8052}
8053
8054impl RuleSetV6RemoveRuleResponder {
8055    /// Sends a response to the FIDL transaction.
8056    ///
8057    /// Sets the channel to shutdown if an error occurs.
8058    pub fn send(self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
8059        let _result = self.send_raw(result);
8060        if _result.is_err() {
8061            self.control_handle.shutdown();
8062        }
8063        self.drop_without_shutdown();
8064        _result
8065    }
8066
8067    /// Similar to "send" but does not shutdown the channel if an error occurs.
8068    pub fn send_no_shutdown_on_err(
8069        self,
8070        mut result: Result<(), RuleSetError>,
8071    ) -> Result<(), fidl::Error> {
8072        let _result = self.send_raw(result);
8073        self.drop_without_shutdown();
8074        _result
8075    }
8076
8077    fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
8078        self.control_handle.inner.send::<fidl::encoding::ResultType<
8079            fidl::encoding::EmptyStruct,
8080            RuleSetError,
8081        >>(
8082            result,
8083            self.tx_id,
8084            0x2ae3d7e817cbff90,
8085            fidl::encoding::DynamicFlags::empty(),
8086        )
8087    }
8088}
8089
8090#[must_use = "FIDL methods require a response to be sent"]
8091#[derive(Debug)]
8092pub struct RuleSetV6AddRuleResponder {
8093    control_handle: std::mem::ManuallyDrop<RuleSetV6ControlHandle>,
8094    tx_id: u32,
8095}
8096
8097/// Set the the channel to be shutdown (see [`RuleSetV6ControlHandle::shutdown`])
8098/// if the responder is dropped without sending a response, so that the client
8099/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
8100impl std::ops::Drop for RuleSetV6AddRuleResponder {
8101    fn drop(&mut self) {
8102        self.control_handle.shutdown();
8103        // Safety: drops once, never accessed again
8104        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8105    }
8106}
8107
8108impl fidl::endpoints::Responder for RuleSetV6AddRuleResponder {
8109    type ControlHandle = RuleSetV6ControlHandle;
8110
8111    fn control_handle(&self) -> &RuleSetV6ControlHandle {
8112        &self.control_handle
8113    }
8114
8115    fn drop_without_shutdown(mut self) {
8116        // Safety: drops once, never accessed again due to mem::forget
8117        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
8118        // Prevent Drop from running (which would shut down the channel)
8119        std::mem::forget(self);
8120    }
8121}
8122
8123impl RuleSetV6AddRuleResponder {
8124    /// Sends a response to the FIDL transaction.
8125    ///
8126    /// Sets the channel to shutdown if an error occurs.
8127    pub fn send(self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
8128        let _result = self.send_raw(result);
8129        if _result.is_err() {
8130            self.control_handle.shutdown();
8131        }
8132        self.drop_without_shutdown();
8133        _result
8134    }
8135
8136    /// Similar to "send" but does not shutdown the channel if an error occurs.
8137    pub fn send_no_shutdown_on_err(
8138        self,
8139        mut result: Result<(), RuleSetError>,
8140    ) -> Result<(), fidl::Error> {
8141        let _result = self.send_raw(result);
8142        self.drop_without_shutdown();
8143        _result
8144    }
8145
8146    fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
8147        self.control_handle.inner.send::<fidl::encoding::ResultType<
8148            fidl::encoding::EmptyStruct,
8149            RuleSetError,
8150        >>(
8151            result,
8152            self.tx_id,
8153            0x946cad8f8a726b3,
8154            fidl::encoding::DynamicFlags::empty(),
8155        )
8156    }
8157}
8158
8159#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8160pub struct RuleTableV4Marker;
8161
8162impl fidl::endpoints::ProtocolMarker for RuleTableV4Marker {
8163    type Proxy = RuleTableV4Proxy;
8164    type RequestStream = RuleTableV4RequestStream;
8165    #[cfg(target_os = "fuchsia")]
8166    type SynchronousProxy = RuleTableV4SynchronousProxy;
8167
8168    const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RuleTableV4";
8169}
8170impl fidl::endpoints::DiscoverableProtocolMarker for RuleTableV4Marker {}
8171
8172pub trait RuleTableV4ProxyInterface: Send + Sync {
8173    fn r#new_rule_set(
8174        &self,
8175        priority: u32,
8176        rule_set: fidl::endpoints::ServerEnd<RuleSetV4Marker>,
8177    ) -> Result<(), fidl::Error>;
8178}
8179#[derive(Debug)]
8180#[cfg(target_os = "fuchsia")]
8181pub struct RuleTableV4SynchronousProxy {
8182    client: fidl::client::sync::Client,
8183}
8184
8185#[cfg(target_os = "fuchsia")]
8186impl fidl::endpoints::SynchronousProxy for RuleTableV4SynchronousProxy {
8187    type Proxy = RuleTableV4Proxy;
8188    type Protocol = RuleTableV4Marker;
8189
8190    fn from_channel(inner: fidl::Channel) -> Self {
8191        Self::new(inner)
8192    }
8193
8194    fn into_channel(self) -> fidl::Channel {
8195        self.client.into_channel()
8196    }
8197
8198    fn as_channel(&self) -> &fidl::Channel {
8199        self.client.as_channel()
8200    }
8201}
8202
8203#[cfg(target_os = "fuchsia")]
8204impl RuleTableV4SynchronousProxy {
8205    pub fn new(channel: fidl::Channel) -> Self {
8206        let protocol_name = <RuleTableV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8207        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8208    }
8209
8210    pub fn into_channel(self) -> fidl::Channel {
8211        self.client.into_channel()
8212    }
8213
8214    /// Waits until an event arrives and returns it. It is safe for other
8215    /// threads to make concurrent requests while waiting for an event.
8216    pub fn wait_for_event(
8217        &self,
8218        deadline: zx::MonotonicInstant,
8219    ) -> Result<RuleTableV4Event, fidl::Error> {
8220        RuleTableV4Event::decode(self.client.wait_for_event(deadline)?)
8221    }
8222
8223    /// Returns an empty rule set at requested priority.
8224    ///
8225    /// Clients are free to manage the rules within their own rule set, but not
8226    /// the rule set of others. Only one rule set is allowed at each `priority`
8227    /// level. Channel is closed with `ZX_ERR_ALREADY_EXISTS` if there's already
8228    /// a rule set at the given `priority`.
8229    ///
8230    /// + request `priority` the priority of this `RuleSetV4`, all rule sets are
8231    ///   globally ordered according to this number.
8232    /// + request `rule_set` grants access to the `RuleSetV4` protocol.
8233    pub fn r#new_rule_set(
8234        &self,
8235        mut priority: u32,
8236        mut rule_set: fidl::endpoints::ServerEnd<RuleSetV4Marker>,
8237    ) -> Result<(), fidl::Error> {
8238        self.client.send::<RuleTableV4NewRuleSetRequest>(
8239            (priority, rule_set),
8240            0xa32a9097da46f3a,
8241            fidl::encoding::DynamicFlags::empty(),
8242        )
8243    }
8244}
8245
8246#[derive(Debug, Clone)]
8247pub struct RuleTableV4Proxy {
8248    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8249}
8250
8251impl fidl::endpoints::Proxy for RuleTableV4Proxy {
8252    type Protocol = RuleTableV4Marker;
8253
8254    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8255        Self::new(inner)
8256    }
8257
8258    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8259        self.client.into_channel().map_err(|client| Self { client })
8260    }
8261
8262    fn as_channel(&self) -> &::fidl::AsyncChannel {
8263        self.client.as_channel()
8264    }
8265}
8266
8267impl RuleTableV4Proxy {
8268    /// Create a new Proxy for fuchsia.net.routes.admin/RuleTableV4.
8269    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8270        let protocol_name = <RuleTableV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8271        Self { client: fidl::client::Client::new(channel, protocol_name) }
8272    }
8273
8274    /// Get a Stream of events from the remote end of the protocol.
8275    ///
8276    /// # Panics
8277    ///
8278    /// Panics if the event stream was already taken.
8279    pub fn take_event_stream(&self) -> RuleTableV4EventStream {
8280        RuleTableV4EventStream { event_receiver: self.client.take_event_receiver() }
8281    }
8282
8283    /// Returns an empty rule set at requested priority.
8284    ///
8285    /// Clients are free to manage the rules within their own rule set, but not
8286    /// the rule set of others. Only one rule set is allowed at each `priority`
8287    /// level. Channel is closed with `ZX_ERR_ALREADY_EXISTS` if there's already
8288    /// a rule set at the given `priority`.
8289    ///
8290    /// + request `priority` the priority of this `RuleSetV4`, all rule sets are
8291    ///   globally ordered according to this number.
8292    /// + request `rule_set` grants access to the `RuleSetV4` protocol.
8293    pub fn r#new_rule_set(
8294        &self,
8295        mut priority: u32,
8296        mut rule_set: fidl::endpoints::ServerEnd<RuleSetV4Marker>,
8297    ) -> Result<(), fidl::Error> {
8298        RuleTableV4ProxyInterface::r#new_rule_set(self, priority, rule_set)
8299    }
8300}
8301
8302impl RuleTableV4ProxyInterface for RuleTableV4Proxy {
8303    fn r#new_rule_set(
8304        &self,
8305        mut priority: u32,
8306        mut rule_set: fidl::endpoints::ServerEnd<RuleSetV4Marker>,
8307    ) -> Result<(), fidl::Error> {
8308        self.client.send::<RuleTableV4NewRuleSetRequest>(
8309            (priority, rule_set),
8310            0xa32a9097da46f3a,
8311            fidl::encoding::DynamicFlags::empty(),
8312        )
8313    }
8314}
8315
8316pub struct RuleTableV4EventStream {
8317    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8318}
8319
8320impl std::marker::Unpin for RuleTableV4EventStream {}
8321
8322impl futures::stream::FusedStream for RuleTableV4EventStream {
8323    fn is_terminated(&self) -> bool {
8324        self.event_receiver.is_terminated()
8325    }
8326}
8327
8328impl futures::Stream for RuleTableV4EventStream {
8329    type Item = Result<RuleTableV4Event, fidl::Error>;
8330
8331    fn poll_next(
8332        mut self: std::pin::Pin<&mut Self>,
8333        cx: &mut std::task::Context<'_>,
8334    ) -> std::task::Poll<Option<Self::Item>> {
8335        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8336            &mut self.event_receiver,
8337            cx
8338        )?) {
8339            Some(buf) => std::task::Poll::Ready(Some(RuleTableV4Event::decode(buf))),
8340            None => std::task::Poll::Ready(None),
8341        }
8342    }
8343}
8344
8345#[derive(Debug)]
8346pub enum RuleTableV4Event {}
8347
8348impl RuleTableV4Event {
8349    /// Decodes a message buffer as a [`RuleTableV4Event`].
8350    fn decode(
8351        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8352    ) -> Result<RuleTableV4Event, fidl::Error> {
8353        let (bytes, _handles) = buf.split_mut();
8354        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8355        debug_assert_eq!(tx_header.tx_id, 0);
8356        match tx_header.ordinal {
8357            _ => Err(fidl::Error::UnknownOrdinal {
8358                ordinal: tx_header.ordinal,
8359                protocol_name: <RuleTableV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8360            }),
8361        }
8362    }
8363}
8364
8365/// A Stream of incoming requests for fuchsia.net.routes.admin/RuleTableV4.
8366pub struct RuleTableV4RequestStream {
8367    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8368    is_terminated: bool,
8369}
8370
8371impl std::marker::Unpin for RuleTableV4RequestStream {}
8372
8373impl futures::stream::FusedStream for RuleTableV4RequestStream {
8374    fn is_terminated(&self) -> bool {
8375        self.is_terminated
8376    }
8377}
8378
8379impl fidl::endpoints::RequestStream for RuleTableV4RequestStream {
8380    type Protocol = RuleTableV4Marker;
8381    type ControlHandle = RuleTableV4ControlHandle;
8382
8383    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8384        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8385    }
8386
8387    fn control_handle(&self) -> Self::ControlHandle {
8388        RuleTableV4ControlHandle { inner: self.inner.clone() }
8389    }
8390
8391    fn into_inner(
8392        self,
8393    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8394    {
8395        (self.inner, self.is_terminated)
8396    }
8397
8398    fn from_inner(
8399        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8400        is_terminated: bool,
8401    ) -> Self {
8402        Self { inner, is_terminated }
8403    }
8404}
8405
8406impl futures::Stream for RuleTableV4RequestStream {
8407    type Item = Result<RuleTableV4Request, fidl::Error>;
8408
8409    fn poll_next(
8410        mut self: std::pin::Pin<&mut Self>,
8411        cx: &mut std::task::Context<'_>,
8412    ) -> std::task::Poll<Option<Self::Item>> {
8413        let this = &mut *self;
8414        if this.inner.check_shutdown(cx) {
8415            this.is_terminated = true;
8416            return std::task::Poll::Ready(None);
8417        }
8418        if this.is_terminated {
8419            panic!("polled RuleTableV4RequestStream after completion");
8420        }
8421        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8422            |bytes, handles| {
8423                match this.inner.channel().read_etc(cx, bytes, handles) {
8424                    std::task::Poll::Ready(Ok(())) => {}
8425                    std::task::Poll::Pending => return std::task::Poll::Pending,
8426                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8427                        this.is_terminated = true;
8428                        return std::task::Poll::Ready(None);
8429                    }
8430                    std::task::Poll::Ready(Err(e)) => {
8431                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8432                            e.into(),
8433                        ))))
8434                    }
8435                }
8436
8437                // A message has been received from the channel
8438                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8439
8440                std::task::Poll::Ready(Some(match header.ordinal {
8441                    0xa32a9097da46f3a => {
8442                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8443                        let mut req = fidl::new_empty!(
8444                            RuleTableV4NewRuleSetRequest,
8445                            fidl::encoding::DefaultFuchsiaResourceDialect
8446                        );
8447                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RuleTableV4NewRuleSetRequest>(&header, _body_bytes, handles, &mut req)?;
8448                        let control_handle = RuleTableV4ControlHandle { inner: this.inner.clone() };
8449                        Ok(RuleTableV4Request::NewRuleSet {
8450                            priority: req.priority,
8451                            rule_set: req.rule_set,
8452
8453                            control_handle,
8454                        })
8455                    }
8456                    _ => Err(fidl::Error::UnknownOrdinal {
8457                        ordinal: header.ordinal,
8458                        protocol_name:
8459                            <RuleTableV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8460                    }),
8461                }))
8462            },
8463        )
8464    }
8465}
8466
8467/// Gives isolated access to the system's policy routing rules.
8468#[derive(Debug)]
8469pub enum RuleTableV4Request {
8470    /// Returns an empty rule set at requested priority.
8471    ///
8472    /// Clients are free to manage the rules within their own rule set, but not
8473    /// the rule set of others. Only one rule set is allowed at each `priority`
8474    /// level. Channel is closed with `ZX_ERR_ALREADY_EXISTS` if there's already
8475    /// a rule set at the given `priority`.
8476    ///
8477    /// + request `priority` the priority of this `RuleSetV4`, all rule sets are
8478    ///   globally ordered according to this number.
8479    /// + request `rule_set` grants access to the `RuleSetV4` protocol.
8480    NewRuleSet {
8481        priority: u32,
8482        rule_set: fidl::endpoints::ServerEnd<RuleSetV4Marker>,
8483        control_handle: RuleTableV4ControlHandle,
8484    },
8485}
8486
8487impl RuleTableV4Request {
8488    #[allow(irrefutable_let_patterns)]
8489    pub fn into_new_rule_set(
8490        self,
8491    ) -> Option<(u32, fidl::endpoints::ServerEnd<RuleSetV4Marker>, RuleTableV4ControlHandle)> {
8492        if let RuleTableV4Request::NewRuleSet { priority, rule_set, control_handle } = self {
8493            Some((priority, rule_set, control_handle))
8494        } else {
8495            None
8496        }
8497    }
8498
8499    /// Name of the method defined in FIDL
8500    pub fn method_name(&self) -> &'static str {
8501        match *self {
8502            RuleTableV4Request::NewRuleSet { .. } => "new_rule_set",
8503        }
8504    }
8505}
8506
8507#[derive(Debug, Clone)]
8508pub struct RuleTableV4ControlHandle {
8509    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8510}
8511
8512impl fidl::endpoints::ControlHandle for RuleTableV4ControlHandle {
8513    fn shutdown(&self) {
8514        self.inner.shutdown()
8515    }
8516    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8517        self.inner.shutdown_with_epitaph(status)
8518    }
8519
8520    fn is_closed(&self) -> bool {
8521        self.inner.channel().is_closed()
8522    }
8523    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8524        self.inner.channel().on_closed()
8525    }
8526
8527    #[cfg(target_os = "fuchsia")]
8528    fn signal_peer(
8529        &self,
8530        clear_mask: zx::Signals,
8531        set_mask: zx::Signals,
8532    ) -> Result<(), zx_status::Status> {
8533        use fidl::Peered;
8534        self.inner.channel().signal_peer(clear_mask, set_mask)
8535    }
8536}
8537
8538impl RuleTableV4ControlHandle {}
8539
8540#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
8541pub struct RuleTableV6Marker;
8542
8543impl fidl::endpoints::ProtocolMarker for RuleTableV6Marker {
8544    type Proxy = RuleTableV6Proxy;
8545    type RequestStream = RuleTableV6RequestStream;
8546    #[cfg(target_os = "fuchsia")]
8547    type SynchronousProxy = RuleTableV6SynchronousProxy;
8548
8549    const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RuleTableV6";
8550}
8551impl fidl::endpoints::DiscoverableProtocolMarker for RuleTableV6Marker {}
8552
8553pub trait RuleTableV6ProxyInterface: Send + Sync {
8554    fn r#new_rule_set(
8555        &self,
8556        priority: u32,
8557        rule_set: fidl::endpoints::ServerEnd<RuleSetV6Marker>,
8558    ) -> Result<(), fidl::Error>;
8559}
8560#[derive(Debug)]
8561#[cfg(target_os = "fuchsia")]
8562pub struct RuleTableV6SynchronousProxy {
8563    client: fidl::client::sync::Client,
8564}
8565
8566#[cfg(target_os = "fuchsia")]
8567impl fidl::endpoints::SynchronousProxy for RuleTableV6SynchronousProxy {
8568    type Proxy = RuleTableV6Proxy;
8569    type Protocol = RuleTableV6Marker;
8570
8571    fn from_channel(inner: fidl::Channel) -> Self {
8572        Self::new(inner)
8573    }
8574
8575    fn into_channel(self) -> fidl::Channel {
8576        self.client.into_channel()
8577    }
8578
8579    fn as_channel(&self) -> &fidl::Channel {
8580        self.client.as_channel()
8581    }
8582}
8583
8584#[cfg(target_os = "fuchsia")]
8585impl RuleTableV6SynchronousProxy {
8586    pub fn new(channel: fidl::Channel) -> Self {
8587        let protocol_name = <RuleTableV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8588        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
8589    }
8590
8591    pub fn into_channel(self) -> fidl::Channel {
8592        self.client.into_channel()
8593    }
8594
8595    /// Waits until an event arrives and returns it. It is safe for other
8596    /// threads to make concurrent requests while waiting for an event.
8597    pub fn wait_for_event(
8598        &self,
8599        deadline: zx::MonotonicInstant,
8600    ) -> Result<RuleTableV6Event, fidl::Error> {
8601        RuleTableV6Event::decode(self.client.wait_for_event(deadline)?)
8602    }
8603
8604    /// Returns an empty rule set at requested priority.
8605    ///
8606    /// Clients are free to manage the rules within their own rule set, but not
8607    /// the rule set of others. Only one rule set is allowed at each `priority`
8608    /// level. Channel is closed with `ZX_ERR_ALREADY_EXISTS` if there's already
8609    /// a rule set at the given `priority`.
8610    ///
8611    /// + request `priority` the priority of this `RuleSetV6`, all rule sets are
8612    ///   globally ordered according to this number.
8613    /// + request `rule_set` grants access to the `RuleSetV6` protocol.
8614    pub fn r#new_rule_set(
8615        &self,
8616        mut priority: u32,
8617        mut rule_set: fidl::endpoints::ServerEnd<RuleSetV6Marker>,
8618    ) -> Result<(), fidl::Error> {
8619        self.client.send::<RuleTableV6NewRuleSetRequest>(
8620            (priority, rule_set),
8621            0x2261cc6eee9726a0,
8622            fidl::encoding::DynamicFlags::empty(),
8623        )
8624    }
8625}
8626
8627#[derive(Debug, Clone)]
8628pub struct RuleTableV6Proxy {
8629    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
8630}
8631
8632impl fidl::endpoints::Proxy for RuleTableV6Proxy {
8633    type Protocol = RuleTableV6Marker;
8634
8635    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
8636        Self::new(inner)
8637    }
8638
8639    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
8640        self.client.into_channel().map_err(|client| Self { client })
8641    }
8642
8643    fn as_channel(&self) -> &::fidl::AsyncChannel {
8644        self.client.as_channel()
8645    }
8646}
8647
8648impl RuleTableV6Proxy {
8649    /// Create a new Proxy for fuchsia.net.routes.admin/RuleTableV6.
8650    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
8651        let protocol_name = <RuleTableV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
8652        Self { client: fidl::client::Client::new(channel, protocol_name) }
8653    }
8654
8655    /// Get a Stream of events from the remote end of the protocol.
8656    ///
8657    /// # Panics
8658    ///
8659    /// Panics if the event stream was already taken.
8660    pub fn take_event_stream(&self) -> RuleTableV6EventStream {
8661        RuleTableV6EventStream { event_receiver: self.client.take_event_receiver() }
8662    }
8663
8664    /// Returns an empty rule set at requested priority.
8665    ///
8666    /// Clients are free to manage the rules within their own rule set, but not
8667    /// the rule set of others. Only one rule set is allowed at each `priority`
8668    /// level. Channel is closed with `ZX_ERR_ALREADY_EXISTS` if there's already
8669    /// a rule set at the given `priority`.
8670    ///
8671    /// + request `priority` the priority of this `RuleSetV6`, all rule sets are
8672    ///   globally ordered according to this number.
8673    /// + request `rule_set` grants access to the `RuleSetV6` protocol.
8674    pub fn r#new_rule_set(
8675        &self,
8676        mut priority: u32,
8677        mut rule_set: fidl::endpoints::ServerEnd<RuleSetV6Marker>,
8678    ) -> Result<(), fidl::Error> {
8679        RuleTableV6ProxyInterface::r#new_rule_set(self, priority, rule_set)
8680    }
8681}
8682
8683impl RuleTableV6ProxyInterface for RuleTableV6Proxy {
8684    fn r#new_rule_set(
8685        &self,
8686        mut priority: u32,
8687        mut rule_set: fidl::endpoints::ServerEnd<RuleSetV6Marker>,
8688    ) -> Result<(), fidl::Error> {
8689        self.client.send::<RuleTableV6NewRuleSetRequest>(
8690            (priority, rule_set),
8691            0x2261cc6eee9726a0,
8692            fidl::encoding::DynamicFlags::empty(),
8693        )
8694    }
8695}
8696
8697pub struct RuleTableV6EventStream {
8698    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
8699}
8700
8701impl std::marker::Unpin for RuleTableV6EventStream {}
8702
8703impl futures::stream::FusedStream for RuleTableV6EventStream {
8704    fn is_terminated(&self) -> bool {
8705        self.event_receiver.is_terminated()
8706    }
8707}
8708
8709impl futures::Stream for RuleTableV6EventStream {
8710    type Item = Result<RuleTableV6Event, 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        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
8717            &mut self.event_receiver,
8718            cx
8719        )?) {
8720            Some(buf) => std::task::Poll::Ready(Some(RuleTableV6Event::decode(buf))),
8721            None => std::task::Poll::Ready(None),
8722        }
8723    }
8724}
8725
8726#[derive(Debug)]
8727pub enum RuleTableV6Event {}
8728
8729impl RuleTableV6Event {
8730    /// Decodes a message buffer as a [`RuleTableV6Event`].
8731    fn decode(
8732        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
8733    ) -> Result<RuleTableV6Event, fidl::Error> {
8734        let (bytes, _handles) = buf.split_mut();
8735        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8736        debug_assert_eq!(tx_header.tx_id, 0);
8737        match tx_header.ordinal {
8738            _ => Err(fidl::Error::UnknownOrdinal {
8739                ordinal: tx_header.ordinal,
8740                protocol_name: <RuleTableV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8741            }),
8742        }
8743    }
8744}
8745
8746/// A Stream of incoming requests for fuchsia.net.routes.admin/RuleTableV6.
8747pub struct RuleTableV6RequestStream {
8748    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8749    is_terminated: bool,
8750}
8751
8752impl std::marker::Unpin for RuleTableV6RequestStream {}
8753
8754impl futures::stream::FusedStream for RuleTableV6RequestStream {
8755    fn is_terminated(&self) -> bool {
8756        self.is_terminated
8757    }
8758}
8759
8760impl fidl::endpoints::RequestStream for RuleTableV6RequestStream {
8761    type Protocol = RuleTableV6Marker;
8762    type ControlHandle = RuleTableV6ControlHandle;
8763
8764    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
8765        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
8766    }
8767
8768    fn control_handle(&self) -> Self::ControlHandle {
8769        RuleTableV6ControlHandle { inner: self.inner.clone() }
8770    }
8771
8772    fn into_inner(
8773        self,
8774    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
8775    {
8776        (self.inner, self.is_terminated)
8777    }
8778
8779    fn from_inner(
8780        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8781        is_terminated: bool,
8782    ) -> Self {
8783        Self { inner, is_terminated }
8784    }
8785}
8786
8787impl futures::Stream for RuleTableV6RequestStream {
8788    type Item = Result<RuleTableV6Request, fidl::Error>;
8789
8790    fn poll_next(
8791        mut self: std::pin::Pin<&mut Self>,
8792        cx: &mut std::task::Context<'_>,
8793    ) -> std::task::Poll<Option<Self::Item>> {
8794        let this = &mut *self;
8795        if this.inner.check_shutdown(cx) {
8796            this.is_terminated = true;
8797            return std::task::Poll::Ready(None);
8798        }
8799        if this.is_terminated {
8800            panic!("polled RuleTableV6RequestStream after completion");
8801        }
8802        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
8803            |bytes, handles| {
8804                match this.inner.channel().read_etc(cx, bytes, handles) {
8805                    std::task::Poll::Ready(Ok(())) => {}
8806                    std::task::Poll::Pending => return std::task::Poll::Pending,
8807                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
8808                        this.is_terminated = true;
8809                        return std::task::Poll::Ready(None);
8810                    }
8811                    std::task::Poll::Ready(Err(e)) => {
8812                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
8813                            e.into(),
8814                        ))))
8815                    }
8816                }
8817
8818                // A message has been received from the channel
8819                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
8820
8821                std::task::Poll::Ready(Some(match header.ordinal {
8822                    0x2261cc6eee9726a0 => {
8823                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
8824                        let mut req = fidl::new_empty!(
8825                            RuleTableV6NewRuleSetRequest,
8826                            fidl::encoding::DefaultFuchsiaResourceDialect
8827                        );
8828                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RuleTableV6NewRuleSetRequest>(&header, _body_bytes, handles, &mut req)?;
8829                        let control_handle = RuleTableV6ControlHandle { inner: this.inner.clone() };
8830                        Ok(RuleTableV6Request::NewRuleSet {
8831                            priority: req.priority,
8832                            rule_set: req.rule_set,
8833
8834                            control_handle,
8835                        })
8836                    }
8837                    _ => Err(fidl::Error::UnknownOrdinal {
8838                        ordinal: header.ordinal,
8839                        protocol_name:
8840                            <RuleTableV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
8841                    }),
8842                }))
8843            },
8844        )
8845    }
8846}
8847
8848/// Gives isolated access to the system's policy routing rules.
8849#[derive(Debug)]
8850pub enum RuleTableV6Request {
8851    /// Returns an empty rule set at requested priority.
8852    ///
8853    /// Clients are free to manage the rules within their own rule set, but not
8854    /// the rule set of others. Only one rule set is allowed at each `priority`
8855    /// level. Channel is closed with `ZX_ERR_ALREADY_EXISTS` if there's already
8856    /// a rule set at the given `priority`.
8857    ///
8858    /// + request `priority` the priority of this `RuleSetV6`, all rule sets are
8859    ///   globally ordered according to this number.
8860    /// + request `rule_set` grants access to the `RuleSetV6` protocol.
8861    NewRuleSet {
8862        priority: u32,
8863        rule_set: fidl::endpoints::ServerEnd<RuleSetV6Marker>,
8864        control_handle: RuleTableV6ControlHandle,
8865    },
8866}
8867
8868impl RuleTableV6Request {
8869    #[allow(irrefutable_let_patterns)]
8870    pub fn into_new_rule_set(
8871        self,
8872    ) -> Option<(u32, fidl::endpoints::ServerEnd<RuleSetV6Marker>, RuleTableV6ControlHandle)> {
8873        if let RuleTableV6Request::NewRuleSet { priority, rule_set, control_handle } = self {
8874            Some((priority, rule_set, control_handle))
8875        } else {
8876            None
8877        }
8878    }
8879
8880    /// Name of the method defined in FIDL
8881    pub fn method_name(&self) -> &'static str {
8882        match *self {
8883            RuleTableV6Request::NewRuleSet { .. } => "new_rule_set",
8884        }
8885    }
8886}
8887
8888#[derive(Debug, Clone)]
8889pub struct RuleTableV6ControlHandle {
8890    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
8891}
8892
8893impl fidl::endpoints::ControlHandle for RuleTableV6ControlHandle {
8894    fn shutdown(&self) {
8895        self.inner.shutdown()
8896    }
8897    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
8898        self.inner.shutdown_with_epitaph(status)
8899    }
8900
8901    fn is_closed(&self) -> bool {
8902        self.inner.channel().is_closed()
8903    }
8904    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
8905        self.inner.channel().on_closed()
8906    }
8907
8908    #[cfg(target_os = "fuchsia")]
8909    fn signal_peer(
8910        &self,
8911        clear_mask: zx::Signals,
8912        set_mask: zx::Signals,
8913    ) -> Result<(), zx_status::Status> {
8914        use fidl::Peered;
8915        self.inner.channel().signal_peer(clear_mask, set_mask)
8916    }
8917}
8918
8919impl RuleTableV6ControlHandle {}
8920
8921mod internal {
8922    use super::*;
8923    unsafe impl fidl::encoding::TypeMarker for AuthenticateForInterfaceError {
8924        type Owned = Self;
8925
8926        #[inline(always)]
8927        fn inline_align(_context: fidl::encoding::Context) -> usize {
8928            std::mem::align_of::<u32>()
8929        }
8930
8931        #[inline(always)]
8932        fn inline_size(_context: fidl::encoding::Context) -> usize {
8933            std::mem::size_of::<u32>()
8934        }
8935
8936        #[inline(always)]
8937        fn encode_is_copy() -> bool {
8938            false
8939        }
8940
8941        #[inline(always)]
8942        fn decode_is_copy() -> bool {
8943            false
8944        }
8945    }
8946
8947    impl fidl::encoding::ValueTypeMarker for AuthenticateForInterfaceError {
8948        type Borrowed<'a> = Self;
8949        #[inline(always)]
8950        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
8951            *value
8952        }
8953    }
8954
8955    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
8956        for AuthenticateForInterfaceError
8957    {
8958        #[inline]
8959        unsafe fn encode(
8960            self,
8961            encoder: &mut fidl::encoding::Encoder<'_, D>,
8962            offset: usize,
8963            _depth: fidl::encoding::Depth,
8964        ) -> fidl::Result<()> {
8965            encoder.debug_check_bounds::<Self>(offset);
8966            encoder.write_num(self.into_primitive(), offset);
8967            Ok(())
8968        }
8969    }
8970
8971    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
8972        for AuthenticateForInterfaceError
8973    {
8974        #[inline(always)]
8975        fn new_empty() -> Self {
8976            Self::unknown()
8977        }
8978
8979        #[inline]
8980        unsafe fn decode(
8981            &mut self,
8982            decoder: &mut fidl::encoding::Decoder<'_, D>,
8983            offset: usize,
8984            _depth: fidl::encoding::Depth,
8985        ) -> fidl::Result<()> {
8986            decoder.debug_check_bounds::<Self>(offset);
8987            let prim = decoder.read_num::<u32>(offset);
8988
8989            *self = Self::from_primitive_allow_unknown(prim);
8990            Ok(())
8991        }
8992    }
8993    unsafe impl fidl::encoding::TypeMarker for AuthenticateForRouteTableError {
8994        type Owned = Self;
8995
8996        #[inline(always)]
8997        fn inline_align(_context: fidl::encoding::Context) -> usize {
8998            std::mem::align_of::<u32>()
8999        }
9000
9001        #[inline(always)]
9002        fn inline_size(_context: fidl::encoding::Context) -> usize {
9003            std::mem::size_of::<u32>()
9004        }
9005
9006        #[inline(always)]
9007        fn encode_is_copy() -> bool {
9008            false
9009        }
9010
9011        #[inline(always)]
9012        fn decode_is_copy() -> bool {
9013            false
9014        }
9015    }
9016
9017    impl fidl::encoding::ValueTypeMarker for AuthenticateForRouteTableError {
9018        type Borrowed<'a> = Self;
9019        #[inline(always)]
9020        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9021            *value
9022        }
9023    }
9024
9025    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
9026        for AuthenticateForRouteTableError
9027    {
9028        #[inline]
9029        unsafe fn encode(
9030            self,
9031            encoder: &mut fidl::encoding::Encoder<'_, D>,
9032            offset: usize,
9033            _depth: fidl::encoding::Depth,
9034        ) -> fidl::Result<()> {
9035            encoder.debug_check_bounds::<Self>(offset);
9036            encoder.write_num(self.into_primitive(), offset);
9037            Ok(())
9038        }
9039    }
9040
9041    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9042        for AuthenticateForRouteTableError
9043    {
9044        #[inline(always)]
9045        fn new_empty() -> Self {
9046            Self::unknown()
9047        }
9048
9049        #[inline]
9050        unsafe fn decode(
9051            &mut self,
9052            decoder: &mut fidl::encoding::Decoder<'_, D>,
9053            offset: usize,
9054            _depth: fidl::encoding::Depth,
9055        ) -> fidl::Result<()> {
9056            decoder.debug_check_bounds::<Self>(offset);
9057            let prim = decoder.read_num::<u32>(offset);
9058
9059            *self = Self::from_primitive_allow_unknown(prim);
9060            Ok(())
9061        }
9062    }
9063    unsafe impl fidl::encoding::TypeMarker for BaseRouteTableRemoveError {
9064        type Owned = Self;
9065
9066        #[inline(always)]
9067        fn inline_align(_context: fidl::encoding::Context) -> usize {
9068            std::mem::align_of::<u32>()
9069        }
9070
9071        #[inline(always)]
9072        fn inline_size(_context: fidl::encoding::Context) -> usize {
9073            std::mem::size_of::<u32>()
9074        }
9075
9076        #[inline(always)]
9077        fn encode_is_copy() -> bool {
9078            false
9079        }
9080
9081        #[inline(always)]
9082        fn decode_is_copy() -> bool {
9083            false
9084        }
9085    }
9086
9087    impl fidl::encoding::ValueTypeMarker for BaseRouteTableRemoveError {
9088        type Borrowed<'a> = Self;
9089        #[inline(always)]
9090        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9091            *value
9092        }
9093    }
9094
9095    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
9096        for BaseRouteTableRemoveError
9097    {
9098        #[inline]
9099        unsafe fn encode(
9100            self,
9101            encoder: &mut fidl::encoding::Encoder<'_, D>,
9102            offset: usize,
9103            _depth: fidl::encoding::Depth,
9104        ) -> fidl::Result<()> {
9105            encoder.debug_check_bounds::<Self>(offset);
9106            encoder.write_num(self.into_primitive(), offset);
9107            Ok(())
9108        }
9109    }
9110
9111    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9112        for BaseRouteTableRemoveError
9113    {
9114        #[inline(always)]
9115        fn new_empty() -> Self {
9116            Self::unknown()
9117        }
9118
9119        #[inline]
9120        unsafe fn decode(
9121            &mut self,
9122            decoder: &mut fidl::encoding::Decoder<'_, D>,
9123            offset: usize,
9124            _depth: fidl::encoding::Depth,
9125        ) -> fidl::Result<()> {
9126            decoder.debug_check_bounds::<Self>(offset);
9127            let prim = decoder.read_num::<u32>(offset);
9128
9129            *self = Self::from_primitive_allow_unknown(prim);
9130            Ok(())
9131        }
9132    }
9133    unsafe impl fidl::encoding::TypeMarker for RouteSetError {
9134        type Owned = Self;
9135
9136        #[inline(always)]
9137        fn inline_align(_context: fidl::encoding::Context) -> usize {
9138            std::mem::align_of::<u32>()
9139        }
9140
9141        #[inline(always)]
9142        fn inline_size(_context: fidl::encoding::Context) -> usize {
9143            std::mem::size_of::<u32>()
9144        }
9145
9146        #[inline(always)]
9147        fn encode_is_copy() -> bool {
9148            false
9149        }
9150
9151        #[inline(always)]
9152        fn decode_is_copy() -> bool {
9153            false
9154        }
9155    }
9156
9157    impl fidl::encoding::ValueTypeMarker for RouteSetError {
9158        type Borrowed<'a> = Self;
9159        #[inline(always)]
9160        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9161            *value
9162        }
9163    }
9164
9165    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for RouteSetError {
9166        #[inline]
9167        unsafe fn encode(
9168            self,
9169            encoder: &mut fidl::encoding::Encoder<'_, D>,
9170            offset: usize,
9171            _depth: fidl::encoding::Depth,
9172        ) -> fidl::Result<()> {
9173            encoder.debug_check_bounds::<Self>(offset);
9174            encoder.write_num(self.into_primitive(), offset);
9175            Ok(())
9176        }
9177    }
9178
9179    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RouteSetError {
9180        #[inline(always)]
9181        fn new_empty() -> Self {
9182            Self::unknown()
9183        }
9184
9185        #[inline]
9186        unsafe fn decode(
9187            &mut self,
9188            decoder: &mut fidl::encoding::Decoder<'_, D>,
9189            offset: usize,
9190            _depth: fidl::encoding::Depth,
9191        ) -> fidl::Result<()> {
9192            decoder.debug_check_bounds::<Self>(offset);
9193            let prim = decoder.read_num::<u32>(offset);
9194
9195            *self = Self::from_primitive_allow_unknown(prim);
9196            Ok(())
9197        }
9198    }
9199    unsafe impl fidl::encoding::TypeMarker for RuleSetError {
9200        type Owned = Self;
9201
9202        #[inline(always)]
9203        fn inline_align(_context: fidl::encoding::Context) -> usize {
9204            std::mem::align_of::<u32>()
9205        }
9206
9207        #[inline(always)]
9208        fn inline_size(_context: fidl::encoding::Context) -> usize {
9209            std::mem::size_of::<u32>()
9210        }
9211
9212        #[inline(always)]
9213        fn encode_is_copy() -> bool {
9214            false
9215        }
9216
9217        #[inline(always)]
9218        fn decode_is_copy() -> bool {
9219            false
9220        }
9221    }
9222
9223    impl fidl::encoding::ValueTypeMarker for RuleSetError {
9224        type Borrowed<'a> = Self;
9225        #[inline(always)]
9226        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9227            *value
9228        }
9229    }
9230
9231    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for RuleSetError {
9232        #[inline]
9233        unsafe fn encode(
9234            self,
9235            encoder: &mut fidl::encoding::Encoder<'_, D>,
9236            offset: usize,
9237            _depth: fidl::encoding::Depth,
9238        ) -> fidl::Result<()> {
9239            encoder.debug_check_bounds::<Self>(offset);
9240            encoder.write_num(self.into_primitive(), offset);
9241            Ok(())
9242        }
9243    }
9244
9245    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RuleSetError {
9246        #[inline(always)]
9247        fn new_empty() -> Self {
9248            Self::unknown()
9249        }
9250
9251        #[inline]
9252        unsafe fn decode(
9253            &mut self,
9254            decoder: &mut fidl::encoding::Decoder<'_, D>,
9255            offset: usize,
9256            _depth: fidl::encoding::Depth,
9257        ) -> fidl::Result<()> {
9258            decoder.debug_check_bounds::<Self>(offset);
9259            let prim = decoder.read_num::<u32>(offset);
9260
9261            *self = Self::from_primitive_allow_unknown(prim);
9262            Ok(())
9263        }
9264    }
9265
9266    impl fidl::encoding::ResourceTypeMarker for BaseRouteTableGetAuthorizationForRouteTableResponse {
9267        type Borrowed<'a> = &'a mut Self;
9268        fn take_or_borrow<'a>(
9269            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9270        ) -> Self::Borrowed<'a> {
9271            value
9272        }
9273    }
9274
9275    unsafe impl fidl::encoding::TypeMarker for BaseRouteTableGetAuthorizationForRouteTableResponse {
9276        type Owned = Self;
9277
9278        #[inline(always)]
9279        fn inline_align(_context: fidl::encoding::Context) -> usize {
9280            4
9281        }
9282
9283        #[inline(always)]
9284        fn inline_size(_context: fidl::encoding::Context) -> usize {
9285            8
9286        }
9287    }
9288
9289    unsafe impl
9290        fidl::encoding::Encode<
9291            BaseRouteTableGetAuthorizationForRouteTableResponse,
9292            fidl::encoding::DefaultFuchsiaResourceDialect,
9293        > for &mut BaseRouteTableGetAuthorizationForRouteTableResponse
9294    {
9295        #[inline]
9296        unsafe fn encode(
9297            self,
9298            encoder: &mut fidl::encoding::Encoder<
9299                '_,
9300                fidl::encoding::DefaultFuchsiaResourceDialect,
9301            >,
9302            offset: usize,
9303            _depth: fidl::encoding::Depth,
9304        ) -> fidl::Result<()> {
9305            encoder
9306                .debug_check_bounds::<BaseRouteTableGetAuthorizationForRouteTableResponse>(offset);
9307            // Delegate to tuple encoding.
9308            fidl::encoding::Encode::<BaseRouteTableGetAuthorizationForRouteTableResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
9309                (
9310                    <GrantForRouteTableAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
9311                ),
9312                encoder, offset, _depth
9313            )
9314        }
9315    }
9316    unsafe impl<
9317            T0: fidl::encoding::Encode<
9318                GrantForRouteTableAuthorization,
9319                fidl::encoding::DefaultFuchsiaResourceDialect,
9320            >,
9321        >
9322        fidl::encoding::Encode<
9323            BaseRouteTableGetAuthorizationForRouteTableResponse,
9324            fidl::encoding::DefaultFuchsiaResourceDialect,
9325        > for (T0,)
9326    {
9327        #[inline]
9328        unsafe fn encode(
9329            self,
9330            encoder: &mut fidl::encoding::Encoder<
9331                '_,
9332                fidl::encoding::DefaultFuchsiaResourceDialect,
9333            >,
9334            offset: usize,
9335            depth: fidl::encoding::Depth,
9336        ) -> fidl::Result<()> {
9337            encoder
9338                .debug_check_bounds::<BaseRouteTableGetAuthorizationForRouteTableResponse>(offset);
9339            // Zero out padding regions. There's no need to apply masks
9340            // because the unmasked parts will be overwritten by fields.
9341            // Write the fields.
9342            self.0.encode(encoder, offset + 0, depth)?;
9343            Ok(())
9344        }
9345    }
9346
9347    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9348        for BaseRouteTableGetAuthorizationForRouteTableResponse
9349    {
9350        #[inline(always)]
9351        fn new_empty() -> Self {
9352            Self {
9353                credential: fidl::new_empty!(
9354                    GrantForRouteTableAuthorization,
9355                    fidl::encoding::DefaultFuchsiaResourceDialect
9356                ),
9357            }
9358        }
9359
9360        #[inline]
9361        unsafe fn decode(
9362            &mut self,
9363            decoder: &mut fidl::encoding::Decoder<
9364                '_,
9365                fidl::encoding::DefaultFuchsiaResourceDialect,
9366            >,
9367            offset: usize,
9368            _depth: fidl::encoding::Depth,
9369        ) -> fidl::Result<()> {
9370            decoder.debug_check_bounds::<Self>(offset);
9371            // Verify that padding bytes are zero.
9372            fidl::decode!(
9373                GrantForRouteTableAuthorization,
9374                fidl::encoding::DefaultFuchsiaResourceDialect,
9375                &mut self.credential,
9376                decoder,
9377                offset + 0,
9378                _depth
9379            )?;
9380            Ok(())
9381        }
9382    }
9383
9384    impl fidl::encoding::ValueTypeMarker for BaseRouteTableGetTableIdResponse {
9385        type Borrowed<'a> = &'a Self;
9386        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9387            value
9388        }
9389    }
9390
9391    unsafe impl fidl::encoding::TypeMarker for BaseRouteTableGetTableIdResponse {
9392        type Owned = Self;
9393
9394        #[inline(always)]
9395        fn inline_align(_context: fidl::encoding::Context) -> usize {
9396            4
9397        }
9398
9399        #[inline(always)]
9400        fn inline_size(_context: fidl::encoding::Context) -> usize {
9401            4
9402        }
9403        #[inline(always)]
9404        fn encode_is_copy() -> bool {
9405            true
9406        }
9407
9408        #[inline(always)]
9409        fn decode_is_copy() -> bool {
9410            true
9411        }
9412    }
9413
9414    unsafe impl<D: fidl::encoding::ResourceDialect>
9415        fidl::encoding::Encode<BaseRouteTableGetTableIdResponse, D>
9416        for &BaseRouteTableGetTableIdResponse
9417    {
9418        #[inline]
9419        unsafe fn encode(
9420            self,
9421            encoder: &mut fidl::encoding::Encoder<'_, D>,
9422            offset: usize,
9423            _depth: fidl::encoding::Depth,
9424        ) -> fidl::Result<()> {
9425            encoder.debug_check_bounds::<BaseRouteTableGetTableIdResponse>(offset);
9426            unsafe {
9427                // Copy the object into the buffer.
9428                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
9429                (buf_ptr as *mut BaseRouteTableGetTableIdResponse)
9430                    .write_unaligned((self as *const BaseRouteTableGetTableIdResponse).read());
9431                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
9432                // done second because the memcpy will write garbage to these bytes.
9433            }
9434            Ok(())
9435        }
9436    }
9437    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
9438        fidl::encoding::Encode<BaseRouteTableGetTableIdResponse, D> for (T0,)
9439    {
9440        #[inline]
9441        unsafe fn encode(
9442            self,
9443            encoder: &mut fidl::encoding::Encoder<'_, D>,
9444            offset: usize,
9445            depth: fidl::encoding::Depth,
9446        ) -> fidl::Result<()> {
9447            encoder.debug_check_bounds::<BaseRouteTableGetTableIdResponse>(offset);
9448            // Zero out padding regions. There's no need to apply masks
9449            // because the unmasked parts will be overwritten by fields.
9450            // Write the fields.
9451            self.0.encode(encoder, offset + 0, depth)?;
9452            Ok(())
9453        }
9454    }
9455
9456    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9457        for BaseRouteTableGetTableIdResponse
9458    {
9459        #[inline(always)]
9460        fn new_empty() -> Self {
9461            Self { table_id: fidl::new_empty!(u32, D) }
9462        }
9463
9464        #[inline]
9465        unsafe fn decode(
9466            &mut self,
9467            decoder: &mut fidl::encoding::Decoder<'_, D>,
9468            offset: usize,
9469            _depth: fidl::encoding::Depth,
9470        ) -> fidl::Result<()> {
9471            decoder.debug_check_bounds::<Self>(offset);
9472            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
9473            // Verify that padding bytes are zero.
9474            // Copy from the buffer into the object.
9475            unsafe {
9476                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
9477            }
9478            Ok(())
9479        }
9480    }
9481
9482    impl fidl::encoding::ValueTypeMarker for BaseRuleSetRemoveRuleRequest {
9483        type Borrowed<'a> = &'a Self;
9484        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
9485            value
9486        }
9487    }
9488
9489    unsafe impl fidl::encoding::TypeMarker for BaseRuleSetRemoveRuleRequest {
9490        type Owned = Self;
9491
9492        #[inline(always)]
9493        fn inline_align(_context: fidl::encoding::Context) -> usize {
9494            4
9495        }
9496
9497        #[inline(always)]
9498        fn inline_size(_context: fidl::encoding::Context) -> usize {
9499            4
9500        }
9501        #[inline(always)]
9502        fn encode_is_copy() -> bool {
9503            true
9504        }
9505
9506        #[inline(always)]
9507        fn decode_is_copy() -> bool {
9508            true
9509        }
9510    }
9511
9512    unsafe impl<D: fidl::encoding::ResourceDialect>
9513        fidl::encoding::Encode<BaseRuleSetRemoveRuleRequest, D> for &BaseRuleSetRemoveRuleRequest
9514    {
9515        #[inline]
9516        unsafe fn encode(
9517            self,
9518            encoder: &mut fidl::encoding::Encoder<'_, D>,
9519            offset: usize,
9520            _depth: fidl::encoding::Depth,
9521        ) -> fidl::Result<()> {
9522            encoder.debug_check_bounds::<BaseRuleSetRemoveRuleRequest>(offset);
9523            unsafe {
9524                // Copy the object into the buffer.
9525                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
9526                (buf_ptr as *mut BaseRuleSetRemoveRuleRequest)
9527                    .write_unaligned((self as *const BaseRuleSetRemoveRuleRequest).read());
9528                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
9529                // done second because the memcpy will write garbage to these bytes.
9530            }
9531            Ok(())
9532        }
9533    }
9534    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
9535        fidl::encoding::Encode<BaseRuleSetRemoveRuleRequest, D> for (T0,)
9536    {
9537        #[inline]
9538        unsafe fn encode(
9539            self,
9540            encoder: &mut fidl::encoding::Encoder<'_, D>,
9541            offset: usize,
9542            depth: fidl::encoding::Depth,
9543        ) -> fidl::Result<()> {
9544            encoder.debug_check_bounds::<BaseRuleSetRemoveRuleRequest>(offset);
9545            // Zero out padding regions. There's no need to apply masks
9546            // because the unmasked parts will be overwritten by fields.
9547            // Write the fields.
9548            self.0.encode(encoder, offset + 0, depth)?;
9549            Ok(())
9550        }
9551    }
9552
9553    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
9554        for BaseRuleSetRemoveRuleRequest
9555    {
9556        #[inline(always)]
9557        fn new_empty() -> Self {
9558            Self { index: fidl::new_empty!(u32, D) }
9559        }
9560
9561        #[inline]
9562        unsafe fn decode(
9563            &mut self,
9564            decoder: &mut fidl::encoding::Decoder<'_, D>,
9565            offset: usize,
9566            _depth: fidl::encoding::Depth,
9567        ) -> fidl::Result<()> {
9568            decoder.debug_check_bounds::<Self>(offset);
9569            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
9570            // Verify that padding bytes are zero.
9571            // Copy from the buffer into the object.
9572            unsafe {
9573                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
9574            }
9575            Ok(())
9576        }
9577    }
9578
9579    impl fidl::encoding::ResourceTypeMarker for GrantForRouteTableAuthorization {
9580        type Borrowed<'a> = &'a mut Self;
9581        fn take_or_borrow<'a>(
9582            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9583        ) -> Self::Borrowed<'a> {
9584            value
9585        }
9586    }
9587
9588    unsafe impl fidl::encoding::TypeMarker for GrantForRouteTableAuthorization {
9589        type Owned = Self;
9590
9591        #[inline(always)]
9592        fn inline_align(_context: fidl::encoding::Context) -> usize {
9593            4
9594        }
9595
9596        #[inline(always)]
9597        fn inline_size(_context: fidl::encoding::Context) -> usize {
9598            8
9599        }
9600    }
9601
9602    unsafe impl
9603        fidl::encoding::Encode<
9604            GrantForRouteTableAuthorization,
9605            fidl::encoding::DefaultFuchsiaResourceDialect,
9606        > for &mut GrantForRouteTableAuthorization
9607    {
9608        #[inline]
9609        unsafe fn encode(
9610            self,
9611            encoder: &mut fidl::encoding::Encoder<
9612                '_,
9613                fidl::encoding::DefaultFuchsiaResourceDialect,
9614            >,
9615            offset: usize,
9616            _depth: fidl::encoding::Depth,
9617        ) -> fidl::Result<()> {
9618            encoder.debug_check_bounds::<GrantForRouteTableAuthorization>(offset);
9619            // Delegate to tuple encoding.
9620            fidl::encoding::Encode::<
9621                GrantForRouteTableAuthorization,
9622                fidl::encoding::DefaultFuchsiaResourceDialect,
9623            >::encode(
9624                (
9625                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.table_id),
9626                    <fidl::encoding::HandleType<
9627                        fidl::Event,
9628                        { fidl::ObjectType::EVENT.into_raw() },
9629                        3,
9630                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9631                        &mut self.token
9632                    ),
9633                ),
9634                encoder,
9635                offset,
9636                _depth,
9637            )
9638        }
9639    }
9640    unsafe impl<
9641            T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
9642            T1: fidl::encoding::Encode<
9643                fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 3>,
9644                fidl::encoding::DefaultFuchsiaResourceDialect,
9645            >,
9646        >
9647        fidl::encoding::Encode<
9648            GrantForRouteTableAuthorization,
9649            fidl::encoding::DefaultFuchsiaResourceDialect,
9650        > for (T0, T1)
9651    {
9652        #[inline]
9653        unsafe fn encode(
9654            self,
9655            encoder: &mut fidl::encoding::Encoder<
9656                '_,
9657                fidl::encoding::DefaultFuchsiaResourceDialect,
9658            >,
9659            offset: usize,
9660            depth: fidl::encoding::Depth,
9661        ) -> fidl::Result<()> {
9662            encoder.debug_check_bounds::<GrantForRouteTableAuthorization>(offset);
9663            // Zero out padding regions. There's no need to apply masks
9664            // because the unmasked parts will be overwritten by fields.
9665            // Write the fields.
9666            self.0.encode(encoder, offset + 0, depth)?;
9667            self.1.encode(encoder, offset + 4, depth)?;
9668            Ok(())
9669        }
9670    }
9671
9672    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9673        for GrantForRouteTableAuthorization
9674    {
9675        #[inline(always)]
9676        fn new_empty() -> Self {
9677            Self {
9678                table_id: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
9679                token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 3>, fidl::encoding::DefaultFuchsiaResourceDialect),
9680            }
9681        }
9682
9683        #[inline]
9684        unsafe fn decode(
9685            &mut self,
9686            decoder: &mut fidl::encoding::Decoder<
9687                '_,
9688                fidl::encoding::DefaultFuchsiaResourceDialect,
9689            >,
9690            offset: usize,
9691            _depth: fidl::encoding::Depth,
9692        ) -> fidl::Result<()> {
9693            decoder.debug_check_bounds::<Self>(offset);
9694            // Verify that padding bytes are zero.
9695            fidl::decode!(
9696                u32,
9697                fidl::encoding::DefaultFuchsiaResourceDialect,
9698                &mut self.table_id,
9699                decoder,
9700                offset + 0,
9701                _depth
9702            )?;
9703            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 3>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 4, _depth)?;
9704            Ok(())
9705        }
9706    }
9707
9708    impl fidl::encoding::ResourceTypeMarker for ProofOfRouteTableAuthorization {
9709        type Borrowed<'a> = &'a mut Self;
9710        fn take_or_borrow<'a>(
9711            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9712        ) -> Self::Borrowed<'a> {
9713            value
9714        }
9715    }
9716
9717    unsafe impl fidl::encoding::TypeMarker for ProofOfRouteTableAuthorization {
9718        type Owned = Self;
9719
9720        #[inline(always)]
9721        fn inline_align(_context: fidl::encoding::Context) -> usize {
9722            4
9723        }
9724
9725        #[inline(always)]
9726        fn inline_size(_context: fidl::encoding::Context) -> usize {
9727            8
9728        }
9729    }
9730
9731    unsafe impl
9732        fidl::encoding::Encode<
9733            ProofOfRouteTableAuthorization,
9734            fidl::encoding::DefaultFuchsiaResourceDialect,
9735        > for &mut ProofOfRouteTableAuthorization
9736    {
9737        #[inline]
9738        unsafe fn encode(
9739            self,
9740            encoder: &mut fidl::encoding::Encoder<
9741                '_,
9742                fidl::encoding::DefaultFuchsiaResourceDialect,
9743            >,
9744            offset: usize,
9745            _depth: fidl::encoding::Depth,
9746        ) -> fidl::Result<()> {
9747            encoder.debug_check_bounds::<ProofOfRouteTableAuthorization>(offset);
9748            // Delegate to tuple encoding.
9749            fidl::encoding::Encode::<
9750                ProofOfRouteTableAuthorization,
9751                fidl::encoding::DefaultFuchsiaResourceDialect,
9752            >::encode(
9753                (
9754                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.table),
9755                    <fidl::encoding::HandleType<
9756                        fidl::Event,
9757                        { fidl::ObjectType::EVENT.into_raw() },
9758                        0,
9759                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
9760                        &mut self.token
9761                    ),
9762                ),
9763                encoder,
9764                offset,
9765                _depth,
9766            )
9767        }
9768    }
9769    unsafe impl<
9770            T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
9771            T1: fidl::encoding::Encode<
9772                fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 0>,
9773                fidl::encoding::DefaultFuchsiaResourceDialect,
9774            >,
9775        >
9776        fidl::encoding::Encode<
9777            ProofOfRouteTableAuthorization,
9778            fidl::encoding::DefaultFuchsiaResourceDialect,
9779        > for (T0, T1)
9780    {
9781        #[inline]
9782        unsafe fn encode(
9783            self,
9784            encoder: &mut fidl::encoding::Encoder<
9785                '_,
9786                fidl::encoding::DefaultFuchsiaResourceDialect,
9787            >,
9788            offset: usize,
9789            depth: fidl::encoding::Depth,
9790        ) -> fidl::Result<()> {
9791            encoder.debug_check_bounds::<ProofOfRouteTableAuthorization>(offset);
9792            // Zero out padding regions. There's no need to apply masks
9793            // because the unmasked parts will be overwritten by fields.
9794            // Write the fields.
9795            self.0.encode(encoder, offset + 0, depth)?;
9796            self.1.encode(encoder, offset + 4, depth)?;
9797            Ok(())
9798        }
9799    }
9800
9801    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9802        for ProofOfRouteTableAuthorization
9803    {
9804        #[inline(always)]
9805        fn new_empty() -> Self {
9806            Self {
9807                table: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
9808                token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 0>, fidl::encoding::DefaultFuchsiaResourceDialect),
9809            }
9810        }
9811
9812        #[inline]
9813        unsafe fn decode(
9814            &mut self,
9815            decoder: &mut fidl::encoding::Decoder<
9816                '_,
9817                fidl::encoding::DefaultFuchsiaResourceDialect,
9818            >,
9819            offset: usize,
9820            _depth: fidl::encoding::Depth,
9821        ) -> fidl::Result<()> {
9822            decoder.debug_check_bounds::<Self>(offset);
9823            // Verify that padding bytes are zero.
9824            fidl::decode!(
9825                u32,
9826                fidl::encoding::DefaultFuchsiaResourceDialect,
9827                &mut self.table,
9828                decoder,
9829                offset + 0,
9830                _depth
9831            )?;
9832            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 0>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 4, _depth)?;
9833            Ok(())
9834        }
9835    }
9836
9837    impl fidl::encoding::ResourceTypeMarker for RouteSetV4AddRouteRequest {
9838        type Borrowed<'a> = &'a mut Self;
9839        fn take_or_borrow<'a>(
9840            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9841        ) -> Self::Borrowed<'a> {
9842            value
9843        }
9844    }
9845
9846    unsafe impl fidl::encoding::TypeMarker for RouteSetV4AddRouteRequest {
9847        type Owned = Self;
9848
9849        #[inline(always)]
9850        fn inline_align(_context: fidl::encoding::Context) -> usize {
9851            8
9852        }
9853
9854        #[inline(always)]
9855        fn inline_size(_context: fidl::encoding::Context) -> usize {
9856            40
9857        }
9858    }
9859
9860    unsafe impl
9861        fidl::encoding::Encode<
9862            RouteSetV4AddRouteRequest,
9863            fidl::encoding::DefaultFuchsiaResourceDialect,
9864        > for &mut RouteSetV4AddRouteRequest
9865    {
9866        #[inline]
9867        unsafe fn encode(
9868            self,
9869            encoder: &mut fidl::encoding::Encoder<
9870                '_,
9871                fidl::encoding::DefaultFuchsiaResourceDialect,
9872            >,
9873            offset: usize,
9874            _depth: fidl::encoding::Depth,
9875        ) -> fidl::Result<()> {
9876            encoder.debug_check_bounds::<RouteSetV4AddRouteRequest>(offset);
9877            // Delegate to tuple encoding.
9878            fidl::encoding::Encode::<
9879                RouteSetV4AddRouteRequest,
9880                fidl::encoding::DefaultFuchsiaResourceDialect,
9881            >::encode(
9882                (<fidl_fuchsia_net_routes::RouteV4 as fidl::encoding::ValueTypeMarker>::borrow(
9883                    &self.route,
9884                ),),
9885                encoder,
9886                offset,
9887                _depth,
9888            )
9889        }
9890    }
9891    unsafe impl<
9892            T0: fidl::encoding::Encode<
9893                fidl_fuchsia_net_routes::RouteV4,
9894                fidl::encoding::DefaultFuchsiaResourceDialect,
9895            >,
9896        >
9897        fidl::encoding::Encode<
9898            RouteSetV4AddRouteRequest,
9899            fidl::encoding::DefaultFuchsiaResourceDialect,
9900        > for (T0,)
9901    {
9902        #[inline]
9903        unsafe fn encode(
9904            self,
9905            encoder: &mut fidl::encoding::Encoder<
9906                '_,
9907                fidl::encoding::DefaultFuchsiaResourceDialect,
9908            >,
9909            offset: usize,
9910            depth: fidl::encoding::Depth,
9911        ) -> fidl::Result<()> {
9912            encoder.debug_check_bounds::<RouteSetV4AddRouteRequest>(offset);
9913            // Zero out padding regions. There's no need to apply masks
9914            // because the unmasked parts will be overwritten by fields.
9915            // Write the fields.
9916            self.0.encode(encoder, offset + 0, depth)?;
9917            Ok(())
9918        }
9919    }
9920
9921    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
9922        for RouteSetV4AddRouteRequest
9923    {
9924        #[inline(always)]
9925        fn new_empty() -> Self {
9926            Self {
9927                route: fidl::new_empty!(
9928                    fidl_fuchsia_net_routes::RouteV4,
9929                    fidl::encoding::DefaultFuchsiaResourceDialect
9930                ),
9931            }
9932        }
9933
9934        #[inline]
9935        unsafe fn decode(
9936            &mut self,
9937            decoder: &mut fidl::encoding::Decoder<
9938                '_,
9939                fidl::encoding::DefaultFuchsiaResourceDialect,
9940            >,
9941            offset: usize,
9942            _depth: fidl::encoding::Depth,
9943        ) -> fidl::Result<()> {
9944            decoder.debug_check_bounds::<Self>(offset);
9945            // Verify that padding bytes are zero.
9946            fidl::decode!(
9947                fidl_fuchsia_net_routes::RouteV4,
9948                fidl::encoding::DefaultFuchsiaResourceDialect,
9949                &mut self.route,
9950                decoder,
9951                offset + 0,
9952                _depth
9953            )?;
9954            Ok(())
9955        }
9956    }
9957
9958    impl fidl::encoding::ResourceTypeMarker for RouteSetV4AuthenticateForInterfaceRequest {
9959        type Borrowed<'a> = &'a mut Self;
9960        fn take_or_borrow<'a>(
9961            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
9962        ) -> Self::Borrowed<'a> {
9963            value
9964        }
9965    }
9966
9967    unsafe impl fidl::encoding::TypeMarker for RouteSetV4AuthenticateForInterfaceRequest {
9968        type Owned = Self;
9969
9970        #[inline(always)]
9971        fn inline_align(_context: fidl::encoding::Context) -> usize {
9972            8
9973        }
9974
9975        #[inline(always)]
9976        fn inline_size(_context: fidl::encoding::Context) -> usize {
9977            16
9978        }
9979    }
9980
9981    unsafe impl
9982        fidl::encoding::Encode<
9983            RouteSetV4AuthenticateForInterfaceRequest,
9984            fidl::encoding::DefaultFuchsiaResourceDialect,
9985        > for &mut RouteSetV4AuthenticateForInterfaceRequest
9986    {
9987        #[inline]
9988        unsafe fn encode(
9989            self,
9990            encoder: &mut fidl::encoding::Encoder<
9991                '_,
9992                fidl::encoding::DefaultFuchsiaResourceDialect,
9993            >,
9994            offset: usize,
9995            _depth: fidl::encoding::Depth,
9996        ) -> fidl::Result<()> {
9997            encoder.debug_check_bounds::<RouteSetV4AuthenticateForInterfaceRequest>(offset);
9998            // Delegate to tuple encoding.
9999            fidl::encoding::Encode::<RouteSetV4AuthenticateForInterfaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10000                (
10001                    <fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
10002                ),
10003                encoder, offset, _depth
10004            )
10005        }
10006    }
10007    unsafe impl<
10008            T0: fidl::encoding::Encode<
10009                fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
10010                fidl::encoding::DefaultFuchsiaResourceDialect,
10011            >,
10012        >
10013        fidl::encoding::Encode<
10014            RouteSetV4AuthenticateForInterfaceRequest,
10015            fidl::encoding::DefaultFuchsiaResourceDialect,
10016        > for (T0,)
10017    {
10018        #[inline]
10019        unsafe fn encode(
10020            self,
10021            encoder: &mut fidl::encoding::Encoder<
10022                '_,
10023                fidl::encoding::DefaultFuchsiaResourceDialect,
10024            >,
10025            offset: usize,
10026            depth: fidl::encoding::Depth,
10027        ) -> fidl::Result<()> {
10028            encoder.debug_check_bounds::<RouteSetV4AuthenticateForInterfaceRequest>(offset);
10029            // Zero out padding regions. There's no need to apply masks
10030            // because the unmasked parts will be overwritten by fields.
10031            // Write the fields.
10032            self.0.encode(encoder, offset + 0, depth)?;
10033            Ok(())
10034        }
10035    }
10036
10037    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10038        for RouteSetV4AuthenticateForInterfaceRequest
10039    {
10040        #[inline(always)]
10041        fn new_empty() -> Self {
10042            Self {
10043                credential: fidl::new_empty!(
10044                    fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
10045                    fidl::encoding::DefaultFuchsiaResourceDialect
10046                ),
10047            }
10048        }
10049
10050        #[inline]
10051        unsafe fn decode(
10052            &mut self,
10053            decoder: &mut fidl::encoding::Decoder<
10054                '_,
10055                fidl::encoding::DefaultFuchsiaResourceDialect,
10056            >,
10057            offset: usize,
10058            _depth: fidl::encoding::Depth,
10059        ) -> fidl::Result<()> {
10060            decoder.debug_check_bounds::<Self>(offset);
10061            // Verify that padding bytes are zero.
10062            fidl::decode!(
10063                fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
10064                fidl::encoding::DefaultFuchsiaResourceDialect,
10065                &mut self.credential,
10066                decoder,
10067                offset + 0,
10068                _depth
10069            )?;
10070            Ok(())
10071        }
10072    }
10073
10074    impl fidl::encoding::ResourceTypeMarker for RouteSetV4RemoveRouteRequest {
10075        type Borrowed<'a> = &'a mut Self;
10076        fn take_or_borrow<'a>(
10077            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10078        ) -> Self::Borrowed<'a> {
10079            value
10080        }
10081    }
10082
10083    unsafe impl fidl::encoding::TypeMarker for RouteSetV4RemoveRouteRequest {
10084        type Owned = Self;
10085
10086        #[inline(always)]
10087        fn inline_align(_context: fidl::encoding::Context) -> usize {
10088            8
10089        }
10090
10091        #[inline(always)]
10092        fn inline_size(_context: fidl::encoding::Context) -> usize {
10093            40
10094        }
10095    }
10096
10097    unsafe impl
10098        fidl::encoding::Encode<
10099            RouteSetV4RemoveRouteRequest,
10100            fidl::encoding::DefaultFuchsiaResourceDialect,
10101        > for &mut RouteSetV4RemoveRouteRequest
10102    {
10103        #[inline]
10104        unsafe fn encode(
10105            self,
10106            encoder: &mut fidl::encoding::Encoder<
10107                '_,
10108                fidl::encoding::DefaultFuchsiaResourceDialect,
10109            >,
10110            offset: usize,
10111            _depth: fidl::encoding::Depth,
10112        ) -> fidl::Result<()> {
10113            encoder.debug_check_bounds::<RouteSetV4RemoveRouteRequest>(offset);
10114            // Delegate to tuple encoding.
10115            fidl::encoding::Encode::<
10116                RouteSetV4RemoveRouteRequest,
10117                fidl::encoding::DefaultFuchsiaResourceDialect,
10118            >::encode(
10119                (<fidl_fuchsia_net_routes::RouteV4 as fidl::encoding::ValueTypeMarker>::borrow(
10120                    &self.route,
10121                ),),
10122                encoder,
10123                offset,
10124                _depth,
10125            )
10126        }
10127    }
10128    unsafe impl<
10129            T0: fidl::encoding::Encode<
10130                fidl_fuchsia_net_routes::RouteV4,
10131                fidl::encoding::DefaultFuchsiaResourceDialect,
10132            >,
10133        >
10134        fidl::encoding::Encode<
10135            RouteSetV4RemoveRouteRequest,
10136            fidl::encoding::DefaultFuchsiaResourceDialect,
10137        > for (T0,)
10138    {
10139        #[inline]
10140        unsafe fn encode(
10141            self,
10142            encoder: &mut fidl::encoding::Encoder<
10143                '_,
10144                fidl::encoding::DefaultFuchsiaResourceDialect,
10145            >,
10146            offset: usize,
10147            depth: fidl::encoding::Depth,
10148        ) -> fidl::Result<()> {
10149            encoder.debug_check_bounds::<RouteSetV4RemoveRouteRequest>(offset);
10150            // Zero out padding regions. There's no need to apply masks
10151            // because the unmasked parts will be overwritten by fields.
10152            // Write the fields.
10153            self.0.encode(encoder, offset + 0, depth)?;
10154            Ok(())
10155        }
10156    }
10157
10158    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10159        for RouteSetV4RemoveRouteRequest
10160    {
10161        #[inline(always)]
10162        fn new_empty() -> Self {
10163            Self {
10164                route: fidl::new_empty!(
10165                    fidl_fuchsia_net_routes::RouteV4,
10166                    fidl::encoding::DefaultFuchsiaResourceDialect
10167                ),
10168            }
10169        }
10170
10171        #[inline]
10172        unsafe fn decode(
10173            &mut self,
10174            decoder: &mut fidl::encoding::Decoder<
10175                '_,
10176                fidl::encoding::DefaultFuchsiaResourceDialect,
10177            >,
10178            offset: usize,
10179            _depth: fidl::encoding::Depth,
10180        ) -> fidl::Result<()> {
10181            decoder.debug_check_bounds::<Self>(offset);
10182            // Verify that padding bytes are zero.
10183            fidl::decode!(
10184                fidl_fuchsia_net_routes::RouteV4,
10185                fidl::encoding::DefaultFuchsiaResourceDialect,
10186                &mut self.route,
10187                decoder,
10188                offset + 0,
10189                _depth
10190            )?;
10191            Ok(())
10192        }
10193    }
10194
10195    impl fidl::encoding::ValueTypeMarker for RouteSetV4AddRouteResponse {
10196        type Borrowed<'a> = &'a Self;
10197        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10198            value
10199        }
10200    }
10201
10202    unsafe impl fidl::encoding::TypeMarker for RouteSetV4AddRouteResponse {
10203        type Owned = Self;
10204
10205        #[inline(always)]
10206        fn inline_align(_context: fidl::encoding::Context) -> usize {
10207            1
10208        }
10209
10210        #[inline(always)]
10211        fn inline_size(_context: fidl::encoding::Context) -> usize {
10212            1
10213        }
10214    }
10215
10216    unsafe impl<D: fidl::encoding::ResourceDialect>
10217        fidl::encoding::Encode<RouteSetV4AddRouteResponse, D> for &RouteSetV4AddRouteResponse
10218    {
10219        #[inline]
10220        unsafe fn encode(
10221            self,
10222            encoder: &mut fidl::encoding::Encoder<'_, D>,
10223            offset: usize,
10224            _depth: fidl::encoding::Depth,
10225        ) -> fidl::Result<()> {
10226            encoder.debug_check_bounds::<RouteSetV4AddRouteResponse>(offset);
10227            // Delegate to tuple encoding.
10228            fidl::encoding::Encode::<RouteSetV4AddRouteResponse, D>::encode(
10229                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.did_add),),
10230                encoder,
10231                offset,
10232                _depth,
10233            )
10234        }
10235    }
10236    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
10237        fidl::encoding::Encode<RouteSetV4AddRouteResponse, D> for (T0,)
10238    {
10239        #[inline]
10240        unsafe fn encode(
10241            self,
10242            encoder: &mut fidl::encoding::Encoder<'_, D>,
10243            offset: usize,
10244            depth: fidl::encoding::Depth,
10245        ) -> fidl::Result<()> {
10246            encoder.debug_check_bounds::<RouteSetV4AddRouteResponse>(offset);
10247            // Zero out padding regions. There's no need to apply masks
10248            // because the unmasked parts will be overwritten by fields.
10249            // Write the fields.
10250            self.0.encode(encoder, offset + 0, depth)?;
10251            Ok(())
10252        }
10253    }
10254
10255    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
10256        for RouteSetV4AddRouteResponse
10257    {
10258        #[inline(always)]
10259        fn new_empty() -> Self {
10260            Self { did_add: fidl::new_empty!(bool, D) }
10261        }
10262
10263        #[inline]
10264        unsafe fn decode(
10265            &mut self,
10266            decoder: &mut fidl::encoding::Decoder<'_, D>,
10267            offset: usize,
10268            _depth: fidl::encoding::Depth,
10269        ) -> fidl::Result<()> {
10270            decoder.debug_check_bounds::<Self>(offset);
10271            // Verify that padding bytes are zero.
10272            fidl::decode!(bool, D, &mut self.did_add, decoder, offset + 0, _depth)?;
10273            Ok(())
10274        }
10275    }
10276
10277    impl fidl::encoding::ValueTypeMarker for RouteSetV4RemoveRouteResponse {
10278        type Borrowed<'a> = &'a Self;
10279        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10280            value
10281        }
10282    }
10283
10284    unsafe impl fidl::encoding::TypeMarker for RouteSetV4RemoveRouteResponse {
10285        type Owned = Self;
10286
10287        #[inline(always)]
10288        fn inline_align(_context: fidl::encoding::Context) -> usize {
10289            1
10290        }
10291
10292        #[inline(always)]
10293        fn inline_size(_context: fidl::encoding::Context) -> usize {
10294            1
10295        }
10296    }
10297
10298    unsafe impl<D: fidl::encoding::ResourceDialect>
10299        fidl::encoding::Encode<RouteSetV4RemoveRouteResponse, D>
10300        for &RouteSetV4RemoveRouteResponse
10301    {
10302        #[inline]
10303        unsafe fn encode(
10304            self,
10305            encoder: &mut fidl::encoding::Encoder<'_, D>,
10306            offset: usize,
10307            _depth: fidl::encoding::Depth,
10308        ) -> fidl::Result<()> {
10309            encoder.debug_check_bounds::<RouteSetV4RemoveRouteResponse>(offset);
10310            // Delegate to tuple encoding.
10311            fidl::encoding::Encode::<RouteSetV4RemoveRouteResponse, D>::encode(
10312                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.did_remove),),
10313                encoder,
10314                offset,
10315                _depth,
10316            )
10317        }
10318    }
10319    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
10320        fidl::encoding::Encode<RouteSetV4RemoveRouteResponse, D> for (T0,)
10321    {
10322        #[inline]
10323        unsafe fn encode(
10324            self,
10325            encoder: &mut fidl::encoding::Encoder<'_, D>,
10326            offset: usize,
10327            depth: fidl::encoding::Depth,
10328        ) -> fidl::Result<()> {
10329            encoder.debug_check_bounds::<RouteSetV4RemoveRouteResponse>(offset);
10330            // Zero out padding regions. There's no need to apply masks
10331            // because the unmasked parts will be overwritten by fields.
10332            // Write the fields.
10333            self.0.encode(encoder, offset + 0, depth)?;
10334            Ok(())
10335        }
10336    }
10337
10338    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
10339        for RouteSetV4RemoveRouteResponse
10340    {
10341        #[inline(always)]
10342        fn new_empty() -> Self {
10343            Self { did_remove: fidl::new_empty!(bool, D) }
10344        }
10345
10346        #[inline]
10347        unsafe fn decode(
10348            &mut self,
10349            decoder: &mut fidl::encoding::Decoder<'_, D>,
10350            offset: usize,
10351            _depth: fidl::encoding::Depth,
10352        ) -> fidl::Result<()> {
10353            decoder.debug_check_bounds::<Self>(offset);
10354            // Verify that padding bytes are zero.
10355            fidl::decode!(bool, D, &mut self.did_remove, decoder, offset + 0, _depth)?;
10356            Ok(())
10357        }
10358    }
10359
10360    impl fidl::encoding::ResourceTypeMarker for RouteSetV6AddRouteRequest {
10361        type Borrowed<'a> = &'a mut Self;
10362        fn take_or_borrow<'a>(
10363            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10364        ) -> Self::Borrowed<'a> {
10365            value
10366        }
10367    }
10368
10369    unsafe impl fidl::encoding::TypeMarker for RouteSetV6AddRouteRequest {
10370        type Owned = Self;
10371
10372        #[inline(always)]
10373        fn inline_align(_context: fidl::encoding::Context) -> usize {
10374            8
10375        }
10376
10377        #[inline(always)]
10378        fn inline_size(_context: fidl::encoding::Context) -> usize {
10379            56
10380        }
10381    }
10382
10383    unsafe impl
10384        fidl::encoding::Encode<
10385            RouteSetV6AddRouteRequest,
10386            fidl::encoding::DefaultFuchsiaResourceDialect,
10387        > for &mut RouteSetV6AddRouteRequest
10388    {
10389        #[inline]
10390        unsafe fn encode(
10391            self,
10392            encoder: &mut fidl::encoding::Encoder<
10393                '_,
10394                fidl::encoding::DefaultFuchsiaResourceDialect,
10395            >,
10396            offset: usize,
10397            _depth: fidl::encoding::Depth,
10398        ) -> fidl::Result<()> {
10399            encoder.debug_check_bounds::<RouteSetV6AddRouteRequest>(offset);
10400            // Delegate to tuple encoding.
10401            fidl::encoding::Encode::<
10402                RouteSetV6AddRouteRequest,
10403                fidl::encoding::DefaultFuchsiaResourceDialect,
10404            >::encode(
10405                (<fidl_fuchsia_net_routes::RouteV6 as fidl::encoding::ValueTypeMarker>::borrow(
10406                    &self.route,
10407                ),),
10408                encoder,
10409                offset,
10410                _depth,
10411            )
10412        }
10413    }
10414    unsafe impl<
10415            T0: fidl::encoding::Encode<
10416                fidl_fuchsia_net_routes::RouteV6,
10417                fidl::encoding::DefaultFuchsiaResourceDialect,
10418            >,
10419        >
10420        fidl::encoding::Encode<
10421            RouteSetV6AddRouteRequest,
10422            fidl::encoding::DefaultFuchsiaResourceDialect,
10423        > for (T0,)
10424    {
10425        #[inline]
10426        unsafe fn encode(
10427            self,
10428            encoder: &mut fidl::encoding::Encoder<
10429                '_,
10430                fidl::encoding::DefaultFuchsiaResourceDialect,
10431            >,
10432            offset: usize,
10433            depth: fidl::encoding::Depth,
10434        ) -> fidl::Result<()> {
10435            encoder.debug_check_bounds::<RouteSetV6AddRouteRequest>(offset);
10436            // Zero out padding regions. There's no need to apply masks
10437            // because the unmasked parts will be overwritten by fields.
10438            // Write the fields.
10439            self.0.encode(encoder, offset + 0, depth)?;
10440            Ok(())
10441        }
10442    }
10443
10444    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10445        for RouteSetV6AddRouteRequest
10446    {
10447        #[inline(always)]
10448        fn new_empty() -> Self {
10449            Self {
10450                route: fidl::new_empty!(
10451                    fidl_fuchsia_net_routes::RouteV6,
10452                    fidl::encoding::DefaultFuchsiaResourceDialect
10453                ),
10454            }
10455        }
10456
10457        #[inline]
10458        unsafe fn decode(
10459            &mut self,
10460            decoder: &mut fidl::encoding::Decoder<
10461                '_,
10462                fidl::encoding::DefaultFuchsiaResourceDialect,
10463            >,
10464            offset: usize,
10465            _depth: fidl::encoding::Depth,
10466        ) -> fidl::Result<()> {
10467            decoder.debug_check_bounds::<Self>(offset);
10468            // Verify that padding bytes are zero.
10469            fidl::decode!(
10470                fidl_fuchsia_net_routes::RouteV6,
10471                fidl::encoding::DefaultFuchsiaResourceDialect,
10472                &mut self.route,
10473                decoder,
10474                offset + 0,
10475                _depth
10476            )?;
10477            Ok(())
10478        }
10479    }
10480
10481    impl fidl::encoding::ResourceTypeMarker for RouteSetV6AuthenticateForInterfaceRequest {
10482        type Borrowed<'a> = &'a mut Self;
10483        fn take_or_borrow<'a>(
10484            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10485        ) -> Self::Borrowed<'a> {
10486            value
10487        }
10488    }
10489
10490    unsafe impl fidl::encoding::TypeMarker for RouteSetV6AuthenticateForInterfaceRequest {
10491        type Owned = Self;
10492
10493        #[inline(always)]
10494        fn inline_align(_context: fidl::encoding::Context) -> usize {
10495            8
10496        }
10497
10498        #[inline(always)]
10499        fn inline_size(_context: fidl::encoding::Context) -> usize {
10500            16
10501        }
10502    }
10503
10504    unsafe impl
10505        fidl::encoding::Encode<
10506            RouteSetV6AuthenticateForInterfaceRequest,
10507            fidl::encoding::DefaultFuchsiaResourceDialect,
10508        > for &mut RouteSetV6AuthenticateForInterfaceRequest
10509    {
10510        #[inline]
10511        unsafe fn encode(
10512            self,
10513            encoder: &mut fidl::encoding::Encoder<
10514                '_,
10515                fidl::encoding::DefaultFuchsiaResourceDialect,
10516            >,
10517            offset: usize,
10518            _depth: fidl::encoding::Depth,
10519        ) -> fidl::Result<()> {
10520            encoder.debug_check_bounds::<RouteSetV6AuthenticateForInterfaceRequest>(offset);
10521            // Delegate to tuple encoding.
10522            fidl::encoding::Encode::<RouteSetV6AuthenticateForInterfaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10523                (
10524                    <fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
10525                ),
10526                encoder, offset, _depth
10527            )
10528        }
10529    }
10530    unsafe impl<
10531            T0: fidl::encoding::Encode<
10532                fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
10533                fidl::encoding::DefaultFuchsiaResourceDialect,
10534            >,
10535        >
10536        fidl::encoding::Encode<
10537            RouteSetV6AuthenticateForInterfaceRequest,
10538            fidl::encoding::DefaultFuchsiaResourceDialect,
10539        > for (T0,)
10540    {
10541        #[inline]
10542        unsafe fn encode(
10543            self,
10544            encoder: &mut fidl::encoding::Encoder<
10545                '_,
10546                fidl::encoding::DefaultFuchsiaResourceDialect,
10547            >,
10548            offset: usize,
10549            depth: fidl::encoding::Depth,
10550        ) -> fidl::Result<()> {
10551            encoder.debug_check_bounds::<RouteSetV6AuthenticateForInterfaceRequest>(offset);
10552            // Zero out padding regions. There's no need to apply masks
10553            // because the unmasked parts will be overwritten by fields.
10554            // Write the fields.
10555            self.0.encode(encoder, offset + 0, depth)?;
10556            Ok(())
10557        }
10558    }
10559
10560    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10561        for RouteSetV6AuthenticateForInterfaceRequest
10562    {
10563        #[inline(always)]
10564        fn new_empty() -> Self {
10565            Self {
10566                credential: fidl::new_empty!(
10567                    fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
10568                    fidl::encoding::DefaultFuchsiaResourceDialect
10569                ),
10570            }
10571        }
10572
10573        #[inline]
10574        unsafe fn decode(
10575            &mut self,
10576            decoder: &mut fidl::encoding::Decoder<
10577                '_,
10578                fidl::encoding::DefaultFuchsiaResourceDialect,
10579            >,
10580            offset: usize,
10581            _depth: fidl::encoding::Depth,
10582        ) -> fidl::Result<()> {
10583            decoder.debug_check_bounds::<Self>(offset);
10584            // Verify that padding bytes are zero.
10585            fidl::decode!(
10586                fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
10587                fidl::encoding::DefaultFuchsiaResourceDialect,
10588                &mut self.credential,
10589                decoder,
10590                offset + 0,
10591                _depth
10592            )?;
10593            Ok(())
10594        }
10595    }
10596
10597    impl fidl::encoding::ResourceTypeMarker for RouteSetV6RemoveRouteRequest {
10598        type Borrowed<'a> = &'a mut Self;
10599        fn take_or_borrow<'a>(
10600            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10601        ) -> Self::Borrowed<'a> {
10602            value
10603        }
10604    }
10605
10606    unsafe impl fidl::encoding::TypeMarker for RouteSetV6RemoveRouteRequest {
10607        type Owned = Self;
10608
10609        #[inline(always)]
10610        fn inline_align(_context: fidl::encoding::Context) -> usize {
10611            8
10612        }
10613
10614        #[inline(always)]
10615        fn inline_size(_context: fidl::encoding::Context) -> usize {
10616            56
10617        }
10618    }
10619
10620    unsafe impl
10621        fidl::encoding::Encode<
10622            RouteSetV6RemoveRouteRequest,
10623            fidl::encoding::DefaultFuchsiaResourceDialect,
10624        > for &mut RouteSetV6RemoveRouteRequest
10625    {
10626        #[inline]
10627        unsafe fn encode(
10628            self,
10629            encoder: &mut fidl::encoding::Encoder<
10630                '_,
10631                fidl::encoding::DefaultFuchsiaResourceDialect,
10632            >,
10633            offset: usize,
10634            _depth: fidl::encoding::Depth,
10635        ) -> fidl::Result<()> {
10636            encoder.debug_check_bounds::<RouteSetV6RemoveRouteRequest>(offset);
10637            // Delegate to tuple encoding.
10638            fidl::encoding::Encode::<
10639                RouteSetV6RemoveRouteRequest,
10640                fidl::encoding::DefaultFuchsiaResourceDialect,
10641            >::encode(
10642                (<fidl_fuchsia_net_routes::RouteV6 as fidl::encoding::ValueTypeMarker>::borrow(
10643                    &self.route,
10644                ),),
10645                encoder,
10646                offset,
10647                _depth,
10648            )
10649        }
10650    }
10651    unsafe impl<
10652            T0: fidl::encoding::Encode<
10653                fidl_fuchsia_net_routes::RouteV6,
10654                fidl::encoding::DefaultFuchsiaResourceDialect,
10655            >,
10656        >
10657        fidl::encoding::Encode<
10658            RouteSetV6RemoveRouteRequest,
10659            fidl::encoding::DefaultFuchsiaResourceDialect,
10660        > for (T0,)
10661    {
10662        #[inline]
10663        unsafe fn encode(
10664            self,
10665            encoder: &mut fidl::encoding::Encoder<
10666                '_,
10667                fidl::encoding::DefaultFuchsiaResourceDialect,
10668            >,
10669            offset: usize,
10670            depth: fidl::encoding::Depth,
10671        ) -> fidl::Result<()> {
10672            encoder.debug_check_bounds::<RouteSetV6RemoveRouteRequest>(offset);
10673            // Zero out padding regions. There's no need to apply masks
10674            // because the unmasked parts will be overwritten by fields.
10675            // Write the fields.
10676            self.0.encode(encoder, offset + 0, depth)?;
10677            Ok(())
10678        }
10679    }
10680
10681    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10682        for RouteSetV6RemoveRouteRequest
10683    {
10684        #[inline(always)]
10685        fn new_empty() -> Self {
10686            Self {
10687                route: fidl::new_empty!(
10688                    fidl_fuchsia_net_routes::RouteV6,
10689                    fidl::encoding::DefaultFuchsiaResourceDialect
10690                ),
10691            }
10692        }
10693
10694        #[inline]
10695        unsafe fn decode(
10696            &mut self,
10697            decoder: &mut fidl::encoding::Decoder<
10698                '_,
10699                fidl::encoding::DefaultFuchsiaResourceDialect,
10700            >,
10701            offset: usize,
10702            _depth: fidl::encoding::Depth,
10703        ) -> fidl::Result<()> {
10704            decoder.debug_check_bounds::<Self>(offset);
10705            // Verify that padding bytes are zero.
10706            fidl::decode!(
10707                fidl_fuchsia_net_routes::RouteV6,
10708                fidl::encoding::DefaultFuchsiaResourceDialect,
10709                &mut self.route,
10710                decoder,
10711                offset + 0,
10712                _depth
10713            )?;
10714            Ok(())
10715        }
10716    }
10717
10718    impl fidl::encoding::ValueTypeMarker for RouteSetV6AddRouteResponse {
10719        type Borrowed<'a> = &'a Self;
10720        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10721            value
10722        }
10723    }
10724
10725    unsafe impl fidl::encoding::TypeMarker for RouteSetV6AddRouteResponse {
10726        type Owned = Self;
10727
10728        #[inline(always)]
10729        fn inline_align(_context: fidl::encoding::Context) -> usize {
10730            1
10731        }
10732
10733        #[inline(always)]
10734        fn inline_size(_context: fidl::encoding::Context) -> usize {
10735            1
10736        }
10737    }
10738
10739    unsafe impl<D: fidl::encoding::ResourceDialect>
10740        fidl::encoding::Encode<RouteSetV6AddRouteResponse, D> for &RouteSetV6AddRouteResponse
10741    {
10742        #[inline]
10743        unsafe fn encode(
10744            self,
10745            encoder: &mut fidl::encoding::Encoder<'_, D>,
10746            offset: usize,
10747            _depth: fidl::encoding::Depth,
10748        ) -> fidl::Result<()> {
10749            encoder.debug_check_bounds::<RouteSetV6AddRouteResponse>(offset);
10750            // Delegate to tuple encoding.
10751            fidl::encoding::Encode::<RouteSetV6AddRouteResponse, D>::encode(
10752                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.did_add),),
10753                encoder,
10754                offset,
10755                _depth,
10756            )
10757        }
10758    }
10759    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
10760        fidl::encoding::Encode<RouteSetV6AddRouteResponse, D> for (T0,)
10761    {
10762        #[inline]
10763        unsafe fn encode(
10764            self,
10765            encoder: &mut fidl::encoding::Encoder<'_, D>,
10766            offset: usize,
10767            depth: fidl::encoding::Depth,
10768        ) -> fidl::Result<()> {
10769            encoder.debug_check_bounds::<RouteSetV6AddRouteResponse>(offset);
10770            // Zero out padding regions. There's no need to apply masks
10771            // because the unmasked parts will be overwritten by fields.
10772            // Write the fields.
10773            self.0.encode(encoder, offset + 0, depth)?;
10774            Ok(())
10775        }
10776    }
10777
10778    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
10779        for RouteSetV6AddRouteResponse
10780    {
10781        #[inline(always)]
10782        fn new_empty() -> Self {
10783            Self { did_add: fidl::new_empty!(bool, D) }
10784        }
10785
10786        #[inline]
10787        unsafe fn decode(
10788            &mut self,
10789            decoder: &mut fidl::encoding::Decoder<'_, D>,
10790            offset: usize,
10791            _depth: fidl::encoding::Depth,
10792        ) -> fidl::Result<()> {
10793            decoder.debug_check_bounds::<Self>(offset);
10794            // Verify that padding bytes are zero.
10795            fidl::decode!(bool, D, &mut self.did_add, decoder, offset + 0, _depth)?;
10796            Ok(())
10797        }
10798    }
10799
10800    impl fidl::encoding::ValueTypeMarker for RouteSetV6RemoveRouteResponse {
10801        type Borrowed<'a> = &'a Self;
10802        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
10803            value
10804        }
10805    }
10806
10807    unsafe impl fidl::encoding::TypeMarker for RouteSetV6RemoveRouteResponse {
10808        type Owned = Self;
10809
10810        #[inline(always)]
10811        fn inline_align(_context: fidl::encoding::Context) -> usize {
10812            1
10813        }
10814
10815        #[inline(always)]
10816        fn inline_size(_context: fidl::encoding::Context) -> usize {
10817            1
10818        }
10819    }
10820
10821    unsafe impl<D: fidl::encoding::ResourceDialect>
10822        fidl::encoding::Encode<RouteSetV6RemoveRouteResponse, D>
10823        for &RouteSetV6RemoveRouteResponse
10824    {
10825        #[inline]
10826        unsafe fn encode(
10827            self,
10828            encoder: &mut fidl::encoding::Encoder<'_, D>,
10829            offset: usize,
10830            _depth: fidl::encoding::Depth,
10831        ) -> fidl::Result<()> {
10832            encoder.debug_check_bounds::<RouteSetV6RemoveRouteResponse>(offset);
10833            // Delegate to tuple encoding.
10834            fidl::encoding::Encode::<RouteSetV6RemoveRouteResponse, D>::encode(
10835                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.did_remove),),
10836                encoder,
10837                offset,
10838                _depth,
10839            )
10840        }
10841    }
10842    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
10843        fidl::encoding::Encode<RouteSetV6RemoveRouteResponse, D> for (T0,)
10844    {
10845        #[inline]
10846        unsafe fn encode(
10847            self,
10848            encoder: &mut fidl::encoding::Encoder<'_, D>,
10849            offset: usize,
10850            depth: fidl::encoding::Depth,
10851        ) -> fidl::Result<()> {
10852            encoder.debug_check_bounds::<RouteSetV6RemoveRouteResponse>(offset);
10853            // Zero out padding regions. There's no need to apply masks
10854            // because the unmasked parts will be overwritten by fields.
10855            // Write the fields.
10856            self.0.encode(encoder, offset + 0, depth)?;
10857            Ok(())
10858        }
10859    }
10860
10861    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
10862        for RouteSetV6RemoveRouteResponse
10863    {
10864        #[inline(always)]
10865        fn new_empty() -> Self {
10866            Self { did_remove: fidl::new_empty!(bool, D) }
10867        }
10868
10869        #[inline]
10870        unsafe fn decode(
10871            &mut self,
10872            decoder: &mut fidl::encoding::Decoder<'_, D>,
10873            offset: usize,
10874            _depth: fidl::encoding::Depth,
10875        ) -> fidl::Result<()> {
10876            decoder.debug_check_bounds::<Self>(offset);
10877            // Verify that padding bytes are zero.
10878            fidl::decode!(bool, D, &mut self.did_remove, decoder, offset + 0, _depth)?;
10879            Ok(())
10880        }
10881    }
10882
10883    impl fidl::encoding::ResourceTypeMarker for RouteTableProviderV4NewRouteTableRequest {
10884        type Borrowed<'a> = &'a mut Self;
10885        fn take_or_borrow<'a>(
10886            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
10887        ) -> Self::Borrowed<'a> {
10888            value
10889        }
10890    }
10891
10892    unsafe impl fidl::encoding::TypeMarker for RouteTableProviderV4NewRouteTableRequest {
10893        type Owned = Self;
10894
10895        #[inline(always)]
10896        fn inline_align(_context: fidl::encoding::Context) -> usize {
10897            8
10898        }
10899
10900        #[inline(always)]
10901        fn inline_size(_context: fidl::encoding::Context) -> usize {
10902            24
10903        }
10904    }
10905
10906    unsafe impl
10907        fidl::encoding::Encode<
10908            RouteTableProviderV4NewRouteTableRequest,
10909            fidl::encoding::DefaultFuchsiaResourceDialect,
10910        > for &mut RouteTableProviderV4NewRouteTableRequest
10911    {
10912        #[inline]
10913        unsafe fn encode(
10914            self,
10915            encoder: &mut fidl::encoding::Encoder<
10916                '_,
10917                fidl::encoding::DefaultFuchsiaResourceDialect,
10918            >,
10919            offset: usize,
10920            _depth: fidl::encoding::Depth,
10921        ) -> fidl::Result<()> {
10922            encoder.debug_check_bounds::<RouteTableProviderV4NewRouteTableRequest>(offset);
10923            // Delegate to tuple encoding.
10924            fidl::encoding::Encode::<RouteTableProviderV4NewRouteTableRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
10925                (
10926                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.provider),
10927                    <RouteTableOptionsV4 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
10928                ),
10929                encoder, offset, _depth
10930            )
10931        }
10932    }
10933    unsafe impl<
10934            T0: fidl::encoding::Encode<
10935                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV4Marker>>,
10936                fidl::encoding::DefaultFuchsiaResourceDialect,
10937            >,
10938            T1: fidl::encoding::Encode<
10939                RouteTableOptionsV4,
10940                fidl::encoding::DefaultFuchsiaResourceDialect,
10941            >,
10942        >
10943        fidl::encoding::Encode<
10944            RouteTableProviderV4NewRouteTableRequest,
10945            fidl::encoding::DefaultFuchsiaResourceDialect,
10946        > for (T0, T1)
10947    {
10948        #[inline]
10949        unsafe fn encode(
10950            self,
10951            encoder: &mut fidl::encoding::Encoder<
10952                '_,
10953                fidl::encoding::DefaultFuchsiaResourceDialect,
10954            >,
10955            offset: usize,
10956            depth: fidl::encoding::Depth,
10957        ) -> fidl::Result<()> {
10958            encoder.debug_check_bounds::<RouteTableProviderV4NewRouteTableRequest>(offset);
10959            // Zero out padding regions. There's no need to apply masks
10960            // because the unmasked parts will be overwritten by fields.
10961            unsafe {
10962                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
10963                (ptr as *mut u64).write_unaligned(0);
10964            }
10965            // Write the fields.
10966            self.0.encode(encoder, offset + 0, depth)?;
10967            self.1.encode(encoder, offset + 8, depth)?;
10968            Ok(())
10969        }
10970    }
10971
10972    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
10973        for RouteTableProviderV4NewRouteTableRequest
10974    {
10975        #[inline(always)]
10976        fn new_empty() -> Self {
10977            Self {
10978                provider: fidl::new_empty!(
10979                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV4Marker>>,
10980                    fidl::encoding::DefaultFuchsiaResourceDialect
10981                ),
10982                options: fidl::new_empty!(
10983                    RouteTableOptionsV4,
10984                    fidl::encoding::DefaultFuchsiaResourceDialect
10985                ),
10986            }
10987        }
10988
10989        #[inline]
10990        unsafe fn decode(
10991            &mut self,
10992            decoder: &mut fidl::encoding::Decoder<
10993                '_,
10994                fidl::encoding::DefaultFuchsiaResourceDialect,
10995            >,
10996            offset: usize,
10997            _depth: fidl::encoding::Depth,
10998        ) -> fidl::Result<()> {
10999            decoder.debug_check_bounds::<Self>(offset);
11000            // Verify that padding bytes are zero.
11001            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
11002            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11003            let mask = 0xffffffff00000000u64;
11004            let maskedval = padval & mask;
11005            if maskedval != 0 {
11006                return Err(fidl::Error::NonZeroPadding {
11007                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
11008                });
11009            }
11010            fidl::decode!(
11011                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV4Marker>>,
11012                fidl::encoding::DefaultFuchsiaResourceDialect,
11013                &mut self.provider,
11014                decoder,
11015                offset + 0,
11016                _depth
11017            )?;
11018            fidl::decode!(
11019                RouteTableOptionsV4,
11020                fidl::encoding::DefaultFuchsiaResourceDialect,
11021                &mut self.options,
11022                decoder,
11023                offset + 8,
11024                _depth
11025            )?;
11026            Ok(())
11027        }
11028    }
11029
11030    impl fidl::encoding::ResourceTypeMarker for RouteTableProviderV6NewRouteTableRequest {
11031        type Borrowed<'a> = &'a mut Self;
11032        fn take_or_borrow<'a>(
11033            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11034        ) -> Self::Borrowed<'a> {
11035            value
11036        }
11037    }
11038
11039    unsafe impl fidl::encoding::TypeMarker for RouteTableProviderV6NewRouteTableRequest {
11040        type Owned = Self;
11041
11042        #[inline(always)]
11043        fn inline_align(_context: fidl::encoding::Context) -> usize {
11044            8
11045        }
11046
11047        #[inline(always)]
11048        fn inline_size(_context: fidl::encoding::Context) -> usize {
11049            24
11050        }
11051    }
11052
11053    unsafe impl
11054        fidl::encoding::Encode<
11055            RouteTableProviderV6NewRouteTableRequest,
11056            fidl::encoding::DefaultFuchsiaResourceDialect,
11057        > for &mut RouteTableProviderV6NewRouteTableRequest
11058    {
11059        #[inline]
11060        unsafe fn encode(
11061            self,
11062            encoder: &mut fidl::encoding::Encoder<
11063                '_,
11064                fidl::encoding::DefaultFuchsiaResourceDialect,
11065            >,
11066            offset: usize,
11067            _depth: fidl::encoding::Depth,
11068        ) -> fidl::Result<()> {
11069            encoder.debug_check_bounds::<RouteTableProviderV6NewRouteTableRequest>(offset);
11070            // Delegate to tuple encoding.
11071            fidl::encoding::Encode::<RouteTableProviderV6NewRouteTableRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11072                (
11073                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.provider),
11074                    <RouteTableOptionsV6 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
11075                ),
11076                encoder, offset, _depth
11077            )
11078        }
11079    }
11080    unsafe impl<
11081            T0: fidl::encoding::Encode<
11082                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV6Marker>>,
11083                fidl::encoding::DefaultFuchsiaResourceDialect,
11084            >,
11085            T1: fidl::encoding::Encode<
11086                RouteTableOptionsV6,
11087                fidl::encoding::DefaultFuchsiaResourceDialect,
11088            >,
11089        >
11090        fidl::encoding::Encode<
11091            RouteTableProviderV6NewRouteTableRequest,
11092            fidl::encoding::DefaultFuchsiaResourceDialect,
11093        > for (T0, T1)
11094    {
11095        #[inline]
11096        unsafe fn encode(
11097            self,
11098            encoder: &mut fidl::encoding::Encoder<
11099                '_,
11100                fidl::encoding::DefaultFuchsiaResourceDialect,
11101            >,
11102            offset: usize,
11103            depth: fidl::encoding::Depth,
11104        ) -> fidl::Result<()> {
11105            encoder.debug_check_bounds::<RouteTableProviderV6NewRouteTableRequest>(offset);
11106            // Zero out padding regions. There's no need to apply masks
11107            // because the unmasked parts will be overwritten by fields.
11108            unsafe {
11109                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
11110                (ptr as *mut u64).write_unaligned(0);
11111            }
11112            // Write the fields.
11113            self.0.encode(encoder, offset + 0, depth)?;
11114            self.1.encode(encoder, offset + 8, depth)?;
11115            Ok(())
11116        }
11117    }
11118
11119    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11120        for RouteTableProviderV6NewRouteTableRequest
11121    {
11122        #[inline(always)]
11123        fn new_empty() -> Self {
11124            Self {
11125                provider: fidl::new_empty!(
11126                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV6Marker>>,
11127                    fidl::encoding::DefaultFuchsiaResourceDialect
11128                ),
11129                options: fidl::new_empty!(
11130                    RouteTableOptionsV6,
11131                    fidl::encoding::DefaultFuchsiaResourceDialect
11132                ),
11133            }
11134        }
11135
11136        #[inline]
11137        unsafe fn decode(
11138            &mut self,
11139            decoder: &mut fidl::encoding::Decoder<
11140                '_,
11141                fidl::encoding::DefaultFuchsiaResourceDialect,
11142            >,
11143            offset: usize,
11144            _depth: fidl::encoding::Depth,
11145        ) -> fidl::Result<()> {
11146            decoder.debug_check_bounds::<Self>(offset);
11147            // Verify that padding bytes are zero.
11148            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
11149            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11150            let mask = 0xffffffff00000000u64;
11151            let maskedval = padval & mask;
11152            if maskedval != 0 {
11153                return Err(fidl::Error::NonZeroPadding {
11154                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
11155                });
11156            }
11157            fidl::decode!(
11158                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV6Marker>>,
11159                fidl::encoding::DefaultFuchsiaResourceDialect,
11160                &mut self.provider,
11161                decoder,
11162                offset + 0,
11163                _depth
11164            )?;
11165            fidl::decode!(
11166                RouteTableOptionsV6,
11167                fidl::encoding::DefaultFuchsiaResourceDialect,
11168                &mut self.options,
11169                decoder,
11170                offset + 8,
11171                _depth
11172            )?;
11173            Ok(())
11174        }
11175    }
11176
11177    impl fidl::encoding::ResourceTypeMarker for RouteTableV4NewRouteSetRequest {
11178        type Borrowed<'a> = &'a mut Self;
11179        fn take_or_borrow<'a>(
11180            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11181        ) -> Self::Borrowed<'a> {
11182            value
11183        }
11184    }
11185
11186    unsafe impl fidl::encoding::TypeMarker for RouteTableV4NewRouteSetRequest {
11187        type Owned = Self;
11188
11189        #[inline(always)]
11190        fn inline_align(_context: fidl::encoding::Context) -> usize {
11191            4
11192        }
11193
11194        #[inline(always)]
11195        fn inline_size(_context: fidl::encoding::Context) -> usize {
11196            4
11197        }
11198    }
11199
11200    unsafe impl
11201        fidl::encoding::Encode<
11202            RouteTableV4NewRouteSetRequest,
11203            fidl::encoding::DefaultFuchsiaResourceDialect,
11204        > for &mut RouteTableV4NewRouteSetRequest
11205    {
11206        #[inline]
11207        unsafe fn encode(
11208            self,
11209            encoder: &mut fidl::encoding::Encoder<
11210                '_,
11211                fidl::encoding::DefaultFuchsiaResourceDialect,
11212            >,
11213            offset: usize,
11214            _depth: fidl::encoding::Depth,
11215        ) -> fidl::Result<()> {
11216            encoder.debug_check_bounds::<RouteTableV4NewRouteSetRequest>(offset);
11217            // Delegate to tuple encoding.
11218            fidl::encoding::Encode::<RouteTableV4NewRouteSetRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11219                (
11220                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.route_set),
11221                ),
11222                encoder, offset, _depth
11223            )
11224        }
11225    }
11226    unsafe impl<
11227            T0: fidl::encoding::Encode<
11228                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV4Marker>>,
11229                fidl::encoding::DefaultFuchsiaResourceDialect,
11230            >,
11231        >
11232        fidl::encoding::Encode<
11233            RouteTableV4NewRouteSetRequest,
11234            fidl::encoding::DefaultFuchsiaResourceDialect,
11235        > for (T0,)
11236    {
11237        #[inline]
11238        unsafe fn encode(
11239            self,
11240            encoder: &mut fidl::encoding::Encoder<
11241                '_,
11242                fidl::encoding::DefaultFuchsiaResourceDialect,
11243            >,
11244            offset: usize,
11245            depth: fidl::encoding::Depth,
11246        ) -> fidl::Result<()> {
11247            encoder.debug_check_bounds::<RouteTableV4NewRouteSetRequest>(offset);
11248            // Zero out padding regions. There's no need to apply masks
11249            // because the unmasked parts will be overwritten by fields.
11250            // Write the fields.
11251            self.0.encode(encoder, offset + 0, depth)?;
11252            Ok(())
11253        }
11254    }
11255
11256    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11257        for RouteTableV4NewRouteSetRequest
11258    {
11259        #[inline(always)]
11260        fn new_empty() -> Self {
11261            Self {
11262                route_set: fidl::new_empty!(
11263                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV4Marker>>,
11264                    fidl::encoding::DefaultFuchsiaResourceDialect
11265                ),
11266            }
11267        }
11268
11269        #[inline]
11270        unsafe fn decode(
11271            &mut self,
11272            decoder: &mut fidl::encoding::Decoder<
11273                '_,
11274                fidl::encoding::DefaultFuchsiaResourceDialect,
11275            >,
11276            offset: usize,
11277            _depth: fidl::encoding::Depth,
11278        ) -> fidl::Result<()> {
11279            decoder.debug_check_bounds::<Self>(offset);
11280            // Verify that padding bytes are zero.
11281            fidl::decode!(
11282                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV4Marker>>,
11283                fidl::encoding::DefaultFuchsiaResourceDialect,
11284                &mut self.route_set,
11285                decoder,
11286                offset + 0,
11287                _depth
11288            )?;
11289            Ok(())
11290        }
11291    }
11292
11293    impl fidl::encoding::ResourceTypeMarker for RouteTableV6NewRouteSetRequest {
11294        type Borrowed<'a> = &'a mut Self;
11295        fn take_or_borrow<'a>(
11296            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11297        ) -> Self::Borrowed<'a> {
11298            value
11299        }
11300    }
11301
11302    unsafe impl fidl::encoding::TypeMarker for RouteTableV6NewRouteSetRequest {
11303        type Owned = Self;
11304
11305        #[inline(always)]
11306        fn inline_align(_context: fidl::encoding::Context) -> usize {
11307            4
11308        }
11309
11310        #[inline(always)]
11311        fn inline_size(_context: fidl::encoding::Context) -> usize {
11312            4
11313        }
11314    }
11315
11316    unsafe impl
11317        fidl::encoding::Encode<
11318            RouteTableV6NewRouteSetRequest,
11319            fidl::encoding::DefaultFuchsiaResourceDialect,
11320        > for &mut RouteTableV6NewRouteSetRequest
11321    {
11322        #[inline]
11323        unsafe fn encode(
11324            self,
11325            encoder: &mut fidl::encoding::Encoder<
11326                '_,
11327                fidl::encoding::DefaultFuchsiaResourceDialect,
11328            >,
11329            offset: usize,
11330            _depth: fidl::encoding::Depth,
11331        ) -> fidl::Result<()> {
11332            encoder.debug_check_bounds::<RouteTableV6NewRouteSetRequest>(offset);
11333            // Delegate to tuple encoding.
11334            fidl::encoding::Encode::<RouteTableV6NewRouteSetRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11335                (
11336                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.route_set),
11337                ),
11338                encoder, offset, _depth
11339            )
11340        }
11341    }
11342    unsafe impl<
11343            T0: fidl::encoding::Encode<
11344                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV6Marker>>,
11345                fidl::encoding::DefaultFuchsiaResourceDialect,
11346            >,
11347        >
11348        fidl::encoding::Encode<
11349            RouteTableV6NewRouteSetRequest,
11350            fidl::encoding::DefaultFuchsiaResourceDialect,
11351        > for (T0,)
11352    {
11353        #[inline]
11354        unsafe fn encode(
11355            self,
11356            encoder: &mut fidl::encoding::Encoder<
11357                '_,
11358                fidl::encoding::DefaultFuchsiaResourceDialect,
11359            >,
11360            offset: usize,
11361            depth: fidl::encoding::Depth,
11362        ) -> fidl::Result<()> {
11363            encoder.debug_check_bounds::<RouteTableV6NewRouteSetRequest>(offset);
11364            // Zero out padding regions. There's no need to apply masks
11365            // because the unmasked parts will be overwritten by fields.
11366            // Write the fields.
11367            self.0.encode(encoder, offset + 0, depth)?;
11368            Ok(())
11369        }
11370    }
11371
11372    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11373        for RouteTableV6NewRouteSetRequest
11374    {
11375        #[inline(always)]
11376        fn new_empty() -> Self {
11377            Self {
11378                route_set: fidl::new_empty!(
11379                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV6Marker>>,
11380                    fidl::encoding::DefaultFuchsiaResourceDialect
11381                ),
11382            }
11383        }
11384
11385        #[inline]
11386        unsafe fn decode(
11387            &mut self,
11388            decoder: &mut fidl::encoding::Decoder<
11389                '_,
11390                fidl::encoding::DefaultFuchsiaResourceDialect,
11391            >,
11392            offset: usize,
11393            _depth: fidl::encoding::Depth,
11394        ) -> fidl::Result<()> {
11395            decoder.debug_check_bounds::<Self>(offset);
11396            // Verify that padding bytes are zero.
11397            fidl::decode!(
11398                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV6Marker>>,
11399                fidl::encoding::DefaultFuchsiaResourceDialect,
11400                &mut self.route_set,
11401                decoder,
11402                offset + 0,
11403                _depth
11404            )?;
11405            Ok(())
11406        }
11407    }
11408
11409    impl fidl::encoding::ResourceTypeMarker for RuleSetV4AddRuleRequest {
11410        type Borrowed<'a> = &'a mut Self;
11411        fn take_or_borrow<'a>(
11412            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11413        ) -> Self::Borrowed<'a> {
11414            value
11415        }
11416    }
11417
11418    unsafe impl fidl::encoding::TypeMarker for RuleSetV4AddRuleRequest {
11419        type Owned = Self;
11420
11421        #[inline(always)]
11422        fn inline_align(_context: fidl::encoding::Context) -> usize {
11423            8
11424        }
11425
11426        #[inline(always)]
11427        fn inline_size(_context: fidl::encoding::Context) -> usize {
11428            40
11429        }
11430    }
11431
11432    unsafe impl
11433        fidl::encoding::Encode<
11434            RuleSetV4AddRuleRequest,
11435            fidl::encoding::DefaultFuchsiaResourceDialect,
11436        > for &mut RuleSetV4AddRuleRequest
11437    {
11438        #[inline]
11439        unsafe fn encode(
11440            self,
11441            encoder: &mut fidl::encoding::Encoder<
11442                '_,
11443                fidl::encoding::DefaultFuchsiaResourceDialect,
11444            >,
11445            offset: usize,
11446            _depth: fidl::encoding::Depth,
11447        ) -> fidl::Result<()> {
11448            encoder.debug_check_bounds::<RuleSetV4AddRuleRequest>(offset);
11449            // Delegate to tuple encoding.
11450            fidl::encoding::Encode::<RuleSetV4AddRuleRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11451                (
11452                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.index),
11453                    <fidl_fuchsia_net_routes::RuleMatcherV4 as fidl::encoding::ValueTypeMarker>::borrow(&self.matcher),
11454                    <fidl_fuchsia_net_routes::RuleAction as fidl::encoding::ValueTypeMarker>::borrow(&self.action),
11455                ),
11456                encoder, offset, _depth
11457            )
11458        }
11459    }
11460    unsafe impl<
11461            T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
11462            T1: fidl::encoding::Encode<
11463                fidl_fuchsia_net_routes::RuleMatcherV4,
11464                fidl::encoding::DefaultFuchsiaResourceDialect,
11465            >,
11466            T2: fidl::encoding::Encode<
11467                fidl_fuchsia_net_routes::RuleAction,
11468                fidl::encoding::DefaultFuchsiaResourceDialect,
11469            >,
11470        >
11471        fidl::encoding::Encode<
11472            RuleSetV4AddRuleRequest,
11473            fidl::encoding::DefaultFuchsiaResourceDialect,
11474        > for (T0, T1, T2)
11475    {
11476        #[inline]
11477        unsafe fn encode(
11478            self,
11479            encoder: &mut fidl::encoding::Encoder<
11480                '_,
11481                fidl::encoding::DefaultFuchsiaResourceDialect,
11482            >,
11483            offset: usize,
11484            depth: fidl::encoding::Depth,
11485        ) -> fidl::Result<()> {
11486            encoder.debug_check_bounds::<RuleSetV4AddRuleRequest>(offset);
11487            // Zero out padding regions. There's no need to apply masks
11488            // because the unmasked parts will be overwritten by fields.
11489            unsafe {
11490                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
11491                (ptr as *mut u64).write_unaligned(0);
11492            }
11493            // Write the fields.
11494            self.0.encode(encoder, offset + 0, depth)?;
11495            self.1.encode(encoder, offset + 8, depth)?;
11496            self.2.encode(encoder, offset + 24, depth)?;
11497            Ok(())
11498        }
11499    }
11500
11501    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11502        for RuleSetV4AddRuleRequest
11503    {
11504        #[inline(always)]
11505        fn new_empty() -> Self {
11506            Self {
11507                index: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
11508                matcher: fidl::new_empty!(
11509                    fidl_fuchsia_net_routes::RuleMatcherV4,
11510                    fidl::encoding::DefaultFuchsiaResourceDialect
11511                ),
11512                action: fidl::new_empty!(
11513                    fidl_fuchsia_net_routes::RuleAction,
11514                    fidl::encoding::DefaultFuchsiaResourceDialect
11515                ),
11516            }
11517        }
11518
11519        #[inline]
11520        unsafe fn decode(
11521            &mut self,
11522            decoder: &mut fidl::encoding::Decoder<
11523                '_,
11524                fidl::encoding::DefaultFuchsiaResourceDialect,
11525            >,
11526            offset: usize,
11527            _depth: fidl::encoding::Depth,
11528        ) -> fidl::Result<()> {
11529            decoder.debug_check_bounds::<Self>(offset);
11530            // Verify that padding bytes are zero.
11531            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
11532            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11533            let mask = 0xffffffff00000000u64;
11534            let maskedval = padval & mask;
11535            if maskedval != 0 {
11536                return Err(fidl::Error::NonZeroPadding {
11537                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
11538                });
11539            }
11540            fidl::decode!(
11541                u32,
11542                fidl::encoding::DefaultFuchsiaResourceDialect,
11543                &mut self.index,
11544                decoder,
11545                offset + 0,
11546                _depth
11547            )?;
11548            fidl::decode!(
11549                fidl_fuchsia_net_routes::RuleMatcherV4,
11550                fidl::encoding::DefaultFuchsiaResourceDialect,
11551                &mut self.matcher,
11552                decoder,
11553                offset + 8,
11554                _depth
11555            )?;
11556            fidl::decode!(
11557                fidl_fuchsia_net_routes::RuleAction,
11558                fidl::encoding::DefaultFuchsiaResourceDialect,
11559                &mut self.action,
11560                decoder,
11561                offset + 24,
11562                _depth
11563            )?;
11564            Ok(())
11565        }
11566    }
11567
11568    impl fidl::encoding::ResourceTypeMarker for RuleSetV6AddRuleRequest {
11569        type Borrowed<'a> = &'a mut Self;
11570        fn take_or_borrow<'a>(
11571            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11572        ) -> Self::Borrowed<'a> {
11573            value
11574        }
11575    }
11576
11577    unsafe impl fidl::encoding::TypeMarker for RuleSetV6AddRuleRequest {
11578        type Owned = Self;
11579
11580        #[inline(always)]
11581        fn inline_align(_context: fidl::encoding::Context) -> usize {
11582            8
11583        }
11584
11585        #[inline(always)]
11586        fn inline_size(_context: fidl::encoding::Context) -> usize {
11587            40
11588        }
11589    }
11590
11591    unsafe impl
11592        fidl::encoding::Encode<
11593            RuleSetV6AddRuleRequest,
11594            fidl::encoding::DefaultFuchsiaResourceDialect,
11595        > for &mut RuleSetV6AddRuleRequest
11596    {
11597        #[inline]
11598        unsafe fn encode(
11599            self,
11600            encoder: &mut fidl::encoding::Encoder<
11601                '_,
11602                fidl::encoding::DefaultFuchsiaResourceDialect,
11603            >,
11604            offset: usize,
11605            _depth: fidl::encoding::Depth,
11606        ) -> fidl::Result<()> {
11607            encoder.debug_check_bounds::<RuleSetV6AddRuleRequest>(offset);
11608            // Delegate to tuple encoding.
11609            fidl::encoding::Encode::<RuleSetV6AddRuleRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11610                (
11611                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.index),
11612                    <fidl_fuchsia_net_routes::RuleMatcherV6 as fidl::encoding::ValueTypeMarker>::borrow(&self.matcher),
11613                    <fidl_fuchsia_net_routes::RuleAction as fidl::encoding::ValueTypeMarker>::borrow(&self.action),
11614                ),
11615                encoder, offset, _depth
11616            )
11617        }
11618    }
11619    unsafe impl<
11620            T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
11621            T1: fidl::encoding::Encode<
11622                fidl_fuchsia_net_routes::RuleMatcherV6,
11623                fidl::encoding::DefaultFuchsiaResourceDialect,
11624            >,
11625            T2: fidl::encoding::Encode<
11626                fidl_fuchsia_net_routes::RuleAction,
11627                fidl::encoding::DefaultFuchsiaResourceDialect,
11628            >,
11629        >
11630        fidl::encoding::Encode<
11631            RuleSetV6AddRuleRequest,
11632            fidl::encoding::DefaultFuchsiaResourceDialect,
11633        > for (T0, T1, T2)
11634    {
11635        #[inline]
11636        unsafe fn encode(
11637            self,
11638            encoder: &mut fidl::encoding::Encoder<
11639                '_,
11640                fidl::encoding::DefaultFuchsiaResourceDialect,
11641            >,
11642            offset: usize,
11643            depth: fidl::encoding::Depth,
11644        ) -> fidl::Result<()> {
11645            encoder.debug_check_bounds::<RuleSetV6AddRuleRequest>(offset);
11646            // Zero out padding regions. There's no need to apply masks
11647            // because the unmasked parts will be overwritten by fields.
11648            unsafe {
11649                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
11650                (ptr as *mut u64).write_unaligned(0);
11651            }
11652            // Write the fields.
11653            self.0.encode(encoder, offset + 0, depth)?;
11654            self.1.encode(encoder, offset + 8, depth)?;
11655            self.2.encode(encoder, offset + 24, depth)?;
11656            Ok(())
11657        }
11658    }
11659
11660    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11661        for RuleSetV6AddRuleRequest
11662    {
11663        #[inline(always)]
11664        fn new_empty() -> Self {
11665            Self {
11666                index: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
11667                matcher: fidl::new_empty!(
11668                    fidl_fuchsia_net_routes::RuleMatcherV6,
11669                    fidl::encoding::DefaultFuchsiaResourceDialect
11670                ),
11671                action: fidl::new_empty!(
11672                    fidl_fuchsia_net_routes::RuleAction,
11673                    fidl::encoding::DefaultFuchsiaResourceDialect
11674                ),
11675            }
11676        }
11677
11678        #[inline]
11679        unsafe fn decode(
11680            &mut self,
11681            decoder: &mut fidl::encoding::Decoder<
11682                '_,
11683                fidl::encoding::DefaultFuchsiaResourceDialect,
11684            >,
11685            offset: usize,
11686            _depth: fidl::encoding::Depth,
11687        ) -> fidl::Result<()> {
11688            decoder.debug_check_bounds::<Self>(offset);
11689            // Verify that padding bytes are zero.
11690            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
11691            let padval = unsafe { (ptr as *const u64).read_unaligned() };
11692            let mask = 0xffffffff00000000u64;
11693            let maskedval = padval & mask;
11694            if maskedval != 0 {
11695                return Err(fidl::Error::NonZeroPadding {
11696                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
11697                });
11698            }
11699            fidl::decode!(
11700                u32,
11701                fidl::encoding::DefaultFuchsiaResourceDialect,
11702                &mut self.index,
11703                decoder,
11704                offset + 0,
11705                _depth
11706            )?;
11707            fidl::decode!(
11708                fidl_fuchsia_net_routes::RuleMatcherV6,
11709                fidl::encoding::DefaultFuchsiaResourceDialect,
11710                &mut self.matcher,
11711                decoder,
11712                offset + 8,
11713                _depth
11714            )?;
11715            fidl::decode!(
11716                fidl_fuchsia_net_routes::RuleAction,
11717                fidl::encoding::DefaultFuchsiaResourceDialect,
11718                &mut self.action,
11719                decoder,
11720                offset + 24,
11721                _depth
11722            )?;
11723            Ok(())
11724        }
11725    }
11726
11727    impl fidl::encoding::ResourceTypeMarker for RuleTableV4NewRuleSetRequest {
11728        type Borrowed<'a> = &'a mut Self;
11729        fn take_or_borrow<'a>(
11730            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11731        ) -> Self::Borrowed<'a> {
11732            value
11733        }
11734    }
11735
11736    unsafe impl fidl::encoding::TypeMarker for RuleTableV4NewRuleSetRequest {
11737        type Owned = Self;
11738
11739        #[inline(always)]
11740        fn inline_align(_context: fidl::encoding::Context) -> usize {
11741            4
11742        }
11743
11744        #[inline(always)]
11745        fn inline_size(_context: fidl::encoding::Context) -> usize {
11746            8
11747        }
11748    }
11749
11750    unsafe impl
11751        fidl::encoding::Encode<
11752            RuleTableV4NewRuleSetRequest,
11753            fidl::encoding::DefaultFuchsiaResourceDialect,
11754        > for &mut RuleTableV4NewRuleSetRequest
11755    {
11756        #[inline]
11757        unsafe fn encode(
11758            self,
11759            encoder: &mut fidl::encoding::Encoder<
11760                '_,
11761                fidl::encoding::DefaultFuchsiaResourceDialect,
11762            >,
11763            offset: usize,
11764            _depth: fidl::encoding::Depth,
11765        ) -> fidl::Result<()> {
11766            encoder.debug_check_bounds::<RuleTableV4NewRuleSetRequest>(offset);
11767            // Delegate to tuple encoding.
11768            fidl::encoding::Encode::<RuleTableV4NewRuleSetRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11769                (
11770                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.priority),
11771                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.rule_set),
11772                ),
11773                encoder, offset, _depth
11774            )
11775        }
11776    }
11777    unsafe impl<
11778            T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
11779            T1: fidl::encoding::Encode<
11780                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV4Marker>>,
11781                fidl::encoding::DefaultFuchsiaResourceDialect,
11782            >,
11783        >
11784        fidl::encoding::Encode<
11785            RuleTableV4NewRuleSetRequest,
11786            fidl::encoding::DefaultFuchsiaResourceDialect,
11787        > for (T0, T1)
11788    {
11789        #[inline]
11790        unsafe fn encode(
11791            self,
11792            encoder: &mut fidl::encoding::Encoder<
11793                '_,
11794                fidl::encoding::DefaultFuchsiaResourceDialect,
11795            >,
11796            offset: usize,
11797            depth: fidl::encoding::Depth,
11798        ) -> fidl::Result<()> {
11799            encoder.debug_check_bounds::<RuleTableV4NewRuleSetRequest>(offset);
11800            // Zero out padding regions. There's no need to apply masks
11801            // because the unmasked parts will be overwritten by fields.
11802            // Write the fields.
11803            self.0.encode(encoder, offset + 0, depth)?;
11804            self.1.encode(encoder, offset + 4, depth)?;
11805            Ok(())
11806        }
11807    }
11808
11809    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11810        for RuleTableV4NewRuleSetRequest
11811    {
11812        #[inline(always)]
11813        fn new_empty() -> Self {
11814            Self {
11815                priority: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
11816                rule_set: fidl::new_empty!(
11817                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV4Marker>>,
11818                    fidl::encoding::DefaultFuchsiaResourceDialect
11819                ),
11820            }
11821        }
11822
11823        #[inline]
11824        unsafe fn decode(
11825            &mut self,
11826            decoder: &mut fidl::encoding::Decoder<
11827                '_,
11828                fidl::encoding::DefaultFuchsiaResourceDialect,
11829            >,
11830            offset: usize,
11831            _depth: fidl::encoding::Depth,
11832        ) -> fidl::Result<()> {
11833            decoder.debug_check_bounds::<Self>(offset);
11834            // Verify that padding bytes are zero.
11835            fidl::decode!(
11836                u32,
11837                fidl::encoding::DefaultFuchsiaResourceDialect,
11838                &mut self.priority,
11839                decoder,
11840                offset + 0,
11841                _depth
11842            )?;
11843            fidl::decode!(
11844                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV4Marker>>,
11845                fidl::encoding::DefaultFuchsiaResourceDialect,
11846                &mut self.rule_set,
11847                decoder,
11848                offset + 4,
11849                _depth
11850            )?;
11851            Ok(())
11852        }
11853    }
11854
11855    impl fidl::encoding::ResourceTypeMarker for RuleTableV6NewRuleSetRequest {
11856        type Borrowed<'a> = &'a mut Self;
11857        fn take_or_borrow<'a>(
11858            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
11859        ) -> Self::Borrowed<'a> {
11860            value
11861        }
11862    }
11863
11864    unsafe impl fidl::encoding::TypeMarker for RuleTableV6NewRuleSetRequest {
11865        type Owned = Self;
11866
11867        #[inline(always)]
11868        fn inline_align(_context: fidl::encoding::Context) -> usize {
11869            4
11870        }
11871
11872        #[inline(always)]
11873        fn inline_size(_context: fidl::encoding::Context) -> usize {
11874            8
11875        }
11876    }
11877
11878    unsafe impl
11879        fidl::encoding::Encode<
11880            RuleTableV6NewRuleSetRequest,
11881            fidl::encoding::DefaultFuchsiaResourceDialect,
11882        > for &mut RuleTableV6NewRuleSetRequest
11883    {
11884        #[inline]
11885        unsafe fn encode(
11886            self,
11887            encoder: &mut fidl::encoding::Encoder<
11888                '_,
11889                fidl::encoding::DefaultFuchsiaResourceDialect,
11890            >,
11891            offset: usize,
11892            _depth: fidl::encoding::Depth,
11893        ) -> fidl::Result<()> {
11894            encoder.debug_check_bounds::<RuleTableV6NewRuleSetRequest>(offset);
11895            // Delegate to tuple encoding.
11896            fidl::encoding::Encode::<RuleTableV6NewRuleSetRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
11897                (
11898                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.priority),
11899                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.rule_set),
11900                ),
11901                encoder, offset, _depth
11902            )
11903        }
11904    }
11905    unsafe impl<
11906            T0: fidl::encoding::Encode<u32, fidl::encoding::DefaultFuchsiaResourceDialect>,
11907            T1: fidl::encoding::Encode<
11908                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV6Marker>>,
11909                fidl::encoding::DefaultFuchsiaResourceDialect,
11910            >,
11911        >
11912        fidl::encoding::Encode<
11913            RuleTableV6NewRuleSetRequest,
11914            fidl::encoding::DefaultFuchsiaResourceDialect,
11915        > for (T0, T1)
11916    {
11917        #[inline]
11918        unsafe fn encode(
11919            self,
11920            encoder: &mut fidl::encoding::Encoder<
11921                '_,
11922                fidl::encoding::DefaultFuchsiaResourceDialect,
11923            >,
11924            offset: usize,
11925            depth: fidl::encoding::Depth,
11926        ) -> fidl::Result<()> {
11927            encoder.debug_check_bounds::<RuleTableV6NewRuleSetRequest>(offset);
11928            // Zero out padding regions. There's no need to apply masks
11929            // because the unmasked parts will be overwritten by fields.
11930            // Write the fields.
11931            self.0.encode(encoder, offset + 0, depth)?;
11932            self.1.encode(encoder, offset + 4, depth)?;
11933            Ok(())
11934        }
11935    }
11936
11937    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
11938        for RuleTableV6NewRuleSetRequest
11939    {
11940        #[inline(always)]
11941        fn new_empty() -> Self {
11942            Self {
11943                priority: fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect),
11944                rule_set: fidl::new_empty!(
11945                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV6Marker>>,
11946                    fidl::encoding::DefaultFuchsiaResourceDialect
11947                ),
11948            }
11949        }
11950
11951        #[inline]
11952        unsafe fn decode(
11953            &mut self,
11954            decoder: &mut fidl::encoding::Decoder<
11955                '_,
11956                fidl::encoding::DefaultFuchsiaResourceDialect,
11957            >,
11958            offset: usize,
11959            _depth: fidl::encoding::Depth,
11960        ) -> fidl::Result<()> {
11961            decoder.debug_check_bounds::<Self>(offset);
11962            // Verify that padding bytes are zero.
11963            fidl::decode!(
11964                u32,
11965                fidl::encoding::DefaultFuchsiaResourceDialect,
11966                &mut self.priority,
11967                decoder,
11968                offset + 0,
11969                _depth
11970            )?;
11971            fidl::decode!(
11972                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV6Marker>>,
11973                fidl::encoding::DefaultFuchsiaResourceDialect,
11974                &mut self.rule_set,
11975                decoder,
11976                offset + 4,
11977                _depth
11978            )?;
11979            Ok(())
11980        }
11981    }
11982
11983    impl RouteTableOptionsV4 {
11984        #[inline(always)]
11985        fn max_ordinal_present(&self) -> u64 {
11986            if let Some(_) = self.name {
11987                return 1;
11988            }
11989            0
11990        }
11991    }
11992
11993    impl fidl::encoding::ValueTypeMarker for RouteTableOptionsV4 {
11994        type Borrowed<'a> = &'a Self;
11995        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
11996            value
11997        }
11998    }
11999
12000    unsafe impl fidl::encoding::TypeMarker for RouteTableOptionsV4 {
12001        type Owned = Self;
12002
12003        #[inline(always)]
12004        fn inline_align(_context: fidl::encoding::Context) -> usize {
12005            8
12006        }
12007
12008        #[inline(always)]
12009        fn inline_size(_context: fidl::encoding::Context) -> usize {
12010            16
12011        }
12012    }
12013
12014    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RouteTableOptionsV4, D>
12015        for &RouteTableOptionsV4
12016    {
12017        unsafe fn encode(
12018            self,
12019            encoder: &mut fidl::encoding::Encoder<'_, D>,
12020            offset: usize,
12021            mut depth: fidl::encoding::Depth,
12022        ) -> fidl::Result<()> {
12023            encoder.debug_check_bounds::<RouteTableOptionsV4>(offset);
12024            // Vector header
12025            let max_ordinal: u64 = self.max_ordinal_present();
12026            encoder.write_num(max_ordinal, offset);
12027            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12028            // Calling encoder.out_of_line_offset(0) is not allowed.
12029            if max_ordinal == 0 {
12030                return Ok(());
12031            }
12032            depth.increment()?;
12033            let envelope_size = 8;
12034            let bytes_len = max_ordinal as usize * envelope_size;
12035            #[allow(unused_variables)]
12036            let offset = encoder.out_of_line_offset(bytes_len);
12037            let mut _prev_end_offset: usize = 0;
12038            if 1 > max_ordinal {
12039                return Ok(());
12040            }
12041
12042            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12043            // are envelope_size bytes.
12044            let cur_offset: usize = (1 - 1) * envelope_size;
12045
12046            // Zero reserved fields.
12047            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12048
12049            // Safety:
12050            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12051            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12052            //   envelope_size bytes, there is always sufficient room.
12053            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>, D>(
12054                self.name.as_ref().map(
12055                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
12056                ),
12057                encoder,
12058                offset + cur_offset,
12059                depth,
12060            )?;
12061
12062            _prev_end_offset = cur_offset + envelope_size;
12063
12064            Ok(())
12065        }
12066    }
12067
12068    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RouteTableOptionsV4 {
12069        #[inline(always)]
12070        fn new_empty() -> Self {
12071            Self::default()
12072        }
12073
12074        unsafe fn decode(
12075            &mut self,
12076            decoder: &mut fidl::encoding::Decoder<'_, D>,
12077            offset: usize,
12078            mut depth: fidl::encoding::Depth,
12079        ) -> fidl::Result<()> {
12080            decoder.debug_check_bounds::<Self>(offset);
12081            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12082                None => return Err(fidl::Error::NotNullable),
12083                Some(len) => len,
12084            };
12085            // Calling decoder.out_of_line_offset(0) is not allowed.
12086            if len == 0 {
12087                return Ok(());
12088            };
12089            depth.increment()?;
12090            let envelope_size = 8;
12091            let bytes_len = len * envelope_size;
12092            let offset = decoder.out_of_line_offset(bytes_len)?;
12093            // Decode the envelope for each type.
12094            let mut _next_ordinal_to_read = 0;
12095            let mut next_offset = offset;
12096            let end_offset = offset + bytes_len;
12097            _next_ordinal_to_read += 1;
12098            if next_offset >= end_offset {
12099                return Ok(());
12100            }
12101
12102            // Decode unknown envelopes for gaps in ordinals.
12103            while _next_ordinal_to_read < 1 {
12104                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12105                _next_ordinal_to_read += 1;
12106                next_offset += envelope_size;
12107            }
12108
12109            let next_out_of_line = decoder.next_out_of_line();
12110            let handles_before = decoder.remaining_handles();
12111            if let Some((inlined, num_bytes, num_handles)) =
12112                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12113            {
12114                let member_inline_size =
12115                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
12116                        decoder.context,
12117                    );
12118                if inlined != (member_inline_size <= 4) {
12119                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12120                }
12121                let inner_offset;
12122                let mut inner_depth = depth.clone();
12123                if inlined {
12124                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12125                    inner_offset = next_offset;
12126                } else {
12127                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12128                    inner_depth.increment()?;
12129                }
12130                let val_ref = self
12131                    .name
12132                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>, D));
12133                fidl::decode!(
12134                    fidl::encoding::BoundedString<255>,
12135                    D,
12136                    val_ref,
12137                    decoder,
12138                    inner_offset,
12139                    inner_depth
12140                )?;
12141                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12142                {
12143                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12144                }
12145                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12146                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12147                }
12148            }
12149
12150            next_offset += envelope_size;
12151
12152            // Decode the remaining unknown envelopes.
12153            while next_offset < end_offset {
12154                _next_ordinal_to_read += 1;
12155                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12156                next_offset += envelope_size;
12157            }
12158
12159            Ok(())
12160        }
12161    }
12162
12163    impl RouteTableOptionsV6 {
12164        #[inline(always)]
12165        fn max_ordinal_present(&self) -> u64 {
12166            if let Some(_) = self.name {
12167                return 1;
12168            }
12169            0
12170        }
12171    }
12172
12173    impl fidl::encoding::ValueTypeMarker for RouteTableOptionsV6 {
12174        type Borrowed<'a> = &'a Self;
12175        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
12176            value
12177        }
12178    }
12179
12180    unsafe impl fidl::encoding::TypeMarker for RouteTableOptionsV6 {
12181        type Owned = Self;
12182
12183        #[inline(always)]
12184        fn inline_align(_context: fidl::encoding::Context) -> usize {
12185            8
12186        }
12187
12188        #[inline(always)]
12189        fn inline_size(_context: fidl::encoding::Context) -> usize {
12190            16
12191        }
12192    }
12193
12194    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RouteTableOptionsV6, D>
12195        for &RouteTableOptionsV6
12196    {
12197        unsafe fn encode(
12198            self,
12199            encoder: &mut fidl::encoding::Encoder<'_, D>,
12200            offset: usize,
12201            mut depth: fidl::encoding::Depth,
12202        ) -> fidl::Result<()> {
12203            encoder.debug_check_bounds::<RouteTableOptionsV6>(offset);
12204            // Vector header
12205            let max_ordinal: u64 = self.max_ordinal_present();
12206            encoder.write_num(max_ordinal, offset);
12207            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
12208            // Calling encoder.out_of_line_offset(0) is not allowed.
12209            if max_ordinal == 0 {
12210                return Ok(());
12211            }
12212            depth.increment()?;
12213            let envelope_size = 8;
12214            let bytes_len = max_ordinal as usize * envelope_size;
12215            #[allow(unused_variables)]
12216            let offset = encoder.out_of_line_offset(bytes_len);
12217            let mut _prev_end_offset: usize = 0;
12218            if 1 > max_ordinal {
12219                return Ok(());
12220            }
12221
12222            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
12223            // are envelope_size bytes.
12224            let cur_offset: usize = (1 - 1) * envelope_size;
12225
12226            // Zero reserved fields.
12227            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
12228
12229            // Safety:
12230            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
12231            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
12232            //   envelope_size bytes, there is always sufficient room.
12233            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>, D>(
12234                self.name.as_ref().map(
12235                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
12236                ),
12237                encoder,
12238                offset + cur_offset,
12239                depth,
12240            )?;
12241
12242            _prev_end_offset = cur_offset + envelope_size;
12243
12244            Ok(())
12245        }
12246    }
12247
12248    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RouteTableOptionsV6 {
12249        #[inline(always)]
12250        fn new_empty() -> Self {
12251            Self::default()
12252        }
12253
12254        unsafe fn decode(
12255            &mut self,
12256            decoder: &mut fidl::encoding::Decoder<'_, D>,
12257            offset: usize,
12258            mut depth: fidl::encoding::Depth,
12259        ) -> fidl::Result<()> {
12260            decoder.debug_check_bounds::<Self>(offset);
12261            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
12262                None => return Err(fidl::Error::NotNullable),
12263                Some(len) => len,
12264            };
12265            // Calling decoder.out_of_line_offset(0) is not allowed.
12266            if len == 0 {
12267                return Ok(());
12268            };
12269            depth.increment()?;
12270            let envelope_size = 8;
12271            let bytes_len = len * envelope_size;
12272            let offset = decoder.out_of_line_offset(bytes_len)?;
12273            // Decode the envelope for each type.
12274            let mut _next_ordinal_to_read = 0;
12275            let mut next_offset = offset;
12276            let end_offset = offset + bytes_len;
12277            _next_ordinal_to_read += 1;
12278            if next_offset >= end_offset {
12279                return Ok(());
12280            }
12281
12282            // Decode unknown envelopes for gaps in ordinals.
12283            while _next_ordinal_to_read < 1 {
12284                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12285                _next_ordinal_to_read += 1;
12286                next_offset += envelope_size;
12287            }
12288
12289            let next_out_of_line = decoder.next_out_of_line();
12290            let handles_before = decoder.remaining_handles();
12291            if let Some((inlined, num_bytes, num_handles)) =
12292                fidl::encoding::decode_envelope_header(decoder, next_offset)?
12293            {
12294                let member_inline_size =
12295                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
12296                        decoder.context,
12297                    );
12298                if inlined != (member_inline_size <= 4) {
12299                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
12300                }
12301                let inner_offset;
12302                let mut inner_depth = depth.clone();
12303                if inlined {
12304                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
12305                    inner_offset = next_offset;
12306                } else {
12307                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
12308                    inner_depth.increment()?;
12309                }
12310                let val_ref = self
12311                    .name
12312                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>, D));
12313                fidl::decode!(
12314                    fidl::encoding::BoundedString<255>,
12315                    D,
12316                    val_ref,
12317                    decoder,
12318                    inner_offset,
12319                    inner_depth
12320                )?;
12321                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
12322                {
12323                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
12324                }
12325                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
12326                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
12327                }
12328            }
12329
12330            next_offset += envelope_size;
12331
12332            // Decode the remaining unknown envelopes.
12333            while next_offset < end_offset {
12334                _next_ordinal_to_read += 1;
12335                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
12336                next_offset += envelope_size;
12337            }
12338
12339            Ok(())
12340        }
12341    }
12342}