Skip to main content

fidl_fuchsia_net_filter__common/
fidl_fuchsia_net_filter__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
11pub type ControllerId = String;
12
13/// A unique identifier for a [`Namespace`].
14pub type NamespaceId = String;
15
16/// The priority of the routine relative to other routines installed on the same
17/// hook. For a given packet traversing a given hook, all installed routines are
18/// executed in order of priority (stopping early only if a terminal action is
19/// hit).
20///
21/// If two routines are installed with the same priority on the same hook, the
22/// routine that was installed earlier will be evaluated first.
23pub type Priority = i32;
24
25/// The default priority of a routine relative to other routines installed on
26/// the same hook.
27pub const DEFAULT_ROUTINE_PRIORITY: i32 = 0;
28
29/// The largest number of changes that can be provided in a single call to
30/// `PushChanges`, or events that will be provided in a single `Watch` response.
31pub const MAX_BATCH_SIZE: u16 = 42;
32
33/// An arbitrary limit on the number of changes that can be applied in a single
34/// transactional update. Exists largely to prevent clients from being able to
35/// OOM the netstack.
36pub const MAX_COMMIT_SIZE: u16 = 1024;
37
38pub const MAX_NAME_LEN: u8 = 255;
39
40#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
41pub enum ChangeValidationError {
42    /// The change was not validated because an invalid change was
43    /// encountered before it.
44    NotReached,
45    /// The change was valid.
46    Ok,
47    /// The change included a resource that was missing a field that is
48    /// required to be specified.
49    MissingRequiredField,
50    /// The change included a rule with an invalid interface matcher.
51    InvalidInterfaceMatcher,
52    /// The change included a rule with an invalid address matcher.
53    InvalidAddressMatcher,
54    /// The change included a rule with an invalid port matcher.
55    InvalidPortMatcher,
56    /// The change included a transparent proxy action with an invalid
57    /// configuration (e.g. a local port of 0).
58    InvalidTransparentProxyAction,
59    /// The change included a NAT action with an invalid configuration
60    /// (e.g. a destination or source port of 0).
61    InvalidNatAction,
62    /// The change included an action with an invalid port range (e.g.
63    /// the range start was not <= range end).
64    InvalidPortRange,
65    #[doc(hidden)]
66    __SourceBreaking { unknown_ordinal: u32 },
67}
68
69/// Pattern that matches an unknown `ChangeValidationError` member.
70#[macro_export]
71macro_rules! ChangeValidationErrorUnknown {
72    () => {
73        _
74    };
75}
76
77impl ChangeValidationError {
78    #[inline]
79    pub fn from_primitive(prim: u32) -> Option<Self> {
80        match prim {
81            1 => Some(Self::NotReached),
82            2 => Some(Self::Ok),
83            3 => Some(Self::MissingRequiredField),
84            4 => Some(Self::InvalidInterfaceMatcher),
85            5 => Some(Self::InvalidAddressMatcher),
86            6 => Some(Self::InvalidPortMatcher),
87            7 => Some(Self::InvalidTransparentProxyAction),
88            8 => Some(Self::InvalidNatAction),
89            9 => Some(Self::InvalidPortRange),
90            _ => None,
91        }
92    }
93
94    #[inline]
95    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
96        match prim {
97            1 => Self::NotReached,
98            2 => Self::Ok,
99            3 => Self::MissingRequiredField,
100            4 => Self::InvalidInterfaceMatcher,
101            5 => Self::InvalidAddressMatcher,
102            6 => Self::InvalidPortMatcher,
103            7 => Self::InvalidTransparentProxyAction,
104            8 => Self::InvalidNatAction,
105            9 => Self::InvalidPortRange,
106            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
107        }
108    }
109
110    #[inline]
111    pub fn unknown() -> Self {
112        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
113    }
114
115    #[inline]
116    pub const fn into_primitive(self) -> u32 {
117        match self {
118            Self::NotReached => 1,
119            Self::Ok => 2,
120            Self::MissingRequiredField => 3,
121            Self::InvalidInterfaceMatcher => 4,
122            Self::InvalidAddressMatcher => 5,
123            Self::InvalidPortMatcher => 6,
124            Self::InvalidTransparentProxyAction => 7,
125            Self::InvalidNatAction => 8,
126            Self::InvalidPortRange => 9,
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 CommitError {
142    /// The change was not validated because an invalid change was
143    /// encountered before it.
144    NotReached,
145    /// The change was valid.
146    Ok,
147    /// The change referred to an unknown namespace.
148    NamespaceNotFound,
149    /// The change referred to an unknown routine.
150    RoutineNotFound,
151    /// The change referred to an unknown rule.
152    RuleNotFound,
153    /// One of the specified resources already exists.
154    AlreadyExists,
155    /// The change includes a rule that jumps to an installed routine.
156    TargetRoutineIsInstalled,
157    /// Invalid eBPF program Id.
158    InvalidEbpfProgramId,
159    #[doc(hidden)]
160    __SourceBreaking { unknown_ordinal: u32 },
161}
162
163/// Pattern that matches an unknown `CommitError` member.
164#[macro_export]
165macro_rules! CommitErrorUnknown {
166    () => {
167        _
168    };
169}
170
171impl CommitError {
172    #[inline]
173    pub fn from_primitive(prim: u32) -> Option<Self> {
174        match prim {
175            1 => Some(Self::NotReached),
176            2 => Some(Self::Ok),
177            3 => Some(Self::NamespaceNotFound),
178            4 => Some(Self::RoutineNotFound),
179            5 => Some(Self::RuleNotFound),
180            6 => Some(Self::AlreadyExists),
181            7 => Some(Self::TargetRoutineIsInstalled),
182            8 => Some(Self::InvalidEbpfProgramId),
183            _ => None,
184        }
185    }
186
187    #[inline]
188    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
189        match prim {
190            1 => Self::NotReached,
191            2 => Self::Ok,
192            3 => Self::NamespaceNotFound,
193            4 => Self::RoutineNotFound,
194            5 => Self::RuleNotFound,
195            6 => Self::AlreadyExists,
196            7 => Self::TargetRoutineIsInstalled,
197            8 => Self::InvalidEbpfProgramId,
198            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
199        }
200    }
201
202    #[inline]
203    pub fn unknown() -> Self {
204        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
205    }
206
207    #[inline]
208    pub const fn into_primitive(self) -> u32 {
209        match self {
210            Self::NotReached => 1,
211            Self::Ok => 2,
212            Self::NamespaceNotFound => 3,
213            Self::RoutineNotFound => 4,
214            Self::RuleNotFound => 5,
215            Self::AlreadyExists => 6,
216            Self::TargetRoutineIsInstalled => 7,
217            Self::InvalidEbpfProgramId => 8,
218            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
219        }
220    }
221
222    #[inline]
223    pub fn is_unknown(&self) -> bool {
224        match self {
225            Self::__SourceBreaking { unknown_ordinal: _ } => true,
226            _ => false,
227        }
228    }
229}
230
231#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
232pub enum Domain {
233    Ipv4,
234    Ipv6,
235    AllIp,
236    #[doc(hidden)]
237    __SourceBreaking {
238        unknown_ordinal: u32,
239    },
240}
241
242/// Pattern that matches an unknown `Domain` member.
243#[macro_export]
244macro_rules! DomainUnknown {
245    () => {
246        _
247    };
248}
249
250impl Domain {
251    #[inline]
252    pub fn from_primitive(prim: u32) -> Option<Self> {
253        match prim {
254            1 => Some(Self::Ipv4),
255            2 => Some(Self::Ipv6),
256            3 => Some(Self::AllIp),
257            _ => None,
258        }
259    }
260
261    #[inline]
262    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
263        match prim {
264            1 => Self::Ipv4,
265            2 => Self::Ipv6,
266            3 => Self::AllIp,
267            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
268        }
269    }
270
271    #[inline]
272    pub fn unknown() -> Self {
273        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
274    }
275
276    #[inline]
277    pub const fn into_primitive(self) -> u32 {
278        match self {
279            Self::Ipv4 => 1,
280            Self::Ipv6 => 2,
281            Self::AllIp => 3,
282            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
283        }
284    }
285
286    #[inline]
287    pub fn is_unknown(&self) -> bool {
288        match self {
289            Self::__SourceBreaking { unknown_ordinal: _ } => true,
290            _ => false,
291        }
292    }
293}
294
295#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
296pub enum IpInstallationHook {
297    Ingress,
298    LocalIngress,
299    Forwarding,
300    LocalEgress,
301    Egress,
302    #[doc(hidden)]
303    __SourceBreaking {
304        unknown_ordinal: u32,
305    },
306}
307
308/// Pattern that matches an unknown `IpInstallationHook` member.
309#[macro_export]
310macro_rules! IpInstallationHookUnknown {
311    () => {
312        _
313    };
314}
315
316impl IpInstallationHook {
317    #[inline]
318    pub fn from_primitive(prim: u32) -> Option<Self> {
319        match prim {
320            1 => Some(Self::Ingress),
321            2 => Some(Self::LocalIngress),
322            3 => Some(Self::Forwarding),
323            4 => Some(Self::LocalEgress),
324            5 => Some(Self::Egress),
325            _ => None,
326        }
327    }
328
329    #[inline]
330    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
331        match prim {
332            1 => Self::Ingress,
333            2 => Self::LocalIngress,
334            3 => Self::Forwarding,
335            4 => Self::LocalEgress,
336            5 => Self::Egress,
337            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
338        }
339    }
340
341    #[inline]
342    pub fn unknown() -> Self {
343        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
344    }
345
346    #[inline]
347    pub const fn into_primitive(self) -> u32 {
348        match self {
349            Self::Ingress => 1,
350            Self::LocalIngress => 2,
351            Self::Forwarding => 3,
352            Self::LocalEgress => 4,
353            Self::Egress => 5,
354            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
355        }
356    }
357
358    #[inline]
359    pub fn is_unknown(&self) -> bool {
360        match self {
361            Self::__SourceBreaking { unknown_ordinal: _ } => true,
362            _ => false,
363        }
364    }
365}
366
367#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
368pub enum NatInstallationHook {
369    Ingress,
370    LocalIngress,
371    LocalEgress,
372    Egress,
373    #[doc(hidden)]
374    __SourceBreaking {
375        unknown_ordinal: u32,
376    },
377}
378
379/// Pattern that matches an unknown `NatInstallationHook` member.
380#[macro_export]
381macro_rules! NatInstallationHookUnknown {
382    () => {
383        _
384    };
385}
386
387impl NatInstallationHook {
388    #[inline]
389    pub fn from_primitive(prim: u32) -> Option<Self> {
390        match prim {
391            1 => Some(Self::Ingress),
392            2 => Some(Self::LocalIngress),
393            3 => Some(Self::LocalEgress),
394            4 => Some(Self::Egress),
395            _ => None,
396        }
397    }
398
399    #[inline]
400    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
401        match prim {
402            1 => Self::Ingress,
403            2 => Self::LocalIngress,
404            3 => Self::LocalEgress,
405            4 => Self::Egress,
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::Ingress => 1,
419            Self::LocalIngress => 2,
420            Self::LocalEgress => 3,
421            Self::Egress => 4,
422            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
423        }
424    }
425
426    #[inline]
427    pub fn is_unknown(&self) -> bool {
428        match self {
429            Self::__SourceBreaking { unknown_ordinal: _ } => true,
430            _ => false,
431        }
432    }
433}
434
435#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
436#[repr(u32)]
437pub enum RegisterEbpfProgramError {
438    LinkFailed = 1,
439    /// Failed to initialize a map.
440    MapFailed = 2,
441    /// The program is already registered.
442    AlreadyRegistered = 3,
443    /// The request is missing a required field.
444    MissingRequiredField = 4,
445}
446
447impl RegisterEbpfProgramError {
448    #[inline]
449    pub fn from_primitive(prim: u32) -> Option<Self> {
450        match prim {
451            1 => Some(Self::LinkFailed),
452            2 => Some(Self::MapFailed),
453            3 => Some(Self::AlreadyRegistered),
454            4 => Some(Self::MissingRequiredField),
455            _ => None,
456        }
457    }
458
459    #[inline]
460    pub const fn into_primitive(self) -> u32 {
461        self as u32
462    }
463}
464
465/// The type of the message to send in REJECT action. The exact type of the
466/// rejection message sent depends on IP version of the protocol being processed.
467#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
468pub enum RejectType {
469    /// TCP RST packet.
470    ///
471    /// Allowed only for rules that match TCP packets.
472    TcpReset,
473    /// Network unreachable.
474    ///
475    /// IPv4: ICMP Destination network unreachable (type 3, code 0).
476    /// IPv6: ICMPv6 No route to destination (type 1, code 0).
477    NetUnreachable,
478    /// Host unreachable.
479    ///
480    /// IPv4: ICMP Host unreachable (type 3, code 1).
481    /// IPv6: ICMPv6 Address unreachable (type 1, code 3).
482    HostUnreachable,
483    /// Protocol unreachable.
484    ///
485    /// IPv4: ICMP Protocol unreachable (type 3, code 2).
486    /// IPv6: ICMPv6 Unrecognized Next Header type encountered (type 4, code 1).
487    ProtoUnreachable,
488    /// Port unreachable.
489    ///
490    /// IPv4: ICMP Port unreachable (type 3, code 3).
491    /// IPv6: ICMPv6 Port unreachable (type 1, code 4).
492    PortUnreachable,
493    /// Route to the destination network is prohibited.
494    ///
495    /// IPv4: ICMP Network administratively prohibited (type 3, code 9).
496    /// IPv6: ICMPv6 Source address failed ingress/egress policy (type 1, code 5).
497    RoutePolicyFail,
498    /// Reject route.
499    ///
500    /// IPv4: ICMP Host administratively prohibited (type 3, code 10).
501    /// IPv6: ICMPv6 Reject route to destination (type 1, code 6).
502    RejectRoute,
503    /// Communication administratively prohibited.
504    ///
505    /// IPv4: ICMP Communication administratively prohibited (type 3, code 13).
506    /// IPv6: ICMPv6 Communication administratively prohibited (type 1, code 1).
507    AdminProhibited,
508    #[doc(hidden)]
509    __SourceBreaking { unknown_ordinal: u32 },
510}
511
512/// Pattern that matches an unknown `RejectType` member.
513#[macro_export]
514macro_rules! RejectTypeUnknown {
515    () => {
516        _
517    };
518}
519
520impl RejectType {
521    #[inline]
522    pub fn from_primitive(prim: u32) -> Option<Self> {
523        match prim {
524            0 => Some(Self::TcpReset),
525            1 => Some(Self::NetUnreachable),
526            2 => Some(Self::HostUnreachable),
527            3 => Some(Self::ProtoUnreachable),
528            4 => Some(Self::PortUnreachable),
529            5 => Some(Self::RoutePolicyFail),
530            6 => Some(Self::RejectRoute),
531            7 => Some(Self::AdminProhibited),
532            _ => None,
533        }
534    }
535
536    #[inline]
537    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
538        match prim {
539            0 => Self::TcpReset,
540            1 => Self::NetUnreachable,
541            2 => Self::HostUnreachable,
542            3 => Self::ProtoUnreachable,
543            4 => Self::PortUnreachable,
544            5 => Self::RoutePolicyFail,
545            6 => Self::RejectRoute,
546            7 => Self::AdminProhibited,
547            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
548        }
549    }
550
551    #[inline]
552    pub fn unknown() -> Self {
553        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
554    }
555
556    #[inline]
557    pub const fn into_primitive(self) -> u32 {
558        match self {
559            Self::TcpReset => 0,
560            Self::NetUnreachable => 1,
561            Self::HostUnreachable => 2,
562            Self::ProtoUnreachable => 3,
563            Self::PortUnreachable => 4,
564            Self::RoutePolicyFail => 5,
565            Self::RejectRoute => 6,
566            Self::AdminProhibited => 7,
567            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
568        }
569    }
570
571    #[inline]
572    pub fn is_unknown(&self) -> bool {
573        match self {
574            Self::__SourceBreaking { unknown_ordinal: _ } => true,
575            _ => false,
576        }
577    }
578}
579
580#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
581#[repr(u32)]
582pub enum SocketControlAttachEbpfProgramError {
583    /// The specified configuration is not supported currently.
584    NotSupported = 1,
585    LinkFailed = 2,
586    /// Failed to initialize a map.
587    MapFailed = 3,
588    /// Another program is already attached to the hook.
589    DuplicateAttachment = 4,
590}
591
592impl SocketControlAttachEbpfProgramError {
593    #[inline]
594    pub fn from_primitive(prim: u32) -> Option<Self> {
595        match prim {
596            1 => Some(Self::NotSupported),
597            2 => Some(Self::LinkFailed),
598            3 => Some(Self::MapFailed),
599            4 => Some(Self::DuplicateAttachment),
600            _ => None,
601        }
602    }
603
604    #[inline]
605    pub const fn into_primitive(self) -> u32 {
606        self as u32
607    }
608}
609
610#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
611#[repr(u32)]
612pub enum SocketControlDetachEbpfProgramError {
613    /// No filters attached to the hook.
614    NotFound = 1,
615}
616
617impl SocketControlDetachEbpfProgramError {
618    #[inline]
619    pub fn from_primitive(prim: u32) -> Option<Self> {
620        match prim {
621            1 => Some(Self::NotFound),
622            _ => None,
623        }
624    }
625
626    #[inline]
627    pub const fn into_primitive(self) -> u32 {
628        self as u32
629    }
630}
631
632/// Hook to which a `SocketControl` client can attach an eBPF filter.
633#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
634pub enum SocketHook {
635    /// Runs for all packets delivered to local IP sockets.
636    Ingress,
637    /// Runs for all packets produced by local IP sockets.
638    Egress,
639    #[doc(hidden)]
640    __SourceBreaking { unknown_ordinal: u32 },
641}
642
643/// Pattern that matches an unknown `SocketHook` member.
644#[macro_export]
645macro_rules! SocketHookUnknown {
646    () => {
647        _
648    };
649}
650
651impl SocketHook {
652    #[inline]
653    pub fn from_primitive(prim: u32) -> Option<Self> {
654        match prim {
655            1 => Some(Self::Ingress),
656            2 => Some(Self::Egress),
657            _ => None,
658        }
659    }
660
661    #[inline]
662    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
663        match prim {
664            1 => Self::Ingress,
665            2 => Self::Egress,
666            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
667        }
668    }
669
670    #[inline]
671    pub fn unknown() -> Self {
672        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
673    }
674
675    #[inline]
676    pub const fn into_primitive(self) -> u32 {
677        match self {
678            Self::Ingress => 1,
679            Self::Egress => 2,
680            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
681        }
682    }
683
684    #[inline]
685    pub fn is_unknown(&self) -> bool {
686        match self {
687            Self::__SourceBreaking { unknown_ordinal: _ } => true,
688            _ => false,
689        }
690    }
691}
692
693#[derive(Clone, Debug, PartialEq)]
694pub struct AddedResource {
695    pub controller: String,
696    pub resource: Resource,
697}
698
699impl fidl::Persistable for AddedResource {}
700
701/// A unique identifier for a controller that is only visible to administrators
702/// of that controller. Useful for proving administrative access.
703#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
704#[repr(C)]
705pub struct ControllerKey {
706    /// The UUID bytes in little-endian order.
707    pub uuid: [u8; 16],
708}
709
710impl fidl::Persistable for ControllerKey {}
711
712#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
713pub struct Empty;
714
715impl fidl::Persistable for Empty {}
716
717#[derive(Clone, Debug, PartialEq)]
718pub struct ExistingResource {
719    pub controller: String,
720    pub resource: Resource,
721}
722
723impl fidl::Persistable for ExistingResource {}
724
725#[derive(Clone, Debug, PartialEq)]
726pub struct Mark {
727    /// The domain to apply the mark action.
728    pub domain: fidl_fuchsia_net__common::MarkDomain,
729    /// The action to apply.
730    pub action: MarkAction,
731}
732
733impl fidl::Persistable for Mark {}
734
735#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
736pub struct NamespaceControllerOnIdAssignedRequest {
737    pub id: String,
738}
739
740impl fidl::Persistable for NamespaceControllerOnIdAssignedRequest {}
741
742/// An inclusive range of transport-layer ports.
743#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
744#[repr(C)]
745pub struct PortRange {
746    /// The inclusive start of the port range.
747    pub start: u16,
748    /// The inclusive end of the port range.
749    pub end: u16,
750}
751
752impl fidl::Persistable for PortRange {}
753
754#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
755pub struct Reject {
756    /// The type of the message to send.
757    pub reject_type: RejectType,
758}
759
760impl fidl::Persistable for Reject {}
761
762#[derive(Clone, Debug, PartialEq)]
763pub struct RemovedResource {
764    pub controller: String,
765    pub resource: ResourceId,
766}
767
768impl fidl::Persistable for RemovedResource {}
769
770/// A unique identifier for a [`Routine`].
771#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
772pub struct RoutineId {
773    /// The namespace in which the routine is installed.
774    pub namespace: String,
775    /// The name of the routine.
776    ///
777    /// Must be unique within the namespace in which the routine is created.
778    pub name: String,
779}
780
781impl fidl::Persistable for RoutineId {}
782
783/// A rule is a set of criteria (matchers) and a resultant action.
784#[derive(Clone, Debug, PartialEq)]
785pub struct Rule {
786    /// The ID of the rule.
787    ///
788    /// Must be unique within the scope of the routine to which the rule is
789    /// added.
790    pub id: RuleId,
791    /// The criteria that a packet must match for the action to be executed.
792    pub matchers: Matchers,
793    /// The action to take on a matching packet.
794    pub action: Action,
795}
796
797impl fidl::Persistable for Rule {}
798
799/// A unique identifier for a [`Rule`].
800#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
801pub struct RuleId {
802    /// The routine to which the rule is added.
803    pub routine: RoutineId,
804    /// The index of the rule.
805    ///
806    /// Must be unique within the routine to which the rule is added. Within a
807    /// given routine, rules will be executed in order of `index`. Note that
808    /// indices in a routine can be sparse; this allows removal and insertion of
809    /// rules while maintaining stable indices for rules that were unchanged.
810    pub index: u32,
811}
812
813impl fidl::Persistable for RuleId {}
814
815#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
816#[repr(C)]
817pub struct SetMark {
818    /// The bits specified by this mask are cleared out from the existing
819    /// mark.
820    pub clearing_mask: u32,
821    /// This value is combined with the result of the masking using a
822    /// bitwise OR to get the final mark.
823    pub mark: u32,
824}
825
826impl fidl::Persistable for SetMark {}
827
828#[derive(Clone, Debug, PartialEq)]
829pub struct SocketAddr {
830    pub addr: fidl_fuchsia_net__common::IpAddress,
831    pub port: u16,
832}
833
834impl fidl::Persistable for SocketAddr {}
835
836#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
837pub struct SocketControlDetachEbpfProgramRequest {
838    pub hook: SocketHook,
839}
840
841impl fidl::Persistable for SocketControlDetachEbpfProgramRequest {}
842
843#[derive(Clone, Debug, PartialEq)]
844pub struct WatcherWatchResponse {
845    pub events: Vec<Event>,
846}
847
848impl fidl::Persistable for WatcherWatchResponse {}
849
850#[derive(Clone, Debug, Default, PartialEq)]
851pub struct InstalledIpRoutine {
852    /// The hook on which the routine is installed.
853    ///  * The `INGRESS` hook occurs for incoming traffic before a
854    ///    routing decision has been made.
855    ///  * The `LOCAL_INGRESS` hook occurs for incoming traffic that
856    ///    is destined for the local host.
857    ///  * The `FORWARDING` hook occurs for incoming traffic that is
858    ///    destined for another node.
859    ///  * The `LOCAL_EGRESS` hook occurs for locally-generated
860    ///    traffic before a final routing decision has been made.
861    ///  * The `EGRESS` hook occurs for all outgoing traffic after a
862    ///    routing decision has been made.
863    ///
864    /// Required.
865    pub hook: Option<IpInstallationHook>,
866    /// The priority of the routine relative to other routines
867    /// installed on the same hook.
868    ///
869    /// Interpreted as `DEFAULT_ROUTINE_PRIORITY` if unset.
870    pub priority: Option<i32>,
871    #[doc(hidden)]
872    pub __source_breaking: fidl::marker::SourceBreaking,
873}
874
875impl fidl::Persistable for InstalledIpRoutine {}
876
877#[derive(Clone, Debug, Default, PartialEq)]
878pub struct InstalledNatRoutine {
879    /// The optional hook in which to install the routine. If a
880    /// routine is not installed on a particular hook, it can only
881    /// be reached from other routines.
882    ///  * The `INGRESS` hook occurs for incoming traffic before a
883    ///    routing decision has been made.
884    ///  * The `LOCAL_INGRESS` hook occurs for incoming traffic that
885    ///    is destined for the local host.
886    ///  * The `LOCAL_EGRESS` hook occurs for locally-generated
887    ///    traffic before a routing decision has been made.
888    ///  * The `EGRESS` hook occurs for all outgoing traffic after a
889    ///    routing decision has been made.
890    ///
891    /// Required.
892    pub hook: Option<NatInstallationHook>,
893    /// The priority of the routine relative to other routines
894    /// installed on the same hook.
895    ///
896    /// Interpreted as `DEFAULT_ROUTINE_PRIORITY` if unset.
897    pub priority: Option<i32>,
898    #[doc(hidden)]
899    pub __source_breaking: fidl::marker::SourceBreaking,
900}
901
902impl fidl::Persistable for InstalledNatRoutine {}
903
904#[derive(Clone, Debug, Default, PartialEq)]
905pub struct IpRoutine {
906    /// Installed routines are evaluated iff a packet hits the hook on
907    /// which it is installed.
908    ///
909    /// Uninstalled routines are useful for organizational purposes and
910    /// are only traversed when jumped to from another routine.
911    ///
912    /// If left unset, will be an uninstalled routine.
913    pub installation: Option<InstalledIpRoutine>,
914    #[doc(hidden)]
915    pub __source_breaking: fidl::marker::SourceBreaking,
916}
917
918impl fidl::Persistable for IpRoutine {}
919
920#[derive(Clone, Debug, Default, PartialEq)]
921pub struct Masquerade {
922    /// The optional range of source ports used to rewrite the packet.
923    ///
924    /// The source port will be rewritten if necessary to ensure the
925    /// packet's flow does not conflict with an existing tracked connection.
926    /// Note that the source port may be rewritten whether or not this range
927    /// is specified.
928    ///
929    /// If specified, this overrides the default behavior and restricts the
930    /// range of possible values to which the source port can be rewritten.
931    pub src_port: Option<PortRange>,
932    #[doc(hidden)]
933    pub __source_breaking: fidl::marker::SourceBreaking,
934}
935
936impl fidl::Persistable for Masquerade {}
937
938/// The criteria that a packet must match for a rule to be applied.
939///
940/// Each field is optional, and will only be checked if provided. An unset
941/// field will be considered to match any packet. (An entirely empty table
942/// would match every packet.) Another way to think of the matching criteria
943/// for a given rule is as an AND of every provided matcher.
944///
945/// Some matchers are only available in certain contexts. For example, the
946/// `in_interface` is not available in the `EGRESS` hook. If a matcher is
947/// provided that is not available in the context in which the rule is
948/// installed, the installation will fail with an error.
949#[derive(Clone, Debug, Default, PartialEq)]
950pub struct Matchers {
951    /// The interface on which the packet entered the stack.
952    ///
953    /// Only available in `INGRESS`, `LOCAL_INGRESS`, and `FORWARDING`.
954    pub in_interface: Option<fidl_fuchsia_net_matchers__common::Interface>,
955    /// The interface through which the packet exits the stack.
956    ///
957    /// Only available in `FORWARDING`, `LOCAL_EGRESS`, and `EGRESS`.
958    pub out_interface: Option<fidl_fuchsia_net_matchers__common::Interface>,
959    /// Matcher for the source IP address.
960    pub src_addr: Option<fidl_fuchsia_net_matchers__common::Address>,
961    /// Matcher for the destination IP address.
962    pub dst_addr: Option<fidl_fuchsia_net_matchers__common::Address>,
963    /// Matchers for the transport layer protocol.
964    ///
965    /// Note that the variants of the `TransportProtocol` union allow matching
966    /// on the transport layer protocol itself; to match on specific properties
967    /// at the transport layer (such as TCP or UDP ports), clients should use
968    /// the fields of a protocol-specific matcher.
969    pub transport_protocol: Option<fidl_fuchsia_net_matchers__common::PacketTransportProtocol>,
970    /// An eBPF program used as a matcher.
971    ///
972    /// The program should be registered by calling
973    /// ['fuchsia.net.filter.NamespaceController/RegisterEbpfProgram'] prior to
974    /// committing the rule containing the matcher.
975    ///
976    /// When the program is executed, a non-zero result from the program
977    /// indicates a match.
978    pub ebpf_program: Option<fidl_fuchsia_ebpf__common::ProgramId>,
979    #[doc(hidden)]
980    pub __source_breaking: fidl::marker::SourceBreaking,
981}
982
983impl fidl::Persistable for Matchers {}
984
985/// A namespace.
986///
987/// A namespace is a scoped collection of filtering state, specifically
988/// [`Routine`]s. It is analogous to a table in Netfilter.
989#[derive(Clone, Debug, Default, PartialEq)]
990pub struct Namespace {
991    /// The identifier of the namespace.
992    ///
993    /// Must be unique within the scope of the controller in which the namespace
994    /// is created.
995    pub id: Option<String>,
996    /// The domain (or domains) in which the namespace operates.
997    pub domain: Option<Domain>,
998    #[doc(hidden)]
999    pub __source_breaking: fidl::marker::SourceBreaking,
1000}
1001
1002impl fidl::Persistable for Namespace {}
1003
1004#[derive(Clone, Debug, Default, PartialEq)]
1005pub struct NatRoutine {
1006    /// Installed routines are evaluated whenever a packet hits the hook
1007    /// on which it is installed.
1008    ///
1009    /// Uninstalled routines are useful for organizational purposes and
1010    /// are only traversed when jumped to from another routine.
1011    ///
1012    /// If left unset, will be an uninstalled routine.
1013    pub installation: Option<InstalledNatRoutine>,
1014    #[doc(hidden)]
1015    pub __source_breaking: fidl::marker::SourceBreaking,
1016}
1017
1018impl fidl::Persistable for NatRoutine {}
1019
1020#[derive(Clone, Debug, Default, PartialEq)]
1021pub struct Redirect {
1022    /// The optional range of destination ports used to rewrite the packet.
1023    ///
1024    /// If specified, the destination port of the packet will be rewritten
1025    /// to some randomly chosen port in the range. If absent, the
1026    /// destination port of the packet will not be rewritten.
1027    pub dst_port: Option<PortRange>,
1028    #[doc(hidden)]
1029    pub __source_breaking: fidl::marker::SourceBreaking,
1030}
1031
1032impl fidl::Persistable for Redirect {}
1033
1034/// A routine.
1035///
1036/// A routine is a sequence of [`Rule`]s. It is analogous to a chain in
1037/// Netfilter.
1038#[derive(Clone, Debug, Default, PartialEq)]
1039pub struct Routine {
1040    /// The ID of the routine.
1041    ///
1042    /// Must be unique within the scope of the namespace in which the routine is
1043    /// created.
1044    pub id: Option<RoutineId>,
1045    /// The type of the routine.
1046    ///
1047    /// IP routines can only include rules with ordinary filter actions, whereas
1048    /// NAT routines can also include rules with NAT actions.
1049    ///
1050    /// Note that NAT routines are only executed *once* for a given connection,
1051    /// for the first packet in the flow.
1052    pub type_: Option<RoutineType>,
1053    #[doc(hidden)]
1054    pub __source_breaking: fidl::marker::SourceBreaking,
1055}
1056
1057impl fidl::Persistable for Routine {}
1058
1059#[derive(Clone, Debug, Default, PartialEq)]
1060pub struct WatcherOptions {
1061    #[doc(hidden)]
1062    pub __source_breaking: fidl::marker::SourceBreaking,
1063}
1064
1065impl fidl::Persistable for WatcherOptions {}
1066
1067/// The action to take on a packet.
1068#[derive(Clone, Debug)]
1069pub enum Action {
1070    /// Accept the packet.
1071    ///
1072    /// This is a terminal action for the current *installed* routine, i.e. no
1073    /// further rules will be evaluated for this packet in the installed routine
1074    /// (or any subroutines) in which this rule is installed. Subsequent
1075    /// routines installed on the same hook will still be evaluated.
1076    Accept(Empty),
1077    /// Drop the packet.
1078    ///
1079    /// This is a terminal action, i.e. no further rules will be evaluated for
1080    /// this packet, even in other routines on the same hook.
1081    Drop(Empty),
1082    /// Jump from the current routine to the routine identified by the provided
1083    /// name.
1084    ///
1085    /// The target routine must be in the same namespace as the calling routine,
1086    /// and it cannot be installed on a hook; it must be an uninstalled routine.
1087    Jump(String),
1088    /// Stop evaluation of the current routine and return to the calling routine
1089    /// (the routine from which the current routine was jumped), continuing
1090    /// evaluation at the next rule.
1091    ///
1092    /// If invoked in an installed routine, equivalent to `accept`, given packets
1093    /// are accepted by default in the absence of any matching rules.
1094    Return_(Empty),
1095    /// Redirect the packet to a local socket without changing the packet header
1096    /// in any way.
1097    ///
1098    /// This is a terminal action for the current hook, i.e. no further rules
1099    /// will be evaluated for this packet, even in other routines on the same
1100    /// hook. However, note that this does not preclude actions on *other* hooks
1101    /// from having an effect on this packet; for example, a packet that hits
1102    /// TransparentProxy in INGRESS could still be dropped in LOCAL_INGRESS.
1103    ///
1104    /// This action is only valid in IP routines on the INGRESS hook. This action
1105    /// is also only valid in a rule that ensures the presence of a TCP or UDP
1106    /// header by matching on the transport protocol, so that the packet can be
1107    /// properly dispatched.
1108    ///
1109    /// Also note that transparently proxied packets will only be delivered to
1110    /// sockets with the transparent socket option enabled. If no such socket
1111    /// exists, the packet will be dropped.
1112    ///
1113    /// This is analogous to the `tproxy` statement in Netfilter.
1114    TransparentProxy(TransparentProxy_),
1115    /// A special case of destination NAT (DNAT) that redirects the packet to
1116    /// the local host.
1117    ///
1118    /// This is a terminal action for all NAT routines on the current hook. The
1119    /// packet is redirected by rewriting the destination IP address to one
1120    /// owned by the ingress interface (if operating on incoming traffic in
1121    /// INGRESS) or the loopback address (if operating on locally-generated
1122    /// traffic in LOCAL_EGRESS). If this rule is installed on INGRESS and no IP
1123    /// address is assigned to the incoming interface, the packet is dropped.
1124    ///
1125    /// As with all DNAT actions, this action is only valid in the INGRESS and
1126    /// LOCAL_EGRESS hooks. If a destination port is specified, this action is
1127    /// only valid in a rule that ensures the presence of a TCP or UDP header by
1128    /// matching on the transport protocol, so that the destination port can be
1129    /// rewritten.
1130    ///
1131    /// This is analogous to the `redirect` statement in Netfilter.
1132    Redirect(Redirect),
1133    /// A special case of source NAT (SNAT) that reassigns the source IP address
1134    /// of the packet to an address that is assigned to the outgoing interface.
1135    ///
1136    /// This is a terminal action for all NAT routines on the current hook. If
1137    /// no address is assigned to the outgoing interface, the packet will be
1138    /// dropped.
1139    ///
1140    /// This action is only valid in the EGRESS hook. If a source port range is
1141    /// specified, this action is only valid in a rule that ensures the presence
1142    /// of a TCP or UDP header by matching on the transport protocol, so that
1143    /// the source port can be rewritten.
1144    ///
1145    /// This is analogous to the `masquerade` statement in Netfilter.
1146    Masquerade(Masquerade),
1147    /// Applies the mark action to the given mark domain.
1148    ///
1149    /// This is a non-terminal action for both routines and hooks. This is also
1150    /// only available in [`IpRoutine`]s because [`NatRoutines`]s only runs on
1151    /// the first packet in a connection and it is likely a misconfiguration
1152    /// that packets after the first are marked differently or unmarked.
1153    ///
1154    /// Note: If we find use cases that justify this being in [`NatRoutine`]s we
1155    /// should relax this limitation and support it.
1156    ///
1157    /// This is analogous to the `mark` statement in Netfilter.
1158    Mark(Mark),
1159    /// A non-terminal action that does nothing. Useful to run matchers that may
1160    /// have side-effects, particularly eBPF matchers.
1161    None(Empty),
1162    /// Rejects the packet by dropping it and responding to the sender.
1163    ///
1164    /// `reject_type` defines the message sent back to the source address.
1165    /// Allowed only in [`IpRoutine`]'s installed at `LOCAL_INGRESS`,
1166    /// `FORWARDING` and `LOCAL_EGRESS` hooks.
1167    ///
1168    /// This is a terminal action.
1169    Reject(Reject),
1170    #[doc(hidden)]
1171    __SourceBreaking { unknown_ordinal: u64 },
1172}
1173
1174/// Pattern that matches an unknown `Action` member.
1175#[macro_export]
1176macro_rules! ActionUnknown {
1177    () => {
1178        _
1179    };
1180}
1181
1182// Custom PartialEq so that unknown variants are not equal to themselves.
1183impl PartialEq for Action {
1184    fn eq(&self, other: &Self) -> bool {
1185        match (self, other) {
1186            (Self::Accept(x), Self::Accept(y)) => *x == *y,
1187            (Self::Drop(x), Self::Drop(y)) => *x == *y,
1188            (Self::Jump(x), Self::Jump(y)) => *x == *y,
1189            (Self::Return_(x), Self::Return_(y)) => *x == *y,
1190            (Self::TransparentProxy(x), Self::TransparentProxy(y)) => *x == *y,
1191            (Self::Redirect(x), Self::Redirect(y)) => *x == *y,
1192            (Self::Masquerade(x), Self::Masquerade(y)) => *x == *y,
1193            (Self::Mark(x), Self::Mark(y)) => *x == *y,
1194            (Self::None(x), Self::None(y)) => *x == *y,
1195            (Self::Reject(x), Self::Reject(y)) => *x == *y,
1196            _ => false,
1197        }
1198    }
1199}
1200
1201impl Action {
1202    #[inline]
1203    pub fn ordinal(&self) -> u64 {
1204        match *self {
1205            Self::Accept(_) => 1,
1206            Self::Drop(_) => 2,
1207            Self::Jump(_) => 3,
1208            Self::Return_(_) => 4,
1209            Self::TransparentProxy(_) => 5,
1210            Self::Redirect(_) => 6,
1211            Self::Masquerade(_) => 7,
1212            Self::Mark(_) => 8,
1213            Self::None(_) => 9,
1214            Self::Reject(_) => 10,
1215            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1216        }
1217    }
1218
1219    #[inline]
1220    pub fn unknown_variant_for_testing() -> Self {
1221        Self::__SourceBreaking { unknown_ordinal: 0 }
1222    }
1223
1224    #[inline]
1225    pub fn is_unknown(&self) -> bool {
1226        match self {
1227            Self::__SourceBreaking { .. } => true,
1228            _ => false,
1229        }
1230    }
1231}
1232
1233impl fidl::Persistable for Action {}
1234
1235#[derive(Clone, Debug)]
1236pub enum Change {
1237    /// Create the specified resource.
1238    Create(Resource),
1239    /// Remove the specified resource, along with all of its contents.
1240    Remove(ResourceId),
1241    #[doc(hidden)]
1242    __SourceBreaking { unknown_ordinal: u64 },
1243}
1244
1245/// Pattern that matches an unknown `Change` member.
1246#[macro_export]
1247macro_rules! ChangeUnknown {
1248    () => {
1249        _
1250    };
1251}
1252
1253// Custom PartialEq so that unknown variants are not equal to themselves.
1254impl PartialEq for Change {
1255    fn eq(&self, other: &Self) -> bool {
1256        match (self, other) {
1257            (Self::Create(x), Self::Create(y)) => *x == *y,
1258            (Self::Remove(x), Self::Remove(y)) => *x == *y,
1259            _ => false,
1260        }
1261    }
1262}
1263
1264impl Change {
1265    #[inline]
1266    pub fn ordinal(&self) -> u64 {
1267        match *self {
1268            Self::Create(_) => 1,
1269            Self::Remove(_) => 2,
1270            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1271        }
1272    }
1273
1274    #[inline]
1275    pub fn unknown_variant_for_testing() -> Self {
1276        Self::__SourceBreaking { unknown_ordinal: 0 }
1277    }
1278
1279    #[inline]
1280    pub fn is_unknown(&self) -> bool {
1281        match self {
1282            Self::__SourceBreaking { .. } => true,
1283            _ => false,
1284        }
1285    }
1286}
1287
1288impl fidl::Persistable for Change {}
1289
1290#[derive(Clone, Debug)]
1291pub enum Event {
1292    Existing(ExistingResource),
1293    Added(AddedResource),
1294    Removed(RemovedResource),
1295    Idle(Empty),
1296    EndOfUpdate(Empty),
1297    #[doc(hidden)]
1298    __SourceBreaking {
1299        unknown_ordinal: u64,
1300    },
1301}
1302
1303/// Pattern that matches an unknown `Event` member.
1304#[macro_export]
1305macro_rules! EventUnknown {
1306    () => {
1307        _
1308    };
1309}
1310
1311// Custom PartialEq so that unknown variants are not equal to themselves.
1312impl PartialEq for Event {
1313    fn eq(&self, other: &Self) -> bool {
1314        match (self, other) {
1315            (Self::Existing(x), Self::Existing(y)) => *x == *y,
1316            (Self::Added(x), Self::Added(y)) => *x == *y,
1317            (Self::Removed(x), Self::Removed(y)) => *x == *y,
1318            (Self::Idle(x), Self::Idle(y)) => *x == *y,
1319            (Self::EndOfUpdate(x), Self::EndOfUpdate(y)) => *x == *y,
1320            _ => false,
1321        }
1322    }
1323}
1324
1325impl Event {
1326    #[inline]
1327    pub fn ordinal(&self) -> u64 {
1328        match *self {
1329            Self::Existing(_) => 1,
1330            Self::Added(_) => 2,
1331            Self::Removed(_) => 3,
1332            Self::Idle(_) => 4,
1333            Self::EndOfUpdate(_) => 5,
1334            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1335        }
1336    }
1337
1338    #[inline]
1339    pub fn unknown_variant_for_testing() -> Self {
1340        Self::__SourceBreaking { unknown_ordinal: 0 }
1341    }
1342
1343    #[inline]
1344    pub fn is_unknown(&self) -> bool {
1345        match self {
1346            Self::__SourceBreaking { .. } => true,
1347            _ => false,
1348        }
1349    }
1350}
1351
1352impl fidl::Persistable for Event {}
1353
1354/// An action that can be applied to a mark.
1355#[derive(Clone, Debug)]
1356pub enum MarkAction {
1357    /// This action sets the mark specified by the `mark` and `clearing_mask`.
1358    ///
1359    /// If the current mark is [`None`], it sets it to `mark`.
1360    SetMark(SetMark),
1361    #[doc(hidden)]
1362    __SourceBreaking { unknown_ordinal: u64 },
1363}
1364
1365/// Pattern that matches an unknown `MarkAction` member.
1366#[macro_export]
1367macro_rules! MarkActionUnknown {
1368    () => {
1369        _
1370    };
1371}
1372
1373// Custom PartialEq so that unknown variants are not equal to themselves.
1374impl PartialEq for MarkAction {
1375    fn eq(&self, other: &Self) -> bool {
1376        match (self, other) {
1377            (Self::SetMark(x), Self::SetMark(y)) => *x == *y,
1378            _ => false,
1379        }
1380    }
1381}
1382
1383impl MarkAction {
1384    #[inline]
1385    pub fn ordinal(&self) -> u64 {
1386        match *self {
1387            Self::SetMark(_) => 1,
1388            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1389        }
1390    }
1391
1392    #[inline]
1393    pub fn unknown_variant_for_testing() -> Self {
1394        Self::__SourceBreaking { unknown_ordinal: 0 }
1395    }
1396
1397    #[inline]
1398    pub fn is_unknown(&self) -> bool {
1399        match self {
1400            Self::__SourceBreaking { .. } => true,
1401            _ => false,
1402        }
1403    }
1404}
1405
1406impl fidl::Persistable for MarkAction {}
1407
1408/// A filtering resource.
1409#[derive(Clone, Debug)]
1410pub enum Resource {
1411    Namespace(Namespace),
1412    Routine(Routine),
1413    Rule(Rule),
1414    #[doc(hidden)]
1415    __SourceBreaking {
1416        unknown_ordinal: u64,
1417    },
1418}
1419
1420/// Pattern that matches an unknown `Resource` member.
1421#[macro_export]
1422macro_rules! ResourceUnknown {
1423    () => {
1424        _
1425    };
1426}
1427
1428// Custom PartialEq so that unknown variants are not equal to themselves.
1429impl PartialEq for Resource {
1430    fn eq(&self, other: &Self) -> bool {
1431        match (self, other) {
1432            (Self::Namespace(x), Self::Namespace(y)) => *x == *y,
1433            (Self::Routine(x), Self::Routine(y)) => *x == *y,
1434            (Self::Rule(x), Self::Rule(y)) => *x == *y,
1435            _ => false,
1436        }
1437    }
1438}
1439
1440impl Resource {
1441    #[inline]
1442    pub fn ordinal(&self) -> u64 {
1443        match *self {
1444            Self::Namespace(_) => 1,
1445            Self::Routine(_) => 2,
1446            Self::Rule(_) => 3,
1447            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1448        }
1449    }
1450
1451    #[inline]
1452    pub fn unknown_variant_for_testing() -> Self {
1453        Self::__SourceBreaking { unknown_ordinal: 0 }
1454    }
1455
1456    #[inline]
1457    pub fn is_unknown(&self) -> bool {
1458        match self {
1459            Self::__SourceBreaking { .. } => true,
1460            _ => false,
1461        }
1462    }
1463}
1464
1465impl fidl::Persistable for Resource {}
1466
1467/// An identifier for a filtering resource, unique within a controller's scope.
1468#[derive(Clone, Debug)]
1469pub enum ResourceId {
1470    Namespace(String),
1471    Routine(RoutineId),
1472    Rule(RuleId),
1473    #[doc(hidden)]
1474    __SourceBreaking {
1475        unknown_ordinal: u64,
1476    },
1477}
1478
1479/// Pattern that matches an unknown `ResourceId` member.
1480#[macro_export]
1481macro_rules! ResourceIdUnknown {
1482    () => {
1483        _
1484    };
1485}
1486
1487// Custom PartialEq so that unknown variants are not equal to themselves.
1488impl PartialEq for ResourceId {
1489    fn eq(&self, other: &Self) -> bool {
1490        match (self, other) {
1491            (Self::Namespace(x), Self::Namespace(y)) => *x == *y,
1492            (Self::Routine(x), Self::Routine(y)) => *x == *y,
1493            (Self::Rule(x), Self::Rule(y)) => *x == *y,
1494            _ => false,
1495        }
1496    }
1497}
1498
1499impl ResourceId {
1500    #[inline]
1501    pub fn ordinal(&self) -> u64 {
1502        match *self {
1503            Self::Namespace(_) => 1,
1504            Self::Routine(_) => 2,
1505            Self::Rule(_) => 3,
1506            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1507        }
1508    }
1509
1510    #[inline]
1511    pub fn unknown_variant_for_testing() -> Self {
1512        Self::__SourceBreaking { unknown_ordinal: 0 }
1513    }
1514
1515    #[inline]
1516    pub fn is_unknown(&self) -> bool {
1517        match self {
1518            Self::__SourceBreaking { .. } => true,
1519            _ => false,
1520        }
1521    }
1522}
1523
1524impl fidl::Persistable for ResourceId {}
1525
1526#[derive(Clone, Debug)]
1527pub enum RoutineType {
1528    Ip(IpRoutine),
1529    Nat(NatRoutine),
1530    #[doc(hidden)]
1531    __SourceBreaking {
1532        unknown_ordinal: u64,
1533    },
1534}
1535
1536/// Pattern that matches an unknown `RoutineType` member.
1537#[macro_export]
1538macro_rules! RoutineTypeUnknown {
1539    () => {
1540        _
1541    };
1542}
1543
1544// Custom PartialEq so that unknown variants are not equal to themselves.
1545impl PartialEq for RoutineType {
1546    fn eq(&self, other: &Self) -> bool {
1547        match (self, other) {
1548            (Self::Ip(x), Self::Ip(y)) => *x == *y,
1549            (Self::Nat(x), Self::Nat(y)) => *x == *y,
1550            _ => false,
1551        }
1552    }
1553}
1554
1555impl RoutineType {
1556    #[inline]
1557    pub fn ordinal(&self) -> u64 {
1558        match *self {
1559            Self::Ip(_) => 1,
1560            Self::Nat(_) => 2,
1561            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1562        }
1563    }
1564
1565    #[inline]
1566    pub fn unknown_variant_for_testing() -> Self {
1567        Self::__SourceBreaking { unknown_ordinal: 0 }
1568    }
1569
1570    #[inline]
1571    pub fn is_unknown(&self) -> bool {
1572        match self {
1573            Self::__SourceBreaking { .. } => true,
1574            _ => false,
1575        }
1576    }
1577}
1578
1579impl fidl::Persistable for RoutineType {}
1580
1581#[derive(Clone, Debug)]
1582pub enum TransparentProxy_ {
1583    /// The bound address of the local socket to redirect the packet to.
1584    ///
1585    /// The destination port of the packet is used for local delivery.
1586    LocalAddr(fidl_fuchsia_net__common::IpAddress),
1587    /// The bound port of the local socket to redirect the packet to. It
1588    /// must be nonzero.
1589    ///
1590    /// The destination IP address of the packet is used for local delivery.
1591    LocalPort(u16),
1592    /// The bound address and port of the local socket to redirect the
1593    /// packet to. The port must be nonzero.
1594    LocalAddrAndPort(SocketAddr),
1595    #[doc(hidden)]
1596    __SourceBreaking { unknown_ordinal: u64 },
1597}
1598
1599/// Pattern that matches an unknown `TransparentProxy_` member.
1600#[macro_export]
1601macro_rules! TransparentProxy_Unknown {
1602    () => {
1603        _
1604    };
1605}
1606
1607// Custom PartialEq so that unknown variants are not equal to themselves.
1608impl PartialEq for TransparentProxy_ {
1609    fn eq(&self, other: &Self) -> bool {
1610        match (self, other) {
1611            (Self::LocalAddr(x), Self::LocalAddr(y)) => *x == *y,
1612            (Self::LocalPort(x), Self::LocalPort(y)) => *x == *y,
1613            (Self::LocalAddrAndPort(x), Self::LocalAddrAndPort(y)) => *x == *y,
1614            _ => false,
1615        }
1616    }
1617}
1618
1619impl TransparentProxy_ {
1620    #[inline]
1621    pub fn ordinal(&self) -> u64 {
1622        match *self {
1623            Self::LocalAddr(_) => 1,
1624            Self::LocalPort(_) => 2,
1625            Self::LocalAddrAndPort(_) => 3,
1626            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1627        }
1628    }
1629
1630    #[inline]
1631    pub fn unknown_variant_for_testing() -> Self {
1632        Self::__SourceBreaking { unknown_ordinal: 0 }
1633    }
1634
1635    #[inline]
1636    pub fn is_unknown(&self) -> bool {
1637        match self {
1638            Self::__SourceBreaking { .. } => true,
1639            _ => false,
1640        }
1641    }
1642}
1643
1644impl fidl::Persistable for TransparentProxy_ {}
1645
1646pub mod control_ordinals {
1647    pub const OPEN_CONTROLLER: u64 = 0x2e1014a4c918d0e6;
1648    pub const REOPEN_DETACHED_CONTROLLER: u64 = 0x59cf56d70942967a;
1649}
1650
1651pub mod namespace_controller_ordinals {
1652    pub const ON_ID_ASSIGNED: u64 = 0x2e218c64a1d5ea74;
1653    pub const DETACH: u64 = 0x15db86969aaa7c37;
1654    pub const REGISTER_EBPF_PROGRAM: u64 = 0x65a03500ae88cc2b;
1655    pub const PUSH_CHANGES: u64 = 0x2c814d42c2783ee6;
1656    pub const COMMIT: u64 = 0x49ed5545357963e4;
1657}
1658
1659pub mod socket_control_ordinals {
1660    pub const ATTACH_EBPF_PROGRAM: u64 = 0x35076256e3cc40e;
1661    pub const DETACH_EBPF_PROGRAM: u64 = 0x226db36c461b6c1;
1662}
1663
1664pub mod state_ordinals {
1665    pub const GET_WATCHER: u64 = 0x663aae2b6bc5aa14;
1666}
1667
1668pub mod watcher_ordinals {
1669    pub const WATCH: u64 = 0x5f62165a0638ca75;
1670}
1671
1672mod internal {
1673    use super::*;
1674    unsafe impl fidl::encoding::TypeMarker for ChangeValidationError {
1675        type Owned = Self;
1676
1677        #[inline(always)]
1678        fn inline_align(_context: fidl::encoding::Context) -> usize {
1679            std::mem::align_of::<u32>()
1680        }
1681
1682        #[inline(always)]
1683        fn inline_size(_context: fidl::encoding::Context) -> usize {
1684            std::mem::size_of::<u32>()
1685        }
1686
1687        #[inline(always)]
1688        fn encode_is_copy() -> bool {
1689            false
1690        }
1691
1692        #[inline(always)]
1693        fn decode_is_copy() -> bool {
1694            false
1695        }
1696    }
1697
1698    impl fidl::encoding::ValueTypeMarker for ChangeValidationError {
1699        type Borrowed<'a> = Self;
1700        #[inline(always)]
1701        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1702            *value
1703        }
1704    }
1705
1706    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1707        for ChangeValidationError
1708    {
1709        #[inline]
1710        unsafe fn encode(
1711            self,
1712            encoder: &mut fidl::encoding::Encoder<'_, D>,
1713            offset: usize,
1714            _depth: fidl::encoding::Depth,
1715        ) -> fidl::Result<()> {
1716            encoder.debug_check_bounds::<Self>(offset);
1717            encoder.write_num(self.into_primitive(), offset);
1718            Ok(())
1719        }
1720    }
1721
1722    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChangeValidationError {
1723        #[inline(always)]
1724        fn new_empty() -> Self {
1725            Self::unknown()
1726        }
1727
1728        #[inline]
1729        unsafe fn decode(
1730            &mut self,
1731            decoder: &mut fidl::encoding::Decoder<'_, D>,
1732            offset: usize,
1733            _depth: fidl::encoding::Depth,
1734        ) -> fidl::Result<()> {
1735            decoder.debug_check_bounds::<Self>(offset);
1736            let prim = decoder.read_num::<u32>(offset);
1737
1738            *self = Self::from_primitive_allow_unknown(prim);
1739            Ok(())
1740        }
1741    }
1742    unsafe impl fidl::encoding::TypeMarker for CommitError {
1743        type Owned = Self;
1744
1745        #[inline(always)]
1746        fn inline_align(_context: fidl::encoding::Context) -> usize {
1747            std::mem::align_of::<u32>()
1748        }
1749
1750        #[inline(always)]
1751        fn inline_size(_context: fidl::encoding::Context) -> usize {
1752            std::mem::size_of::<u32>()
1753        }
1754
1755        #[inline(always)]
1756        fn encode_is_copy() -> bool {
1757            false
1758        }
1759
1760        #[inline(always)]
1761        fn decode_is_copy() -> bool {
1762            false
1763        }
1764    }
1765
1766    impl fidl::encoding::ValueTypeMarker for CommitError {
1767        type Borrowed<'a> = Self;
1768        #[inline(always)]
1769        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1770            *value
1771        }
1772    }
1773
1774    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for CommitError {
1775        #[inline]
1776        unsafe fn encode(
1777            self,
1778            encoder: &mut fidl::encoding::Encoder<'_, D>,
1779            offset: usize,
1780            _depth: fidl::encoding::Depth,
1781        ) -> fidl::Result<()> {
1782            encoder.debug_check_bounds::<Self>(offset);
1783            encoder.write_num(self.into_primitive(), offset);
1784            Ok(())
1785        }
1786    }
1787
1788    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CommitError {
1789        #[inline(always)]
1790        fn new_empty() -> Self {
1791            Self::unknown()
1792        }
1793
1794        #[inline]
1795        unsafe fn decode(
1796            &mut self,
1797            decoder: &mut fidl::encoding::Decoder<'_, D>,
1798            offset: usize,
1799            _depth: fidl::encoding::Depth,
1800        ) -> fidl::Result<()> {
1801            decoder.debug_check_bounds::<Self>(offset);
1802            let prim = decoder.read_num::<u32>(offset);
1803
1804            *self = Self::from_primitive_allow_unknown(prim);
1805            Ok(())
1806        }
1807    }
1808    unsafe impl fidl::encoding::TypeMarker for Domain {
1809        type Owned = Self;
1810
1811        #[inline(always)]
1812        fn inline_align(_context: fidl::encoding::Context) -> usize {
1813            std::mem::align_of::<u32>()
1814        }
1815
1816        #[inline(always)]
1817        fn inline_size(_context: fidl::encoding::Context) -> usize {
1818            std::mem::size_of::<u32>()
1819        }
1820
1821        #[inline(always)]
1822        fn encode_is_copy() -> bool {
1823            false
1824        }
1825
1826        #[inline(always)]
1827        fn decode_is_copy() -> bool {
1828            false
1829        }
1830    }
1831
1832    impl fidl::encoding::ValueTypeMarker for Domain {
1833        type Borrowed<'a> = Self;
1834        #[inline(always)]
1835        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1836            *value
1837        }
1838    }
1839
1840    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Domain {
1841        #[inline]
1842        unsafe fn encode(
1843            self,
1844            encoder: &mut fidl::encoding::Encoder<'_, D>,
1845            offset: usize,
1846            _depth: fidl::encoding::Depth,
1847        ) -> fidl::Result<()> {
1848            encoder.debug_check_bounds::<Self>(offset);
1849            encoder.write_num(self.into_primitive(), offset);
1850            Ok(())
1851        }
1852    }
1853
1854    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Domain {
1855        #[inline(always)]
1856        fn new_empty() -> Self {
1857            Self::unknown()
1858        }
1859
1860        #[inline]
1861        unsafe fn decode(
1862            &mut self,
1863            decoder: &mut fidl::encoding::Decoder<'_, D>,
1864            offset: usize,
1865            _depth: fidl::encoding::Depth,
1866        ) -> fidl::Result<()> {
1867            decoder.debug_check_bounds::<Self>(offset);
1868            let prim = decoder.read_num::<u32>(offset);
1869
1870            *self = Self::from_primitive_allow_unknown(prim);
1871            Ok(())
1872        }
1873    }
1874    unsafe impl fidl::encoding::TypeMarker for IpInstallationHook {
1875        type Owned = Self;
1876
1877        #[inline(always)]
1878        fn inline_align(_context: fidl::encoding::Context) -> usize {
1879            std::mem::align_of::<u32>()
1880        }
1881
1882        #[inline(always)]
1883        fn inline_size(_context: fidl::encoding::Context) -> usize {
1884            std::mem::size_of::<u32>()
1885        }
1886
1887        #[inline(always)]
1888        fn encode_is_copy() -> bool {
1889            false
1890        }
1891
1892        #[inline(always)]
1893        fn decode_is_copy() -> bool {
1894            false
1895        }
1896    }
1897
1898    impl fidl::encoding::ValueTypeMarker for IpInstallationHook {
1899        type Borrowed<'a> = Self;
1900        #[inline(always)]
1901        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1902            *value
1903        }
1904    }
1905
1906    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1907        for IpInstallationHook
1908    {
1909        #[inline]
1910        unsafe fn encode(
1911            self,
1912            encoder: &mut fidl::encoding::Encoder<'_, D>,
1913            offset: usize,
1914            _depth: fidl::encoding::Depth,
1915        ) -> fidl::Result<()> {
1916            encoder.debug_check_bounds::<Self>(offset);
1917            encoder.write_num(self.into_primitive(), offset);
1918            Ok(())
1919        }
1920    }
1921
1922    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IpInstallationHook {
1923        #[inline(always)]
1924        fn new_empty() -> Self {
1925            Self::unknown()
1926        }
1927
1928        #[inline]
1929        unsafe fn decode(
1930            &mut self,
1931            decoder: &mut fidl::encoding::Decoder<'_, D>,
1932            offset: usize,
1933            _depth: fidl::encoding::Depth,
1934        ) -> fidl::Result<()> {
1935            decoder.debug_check_bounds::<Self>(offset);
1936            let prim = decoder.read_num::<u32>(offset);
1937
1938            *self = Self::from_primitive_allow_unknown(prim);
1939            Ok(())
1940        }
1941    }
1942    unsafe impl fidl::encoding::TypeMarker for NatInstallationHook {
1943        type Owned = Self;
1944
1945        #[inline(always)]
1946        fn inline_align(_context: fidl::encoding::Context) -> usize {
1947            std::mem::align_of::<u32>()
1948        }
1949
1950        #[inline(always)]
1951        fn inline_size(_context: fidl::encoding::Context) -> usize {
1952            std::mem::size_of::<u32>()
1953        }
1954
1955        #[inline(always)]
1956        fn encode_is_copy() -> bool {
1957            false
1958        }
1959
1960        #[inline(always)]
1961        fn decode_is_copy() -> bool {
1962            false
1963        }
1964    }
1965
1966    impl fidl::encoding::ValueTypeMarker for NatInstallationHook {
1967        type Borrowed<'a> = Self;
1968        #[inline(always)]
1969        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1970            *value
1971        }
1972    }
1973
1974    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1975        for NatInstallationHook
1976    {
1977        #[inline]
1978        unsafe fn encode(
1979            self,
1980            encoder: &mut fidl::encoding::Encoder<'_, D>,
1981            offset: usize,
1982            _depth: fidl::encoding::Depth,
1983        ) -> fidl::Result<()> {
1984            encoder.debug_check_bounds::<Self>(offset);
1985            encoder.write_num(self.into_primitive(), offset);
1986            Ok(())
1987        }
1988    }
1989
1990    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NatInstallationHook {
1991        #[inline(always)]
1992        fn new_empty() -> Self {
1993            Self::unknown()
1994        }
1995
1996        #[inline]
1997        unsafe fn decode(
1998            &mut self,
1999            decoder: &mut fidl::encoding::Decoder<'_, D>,
2000            offset: usize,
2001            _depth: fidl::encoding::Depth,
2002        ) -> fidl::Result<()> {
2003            decoder.debug_check_bounds::<Self>(offset);
2004            let prim = decoder.read_num::<u32>(offset);
2005
2006            *self = Self::from_primitive_allow_unknown(prim);
2007            Ok(())
2008        }
2009    }
2010    unsafe impl fidl::encoding::TypeMarker for RegisterEbpfProgramError {
2011        type Owned = Self;
2012
2013        #[inline(always)]
2014        fn inline_align(_context: fidl::encoding::Context) -> usize {
2015            std::mem::align_of::<u32>()
2016        }
2017
2018        #[inline(always)]
2019        fn inline_size(_context: fidl::encoding::Context) -> usize {
2020            std::mem::size_of::<u32>()
2021        }
2022
2023        #[inline(always)]
2024        fn encode_is_copy() -> bool {
2025            true
2026        }
2027
2028        #[inline(always)]
2029        fn decode_is_copy() -> bool {
2030            false
2031        }
2032    }
2033
2034    impl fidl::encoding::ValueTypeMarker for RegisterEbpfProgramError {
2035        type Borrowed<'a> = Self;
2036        #[inline(always)]
2037        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2038            *value
2039        }
2040    }
2041
2042    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2043        for RegisterEbpfProgramError
2044    {
2045        #[inline]
2046        unsafe fn encode(
2047            self,
2048            encoder: &mut fidl::encoding::Encoder<'_, D>,
2049            offset: usize,
2050            _depth: fidl::encoding::Depth,
2051        ) -> fidl::Result<()> {
2052            encoder.debug_check_bounds::<Self>(offset);
2053            encoder.write_num(self.into_primitive(), offset);
2054            Ok(())
2055        }
2056    }
2057
2058    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2059        for RegisterEbpfProgramError
2060    {
2061        #[inline(always)]
2062        fn new_empty() -> Self {
2063            Self::LinkFailed
2064        }
2065
2066        #[inline]
2067        unsafe fn decode(
2068            &mut self,
2069            decoder: &mut fidl::encoding::Decoder<'_, D>,
2070            offset: usize,
2071            _depth: fidl::encoding::Depth,
2072        ) -> fidl::Result<()> {
2073            decoder.debug_check_bounds::<Self>(offset);
2074            let prim = decoder.read_num::<u32>(offset);
2075
2076            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
2077            Ok(())
2078        }
2079    }
2080    unsafe impl fidl::encoding::TypeMarker for RejectType {
2081        type Owned = Self;
2082
2083        #[inline(always)]
2084        fn inline_align(_context: fidl::encoding::Context) -> usize {
2085            std::mem::align_of::<u32>()
2086        }
2087
2088        #[inline(always)]
2089        fn inline_size(_context: fidl::encoding::Context) -> usize {
2090            std::mem::size_of::<u32>()
2091        }
2092
2093        #[inline(always)]
2094        fn encode_is_copy() -> bool {
2095            false
2096        }
2097
2098        #[inline(always)]
2099        fn decode_is_copy() -> bool {
2100            false
2101        }
2102    }
2103
2104    impl fidl::encoding::ValueTypeMarker for RejectType {
2105        type Borrowed<'a> = Self;
2106        #[inline(always)]
2107        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2108            *value
2109        }
2110    }
2111
2112    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for RejectType {
2113        #[inline]
2114        unsafe fn encode(
2115            self,
2116            encoder: &mut fidl::encoding::Encoder<'_, D>,
2117            offset: usize,
2118            _depth: fidl::encoding::Depth,
2119        ) -> fidl::Result<()> {
2120            encoder.debug_check_bounds::<Self>(offset);
2121            encoder.write_num(self.into_primitive(), offset);
2122            Ok(())
2123        }
2124    }
2125
2126    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RejectType {
2127        #[inline(always)]
2128        fn new_empty() -> Self {
2129            Self::unknown()
2130        }
2131
2132        #[inline]
2133        unsafe fn decode(
2134            &mut self,
2135            decoder: &mut fidl::encoding::Decoder<'_, D>,
2136            offset: usize,
2137            _depth: fidl::encoding::Depth,
2138        ) -> fidl::Result<()> {
2139            decoder.debug_check_bounds::<Self>(offset);
2140            let prim = decoder.read_num::<u32>(offset);
2141
2142            *self = Self::from_primitive_allow_unknown(prim);
2143            Ok(())
2144        }
2145    }
2146    unsafe impl fidl::encoding::TypeMarker for SocketControlAttachEbpfProgramError {
2147        type Owned = Self;
2148
2149        #[inline(always)]
2150        fn inline_align(_context: fidl::encoding::Context) -> usize {
2151            std::mem::align_of::<u32>()
2152        }
2153
2154        #[inline(always)]
2155        fn inline_size(_context: fidl::encoding::Context) -> usize {
2156            std::mem::size_of::<u32>()
2157        }
2158
2159        #[inline(always)]
2160        fn encode_is_copy() -> bool {
2161            true
2162        }
2163
2164        #[inline(always)]
2165        fn decode_is_copy() -> bool {
2166            false
2167        }
2168    }
2169
2170    impl fidl::encoding::ValueTypeMarker for SocketControlAttachEbpfProgramError {
2171        type Borrowed<'a> = Self;
2172        #[inline(always)]
2173        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2174            *value
2175        }
2176    }
2177
2178    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2179        for SocketControlAttachEbpfProgramError
2180    {
2181        #[inline]
2182        unsafe fn encode(
2183            self,
2184            encoder: &mut fidl::encoding::Encoder<'_, D>,
2185            offset: usize,
2186            _depth: fidl::encoding::Depth,
2187        ) -> fidl::Result<()> {
2188            encoder.debug_check_bounds::<Self>(offset);
2189            encoder.write_num(self.into_primitive(), offset);
2190            Ok(())
2191        }
2192    }
2193
2194    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2195        for SocketControlAttachEbpfProgramError
2196    {
2197        #[inline(always)]
2198        fn new_empty() -> Self {
2199            Self::NotSupported
2200        }
2201
2202        #[inline]
2203        unsafe fn decode(
2204            &mut self,
2205            decoder: &mut fidl::encoding::Decoder<'_, D>,
2206            offset: usize,
2207            _depth: fidl::encoding::Depth,
2208        ) -> fidl::Result<()> {
2209            decoder.debug_check_bounds::<Self>(offset);
2210            let prim = decoder.read_num::<u32>(offset);
2211
2212            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
2213            Ok(())
2214        }
2215    }
2216    unsafe impl fidl::encoding::TypeMarker for SocketControlDetachEbpfProgramError {
2217        type Owned = Self;
2218
2219        #[inline(always)]
2220        fn inline_align(_context: fidl::encoding::Context) -> usize {
2221            std::mem::align_of::<u32>()
2222        }
2223
2224        #[inline(always)]
2225        fn inline_size(_context: fidl::encoding::Context) -> usize {
2226            std::mem::size_of::<u32>()
2227        }
2228
2229        #[inline(always)]
2230        fn encode_is_copy() -> bool {
2231            true
2232        }
2233
2234        #[inline(always)]
2235        fn decode_is_copy() -> bool {
2236            false
2237        }
2238    }
2239
2240    impl fidl::encoding::ValueTypeMarker for SocketControlDetachEbpfProgramError {
2241        type Borrowed<'a> = Self;
2242        #[inline(always)]
2243        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2244            *value
2245        }
2246    }
2247
2248    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2249        for SocketControlDetachEbpfProgramError
2250    {
2251        #[inline]
2252        unsafe fn encode(
2253            self,
2254            encoder: &mut fidl::encoding::Encoder<'_, D>,
2255            offset: usize,
2256            _depth: fidl::encoding::Depth,
2257        ) -> fidl::Result<()> {
2258            encoder.debug_check_bounds::<Self>(offset);
2259            encoder.write_num(self.into_primitive(), offset);
2260            Ok(())
2261        }
2262    }
2263
2264    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2265        for SocketControlDetachEbpfProgramError
2266    {
2267        #[inline(always)]
2268        fn new_empty() -> Self {
2269            Self::NotFound
2270        }
2271
2272        #[inline]
2273        unsafe fn decode(
2274            &mut self,
2275            decoder: &mut fidl::encoding::Decoder<'_, D>,
2276            offset: usize,
2277            _depth: fidl::encoding::Depth,
2278        ) -> fidl::Result<()> {
2279            decoder.debug_check_bounds::<Self>(offset);
2280            let prim = decoder.read_num::<u32>(offset);
2281
2282            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
2283            Ok(())
2284        }
2285    }
2286    unsafe impl fidl::encoding::TypeMarker for SocketHook {
2287        type Owned = Self;
2288
2289        #[inline(always)]
2290        fn inline_align(_context: fidl::encoding::Context) -> usize {
2291            std::mem::align_of::<u32>()
2292        }
2293
2294        #[inline(always)]
2295        fn inline_size(_context: fidl::encoding::Context) -> usize {
2296            std::mem::size_of::<u32>()
2297        }
2298
2299        #[inline(always)]
2300        fn encode_is_copy() -> bool {
2301            false
2302        }
2303
2304        #[inline(always)]
2305        fn decode_is_copy() -> bool {
2306            false
2307        }
2308    }
2309
2310    impl fidl::encoding::ValueTypeMarker for SocketHook {
2311        type Borrowed<'a> = Self;
2312        #[inline(always)]
2313        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2314            *value
2315        }
2316    }
2317
2318    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for SocketHook {
2319        #[inline]
2320        unsafe fn encode(
2321            self,
2322            encoder: &mut fidl::encoding::Encoder<'_, D>,
2323            offset: usize,
2324            _depth: fidl::encoding::Depth,
2325        ) -> fidl::Result<()> {
2326            encoder.debug_check_bounds::<Self>(offset);
2327            encoder.write_num(self.into_primitive(), offset);
2328            Ok(())
2329        }
2330    }
2331
2332    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketHook {
2333        #[inline(always)]
2334        fn new_empty() -> Self {
2335            Self::unknown()
2336        }
2337
2338        #[inline]
2339        unsafe fn decode(
2340            &mut self,
2341            decoder: &mut fidl::encoding::Decoder<'_, D>,
2342            offset: usize,
2343            _depth: fidl::encoding::Depth,
2344        ) -> fidl::Result<()> {
2345            decoder.debug_check_bounds::<Self>(offset);
2346            let prim = decoder.read_num::<u32>(offset);
2347
2348            *self = Self::from_primitive_allow_unknown(prim);
2349            Ok(())
2350        }
2351    }
2352
2353    impl fidl::encoding::ValueTypeMarker for AddedResource {
2354        type Borrowed<'a> = &'a Self;
2355        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2356            value
2357        }
2358    }
2359
2360    unsafe impl fidl::encoding::TypeMarker for AddedResource {
2361        type Owned = Self;
2362
2363        #[inline(always)]
2364        fn inline_align(_context: fidl::encoding::Context) -> usize {
2365            8
2366        }
2367
2368        #[inline(always)]
2369        fn inline_size(_context: fidl::encoding::Context) -> usize {
2370            32
2371        }
2372    }
2373
2374    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AddedResource, D>
2375        for &AddedResource
2376    {
2377        #[inline]
2378        unsafe fn encode(
2379            self,
2380            encoder: &mut fidl::encoding::Encoder<'_, D>,
2381            offset: usize,
2382            _depth: fidl::encoding::Depth,
2383        ) -> fidl::Result<()> {
2384            encoder.debug_check_bounds::<AddedResource>(offset);
2385            // Delegate to tuple encoding.
2386            fidl::encoding::Encode::<AddedResource, D>::encode(
2387                (
2388                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
2389                        &self.controller,
2390                    ),
2391                    <Resource as fidl::encoding::ValueTypeMarker>::borrow(&self.resource),
2392                ),
2393                encoder,
2394                offset,
2395                _depth,
2396            )
2397        }
2398    }
2399    unsafe impl<
2400        D: fidl::encoding::ResourceDialect,
2401        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
2402        T1: fidl::encoding::Encode<Resource, D>,
2403    > fidl::encoding::Encode<AddedResource, D> for (T0, T1)
2404    {
2405        #[inline]
2406        unsafe fn encode(
2407            self,
2408            encoder: &mut fidl::encoding::Encoder<'_, D>,
2409            offset: usize,
2410            depth: fidl::encoding::Depth,
2411        ) -> fidl::Result<()> {
2412            encoder.debug_check_bounds::<AddedResource>(offset);
2413            // Zero out padding regions. There's no need to apply masks
2414            // because the unmasked parts will be overwritten by fields.
2415            // Write the fields.
2416            self.0.encode(encoder, offset + 0, depth)?;
2417            self.1.encode(encoder, offset + 16, depth)?;
2418            Ok(())
2419        }
2420    }
2421
2422    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AddedResource {
2423        #[inline(always)]
2424        fn new_empty() -> Self {
2425            Self {
2426                controller: fidl::new_empty!(fidl::encoding::BoundedString<255>, D),
2427                resource: fidl::new_empty!(Resource, D),
2428            }
2429        }
2430
2431        #[inline]
2432        unsafe fn decode(
2433            &mut self,
2434            decoder: &mut fidl::encoding::Decoder<'_, D>,
2435            offset: usize,
2436            _depth: fidl::encoding::Depth,
2437        ) -> fidl::Result<()> {
2438            decoder.debug_check_bounds::<Self>(offset);
2439            // Verify that padding bytes are zero.
2440            fidl::decode!(
2441                fidl::encoding::BoundedString<255>,
2442                D,
2443                &mut self.controller,
2444                decoder,
2445                offset + 0,
2446                _depth
2447            )?;
2448            fidl::decode!(Resource, D, &mut self.resource, decoder, offset + 16, _depth)?;
2449            Ok(())
2450        }
2451    }
2452
2453    impl fidl::encoding::ValueTypeMarker for ControllerKey {
2454        type Borrowed<'a> = &'a Self;
2455        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2456            value
2457        }
2458    }
2459
2460    unsafe impl fidl::encoding::TypeMarker for ControllerKey {
2461        type Owned = Self;
2462
2463        #[inline(always)]
2464        fn inline_align(_context: fidl::encoding::Context) -> usize {
2465            1
2466        }
2467
2468        #[inline(always)]
2469        fn inline_size(_context: fidl::encoding::Context) -> usize {
2470            16
2471        }
2472        #[inline(always)]
2473        fn encode_is_copy() -> bool {
2474            true
2475        }
2476
2477        #[inline(always)]
2478        fn decode_is_copy() -> bool {
2479            true
2480        }
2481    }
2482
2483    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ControllerKey, D>
2484        for &ControllerKey
2485    {
2486        #[inline]
2487        unsafe fn encode(
2488            self,
2489            encoder: &mut fidl::encoding::Encoder<'_, D>,
2490            offset: usize,
2491            _depth: fidl::encoding::Depth,
2492        ) -> fidl::Result<()> {
2493            encoder.debug_check_bounds::<ControllerKey>(offset);
2494            unsafe {
2495                // Copy the object into the buffer.
2496                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2497                (buf_ptr as *mut ControllerKey)
2498                    .write_unaligned((self as *const ControllerKey).read());
2499                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2500                // done second because the memcpy will write garbage to these bytes.
2501            }
2502            Ok(())
2503        }
2504    }
2505    unsafe impl<
2506        D: fidl::encoding::ResourceDialect,
2507        T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 16>, D>,
2508    > fidl::encoding::Encode<ControllerKey, D> for (T0,)
2509    {
2510        #[inline]
2511        unsafe fn encode(
2512            self,
2513            encoder: &mut fidl::encoding::Encoder<'_, D>,
2514            offset: usize,
2515            depth: fidl::encoding::Depth,
2516        ) -> fidl::Result<()> {
2517            encoder.debug_check_bounds::<ControllerKey>(offset);
2518            // Zero out padding regions. There's no need to apply masks
2519            // because the unmasked parts will be overwritten by fields.
2520            // Write the fields.
2521            self.0.encode(encoder, offset + 0, depth)?;
2522            Ok(())
2523        }
2524    }
2525
2526    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ControllerKey {
2527        #[inline(always)]
2528        fn new_empty() -> Self {
2529            Self { uuid: fidl::new_empty!(fidl::encoding::Array<u8, 16>, D) }
2530        }
2531
2532        #[inline]
2533        unsafe fn decode(
2534            &mut self,
2535            decoder: &mut fidl::encoding::Decoder<'_, D>,
2536            offset: usize,
2537            _depth: fidl::encoding::Depth,
2538        ) -> fidl::Result<()> {
2539            decoder.debug_check_bounds::<Self>(offset);
2540            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2541            // Verify that padding bytes are zero.
2542            // Copy from the buffer into the object.
2543            unsafe {
2544                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
2545            }
2546            Ok(())
2547        }
2548    }
2549
2550    impl fidl::encoding::ValueTypeMarker for Empty {
2551        type Borrowed<'a> = &'a Self;
2552        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2553            value
2554        }
2555    }
2556
2557    unsafe impl fidl::encoding::TypeMarker for Empty {
2558        type Owned = Self;
2559
2560        #[inline(always)]
2561        fn inline_align(_context: fidl::encoding::Context) -> usize {
2562            1
2563        }
2564
2565        #[inline(always)]
2566        fn inline_size(_context: fidl::encoding::Context) -> usize {
2567            1
2568        }
2569    }
2570
2571    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Empty, D> for &Empty {
2572        #[inline]
2573        unsafe fn encode(
2574            self,
2575            encoder: &mut fidl::encoding::Encoder<'_, D>,
2576            offset: usize,
2577            _depth: fidl::encoding::Depth,
2578        ) -> fidl::Result<()> {
2579            encoder.debug_check_bounds::<Empty>(offset);
2580            encoder.write_num(0u8, offset);
2581            Ok(())
2582        }
2583    }
2584
2585    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Empty {
2586        #[inline(always)]
2587        fn new_empty() -> Self {
2588            Self
2589        }
2590
2591        #[inline]
2592        unsafe fn decode(
2593            &mut self,
2594            decoder: &mut fidl::encoding::Decoder<'_, D>,
2595            offset: usize,
2596            _depth: fidl::encoding::Depth,
2597        ) -> fidl::Result<()> {
2598            decoder.debug_check_bounds::<Self>(offset);
2599            match decoder.read_num::<u8>(offset) {
2600                0 => Ok(()),
2601                _ => Err(fidl::Error::Invalid),
2602            }
2603        }
2604    }
2605
2606    impl fidl::encoding::ValueTypeMarker for ExistingResource {
2607        type Borrowed<'a> = &'a Self;
2608        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2609            value
2610        }
2611    }
2612
2613    unsafe impl fidl::encoding::TypeMarker for ExistingResource {
2614        type Owned = Self;
2615
2616        #[inline(always)]
2617        fn inline_align(_context: fidl::encoding::Context) -> usize {
2618            8
2619        }
2620
2621        #[inline(always)]
2622        fn inline_size(_context: fidl::encoding::Context) -> usize {
2623            32
2624        }
2625    }
2626
2627    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ExistingResource, D>
2628        for &ExistingResource
2629    {
2630        #[inline]
2631        unsafe fn encode(
2632            self,
2633            encoder: &mut fidl::encoding::Encoder<'_, D>,
2634            offset: usize,
2635            _depth: fidl::encoding::Depth,
2636        ) -> fidl::Result<()> {
2637            encoder.debug_check_bounds::<ExistingResource>(offset);
2638            // Delegate to tuple encoding.
2639            fidl::encoding::Encode::<ExistingResource, D>::encode(
2640                (
2641                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
2642                        &self.controller,
2643                    ),
2644                    <Resource as fidl::encoding::ValueTypeMarker>::borrow(&self.resource),
2645                ),
2646                encoder,
2647                offset,
2648                _depth,
2649            )
2650        }
2651    }
2652    unsafe impl<
2653        D: fidl::encoding::ResourceDialect,
2654        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
2655        T1: fidl::encoding::Encode<Resource, D>,
2656    > fidl::encoding::Encode<ExistingResource, D> for (T0, T1)
2657    {
2658        #[inline]
2659        unsafe fn encode(
2660            self,
2661            encoder: &mut fidl::encoding::Encoder<'_, D>,
2662            offset: usize,
2663            depth: fidl::encoding::Depth,
2664        ) -> fidl::Result<()> {
2665            encoder.debug_check_bounds::<ExistingResource>(offset);
2666            // Zero out padding regions. There's no need to apply masks
2667            // because the unmasked parts will be overwritten by fields.
2668            // Write the fields.
2669            self.0.encode(encoder, offset + 0, depth)?;
2670            self.1.encode(encoder, offset + 16, depth)?;
2671            Ok(())
2672        }
2673    }
2674
2675    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ExistingResource {
2676        #[inline(always)]
2677        fn new_empty() -> Self {
2678            Self {
2679                controller: fidl::new_empty!(fidl::encoding::BoundedString<255>, D),
2680                resource: fidl::new_empty!(Resource, D),
2681            }
2682        }
2683
2684        #[inline]
2685        unsafe fn decode(
2686            &mut self,
2687            decoder: &mut fidl::encoding::Decoder<'_, D>,
2688            offset: usize,
2689            _depth: fidl::encoding::Depth,
2690        ) -> fidl::Result<()> {
2691            decoder.debug_check_bounds::<Self>(offset);
2692            // Verify that padding bytes are zero.
2693            fidl::decode!(
2694                fidl::encoding::BoundedString<255>,
2695                D,
2696                &mut self.controller,
2697                decoder,
2698                offset + 0,
2699                _depth
2700            )?;
2701            fidl::decode!(Resource, D, &mut self.resource, decoder, offset + 16, _depth)?;
2702            Ok(())
2703        }
2704    }
2705
2706    impl fidl::encoding::ValueTypeMarker for Mark {
2707        type Borrowed<'a> = &'a Self;
2708        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2709            value
2710        }
2711    }
2712
2713    unsafe impl fidl::encoding::TypeMarker for Mark {
2714        type Owned = Self;
2715
2716        #[inline(always)]
2717        fn inline_align(_context: fidl::encoding::Context) -> usize {
2718            8
2719        }
2720
2721        #[inline(always)]
2722        fn inline_size(_context: fidl::encoding::Context) -> usize {
2723            24
2724        }
2725    }
2726
2727    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Mark, D> for &Mark {
2728        #[inline]
2729        unsafe fn encode(
2730            self,
2731            encoder: &mut fidl::encoding::Encoder<'_, D>,
2732            offset: usize,
2733            _depth: fidl::encoding::Depth,
2734        ) -> fidl::Result<()> {
2735            encoder.debug_check_bounds::<Mark>(offset);
2736            // Delegate to tuple encoding.
2737            fidl::encoding::Encode::<Mark, D>::encode(
2738                (
2739                    <fidl_fuchsia_net__common::MarkDomain as fidl::encoding::ValueTypeMarker>::borrow(&self.domain),
2740                    <MarkAction as fidl::encoding::ValueTypeMarker>::borrow(&self.action),
2741                ),
2742                encoder, offset, _depth
2743            )
2744        }
2745    }
2746    unsafe impl<
2747        D: fidl::encoding::ResourceDialect,
2748        T0: fidl::encoding::Encode<fidl_fuchsia_net__common::MarkDomain, D>,
2749        T1: fidl::encoding::Encode<MarkAction, D>,
2750    > fidl::encoding::Encode<Mark, D> for (T0, T1)
2751    {
2752        #[inline]
2753        unsafe fn encode(
2754            self,
2755            encoder: &mut fidl::encoding::Encoder<'_, D>,
2756            offset: usize,
2757            depth: fidl::encoding::Depth,
2758        ) -> fidl::Result<()> {
2759            encoder.debug_check_bounds::<Mark>(offset);
2760            // Zero out padding regions. There's no need to apply masks
2761            // because the unmasked parts will be overwritten by fields.
2762            unsafe {
2763                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2764                (ptr as *mut u64).write_unaligned(0);
2765            }
2766            // Write the fields.
2767            self.0.encode(encoder, offset + 0, depth)?;
2768            self.1.encode(encoder, offset + 8, depth)?;
2769            Ok(())
2770        }
2771    }
2772
2773    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Mark {
2774        #[inline(always)]
2775        fn new_empty() -> Self {
2776            Self {
2777                domain: fidl::new_empty!(fidl_fuchsia_net__common::MarkDomain, D),
2778                action: fidl::new_empty!(MarkAction, D),
2779            }
2780        }
2781
2782        #[inline]
2783        unsafe fn decode(
2784            &mut self,
2785            decoder: &mut fidl::encoding::Decoder<'_, D>,
2786            offset: usize,
2787            _depth: fidl::encoding::Depth,
2788        ) -> fidl::Result<()> {
2789            decoder.debug_check_bounds::<Self>(offset);
2790            // Verify that padding bytes are zero.
2791            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2792            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2793            let mask = 0xffffffffffffff00u64;
2794            let maskedval = padval & mask;
2795            if maskedval != 0 {
2796                return Err(fidl::Error::NonZeroPadding {
2797                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2798                });
2799            }
2800            fidl::decode!(
2801                fidl_fuchsia_net__common::MarkDomain,
2802                D,
2803                &mut self.domain,
2804                decoder,
2805                offset + 0,
2806                _depth
2807            )?;
2808            fidl::decode!(MarkAction, D, &mut self.action, decoder, offset + 8, _depth)?;
2809            Ok(())
2810        }
2811    }
2812
2813    impl fidl::encoding::ValueTypeMarker for NamespaceControllerOnIdAssignedRequest {
2814        type Borrowed<'a> = &'a Self;
2815        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2816            value
2817        }
2818    }
2819
2820    unsafe impl fidl::encoding::TypeMarker for NamespaceControllerOnIdAssignedRequest {
2821        type Owned = Self;
2822
2823        #[inline(always)]
2824        fn inline_align(_context: fidl::encoding::Context) -> usize {
2825            8
2826        }
2827
2828        #[inline(always)]
2829        fn inline_size(_context: fidl::encoding::Context) -> usize {
2830            16
2831        }
2832    }
2833
2834    unsafe impl<D: fidl::encoding::ResourceDialect>
2835        fidl::encoding::Encode<NamespaceControllerOnIdAssignedRequest, D>
2836        for &NamespaceControllerOnIdAssignedRequest
2837    {
2838        #[inline]
2839        unsafe fn encode(
2840            self,
2841            encoder: &mut fidl::encoding::Encoder<'_, D>,
2842            offset: usize,
2843            _depth: fidl::encoding::Depth,
2844        ) -> fidl::Result<()> {
2845            encoder.debug_check_bounds::<NamespaceControllerOnIdAssignedRequest>(offset);
2846            // Delegate to tuple encoding.
2847            fidl::encoding::Encode::<NamespaceControllerOnIdAssignedRequest, D>::encode(
2848                (<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
2849                    &self.id,
2850                ),),
2851                encoder,
2852                offset,
2853                _depth,
2854            )
2855        }
2856    }
2857    unsafe impl<
2858        D: fidl::encoding::ResourceDialect,
2859        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
2860    > fidl::encoding::Encode<NamespaceControllerOnIdAssignedRequest, D> for (T0,)
2861    {
2862        #[inline]
2863        unsafe fn encode(
2864            self,
2865            encoder: &mut fidl::encoding::Encoder<'_, D>,
2866            offset: usize,
2867            depth: fidl::encoding::Depth,
2868        ) -> fidl::Result<()> {
2869            encoder.debug_check_bounds::<NamespaceControllerOnIdAssignedRequest>(offset);
2870            // Zero out padding regions. There's no need to apply masks
2871            // because the unmasked parts will be overwritten by fields.
2872            // Write the fields.
2873            self.0.encode(encoder, offset + 0, depth)?;
2874            Ok(())
2875        }
2876    }
2877
2878    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2879        for NamespaceControllerOnIdAssignedRequest
2880    {
2881        #[inline(always)]
2882        fn new_empty() -> Self {
2883            Self { id: fidl::new_empty!(fidl::encoding::BoundedString<255>, D) }
2884        }
2885
2886        #[inline]
2887        unsafe fn decode(
2888            &mut self,
2889            decoder: &mut fidl::encoding::Decoder<'_, D>,
2890            offset: usize,
2891            _depth: fidl::encoding::Depth,
2892        ) -> fidl::Result<()> {
2893            decoder.debug_check_bounds::<Self>(offset);
2894            // Verify that padding bytes are zero.
2895            fidl::decode!(
2896                fidl::encoding::BoundedString<255>,
2897                D,
2898                &mut self.id,
2899                decoder,
2900                offset + 0,
2901                _depth
2902            )?;
2903            Ok(())
2904        }
2905    }
2906
2907    impl fidl::encoding::ValueTypeMarker for PortRange {
2908        type Borrowed<'a> = &'a Self;
2909        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2910            value
2911        }
2912    }
2913
2914    unsafe impl fidl::encoding::TypeMarker for PortRange {
2915        type Owned = Self;
2916
2917        #[inline(always)]
2918        fn inline_align(_context: fidl::encoding::Context) -> usize {
2919            2
2920        }
2921
2922        #[inline(always)]
2923        fn inline_size(_context: fidl::encoding::Context) -> usize {
2924            4
2925        }
2926        #[inline(always)]
2927        fn encode_is_copy() -> bool {
2928            true
2929        }
2930
2931        #[inline(always)]
2932        fn decode_is_copy() -> bool {
2933            true
2934        }
2935    }
2936
2937    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PortRange, D>
2938        for &PortRange
2939    {
2940        #[inline]
2941        unsafe fn encode(
2942            self,
2943            encoder: &mut fidl::encoding::Encoder<'_, D>,
2944            offset: usize,
2945            _depth: fidl::encoding::Depth,
2946        ) -> fidl::Result<()> {
2947            encoder.debug_check_bounds::<PortRange>(offset);
2948            unsafe {
2949                // Copy the object into the buffer.
2950                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2951                (buf_ptr as *mut PortRange).write_unaligned((self as *const PortRange).read());
2952                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2953                // done second because the memcpy will write garbage to these bytes.
2954            }
2955            Ok(())
2956        }
2957    }
2958    unsafe impl<
2959        D: fidl::encoding::ResourceDialect,
2960        T0: fidl::encoding::Encode<u16, D>,
2961        T1: fidl::encoding::Encode<u16, D>,
2962    > fidl::encoding::Encode<PortRange, D> for (T0, T1)
2963    {
2964        #[inline]
2965        unsafe fn encode(
2966            self,
2967            encoder: &mut fidl::encoding::Encoder<'_, D>,
2968            offset: usize,
2969            depth: fidl::encoding::Depth,
2970        ) -> fidl::Result<()> {
2971            encoder.debug_check_bounds::<PortRange>(offset);
2972            // Zero out padding regions. There's no need to apply masks
2973            // because the unmasked parts will be overwritten by fields.
2974            // Write the fields.
2975            self.0.encode(encoder, offset + 0, depth)?;
2976            self.1.encode(encoder, offset + 2, depth)?;
2977            Ok(())
2978        }
2979    }
2980
2981    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PortRange {
2982        #[inline(always)]
2983        fn new_empty() -> Self {
2984            Self { start: fidl::new_empty!(u16, D), end: fidl::new_empty!(u16, D) }
2985        }
2986
2987        #[inline]
2988        unsafe fn decode(
2989            &mut self,
2990            decoder: &mut fidl::encoding::Decoder<'_, D>,
2991            offset: usize,
2992            _depth: fidl::encoding::Depth,
2993        ) -> fidl::Result<()> {
2994            decoder.debug_check_bounds::<Self>(offset);
2995            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2996            // Verify that padding bytes are zero.
2997            // Copy from the buffer into the object.
2998            unsafe {
2999                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
3000            }
3001            Ok(())
3002        }
3003    }
3004
3005    impl fidl::encoding::ValueTypeMarker for Reject {
3006        type Borrowed<'a> = &'a Self;
3007        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3008            value
3009        }
3010    }
3011
3012    unsafe impl fidl::encoding::TypeMarker for Reject {
3013        type Owned = Self;
3014
3015        #[inline(always)]
3016        fn inline_align(_context: fidl::encoding::Context) -> usize {
3017            4
3018        }
3019
3020        #[inline(always)]
3021        fn inline_size(_context: fidl::encoding::Context) -> usize {
3022            4
3023        }
3024    }
3025
3026    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Reject, D> for &Reject {
3027        #[inline]
3028        unsafe fn encode(
3029            self,
3030            encoder: &mut fidl::encoding::Encoder<'_, D>,
3031            offset: usize,
3032            _depth: fidl::encoding::Depth,
3033        ) -> fidl::Result<()> {
3034            encoder.debug_check_bounds::<Reject>(offset);
3035            // Delegate to tuple encoding.
3036            fidl::encoding::Encode::<Reject, D>::encode(
3037                (<RejectType as fidl::encoding::ValueTypeMarker>::borrow(&self.reject_type),),
3038                encoder,
3039                offset,
3040                _depth,
3041            )
3042        }
3043    }
3044    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<RejectType, D>>
3045        fidl::encoding::Encode<Reject, D> for (T0,)
3046    {
3047        #[inline]
3048        unsafe fn encode(
3049            self,
3050            encoder: &mut fidl::encoding::Encoder<'_, D>,
3051            offset: usize,
3052            depth: fidl::encoding::Depth,
3053        ) -> fidl::Result<()> {
3054            encoder.debug_check_bounds::<Reject>(offset);
3055            // Zero out padding regions. There's no need to apply masks
3056            // because the unmasked parts will be overwritten by fields.
3057            // Write the fields.
3058            self.0.encode(encoder, offset + 0, depth)?;
3059            Ok(())
3060        }
3061    }
3062
3063    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Reject {
3064        #[inline(always)]
3065        fn new_empty() -> Self {
3066            Self { reject_type: fidl::new_empty!(RejectType, D) }
3067        }
3068
3069        #[inline]
3070        unsafe fn decode(
3071            &mut self,
3072            decoder: &mut fidl::encoding::Decoder<'_, D>,
3073            offset: usize,
3074            _depth: fidl::encoding::Depth,
3075        ) -> fidl::Result<()> {
3076            decoder.debug_check_bounds::<Self>(offset);
3077            // Verify that padding bytes are zero.
3078            fidl::decode!(RejectType, D, &mut self.reject_type, decoder, offset + 0, _depth)?;
3079            Ok(())
3080        }
3081    }
3082
3083    impl fidl::encoding::ValueTypeMarker for RemovedResource {
3084        type Borrowed<'a> = &'a Self;
3085        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3086            value
3087        }
3088    }
3089
3090    unsafe impl fidl::encoding::TypeMarker for RemovedResource {
3091        type Owned = Self;
3092
3093        #[inline(always)]
3094        fn inline_align(_context: fidl::encoding::Context) -> usize {
3095            8
3096        }
3097
3098        #[inline(always)]
3099        fn inline_size(_context: fidl::encoding::Context) -> usize {
3100            32
3101        }
3102    }
3103
3104    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RemovedResource, D>
3105        for &RemovedResource
3106    {
3107        #[inline]
3108        unsafe fn encode(
3109            self,
3110            encoder: &mut fidl::encoding::Encoder<'_, D>,
3111            offset: usize,
3112            _depth: fidl::encoding::Depth,
3113        ) -> fidl::Result<()> {
3114            encoder.debug_check_bounds::<RemovedResource>(offset);
3115            // Delegate to tuple encoding.
3116            fidl::encoding::Encode::<RemovedResource, D>::encode(
3117                (
3118                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
3119                        &self.controller,
3120                    ),
3121                    <ResourceId as fidl::encoding::ValueTypeMarker>::borrow(&self.resource),
3122                ),
3123                encoder,
3124                offset,
3125                _depth,
3126            )
3127        }
3128    }
3129    unsafe impl<
3130        D: fidl::encoding::ResourceDialect,
3131        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
3132        T1: fidl::encoding::Encode<ResourceId, D>,
3133    > fidl::encoding::Encode<RemovedResource, D> for (T0, T1)
3134    {
3135        #[inline]
3136        unsafe fn encode(
3137            self,
3138            encoder: &mut fidl::encoding::Encoder<'_, D>,
3139            offset: usize,
3140            depth: fidl::encoding::Depth,
3141        ) -> fidl::Result<()> {
3142            encoder.debug_check_bounds::<RemovedResource>(offset);
3143            // Zero out padding regions. There's no need to apply masks
3144            // because the unmasked parts will be overwritten by fields.
3145            // Write the fields.
3146            self.0.encode(encoder, offset + 0, depth)?;
3147            self.1.encode(encoder, offset + 16, depth)?;
3148            Ok(())
3149        }
3150    }
3151
3152    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RemovedResource {
3153        #[inline(always)]
3154        fn new_empty() -> Self {
3155            Self {
3156                controller: fidl::new_empty!(fidl::encoding::BoundedString<255>, D),
3157                resource: fidl::new_empty!(ResourceId, D),
3158            }
3159        }
3160
3161        #[inline]
3162        unsafe fn decode(
3163            &mut self,
3164            decoder: &mut fidl::encoding::Decoder<'_, D>,
3165            offset: usize,
3166            _depth: fidl::encoding::Depth,
3167        ) -> fidl::Result<()> {
3168            decoder.debug_check_bounds::<Self>(offset);
3169            // Verify that padding bytes are zero.
3170            fidl::decode!(
3171                fidl::encoding::BoundedString<255>,
3172                D,
3173                &mut self.controller,
3174                decoder,
3175                offset + 0,
3176                _depth
3177            )?;
3178            fidl::decode!(ResourceId, D, &mut self.resource, decoder, offset + 16, _depth)?;
3179            Ok(())
3180        }
3181    }
3182
3183    impl fidl::encoding::ValueTypeMarker for RoutineId {
3184        type Borrowed<'a> = &'a Self;
3185        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3186            value
3187        }
3188    }
3189
3190    unsafe impl fidl::encoding::TypeMarker for RoutineId {
3191        type Owned = Self;
3192
3193        #[inline(always)]
3194        fn inline_align(_context: fidl::encoding::Context) -> usize {
3195            8
3196        }
3197
3198        #[inline(always)]
3199        fn inline_size(_context: fidl::encoding::Context) -> usize {
3200            32
3201        }
3202    }
3203
3204    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RoutineId, D>
3205        for &RoutineId
3206    {
3207        #[inline]
3208        unsafe fn encode(
3209            self,
3210            encoder: &mut fidl::encoding::Encoder<'_, D>,
3211            offset: usize,
3212            _depth: fidl::encoding::Depth,
3213        ) -> fidl::Result<()> {
3214            encoder.debug_check_bounds::<RoutineId>(offset);
3215            // Delegate to tuple encoding.
3216            fidl::encoding::Encode::<RoutineId, D>::encode(
3217                (
3218                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
3219                        &self.namespace,
3220                    ),
3221                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
3222                        &self.name,
3223                    ),
3224                ),
3225                encoder,
3226                offset,
3227                _depth,
3228            )
3229        }
3230    }
3231    unsafe impl<
3232        D: fidl::encoding::ResourceDialect,
3233        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
3234        T1: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
3235    > fidl::encoding::Encode<RoutineId, D> for (T0, T1)
3236    {
3237        #[inline]
3238        unsafe fn encode(
3239            self,
3240            encoder: &mut fidl::encoding::Encoder<'_, D>,
3241            offset: usize,
3242            depth: fidl::encoding::Depth,
3243        ) -> fidl::Result<()> {
3244            encoder.debug_check_bounds::<RoutineId>(offset);
3245            // Zero out padding regions. There's no need to apply masks
3246            // because the unmasked parts will be overwritten by fields.
3247            // Write the fields.
3248            self.0.encode(encoder, offset + 0, depth)?;
3249            self.1.encode(encoder, offset + 16, depth)?;
3250            Ok(())
3251        }
3252    }
3253
3254    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RoutineId {
3255        #[inline(always)]
3256        fn new_empty() -> Self {
3257            Self {
3258                namespace: fidl::new_empty!(fidl::encoding::BoundedString<255>, D),
3259                name: fidl::new_empty!(fidl::encoding::BoundedString<255>, D),
3260            }
3261        }
3262
3263        #[inline]
3264        unsafe fn decode(
3265            &mut self,
3266            decoder: &mut fidl::encoding::Decoder<'_, D>,
3267            offset: usize,
3268            _depth: fidl::encoding::Depth,
3269        ) -> fidl::Result<()> {
3270            decoder.debug_check_bounds::<Self>(offset);
3271            // Verify that padding bytes are zero.
3272            fidl::decode!(
3273                fidl::encoding::BoundedString<255>,
3274                D,
3275                &mut self.namespace,
3276                decoder,
3277                offset + 0,
3278                _depth
3279            )?;
3280            fidl::decode!(
3281                fidl::encoding::BoundedString<255>,
3282                D,
3283                &mut self.name,
3284                decoder,
3285                offset + 16,
3286                _depth
3287            )?;
3288            Ok(())
3289        }
3290    }
3291
3292    impl fidl::encoding::ValueTypeMarker for Rule {
3293        type Borrowed<'a> = &'a Self;
3294        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3295            value
3296        }
3297    }
3298
3299    unsafe impl fidl::encoding::TypeMarker for Rule {
3300        type Owned = Self;
3301
3302        #[inline(always)]
3303        fn inline_align(_context: fidl::encoding::Context) -> usize {
3304            8
3305        }
3306
3307        #[inline(always)]
3308        fn inline_size(_context: fidl::encoding::Context) -> usize {
3309            72
3310        }
3311    }
3312
3313    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Rule, D> for &Rule {
3314        #[inline]
3315        unsafe fn encode(
3316            self,
3317            encoder: &mut fidl::encoding::Encoder<'_, D>,
3318            offset: usize,
3319            _depth: fidl::encoding::Depth,
3320        ) -> fidl::Result<()> {
3321            encoder.debug_check_bounds::<Rule>(offset);
3322            // Delegate to tuple encoding.
3323            fidl::encoding::Encode::<Rule, D>::encode(
3324                (
3325                    <RuleId as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
3326                    <Matchers as fidl::encoding::ValueTypeMarker>::borrow(&self.matchers),
3327                    <Action as fidl::encoding::ValueTypeMarker>::borrow(&self.action),
3328                ),
3329                encoder,
3330                offset,
3331                _depth,
3332            )
3333        }
3334    }
3335    unsafe impl<
3336        D: fidl::encoding::ResourceDialect,
3337        T0: fidl::encoding::Encode<RuleId, D>,
3338        T1: fidl::encoding::Encode<Matchers, D>,
3339        T2: fidl::encoding::Encode<Action, D>,
3340    > fidl::encoding::Encode<Rule, D> for (T0, T1, T2)
3341    {
3342        #[inline]
3343        unsafe fn encode(
3344            self,
3345            encoder: &mut fidl::encoding::Encoder<'_, D>,
3346            offset: usize,
3347            depth: fidl::encoding::Depth,
3348        ) -> fidl::Result<()> {
3349            encoder.debug_check_bounds::<Rule>(offset);
3350            // Zero out padding regions. There's no need to apply masks
3351            // because the unmasked parts will be overwritten by fields.
3352            // Write the fields.
3353            self.0.encode(encoder, offset + 0, depth)?;
3354            self.1.encode(encoder, offset + 40, depth)?;
3355            self.2.encode(encoder, offset + 56, depth)?;
3356            Ok(())
3357        }
3358    }
3359
3360    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Rule {
3361        #[inline(always)]
3362        fn new_empty() -> Self {
3363            Self {
3364                id: fidl::new_empty!(RuleId, D),
3365                matchers: fidl::new_empty!(Matchers, D),
3366                action: fidl::new_empty!(Action, D),
3367            }
3368        }
3369
3370        #[inline]
3371        unsafe fn decode(
3372            &mut self,
3373            decoder: &mut fidl::encoding::Decoder<'_, D>,
3374            offset: usize,
3375            _depth: fidl::encoding::Depth,
3376        ) -> fidl::Result<()> {
3377            decoder.debug_check_bounds::<Self>(offset);
3378            // Verify that padding bytes are zero.
3379            fidl::decode!(RuleId, D, &mut self.id, decoder, offset + 0, _depth)?;
3380            fidl::decode!(Matchers, D, &mut self.matchers, decoder, offset + 40, _depth)?;
3381            fidl::decode!(Action, D, &mut self.action, decoder, offset + 56, _depth)?;
3382            Ok(())
3383        }
3384    }
3385
3386    impl fidl::encoding::ValueTypeMarker for RuleId {
3387        type Borrowed<'a> = &'a Self;
3388        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3389            value
3390        }
3391    }
3392
3393    unsafe impl fidl::encoding::TypeMarker for RuleId {
3394        type Owned = Self;
3395
3396        #[inline(always)]
3397        fn inline_align(_context: fidl::encoding::Context) -> usize {
3398            8
3399        }
3400
3401        #[inline(always)]
3402        fn inline_size(_context: fidl::encoding::Context) -> usize {
3403            40
3404        }
3405    }
3406
3407    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RuleId, D> for &RuleId {
3408        #[inline]
3409        unsafe fn encode(
3410            self,
3411            encoder: &mut fidl::encoding::Encoder<'_, D>,
3412            offset: usize,
3413            _depth: fidl::encoding::Depth,
3414        ) -> fidl::Result<()> {
3415            encoder.debug_check_bounds::<RuleId>(offset);
3416            // Delegate to tuple encoding.
3417            fidl::encoding::Encode::<RuleId, D>::encode(
3418                (
3419                    <RoutineId as fidl::encoding::ValueTypeMarker>::borrow(&self.routine),
3420                    <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.index),
3421                ),
3422                encoder,
3423                offset,
3424                _depth,
3425            )
3426        }
3427    }
3428    unsafe impl<
3429        D: fidl::encoding::ResourceDialect,
3430        T0: fidl::encoding::Encode<RoutineId, D>,
3431        T1: fidl::encoding::Encode<u32, D>,
3432    > fidl::encoding::Encode<RuleId, D> for (T0, T1)
3433    {
3434        #[inline]
3435        unsafe fn encode(
3436            self,
3437            encoder: &mut fidl::encoding::Encoder<'_, D>,
3438            offset: usize,
3439            depth: fidl::encoding::Depth,
3440        ) -> fidl::Result<()> {
3441            encoder.debug_check_bounds::<RuleId>(offset);
3442            // Zero out padding regions. There's no need to apply masks
3443            // because the unmasked parts will be overwritten by fields.
3444            unsafe {
3445                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
3446                (ptr as *mut u64).write_unaligned(0);
3447            }
3448            // Write the fields.
3449            self.0.encode(encoder, offset + 0, depth)?;
3450            self.1.encode(encoder, offset + 32, depth)?;
3451            Ok(())
3452        }
3453    }
3454
3455    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RuleId {
3456        #[inline(always)]
3457        fn new_empty() -> Self {
3458            Self { routine: fidl::new_empty!(RoutineId, D), index: fidl::new_empty!(u32, D) }
3459        }
3460
3461        #[inline]
3462        unsafe fn decode(
3463            &mut self,
3464            decoder: &mut fidl::encoding::Decoder<'_, D>,
3465            offset: usize,
3466            _depth: fidl::encoding::Depth,
3467        ) -> fidl::Result<()> {
3468            decoder.debug_check_bounds::<Self>(offset);
3469            // Verify that padding bytes are zero.
3470            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
3471            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3472            let mask = 0xffffffff00000000u64;
3473            let maskedval = padval & mask;
3474            if maskedval != 0 {
3475                return Err(fidl::Error::NonZeroPadding {
3476                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
3477                });
3478            }
3479            fidl::decode!(RoutineId, D, &mut self.routine, decoder, offset + 0, _depth)?;
3480            fidl::decode!(u32, D, &mut self.index, decoder, offset + 32, _depth)?;
3481            Ok(())
3482        }
3483    }
3484
3485    impl fidl::encoding::ValueTypeMarker for SetMark {
3486        type Borrowed<'a> = &'a Self;
3487        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3488            value
3489        }
3490    }
3491
3492    unsafe impl fidl::encoding::TypeMarker for SetMark {
3493        type Owned = Self;
3494
3495        #[inline(always)]
3496        fn inline_align(_context: fidl::encoding::Context) -> usize {
3497            4
3498        }
3499
3500        #[inline(always)]
3501        fn inline_size(_context: fidl::encoding::Context) -> usize {
3502            8
3503        }
3504        #[inline(always)]
3505        fn encode_is_copy() -> bool {
3506            true
3507        }
3508
3509        #[inline(always)]
3510        fn decode_is_copy() -> bool {
3511            true
3512        }
3513    }
3514
3515    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SetMark, D> for &SetMark {
3516        #[inline]
3517        unsafe fn encode(
3518            self,
3519            encoder: &mut fidl::encoding::Encoder<'_, D>,
3520            offset: usize,
3521            _depth: fidl::encoding::Depth,
3522        ) -> fidl::Result<()> {
3523            encoder.debug_check_bounds::<SetMark>(offset);
3524            unsafe {
3525                // Copy the object into the buffer.
3526                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3527                (buf_ptr as *mut SetMark).write_unaligned((self as *const SetMark).read());
3528                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3529                // done second because the memcpy will write garbage to these bytes.
3530            }
3531            Ok(())
3532        }
3533    }
3534    unsafe impl<
3535        D: fidl::encoding::ResourceDialect,
3536        T0: fidl::encoding::Encode<u32, D>,
3537        T1: fidl::encoding::Encode<u32, D>,
3538    > fidl::encoding::Encode<SetMark, D> for (T0, T1)
3539    {
3540        #[inline]
3541        unsafe fn encode(
3542            self,
3543            encoder: &mut fidl::encoding::Encoder<'_, D>,
3544            offset: usize,
3545            depth: fidl::encoding::Depth,
3546        ) -> fidl::Result<()> {
3547            encoder.debug_check_bounds::<SetMark>(offset);
3548            // Zero out padding regions. There's no need to apply masks
3549            // because the unmasked parts will be overwritten by fields.
3550            // Write the fields.
3551            self.0.encode(encoder, offset + 0, depth)?;
3552            self.1.encode(encoder, offset + 4, depth)?;
3553            Ok(())
3554        }
3555    }
3556
3557    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SetMark {
3558        #[inline(always)]
3559        fn new_empty() -> Self {
3560            Self { clearing_mask: fidl::new_empty!(u32, D), mark: fidl::new_empty!(u32, D) }
3561        }
3562
3563        #[inline]
3564        unsafe fn decode(
3565            &mut self,
3566            decoder: &mut fidl::encoding::Decoder<'_, D>,
3567            offset: usize,
3568            _depth: fidl::encoding::Depth,
3569        ) -> fidl::Result<()> {
3570            decoder.debug_check_bounds::<Self>(offset);
3571            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3572            // Verify that padding bytes are zero.
3573            // Copy from the buffer into the object.
3574            unsafe {
3575                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
3576            }
3577            Ok(())
3578        }
3579    }
3580
3581    impl fidl::encoding::ValueTypeMarker for SocketAddr {
3582        type Borrowed<'a> = &'a Self;
3583        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3584            value
3585        }
3586    }
3587
3588    unsafe impl fidl::encoding::TypeMarker for SocketAddr {
3589        type Owned = Self;
3590
3591        #[inline(always)]
3592        fn inline_align(_context: fidl::encoding::Context) -> usize {
3593            8
3594        }
3595
3596        #[inline(always)]
3597        fn inline_size(_context: fidl::encoding::Context) -> usize {
3598            24
3599        }
3600    }
3601
3602    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SocketAddr, D>
3603        for &SocketAddr
3604    {
3605        #[inline]
3606        unsafe fn encode(
3607            self,
3608            encoder: &mut fidl::encoding::Encoder<'_, D>,
3609            offset: usize,
3610            _depth: fidl::encoding::Depth,
3611        ) -> fidl::Result<()> {
3612            encoder.debug_check_bounds::<SocketAddr>(offset);
3613            // Delegate to tuple encoding.
3614            fidl::encoding::Encode::<SocketAddr, D>::encode(
3615                (
3616                    <fidl_fuchsia_net__common::IpAddress as fidl::encoding::ValueTypeMarker>::borrow(&self.addr),
3617                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.port),
3618                ),
3619                encoder, offset, _depth
3620            )
3621        }
3622    }
3623    unsafe impl<
3624        D: fidl::encoding::ResourceDialect,
3625        T0: fidl::encoding::Encode<fidl_fuchsia_net__common::IpAddress, D>,
3626        T1: fidl::encoding::Encode<u16, D>,
3627    > fidl::encoding::Encode<SocketAddr, D> for (T0, T1)
3628    {
3629        #[inline]
3630        unsafe fn encode(
3631            self,
3632            encoder: &mut fidl::encoding::Encoder<'_, D>,
3633            offset: usize,
3634            depth: fidl::encoding::Depth,
3635        ) -> fidl::Result<()> {
3636            encoder.debug_check_bounds::<SocketAddr>(offset);
3637            // Zero out padding regions. There's no need to apply masks
3638            // because the unmasked parts will be overwritten by fields.
3639            unsafe {
3640                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
3641                (ptr as *mut u64).write_unaligned(0);
3642            }
3643            // Write the fields.
3644            self.0.encode(encoder, offset + 0, depth)?;
3645            self.1.encode(encoder, offset + 16, depth)?;
3646            Ok(())
3647        }
3648    }
3649
3650    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketAddr {
3651        #[inline(always)]
3652        fn new_empty() -> Self {
3653            Self {
3654                addr: fidl::new_empty!(fidl_fuchsia_net__common::IpAddress, D),
3655                port: fidl::new_empty!(u16, D),
3656            }
3657        }
3658
3659        #[inline]
3660        unsafe fn decode(
3661            &mut self,
3662            decoder: &mut fidl::encoding::Decoder<'_, D>,
3663            offset: usize,
3664            _depth: fidl::encoding::Depth,
3665        ) -> fidl::Result<()> {
3666            decoder.debug_check_bounds::<Self>(offset);
3667            // Verify that padding bytes are zero.
3668            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
3669            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3670            let mask = 0xffffffffffff0000u64;
3671            let maskedval = padval & mask;
3672            if maskedval != 0 {
3673                return Err(fidl::Error::NonZeroPadding {
3674                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
3675                });
3676            }
3677            fidl::decode!(
3678                fidl_fuchsia_net__common::IpAddress,
3679                D,
3680                &mut self.addr,
3681                decoder,
3682                offset + 0,
3683                _depth
3684            )?;
3685            fidl::decode!(u16, D, &mut self.port, decoder, offset + 16, _depth)?;
3686            Ok(())
3687        }
3688    }
3689
3690    impl fidl::encoding::ValueTypeMarker for SocketControlDetachEbpfProgramRequest {
3691        type Borrowed<'a> = &'a Self;
3692        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3693            value
3694        }
3695    }
3696
3697    unsafe impl fidl::encoding::TypeMarker for SocketControlDetachEbpfProgramRequest {
3698        type Owned = Self;
3699
3700        #[inline(always)]
3701        fn inline_align(_context: fidl::encoding::Context) -> usize {
3702            4
3703        }
3704
3705        #[inline(always)]
3706        fn inline_size(_context: fidl::encoding::Context) -> usize {
3707            4
3708        }
3709    }
3710
3711    unsafe impl<D: fidl::encoding::ResourceDialect>
3712        fidl::encoding::Encode<SocketControlDetachEbpfProgramRequest, D>
3713        for &SocketControlDetachEbpfProgramRequest
3714    {
3715        #[inline]
3716        unsafe fn encode(
3717            self,
3718            encoder: &mut fidl::encoding::Encoder<'_, D>,
3719            offset: usize,
3720            _depth: fidl::encoding::Depth,
3721        ) -> fidl::Result<()> {
3722            encoder.debug_check_bounds::<SocketControlDetachEbpfProgramRequest>(offset);
3723            // Delegate to tuple encoding.
3724            fidl::encoding::Encode::<SocketControlDetachEbpfProgramRequest, D>::encode(
3725                (<SocketHook as fidl::encoding::ValueTypeMarker>::borrow(&self.hook),),
3726                encoder,
3727                offset,
3728                _depth,
3729            )
3730        }
3731    }
3732    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<SocketHook, D>>
3733        fidl::encoding::Encode<SocketControlDetachEbpfProgramRequest, D> for (T0,)
3734    {
3735        #[inline]
3736        unsafe fn encode(
3737            self,
3738            encoder: &mut fidl::encoding::Encoder<'_, D>,
3739            offset: usize,
3740            depth: fidl::encoding::Depth,
3741        ) -> fidl::Result<()> {
3742            encoder.debug_check_bounds::<SocketControlDetachEbpfProgramRequest>(offset);
3743            // Zero out padding regions. There's no need to apply masks
3744            // because the unmasked parts will be overwritten by fields.
3745            // Write the fields.
3746            self.0.encode(encoder, offset + 0, depth)?;
3747            Ok(())
3748        }
3749    }
3750
3751    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3752        for SocketControlDetachEbpfProgramRequest
3753    {
3754        #[inline(always)]
3755        fn new_empty() -> Self {
3756            Self { hook: fidl::new_empty!(SocketHook, D) }
3757        }
3758
3759        #[inline]
3760        unsafe fn decode(
3761            &mut self,
3762            decoder: &mut fidl::encoding::Decoder<'_, D>,
3763            offset: usize,
3764            _depth: fidl::encoding::Depth,
3765        ) -> fidl::Result<()> {
3766            decoder.debug_check_bounds::<Self>(offset);
3767            // Verify that padding bytes are zero.
3768            fidl::decode!(SocketHook, D, &mut self.hook, decoder, offset + 0, _depth)?;
3769            Ok(())
3770        }
3771    }
3772
3773    impl fidl::encoding::ValueTypeMarker for WatcherWatchResponse {
3774        type Borrowed<'a> = &'a Self;
3775        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3776            value
3777        }
3778    }
3779
3780    unsafe impl fidl::encoding::TypeMarker for WatcherWatchResponse {
3781        type Owned = Self;
3782
3783        #[inline(always)]
3784        fn inline_align(_context: fidl::encoding::Context) -> usize {
3785            8
3786        }
3787
3788        #[inline(always)]
3789        fn inline_size(_context: fidl::encoding::Context) -> usize {
3790            16
3791        }
3792    }
3793
3794    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WatcherWatchResponse, D>
3795        for &WatcherWatchResponse
3796    {
3797        #[inline]
3798        unsafe fn encode(
3799            self,
3800            encoder: &mut fidl::encoding::Encoder<'_, D>,
3801            offset: usize,
3802            _depth: fidl::encoding::Depth,
3803        ) -> fidl::Result<()> {
3804            encoder.debug_check_bounds::<WatcherWatchResponse>(offset);
3805            // Delegate to tuple encoding.
3806            fidl::encoding::Encode::<WatcherWatchResponse, D>::encode(
3807                (<fidl::encoding::Vector<Event, 42> as fidl::encoding::ValueTypeMarker>::borrow(
3808                    &self.events,
3809                ),),
3810                encoder,
3811                offset,
3812                _depth,
3813            )
3814        }
3815    }
3816    unsafe impl<
3817        D: fidl::encoding::ResourceDialect,
3818        T0: fidl::encoding::Encode<fidl::encoding::Vector<Event, 42>, D>,
3819    > fidl::encoding::Encode<WatcherWatchResponse, D> for (T0,)
3820    {
3821        #[inline]
3822        unsafe fn encode(
3823            self,
3824            encoder: &mut fidl::encoding::Encoder<'_, D>,
3825            offset: usize,
3826            depth: fidl::encoding::Depth,
3827        ) -> fidl::Result<()> {
3828            encoder.debug_check_bounds::<WatcherWatchResponse>(offset);
3829            // Zero out padding regions. There's no need to apply masks
3830            // because the unmasked parts will be overwritten by fields.
3831            // Write the fields.
3832            self.0.encode(encoder, offset + 0, depth)?;
3833            Ok(())
3834        }
3835    }
3836
3837    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WatcherWatchResponse {
3838        #[inline(always)]
3839        fn new_empty() -> Self {
3840            Self { events: fidl::new_empty!(fidl::encoding::Vector<Event, 42>, D) }
3841        }
3842
3843        #[inline]
3844        unsafe fn decode(
3845            &mut self,
3846            decoder: &mut fidl::encoding::Decoder<'_, D>,
3847            offset: usize,
3848            _depth: fidl::encoding::Depth,
3849        ) -> fidl::Result<()> {
3850            decoder.debug_check_bounds::<Self>(offset);
3851            // Verify that padding bytes are zero.
3852            fidl::decode!(fidl::encoding::Vector<Event, 42>, D, &mut self.events, decoder, offset + 0, _depth)?;
3853            Ok(())
3854        }
3855    }
3856
3857    impl InstalledIpRoutine {
3858        #[inline(always)]
3859        fn max_ordinal_present(&self) -> u64 {
3860            if let Some(_) = self.priority {
3861                return 2;
3862            }
3863            if let Some(_) = self.hook {
3864                return 1;
3865            }
3866            0
3867        }
3868    }
3869
3870    impl fidl::encoding::ValueTypeMarker for InstalledIpRoutine {
3871        type Borrowed<'a> = &'a Self;
3872        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3873            value
3874        }
3875    }
3876
3877    unsafe impl fidl::encoding::TypeMarker for InstalledIpRoutine {
3878        type Owned = Self;
3879
3880        #[inline(always)]
3881        fn inline_align(_context: fidl::encoding::Context) -> usize {
3882            8
3883        }
3884
3885        #[inline(always)]
3886        fn inline_size(_context: fidl::encoding::Context) -> usize {
3887            16
3888        }
3889    }
3890
3891    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InstalledIpRoutine, D>
3892        for &InstalledIpRoutine
3893    {
3894        unsafe fn encode(
3895            self,
3896            encoder: &mut fidl::encoding::Encoder<'_, D>,
3897            offset: usize,
3898            mut depth: fidl::encoding::Depth,
3899        ) -> fidl::Result<()> {
3900            encoder.debug_check_bounds::<InstalledIpRoutine>(offset);
3901            // Vector header
3902            let max_ordinal: u64 = self.max_ordinal_present();
3903            encoder.write_num(max_ordinal, offset);
3904            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3905            // Calling encoder.out_of_line_offset(0) is not allowed.
3906            if max_ordinal == 0 {
3907                return Ok(());
3908            }
3909            depth.increment()?;
3910            let envelope_size = 8;
3911            let bytes_len = max_ordinal as usize * envelope_size;
3912            #[allow(unused_variables)]
3913            let offset = encoder.out_of_line_offset(bytes_len);
3914            let mut _prev_end_offset: usize = 0;
3915            if 1 > max_ordinal {
3916                return Ok(());
3917            }
3918
3919            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3920            // are envelope_size bytes.
3921            let cur_offset: usize = (1 - 1) * envelope_size;
3922
3923            // Zero reserved fields.
3924            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3925
3926            // Safety:
3927            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3928            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3929            //   envelope_size bytes, there is always sufficient room.
3930            fidl::encoding::encode_in_envelope_optional::<IpInstallationHook, D>(
3931                self.hook
3932                    .as_ref()
3933                    .map(<IpInstallationHook as fidl::encoding::ValueTypeMarker>::borrow),
3934                encoder,
3935                offset + cur_offset,
3936                depth,
3937            )?;
3938
3939            _prev_end_offset = cur_offset + envelope_size;
3940            if 2 > max_ordinal {
3941                return Ok(());
3942            }
3943
3944            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3945            // are envelope_size bytes.
3946            let cur_offset: usize = (2 - 1) * envelope_size;
3947
3948            // Zero reserved fields.
3949            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3950
3951            // Safety:
3952            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3953            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3954            //   envelope_size bytes, there is always sufficient room.
3955            fidl::encoding::encode_in_envelope_optional::<i32, D>(
3956                self.priority.as_ref().map(<i32 as fidl::encoding::ValueTypeMarker>::borrow),
3957                encoder,
3958                offset + cur_offset,
3959                depth,
3960            )?;
3961
3962            _prev_end_offset = cur_offset + envelope_size;
3963
3964            Ok(())
3965        }
3966    }
3967
3968    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InstalledIpRoutine {
3969        #[inline(always)]
3970        fn new_empty() -> Self {
3971            Self::default()
3972        }
3973
3974        unsafe fn decode(
3975            &mut self,
3976            decoder: &mut fidl::encoding::Decoder<'_, D>,
3977            offset: usize,
3978            mut depth: fidl::encoding::Depth,
3979        ) -> fidl::Result<()> {
3980            decoder.debug_check_bounds::<Self>(offset);
3981            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3982                None => return Err(fidl::Error::NotNullable),
3983                Some(len) => len,
3984            };
3985            // Calling decoder.out_of_line_offset(0) is not allowed.
3986            if len == 0 {
3987                return Ok(());
3988            };
3989            depth.increment()?;
3990            let envelope_size = 8;
3991            let bytes_len = len * envelope_size;
3992            let offset = decoder.out_of_line_offset(bytes_len)?;
3993            // Decode the envelope for each type.
3994            let mut _next_ordinal_to_read = 0;
3995            let mut next_offset = offset;
3996            let end_offset = offset + bytes_len;
3997            _next_ordinal_to_read += 1;
3998            if next_offset >= end_offset {
3999                return Ok(());
4000            }
4001
4002            // Decode unknown envelopes for gaps in ordinals.
4003            while _next_ordinal_to_read < 1 {
4004                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4005                _next_ordinal_to_read += 1;
4006                next_offset += envelope_size;
4007            }
4008
4009            let next_out_of_line = decoder.next_out_of_line();
4010            let handles_before = decoder.remaining_handles();
4011            if let Some((inlined, num_bytes, num_handles)) =
4012                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4013            {
4014                let member_inline_size =
4015                    <IpInstallationHook as fidl::encoding::TypeMarker>::inline_size(
4016                        decoder.context,
4017                    );
4018                if inlined != (member_inline_size <= 4) {
4019                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4020                }
4021                let inner_offset;
4022                let mut inner_depth = depth.clone();
4023                if inlined {
4024                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4025                    inner_offset = next_offset;
4026                } else {
4027                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4028                    inner_depth.increment()?;
4029                }
4030                let val_ref =
4031                    self.hook.get_or_insert_with(|| fidl::new_empty!(IpInstallationHook, D));
4032                fidl::decode!(IpInstallationHook, D, val_ref, decoder, inner_offset, inner_depth)?;
4033                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4034                {
4035                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4036                }
4037                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4038                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4039                }
4040            }
4041
4042            next_offset += envelope_size;
4043            _next_ordinal_to_read += 1;
4044            if next_offset >= end_offset {
4045                return Ok(());
4046            }
4047
4048            // Decode unknown envelopes for gaps in ordinals.
4049            while _next_ordinal_to_read < 2 {
4050                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4051                _next_ordinal_to_read += 1;
4052                next_offset += envelope_size;
4053            }
4054
4055            let next_out_of_line = decoder.next_out_of_line();
4056            let handles_before = decoder.remaining_handles();
4057            if let Some((inlined, num_bytes, num_handles)) =
4058                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4059            {
4060                let member_inline_size =
4061                    <i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4062                if inlined != (member_inline_size <= 4) {
4063                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4064                }
4065                let inner_offset;
4066                let mut inner_depth = depth.clone();
4067                if inlined {
4068                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4069                    inner_offset = next_offset;
4070                } else {
4071                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4072                    inner_depth.increment()?;
4073                }
4074                let val_ref = self.priority.get_or_insert_with(|| fidl::new_empty!(i32, D));
4075                fidl::decode!(i32, D, val_ref, decoder, inner_offset, inner_depth)?;
4076                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4077                {
4078                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4079                }
4080                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4081                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4082                }
4083            }
4084
4085            next_offset += envelope_size;
4086
4087            // Decode the remaining unknown envelopes.
4088            while next_offset < end_offset {
4089                _next_ordinal_to_read += 1;
4090                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4091                next_offset += envelope_size;
4092            }
4093
4094            Ok(())
4095        }
4096    }
4097
4098    impl InstalledNatRoutine {
4099        #[inline(always)]
4100        fn max_ordinal_present(&self) -> u64 {
4101            if let Some(_) = self.priority {
4102                return 2;
4103            }
4104            if let Some(_) = self.hook {
4105                return 1;
4106            }
4107            0
4108        }
4109    }
4110
4111    impl fidl::encoding::ValueTypeMarker for InstalledNatRoutine {
4112        type Borrowed<'a> = &'a Self;
4113        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4114            value
4115        }
4116    }
4117
4118    unsafe impl fidl::encoding::TypeMarker for InstalledNatRoutine {
4119        type Owned = Self;
4120
4121        #[inline(always)]
4122        fn inline_align(_context: fidl::encoding::Context) -> usize {
4123            8
4124        }
4125
4126        #[inline(always)]
4127        fn inline_size(_context: fidl::encoding::Context) -> usize {
4128            16
4129        }
4130    }
4131
4132    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InstalledNatRoutine, D>
4133        for &InstalledNatRoutine
4134    {
4135        unsafe fn encode(
4136            self,
4137            encoder: &mut fidl::encoding::Encoder<'_, D>,
4138            offset: usize,
4139            mut depth: fidl::encoding::Depth,
4140        ) -> fidl::Result<()> {
4141            encoder.debug_check_bounds::<InstalledNatRoutine>(offset);
4142            // Vector header
4143            let max_ordinal: u64 = self.max_ordinal_present();
4144            encoder.write_num(max_ordinal, offset);
4145            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4146            // Calling encoder.out_of_line_offset(0) is not allowed.
4147            if max_ordinal == 0 {
4148                return Ok(());
4149            }
4150            depth.increment()?;
4151            let envelope_size = 8;
4152            let bytes_len = max_ordinal as usize * envelope_size;
4153            #[allow(unused_variables)]
4154            let offset = encoder.out_of_line_offset(bytes_len);
4155            let mut _prev_end_offset: usize = 0;
4156            if 1 > max_ordinal {
4157                return Ok(());
4158            }
4159
4160            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4161            // are envelope_size bytes.
4162            let cur_offset: usize = (1 - 1) * envelope_size;
4163
4164            // Zero reserved fields.
4165            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4166
4167            // Safety:
4168            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4169            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4170            //   envelope_size bytes, there is always sufficient room.
4171            fidl::encoding::encode_in_envelope_optional::<NatInstallationHook, D>(
4172                self.hook
4173                    .as_ref()
4174                    .map(<NatInstallationHook as fidl::encoding::ValueTypeMarker>::borrow),
4175                encoder,
4176                offset + cur_offset,
4177                depth,
4178            )?;
4179
4180            _prev_end_offset = cur_offset + envelope_size;
4181            if 2 > max_ordinal {
4182                return Ok(());
4183            }
4184
4185            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4186            // are envelope_size bytes.
4187            let cur_offset: usize = (2 - 1) * envelope_size;
4188
4189            // Zero reserved fields.
4190            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4191
4192            // Safety:
4193            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4194            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4195            //   envelope_size bytes, there is always sufficient room.
4196            fidl::encoding::encode_in_envelope_optional::<i32, D>(
4197                self.priority.as_ref().map(<i32 as fidl::encoding::ValueTypeMarker>::borrow),
4198                encoder,
4199                offset + cur_offset,
4200                depth,
4201            )?;
4202
4203            _prev_end_offset = cur_offset + envelope_size;
4204
4205            Ok(())
4206        }
4207    }
4208
4209    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InstalledNatRoutine {
4210        #[inline(always)]
4211        fn new_empty() -> Self {
4212            Self::default()
4213        }
4214
4215        unsafe fn decode(
4216            &mut self,
4217            decoder: &mut fidl::encoding::Decoder<'_, D>,
4218            offset: usize,
4219            mut depth: fidl::encoding::Depth,
4220        ) -> fidl::Result<()> {
4221            decoder.debug_check_bounds::<Self>(offset);
4222            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4223                None => return Err(fidl::Error::NotNullable),
4224                Some(len) => len,
4225            };
4226            // Calling decoder.out_of_line_offset(0) is not allowed.
4227            if len == 0 {
4228                return Ok(());
4229            };
4230            depth.increment()?;
4231            let envelope_size = 8;
4232            let bytes_len = len * envelope_size;
4233            let offset = decoder.out_of_line_offset(bytes_len)?;
4234            // Decode the envelope for each type.
4235            let mut _next_ordinal_to_read = 0;
4236            let mut next_offset = offset;
4237            let end_offset = offset + bytes_len;
4238            _next_ordinal_to_read += 1;
4239            if next_offset >= end_offset {
4240                return Ok(());
4241            }
4242
4243            // Decode unknown envelopes for gaps in ordinals.
4244            while _next_ordinal_to_read < 1 {
4245                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4246                _next_ordinal_to_read += 1;
4247                next_offset += envelope_size;
4248            }
4249
4250            let next_out_of_line = decoder.next_out_of_line();
4251            let handles_before = decoder.remaining_handles();
4252            if let Some((inlined, num_bytes, num_handles)) =
4253                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4254            {
4255                let member_inline_size =
4256                    <NatInstallationHook as fidl::encoding::TypeMarker>::inline_size(
4257                        decoder.context,
4258                    );
4259                if inlined != (member_inline_size <= 4) {
4260                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4261                }
4262                let inner_offset;
4263                let mut inner_depth = depth.clone();
4264                if inlined {
4265                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4266                    inner_offset = next_offset;
4267                } else {
4268                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4269                    inner_depth.increment()?;
4270                }
4271                let val_ref =
4272                    self.hook.get_or_insert_with(|| fidl::new_empty!(NatInstallationHook, D));
4273                fidl::decode!(NatInstallationHook, D, val_ref, decoder, inner_offset, inner_depth)?;
4274                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4275                {
4276                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4277                }
4278                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4279                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4280                }
4281            }
4282
4283            next_offset += envelope_size;
4284            _next_ordinal_to_read += 1;
4285            if next_offset >= end_offset {
4286                return Ok(());
4287            }
4288
4289            // Decode unknown envelopes for gaps in ordinals.
4290            while _next_ordinal_to_read < 2 {
4291                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4292                _next_ordinal_to_read += 1;
4293                next_offset += envelope_size;
4294            }
4295
4296            let next_out_of_line = decoder.next_out_of_line();
4297            let handles_before = decoder.remaining_handles();
4298            if let Some((inlined, num_bytes, num_handles)) =
4299                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4300            {
4301                let member_inline_size =
4302                    <i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4303                if inlined != (member_inline_size <= 4) {
4304                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4305                }
4306                let inner_offset;
4307                let mut inner_depth = depth.clone();
4308                if inlined {
4309                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4310                    inner_offset = next_offset;
4311                } else {
4312                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4313                    inner_depth.increment()?;
4314                }
4315                let val_ref = self.priority.get_or_insert_with(|| fidl::new_empty!(i32, D));
4316                fidl::decode!(i32, D, val_ref, decoder, inner_offset, inner_depth)?;
4317                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4318                {
4319                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4320                }
4321                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4322                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4323                }
4324            }
4325
4326            next_offset += envelope_size;
4327
4328            // Decode the remaining unknown envelopes.
4329            while next_offset < end_offset {
4330                _next_ordinal_to_read += 1;
4331                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4332                next_offset += envelope_size;
4333            }
4334
4335            Ok(())
4336        }
4337    }
4338
4339    impl IpRoutine {
4340        #[inline(always)]
4341        fn max_ordinal_present(&self) -> u64 {
4342            if let Some(_) = self.installation {
4343                return 1;
4344            }
4345            0
4346        }
4347    }
4348
4349    impl fidl::encoding::ValueTypeMarker for IpRoutine {
4350        type Borrowed<'a> = &'a Self;
4351        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4352            value
4353        }
4354    }
4355
4356    unsafe impl fidl::encoding::TypeMarker for IpRoutine {
4357        type Owned = Self;
4358
4359        #[inline(always)]
4360        fn inline_align(_context: fidl::encoding::Context) -> usize {
4361            8
4362        }
4363
4364        #[inline(always)]
4365        fn inline_size(_context: fidl::encoding::Context) -> usize {
4366            16
4367        }
4368    }
4369
4370    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<IpRoutine, D>
4371        for &IpRoutine
4372    {
4373        unsafe fn encode(
4374            self,
4375            encoder: &mut fidl::encoding::Encoder<'_, D>,
4376            offset: usize,
4377            mut depth: fidl::encoding::Depth,
4378        ) -> fidl::Result<()> {
4379            encoder.debug_check_bounds::<IpRoutine>(offset);
4380            // Vector header
4381            let max_ordinal: u64 = self.max_ordinal_present();
4382            encoder.write_num(max_ordinal, offset);
4383            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4384            // Calling encoder.out_of_line_offset(0) is not allowed.
4385            if max_ordinal == 0 {
4386                return Ok(());
4387            }
4388            depth.increment()?;
4389            let envelope_size = 8;
4390            let bytes_len = max_ordinal as usize * envelope_size;
4391            #[allow(unused_variables)]
4392            let offset = encoder.out_of_line_offset(bytes_len);
4393            let mut _prev_end_offset: usize = 0;
4394            if 1 > max_ordinal {
4395                return Ok(());
4396            }
4397
4398            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4399            // are envelope_size bytes.
4400            let cur_offset: usize = (1 - 1) * envelope_size;
4401
4402            // Zero reserved fields.
4403            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4404
4405            // Safety:
4406            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4407            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4408            //   envelope_size bytes, there is always sufficient room.
4409            fidl::encoding::encode_in_envelope_optional::<InstalledIpRoutine, D>(
4410                self.installation
4411                    .as_ref()
4412                    .map(<InstalledIpRoutine as fidl::encoding::ValueTypeMarker>::borrow),
4413                encoder,
4414                offset + cur_offset,
4415                depth,
4416            )?;
4417
4418            _prev_end_offset = cur_offset + envelope_size;
4419
4420            Ok(())
4421        }
4422    }
4423
4424    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IpRoutine {
4425        #[inline(always)]
4426        fn new_empty() -> Self {
4427            Self::default()
4428        }
4429
4430        unsafe fn decode(
4431            &mut self,
4432            decoder: &mut fidl::encoding::Decoder<'_, D>,
4433            offset: usize,
4434            mut depth: fidl::encoding::Depth,
4435        ) -> fidl::Result<()> {
4436            decoder.debug_check_bounds::<Self>(offset);
4437            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4438                None => return Err(fidl::Error::NotNullable),
4439                Some(len) => len,
4440            };
4441            // Calling decoder.out_of_line_offset(0) is not allowed.
4442            if len == 0 {
4443                return Ok(());
4444            };
4445            depth.increment()?;
4446            let envelope_size = 8;
4447            let bytes_len = len * envelope_size;
4448            let offset = decoder.out_of_line_offset(bytes_len)?;
4449            // Decode the envelope for each type.
4450            let mut _next_ordinal_to_read = 0;
4451            let mut next_offset = offset;
4452            let end_offset = offset + bytes_len;
4453            _next_ordinal_to_read += 1;
4454            if next_offset >= end_offset {
4455                return Ok(());
4456            }
4457
4458            // Decode unknown envelopes for gaps in ordinals.
4459            while _next_ordinal_to_read < 1 {
4460                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4461                _next_ordinal_to_read += 1;
4462                next_offset += envelope_size;
4463            }
4464
4465            let next_out_of_line = decoder.next_out_of_line();
4466            let handles_before = decoder.remaining_handles();
4467            if let Some((inlined, num_bytes, num_handles)) =
4468                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4469            {
4470                let member_inline_size =
4471                    <InstalledIpRoutine as fidl::encoding::TypeMarker>::inline_size(
4472                        decoder.context,
4473                    );
4474                if inlined != (member_inline_size <= 4) {
4475                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4476                }
4477                let inner_offset;
4478                let mut inner_depth = depth.clone();
4479                if inlined {
4480                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4481                    inner_offset = next_offset;
4482                } else {
4483                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4484                    inner_depth.increment()?;
4485                }
4486                let val_ref = self
4487                    .installation
4488                    .get_or_insert_with(|| fidl::new_empty!(InstalledIpRoutine, D));
4489                fidl::decode!(InstalledIpRoutine, D, val_ref, decoder, inner_offset, inner_depth)?;
4490                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4491                {
4492                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4493                }
4494                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4495                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4496                }
4497            }
4498
4499            next_offset += envelope_size;
4500
4501            // Decode the remaining unknown envelopes.
4502            while next_offset < end_offset {
4503                _next_ordinal_to_read += 1;
4504                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4505                next_offset += envelope_size;
4506            }
4507
4508            Ok(())
4509        }
4510    }
4511
4512    impl Masquerade {
4513        #[inline(always)]
4514        fn max_ordinal_present(&self) -> u64 {
4515            if let Some(_) = self.src_port {
4516                return 1;
4517            }
4518            0
4519        }
4520    }
4521
4522    impl fidl::encoding::ValueTypeMarker for Masquerade {
4523        type Borrowed<'a> = &'a Self;
4524        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4525            value
4526        }
4527    }
4528
4529    unsafe impl fidl::encoding::TypeMarker for Masquerade {
4530        type Owned = Self;
4531
4532        #[inline(always)]
4533        fn inline_align(_context: fidl::encoding::Context) -> usize {
4534            8
4535        }
4536
4537        #[inline(always)]
4538        fn inline_size(_context: fidl::encoding::Context) -> usize {
4539            16
4540        }
4541    }
4542
4543    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Masquerade, D>
4544        for &Masquerade
4545    {
4546        unsafe fn encode(
4547            self,
4548            encoder: &mut fidl::encoding::Encoder<'_, D>,
4549            offset: usize,
4550            mut depth: fidl::encoding::Depth,
4551        ) -> fidl::Result<()> {
4552            encoder.debug_check_bounds::<Masquerade>(offset);
4553            // Vector header
4554            let max_ordinal: u64 = self.max_ordinal_present();
4555            encoder.write_num(max_ordinal, offset);
4556            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4557            // Calling encoder.out_of_line_offset(0) is not allowed.
4558            if max_ordinal == 0 {
4559                return Ok(());
4560            }
4561            depth.increment()?;
4562            let envelope_size = 8;
4563            let bytes_len = max_ordinal as usize * envelope_size;
4564            #[allow(unused_variables)]
4565            let offset = encoder.out_of_line_offset(bytes_len);
4566            let mut _prev_end_offset: usize = 0;
4567            if 1 > max_ordinal {
4568                return Ok(());
4569            }
4570
4571            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4572            // are envelope_size bytes.
4573            let cur_offset: usize = (1 - 1) * envelope_size;
4574
4575            // Zero reserved fields.
4576            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4577
4578            // Safety:
4579            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4580            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4581            //   envelope_size bytes, there is always sufficient room.
4582            fidl::encoding::encode_in_envelope_optional::<PortRange, D>(
4583                self.src_port.as_ref().map(<PortRange as fidl::encoding::ValueTypeMarker>::borrow),
4584                encoder,
4585                offset + cur_offset,
4586                depth,
4587            )?;
4588
4589            _prev_end_offset = cur_offset + envelope_size;
4590
4591            Ok(())
4592        }
4593    }
4594
4595    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Masquerade {
4596        #[inline(always)]
4597        fn new_empty() -> Self {
4598            Self::default()
4599        }
4600
4601        unsafe fn decode(
4602            &mut self,
4603            decoder: &mut fidl::encoding::Decoder<'_, D>,
4604            offset: usize,
4605            mut depth: fidl::encoding::Depth,
4606        ) -> fidl::Result<()> {
4607            decoder.debug_check_bounds::<Self>(offset);
4608            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4609                None => return Err(fidl::Error::NotNullable),
4610                Some(len) => len,
4611            };
4612            // Calling decoder.out_of_line_offset(0) is not allowed.
4613            if len == 0 {
4614                return Ok(());
4615            };
4616            depth.increment()?;
4617            let envelope_size = 8;
4618            let bytes_len = len * envelope_size;
4619            let offset = decoder.out_of_line_offset(bytes_len)?;
4620            // Decode the envelope for each type.
4621            let mut _next_ordinal_to_read = 0;
4622            let mut next_offset = offset;
4623            let end_offset = offset + bytes_len;
4624            _next_ordinal_to_read += 1;
4625            if next_offset >= end_offset {
4626                return Ok(());
4627            }
4628
4629            // Decode unknown envelopes for gaps in ordinals.
4630            while _next_ordinal_to_read < 1 {
4631                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4632                _next_ordinal_to_read += 1;
4633                next_offset += envelope_size;
4634            }
4635
4636            let next_out_of_line = decoder.next_out_of_line();
4637            let handles_before = decoder.remaining_handles();
4638            if let Some((inlined, num_bytes, num_handles)) =
4639                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4640            {
4641                let member_inline_size =
4642                    <PortRange as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4643                if inlined != (member_inline_size <= 4) {
4644                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4645                }
4646                let inner_offset;
4647                let mut inner_depth = depth.clone();
4648                if inlined {
4649                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4650                    inner_offset = next_offset;
4651                } else {
4652                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4653                    inner_depth.increment()?;
4654                }
4655                let val_ref = self.src_port.get_or_insert_with(|| fidl::new_empty!(PortRange, D));
4656                fidl::decode!(PortRange, D, val_ref, decoder, inner_offset, inner_depth)?;
4657                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4658                {
4659                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4660                }
4661                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4662                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4663                }
4664            }
4665
4666            next_offset += envelope_size;
4667
4668            // Decode the remaining unknown envelopes.
4669            while next_offset < end_offset {
4670                _next_ordinal_to_read += 1;
4671                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4672                next_offset += envelope_size;
4673            }
4674
4675            Ok(())
4676        }
4677    }
4678
4679    impl Matchers {
4680        #[inline(always)]
4681        fn max_ordinal_present(&self) -> u64 {
4682            if let Some(_) = self.ebpf_program {
4683                return 6;
4684            }
4685            if let Some(_) = self.transport_protocol {
4686                return 5;
4687            }
4688            if let Some(_) = self.dst_addr {
4689                return 4;
4690            }
4691            if let Some(_) = self.src_addr {
4692                return 3;
4693            }
4694            if let Some(_) = self.out_interface {
4695                return 2;
4696            }
4697            if let Some(_) = self.in_interface {
4698                return 1;
4699            }
4700            0
4701        }
4702    }
4703
4704    impl fidl::encoding::ValueTypeMarker for Matchers {
4705        type Borrowed<'a> = &'a Self;
4706        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4707            value
4708        }
4709    }
4710
4711    unsafe impl fidl::encoding::TypeMarker for Matchers {
4712        type Owned = Self;
4713
4714        #[inline(always)]
4715        fn inline_align(_context: fidl::encoding::Context) -> usize {
4716            8
4717        }
4718
4719        #[inline(always)]
4720        fn inline_size(_context: fidl::encoding::Context) -> usize {
4721            16
4722        }
4723    }
4724
4725    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Matchers, D> for &Matchers {
4726        unsafe fn encode(
4727            self,
4728            encoder: &mut fidl::encoding::Encoder<'_, D>,
4729            offset: usize,
4730            mut depth: fidl::encoding::Depth,
4731        ) -> fidl::Result<()> {
4732            encoder.debug_check_bounds::<Matchers>(offset);
4733            // Vector header
4734            let max_ordinal: u64 = self.max_ordinal_present();
4735            encoder.write_num(max_ordinal, offset);
4736            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4737            // Calling encoder.out_of_line_offset(0) is not allowed.
4738            if max_ordinal == 0 {
4739                return Ok(());
4740            }
4741            depth.increment()?;
4742            let envelope_size = 8;
4743            let bytes_len = max_ordinal as usize * envelope_size;
4744            #[allow(unused_variables)]
4745            let offset = encoder.out_of_line_offset(bytes_len);
4746            let mut _prev_end_offset: usize = 0;
4747            if 1 > max_ordinal {
4748                return Ok(());
4749            }
4750
4751            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4752            // are envelope_size bytes.
4753            let cur_offset: usize = (1 - 1) * envelope_size;
4754
4755            // Zero reserved fields.
4756            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4757
4758            // Safety:
4759            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4760            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4761            //   envelope_size bytes, there is always sufficient room.
4762            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net_matchers__common::Interface, D>(
4763            self.in_interface.as_ref().map(<fidl_fuchsia_net_matchers__common::Interface as fidl::encoding::ValueTypeMarker>::borrow),
4764            encoder, offset + cur_offset, depth
4765        )?;
4766
4767            _prev_end_offset = cur_offset + envelope_size;
4768            if 2 > max_ordinal {
4769                return Ok(());
4770            }
4771
4772            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4773            // are envelope_size bytes.
4774            let cur_offset: usize = (2 - 1) * envelope_size;
4775
4776            // Zero reserved fields.
4777            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4778
4779            // Safety:
4780            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4781            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4782            //   envelope_size bytes, there is always sufficient room.
4783            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net_matchers__common::Interface, D>(
4784            self.out_interface.as_ref().map(<fidl_fuchsia_net_matchers__common::Interface as fidl::encoding::ValueTypeMarker>::borrow),
4785            encoder, offset + cur_offset, depth
4786        )?;
4787
4788            _prev_end_offset = cur_offset + envelope_size;
4789            if 3 > max_ordinal {
4790                return Ok(());
4791            }
4792
4793            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4794            // are envelope_size bytes.
4795            let cur_offset: usize = (3 - 1) * envelope_size;
4796
4797            // Zero reserved fields.
4798            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4799
4800            // Safety:
4801            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4802            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4803            //   envelope_size bytes, there is always sufficient room.
4804            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net_matchers__common::Address, D>(
4805            self.src_addr.as_ref().map(<fidl_fuchsia_net_matchers__common::Address as fidl::encoding::ValueTypeMarker>::borrow),
4806            encoder, offset + cur_offset, depth
4807        )?;
4808
4809            _prev_end_offset = cur_offset + envelope_size;
4810            if 4 > max_ordinal {
4811                return Ok(());
4812            }
4813
4814            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4815            // are envelope_size bytes.
4816            let cur_offset: usize = (4 - 1) * envelope_size;
4817
4818            // Zero reserved fields.
4819            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4820
4821            // Safety:
4822            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4823            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4824            //   envelope_size bytes, there is always sufficient room.
4825            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net_matchers__common::Address, D>(
4826            self.dst_addr.as_ref().map(<fidl_fuchsia_net_matchers__common::Address as fidl::encoding::ValueTypeMarker>::borrow),
4827            encoder, offset + cur_offset, depth
4828        )?;
4829
4830            _prev_end_offset = cur_offset + envelope_size;
4831            if 5 > max_ordinal {
4832                return Ok(());
4833            }
4834
4835            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4836            // are envelope_size bytes.
4837            let cur_offset: usize = (5 - 1) * envelope_size;
4838
4839            // Zero reserved fields.
4840            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4841
4842            // Safety:
4843            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4844            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4845            //   envelope_size bytes, there is always sufficient room.
4846            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net_matchers__common::PacketTransportProtocol, D>(
4847            self.transport_protocol.as_ref().map(<fidl_fuchsia_net_matchers__common::PacketTransportProtocol as fidl::encoding::ValueTypeMarker>::borrow),
4848            encoder, offset + cur_offset, depth
4849        )?;
4850
4851            _prev_end_offset = cur_offset + envelope_size;
4852            if 6 > max_ordinal {
4853                return Ok(());
4854            }
4855
4856            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4857            // are envelope_size bytes.
4858            let cur_offset: usize = (6 - 1) * envelope_size;
4859
4860            // Zero reserved fields.
4861            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4862
4863            // Safety:
4864            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4865            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4866            //   envelope_size bytes, there is always sufficient room.
4867            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ebpf__common::ProgramId, D>(
4868            self.ebpf_program.as_ref().map(<fidl_fuchsia_ebpf__common::ProgramId as fidl::encoding::ValueTypeMarker>::borrow),
4869            encoder, offset + cur_offset, depth
4870        )?;
4871
4872            _prev_end_offset = cur_offset + envelope_size;
4873
4874            Ok(())
4875        }
4876    }
4877
4878    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Matchers {
4879        #[inline(always)]
4880        fn new_empty() -> Self {
4881            Self::default()
4882        }
4883
4884        unsafe fn decode(
4885            &mut self,
4886            decoder: &mut fidl::encoding::Decoder<'_, D>,
4887            offset: usize,
4888            mut depth: fidl::encoding::Depth,
4889        ) -> fidl::Result<()> {
4890            decoder.debug_check_bounds::<Self>(offset);
4891            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4892                None => return Err(fidl::Error::NotNullable),
4893                Some(len) => len,
4894            };
4895            // Calling decoder.out_of_line_offset(0) is not allowed.
4896            if len == 0 {
4897                return Ok(());
4898            };
4899            depth.increment()?;
4900            let envelope_size = 8;
4901            let bytes_len = len * envelope_size;
4902            let offset = decoder.out_of_line_offset(bytes_len)?;
4903            // Decode the envelope for each type.
4904            let mut _next_ordinal_to_read = 0;
4905            let mut next_offset = offset;
4906            let end_offset = offset + bytes_len;
4907            _next_ordinal_to_read += 1;
4908            if next_offset >= end_offset {
4909                return Ok(());
4910            }
4911
4912            // Decode unknown envelopes for gaps in ordinals.
4913            while _next_ordinal_to_read < 1 {
4914                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4915                _next_ordinal_to_read += 1;
4916                next_offset += envelope_size;
4917            }
4918
4919            let next_out_of_line = decoder.next_out_of_line();
4920            let handles_before = decoder.remaining_handles();
4921            if let Some((inlined, num_bytes, num_handles)) =
4922                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4923            {
4924                let member_inline_size = <fidl_fuchsia_net_matchers__common::Interface as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4925                if inlined != (member_inline_size <= 4) {
4926                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4927                }
4928                let inner_offset;
4929                let mut inner_depth = depth.clone();
4930                if inlined {
4931                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4932                    inner_offset = next_offset;
4933                } else {
4934                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4935                    inner_depth.increment()?;
4936                }
4937                let val_ref = self.in_interface.get_or_insert_with(|| {
4938                    fidl::new_empty!(fidl_fuchsia_net_matchers__common::Interface, D)
4939                });
4940                fidl::decode!(
4941                    fidl_fuchsia_net_matchers__common::Interface,
4942                    D,
4943                    val_ref,
4944                    decoder,
4945                    inner_offset,
4946                    inner_depth
4947                )?;
4948                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4949                {
4950                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4951                }
4952                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4953                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4954                }
4955            }
4956
4957            next_offset += envelope_size;
4958            _next_ordinal_to_read += 1;
4959            if next_offset >= end_offset {
4960                return Ok(());
4961            }
4962
4963            // Decode unknown envelopes for gaps in ordinals.
4964            while _next_ordinal_to_read < 2 {
4965                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4966                _next_ordinal_to_read += 1;
4967                next_offset += envelope_size;
4968            }
4969
4970            let next_out_of_line = decoder.next_out_of_line();
4971            let handles_before = decoder.remaining_handles();
4972            if let Some((inlined, num_bytes, num_handles)) =
4973                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4974            {
4975                let member_inline_size = <fidl_fuchsia_net_matchers__common::Interface as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4976                if inlined != (member_inline_size <= 4) {
4977                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4978                }
4979                let inner_offset;
4980                let mut inner_depth = depth.clone();
4981                if inlined {
4982                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4983                    inner_offset = next_offset;
4984                } else {
4985                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4986                    inner_depth.increment()?;
4987                }
4988                let val_ref = self.out_interface.get_or_insert_with(|| {
4989                    fidl::new_empty!(fidl_fuchsia_net_matchers__common::Interface, D)
4990                });
4991                fidl::decode!(
4992                    fidl_fuchsia_net_matchers__common::Interface,
4993                    D,
4994                    val_ref,
4995                    decoder,
4996                    inner_offset,
4997                    inner_depth
4998                )?;
4999                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5000                {
5001                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5002                }
5003                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5004                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5005                }
5006            }
5007
5008            next_offset += envelope_size;
5009            _next_ordinal_to_read += 1;
5010            if next_offset >= end_offset {
5011                return Ok(());
5012            }
5013
5014            // Decode unknown envelopes for gaps in ordinals.
5015            while _next_ordinal_to_read < 3 {
5016                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5017                _next_ordinal_to_read += 1;
5018                next_offset += envelope_size;
5019            }
5020
5021            let next_out_of_line = decoder.next_out_of_line();
5022            let handles_before = decoder.remaining_handles();
5023            if let Some((inlined, num_bytes, num_handles)) =
5024                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5025            {
5026                let member_inline_size = <fidl_fuchsia_net_matchers__common::Address as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5027                if inlined != (member_inline_size <= 4) {
5028                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5029                }
5030                let inner_offset;
5031                let mut inner_depth = depth.clone();
5032                if inlined {
5033                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5034                    inner_offset = next_offset;
5035                } else {
5036                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5037                    inner_depth.increment()?;
5038                }
5039                let val_ref = self.src_addr.get_or_insert_with(|| {
5040                    fidl::new_empty!(fidl_fuchsia_net_matchers__common::Address, D)
5041                });
5042                fidl::decode!(
5043                    fidl_fuchsia_net_matchers__common::Address,
5044                    D,
5045                    val_ref,
5046                    decoder,
5047                    inner_offset,
5048                    inner_depth
5049                )?;
5050                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5051                {
5052                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5053                }
5054                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5055                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5056                }
5057            }
5058
5059            next_offset += envelope_size;
5060            _next_ordinal_to_read += 1;
5061            if next_offset >= end_offset {
5062                return Ok(());
5063            }
5064
5065            // Decode unknown envelopes for gaps in ordinals.
5066            while _next_ordinal_to_read < 4 {
5067                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5068                _next_ordinal_to_read += 1;
5069                next_offset += envelope_size;
5070            }
5071
5072            let next_out_of_line = decoder.next_out_of_line();
5073            let handles_before = decoder.remaining_handles();
5074            if let Some((inlined, num_bytes, num_handles)) =
5075                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5076            {
5077                let member_inline_size = <fidl_fuchsia_net_matchers__common::Address as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5078                if inlined != (member_inline_size <= 4) {
5079                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5080                }
5081                let inner_offset;
5082                let mut inner_depth = depth.clone();
5083                if inlined {
5084                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5085                    inner_offset = next_offset;
5086                } else {
5087                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5088                    inner_depth.increment()?;
5089                }
5090                let val_ref = self.dst_addr.get_or_insert_with(|| {
5091                    fidl::new_empty!(fidl_fuchsia_net_matchers__common::Address, D)
5092                });
5093                fidl::decode!(
5094                    fidl_fuchsia_net_matchers__common::Address,
5095                    D,
5096                    val_ref,
5097                    decoder,
5098                    inner_offset,
5099                    inner_depth
5100                )?;
5101                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5102                {
5103                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5104                }
5105                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5106                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5107                }
5108            }
5109
5110            next_offset += envelope_size;
5111            _next_ordinal_to_read += 1;
5112            if next_offset >= end_offset {
5113                return Ok(());
5114            }
5115
5116            // Decode unknown envelopes for gaps in ordinals.
5117            while _next_ordinal_to_read < 5 {
5118                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5119                _next_ordinal_to_read += 1;
5120                next_offset += envelope_size;
5121            }
5122
5123            let next_out_of_line = decoder.next_out_of_line();
5124            let handles_before = decoder.remaining_handles();
5125            if let Some((inlined, num_bytes, num_handles)) =
5126                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5127            {
5128                let member_inline_size = <fidl_fuchsia_net_matchers__common::PacketTransportProtocol as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5129                if inlined != (member_inline_size <= 4) {
5130                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5131                }
5132                let inner_offset;
5133                let mut inner_depth = depth.clone();
5134                if inlined {
5135                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5136                    inner_offset = next_offset;
5137                } else {
5138                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5139                    inner_depth.increment()?;
5140                }
5141                let val_ref = self.transport_protocol.get_or_insert_with(|| {
5142                    fidl::new_empty!(fidl_fuchsia_net_matchers__common::PacketTransportProtocol, D)
5143                });
5144                fidl::decode!(
5145                    fidl_fuchsia_net_matchers__common::PacketTransportProtocol,
5146                    D,
5147                    val_ref,
5148                    decoder,
5149                    inner_offset,
5150                    inner_depth
5151                )?;
5152                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5153                {
5154                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5155                }
5156                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5157                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5158                }
5159            }
5160
5161            next_offset += envelope_size;
5162            _next_ordinal_to_read += 1;
5163            if next_offset >= end_offset {
5164                return Ok(());
5165            }
5166
5167            // Decode unknown envelopes for gaps in ordinals.
5168            while _next_ordinal_to_read < 6 {
5169                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5170                _next_ordinal_to_read += 1;
5171                next_offset += envelope_size;
5172            }
5173
5174            let next_out_of_line = decoder.next_out_of_line();
5175            let handles_before = decoder.remaining_handles();
5176            if let Some((inlined, num_bytes, num_handles)) =
5177                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5178            {
5179                let member_inline_size = <fidl_fuchsia_ebpf__common::ProgramId as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5180                if inlined != (member_inline_size <= 4) {
5181                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5182                }
5183                let inner_offset;
5184                let mut inner_depth = depth.clone();
5185                if inlined {
5186                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5187                    inner_offset = next_offset;
5188                } else {
5189                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5190                    inner_depth.increment()?;
5191                }
5192                let val_ref = self.ebpf_program.get_or_insert_with(|| {
5193                    fidl::new_empty!(fidl_fuchsia_ebpf__common::ProgramId, D)
5194                });
5195                fidl::decode!(
5196                    fidl_fuchsia_ebpf__common::ProgramId,
5197                    D,
5198                    val_ref,
5199                    decoder,
5200                    inner_offset,
5201                    inner_depth
5202                )?;
5203                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5204                {
5205                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5206                }
5207                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5208                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5209                }
5210            }
5211
5212            next_offset += envelope_size;
5213
5214            // Decode the remaining unknown envelopes.
5215            while next_offset < end_offset {
5216                _next_ordinal_to_read += 1;
5217                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5218                next_offset += envelope_size;
5219            }
5220
5221            Ok(())
5222        }
5223    }
5224
5225    impl Namespace {
5226        #[inline(always)]
5227        fn max_ordinal_present(&self) -> u64 {
5228            if let Some(_) = self.domain {
5229                return 2;
5230            }
5231            if let Some(_) = self.id {
5232                return 1;
5233            }
5234            0
5235        }
5236    }
5237
5238    impl fidl::encoding::ValueTypeMarker for Namespace {
5239        type Borrowed<'a> = &'a Self;
5240        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5241            value
5242        }
5243    }
5244
5245    unsafe impl fidl::encoding::TypeMarker for Namespace {
5246        type Owned = Self;
5247
5248        #[inline(always)]
5249        fn inline_align(_context: fidl::encoding::Context) -> usize {
5250            8
5251        }
5252
5253        #[inline(always)]
5254        fn inline_size(_context: fidl::encoding::Context) -> usize {
5255            16
5256        }
5257    }
5258
5259    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Namespace, D>
5260        for &Namespace
5261    {
5262        unsafe fn encode(
5263            self,
5264            encoder: &mut fidl::encoding::Encoder<'_, D>,
5265            offset: usize,
5266            mut depth: fidl::encoding::Depth,
5267        ) -> fidl::Result<()> {
5268            encoder.debug_check_bounds::<Namespace>(offset);
5269            // Vector header
5270            let max_ordinal: u64 = self.max_ordinal_present();
5271            encoder.write_num(max_ordinal, offset);
5272            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5273            // Calling encoder.out_of_line_offset(0) is not allowed.
5274            if max_ordinal == 0 {
5275                return Ok(());
5276            }
5277            depth.increment()?;
5278            let envelope_size = 8;
5279            let bytes_len = max_ordinal as usize * envelope_size;
5280            #[allow(unused_variables)]
5281            let offset = encoder.out_of_line_offset(bytes_len);
5282            let mut _prev_end_offset: usize = 0;
5283            if 1 > max_ordinal {
5284                return Ok(());
5285            }
5286
5287            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5288            // are envelope_size bytes.
5289            let cur_offset: usize = (1 - 1) * envelope_size;
5290
5291            // Zero reserved fields.
5292            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5293
5294            // Safety:
5295            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5296            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5297            //   envelope_size bytes, there is always sufficient room.
5298            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>, D>(
5299                self.id.as_ref().map(
5300                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
5301                ),
5302                encoder,
5303                offset + cur_offset,
5304                depth,
5305            )?;
5306
5307            _prev_end_offset = cur_offset + envelope_size;
5308            if 2 > max_ordinal {
5309                return Ok(());
5310            }
5311
5312            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5313            // are envelope_size bytes.
5314            let cur_offset: usize = (2 - 1) * envelope_size;
5315
5316            // Zero reserved fields.
5317            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5318
5319            // Safety:
5320            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5321            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5322            //   envelope_size bytes, there is always sufficient room.
5323            fidl::encoding::encode_in_envelope_optional::<Domain, D>(
5324                self.domain.as_ref().map(<Domain as fidl::encoding::ValueTypeMarker>::borrow),
5325                encoder,
5326                offset + cur_offset,
5327                depth,
5328            )?;
5329
5330            _prev_end_offset = cur_offset + envelope_size;
5331
5332            Ok(())
5333        }
5334    }
5335
5336    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Namespace {
5337        #[inline(always)]
5338        fn new_empty() -> Self {
5339            Self::default()
5340        }
5341
5342        unsafe fn decode(
5343            &mut self,
5344            decoder: &mut fidl::encoding::Decoder<'_, D>,
5345            offset: usize,
5346            mut depth: fidl::encoding::Depth,
5347        ) -> fidl::Result<()> {
5348            decoder.debug_check_bounds::<Self>(offset);
5349            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5350                None => return Err(fidl::Error::NotNullable),
5351                Some(len) => len,
5352            };
5353            // Calling decoder.out_of_line_offset(0) is not allowed.
5354            if len == 0 {
5355                return Ok(());
5356            };
5357            depth.increment()?;
5358            let envelope_size = 8;
5359            let bytes_len = len * envelope_size;
5360            let offset = decoder.out_of_line_offset(bytes_len)?;
5361            // Decode the envelope for each type.
5362            let mut _next_ordinal_to_read = 0;
5363            let mut next_offset = offset;
5364            let end_offset = offset + bytes_len;
5365            _next_ordinal_to_read += 1;
5366            if next_offset >= end_offset {
5367                return Ok(());
5368            }
5369
5370            // Decode unknown envelopes for gaps in ordinals.
5371            while _next_ordinal_to_read < 1 {
5372                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5373                _next_ordinal_to_read += 1;
5374                next_offset += envelope_size;
5375            }
5376
5377            let next_out_of_line = decoder.next_out_of_line();
5378            let handles_before = decoder.remaining_handles();
5379            if let Some((inlined, num_bytes, num_handles)) =
5380                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5381            {
5382                let member_inline_size =
5383                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
5384                        decoder.context,
5385                    );
5386                if inlined != (member_inline_size <= 4) {
5387                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5388                }
5389                let inner_offset;
5390                let mut inner_depth = depth.clone();
5391                if inlined {
5392                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5393                    inner_offset = next_offset;
5394                } else {
5395                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5396                    inner_depth.increment()?;
5397                }
5398                let val_ref = self
5399                    .id
5400                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>, D));
5401                fidl::decode!(
5402                    fidl::encoding::BoundedString<255>,
5403                    D,
5404                    val_ref,
5405                    decoder,
5406                    inner_offset,
5407                    inner_depth
5408                )?;
5409                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5410                {
5411                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5412                }
5413                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5414                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5415                }
5416            }
5417
5418            next_offset += envelope_size;
5419            _next_ordinal_to_read += 1;
5420            if next_offset >= end_offset {
5421                return Ok(());
5422            }
5423
5424            // Decode unknown envelopes for gaps in ordinals.
5425            while _next_ordinal_to_read < 2 {
5426                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5427                _next_ordinal_to_read += 1;
5428                next_offset += envelope_size;
5429            }
5430
5431            let next_out_of_line = decoder.next_out_of_line();
5432            let handles_before = decoder.remaining_handles();
5433            if let Some((inlined, num_bytes, num_handles)) =
5434                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5435            {
5436                let member_inline_size =
5437                    <Domain as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5438                if inlined != (member_inline_size <= 4) {
5439                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5440                }
5441                let inner_offset;
5442                let mut inner_depth = depth.clone();
5443                if inlined {
5444                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5445                    inner_offset = next_offset;
5446                } else {
5447                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5448                    inner_depth.increment()?;
5449                }
5450                let val_ref = self.domain.get_or_insert_with(|| fidl::new_empty!(Domain, D));
5451                fidl::decode!(Domain, D, val_ref, decoder, inner_offset, inner_depth)?;
5452                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5453                {
5454                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5455                }
5456                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5457                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5458                }
5459            }
5460
5461            next_offset += envelope_size;
5462
5463            // Decode the remaining unknown envelopes.
5464            while next_offset < end_offset {
5465                _next_ordinal_to_read += 1;
5466                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5467                next_offset += envelope_size;
5468            }
5469
5470            Ok(())
5471        }
5472    }
5473
5474    impl NatRoutine {
5475        #[inline(always)]
5476        fn max_ordinal_present(&self) -> u64 {
5477            if let Some(_) = self.installation {
5478                return 1;
5479            }
5480            0
5481        }
5482    }
5483
5484    impl fidl::encoding::ValueTypeMarker for NatRoutine {
5485        type Borrowed<'a> = &'a Self;
5486        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5487            value
5488        }
5489    }
5490
5491    unsafe impl fidl::encoding::TypeMarker for NatRoutine {
5492        type Owned = Self;
5493
5494        #[inline(always)]
5495        fn inline_align(_context: fidl::encoding::Context) -> usize {
5496            8
5497        }
5498
5499        #[inline(always)]
5500        fn inline_size(_context: fidl::encoding::Context) -> usize {
5501            16
5502        }
5503    }
5504
5505    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NatRoutine, D>
5506        for &NatRoutine
5507    {
5508        unsafe fn encode(
5509            self,
5510            encoder: &mut fidl::encoding::Encoder<'_, D>,
5511            offset: usize,
5512            mut depth: fidl::encoding::Depth,
5513        ) -> fidl::Result<()> {
5514            encoder.debug_check_bounds::<NatRoutine>(offset);
5515            // Vector header
5516            let max_ordinal: u64 = self.max_ordinal_present();
5517            encoder.write_num(max_ordinal, offset);
5518            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5519            // Calling encoder.out_of_line_offset(0) is not allowed.
5520            if max_ordinal == 0 {
5521                return Ok(());
5522            }
5523            depth.increment()?;
5524            let envelope_size = 8;
5525            let bytes_len = max_ordinal as usize * envelope_size;
5526            #[allow(unused_variables)]
5527            let offset = encoder.out_of_line_offset(bytes_len);
5528            let mut _prev_end_offset: usize = 0;
5529            if 1 > max_ordinal {
5530                return Ok(());
5531            }
5532
5533            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5534            // are envelope_size bytes.
5535            let cur_offset: usize = (1 - 1) * envelope_size;
5536
5537            // Zero reserved fields.
5538            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5539
5540            // Safety:
5541            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5542            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5543            //   envelope_size bytes, there is always sufficient room.
5544            fidl::encoding::encode_in_envelope_optional::<InstalledNatRoutine, D>(
5545                self.installation
5546                    .as_ref()
5547                    .map(<InstalledNatRoutine as fidl::encoding::ValueTypeMarker>::borrow),
5548                encoder,
5549                offset + cur_offset,
5550                depth,
5551            )?;
5552
5553            _prev_end_offset = cur_offset + envelope_size;
5554
5555            Ok(())
5556        }
5557    }
5558
5559    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NatRoutine {
5560        #[inline(always)]
5561        fn new_empty() -> Self {
5562            Self::default()
5563        }
5564
5565        unsafe fn decode(
5566            &mut self,
5567            decoder: &mut fidl::encoding::Decoder<'_, D>,
5568            offset: usize,
5569            mut depth: fidl::encoding::Depth,
5570        ) -> fidl::Result<()> {
5571            decoder.debug_check_bounds::<Self>(offset);
5572            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5573                None => return Err(fidl::Error::NotNullable),
5574                Some(len) => len,
5575            };
5576            // Calling decoder.out_of_line_offset(0) is not allowed.
5577            if len == 0 {
5578                return Ok(());
5579            };
5580            depth.increment()?;
5581            let envelope_size = 8;
5582            let bytes_len = len * envelope_size;
5583            let offset = decoder.out_of_line_offset(bytes_len)?;
5584            // Decode the envelope for each type.
5585            let mut _next_ordinal_to_read = 0;
5586            let mut next_offset = offset;
5587            let end_offset = offset + bytes_len;
5588            _next_ordinal_to_read += 1;
5589            if next_offset >= end_offset {
5590                return Ok(());
5591            }
5592
5593            // Decode unknown envelopes for gaps in ordinals.
5594            while _next_ordinal_to_read < 1 {
5595                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5596                _next_ordinal_to_read += 1;
5597                next_offset += envelope_size;
5598            }
5599
5600            let next_out_of_line = decoder.next_out_of_line();
5601            let handles_before = decoder.remaining_handles();
5602            if let Some((inlined, num_bytes, num_handles)) =
5603                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5604            {
5605                let member_inline_size =
5606                    <InstalledNatRoutine as fidl::encoding::TypeMarker>::inline_size(
5607                        decoder.context,
5608                    );
5609                if inlined != (member_inline_size <= 4) {
5610                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5611                }
5612                let inner_offset;
5613                let mut inner_depth = depth.clone();
5614                if inlined {
5615                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5616                    inner_offset = next_offset;
5617                } else {
5618                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5619                    inner_depth.increment()?;
5620                }
5621                let val_ref = self
5622                    .installation
5623                    .get_or_insert_with(|| fidl::new_empty!(InstalledNatRoutine, D));
5624                fidl::decode!(InstalledNatRoutine, D, val_ref, decoder, inner_offset, inner_depth)?;
5625                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5626                {
5627                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5628                }
5629                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5630                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5631                }
5632            }
5633
5634            next_offset += envelope_size;
5635
5636            // Decode the remaining unknown envelopes.
5637            while next_offset < end_offset {
5638                _next_ordinal_to_read += 1;
5639                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5640                next_offset += envelope_size;
5641            }
5642
5643            Ok(())
5644        }
5645    }
5646
5647    impl Redirect {
5648        #[inline(always)]
5649        fn max_ordinal_present(&self) -> u64 {
5650            if let Some(_) = self.dst_port {
5651                return 1;
5652            }
5653            0
5654        }
5655    }
5656
5657    impl fidl::encoding::ValueTypeMarker for Redirect {
5658        type Borrowed<'a> = &'a Self;
5659        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5660            value
5661        }
5662    }
5663
5664    unsafe impl fidl::encoding::TypeMarker for Redirect {
5665        type Owned = Self;
5666
5667        #[inline(always)]
5668        fn inline_align(_context: fidl::encoding::Context) -> usize {
5669            8
5670        }
5671
5672        #[inline(always)]
5673        fn inline_size(_context: fidl::encoding::Context) -> usize {
5674            16
5675        }
5676    }
5677
5678    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Redirect, D> for &Redirect {
5679        unsafe fn encode(
5680            self,
5681            encoder: &mut fidl::encoding::Encoder<'_, D>,
5682            offset: usize,
5683            mut depth: fidl::encoding::Depth,
5684        ) -> fidl::Result<()> {
5685            encoder.debug_check_bounds::<Redirect>(offset);
5686            // Vector header
5687            let max_ordinal: u64 = self.max_ordinal_present();
5688            encoder.write_num(max_ordinal, offset);
5689            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5690            // Calling encoder.out_of_line_offset(0) is not allowed.
5691            if max_ordinal == 0 {
5692                return Ok(());
5693            }
5694            depth.increment()?;
5695            let envelope_size = 8;
5696            let bytes_len = max_ordinal as usize * envelope_size;
5697            #[allow(unused_variables)]
5698            let offset = encoder.out_of_line_offset(bytes_len);
5699            let mut _prev_end_offset: usize = 0;
5700            if 1 > max_ordinal {
5701                return Ok(());
5702            }
5703
5704            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5705            // are envelope_size bytes.
5706            let cur_offset: usize = (1 - 1) * envelope_size;
5707
5708            // Zero reserved fields.
5709            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5710
5711            // Safety:
5712            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5713            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5714            //   envelope_size bytes, there is always sufficient room.
5715            fidl::encoding::encode_in_envelope_optional::<PortRange, D>(
5716                self.dst_port.as_ref().map(<PortRange as fidl::encoding::ValueTypeMarker>::borrow),
5717                encoder,
5718                offset + cur_offset,
5719                depth,
5720            )?;
5721
5722            _prev_end_offset = cur_offset + envelope_size;
5723
5724            Ok(())
5725        }
5726    }
5727
5728    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Redirect {
5729        #[inline(always)]
5730        fn new_empty() -> Self {
5731            Self::default()
5732        }
5733
5734        unsafe fn decode(
5735            &mut self,
5736            decoder: &mut fidl::encoding::Decoder<'_, D>,
5737            offset: usize,
5738            mut depth: fidl::encoding::Depth,
5739        ) -> fidl::Result<()> {
5740            decoder.debug_check_bounds::<Self>(offset);
5741            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5742                None => return Err(fidl::Error::NotNullable),
5743                Some(len) => len,
5744            };
5745            // Calling decoder.out_of_line_offset(0) is not allowed.
5746            if len == 0 {
5747                return Ok(());
5748            };
5749            depth.increment()?;
5750            let envelope_size = 8;
5751            let bytes_len = len * envelope_size;
5752            let offset = decoder.out_of_line_offset(bytes_len)?;
5753            // Decode the envelope for each type.
5754            let mut _next_ordinal_to_read = 0;
5755            let mut next_offset = offset;
5756            let end_offset = offset + bytes_len;
5757            _next_ordinal_to_read += 1;
5758            if next_offset >= end_offset {
5759                return Ok(());
5760            }
5761
5762            // Decode unknown envelopes for gaps in ordinals.
5763            while _next_ordinal_to_read < 1 {
5764                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5765                _next_ordinal_to_read += 1;
5766                next_offset += envelope_size;
5767            }
5768
5769            let next_out_of_line = decoder.next_out_of_line();
5770            let handles_before = decoder.remaining_handles();
5771            if let Some((inlined, num_bytes, num_handles)) =
5772                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5773            {
5774                let member_inline_size =
5775                    <PortRange as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5776                if inlined != (member_inline_size <= 4) {
5777                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5778                }
5779                let inner_offset;
5780                let mut inner_depth = depth.clone();
5781                if inlined {
5782                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5783                    inner_offset = next_offset;
5784                } else {
5785                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5786                    inner_depth.increment()?;
5787                }
5788                let val_ref = self.dst_port.get_or_insert_with(|| fidl::new_empty!(PortRange, D));
5789                fidl::decode!(PortRange, D, val_ref, decoder, inner_offset, inner_depth)?;
5790                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5791                {
5792                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5793                }
5794                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5795                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5796                }
5797            }
5798
5799            next_offset += envelope_size;
5800
5801            // Decode the remaining unknown envelopes.
5802            while next_offset < end_offset {
5803                _next_ordinal_to_read += 1;
5804                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5805                next_offset += envelope_size;
5806            }
5807
5808            Ok(())
5809        }
5810    }
5811
5812    impl Routine {
5813        #[inline(always)]
5814        fn max_ordinal_present(&self) -> u64 {
5815            if let Some(_) = self.type_ {
5816                return 2;
5817            }
5818            if let Some(_) = self.id {
5819                return 1;
5820            }
5821            0
5822        }
5823    }
5824
5825    impl fidl::encoding::ValueTypeMarker for Routine {
5826        type Borrowed<'a> = &'a Self;
5827        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5828            value
5829        }
5830    }
5831
5832    unsafe impl fidl::encoding::TypeMarker for Routine {
5833        type Owned = Self;
5834
5835        #[inline(always)]
5836        fn inline_align(_context: fidl::encoding::Context) -> usize {
5837            8
5838        }
5839
5840        #[inline(always)]
5841        fn inline_size(_context: fidl::encoding::Context) -> usize {
5842            16
5843        }
5844    }
5845
5846    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Routine, D> for &Routine {
5847        unsafe fn encode(
5848            self,
5849            encoder: &mut fidl::encoding::Encoder<'_, D>,
5850            offset: usize,
5851            mut depth: fidl::encoding::Depth,
5852        ) -> fidl::Result<()> {
5853            encoder.debug_check_bounds::<Routine>(offset);
5854            // Vector header
5855            let max_ordinal: u64 = self.max_ordinal_present();
5856            encoder.write_num(max_ordinal, offset);
5857            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5858            // Calling encoder.out_of_line_offset(0) is not allowed.
5859            if max_ordinal == 0 {
5860                return Ok(());
5861            }
5862            depth.increment()?;
5863            let envelope_size = 8;
5864            let bytes_len = max_ordinal as usize * envelope_size;
5865            #[allow(unused_variables)]
5866            let offset = encoder.out_of_line_offset(bytes_len);
5867            let mut _prev_end_offset: usize = 0;
5868            if 1 > max_ordinal {
5869                return Ok(());
5870            }
5871
5872            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5873            // are envelope_size bytes.
5874            let cur_offset: usize = (1 - 1) * envelope_size;
5875
5876            // Zero reserved fields.
5877            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5878
5879            // Safety:
5880            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5881            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5882            //   envelope_size bytes, there is always sufficient room.
5883            fidl::encoding::encode_in_envelope_optional::<RoutineId, D>(
5884                self.id.as_ref().map(<RoutineId as fidl::encoding::ValueTypeMarker>::borrow),
5885                encoder,
5886                offset + cur_offset,
5887                depth,
5888            )?;
5889
5890            _prev_end_offset = cur_offset + envelope_size;
5891            if 2 > max_ordinal {
5892                return Ok(());
5893            }
5894
5895            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5896            // are envelope_size bytes.
5897            let cur_offset: usize = (2 - 1) * envelope_size;
5898
5899            // Zero reserved fields.
5900            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5901
5902            // Safety:
5903            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5904            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5905            //   envelope_size bytes, there is always sufficient room.
5906            fidl::encoding::encode_in_envelope_optional::<RoutineType, D>(
5907                self.type_.as_ref().map(<RoutineType as fidl::encoding::ValueTypeMarker>::borrow),
5908                encoder,
5909                offset + cur_offset,
5910                depth,
5911            )?;
5912
5913            _prev_end_offset = cur_offset + envelope_size;
5914
5915            Ok(())
5916        }
5917    }
5918
5919    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Routine {
5920        #[inline(always)]
5921        fn new_empty() -> Self {
5922            Self::default()
5923        }
5924
5925        unsafe fn decode(
5926            &mut self,
5927            decoder: &mut fidl::encoding::Decoder<'_, D>,
5928            offset: usize,
5929            mut depth: fidl::encoding::Depth,
5930        ) -> fidl::Result<()> {
5931            decoder.debug_check_bounds::<Self>(offset);
5932            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5933                None => return Err(fidl::Error::NotNullable),
5934                Some(len) => len,
5935            };
5936            // Calling decoder.out_of_line_offset(0) is not allowed.
5937            if len == 0 {
5938                return Ok(());
5939            };
5940            depth.increment()?;
5941            let envelope_size = 8;
5942            let bytes_len = len * envelope_size;
5943            let offset = decoder.out_of_line_offset(bytes_len)?;
5944            // Decode the envelope for each type.
5945            let mut _next_ordinal_to_read = 0;
5946            let mut next_offset = offset;
5947            let end_offset = offset + bytes_len;
5948            _next_ordinal_to_read += 1;
5949            if next_offset >= end_offset {
5950                return Ok(());
5951            }
5952
5953            // Decode unknown envelopes for gaps in ordinals.
5954            while _next_ordinal_to_read < 1 {
5955                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5956                _next_ordinal_to_read += 1;
5957                next_offset += envelope_size;
5958            }
5959
5960            let next_out_of_line = decoder.next_out_of_line();
5961            let handles_before = decoder.remaining_handles();
5962            if let Some((inlined, num_bytes, num_handles)) =
5963                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5964            {
5965                let member_inline_size =
5966                    <RoutineId as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5967                if inlined != (member_inline_size <= 4) {
5968                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5969                }
5970                let inner_offset;
5971                let mut inner_depth = depth.clone();
5972                if inlined {
5973                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5974                    inner_offset = next_offset;
5975                } else {
5976                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5977                    inner_depth.increment()?;
5978                }
5979                let val_ref = self.id.get_or_insert_with(|| fidl::new_empty!(RoutineId, D));
5980                fidl::decode!(RoutineId, D, val_ref, decoder, inner_offset, inner_depth)?;
5981                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5982                {
5983                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5984                }
5985                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5986                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5987                }
5988            }
5989
5990            next_offset += envelope_size;
5991            _next_ordinal_to_read += 1;
5992            if next_offset >= end_offset {
5993                return Ok(());
5994            }
5995
5996            // Decode unknown envelopes for gaps in ordinals.
5997            while _next_ordinal_to_read < 2 {
5998                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5999                _next_ordinal_to_read += 1;
6000                next_offset += envelope_size;
6001            }
6002
6003            let next_out_of_line = decoder.next_out_of_line();
6004            let handles_before = decoder.remaining_handles();
6005            if let Some((inlined, num_bytes, num_handles)) =
6006                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6007            {
6008                let member_inline_size =
6009                    <RoutineType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6010                if inlined != (member_inline_size <= 4) {
6011                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6012                }
6013                let inner_offset;
6014                let mut inner_depth = depth.clone();
6015                if inlined {
6016                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6017                    inner_offset = next_offset;
6018                } else {
6019                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6020                    inner_depth.increment()?;
6021                }
6022                let val_ref = self.type_.get_or_insert_with(|| fidl::new_empty!(RoutineType, D));
6023                fidl::decode!(RoutineType, D, val_ref, decoder, inner_offset, inner_depth)?;
6024                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6025                {
6026                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6027                }
6028                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6029                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6030                }
6031            }
6032
6033            next_offset += envelope_size;
6034
6035            // Decode the remaining unknown envelopes.
6036            while next_offset < end_offset {
6037                _next_ordinal_to_read += 1;
6038                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6039                next_offset += envelope_size;
6040            }
6041
6042            Ok(())
6043        }
6044    }
6045
6046    impl WatcherOptions {
6047        #[inline(always)]
6048        fn max_ordinal_present(&self) -> u64 {
6049            0
6050        }
6051    }
6052
6053    impl fidl::encoding::ValueTypeMarker for WatcherOptions {
6054        type Borrowed<'a> = &'a Self;
6055        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6056            value
6057        }
6058    }
6059
6060    unsafe impl fidl::encoding::TypeMarker for WatcherOptions {
6061        type Owned = Self;
6062
6063        #[inline(always)]
6064        fn inline_align(_context: fidl::encoding::Context) -> usize {
6065            8
6066        }
6067
6068        #[inline(always)]
6069        fn inline_size(_context: fidl::encoding::Context) -> usize {
6070            16
6071        }
6072    }
6073
6074    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WatcherOptions, D>
6075        for &WatcherOptions
6076    {
6077        unsafe fn encode(
6078            self,
6079            encoder: &mut fidl::encoding::Encoder<'_, D>,
6080            offset: usize,
6081            mut depth: fidl::encoding::Depth,
6082        ) -> fidl::Result<()> {
6083            encoder.debug_check_bounds::<WatcherOptions>(offset);
6084            // Vector header
6085            let max_ordinal: u64 = self.max_ordinal_present();
6086            encoder.write_num(max_ordinal, offset);
6087            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6088            // Calling encoder.out_of_line_offset(0) is not allowed.
6089            if max_ordinal == 0 {
6090                return Ok(());
6091            }
6092            depth.increment()?;
6093            let envelope_size = 8;
6094            let bytes_len = max_ordinal as usize * envelope_size;
6095            #[allow(unused_variables)]
6096            let offset = encoder.out_of_line_offset(bytes_len);
6097            let mut _prev_end_offset: usize = 0;
6098
6099            Ok(())
6100        }
6101    }
6102
6103    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WatcherOptions {
6104        #[inline(always)]
6105        fn new_empty() -> Self {
6106            Self::default()
6107        }
6108
6109        unsafe fn decode(
6110            &mut self,
6111            decoder: &mut fidl::encoding::Decoder<'_, D>,
6112            offset: usize,
6113            mut depth: fidl::encoding::Depth,
6114        ) -> fidl::Result<()> {
6115            decoder.debug_check_bounds::<Self>(offset);
6116            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6117                None => return Err(fidl::Error::NotNullable),
6118                Some(len) => len,
6119            };
6120            // Calling decoder.out_of_line_offset(0) is not allowed.
6121            if len == 0 {
6122                return Ok(());
6123            };
6124            depth.increment()?;
6125            let envelope_size = 8;
6126            let bytes_len = len * envelope_size;
6127            let offset = decoder.out_of_line_offset(bytes_len)?;
6128            // Decode the envelope for each type.
6129            let mut _next_ordinal_to_read = 0;
6130            let mut next_offset = offset;
6131            let end_offset = offset + bytes_len;
6132
6133            // Decode the remaining unknown envelopes.
6134            while next_offset < end_offset {
6135                _next_ordinal_to_read += 1;
6136                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6137                next_offset += envelope_size;
6138            }
6139
6140            Ok(())
6141        }
6142    }
6143
6144    impl fidl::encoding::ValueTypeMarker for Action {
6145        type Borrowed<'a> = &'a Self;
6146        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6147            value
6148        }
6149    }
6150
6151    unsafe impl fidl::encoding::TypeMarker for Action {
6152        type Owned = Self;
6153
6154        #[inline(always)]
6155        fn inline_align(_context: fidl::encoding::Context) -> usize {
6156            8
6157        }
6158
6159        #[inline(always)]
6160        fn inline_size(_context: fidl::encoding::Context) -> usize {
6161            16
6162        }
6163    }
6164
6165    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Action, D> for &Action {
6166        #[inline]
6167        unsafe fn encode(
6168            self,
6169            encoder: &mut fidl::encoding::Encoder<'_, D>,
6170            offset: usize,
6171            _depth: fidl::encoding::Depth,
6172        ) -> fidl::Result<()> {
6173            encoder.debug_check_bounds::<Action>(offset);
6174            encoder.write_num::<u64>(self.ordinal(), offset);
6175            match self {
6176                Action::Accept(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
6177                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
6178                    encoder,
6179                    offset + 8,
6180                    _depth,
6181                ),
6182                Action::Drop(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
6183                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
6184                    encoder,
6185                    offset + 8,
6186                    _depth,
6187                ),
6188                Action::Jump(ref val) => fidl::encoding::encode_in_envelope::<
6189                    fidl::encoding::BoundedString<255>,
6190                    D,
6191                >(
6192                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
6193                        val,
6194                    ),
6195                    encoder,
6196                    offset + 8,
6197                    _depth,
6198                ),
6199                Action::Return_(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
6200                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
6201                    encoder,
6202                    offset + 8,
6203                    _depth,
6204                ),
6205                Action::TransparentProxy(ref val) => {
6206                    fidl::encoding::encode_in_envelope::<TransparentProxy_, D>(
6207                        <TransparentProxy_ as fidl::encoding::ValueTypeMarker>::borrow(val),
6208                        encoder,
6209                        offset + 8,
6210                        _depth,
6211                    )
6212                }
6213                Action::Redirect(ref val) => fidl::encoding::encode_in_envelope::<Redirect, D>(
6214                    <Redirect as fidl::encoding::ValueTypeMarker>::borrow(val),
6215                    encoder,
6216                    offset + 8,
6217                    _depth,
6218                ),
6219                Action::Masquerade(ref val) => fidl::encoding::encode_in_envelope::<Masquerade, D>(
6220                    <Masquerade as fidl::encoding::ValueTypeMarker>::borrow(val),
6221                    encoder,
6222                    offset + 8,
6223                    _depth,
6224                ),
6225                Action::Mark(ref val) => fidl::encoding::encode_in_envelope::<Mark, D>(
6226                    <Mark as fidl::encoding::ValueTypeMarker>::borrow(val),
6227                    encoder,
6228                    offset + 8,
6229                    _depth,
6230                ),
6231                Action::None(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
6232                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
6233                    encoder,
6234                    offset + 8,
6235                    _depth,
6236                ),
6237                Action::Reject(ref val) => fidl::encoding::encode_in_envelope::<Reject, D>(
6238                    <Reject as fidl::encoding::ValueTypeMarker>::borrow(val),
6239                    encoder,
6240                    offset + 8,
6241                    _depth,
6242                ),
6243                Action::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
6244            }
6245        }
6246    }
6247
6248    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Action {
6249        #[inline(always)]
6250        fn new_empty() -> Self {
6251            Self::__SourceBreaking { unknown_ordinal: 0 }
6252        }
6253
6254        #[inline]
6255        unsafe fn decode(
6256            &mut self,
6257            decoder: &mut fidl::encoding::Decoder<'_, D>,
6258            offset: usize,
6259            mut depth: fidl::encoding::Depth,
6260        ) -> fidl::Result<()> {
6261            decoder.debug_check_bounds::<Self>(offset);
6262            #[allow(unused_variables)]
6263            let next_out_of_line = decoder.next_out_of_line();
6264            let handles_before = decoder.remaining_handles();
6265            let (ordinal, inlined, num_bytes, num_handles) =
6266                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
6267
6268            let member_inline_size = match ordinal {
6269                1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6270                2 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6271                3 => {
6272                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
6273                        decoder.context,
6274                    )
6275                }
6276                4 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6277                5 => {
6278                    <TransparentProxy_ as fidl::encoding::TypeMarker>::inline_size(decoder.context)
6279                }
6280                6 => <Redirect as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6281                7 => <Masquerade as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6282                8 => <Mark as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6283                9 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6284                10 => <Reject as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6285                0 => return Err(fidl::Error::UnknownUnionTag),
6286                _ => num_bytes as usize,
6287            };
6288
6289            if inlined != (member_inline_size <= 4) {
6290                return Err(fidl::Error::InvalidInlineBitInEnvelope);
6291            }
6292            let _inner_offset;
6293            if inlined {
6294                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
6295                _inner_offset = offset + 8;
6296            } else {
6297                depth.increment()?;
6298                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6299            }
6300            match ordinal {
6301                1 => {
6302                    #[allow(irrefutable_let_patterns)]
6303                    if let Action::Accept(_) = self {
6304                        // Do nothing, read the value into the object
6305                    } else {
6306                        // Initialize `self` to the right variant
6307                        *self = Action::Accept(fidl::new_empty!(Empty, D));
6308                    }
6309                    #[allow(irrefutable_let_patterns)]
6310                    if let Action::Accept(ref mut val) = self {
6311                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
6312                    } else {
6313                        unreachable!()
6314                    }
6315                }
6316                2 => {
6317                    #[allow(irrefutable_let_patterns)]
6318                    if let Action::Drop(_) = self {
6319                        // Do nothing, read the value into the object
6320                    } else {
6321                        // Initialize `self` to the right variant
6322                        *self = Action::Drop(fidl::new_empty!(Empty, D));
6323                    }
6324                    #[allow(irrefutable_let_patterns)]
6325                    if let Action::Drop(ref mut val) = self {
6326                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
6327                    } else {
6328                        unreachable!()
6329                    }
6330                }
6331                3 => {
6332                    #[allow(irrefutable_let_patterns)]
6333                    if let Action::Jump(_) = self {
6334                        // Do nothing, read the value into the object
6335                    } else {
6336                        // Initialize `self` to the right variant
6337                        *self =
6338                            Action::Jump(fidl::new_empty!(fidl::encoding::BoundedString<255>, D));
6339                    }
6340                    #[allow(irrefutable_let_patterns)]
6341                    if let Action::Jump(ref mut val) = self {
6342                        fidl::decode!(
6343                            fidl::encoding::BoundedString<255>,
6344                            D,
6345                            val,
6346                            decoder,
6347                            _inner_offset,
6348                            depth
6349                        )?;
6350                    } else {
6351                        unreachable!()
6352                    }
6353                }
6354                4 => {
6355                    #[allow(irrefutable_let_patterns)]
6356                    if let Action::Return_(_) = self {
6357                        // Do nothing, read the value into the object
6358                    } else {
6359                        // Initialize `self` to the right variant
6360                        *self = Action::Return_(fidl::new_empty!(Empty, D));
6361                    }
6362                    #[allow(irrefutable_let_patterns)]
6363                    if let Action::Return_(ref mut val) = self {
6364                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
6365                    } else {
6366                        unreachable!()
6367                    }
6368                }
6369                5 => {
6370                    #[allow(irrefutable_let_patterns)]
6371                    if let Action::TransparentProxy(_) = self {
6372                        // Do nothing, read the value into the object
6373                    } else {
6374                        // Initialize `self` to the right variant
6375                        *self = Action::TransparentProxy(fidl::new_empty!(TransparentProxy_, D));
6376                    }
6377                    #[allow(irrefutable_let_patterns)]
6378                    if let Action::TransparentProxy(ref mut val) = self {
6379                        fidl::decode!(TransparentProxy_, D, val, decoder, _inner_offset, depth)?;
6380                    } else {
6381                        unreachable!()
6382                    }
6383                }
6384                6 => {
6385                    #[allow(irrefutable_let_patterns)]
6386                    if let Action::Redirect(_) = self {
6387                        // Do nothing, read the value into the object
6388                    } else {
6389                        // Initialize `self` to the right variant
6390                        *self = Action::Redirect(fidl::new_empty!(Redirect, D));
6391                    }
6392                    #[allow(irrefutable_let_patterns)]
6393                    if let Action::Redirect(ref mut val) = self {
6394                        fidl::decode!(Redirect, D, val, decoder, _inner_offset, depth)?;
6395                    } else {
6396                        unreachable!()
6397                    }
6398                }
6399                7 => {
6400                    #[allow(irrefutable_let_patterns)]
6401                    if let Action::Masquerade(_) = self {
6402                        // Do nothing, read the value into the object
6403                    } else {
6404                        // Initialize `self` to the right variant
6405                        *self = Action::Masquerade(fidl::new_empty!(Masquerade, D));
6406                    }
6407                    #[allow(irrefutable_let_patterns)]
6408                    if let Action::Masquerade(ref mut val) = self {
6409                        fidl::decode!(Masquerade, D, val, decoder, _inner_offset, depth)?;
6410                    } else {
6411                        unreachable!()
6412                    }
6413                }
6414                8 => {
6415                    #[allow(irrefutable_let_patterns)]
6416                    if let Action::Mark(_) = self {
6417                        // Do nothing, read the value into the object
6418                    } else {
6419                        // Initialize `self` to the right variant
6420                        *self = Action::Mark(fidl::new_empty!(Mark, D));
6421                    }
6422                    #[allow(irrefutable_let_patterns)]
6423                    if let Action::Mark(ref mut val) = self {
6424                        fidl::decode!(Mark, D, val, decoder, _inner_offset, depth)?;
6425                    } else {
6426                        unreachable!()
6427                    }
6428                }
6429                9 => {
6430                    #[allow(irrefutable_let_patterns)]
6431                    if let Action::None(_) = self {
6432                        // Do nothing, read the value into the object
6433                    } else {
6434                        // Initialize `self` to the right variant
6435                        *self = Action::None(fidl::new_empty!(Empty, D));
6436                    }
6437                    #[allow(irrefutable_let_patterns)]
6438                    if let Action::None(ref mut val) = self {
6439                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
6440                    } else {
6441                        unreachable!()
6442                    }
6443                }
6444                10 => {
6445                    #[allow(irrefutable_let_patterns)]
6446                    if let Action::Reject(_) = self {
6447                        // Do nothing, read the value into the object
6448                    } else {
6449                        // Initialize `self` to the right variant
6450                        *self = Action::Reject(fidl::new_empty!(Reject, D));
6451                    }
6452                    #[allow(irrefutable_let_patterns)]
6453                    if let Action::Reject(ref mut val) = self {
6454                        fidl::decode!(Reject, D, val, decoder, _inner_offset, depth)?;
6455                    } else {
6456                        unreachable!()
6457                    }
6458                }
6459                #[allow(deprecated)]
6460                ordinal => {
6461                    for _ in 0..num_handles {
6462                        decoder.drop_next_handle()?;
6463                    }
6464                    *self = Action::__SourceBreaking { unknown_ordinal: ordinal };
6465                }
6466            }
6467            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
6468                return Err(fidl::Error::InvalidNumBytesInEnvelope);
6469            }
6470            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6471                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6472            }
6473            Ok(())
6474        }
6475    }
6476
6477    impl fidl::encoding::ValueTypeMarker for Change {
6478        type Borrowed<'a> = &'a Self;
6479        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6480            value
6481        }
6482    }
6483
6484    unsafe impl fidl::encoding::TypeMarker for Change {
6485        type Owned = Self;
6486
6487        #[inline(always)]
6488        fn inline_align(_context: fidl::encoding::Context) -> usize {
6489            8
6490        }
6491
6492        #[inline(always)]
6493        fn inline_size(_context: fidl::encoding::Context) -> usize {
6494            16
6495        }
6496    }
6497
6498    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Change, D> for &Change {
6499        #[inline]
6500        unsafe fn encode(
6501            self,
6502            encoder: &mut fidl::encoding::Encoder<'_, D>,
6503            offset: usize,
6504            _depth: fidl::encoding::Depth,
6505        ) -> fidl::Result<()> {
6506            encoder.debug_check_bounds::<Change>(offset);
6507            encoder.write_num::<u64>(self.ordinal(), offset);
6508            match self {
6509                Change::Create(ref val) => fidl::encoding::encode_in_envelope::<Resource, D>(
6510                    <Resource as fidl::encoding::ValueTypeMarker>::borrow(val),
6511                    encoder,
6512                    offset + 8,
6513                    _depth,
6514                ),
6515                Change::Remove(ref val) => fidl::encoding::encode_in_envelope::<ResourceId, D>(
6516                    <ResourceId as fidl::encoding::ValueTypeMarker>::borrow(val),
6517                    encoder,
6518                    offset + 8,
6519                    _depth,
6520                ),
6521                Change::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
6522            }
6523        }
6524    }
6525
6526    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Change {
6527        #[inline(always)]
6528        fn new_empty() -> Self {
6529            Self::__SourceBreaking { unknown_ordinal: 0 }
6530        }
6531
6532        #[inline]
6533        unsafe fn decode(
6534            &mut self,
6535            decoder: &mut fidl::encoding::Decoder<'_, D>,
6536            offset: usize,
6537            mut depth: fidl::encoding::Depth,
6538        ) -> fidl::Result<()> {
6539            decoder.debug_check_bounds::<Self>(offset);
6540            #[allow(unused_variables)]
6541            let next_out_of_line = decoder.next_out_of_line();
6542            let handles_before = decoder.remaining_handles();
6543            let (ordinal, inlined, num_bytes, num_handles) =
6544                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
6545
6546            let member_inline_size = match ordinal {
6547                1 => <Resource as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6548                2 => <ResourceId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6549                0 => return Err(fidl::Error::UnknownUnionTag),
6550                _ => num_bytes as usize,
6551            };
6552
6553            if inlined != (member_inline_size <= 4) {
6554                return Err(fidl::Error::InvalidInlineBitInEnvelope);
6555            }
6556            let _inner_offset;
6557            if inlined {
6558                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
6559                _inner_offset = offset + 8;
6560            } else {
6561                depth.increment()?;
6562                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6563            }
6564            match ordinal {
6565                1 => {
6566                    #[allow(irrefutable_let_patterns)]
6567                    if let Change::Create(_) = self {
6568                        // Do nothing, read the value into the object
6569                    } else {
6570                        // Initialize `self` to the right variant
6571                        *self = Change::Create(fidl::new_empty!(Resource, D));
6572                    }
6573                    #[allow(irrefutable_let_patterns)]
6574                    if let Change::Create(ref mut val) = self {
6575                        fidl::decode!(Resource, D, val, decoder, _inner_offset, depth)?;
6576                    } else {
6577                        unreachable!()
6578                    }
6579                }
6580                2 => {
6581                    #[allow(irrefutable_let_patterns)]
6582                    if let Change::Remove(_) = self {
6583                        // Do nothing, read the value into the object
6584                    } else {
6585                        // Initialize `self` to the right variant
6586                        *self = Change::Remove(fidl::new_empty!(ResourceId, D));
6587                    }
6588                    #[allow(irrefutable_let_patterns)]
6589                    if let Change::Remove(ref mut val) = self {
6590                        fidl::decode!(ResourceId, D, val, decoder, _inner_offset, depth)?;
6591                    } else {
6592                        unreachable!()
6593                    }
6594                }
6595                #[allow(deprecated)]
6596                ordinal => {
6597                    for _ in 0..num_handles {
6598                        decoder.drop_next_handle()?;
6599                    }
6600                    *self = Change::__SourceBreaking { unknown_ordinal: ordinal };
6601                }
6602            }
6603            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
6604                return Err(fidl::Error::InvalidNumBytesInEnvelope);
6605            }
6606            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6607                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6608            }
6609            Ok(())
6610        }
6611    }
6612
6613    impl fidl::encoding::ValueTypeMarker for Event {
6614        type Borrowed<'a> = &'a Self;
6615        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6616            value
6617        }
6618    }
6619
6620    unsafe impl fidl::encoding::TypeMarker for Event {
6621        type Owned = Self;
6622
6623        #[inline(always)]
6624        fn inline_align(_context: fidl::encoding::Context) -> usize {
6625            8
6626        }
6627
6628        #[inline(always)]
6629        fn inline_size(_context: fidl::encoding::Context) -> usize {
6630            16
6631        }
6632    }
6633
6634    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Event, D> for &Event {
6635        #[inline]
6636        unsafe fn encode(
6637            self,
6638            encoder: &mut fidl::encoding::Encoder<'_, D>,
6639            offset: usize,
6640            _depth: fidl::encoding::Depth,
6641        ) -> fidl::Result<()> {
6642            encoder.debug_check_bounds::<Event>(offset);
6643            encoder.write_num::<u64>(self.ordinal(), offset);
6644            match self {
6645                Event::Existing(ref val) => {
6646                    fidl::encoding::encode_in_envelope::<ExistingResource, D>(
6647                        <ExistingResource as fidl::encoding::ValueTypeMarker>::borrow(val),
6648                        encoder,
6649                        offset + 8,
6650                        _depth,
6651                    )
6652                }
6653                Event::Added(ref val) => fidl::encoding::encode_in_envelope::<AddedResource, D>(
6654                    <AddedResource as fidl::encoding::ValueTypeMarker>::borrow(val),
6655                    encoder,
6656                    offset + 8,
6657                    _depth,
6658                ),
6659                Event::Removed(ref val) => {
6660                    fidl::encoding::encode_in_envelope::<RemovedResource, D>(
6661                        <RemovedResource as fidl::encoding::ValueTypeMarker>::borrow(val),
6662                        encoder,
6663                        offset + 8,
6664                        _depth,
6665                    )
6666                }
6667                Event::Idle(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
6668                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
6669                    encoder,
6670                    offset + 8,
6671                    _depth,
6672                ),
6673                Event::EndOfUpdate(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
6674                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
6675                    encoder,
6676                    offset + 8,
6677                    _depth,
6678                ),
6679                Event::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
6680            }
6681        }
6682    }
6683
6684    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Event {
6685        #[inline(always)]
6686        fn new_empty() -> Self {
6687            Self::__SourceBreaking { unknown_ordinal: 0 }
6688        }
6689
6690        #[inline]
6691        unsafe fn decode(
6692            &mut self,
6693            decoder: &mut fidl::encoding::Decoder<'_, D>,
6694            offset: usize,
6695            mut depth: fidl::encoding::Depth,
6696        ) -> fidl::Result<()> {
6697            decoder.debug_check_bounds::<Self>(offset);
6698            #[allow(unused_variables)]
6699            let next_out_of_line = decoder.next_out_of_line();
6700            let handles_before = decoder.remaining_handles();
6701            let (ordinal, inlined, num_bytes, num_handles) =
6702                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
6703
6704            let member_inline_size = match ordinal {
6705                1 => <ExistingResource as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6706                2 => <AddedResource as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6707                3 => <RemovedResource as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6708                4 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6709                5 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6710                0 => return Err(fidl::Error::UnknownUnionTag),
6711                _ => num_bytes as usize,
6712            };
6713
6714            if inlined != (member_inline_size <= 4) {
6715                return Err(fidl::Error::InvalidInlineBitInEnvelope);
6716            }
6717            let _inner_offset;
6718            if inlined {
6719                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
6720                _inner_offset = offset + 8;
6721            } else {
6722                depth.increment()?;
6723                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6724            }
6725            match ordinal {
6726                1 => {
6727                    #[allow(irrefutable_let_patterns)]
6728                    if let Event::Existing(_) = self {
6729                        // Do nothing, read the value into the object
6730                    } else {
6731                        // Initialize `self` to the right variant
6732                        *self = Event::Existing(fidl::new_empty!(ExistingResource, D));
6733                    }
6734                    #[allow(irrefutable_let_patterns)]
6735                    if let Event::Existing(ref mut val) = self {
6736                        fidl::decode!(ExistingResource, D, val, decoder, _inner_offset, depth)?;
6737                    } else {
6738                        unreachable!()
6739                    }
6740                }
6741                2 => {
6742                    #[allow(irrefutable_let_patterns)]
6743                    if let Event::Added(_) = self {
6744                        // Do nothing, read the value into the object
6745                    } else {
6746                        // Initialize `self` to the right variant
6747                        *self = Event::Added(fidl::new_empty!(AddedResource, D));
6748                    }
6749                    #[allow(irrefutable_let_patterns)]
6750                    if let Event::Added(ref mut val) = self {
6751                        fidl::decode!(AddedResource, D, val, decoder, _inner_offset, depth)?;
6752                    } else {
6753                        unreachable!()
6754                    }
6755                }
6756                3 => {
6757                    #[allow(irrefutable_let_patterns)]
6758                    if let Event::Removed(_) = self {
6759                        // Do nothing, read the value into the object
6760                    } else {
6761                        // Initialize `self` to the right variant
6762                        *self = Event::Removed(fidl::new_empty!(RemovedResource, D));
6763                    }
6764                    #[allow(irrefutable_let_patterns)]
6765                    if let Event::Removed(ref mut val) = self {
6766                        fidl::decode!(RemovedResource, D, val, decoder, _inner_offset, depth)?;
6767                    } else {
6768                        unreachable!()
6769                    }
6770                }
6771                4 => {
6772                    #[allow(irrefutable_let_patterns)]
6773                    if let Event::Idle(_) = self {
6774                        // Do nothing, read the value into the object
6775                    } else {
6776                        // Initialize `self` to the right variant
6777                        *self = Event::Idle(fidl::new_empty!(Empty, D));
6778                    }
6779                    #[allow(irrefutable_let_patterns)]
6780                    if let Event::Idle(ref mut val) = self {
6781                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
6782                    } else {
6783                        unreachable!()
6784                    }
6785                }
6786                5 => {
6787                    #[allow(irrefutable_let_patterns)]
6788                    if let Event::EndOfUpdate(_) = self {
6789                        // Do nothing, read the value into the object
6790                    } else {
6791                        // Initialize `self` to the right variant
6792                        *self = Event::EndOfUpdate(fidl::new_empty!(Empty, D));
6793                    }
6794                    #[allow(irrefutable_let_patterns)]
6795                    if let Event::EndOfUpdate(ref mut val) = self {
6796                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
6797                    } else {
6798                        unreachable!()
6799                    }
6800                }
6801                #[allow(deprecated)]
6802                ordinal => {
6803                    for _ in 0..num_handles {
6804                        decoder.drop_next_handle()?;
6805                    }
6806                    *self = Event::__SourceBreaking { unknown_ordinal: ordinal };
6807                }
6808            }
6809            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
6810                return Err(fidl::Error::InvalidNumBytesInEnvelope);
6811            }
6812            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6813                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6814            }
6815            Ok(())
6816        }
6817    }
6818
6819    impl fidl::encoding::ValueTypeMarker for MarkAction {
6820        type Borrowed<'a> = &'a Self;
6821        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6822            value
6823        }
6824    }
6825
6826    unsafe impl fidl::encoding::TypeMarker for MarkAction {
6827        type Owned = Self;
6828
6829        #[inline(always)]
6830        fn inline_align(_context: fidl::encoding::Context) -> usize {
6831            8
6832        }
6833
6834        #[inline(always)]
6835        fn inline_size(_context: fidl::encoding::Context) -> usize {
6836            16
6837        }
6838    }
6839
6840    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MarkAction, D>
6841        for &MarkAction
6842    {
6843        #[inline]
6844        unsafe fn encode(
6845            self,
6846            encoder: &mut fidl::encoding::Encoder<'_, D>,
6847            offset: usize,
6848            _depth: fidl::encoding::Depth,
6849        ) -> fidl::Result<()> {
6850            encoder.debug_check_bounds::<MarkAction>(offset);
6851            encoder.write_num::<u64>(self.ordinal(), offset);
6852            match self {
6853                MarkAction::SetMark(ref val) => fidl::encoding::encode_in_envelope::<SetMark, D>(
6854                    <SetMark as fidl::encoding::ValueTypeMarker>::borrow(val),
6855                    encoder,
6856                    offset + 8,
6857                    _depth,
6858                ),
6859                MarkAction::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
6860            }
6861        }
6862    }
6863
6864    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MarkAction {
6865        #[inline(always)]
6866        fn new_empty() -> Self {
6867            Self::__SourceBreaking { unknown_ordinal: 0 }
6868        }
6869
6870        #[inline]
6871        unsafe fn decode(
6872            &mut self,
6873            decoder: &mut fidl::encoding::Decoder<'_, D>,
6874            offset: usize,
6875            mut depth: fidl::encoding::Depth,
6876        ) -> fidl::Result<()> {
6877            decoder.debug_check_bounds::<Self>(offset);
6878            #[allow(unused_variables)]
6879            let next_out_of_line = decoder.next_out_of_line();
6880            let handles_before = decoder.remaining_handles();
6881            let (ordinal, inlined, num_bytes, num_handles) =
6882                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
6883
6884            let member_inline_size = match ordinal {
6885                1 => <SetMark as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6886                0 => return Err(fidl::Error::UnknownUnionTag),
6887                _ => num_bytes as usize,
6888            };
6889
6890            if inlined != (member_inline_size <= 4) {
6891                return Err(fidl::Error::InvalidInlineBitInEnvelope);
6892            }
6893            let _inner_offset;
6894            if inlined {
6895                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
6896                _inner_offset = offset + 8;
6897            } else {
6898                depth.increment()?;
6899                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6900            }
6901            match ordinal {
6902                1 => {
6903                    #[allow(irrefutable_let_patterns)]
6904                    if let MarkAction::SetMark(_) = self {
6905                        // Do nothing, read the value into the object
6906                    } else {
6907                        // Initialize `self` to the right variant
6908                        *self = MarkAction::SetMark(fidl::new_empty!(SetMark, D));
6909                    }
6910                    #[allow(irrefutable_let_patterns)]
6911                    if let MarkAction::SetMark(ref mut val) = self {
6912                        fidl::decode!(SetMark, D, val, decoder, _inner_offset, depth)?;
6913                    } else {
6914                        unreachable!()
6915                    }
6916                }
6917                #[allow(deprecated)]
6918                ordinal => {
6919                    for _ in 0..num_handles {
6920                        decoder.drop_next_handle()?;
6921                    }
6922                    *self = MarkAction::__SourceBreaking { unknown_ordinal: ordinal };
6923                }
6924            }
6925            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
6926                return Err(fidl::Error::InvalidNumBytesInEnvelope);
6927            }
6928            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6929                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6930            }
6931            Ok(())
6932        }
6933    }
6934
6935    impl fidl::encoding::ValueTypeMarker for Resource {
6936        type Borrowed<'a> = &'a Self;
6937        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6938            value
6939        }
6940    }
6941
6942    unsafe impl fidl::encoding::TypeMarker for Resource {
6943        type Owned = Self;
6944
6945        #[inline(always)]
6946        fn inline_align(_context: fidl::encoding::Context) -> usize {
6947            8
6948        }
6949
6950        #[inline(always)]
6951        fn inline_size(_context: fidl::encoding::Context) -> usize {
6952            16
6953        }
6954    }
6955
6956    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Resource, D> for &Resource {
6957        #[inline]
6958        unsafe fn encode(
6959            self,
6960            encoder: &mut fidl::encoding::Encoder<'_, D>,
6961            offset: usize,
6962            _depth: fidl::encoding::Depth,
6963        ) -> fidl::Result<()> {
6964            encoder.debug_check_bounds::<Resource>(offset);
6965            encoder.write_num::<u64>(self.ordinal(), offset);
6966            match self {
6967                Resource::Namespace(ref val) => fidl::encoding::encode_in_envelope::<Namespace, D>(
6968                    <Namespace as fidl::encoding::ValueTypeMarker>::borrow(val),
6969                    encoder,
6970                    offset + 8,
6971                    _depth,
6972                ),
6973                Resource::Routine(ref val) => fidl::encoding::encode_in_envelope::<Routine, D>(
6974                    <Routine as fidl::encoding::ValueTypeMarker>::borrow(val),
6975                    encoder,
6976                    offset + 8,
6977                    _depth,
6978                ),
6979                Resource::Rule(ref val) => fidl::encoding::encode_in_envelope::<Rule, D>(
6980                    <Rule as fidl::encoding::ValueTypeMarker>::borrow(val),
6981                    encoder,
6982                    offset + 8,
6983                    _depth,
6984                ),
6985                Resource::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
6986            }
6987        }
6988    }
6989
6990    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Resource {
6991        #[inline(always)]
6992        fn new_empty() -> Self {
6993            Self::__SourceBreaking { unknown_ordinal: 0 }
6994        }
6995
6996        #[inline]
6997        unsafe fn decode(
6998            &mut self,
6999            decoder: &mut fidl::encoding::Decoder<'_, D>,
7000            offset: usize,
7001            mut depth: fidl::encoding::Depth,
7002        ) -> fidl::Result<()> {
7003            decoder.debug_check_bounds::<Self>(offset);
7004            #[allow(unused_variables)]
7005            let next_out_of_line = decoder.next_out_of_line();
7006            let handles_before = decoder.remaining_handles();
7007            let (ordinal, inlined, num_bytes, num_handles) =
7008                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
7009
7010            let member_inline_size = match ordinal {
7011                1 => <Namespace as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7012                2 => <Routine as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7013                3 => <Rule as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7014                0 => return Err(fidl::Error::UnknownUnionTag),
7015                _ => num_bytes as usize,
7016            };
7017
7018            if inlined != (member_inline_size <= 4) {
7019                return Err(fidl::Error::InvalidInlineBitInEnvelope);
7020            }
7021            let _inner_offset;
7022            if inlined {
7023                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
7024                _inner_offset = offset + 8;
7025            } else {
7026                depth.increment()?;
7027                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7028            }
7029            match ordinal {
7030                1 => {
7031                    #[allow(irrefutable_let_patterns)]
7032                    if let Resource::Namespace(_) = self {
7033                        // Do nothing, read the value into the object
7034                    } else {
7035                        // Initialize `self` to the right variant
7036                        *self = Resource::Namespace(fidl::new_empty!(Namespace, D));
7037                    }
7038                    #[allow(irrefutable_let_patterns)]
7039                    if let Resource::Namespace(ref mut val) = self {
7040                        fidl::decode!(Namespace, D, val, decoder, _inner_offset, depth)?;
7041                    } else {
7042                        unreachable!()
7043                    }
7044                }
7045                2 => {
7046                    #[allow(irrefutable_let_patterns)]
7047                    if let Resource::Routine(_) = self {
7048                        // Do nothing, read the value into the object
7049                    } else {
7050                        // Initialize `self` to the right variant
7051                        *self = Resource::Routine(fidl::new_empty!(Routine, D));
7052                    }
7053                    #[allow(irrefutable_let_patterns)]
7054                    if let Resource::Routine(ref mut val) = self {
7055                        fidl::decode!(Routine, D, val, decoder, _inner_offset, depth)?;
7056                    } else {
7057                        unreachable!()
7058                    }
7059                }
7060                3 => {
7061                    #[allow(irrefutable_let_patterns)]
7062                    if let Resource::Rule(_) = self {
7063                        // Do nothing, read the value into the object
7064                    } else {
7065                        // Initialize `self` to the right variant
7066                        *self = Resource::Rule(fidl::new_empty!(Rule, D));
7067                    }
7068                    #[allow(irrefutable_let_patterns)]
7069                    if let Resource::Rule(ref mut val) = self {
7070                        fidl::decode!(Rule, D, val, decoder, _inner_offset, depth)?;
7071                    } else {
7072                        unreachable!()
7073                    }
7074                }
7075                #[allow(deprecated)]
7076                ordinal => {
7077                    for _ in 0..num_handles {
7078                        decoder.drop_next_handle()?;
7079                    }
7080                    *self = Resource::__SourceBreaking { unknown_ordinal: ordinal };
7081                }
7082            }
7083            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
7084                return Err(fidl::Error::InvalidNumBytesInEnvelope);
7085            }
7086            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7087                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7088            }
7089            Ok(())
7090        }
7091    }
7092
7093    impl fidl::encoding::ValueTypeMarker for ResourceId {
7094        type Borrowed<'a> = &'a Self;
7095        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7096            value
7097        }
7098    }
7099
7100    unsafe impl fidl::encoding::TypeMarker for ResourceId {
7101        type Owned = Self;
7102
7103        #[inline(always)]
7104        fn inline_align(_context: fidl::encoding::Context) -> usize {
7105            8
7106        }
7107
7108        #[inline(always)]
7109        fn inline_size(_context: fidl::encoding::Context) -> usize {
7110            16
7111        }
7112    }
7113
7114    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ResourceId, D>
7115        for &ResourceId
7116    {
7117        #[inline]
7118        unsafe fn encode(
7119            self,
7120            encoder: &mut fidl::encoding::Encoder<'_, D>,
7121            offset: usize,
7122            _depth: fidl::encoding::Depth,
7123        ) -> fidl::Result<()> {
7124            encoder.debug_check_bounds::<ResourceId>(offset);
7125            encoder.write_num::<u64>(self.ordinal(), offset);
7126            match self {
7127                ResourceId::Namespace(ref val) => fidl::encoding::encode_in_envelope::<
7128                    fidl::encoding::BoundedString<255>,
7129                    D,
7130                >(
7131                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
7132                        val,
7133                    ),
7134                    encoder,
7135                    offset + 8,
7136                    _depth,
7137                ),
7138                ResourceId::Routine(ref val) => fidl::encoding::encode_in_envelope::<RoutineId, D>(
7139                    <RoutineId as fidl::encoding::ValueTypeMarker>::borrow(val),
7140                    encoder,
7141                    offset + 8,
7142                    _depth,
7143                ),
7144                ResourceId::Rule(ref val) => fidl::encoding::encode_in_envelope::<RuleId, D>(
7145                    <RuleId as fidl::encoding::ValueTypeMarker>::borrow(val),
7146                    encoder,
7147                    offset + 8,
7148                    _depth,
7149                ),
7150                ResourceId::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
7151            }
7152        }
7153    }
7154
7155    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ResourceId {
7156        #[inline(always)]
7157        fn new_empty() -> Self {
7158            Self::__SourceBreaking { unknown_ordinal: 0 }
7159        }
7160
7161        #[inline]
7162        unsafe fn decode(
7163            &mut self,
7164            decoder: &mut fidl::encoding::Decoder<'_, D>,
7165            offset: usize,
7166            mut depth: fidl::encoding::Depth,
7167        ) -> fidl::Result<()> {
7168            decoder.debug_check_bounds::<Self>(offset);
7169            #[allow(unused_variables)]
7170            let next_out_of_line = decoder.next_out_of_line();
7171            let handles_before = decoder.remaining_handles();
7172            let (ordinal, inlined, num_bytes, num_handles) =
7173                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
7174
7175            let member_inline_size = match ordinal {
7176                1 => {
7177                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
7178                        decoder.context,
7179                    )
7180                }
7181                2 => <RoutineId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7182                3 => <RuleId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7183                0 => return Err(fidl::Error::UnknownUnionTag),
7184                _ => num_bytes as usize,
7185            };
7186
7187            if inlined != (member_inline_size <= 4) {
7188                return Err(fidl::Error::InvalidInlineBitInEnvelope);
7189            }
7190            let _inner_offset;
7191            if inlined {
7192                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
7193                _inner_offset = offset + 8;
7194            } else {
7195                depth.increment()?;
7196                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7197            }
7198            match ordinal {
7199                1 => {
7200                    #[allow(irrefutable_let_patterns)]
7201                    if let ResourceId::Namespace(_) = self {
7202                        // Do nothing, read the value into the object
7203                    } else {
7204                        // Initialize `self` to the right variant
7205                        *self = ResourceId::Namespace(fidl::new_empty!(
7206                            fidl::encoding::BoundedString<255>,
7207                            D
7208                        ));
7209                    }
7210                    #[allow(irrefutable_let_patterns)]
7211                    if let ResourceId::Namespace(ref mut val) = self {
7212                        fidl::decode!(
7213                            fidl::encoding::BoundedString<255>,
7214                            D,
7215                            val,
7216                            decoder,
7217                            _inner_offset,
7218                            depth
7219                        )?;
7220                    } else {
7221                        unreachable!()
7222                    }
7223                }
7224                2 => {
7225                    #[allow(irrefutable_let_patterns)]
7226                    if let ResourceId::Routine(_) = self {
7227                        // Do nothing, read the value into the object
7228                    } else {
7229                        // Initialize `self` to the right variant
7230                        *self = ResourceId::Routine(fidl::new_empty!(RoutineId, D));
7231                    }
7232                    #[allow(irrefutable_let_patterns)]
7233                    if let ResourceId::Routine(ref mut val) = self {
7234                        fidl::decode!(RoutineId, D, val, decoder, _inner_offset, depth)?;
7235                    } else {
7236                        unreachable!()
7237                    }
7238                }
7239                3 => {
7240                    #[allow(irrefutable_let_patterns)]
7241                    if let ResourceId::Rule(_) = self {
7242                        // Do nothing, read the value into the object
7243                    } else {
7244                        // Initialize `self` to the right variant
7245                        *self = ResourceId::Rule(fidl::new_empty!(RuleId, D));
7246                    }
7247                    #[allow(irrefutable_let_patterns)]
7248                    if let ResourceId::Rule(ref mut val) = self {
7249                        fidl::decode!(RuleId, D, val, decoder, _inner_offset, depth)?;
7250                    } else {
7251                        unreachable!()
7252                    }
7253                }
7254                #[allow(deprecated)]
7255                ordinal => {
7256                    for _ in 0..num_handles {
7257                        decoder.drop_next_handle()?;
7258                    }
7259                    *self = ResourceId::__SourceBreaking { unknown_ordinal: ordinal };
7260                }
7261            }
7262            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
7263                return Err(fidl::Error::InvalidNumBytesInEnvelope);
7264            }
7265            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7266                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7267            }
7268            Ok(())
7269        }
7270    }
7271
7272    impl fidl::encoding::ValueTypeMarker for RoutineType {
7273        type Borrowed<'a> = &'a Self;
7274        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7275            value
7276        }
7277    }
7278
7279    unsafe impl fidl::encoding::TypeMarker for RoutineType {
7280        type Owned = Self;
7281
7282        #[inline(always)]
7283        fn inline_align(_context: fidl::encoding::Context) -> usize {
7284            8
7285        }
7286
7287        #[inline(always)]
7288        fn inline_size(_context: fidl::encoding::Context) -> usize {
7289            16
7290        }
7291    }
7292
7293    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RoutineType, D>
7294        for &RoutineType
7295    {
7296        #[inline]
7297        unsafe fn encode(
7298            self,
7299            encoder: &mut fidl::encoding::Encoder<'_, D>,
7300            offset: usize,
7301            _depth: fidl::encoding::Depth,
7302        ) -> fidl::Result<()> {
7303            encoder.debug_check_bounds::<RoutineType>(offset);
7304            encoder.write_num::<u64>(self.ordinal(), offset);
7305            match self {
7306                RoutineType::Ip(ref val) => fidl::encoding::encode_in_envelope::<IpRoutine, D>(
7307                    <IpRoutine as fidl::encoding::ValueTypeMarker>::borrow(val),
7308                    encoder,
7309                    offset + 8,
7310                    _depth,
7311                ),
7312                RoutineType::Nat(ref val) => fidl::encoding::encode_in_envelope::<NatRoutine, D>(
7313                    <NatRoutine as fidl::encoding::ValueTypeMarker>::borrow(val),
7314                    encoder,
7315                    offset + 8,
7316                    _depth,
7317                ),
7318                RoutineType::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
7319            }
7320        }
7321    }
7322
7323    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RoutineType {
7324        #[inline(always)]
7325        fn new_empty() -> Self {
7326            Self::__SourceBreaking { unknown_ordinal: 0 }
7327        }
7328
7329        #[inline]
7330        unsafe fn decode(
7331            &mut self,
7332            decoder: &mut fidl::encoding::Decoder<'_, D>,
7333            offset: usize,
7334            mut depth: fidl::encoding::Depth,
7335        ) -> fidl::Result<()> {
7336            decoder.debug_check_bounds::<Self>(offset);
7337            #[allow(unused_variables)]
7338            let next_out_of_line = decoder.next_out_of_line();
7339            let handles_before = decoder.remaining_handles();
7340            let (ordinal, inlined, num_bytes, num_handles) =
7341                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
7342
7343            let member_inline_size = match ordinal {
7344                1 => <IpRoutine as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7345                2 => <NatRoutine as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7346                0 => return Err(fidl::Error::UnknownUnionTag),
7347                _ => num_bytes as usize,
7348            };
7349
7350            if inlined != (member_inline_size <= 4) {
7351                return Err(fidl::Error::InvalidInlineBitInEnvelope);
7352            }
7353            let _inner_offset;
7354            if inlined {
7355                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
7356                _inner_offset = offset + 8;
7357            } else {
7358                depth.increment()?;
7359                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7360            }
7361            match ordinal {
7362                1 => {
7363                    #[allow(irrefutable_let_patterns)]
7364                    if let RoutineType::Ip(_) = self {
7365                        // Do nothing, read the value into the object
7366                    } else {
7367                        // Initialize `self` to the right variant
7368                        *self = RoutineType::Ip(fidl::new_empty!(IpRoutine, D));
7369                    }
7370                    #[allow(irrefutable_let_patterns)]
7371                    if let RoutineType::Ip(ref mut val) = self {
7372                        fidl::decode!(IpRoutine, D, val, decoder, _inner_offset, depth)?;
7373                    } else {
7374                        unreachable!()
7375                    }
7376                }
7377                2 => {
7378                    #[allow(irrefutable_let_patterns)]
7379                    if let RoutineType::Nat(_) = self {
7380                        // Do nothing, read the value into the object
7381                    } else {
7382                        // Initialize `self` to the right variant
7383                        *self = RoutineType::Nat(fidl::new_empty!(NatRoutine, D));
7384                    }
7385                    #[allow(irrefutable_let_patterns)]
7386                    if let RoutineType::Nat(ref mut val) = self {
7387                        fidl::decode!(NatRoutine, D, val, decoder, _inner_offset, depth)?;
7388                    } else {
7389                        unreachable!()
7390                    }
7391                }
7392                #[allow(deprecated)]
7393                ordinal => {
7394                    for _ in 0..num_handles {
7395                        decoder.drop_next_handle()?;
7396                    }
7397                    *self = RoutineType::__SourceBreaking { unknown_ordinal: ordinal };
7398                }
7399            }
7400            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
7401                return Err(fidl::Error::InvalidNumBytesInEnvelope);
7402            }
7403            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7404                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7405            }
7406            Ok(())
7407        }
7408    }
7409
7410    impl fidl::encoding::ValueTypeMarker for TransparentProxy_ {
7411        type Borrowed<'a> = &'a Self;
7412        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7413            value
7414        }
7415    }
7416
7417    unsafe impl fidl::encoding::TypeMarker for TransparentProxy_ {
7418        type Owned = Self;
7419
7420        #[inline(always)]
7421        fn inline_align(_context: fidl::encoding::Context) -> usize {
7422            8
7423        }
7424
7425        #[inline(always)]
7426        fn inline_size(_context: fidl::encoding::Context) -> usize {
7427            16
7428        }
7429    }
7430
7431    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TransparentProxy_, D>
7432        for &TransparentProxy_
7433    {
7434        #[inline]
7435        unsafe fn encode(
7436            self,
7437            encoder: &mut fidl::encoding::Encoder<'_, D>,
7438            offset: usize,
7439            _depth: fidl::encoding::Depth,
7440        ) -> fidl::Result<()> {
7441            encoder.debug_check_bounds::<TransparentProxy_>(offset);
7442            encoder.write_num::<u64>(self.ordinal(), offset);
7443            match self {
7444            TransparentProxy_::LocalAddr(ref val) => {
7445                fidl::encoding::encode_in_envelope::<fidl_fuchsia_net__common::IpAddress, D>(
7446                    <fidl_fuchsia_net__common::IpAddress as fidl::encoding::ValueTypeMarker>::borrow(val),
7447                    encoder, offset + 8, _depth
7448                )
7449            }
7450            TransparentProxy_::LocalPort(ref val) => {
7451                fidl::encoding::encode_in_envelope::<u16, D>(
7452                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(val),
7453                    encoder, offset + 8, _depth
7454                )
7455            }
7456            TransparentProxy_::LocalAddrAndPort(ref val) => {
7457                fidl::encoding::encode_in_envelope::<SocketAddr, D>(
7458                    <SocketAddr as fidl::encoding::ValueTypeMarker>::borrow(val),
7459                    encoder, offset + 8, _depth
7460                )
7461            }
7462            TransparentProxy_::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
7463        }
7464        }
7465    }
7466
7467    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TransparentProxy_ {
7468        #[inline(always)]
7469        fn new_empty() -> Self {
7470            Self::__SourceBreaking { unknown_ordinal: 0 }
7471        }
7472
7473        #[inline]
7474        unsafe fn decode(
7475            &mut self,
7476            decoder: &mut fidl::encoding::Decoder<'_, D>,
7477            offset: usize,
7478            mut depth: fidl::encoding::Depth,
7479        ) -> fidl::Result<()> {
7480            decoder.debug_check_bounds::<Self>(offset);
7481            #[allow(unused_variables)]
7482            let next_out_of_line = decoder.next_out_of_line();
7483            let handles_before = decoder.remaining_handles();
7484            let (ordinal, inlined, num_bytes, num_handles) =
7485                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
7486
7487            let member_inline_size = match ordinal {
7488                1 => {
7489                    <fidl_fuchsia_net__common::IpAddress as fidl::encoding::TypeMarker>::inline_size(
7490                        decoder.context,
7491                    )
7492                }
7493                2 => <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7494                3 => <SocketAddr as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7495                0 => return Err(fidl::Error::UnknownUnionTag),
7496                _ => num_bytes as usize,
7497            };
7498
7499            if inlined != (member_inline_size <= 4) {
7500                return Err(fidl::Error::InvalidInlineBitInEnvelope);
7501            }
7502            let _inner_offset;
7503            if inlined {
7504                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
7505                _inner_offset = offset + 8;
7506            } else {
7507                depth.increment()?;
7508                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7509            }
7510            match ordinal {
7511                1 => {
7512                    #[allow(irrefutable_let_patterns)]
7513                    if let TransparentProxy_::LocalAddr(_) = self {
7514                        // Do nothing, read the value into the object
7515                    } else {
7516                        // Initialize `self` to the right variant
7517                        *self = TransparentProxy_::LocalAddr(fidl::new_empty!(
7518                            fidl_fuchsia_net__common::IpAddress,
7519                            D
7520                        ));
7521                    }
7522                    #[allow(irrefutable_let_patterns)]
7523                    if let TransparentProxy_::LocalAddr(ref mut val) = self {
7524                        fidl::decode!(
7525                            fidl_fuchsia_net__common::IpAddress,
7526                            D,
7527                            val,
7528                            decoder,
7529                            _inner_offset,
7530                            depth
7531                        )?;
7532                    } else {
7533                        unreachable!()
7534                    }
7535                }
7536                2 => {
7537                    #[allow(irrefutable_let_patterns)]
7538                    if let TransparentProxy_::LocalPort(_) = self {
7539                        // Do nothing, read the value into the object
7540                    } else {
7541                        // Initialize `self` to the right variant
7542                        *self = TransparentProxy_::LocalPort(fidl::new_empty!(u16, D));
7543                    }
7544                    #[allow(irrefutable_let_patterns)]
7545                    if let TransparentProxy_::LocalPort(ref mut val) = self {
7546                        fidl::decode!(u16, D, val, decoder, _inner_offset, depth)?;
7547                    } else {
7548                        unreachable!()
7549                    }
7550                }
7551                3 => {
7552                    #[allow(irrefutable_let_patterns)]
7553                    if let TransparentProxy_::LocalAddrAndPort(_) = self {
7554                        // Do nothing, read the value into the object
7555                    } else {
7556                        // Initialize `self` to the right variant
7557                        *self =
7558                            TransparentProxy_::LocalAddrAndPort(fidl::new_empty!(SocketAddr, D));
7559                    }
7560                    #[allow(irrefutable_let_patterns)]
7561                    if let TransparentProxy_::LocalAddrAndPort(ref mut val) = self {
7562                        fidl::decode!(SocketAddr, D, val, decoder, _inner_offset, depth)?;
7563                    } else {
7564                        unreachable!()
7565                    }
7566                }
7567                #[allow(deprecated)]
7568                ordinal => {
7569                    for _ in 0..num_handles {
7570                        decoder.drop_next_handle()?;
7571                    }
7572                    *self = TransparentProxy_::__SourceBreaking { unknown_ordinal: ordinal };
7573                }
7574            }
7575            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
7576                return Err(fidl::Error::InvalidNumBytesInEnvelope);
7577            }
7578            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7579                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7580            }
7581            Ok(())
7582        }
7583    }
7584}