fidl_fuchsia_net_routes_admin__common/
fidl_fuchsia_net_routes_admin__common.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::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11/// Error type returned when failing to authenticate an interface for a route
12/// set.
13#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
14pub enum AuthenticateForInterfaceError {
15    /// The provided
16    /// [`fuchsia.net.interfaces.admin/ProofOfinterfaceAuthorization`] was
17    /// invalid. This may happen if:
18    ///   - the provided proof's `interface_id' is unknown to the system,
19    ///   - the provided proof's `token` is unknown to the system, or
20    ///   - the provided proof`s `token` is not associated with the proof's
21    ///     `interface_id` (e.g., the `token` authenticates a different
22    ///     interface).
23    InvalidAuthentication,
24    #[doc(hidden)]
25    __SourceBreaking { unknown_ordinal: u32 },
26}
27
28/// Pattern that matches an unknown `AuthenticateForInterfaceError` member.
29#[macro_export]
30macro_rules! AuthenticateForInterfaceErrorUnknown {
31    () => {
32        _
33    };
34}
35
36impl AuthenticateForInterfaceError {
37    #[inline]
38    pub fn from_primitive(prim: u32) -> Option<Self> {
39        match prim {
40            1 => Some(Self::InvalidAuthentication),
41            _ => None,
42        }
43    }
44
45    #[inline]
46    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
47        match prim {
48            1 => Self::InvalidAuthentication,
49            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
50        }
51    }
52
53    #[inline]
54    pub fn unknown() -> Self {
55        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
56    }
57
58    #[inline]
59    pub const fn into_primitive(self) -> u32 {
60        match self {
61            Self::InvalidAuthentication => 1,
62            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
63        }
64    }
65
66    #[inline]
67    pub fn is_unknown(&self) -> bool {
68        match self {
69            Self::__SourceBreaking { unknown_ordinal: _ } => true,
70            _ => false,
71        }
72    }
73}
74
75/// Error type returned when failing to authenticate a route table for a
76/// rules set.
77#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
78pub enum AuthenticateForRouteTableError {
79    /// The provided authentication proof is invalid.
80    /// This may happen if:
81    ///   - the provided proof's `table_id' is unknown to the system,
82    ///   - the provided proof's `token` is unknown to the system, or
83    ///   - the provided proof`s `token` is not associated with the
84    ///     `table_id` (e.g., the `token` authenticates a different
85    ///     route table).
86    InvalidAuthentication,
87    #[doc(hidden)]
88    __SourceBreaking { unknown_ordinal: u32 },
89}
90
91/// Pattern that matches an unknown `AuthenticateForRouteTableError` member.
92#[macro_export]
93macro_rules! AuthenticateForRouteTableErrorUnknown {
94    () => {
95        _
96    };
97}
98
99impl AuthenticateForRouteTableError {
100    #[inline]
101    pub fn from_primitive(prim: u32) -> Option<Self> {
102        match prim {
103            1 => Some(Self::InvalidAuthentication),
104            _ => None,
105        }
106    }
107
108    #[inline]
109    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
110        match prim {
111            1 => Self::InvalidAuthentication,
112            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
113        }
114    }
115
116    #[inline]
117    pub fn unknown() -> Self {
118        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
119    }
120
121    #[inline]
122    pub const fn into_primitive(self) -> u32 {
123        match self {
124            Self::InvalidAuthentication => 1,
125            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
126        }
127    }
128
129    #[inline]
130    pub fn is_unknown(&self) -> bool {
131        match self {
132            Self::__SourceBreaking { unknown_ordinal: _ } => true,
133            _ => false,
134        }
135    }
136}
137
138#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
139pub enum BaseRouteTableRemoveError {
140    InvalidOpOnMainTable,
141    #[doc(hidden)]
142    __SourceBreaking {
143        unknown_ordinal: u32,
144    },
145}
146
147/// Pattern that matches an unknown `BaseRouteTableRemoveError` member.
148#[macro_export]
149macro_rules! BaseRouteTableRemoveErrorUnknown {
150    () => {
151        _
152    };
153}
154
155impl BaseRouteTableRemoveError {
156    #[inline]
157    pub fn from_primitive(prim: u32) -> Option<Self> {
158        match prim {
159            1 => Some(Self::InvalidOpOnMainTable),
160            _ => None,
161        }
162    }
163
164    #[inline]
165    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
166        match prim {
167            1 => Self::InvalidOpOnMainTable,
168            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
169        }
170    }
171
172    #[inline]
173    pub fn unknown() -> Self {
174        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
175    }
176
177    #[inline]
178    pub const fn into_primitive(self) -> u32 {
179        match self {
180            Self::InvalidOpOnMainTable => 1,
181            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
182        }
183    }
184
185    #[inline]
186    pub fn is_unknown(&self) -> bool {
187        match self {
188            Self::__SourceBreaking { unknown_ordinal: _ } => true,
189            _ => false,
190        }
191    }
192}
193
194/// Error type returned when failing to get a local route table for an interface.
195#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
196pub enum GetInterfaceLocalTableError {
197    /// The provided
198    /// [`fuchsia.net.interfaces.admin/ProofOfinterfaceAuthorization`] was
199    /// invalid. This may happen if:
200    ///   - the provided proof's `interface_id' is unknown to the system,
201    ///   - the provided proof's `token` is unknown to the system, or
202    ///   - the provided proof`s `token` is not associated with the proof's
203    ///     `interface_id` (e.g., the `token` authenticates a different
204    ///     interface).
205    InvalidAuthentication,
206    /// The interface does not have a local route table.
207    NoLocalRouteTable,
208    #[doc(hidden)]
209    __SourceBreaking { unknown_ordinal: u32 },
210}
211
212/// Pattern that matches an unknown `GetInterfaceLocalTableError` member.
213#[macro_export]
214macro_rules! GetInterfaceLocalTableErrorUnknown {
215    () => {
216        _
217    };
218}
219
220impl GetInterfaceLocalTableError {
221    #[inline]
222    pub fn from_primitive(prim: u32) -> Option<Self> {
223        match prim {
224            1 => Some(Self::InvalidAuthentication),
225            2 => Some(Self::NoLocalRouteTable),
226            _ => None,
227        }
228    }
229
230    #[inline]
231    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
232        match prim {
233            1 => Self::InvalidAuthentication,
234            2 => Self::NoLocalRouteTable,
235            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
236        }
237    }
238
239    #[inline]
240    pub fn unknown() -> Self {
241        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
242    }
243
244    #[inline]
245    pub const fn into_primitive(self) -> u32 {
246        match self {
247            Self::InvalidAuthentication => 1,
248            Self::NoLocalRouteTable => 2,
249            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
250        }
251    }
252
253    #[inline]
254    pub fn is_unknown(&self) -> bool {
255        match self {
256            Self::__SourceBreaking { unknown_ordinal: _ } => true,
257            _ => false,
258        }
259    }
260}
261
262/// Error type returned when failing to manipulate a route set.
263#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
264pub enum RouteSetError {
265    /// The route set attempted to add/remove a route that uses an
266    /// unauthenticated interface. Clients must first authenticate the route set
267    /// for a particular interface by calling `AuthenticateForInterface`, before
268    /// managing routes over the interface.
269    Unauthenticated,
270    /// This route specified a destination subnet that is invalid.
271    /// E.g. the prefixlen was invalid, or the subnet's host bits were set.
272    InvalidDestinationSubnet,
273    /// This route specified a target whose next-hop address is invalid.
274    /// Next-hop addresses must be unicast addresses.
275    InvalidNextHop,
276    /// The route set attempted to add/remove a route with an unsupported
277    /// `RouteAction` variant.
278    UnsupportedAction,
279    /// The route set attempted to add/remove a route that uses an interface
280    /// that was previously authenticated, but no longer exists.
281    PreviouslyAuthenticatedInterfaceNoLongerExists,
282    /// The route set attempted to add/remove a route that was missing required
283    /// specified properties.
284    MissingRouteProperties,
285    /// The route set attempted to add/remove a route that was missing a
286    /// metric.
287    MissingMetric,
288    #[doc(hidden)]
289    __SourceBreaking { unknown_ordinal: u32 },
290}
291
292/// Pattern that matches an unknown `RouteSetError` member.
293#[macro_export]
294macro_rules! RouteSetErrorUnknown {
295    () => {
296        _
297    };
298}
299
300impl RouteSetError {
301    #[inline]
302    pub fn from_primitive(prim: u32) -> Option<Self> {
303        match prim {
304            1 => Some(Self::Unauthenticated),
305            2 => Some(Self::InvalidDestinationSubnet),
306            3 => Some(Self::InvalidNextHop),
307            4 => Some(Self::UnsupportedAction),
308            5 => Some(Self::PreviouslyAuthenticatedInterfaceNoLongerExists),
309            6 => Some(Self::MissingRouteProperties),
310            7 => Some(Self::MissingMetric),
311            _ => None,
312        }
313    }
314
315    #[inline]
316    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
317        match prim {
318            1 => Self::Unauthenticated,
319            2 => Self::InvalidDestinationSubnet,
320            3 => Self::InvalidNextHop,
321            4 => Self::UnsupportedAction,
322            5 => Self::PreviouslyAuthenticatedInterfaceNoLongerExists,
323            6 => Self::MissingRouteProperties,
324            7 => Self::MissingMetric,
325            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
326        }
327    }
328
329    #[inline]
330    pub fn unknown() -> Self {
331        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
332    }
333
334    #[inline]
335    pub const fn into_primitive(self) -> u32 {
336        match self {
337            Self::Unauthenticated => 1,
338            Self::InvalidDestinationSubnet => 2,
339            Self::InvalidNextHop => 3,
340            Self::UnsupportedAction => 4,
341            Self::PreviouslyAuthenticatedInterfaceNoLongerExists => 5,
342            Self::MissingRouteProperties => 6,
343            Self::MissingMetric => 7,
344            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
345        }
346    }
347
348    #[inline]
349    pub fn is_unknown(&self) -> bool {
350        match self {
351            Self::__SourceBreaking { unknown_ordinal: _ } => true,
352            _ => false,
353        }
354    }
355}
356
357/// Possible errors for operating the rule set.
358#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
359pub enum RuleSetError {
360    /// Tried to install a rule referencing a route table that was not authorized
361    /// through `AuthenticateForRouteTable`.
362    Unauthenticated,
363    /// The action is invalid, for example, the action contains an invalid route
364    /// table.
365    InvalidAction,
366    /// Tried to install a rule at an index that already has an existing rule.
367    RuleAlreadyExists,
368    /// Tried to remove a rule at an index that does not have an existing rule.
369    RuleDoesNotExist,
370    /// The matcher is invalid, there are parts of the matcher that are invalid
371    /// on their own or mutually exclusive.
372    InvalidMatcher,
373    #[doc(hidden)]
374    __SourceBreaking { unknown_ordinal: u32 },
375}
376
377/// Pattern that matches an unknown `RuleSetError` member.
378#[macro_export]
379macro_rules! RuleSetErrorUnknown {
380    () => {
381        _
382    };
383}
384
385impl RuleSetError {
386    #[inline]
387    pub fn from_primitive(prim: u32) -> Option<Self> {
388        match prim {
389            1 => Some(Self::Unauthenticated),
390            2 => Some(Self::InvalidAction),
391            3 => Some(Self::RuleAlreadyExists),
392            4 => Some(Self::RuleDoesNotExist),
393            5 => Some(Self::InvalidMatcher),
394            _ => None,
395        }
396    }
397
398    #[inline]
399    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
400        match prim {
401            1 => Self::Unauthenticated,
402            2 => Self::InvalidAction,
403            3 => Self::RuleAlreadyExists,
404            4 => Self::RuleDoesNotExist,
405            5 => Self::InvalidMatcher,
406            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
407        }
408    }
409
410    #[inline]
411    pub fn unknown() -> Self {
412        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
413    }
414
415    #[inline]
416    pub const fn into_primitive(self) -> u32 {
417        match self {
418            Self::Unauthenticated => 1,
419            Self::InvalidAction => 2,
420            Self::RuleAlreadyExists => 3,
421            Self::RuleDoesNotExist => 4,
422            Self::InvalidMatcher => 5,
423            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
424        }
425    }
426
427    #[inline]
428    pub fn is_unknown(&self) -> bool {
429        match self {
430            Self::__SourceBreaking { unknown_ordinal: _ } => true,
431            _ => false,
432        }
433    }
434}
435
436#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
437#[repr(C)]
438pub struct BaseRouteTableGetTableIdResponse {
439    pub table_id: u32,
440}
441
442impl fidl::Persistable for BaseRouteTableGetTableIdResponse {}
443
444#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
445#[repr(C)]
446pub struct BaseRuleSetRemoveRuleRequest {
447    pub index: u32,
448}
449
450impl fidl::Persistable for BaseRuleSetRemoveRuleRequest {}
451
452#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
453pub struct RouteSetV4AddRouteResponse {
454    pub did_add: bool,
455}
456
457impl fidl::Persistable for RouteSetV4AddRouteResponse {}
458
459#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
460pub struct RouteSetV4RemoveRouteResponse {
461    pub did_remove: bool,
462}
463
464impl fidl::Persistable for RouteSetV4RemoveRouteResponse {}
465
466#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
467pub struct RouteSetV6AddRouteResponse {
468    pub did_add: bool,
469}
470
471impl fidl::Persistable for RouteSetV6AddRouteResponse {}
472
473#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
474pub struct RouteSetV6RemoveRouteResponse {
475    pub did_remove: bool,
476}
477
478impl fidl::Persistable for RouteSetV6RemoveRouteResponse {}
479
480#[derive(Clone, Debug, Default, PartialEq)]
481pub struct RouteTableOptionsV4 {
482    /// This name is optional and only used for debugging purposes.
483    pub name: Option<String>,
484    #[doc(hidden)]
485    pub __source_breaking: fidl::marker::SourceBreaking,
486}
487
488impl fidl::Persistable for RouteTableOptionsV4 {}
489
490#[derive(Clone, Debug, Default, PartialEq)]
491pub struct RouteTableOptionsV6 {
492    /// This name is optional and only used for debugging purposes.
493    pub name: Option<String>,
494    #[doc(hidden)]
495    pub __source_breaking: fidl::marker::SourceBreaking,
496}
497
498impl fidl::Persistable for RouteTableOptionsV6 {}
499
500pub mod base_route_table_ordinals {
501    pub const GET_TABLE_ID: u64 = 0x7eab30c55edbfc15;
502    pub const DETACH: u64 = 0x2853ab157285b384;
503    pub const REMOVE: u64 = 0xc42e58a5fc79426;
504    pub const GET_AUTHORIZATION_FOR_ROUTE_TABLE: u64 = 0x56a48c921ff3b6eb;
505}
506
507pub mod base_rule_set_ordinals {
508    pub const AUTHENTICATE_FOR_ROUTE_TABLE: u64 = 0x6fd845360ed9bc8f;
509    pub const REMOVE_RULE: u64 = 0x2ae3d7e817cbff90;
510    pub const CLOSE: u64 = 0x457e1753672d4073;
511}
512
513pub mod route_set_v4_ordinals {
514    pub const AUTHENTICATE_FOR_INTERFACE: u64 = 0x74841ceef127518e;
515    pub const ADD_ROUTE: u64 = 0x4bd69e45539e8ec0;
516    pub const REMOVE_ROUTE: u64 = 0x514f6880232f1665;
517}
518
519pub mod route_set_v6_ordinals {
520    pub const AUTHENTICATE_FOR_INTERFACE: u64 = 0x7d63a6a7aed6f640;
521    pub const ADD_ROUTE: u64 = 0x67a2bd2ee34ace2e;
522    pub const REMOVE_ROUTE: u64 = 0x4e5b7d4b1112cd82;
523}
524
525pub mod route_table_provider_v4_ordinals {
526    pub const NEW_ROUTE_TABLE: u64 = 0x703bc0eaf98f07cf;
527    pub const GET_INTERFACE_LOCAL_TABLE: u64 = 0x2596721a63bbacbd;
528}
529
530pub mod route_table_provider_v6_ordinals {
531    pub const NEW_ROUTE_TABLE: u64 = 0x152b67b397a31ca;
532    pub const GET_INTERFACE_LOCAL_TABLE: u64 = 0x6f82c1d63c3081f5;
533}
534
535pub mod route_table_v4_ordinals {
536    pub const GET_TABLE_ID: u64 = 0x7eab30c55edbfc15;
537    pub const DETACH: u64 = 0x2853ab157285b384;
538    pub const REMOVE: u64 = 0xc42e58a5fc79426;
539    pub const GET_AUTHORIZATION_FOR_ROUTE_TABLE: u64 = 0x56a48c921ff3b6eb;
540    pub const NEW_ROUTE_SET: u64 = 0x6aeb6d05698abedb;
541}
542
543pub mod route_table_v6_ordinals {
544    pub const GET_TABLE_ID: u64 = 0x7eab30c55edbfc15;
545    pub const DETACH: u64 = 0x2853ab157285b384;
546    pub const REMOVE: u64 = 0xc42e58a5fc79426;
547    pub const GET_AUTHORIZATION_FOR_ROUTE_TABLE: u64 = 0x56a48c921ff3b6eb;
548    pub const NEW_ROUTE_SET: u64 = 0x479aeaf9ad470141;
549}
550
551pub mod rule_set_v4_ordinals {
552    pub const AUTHENTICATE_FOR_ROUTE_TABLE: u64 = 0x6fd845360ed9bc8f;
553    pub const REMOVE_RULE: u64 = 0x2ae3d7e817cbff90;
554    pub const CLOSE: u64 = 0x457e1753672d4073;
555    pub const ADD_RULE: u64 = 0x7f68325de94e80;
556}
557
558pub mod rule_set_v6_ordinals {
559    pub const AUTHENTICATE_FOR_ROUTE_TABLE: u64 = 0x6fd845360ed9bc8f;
560    pub const REMOVE_RULE: u64 = 0x2ae3d7e817cbff90;
561    pub const CLOSE: u64 = 0x457e1753672d4073;
562    pub const ADD_RULE: u64 = 0x946cad8f8a726b3;
563}
564
565pub mod rule_table_v4_ordinals {
566    pub const NEW_RULE_SET: u64 = 0xa32a9097da46f3a;
567}
568
569pub mod rule_table_v6_ordinals {
570    pub const NEW_RULE_SET: u64 = 0x2261cc6eee9726a0;
571}
572
573mod internal {
574    use super::*;
575    unsafe impl fidl::encoding::TypeMarker for AuthenticateForInterfaceError {
576        type Owned = Self;
577
578        #[inline(always)]
579        fn inline_align(_context: fidl::encoding::Context) -> usize {
580            std::mem::align_of::<u32>()
581        }
582
583        #[inline(always)]
584        fn inline_size(_context: fidl::encoding::Context) -> usize {
585            std::mem::size_of::<u32>()
586        }
587
588        #[inline(always)]
589        fn encode_is_copy() -> bool {
590            false
591        }
592
593        #[inline(always)]
594        fn decode_is_copy() -> bool {
595            false
596        }
597    }
598
599    impl fidl::encoding::ValueTypeMarker for AuthenticateForInterfaceError {
600        type Borrowed<'a> = Self;
601        #[inline(always)]
602        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
603            *value
604        }
605    }
606
607    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
608        for AuthenticateForInterfaceError
609    {
610        #[inline]
611        unsafe fn encode(
612            self,
613            encoder: &mut fidl::encoding::Encoder<'_, D>,
614            offset: usize,
615            _depth: fidl::encoding::Depth,
616        ) -> fidl::Result<()> {
617            encoder.debug_check_bounds::<Self>(offset);
618            encoder.write_num(self.into_primitive(), offset);
619            Ok(())
620        }
621    }
622
623    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
624        for AuthenticateForInterfaceError
625    {
626        #[inline(always)]
627        fn new_empty() -> Self {
628            Self::unknown()
629        }
630
631        #[inline]
632        unsafe fn decode(
633            &mut self,
634            decoder: &mut fidl::encoding::Decoder<'_, D>,
635            offset: usize,
636            _depth: fidl::encoding::Depth,
637        ) -> fidl::Result<()> {
638            decoder.debug_check_bounds::<Self>(offset);
639            let prim = decoder.read_num::<u32>(offset);
640
641            *self = Self::from_primitive_allow_unknown(prim);
642            Ok(())
643        }
644    }
645    unsafe impl fidl::encoding::TypeMarker for AuthenticateForRouteTableError {
646        type Owned = Self;
647
648        #[inline(always)]
649        fn inline_align(_context: fidl::encoding::Context) -> usize {
650            std::mem::align_of::<u32>()
651        }
652
653        #[inline(always)]
654        fn inline_size(_context: fidl::encoding::Context) -> usize {
655            std::mem::size_of::<u32>()
656        }
657
658        #[inline(always)]
659        fn encode_is_copy() -> bool {
660            false
661        }
662
663        #[inline(always)]
664        fn decode_is_copy() -> bool {
665            false
666        }
667    }
668
669    impl fidl::encoding::ValueTypeMarker for AuthenticateForRouteTableError {
670        type Borrowed<'a> = Self;
671        #[inline(always)]
672        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
673            *value
674        }
675    }
676
677    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
678        for AuthenticateForRouteTableError
679    {
680        #[inline]
681        unsafe fn encode(
682            self,
683            encoder: &mut fidl::encoding::Encoder<'_, D>,
684            offset: usize,
685            _depth: fidl::encoding::Depth,
686        ) -> fidl::Result<()> {
687            encoder.debug_check_bounds::<Self>(offset);
688            encoder.write_num(self.into_primitive(), offset);
689            Ok(())
690        }
691    }
692
693    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
694        for AuthenticateForRouteTableError
695    {
696        #[inline(always)]
697        fn new_empty() -> Self {
698            Self::unknown()
699        }
700
701        #[inline]
702        unsafe fn decode(
703            &mut self,
704            decoder: &mut fidl::encoding::Decoder<'_, D>,
705            offset: usize,
706            _depth: fidl::encoding::Depth,
707        ) -> fidl::Result<()> {
708            decoder.debug_check_bounds::<Self>(offset);
709            let prim = decoder.read_num::<u32>(offset);
710
711            *self = Self::from_primitive_allow_unknown(prim);
712            Ok(())
713        }
714    }
715    unsafe impl fidl::encoding::TypeMarker for BaseRouteTableRemoveError {
716        type Owned = Self;
717
718        #[inline(always)]
719        fn inline_align(_context: fidl::encoding::Context) -> usize {
720            std::mem::align_of::<u32>()
721        }
722
723        #[inline(always)]
724        fn inline_size(_context: fidl::encoding::Context) -> usize {
725            std::mem::size_of::<u32>()
726        }
727
728        #[inline(always)]
729        fn encode_is_copy() -> bool {
730            false
731        }
732
733        #[inline(always)]
734        fn decode_is_copy() -> bool {
735            false
736        }
737    }
738
739    impl fidl::encoding::ValueTypeMarker for BaseRouteTableRemoveError {
740        type Borrowed<'a> = Self;
741        #[inline(always)]
742        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
743            *value
744        }
745    }
746
747    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
748        for BaseRouteTableRemoveError
749    {
750        #[inline]
751        unsafe fn encode(
752            self,
753            encoder: &mut fidl::encoding::Encoder<'_, D>,
754            offset: usize,
755            _depth: fidl::encoding::Depth,
756        ) -> fidl::Result<()> {
757            encoder.debug_check_bounds::<Self>(offset);
758            encoder.write_num(self.into_primitive(), offset);
759            Ok(())
760        }
761    }
762
763    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
764        for BaseRouteTableRemoveError
765    {
766        #[inline(always)]
767        fn new_empty() -> Self {
768            Self::unknown()
769        }
770
771        #[inline]
772        unsafe fn decode(
773            &mut self,
774            decoder: &mut fidl::encoding::Decoder<'_, D>,
775            offset: usize,
776            _depth: fidl::encoding::Depth,
777        ) -> fidl::Result<()> {
778            decoder.debug_check_bounds::<Self>(offset);
779            let prim = decoder.read_num::<u32>(offset);
780
781            *self = Self::from_primitive_allow_unknown(prim);
782            Ok(())
783        }
784    }
785    unsafe impl fidl::encoding::TypeMarker for GetInterfaceLocalTableError {
786        type Owned = Self;
787
788        #[inline(always)]
789        fn inline_align(_context: fidl::encoding::Context) -> usize {
790            std::mem::align_of::<u32>()
791        }
792
793        #[inline(always)]
794        fn inline_size(_context: fidl::encoding::Context) -> usize {
795            std::mem::size_of::<u32>()
796        }
797
798        #[inline(always)]
799        fn encode_is_copy() -> bool {
800            false
801        }
802
803        #[inline(always)]
804        fn decode_is_copy() -> bool {
805            false
806        }
807    }
808
809    impl fidl::encoding::ValueTypeMarker for GetInterfaceLocalTableError {
810        type Borrowed<'a> = Self;
811        #[inline(always)]
812        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
813            *value
814        }
815    }
816
817    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
818        for GetInterfaceLocalTableError
819    {
820        #[inline]
821        unsafe fn encode(
822            self,
823            encoder: &mut fidl::encoding::Encoder<'_, D>,
824            offset: usize,
825            _depth: fidl::encoding::Depth,
826        ) -> fidl::Result<()> {
827            encoder.debug_check_bounds::<Self>(offset);
828            encoder.write_num(self.into_primitive(), offset);
829            Ok(())
830        }
831    }
832
833    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
834        for GetInterfaceLocalTableError
835    {
836        #[inline(always)]
837        fn new_empty() -> Self {
838            Self::unknown()
839        }
840
841        #[inline]
842        unsafe fn decode(
843            &mut self,
844            decoder: &mut fidl::encoding::Decoder<'_, D>,
845            offset: usize,
846            _depth: fidl::encoding::Depth,
847        ) -> fidl::Result<()> {
848            decoder.debug_check_bounds::<Self>(offset);
849            let prim = decoder.read_num::<u32>(offset);
850
851            *self = Self::from_primitive_allow_unknown(prim);
852            Ok(())
853        }
854    }
855    unsafe impl fidl::encoding::TypeMarker for RouteSetError {
856        type Owned = Self;
857
858        #[inline(always)]
859        fn inline_align(_context: fidl::encoding::Context) -> usize {
860            std::mem::align_of::<u32>()
861        }
862
863        #[inline(always)]
864        fn inline_size(_context: fidl::encoding::Context) -> usize {
865            std::mem::size_of::<u32>()
866        }
867
868        #[inline(always)]
869        fn encode_is_copy() -> bool {
870            false
871        }
872
873        #[inline(always)]
874        fn decode_is_copy() -> bool {
875            false
876        }
877    }
878
879    impl fidl::encoding::ValueTypeMarker for RouteSetError {
880        type Borrowed<'a> = Self;
881        #[inline(always)]
882        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
883            *value
884        }
885    }
886
887    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for RouteSetError {
888        #[inline]
889        unsafe fn encode(
890            self,
891            encoder: &mut fidl::encoding::Encoder<'_, D>,
892            offset: usize,
893            _depth: fidl::encoding::Depth,
894        ) -> fidl::Result<()> {
895            encoder.debug_check_bounds::<Self>(offset);
896            encoder.write_num(self.into_primitive(), offset);
897            Ok(())
898        }
899    }
900
901    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RouteSetError {
902        #[inline(always)]
903        fn new_empty() -> Self {
904            Self::unknown()
905        }
906
907        #[inline]
908        unsafe fn decode(
909            &mut self,
910            decoder: &mut fidl::encoding::Decoder<'_, D>,
911            offset: usize,
912            _depth: fidl::encoding::Depth,
913        ) -> fidl::Result<()> {
914            decoder.debug_check_bounds::<Self>(offset);
915            let prim = decoder.read_num::<u32>(offset);
916
917            *self = Self::from_primitive_allow_unknown(prim);
918            Ok(())
919        }
920    }
921    unsafe impl fidl::encoding::TypeMarker for RuleSetError {
922        type Owned = Self;
923
924        #[inline(always)]
925        fn inline_align(_context: fidl::encoding::Context) -> usize {
926            std::mem::align_of::<u32>()
927        }
928
929        #[inline(always)]
930        fn inline_size(_context: fidl::encoding::Context) -> usize {
931            std::mem::size_of::<u32>()
932        }
933
934        #[inline(always)]
935        fn encode_is_copy() -> bool {
936            false
937        }
938
939        #[inline(always)]
940        fn decode_is_copy() -> bool {
941            false
942        }
943    }
944
945    impl fidl::encoding::ValueTypeMarker for RuleSetError {
946        type Borrowed<'a> = Self;
947        #[inline(always)]
948        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
949            *value
950        }
951    }
952
953    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for RuleSetError {
954        #[inline]
955        unsafe fn encode(
956            self,
957            encoder: &mut fidl::encoding::Encoder<'_, D>,
958            offset: usize,
959            _depth: fidl::encoding::Depth,
960        ) -> fidl::Result<()> {
961            encoder.debug_check_bounds::<Self>(offset);
962            encoder.write_num(self.into_primitive(), offset);
963            Ok(())
964        }
965    }
966
967    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RuleSetError {
968        #[inline(always)]
969        fn new_empty() -> Self {
970            Self::unknown()
971        }
972
973        #[inline]
974        unsafe fn decode(
975            &mut self,
976            decoder: &mut fidl::encoding::Decoder<'_, D>,
977            offset: usize,
978            _depth: fidl::encoding::Depth,
979        ) -> fidl::Result<()> {
980            decoder.debug_check_bounds::<Self>(offset);
981            let prim = decoder.read_num::<u32>(offset);
982
983            *self = Self::from_primitive_allow_unknown(prim);
984            Ok(())
985        }
986    }
987
988    impl fidl::encoding::ValueTypeMarker for BaseRouteTableGetTableIdResponse {
989        type Borrowed<'a> = &'a Self;
990        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
991            value
992        }
993    }
994
995    unsafe impl fidl::encoding::TypeMarker for BaseRouteTableGetTableIdResponse {
996        type Owned = Self;
997
998        #[inline(always)]
999        fn inline_align(_context: fidl::encoding::Context) -> usize {
1000            4
1001        }
1002
1003        #[inline(always)]
1004        fn inline_size(_context: fidl::encoding::Context) -> usize {
1005            4
1006        }
1007        #[inline(always)]
1008        fn encode_is_copy() -> bool {
1009            true
1010        }
1011
1012        #[inline(always)]
1013        fn decode_is_copy() -> bool {
1014            true
1015        }
1016    }
1017
1018    unsafe impl<D: fidl::encoding::ResourceDialect>
1019        fidl::encoding::Encode<BaseRouteTableGetTableIdResponse, D>
1020        for &BaseRouteTableGetTableIdResponse
1021    {
1022        #[inline]
1023        unsafe fn encode(
1024            self,
1025            encoder: &mut fidl::encoding::Encoder<'_, D>,
1026            offset: usize,
1027            _depth: fidl::encoding::Depth,
1028        ) -> fidl::Result<()> {
1029            encoder.debug_check_bounds::<BaseRouteTableGetTableIdResponse>(offset);
1030            unsafe {
1031                // Copy the object into the buffer.
1032                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1033                (buf_ptr as *mut BaseRouteTableGetTableIdResponse)
1034                    .write_unaligned((self as *const BaseRouteTableGetTableIdResponse).read());
1035                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1036                // done second because the memcpy will write garbage to these bytes.
1037            }
1038            Ok(())
1039        }
1040    }
1041    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
1042        fidl::encoding::Encode<BaseRouteTableGetTableIdResponse, D> for (T0,)
1043    {
1044        #[inline]
1045        unsafe fn encode(
1046            self,
1047            encoder: &mut fidl::encoding::Encoder<'_, D>,
1048            offset: usize,
1049            depth: fidl::encoding::Depth,
1050        ) -> fidl::Result<()> {
1051            encoder.debug_check_bounds::<BaseRouteTableGetTableIdResponse>(offset);
1052            // Zero out padding regions. There's no need to apply masks
1053            // because the unmasked parts will be overwritten by fields.
1054            // Write the fields.
1055            self.0.encode(encoder, offset + 0, depth)?;
1056            Ok(())
1057        }
1058    }
1059
1060    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1061        for BaseRouteTableGetTableIdResponse
1062    {
1063        #[inline(always)]
1064        fn new_empty() -> Self {
1065            Self { table_id: fidl::new_empty!(u32, D) }
1066        }
1067
1068        #[inline]
1069        unsafe fn decode(
1070            &mut self,
1071            decoder: &mut fidl::encoding::Decoder<'_, D>,
1072            offset: usize,
1073            _depth: fidl::encoding::Depth,
1074        ) -> fidl::Result<()> {
1075            decoder.debug_check_bounds::<Self>(offset);
1076            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1077            // Verify that padding bytes are zero.
1078            // Copy from the buffer into the object.
1079            unsafe {
1080                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1081            }
1082            Ok(())
1083        }
1084    }
1085
1086    impl fidl::encoding::ValueTypeMarker for BaseRuleSetRemoveRuleRequest {
1087        type Borrowed<'a> = &'a Self;
1088        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1089            value
1090        }
1091    }
1092
1093    unsafe impl fidl::encoding::TypeMarker for BaseRuleSetRemoveRuleRequest {
1094        type Owned = Self;
1095
1096        #[inline(always)]
1097        fn inline_align(_context: fidl::encoding::Context) -> usize {
1098            4
1099        }
1100
1101        #[inline(always)]
1102        fn inline_size(_context: fidl::encoding::Context) -> usize {
1103            4
1104        }
1105        #[inline(always)]
1106        fn encode_is_copy() -> bool {
1107            true
1108        }
1109
1110        #[inline(always)]
1111        fn decode_is_copy() -> bool {
1112            true
1113        }
1114    }
1115
1116    unsafe impl<D: fidl::encoding::ResourceDialect>
1117        fidl::encoding::Encode<BaseRuleSetRemoveRuleRequest, D> for &BaseRuleSetRemoveRuleRequest
1118    {
1119        #[inline]
1120        unsafe fn encode(
1121            self,
1122            encoder: &mut fidl::encoding::Encoder<'_, D>,
1123            offset: usize,
1124            _depth: fidl::encoding::Depth,
1125        ) -> fidl::Result<()> {
1126            encoder.debug_check_bounds::<BaseRuleSetRemoveRuleRequest>(offset);
1127            unsafe {
1128                // Copy the object into the buffer.
1129                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1130                (buf_ptr as *mut BaseRuleSetRemoveRuleRequest)
1131                    .write_unaligned((self as *const BaseRuleSetRemoveRuleRequest).read());
1132                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1133                // done second because the memcpy will write garbage to these bytes.
1134            }
1135            Ok(())
1136        }
1137    }
1138    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
1139        fidl::encoding::Encode<BaseRuleSetRemoveRuleRequest, D> for (T0,)
1140    {
1141        #[inline]
1142        unsafe fn encode(
1143            self,
1144            encoder: &mut fidl::encoding::Encoder<'_, D>,
1145            offset: usize,
1146            depth: fidl::encoding::Depth,
1147        ) -> fidl::Result<()> {
1148            encoder.debug_check_bounds::<BaseRuleSetRemoveRuleRequest>(offset);
1149            // Zero out padding regions. There's no need to apply masks
1150            // because the unmasked parts will be overwritten by fields.
1151            // Write the fields.
1152            self.0.encode(encoder, offset + 0, depth)?;
1153            Ok(())
1154        }
1155    }
1156
1157    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1158        for BaseRuleSetRemoveRuleRequest
1159    {
1160        #[inline(always)]
1161        fn new_empty() -> Self {
1162            Self { index: fidl::new_empty!(u32, D) }
1163        }
1164
1165        #[inline]
1166        unsafe fn decode(
1167            &mut self,
1168            decoder: &mut fidl::encoding::Decoder<'_, D>,
1169            offset: usize,
1170            _depth: fidl::encoding::Depth,
1171        ) -> fidl::Result<()> {
1172            decoder.debug_check_bounds::<Self>(offset);
1173            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1174            // Verify that padding bytes are zero.
1175            // Copy from the buffer into the object.
1176            unsafe {
1177                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
1178            }
1179            Ok(())
1180        }
1181    }
1182
1183    impl fidl::encoding::ValueTypeMarker for RouteSetV4AddRouteResponse {
1184        type Borrowed<'a> = &'a Self;
1185        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1186            value
1187        }
1188    }
1189
1190    unsafe impl fidl::encoding::TypeMarker for RouteSetV4AddRouteResponse {
1191        type Owned = Self;
1192
1193        #[inline(always)]
1194        fn inline_align(_context: fidl::encoding::Context) -> usize {
1195            1
1196        }
1197
1198        #[inline(always)]
1199        fn inline_size(_context: fidl::encoding::Context) -> usize {
1200            1
1201        }
1202    }
1203
1204    unsafe impl<D: fidl::encoding::ResourceDialect>
1205        fidl::encoding::Encode<RouteSetV4AddRouteResponse, D> for &RouteSetV4AddRouteResponse
1206    {
1207        #[inline]
1208        unsafe fn encode(
1209            self,
1210            encoder: &mut fidl::encoding::Encoder<'_, D>,
1211            offset: usize,
1212            _depth: fidl::encoding::Depth,
1213        ) -> fidl::Result<()> {
1214            encoder.debug_check_bounds::<RouteSetV4AddRouteResponse>(offset);
1215            // Delegate to tuple encoding.
1216            fidl::encoding::Encode::<RouteSetV4AddRouteResponse, D>::encode(
1217                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.did_add),),
1218                encoder,
1219                offset,
1220                _depth,
1221            )
1222        }
1223    }
1224    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1225        fidl::encoding::Encode<RouteSetV4AddRouteResponse, D> for (T0,)
1226    {
1227        #[inline]
1228        unsafe fn encode(
1229            self,
1230            encoder: &mut fidl::encoding::Encoder<'_, D>,
1231            offset: usize,
1232            depth: fidl::encoding::Depth,
1233        ) -> fidl::Result<()> {
1234            encoder.debug_check_bounds::<RouteSetV4AddRouteResponse>(offset);
1235            // Zero out padding regions. There's no need to apply masks
1236            // because the unmasked parts will be overwritten by fields.
1237            // Write the fields.
1238            self.0.encode(encoder, offset + 0, depth)?;
1239            Ok(())
1240        }
1241    }
1242
1243    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1244        for RouteSetV4AddRouteResponse
1245    {
1246        #[inline(always)]
1247        fn new_empty() -> Self {
1248            Self { did_add: fidl::new_empty!(bool, D) }
1249        }
1250
1251        #[inline]
1252        unsafe fn decode(
1253            &mut self,
1254            decoder: &mut fidl::encoding::Decoder<'_, D>,
1255            offset: usize,
1256            _depth: fidl::encoding::Depth,
1257        ) -> fidl::Result<()> {
1258            decoder.debug_check_bounds::<Self>(offset);
1259            // Verify that padding bytes are zero.
1260            fidl::decode!(bool, D, &mut self.did_add, decoder, offset + 0, _depth)?;
1261            Ok(())
1262        }
1263    }
1264
1265    impl fidl::encoding::ValueTypeMarker for RouteSetV4RemoveRouteResponse {
1266        type Borrowed<'a> = &'a Self;
1267        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1268            value
1269        }
1270    }
1271
1272    unsafe impl fidl::encoding::TypeMarker for RouteSetV4RemoveRouteResponse {
1273        type Owned = Self;
1274
1275        #[inline(always)]
1276        fn inline_align(_context: fidl::encoding::Context) -> usize {
1277            1
1278        }
1279
1280        #[inline(always)]
1281        fn inline_size(_context: fidl::encoding::Context) -> usize {
1282            1
1283        }
1284    }
1285
1286    unsafe impl<D: fidl::encoding::ResourceDialect>
1287        fidl::encoding::Encode<RouteSetV4RemoveRouteResponse, D>
1288        for &RouteSetV4RemoveRouteResponse
1289    {
1290        #[inline]
1291        unsafe fn encode(
1292            self,
1293            encoder: &mut fidl::encoding::Encoder<'_, D>,
1294            offset: usize,
1295            _depth: fidl::encoding::Depth,
1296        ) -> fidl::Result<()> {
1297            encoder.debug_check_bounds::<RouteSetV4RemoveRouteResponse>(offset);
1298            // Delegate to tuple encoding.
1299            fidl::encoding::Encode::<RouteSetV4RemoveRouteResponse, D>::encode(
1300                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.did_remove),),
1301                encoder,
1302                offset,
1303                _depth,
1304            )
1305        }
1306    }
1307    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1308        fidl::encoding::Encode<RouteSetV4RemoveRouteResponse, D> for (T0,)
1309    {
1310        #[inline]
1311        unsafe fn encode(
1312            self,
1313            encoder: &mut fidl::encoding::Encoder<'_, D>,
1314            offset: usize,
1315            depth: fidl::encoding::Depth,
1316        ) -> fidl::Result<()> {
1317            encoder.debug_check_bounds::<RouteSetV4RemoveRouteResponse>(offset);
1318            // Zero out padding regions. There's no need to apply masks
1319            // because the unmasked parts will be overwritten by fields.
1320            // Write the fields.
1321            self.0.encode(encoder, offset + 0, depth)?;
1322            Ok(())
1323        }
1324    }
1325
1326    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1327        for RouteSetV4RemoveRouteResponse
1328    {
1329        #[inline(always)]
1330        fn new_empty() -> Self {
1331            Self { did_remove: fidl::new_empty!(bool, D) }
1332        }
1333
1334        #[inline]
1335        unsafe fn decode(
1336            &mut self,
1337            decoder: &mut fidl::encoding::Decoder<'_, D>,
1338            offset: usize,
1339            _depth: fidl::encoding::Depth,
1340        ) -> fidl::Result<()> {
1341            decoder.debug_check_bounds::<Self>(offset);
1342            // Verify that padding bytes are zero.
1343            fidl::decode!(bool, D, &mut self.did_remove, decoder, offset + 0, _depth)?;
1344            Ok(())
1345        }
1346    }
1347
1348    impl fidl::encoding::ValueTypeMarker for RouteSetV6AddRouteResponse {
1349        type Borrowed<'a> = &'a Self;
1350        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1351            value
1352        }
1353    }
1354
1355    unsafe impl fidl::encoding::TypeMarker for RouteSetV6AddRouteResponse {
1356        type Owned = Self;
1357
1358        #[inline(always)]
1359        fn inline_align(_context: fidl::encoding::Context) -> usize {
1360            1
1361        }
1362
1363        #[inline(always)]
1364        fn inline_size(_context: fidl::encoding::Context) -> usize {
1365            1
1366        }
1367    }
1368
1369    unsafe impl<D: fidl::encoding::ResourceDialect>
1370        fidl::encoding::Encode<RouteSetV6AddRouteResponse, D> for &RouteSetV6AddRouteResponse
1371    {
1372        #[inline]
1373        unsafe fn encode(
1374            self,
1375            encoder: &mut fidl::encoding::Encoder<'_, D>,
1376            offset: usize,
1377            _depth: fidl::encoding::Depth,
1378        ) -> fidl::Result<()> {
1379            encoder.debug_check_bounds::<RouteSetV6AddRouteResponse>(offset);
1380            // Delegate to tuple encoding.
1381            fidl::encoding::Encode::<RouteSetV6AddRouteResponse, D>::encode(
1382                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.did_add),),
1383                encoder,
1384                offset,
1385                _depth,
1386            )
1387        }
1388    }
1389    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1390        fidl::encoding::Encode<RouteSetV6AddRouteResponse, D> for (T0,)
1391    {
1392        #[inline]
1393        unsafe fn encode(
1394            self,
1395            encoder: &mut fidl::encoding::Encoder<'_, D>,
1396            offset: usize,
1397            depth: fidl::encoding::Depth,
1398        ) -> fidl::Result<()> {
1399            encoder.debug_check_bounds::<RouteSetV6AddRouteResponse>(offset);
1400            // Zero out padding regions. There's no need to apply masks
1401            // because the unmasked parts will be overwritten by fields.
1402            // Write the fields.
1403            self.0.encode(encoder, offset + 0, depth)?;
1404            Ok(())
1405        }
1406    }
1407
1408    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1409        for RouteSetV6AddRouteResponse
1410    {
1411        #[inline(always)]
1412        fn new_empty() -> Self {
1413            Self { did_add: fidl::new_empty!(bool, D) }
1414        }
1415
1416        #[inline]
1417        unsafe fn decode(
1418            &mut self,
1419            decoder: &mut fidl::encoding::Decoder<'_, D>,
1420            offset: usize,
1421            _depth: fidl::encoding::Depth,
1422        ) -> fidl::Result<()> {
1423            decoder.debug_check_bounds::<Self>(offset);
1424            // Verify that padding bytes are zero.
1425            fidl::decode!(bool, D, &mut self.did_add, decoder, offset + 0, _depth)?;
1426            Ok(())
1427        }
1428    }
1429
1430    impl fidl::encoding::ValueTypeMarker for RouteSetV6RemoveRouteResponse {
1431        type Borrowed<'a> = &'a Self;
1432        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1433            value
1434        }
1435    }
1436
1437    unsafe impl fidl::encoding::TypeMarker for RouteSetV6RemoveRouteResponse {
1438        type Owned = Self;
1439
1440        #[inline(always)]
1441        fn inline_align(_context: fidl::encoding::Context) -> usize {
1442            1
1443        }
1444
1445        #[inline(always)]
1446        fn inline_size(_context: fidl::encoding::Context) -> usize {
1447            1
1448        }
1449    }
1450
1451    unsafe impl<D: fidl::encoding::ResourceDialect>
1452        fidl::encoding::Encode<RouteSetV6RemoveRouteResponse, D>
1453        for &RouteSetV6RemoveRouteResponse
1454    {
1455        #[inline]
1456        unsafe fn encode(
1457            self,
1458            encoder: &mut fidl::encoding::Encoder<'_, D>,
1459            offset: usize,
1460            _depth: fidl::encoding::Depth,
1461        ) -> fidl::Result<()> {
1462            encoder.debug_check_bounds::<RouteSetV6RemoveRouteResponse>(offset);
1463            // Delegate to tuple encoding.
1464            fidl::encoding::Encode::<RouteSetV6RemoveRouteResponse, D>::encode(
1465                (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.did_remove),),
1466                encoder,
1467                offset,
1468                _depth,
1469            )
1470        }
1471    }
1472    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1473        fidl::encoding::Encode<RouteSetV6RemoveRouteResponse, D> for (T0,)
1474    {
1475        #[inline]
1476        unsafe fn encode(
1477            self,
1478            encoder: &mut fidl::encoding::Encoder<'_, D>,
1479            offset: usize,
1480            depth: fidl::encoding::Depth,
1481        ) -> fidl::Result<()> {
1482            encoder.debug_check_bounds::<RouteSetV6RemoveRouteResponse>(offset);
1483            // Zero out padding regions. There's no need to apply masks
1484            // because the unmasked parts will be overwritten by fields.
1485            // Write the fields.
1486            self.0.encode(encoder, offset + 0, depth)?;
1487            Ok(())
1488        }
1489    }
1490
1491    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1492        for RouteSetV6RemoveRouteResponse
1493    {
1494        #[inline(always)]
1495        fn new_empty() -> Self {
1496            Self { did_remove: fidl::new_empty!(bool, D) }
1497        }
1498
1499        #[inline]
1500        unsafe fn decode(
1501            &mut self,
1502            decoder: &mut fidl::encoding::Decoder<'_, D>,
1503            offset: usize,
1504            _depth: fidl::encoding::Depth,
1505        ) -> fidl::Result<()> {
1506            decoder.debug_check_bounds::<Self>(offset);
1507            // Verify that padding bytes are zero.
1508            fidl::decode!(bool, D, &mut self.did_remove, decoder, offset + 0, _depth)?;
1509            Ok(())
1510        }
1511    }
1512
1513    impl RouteTableOptionsV4 {
1514        #[inline(always)]
1515        fn max_ordinal_present(&self) -> u64 {
1516            if let Some(_) = self.name {
1517                return 1;
1518            }
1519            0
1520        }
1521    }
1522
1523    impl fidl::encoding::ValueTypeMarker for RouteTableOptionsV4 {
1524        type Borrowed<'a> = &'a Self;
1525        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1526            value
1527        }
1528    }
1529
1530    unsafe impl fidl::encoding::TypeMarker for RouteTableOptionsV4 {
1531        type Owned = Self;
1532
1533        #[inline(always)]
1534        fn inline_align(_context: fidl::encoding::Context) -> usize {
1535            8
1536        }
1537
1538        #[inline(always)]
1539        fn inline_size(_context: fidl::encoding::Context) -> usize {
1540            16
1541        }
1542    }
1543
1544    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RouteTableOptionsV4, D>
1545        for &RouteTableOptionsV4
1546    {
1547        unsafe fn encode(
1548            self,
1549            encoder: &mut fidl::encoding::Encoder<'_, D>,
1550            offset: usize,
1551            mut depth: fidl::encoding::Depth,
1552        ) -> fidl::Result<()> {
1553            encoder.debug_check_bounds::<RouteTableOptionsV4>(offset);
1554            // Vector header
1555            let max_ordinal: u64 = self.max_ordinal_present();
1556            encoder.write_num(max_ordinal, offset);
1557            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1558            // Calling encoder.out_of_line_offset(0) is not allowed.
1559            if max_ordinal == 0 {
1560                return Ok(());
1561            }
1562            depth.increment()?;
1563            let envelope_size = 8;
1564            let bytes_len = max_ordinal as usize * envelope_size;
1565            #[allow(unused_variables)]
1566            let offset = encoder.out_of_line_offset(bytes_len);
1567            let mut _prev_end_offset: usize = 0;
1568            if 1 > max_ordinal {
1569                return Ok(());
1570            }
1571
1572            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1573            // are envelope_size bytes.
1574            let cur_offset: usize = (1 - 1) * envelope_size;
1575
1576            // Zero reserved fields.
1577            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1578
1579            // Safety:
1580            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1581            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1582            //   envelope_size bytes, there is always sufficient room.
1583            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>, D>(
1584                self.name.as_ref().map(
1585                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
1586                ),
1587                encoder,
1588                offset + cur_offset,
1589                depth,
1590            )?;
1591
1592            _prev_end_offset = cur_offset + envelope_size;
1593
1594            Ok(())
1595        }
1596    }
1597
1598    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RouteTableOptionsV4 {
1599        #[inline(always)]
1600        fn new_empty() -> Self {
1601            Self::default()
1602        }
1603
1604        unsafe fn decode(
1605            &mut self,
1606            decoder: &mut fidl::encoding::Decoder<'_, D>,
1607            offset: usize,
1608            mut depth: fidl::encoding::Depth,
1609        ) -> fidl::Result<()> {
1610            decoder.debug_check_bounds::<Self>(offset);
1611            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1612                None => return Err(fidl::Error::NotNullable),
1613                Some(len) => len,
1614            };
1615            // Calling decoder.out_of_line_offset(0) is not allowed.
1616            if len == 0 {
1617                return Ok(());
1618            };
1619            depth.increment()?;
1620            let envelope_size = 8;
1621            let bytes_len = len * envelope_size;
1622            let offset = decoder.out_of_line_offset(bytes_len)?;
1623            // Decode the envelope for each type.
1624            let mut _next_ordinal_to_read = 0;
1625            let mut next_offset = offset;
1626            let end_offset = offset + bytes_len;
1627            _next_ordinal_to_read += 1;
1628            if next_offset >= end_offset {
1629                return Ok(());
1630            }
1631
1632            // Decode unknown envelopes for gaps in ordinals.
1633            while _next_ordinal_to_read < 1 {
1634                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1635                _next_ordinal_to_read += 1;
1636                next_offset += envelope_size;
1637            }
1638
1639            let next_out_of_line = decoder.next_out_of_line();
1640            let handles_before = decoder.remaining_handles();
1641            if let Some((inlined, num_bytes, num_handles)) =
1642                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1643            {
1644                let member_inline_size =
1645                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
1646                        decoder.context,
1647                    );
1648                if inlined != (member_inline_size <= 4) {
1649                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1650                }
1651                let inner_offset;
1652                let mut inner_depth = depth.clone();
1653                if inlined {
1654                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1655                    inner_offset = next_offset;
1656                } else {
1657                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1658                    inner_depth.increment()?;
1659                }
1660                let val_ref = self
1661                    .name
1662                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>, D));
1663                fidl::decode!(
1664                    fidl::encoding::BoundedString<255>,
1665                    D,
1666                    val_ref,
1667                    decoder,
1668                    inner_offset,
1669                    inner_depth
1670                )?;
1671                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1672                {
1673                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1674                }
1675                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1676                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1677                }
1678            }
1679
1680            next_offset += envelope_size;
1681
1682            // Decode the remaining unknown envelopes.
1683            while next_offset < end_offset {
1684                _next_ordinal_to_read += 1;
1685                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1686                next_offset += envelope_size;
1687            }
1688
1689            Ok(())
1690        }
1691    }
1692
1693    impl RouteTableOptionsV6 {
1694        #[inline(always)]
1695        fn max_ordinal_present(&self) -> u64 {
1696            if let Some(_) = self.name {
1697                return 1;
1698            }
1699            0
1700        }
1701    }
1702
1703    impl fidl::encoding::ValueTypeMarker for RouteTableOptionsV6 {
1704        type Borrowed<'a> = &'a Self;
1705        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1706            value
1707        }
1708    }
1709
1710    unsafe impl fidl::encoding::TypeMarker for RouteTableOptionsV6 {
1711        type Owned = Self;
1712
1713        #[inline(always)]
1714        fn inline_align(_context: fidl::encoding::Context) -> usize {
1715            8
1716        }
1717
1718        #[inline(always)]
1719        fn inline_size(_context: fidl::encoding::Context) -> usize {
1720            16
1721        }
1722    }
1723
1724    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RouteTableOptionsV6, D>
1725        for &RouteTableOptionsV6
1726    {
1727        unsafe fn encode(
1728            self,
1729            encoder: &mut fidl::encoding::Encoder<'_, D>,
1730            offset: usize,
1731            mut depth: fidl::encoding::Depth,
1732        ) -> fidl::Result<()> {
1733            encoder.debug_check_bounds::<RouteTableOptionsV6>(offset);
1734            // Vector header
1735            let max_ordinal: u64 = self.max_ordinal_present();
1736            encoder.write_num(max_ordinal, offset);
1737            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1738            // Calling encoder.out_of_line_offset(0) is not allowed.
1739            if max_ordinal == 0 {
1740                return Ok(());
1741            }
1742            depth.increment()?;
1743            let envelope_size = 8;
1744            let bytes_len = max_ordinal as usize * envelope_size;
1745            #[allow(unused_variables)]
1746            let offset = encoder.out_of_line_offset(bytes_len);
1747            let mut _prev_end_offset: usize = 0;
1748            if 1 > max_ordinal {
1749                return Ok(());
1750            }
1751
1752            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1753            // are envelope_size bytes.
1754            let cur_offset: usize = (1 - 1) * envelope_size;
1755
1756            // Zero reserved fields.
1757            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1758
1759            // Safety:
1760            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1761            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1762            //   envelope_size bytes, there is always sufficient room.
1763            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>, D>(
1764                self.name.as_ref().map(
1765                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
1766                ),
1767                encoder,
1768                offset + cur_offset,
1769                depth,
1770            )?;
1771
1772            _prev_end_offset = cur_offset + envelope_size;
1773
1774            Ok(())
1775        }
1776    }
1777
1778    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RouteTableOptionsV6 {
1779        #[inline(always)]
1780        fn new_empty() -> Self {
1781            Self::default()
1782        }
1783
1784        unsafe fn decode(
1785            &mut self,
1786            decoder: &mut fidl::encoding::Decoder<'_, D>,
1787            offset: usize,
1788            mut depth: fidl::encoding::Depth,
1789        ) -> fidl::Result<()> {
1790            decoder.debug_check_bounds::<Self>(offset);
1791            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1792                None => return Err(fidl::Error::NotNullable),
1793                Some(len) => len,
1794            };
1795            // Calling decoder.out_of_line_offset(0) is not allowed.
1796            if len == 0 {
1797                return Ok(());
1798            };
1799            depth.increment()?;
1800            let envelope_size = 8;
1801            let bytes_len = len * envelope_size;
1802            let offset = decoder.out_of_line_offset(bytes_len)?;
1803            // Decode the envelope for each type.
1804            let mut _next_ordinal_to_read = 0;
1805            let mut next_offset = offset;
1806            let end_offset = offset + bytes_len;
1807            _next_ordinal_to_read += 1;
1808            if next_offset >= end_offset {
1809                return Ok(());
1810            }
1811
1812            // Decode unknown envelopes for gaps in ordinals.
1813            while _next_ordinal_to_read < 1 {
1814                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1815                _next_ordinal_to_read += 1;
1816                next_offset += envelope_size;
1817            }
1818
1819            let next_out_of_line = decoder.next_out_of_line();
1820            let handles_before = decoder.remaining_handles();
1821            if let Some((inlined, num_bytes, num_handles)) =
1822                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1823            {
1824                let member_inline_size =
1825                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
1826                        decoder.context,
1827                    );
1828                if inlined != (member_inline_size <= 4) {
1829                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1830                }
1831                let inner_offset;
1832                let mut inner_depth = depth.clone();
1833                if inlined {
1834                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1835                    inner_offset = next_offset;
1836                } else {
1837                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1838                    inner_depth.increment()?;
1839                }
1840                let val_ref = self
1841                    .name
1842                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>, D));
1843                fidl::decode!(
1844                    fidl::encoding::BoundedString<255>,
1845                    D,
1846                    val_ref,
1847                    decoder,
1848                    inner_offset,
1849                    inner_depth
1850                )?;
1851                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1852                {
1853                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1854                }
1855                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1856                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1857                }
1858            }
1859
1860            next_offset += envelope_size;
1861
1862            // Decode the remaining unknown envelopes.
1863            while next_offset < end_offset {
1864                _next_ordinal_to_read += 1;
1865                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1866                next_offset += envelope_size;
1867            }
1868
1869            Ok(())
1870        }
1871    }
1872}