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(
3617                        &self.addr,
3618                    ),
3619                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.port),
3620                ),
3621                encoder,
3622                offset,
3623                _depth,
3624            )
3625        }
3626    }
3627    unsafe impl<
3628        D: fidl::encoding::ResourceDialect,
3629        T0: fidl::encoding::Encode<fidl_fuchsia_net_common::IpAddress, D>,
3630        T1: fidl::encoding::Encode<u16, D>,
3631    > fidl::encoding::Encode<SocketAddr, D> for (T0, T1)
3632    {
3633        #[inline]
3634        unsafe fn encode(
3635            self,
3636            encoder: &mut fidl::encoding::Encoder<'_, D>,
3637            offset: usize,
3638            depth: fidl::encoding::Depth,
3639        ) -> fidl::Result<()> {
3640            encoder.debug_check_bounds::<SocketAddr>(offset);
3641            // Zero out padding regions. There's no need to apply masks
3642            // because the unmasked parts will be overwritten by fields.
3643            unsafe {
3644                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
3645                (ptr as *mut u64).write_unaligned(0);
3646            }
3647            // Write the fields.
3648            self.0.encode(encoder, offset + 0, depth)?;
3649            self.1.encode(encoder, offset + 16, depth)?;
3650            Ok(())
3651        }
3652    }
3653
3654    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SocketAddr {
3655        #[inline(always)]
3656        fn new_empty() -> Self {
3657            Self {
3658                addr: fidl::new_empty!(fidl_fuchsia_net_common::IpAddress, D),
3659                port: fidl::new_empty!(u16, D),
3660            }
3661        }
3662
3663        #[inline]
3664        unsafe fn decode(
3665            &mut self,
3666            decoder: &mut fidl::encoding::Decoder<'_, D>,
3667            offset: usize,
3668            _depth: fidl::encoding::Depth,
3669        ) -> fidl::Result<()> {
3670            decoder.debug_check_bounds::<Self>(offset);
3671            // Verify that padding bytes are zero.
3672            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
3673            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3674            let mask = 0xffffffffffff0000u64;
3675            let maskedval = padval & mask;
3676            if maskedval != 0 {
3677                return Err(fidl::Error::NonZeroPadding {
3678                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
3679                });
3680            }
3681            fidl::decode!(
3682                fidl_fuchsia_net_common::IpAddress,
3683                D,
3684                &mut self.addr,
3685                decoder,
3686                offset + 0,
3687                _depth
3688            )?;
3689            fidl::decode!(u16, D, &mut self.port, decoder, offset + 16, _depth)?;
3690            Ok(())
3691        }
3692    }
3693
3694    impl fidl::encoding::ValueTypeMarker for SocketControlDetachEbpfProgramRequest {
3695        type Borrowed<'a> = &'a Self;
3696        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3697            value
3698        }
3699    }
3700
3701    unsafe impl fidl::encoding::TypeMarker for SocketControlDetachEbpfProgramRequest {
3702        type Owned = Self;
3703
3704        #[inline(always)]
3705        fn inline_align(_context: fidl::encoding::Context) -> usize {
3706            4
3707        }
3708
3709        #[inline(always)]
3710        fn inline_size(_context: fidl::encoding::Context) -> usize {
3711            4
3712        }
3713    }
3714
3715    unsafe impl<D: fidl::encoding::ResourceDialect>
3716        fidl::encoding::Encode<SocketControlDetachEbpfProgramRequest, D>
3717        for &SocketControlDetachEbpfProgramRequest
3718    {
3719        #[inline]
3720        unsafe fn encode(
3721            self,
3722            encoder: &mut fidl::encoding::Encoder<'_, D>,
3723            offset: usize,
3724            _depth: fidl::encoding::Depth,
3725        ) -> fidl::Result<()> {
3726            encoder.debug_check_bounds::<SocketControlDetachEbpfProgramRequest>(offset);
3727            // Delegate to tuple encoding.
3728            fidl::encoding::Encode::<SocketControlDetachEbpfProgramRequest, D>::encode(
3729                (<SocketHook as fidl::encoding::ValueTypeMarker>::borrow(&self.hook),),
3730                encoder,
3731                offset,
3732                _depth,
3733            )
3734        }
3735    }
3736    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<SocketHook, D>>
3737        fidl::encoding::Encode<SocketControlDetachEbpfProgramRequest, D> for (T0,)
3738    {
3739        #[inline]
3740        unsafe fn encode(
3741            self,
3742            encoder: &mut fidl::encoding::Encoder<'_, D>,
3743            offset: usize,
3744            depth: fidl::encoding::Depth,
3745        ) -> fidl::Result<()> {
3746            encoder.debug_check_bounds::<SocketControlDetachEbpfProgramRequest>(offset);
3747            // Zero out padding regions. There's no need to apply masks
3748            // because the unmasked parts will be overwritten by fields.
3749            // Write the fields.
3750            self.0.encode(encoder, offset + 0, depth)?;
3751            Ok(())
3752        }
3753    }
3754
3755    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3756        for SocketControlDetachEbpfProgramRequest
3757    {
3758        #[inline(always)]
3759        fn new_empty() -> Self {
3760            Self { hook: fidl::new_empty!(SocketHook, D) }
3761        }
3762
3763        #[inline]
3764        unsafe fn decode(
3765            &mut self,
3766            decoder: &mut fidl::encoding::Decoder<'_, D>,
3767            offset: usize,
3768            _depth: fidl::encoding::Depth,
3769        ) -> fidl::Result<()> {
3770            decoder.debug_check_bounds::<Self>(offset);
3771            // Verify that padding bytes are zero.
3772            fidl::decode!(SocketHook, D, &mut self.hook, decoder, offset + 0, _depth)?;
3773            Ok(())
3774        }
3775    }
3776
3777    impl fidl::encoding::ValueTypeMarker for WatcherWatchResponse {
3778        type Borrowed<'a> = &'a Self;
3779        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3780            value
3781        }
3782    }
3783
3784    unsafe impl fidl::encoding::TypeMarker for WatcherWatchResponse {
3785        type Owned = Self;
3786
3787        #[inline(always)]
3788        fn inline_align(_context: fidl::encoding::Context) -> usize {
3789            8
3790        }
3791
3792        #[inline(always)]
3793        fn inline_size(_context: fidl::encoding::Context) -> usize {
3794            16
3795        }
3796    }
3797
3798    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WatcherWatchResponse, D>
3799        for &WatcherWatchResponse
3800    {
3801        #[inline]
3802        unsafe fn encode(
3803            self,
3804            encoder: &mut fidl::encoding::Encoder<'_, D>,
3805            offset: usize,
3806            _depth: fidl::encoding::Depth,
3807        ) -> fidl::Result<()> {
3808            encoder.debug_check_bounds::<WatcherWatchResponse>(offset);
3809            // Delegate to tuple encoding.
3810            fidl::encoding::Encode::<WatcherWatchResponse, D>::encode(
3811                (<fidl::encoding::Vector<Event, 42> as fidl::encoding::ValueTypeMarker>::borrow(
3812                    &self.events,
3813                ),),
3814                encoder,
3815                offset,
3816                _depth,
3817            )
3818        }
3819    }
3820    unsafe impl<
3821        D: fidl::encoding::ResourceDialect,
3822        T0: fidl::encoding::Encode<fidl::encoding::Vector<Event, 42>, D>,
3823    > fidl::encoding::Encode<WatcherWatchResponse, D> for (T0,)
3824    {
3825        #[inline]
3826        unsafe fn encode(
3827            self,
3828            encoder: &mut fidl::encoding::Encoder<'_, D>,
3829            offset: usize,
3830            depth: fidl::encoding::Depth,
3831        ) -> fidl::Result<()> {
3832            encoder.debug_check_bounds::<WatcherWatchResponse>(offset);
3833            // Zero out padding regions. There's no need to apply masks
3834            // because the unmasked parts will be overwritten by fields.
3835            // Write the fields.
3836            self.0.encode(encoder, offset + 0, depth)?;
3837            Ok(())
3838        }
3839    }
3840
3841    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WatcherWatchResponse {
3842        #[inline(always)]
3843        fn new_empty() -> Self {
3844            Self { events: fidl::new_empty!(fidl::encoding::Vector<Event, 42>, D) }
3845        }
3846
3847        #[inline]
3848        unsafe fn decode(
3849            &mut self,
3850            decoder: &mut fidl::encoding::Decoder<'_, D>,
3851            offset: usize,
3852            _depth: fidl::encoding::Depth,
3853        ) -> fidl::Result<()> {
3854            decoder.debug_check_bounds::<Self>(offset);
3855            // Verify that padding bytes are zero.
3856            fidl::decode!(fidl::encoding::Vector<Event, 42>, D, &mut self.events, decoder, offset + 0, _depth)?;
3857            Ok(())
3858        }
3859    }
3860
3861    impl InstalledIpRoutine {
3862        #[inline(always)]
3863        fn max_ordinal_present(&self) -> u64 {
3864            if let Some(_) = self.priority {
3865                return 2;
3866            }
3867            if let Some(_) = self.hook {
3868                return 1;
3869            }
3870            0
3871        }
3872    }
3873
3874    impl fidl::encoding::ValueTypeMarker for InstalledIpRoutine {
3875        type Borrowed<'a> = &'a Self;
3876        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3877            value
3878        }
3879    }
3880
3881    unsafe impl fidl::encoding::TypeMarker for InstalledIpRoutine {
3882        type Owned = Self;
3883
3884        #[inline(always)]
3885        fn inline_align(_context: fidl::encoding::Context) -> usize {
3886            8
3887        }
3888
3889        #[inline(always)]
3890        fn inline_size(_context: fidl::encoding::Context) -> usize {
3891            16
3892        }
3893    }
3894
3895    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InstalledIpRoutine, D>
3896        for &InstalledIpRoutine
3897    {
3898        unsafe fn encode(
3899            self,
3900            encoder: &mut fidl::encoding::Encoder<'_, D>,
3901            offset: usize,
3902            mut depth: fidl::encoding::Depth,
3903        ) -> fidl::Result<()> {
3904            encoder.debug_check_bounds::<InstalledIpRoutine>(offset);
3905            // Vector header
3906            let max_ordinal: u64 = self.max_ordinal_present();
3907            encoder.write_num(max_ordinal, offset);
3908            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3909            // Calling encoder.out_of_line_offset(0) is not allowed.
3910            if max_ordinal == 0 {
3911                return Ok(());
3912            }
3913            depth.increment()?;
3914            let envelope_size = 8;
3915            let bytes_len = max_ordinal as usize * envelope_size;
3916            #[allow(unused_variables)]
3917            let offset = encoder.out_of_line_offset(bytes_len);
3918            let mut _prev_end_offset: usize = 0;
3919            if 1 > max_ordinal {
3920                return Ok(());
3921            }
3922
3923            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3924            // are envelope_size bytes.
3925            let cur_offset: usize = (1 - 1) * envelope_size;
3926
3927            // Zero reserved fields.
3928            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3929
3930            // Safety:
3931            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3932            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3933            //   envelope_size bytes, there is always sufficient room.
3934            fidl::encoding::encode_in_envelope_optional::<IpInstallationHook, D>(
3935                self.hook
3936                    .as_ref()
3937                    .map(<IpInstallationHook as fidl::encoding::ValueTypeMarker>::borrow),
3938                encoder,
3939                offset + cur_offset,
3940                depth,
3941            )?;
3942
3943            _prev_end_offset = cur_offset + envelope_size;
3944            if 2 > max_ordinal {
3945                return Ok(());
3946            }
3947
3948            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3949            // are envelope_size bytes.
3950            let cur_offset: usize = (2 - 1) * envelope_size;
3951
3952            // Zero reserved fields.
3953            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3954
3955            // Safety:
3956            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3957            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3958            //   envelope_size bytes, there is always sufficient room.
3959            fidl::encoding::encode_in_envelope_optional::<i32, D>(
3960                self.priority.as_ref().map(<i32 as fidl::encoding::ValueTypeMarker>::borrow),
3961                encoder,
3962                offset + cur_offset,
3963                depth,
3964            )?;
3965
3966            _prev_end_offset = cur_offset + envelope_size;
3967
3968            Ok(())
3969        }
3970    }
3971
3972    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InstalledIpRoutine {
3973        #[inline(always)]
3974        fn new_empty() -> Self {
3975            Self::default()
3976        }
3977
3978        unsafe fn decode(
3979            &mut self,
3980            decoder: &mut fidl::encoding::Decoder<'_, D>,
3981            offset: usize,
3982            mut depth: fidl::encoding::Depth,
3983        ) -> fidl::Result<()> {
3984            decoder.debug_check_bounds::<Self>(offset);
3985            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3986                None => return Err(fidl::Error::NotNullable),
3987                Some(len) => len,
3988            };
3989            // Calling decoder.out_of_line_offset(0) is not allowed.
3990            if len == 0 {
3991                return Ok(());
3992            };
3993            depth.increment()?;
3994            let envelope_size = 8;
3995            let bytes_len = len * envelope_size;
3996            let offset = decoder.out_of_line_offset(bytes_len)?;
3997            // Decode the envelope for each type.
3998            let mut _next_ordinal_to_read = 0;
3999            let mut next_offset = offset;
4000            let end_offset = offset + bytes_len;
4001            _next_ordinal_to_read += 1;
4002            if next_offset >= end_offset {
4003                return Ok(());
4004            }
4005
4006            // Decode unknown envelopes for gaps in ordinals.
4007            while _next_ordinal_to_read < 1 {
4008                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4009                _next_ordinal_to_read += 1;
4010                next_offset += envelope_size;
4011            }
4012
4013            let next_out_of_line = decoder.next_out_of_line();
4014            let handles_before = decoder.remaining_handles();
4015            if let Some((inlined, num_bytes, num_handles)) =
4016                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4017            {
4018                let member_inline_size =
4019                    <IpInstallationHook as fidl::encoding::TypeMarker>::inline_size(
4020                        decoder.context,
4021                    );
4022                if inlined != (member_inline_size <= 4) {
4023                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4024                }
4025                let inner_offset;
4026                let mut inner_depth = depth.clone();
4027                if inlined {
4028                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4029                    inner_offset = next_offset;
4030                } else {
4031                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4032                    inner_depth.increment()?;
4033                }
4034                let val_ref =
4035                    self.hook.get_or_insert_with(|| fidl::new_empty!(IpInstallationHook, D));
4036                fidl::decode!(IpInstallationHook, D, val_ref, decoder, inner_offset, inner_depth)?;
4037                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4038                {
4039                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4040                }
4041                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4042                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4043                }
4044            }
4045
4046            next_offset += envelope_size;
4047            _next_ordinal_to_read += 1;
4048            if next_offset >= end_offset {
4049                return Ok(());
4050            }
4051
4052            // Decode unknown envelopes for gaps in ordinals.
4053            while _next_ordinal_to_read < 2 {
4054                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4055                _next_ordinal_to_read += 1;
4056                next_offset += envelope_size;
4057            }
4058
4059            let next_out_of_line = decoder.next_out_of_line();
4060            let handles_before = decoder.remaining_handles();
4061            if let Some((inlined, num_bytes, num_handles)) =
4062                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4063            {
4064                let member_inline_size =
4065                    <i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4066                if inlined != (member_inline_size <= 4) {
4067                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4068                }
4069                let inner_offset;
4070                let mut inner_depth = depth.clone();
4071                if inlined {
4072                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4073                    inner_offset = next_offset;
4074                } else {
4075                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4076                    inner_depth.increment()?;
4077                }
4078                let val_ref = self.priority.get_or_insert_with(|| fidl::new_empty!(i32, D));
4079                fidl::decode!(i32, D, val_ref, decoder, inner_offset, inner_depth)?;
4080                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4081                {
4082                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4083                }
4084                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4085                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4086                }
4087            }
4088
4089            next_offset += envelope_size;
4090
4091            // Decode the remaining unknown envelopes.
4092            while next_offset < end_offset {
4093                _next_ordinal_to_read += 1;
4094                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4095                next_offset += envelope_size;
4096            }
4097
4098            Ok(())
4099        }
4100    }
4101
4102    impl InstalledNatRoutine {
4103        #[inline(always)]
4104        fn max_ordinal_present(&self) -> u64 {
4105            if let Some(_) = self.priority {
4106                return 2;
4107            }
4108            if let Some(_) = self.hook {
4109                return 1;
4110            }
4111            0
4112        }
4113    }
4114
4115    impl fidl::encoding::ValueTypeMarker for InstalledNatRoutine {
4116        type Borrowed<'a> = &'a Self;
4117        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4118            value
4119        }
4120    }
4121
4122    unsafe impl fidl::encoding::TypeMarker for InstalledNatRoutine {
4123        type Owned = Self;
4124
4125        #[inline(always)]
4126        fn inline_align(_context: fidl::encoding::Context) -> usize {
4127            8
4128        }
4129
4130        #[inline(always)]
4131        fn inline_size(_context: fidl::encoding::Context) -> usize {
4132            16
4133        }
4134    }
4135
4136    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InstalledNatRoutine, D>
4137        for &InstalledNatRoutine
4138    {
4139        unsafe fn encode(
4140            self,
4141            encoder: &mut fidl::encoding::Encoder<'_, D>,
4142            offset: usize,
4143            mut depth: fidl::encoding::Depth,
4144        ) -> fidl::Result<()> {
4145            encoder.debug_check_bounds::<InstalledNatRoutine>(offset);
4146            // Vector header
4147            let max_ordinal: u64 = self.max_ordinal_present();
4148            encoder.write_num(max_ordinal, offset);
4149            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4150            // Calling encoder.out_of_line_offset(0) is not allowed.
4151            if max_ordinal == 0 {
4152                return Ok(());
4153            }
4154            depth.increment()?;
4155            let envelope_size = 8;
4156            let bytes_len = max_ordinal as usize * envelope_size;
4157            #[allow(unused_variables)]
4158            let offset = encoder.out_of_line_offset(bytes_len);
4159            let mut _prev_end_offset: usize = 0;
4160            if 1 > max_ordinal {
4161                return Ok(());
4162            }
4163
4164            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4165            // are envelope_size bytes.
4166            let cur_offset: usize = (1 - 1) * envelope_size;
4167
4168            // Zero reserved fields.
4169            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4170
4171            // Safety:
4172            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4173            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4174            //   envelope_size bytes, there is always sufficient room.
4175            fidl::encoding::encode_in_envelope_optional::<NatInstallationHook, D>(
4176                self.hook
4177                    .as_ref()
4178                    .map(<NatInstallationHook as fidl::encoding::ValueTypeMarker>::borrow),
4179                encoder,
4180                offset + cur_offset,
4181                depth,
4182            )?;
4183
4184            _prev_end_offset = cur_offset + envelope_size;
4185            if 2 > max_ordinal {
4186                return Ok(());
4187            }
4188
4189            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4190            // are envelope_size bytes.
4191            let cur_offset: usize = (2 - 1) * envelope_size;
4192
4193            // Zero reserved fields.
4194            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4195
4196            // Safety:
4197            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4198            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4199            //   envelope_size bytes, there is always sufficient room.
4200            fidl::encoding::encode_in_envelope_optional::<i32, D>(
4201                self.priority.as_ref().map(<i32 as fidl::encoding::ValueTypeMarker>::borrow),
4202                encoder,
4203                offset + cur_offset,
4204                depth,
4205            )?;
4206
4207            _prev_end_offset = cur_offset + envelope_size;
4208
4209            Ok(())
4210        }
4211    }
4212
4213    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InstalledNatRoutine {
4214        #[inline(always)]
4215        fn new_empty() -> Self {
4216            Self::default()
4217        }
4218
4219        unsafe fn decode(
4220            &mut self,
4221            decoder: &mut fidl::encoding::Decoder<'_, D>,
4222            offset: usize,
4223            mut depth: fidl::encoding::Depth,
4224        ) -> fidl::Result<()> {
4225            decoder.debug_check_bounds::<Self>(offset);
4226            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4227                None => return Err(fidl::Error::NotNullable),
4228                Some(len) => len,
4229            };
4230            // Calling decoder.out_of_line_offset(0) is not allowed.
4231            if len == 0 {
4232                return Ok(());
4233            };
4234            depth.increment()?;
4235            let envelope_size = 8;
4236            let bytes_len = len * envelope_size;
4237            let offset = decoder.out_of_line_offset(bytes_len)?;
4238            // Decode the envelope for each type.
4239            let mut _next_ordinal_to_read = 0;
4240            let mut next_offset = offset;
4241            let end_offset = offset + bytes_len;
4242            _next_ordinal_to_read += 1;
4243            if next_offset >= end_offset {
4244                return Ok(());
4245            }
4246
4247            // Decode unknown envelopes for gaps in ordinals.
4248            while _next_ordinal_to_read < 1 {
4249                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4250                _next_ordinal_to_read += 1;
4251                next_offset += envelope_size;
4252            }
4253
4254            let next_out_of_line = decoder.next_out_of_line();
4255            let handles_before = decoder.remaining_handles();
4256            if let Some((inlined, num_bytes, num_handles)) =
4257                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4258            {
4259                let member_inline_size =
4260                    <NatInstallationHook as fidl::encoding::TypeMarker>::inline_size(
4261                        decoder.context,
4262                    );
4263                if inlined != (member_inline_size <= 4) {
4264                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4265                }
4266                let inner_offset;
4267                let mut inner_depth = depth.clone();
4268                if inlined {
4269                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4270                    inner_offset = next_offset;
4271                } else {
4272                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4273                    inner_depth.increment()?;
4274                }
4275                let val_ref =
4276                    self.hook.get_or_insert_with(|| fidl::new_empty!(NatInstallationHook, D));
4277                fidl::decode!(NatInstallationHook, D, val_ref, decoder, inner_offset, inner_depth)?;
4278                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4279                {
4280                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4281                }
4282                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4283                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4284                }
4285            }
4286
4287            next_offset += envelope_size;
4288            _next_ordinal_to_read += 1;
4289            if next_offset >= end_offset {
4290                return Ok(());
4291            }
4292
4293            // Decode unknown envelopes for gaps in ordinals.
4294            while _next_ordinal_to_read < 2 {
4295                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4296                _next_ordinal_to_read += 1;
4297                next_offset += envelope_size;
4298            }
4299
4300            let next_out_of_line = decoder.next_out_of_line();
4301            let handles_before = decoder.remaining_handles();
4302            if let Some((inlined, num_bytes, num_handles)) =
4303                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4304            {
4305                let member_inline_size =
4306                    <i32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4307                if inlined != (member_inline_size <= 4) {
4308                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4309                }
4310                let inner_offset;
4311                let mut inner_depth = depth.clone();
4312                if inlined {
4313                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4314                    inner_offset = next_offset;
4315                } else {
4316                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4317                    inner_depth.increment()?;
4318                }
4319                let val_ref = self.priority.get_or_insert_with(|| fidl::new_empty!(i32, D));
4320                fidl::decode!(i32, D, val_ref, decoder, inner_offset, inner_depth)?;
4321                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4322                {
4323                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4324                }
4325                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4326                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4327                }
4328            }
4329
4330            next_offset += envelope_size;
4331
4332            // Decode the remaining unknown envelopes.
4333            while next_offset < end_offset {
4334                _next_ordinal_to_read += 1;
4335                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4336                next_offset += envelope_size;
4337            }
4338
4339            Ok(())
4340        }
4341    }
4342
4343    impl IpRoutine {
4344        #[inline(always)]
4345        fn max_ordinal_present(&self) -> u64 {
4346            if let Some(_) = self.installation {
4347                return 1;
4348            }
4349            0
4350        }
4351    }
4352
4353    impl fidl::encoding::ValueTypeMarker for IpRoutine {
4354        type Borrowed<'a> = &'a Self;
4355        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4356            value
4357        }
4358    }
4359
4360    unsafe impl fidl::encoding::TypeMarker for IpRoutine {
4361        type Owned = Self;
4362
4363        #[inline(always)]
4364        fn inline_align(_context: fidl::encoding::Context) -> usize {
4365            8
4366        }
4367
4368        #[inline(always)]
4369        fn inline_size(_context: fidl::encoding::Context) -> usize {
4370            16
4371        }
4372    }
4373
4374    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<IpRoutine, D>
4375        for &IpRoutine
4376    {
4377        unsafe fn encode(
4378            self,
4379            encoder: &mut fidl::encoding::Encoder<'_, D>,
4380            offset: usize,
4381            mut depth: fidl::encoding::Depth,
4382        ) -> fidl::Result<()> {
4383            encoder.debug_check_bounds::<IpRoutine>(offset);
4384            // Vector header
4385            let max_ordinal: u64 = self.max_ordinal_present();
4386            encoder.write_num(max_ordinal, offset);
4387            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4388            // Calling encoder.out_of_line_offset(0) is not allowed.
4389            if max_ordinal == 0 {
4390                return Ok(());
4391            }
4392            depth.increment()?;
4393            let envelope_size = 8;
4394            let bytes_len = max_ordinal as usize * envelope_size;
4395            #[allow(unused_variables)]
4396            let offset = encoder.out_of_line_offset(bytes_len);
4397            let mut _prev_end_offset: usize = 0;
4398            if 1 > max_ordinal {
4399                return Ok(());
4400            }
4401
4402            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4403            // are envelope_size bytes.
4404            let cur_offset: usize = (1 - 1) * envelope_size;
4405
4406            // Zero reserved fields.
4407            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4408
4409            // Safety:
4410            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4411            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4412            //   envelope_size bytes, there is always sufficient room.
4413            fidl::encoding::encode_in_envelope_optional::<InstalledIpRoutine, D>(
4414                self.installation
4415                    .as_ref()
4416                    .map(<InstalledIpRoutine as fidl::encoding::ValueTypeMarker>::borrow),
4417                encoder,
4418                offset + cur_offset,
4419                depth,
4420            )?;
4421
4422            _prev_end_offset = cur_offset + envelope_size;
4423
4424            Ok(())
4425        }
4426    }
4427
4428    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IpRoutine {
4429        #[inline(always)]
4430        fn new_empty() -> Self {
4431            Self::default()
4432        }
4433
4434        unsafe fn decode(
4435            &mut self,
4436            decoder: &mut fidl::encoding::Decoder<'_, D>,
4437            offset: usize,
4438            mut depth: fidl::encoding::Depth,
4439        ) -> fidl::Result<()> {
4440            decoder.debug_check_bounds::<Self>(offset);
4441            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4442                None => return Err(fidl::Error::NotNullable),
4443                Some(len) => len,
4444            };
4445            // Calling decoder.out_of_line_offset(0) is not allowed.
4446            if len == 0 {
4447                return Ok(());
4448            };
4449            depth.increment()?;
4450            let envelope_size = 8;
4451            let bytes_len = len * envelope_size;
4452            let offset = decoder.out_of_line_offset(bytes_len)?;
4453            // Decode the envelope for each type.
4454            let mut _next_ordinal_to_read = 0;
4455            let mut next_offset = offset;
4456            let end_offset = offset + bytes_len;
4457            _next_ordinal_to_read += 1;
4458            if next_offset >= end_offset {
4459                return Ok(());
4460            }
4461
4462            // Decode unknown envelopes for gaps in ordinals.
4463            while _next_ordinal_to_read < 1 {
4464                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4465                _next_ordinal_to_read += 1;
4466                next_offset += envelope_size;
4467            }
4468
4469            let next_out_of_line = decoder.next_out_of_line();
4470            let handles_before = decoder.remaining_handles();
4471            if let Some((inlined, num_bytes, num_handles)) =
4472                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4473            {
4474                let member_inline_size =
4475                    <InstalledIpRoutine as fidl::encoding::TypeMarker>::inline_size(
4476                        decoder.context,
4477                    );
4478                if inlined != (member_inline_size <= 4) {
4479                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4480                }
4481                let inner_offset;
4482                let mut inner_depth = depth.clone();
4483                if inlined {
4484                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4485                    inner_offset = next_offset;
4486                } else {
4487                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4488                    inner_depth.increment()?;
4489                }
4490                let val_ref = self
4491                    .installation
4492                    .get_or_insert_with(|| fidl::new_empty!(InstalledIpRoutine, D));
4493                fidl::decode!(InstalledIpRoutine, D, val_ref, decoder, inner_offset, inner_depth)?;
4494                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4495                {
4496                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4497                }
4498                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4499                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4500                }
4501            }
4502
4503            next_offset += envelope_size;
4504
4505            // Decode the remaining unknown envelopes.
4506            while next_offset < end_offset {
4507                _next_ordinal_to_read += 1;
4508                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4509                next_offset += envelope_size;
4510            }
4511
4512            Ok(())
4513        }
4514    }
4515
4516    impl Masquerade {
4517        #[inline(always)]
4518        fn max_ordinal_present(&self) -> u64 {
4519            if let Some(_) = self.src_port {
4520                return 1;
4521            }
4522            0
4523        }
4524    }
4525
4526    impl fidl::encoding::ValueTypeMarker for Masquerade {
4527        type Borrowed<'a> = &'a Self;
4528        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4529            value
4530        }
4531    }
4532
4533    unsafe impl fidl::encoding::TypeMarker for Masquerade {
4534        type Owned = Self;
4535
4536        #[inline(always)]
4537        fn inline_align(_context: fidl::encoding::Context) -> usize {
4538            8
4539        }
4540
4541        #[inline(always)]
4542        fn inline_size(_context: fidl::encoding::Context) -> usize {
4543            16
4544        }
4545    }
4546
4547    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Masquerade, D>
4548        for &Masquerade
4549    {
4550        unsafe fn encode(
4551            self,
4552            encoder: &mut fidl::encoding::Encoder<'_, D>,
4553            offset: usize,
4554            mut depth: fidl::encoding::Depth,
4555        ) -> fidl::Result<()> {
4556            encoder.debug_check_bounds::<Masquerade>(offset);
4557            // Vector header
4558            let max_ordinal: u64 = self.max_ordinal_present();
4559            encoder.write_num(max_ordinal, offset);
4560            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4561            // Calling encoder.out_of_line_offset(0) is not allowed.
4562            if max_ordinal == 0 {
4563                return Ok(());
4564            }
4565            depth.increment()?;
4566            let envelope_size = 8;
4567            let bytes_len = max_ordinal as usize * envelope_size;
4568            #[allow(unused_variables)]
4569            let offset = encoder.out_of_line_offset(bytes_len);
4570            let mut _prev_end_offset: usize = 0;
4571            if 1 > max_ordinal {
4572                return Ok(());
4573            }
4574
4575            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4576            // are envelope_size bytes.
4577            let cur_offset: usize = (1 - 1) * envelope_size;
4578
4579            // Zero reserved fields.
4580            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4581
4582            // Safety:
4583            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4584            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4585            //   envelope_size bytes, there is always sufficient room.
4586            fidl::encoding::encode_in_envelope_optional::<PortRange, D>(
4587                self.src_port.as_ref().map(<PortRange as fidl::encoding::ValueTypeMarker>::borrow),
4588                encoder,
4589                offset + cur_offset,
4590                depth,
4591            )?;
4592
4593            _prev_end_offset = cur_offset + envelope_size;
4594
4595            Ok(())
4596        }
4597    }
4598
4599    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Masquerade {
4600        #[inline(always)]
4601        fn new_empty() -> Self {
4602            Self::default()
4603        }
4604
4605        unsafe fn decode(
4606            &mut self,
4607            decoder: &mut fidl::encoding::Decoder<'_, D>,
4608            offset: usize,
4609            mut depth: fidl::encoding::Depth,
4610        ) -> fidl::Result<()> {
4611            decoder.debug_check_bounds::<Self>(offset);
4612            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4613                None => return Err(fidl::Error::NotNullable),
4614                Some(len) => len,
4615            };
4616            // Calling decoder.out_of_line_offset(0) is not allowed.
4617            if len == 0 {
4618                return Ok(());
4619            };
4620            depth.increment()?;
4621            let envelope_size = 8;
4622            let bytes_len = len * envelope_size;
4623            let offset = decoder.out_of_line_offset(bytes_len)?;
4624            // Decode the envelope for each type.
4625            let mut _next_ordinal_to_read = 0;
4626            let mut next_offset = offset;
4627            let end_offset = offset + bytes_len;
4628            _next_ordinal_to_read += 1;
4629            if next_offset >= end_offset {
4630                return Ok(());
4631            }
4632
4633            // Decode unknown envelopes for gaps in ordinals.
4634            while _next_ordinal_to_read < 1 {
4635                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4636                _next_ordinal_to_read += 1;
4637                next_offset += envelope_size;
4638            }
4639
4640            let next_out_of_line = decoder.next_out_of_line();
4641            let handles_before = decoder.remaining_handles();
4642            if let Some((inlined, num_bytes, num_handles)) =
4643                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4644            {
4645                let member_inline_size =
4646                    <PortRange as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4647                if inlined != (member_inline_size <= 4) {
4648                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4649                }
4650                let inner_offset;
4651                let mut inner_depth = depth.clone();
4652                if inlined {
4653                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4654                    inner_offset = next_offset;
4655                } else {
4656                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4657                    inner_depth.increment()?;
4658                }
4659                let val_ref = self.src_port.get_or_insert_with(|| fidl::new_empty!(PortRange, D));
4660                fidl::decode!(PortRange, D, val_ref, decoder, inner_offset, inner_depth)?;
4661                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4662                {
4663                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4664                }
4665                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4666                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4667                }
4668            }
4669
4670            next_offset += envelope_size;
4671
4672            // Decode the remaining unknown envelopes.
4673            while next_offset < end_offset {
4674                _next_ordinal_to_read += 1;
4675                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4676                next_offset += envelope_size;
4677            }
4678
4679            Ok(())
4680        }
4681    }
4682
4683    impl Matchers {
4684        #[inline(always)]
4685        fn max_ordinal_present(&self) -> u64 {
4686            if let Some(_) = self.ebpf_program {
4687                return 6;
4688            }
4689            if let Some(_) = self.transport_protocol {
4690                return 5;
4691            }
4692            if let Some(_) = self.dst_addr {
4693                return 4;
4694            }
4695            if let Some(_) = self.src_addr {
4696                return 3;
4697            }
4698            if let Some(_) = self.out_interface {
4699                return 2;
4700            }
4701            if let Some(_) = self.in_interface {
4702                return 1;
4703            }
4704            0
4705        }
4706    }
4707
4708    impl fidl::encoding::ValueTypeMarker for Matchers {
4709        type Borrowed<'a> = &'a Self;
4710        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4711            value
4712        }
4713    }
4714
4715    unsafe impl fidl::encoding::TypeMarker for Matchers {
4716        type Owned = Self;
4717
4718        #[inline(always)]
4719        fn inline_align(_context: fidl::encoding::Context) -> usize {
4720            8
4721        }
4722
4723        #[inline(always)]
4724        fn inline_size(_context: fidl::encoding::Context) -> usize {
4725            16
4726        }
4727    }
4728
4729    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Matchers, D> for &Matchers {
4730        unsafe fn encode(
4731            self,
4732            encoder: &mut fidl::encoding::Encoder<'_, D>,
4733            offset: usize,
4734            mut depth: fidl::encoding::Depth,
4735        ) -> fidl::Result<()> {
4736            encoder.debug_check_bounds::<Matchers>(offset);
4737            // Vector header
4738            let max_ordinal: u64 = self.max_ordinal_present();
4739            encoder.write_num(max_ordinal, offset);
4740            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4741            // Calling encoder.out_of_line_offset(0) is not allowed.
4742            if max_ordinal == 0 {
4743                return Ok(());
4744            }
4745            depth.increment()?;
4746            let envelope_size = 8;
4747            let bytes_len = max_ordinal as usize * envelope_size;
4748            #[allow(unused_variables)]
4749            let offset = encoder.out_of_line_offset(bytes_len);
4750            let mut _prev_end_offset: usize = 0;
4751            if 1 > max_ordinal {
4752                return Ok(());
4753            }
4754
4755            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4756            // are envelope_size bytes.
4757            let cur_offset: usize = (1 - 1) * envelope_size;
4758
4759            // Zero reserved fields.
4760            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4761
4762            // Safety:
4763            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4764            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4765            //   envelope_size bytes, there is always sufficient room.
4766            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net_matchers_common::Interface, D>(
4767            self.in_interface.as_ref().map(<fidl_fuchsia_net_matchers_common::Interface as fidl::encoding::ValueTypeMarker>::borrow),
4768            encoder, offset + cur_offset, depth
4769        )?;
4770
4771            _prev_end_offset = cur_offset + envelope_size;
4772            if 2 > max_ordinal {
4773                return Ok(());
4774            }
4775
4776            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4777            // are envelope_size bytes.
4778            let cur_offset: usize = (2 - 1) * envelope_size;
4779
4780            // Zero reserved fields.
4781            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4782
4783            // Safety:
4784            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4785            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4786            //   envelope_size bytes, there is always sufficient room.
4787            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net_matchers_common::Interface, D>(
4788            self.out_interface.as_ref().map(<fidl_fuchsia_net_matchers_common::Interface as fidl::encoding::ValueTypeMarker>::borrow),
4789            encoder, offset + cur_offset, depth
4790        )?;
4791
4792            _prev_end_offset = cur_offset + envelope_size;
4793            if 3 > max_ordinal {
4794                return Ok(());
4795            }
4796
4797            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4798            // are envelope_size bytes.
4799            let cur_offset: usize = (3 - 1) * envelope_size;
4800
4801            // Zero reserved fields.
4802            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4803
4804            // Safety:
4805            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4806            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4807            //   envelope_size bytes, there is always sufficient room.
4808            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net_matchers_common::Address, D>(
4809            self.src_addr.as_ref().map(<fidl_fuchsia_net_matchers_common::Address as fidl::encoding::ValueTypeMarker>::borrow),
4810            encoder, offset + cur_offset, depth
4811        )?;
4812
4813            _prev_end_offset = cur_offset + envelope_size;
4814            if 4 > max_ordinal {
4815                return Ok(());
4816            }
4817
4818            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4819            // are envelope_size bytes.
4820            let cur_offset: usize = (4 - 1) * envelope_size;
4821
4822            // Zero reserved fields.
4823            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4824
4825            // Safety:
4826            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4827            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4828            //   envelope_size bytes, there is always sufficient room.
4829            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net_matchers_common::Address, D>(
4830            self.dst_addr.as_ref().map(<fidl_fuchsia_net_matchers_common::Address as fidl::encoding::ValueTypeMarker>::borrow),
4831            encoder, offset + cur_offset, depth
4832        )?;
4833
4834            _prev_end_offset = cur_offset + envelope_size;
4835            if 5 > max_ordinal {
4836                return Ok(());
4837            }
4838
4839            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4840            // are envelope_size bytes.
4841            let cur_offset: usize = (5 - 1) * envelope_size;
4842
4843            // Zero reserved fields.
4844            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4845
4846            // Safety:
4847            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4848            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4849            //   envelope_size bytes, there is always sufficient room.
4850            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net_matchers_common::PacketTransportProtocol, D>(
4851            self.transport_protocol.as_ref().map(<fidl_fuchsia_net_matchers_common::PacketTransportProtocol as fidl::encoding::ValueTypeMarker>::borrow),
4852            encoder, offset + cur_offset, depth
4853        )?;
4854
4855            _prev_end_offset = cur_offset + envelope_size;
4856            if 6 > max_ordinal {
4857                return Ok(());
4858            }
4859
4860            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4861            // are envelope_size bytes.
4862            let cur_offset: usize = (6 - 1) * envelope_size;
4863
4864            // Zero reserved fields.
4865            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4866
4867            // Safety:
4868            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4869            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4870            //   envelope_size bytes, there is always sufficient room.
4871            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_ebpf_common::ProgramId, D>(
4872            self.ebpf_program.as_ref().map(<fidl_fuchsia_ebpf_common::ProgramId as fidl::encoding::ValueTypeMarker>::borrow),
4873            encoder, offset + cur_offset, depth
4874        )?;
4875
4876            _prev_end_offset = cur_offset + envelope_size;
4877
4878            Ok(())
4879        }
4880    }
4881
4882    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Matchers {
4883        #[inline(always)]
4884        fn new_empty() -> Self {
4885            Self::default()
4886        }
4887
4888        unsafe fn decode(
4889            &mut self,
4890            decoder: &mut fidl::encoding::Decoder<'_, D>,
4891            offset: usize,
4892            mut depth: fidl::encoding::Depth,
4893        ) -> fidl::Result<()> {
4894            decoder.debug_check_bounds::<Self>(offset);
4895            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4896                None => return Err(fidl::Error::NotNullable),
4897                Some(len) => len,
4898            };
4899            // Calling decoder.out_of_line_offset(0) is not allowed.
4900            if len == 0 {
4901                return Ok(());
4902            };
4903            depth.increment()?;
4904            let envelope_size = 8;
4905            let bytes_len = len * envelope_size;
4906            let offset = decoder.out_of_line_offset(bytes_len)?;
4907            // Decode the envelope for each type.
4908            let mut _next_ordinal_to_read = 0;
4909            let mut next_offset = offset;
4910            let end_offset = offset + bytes_len;
4911            _next_ordinal_to_read += 1;
4912            if next_offset >= end_offset {
4913                return Ok(());
4914            }
4915
4916            // Decode unknown envelopes for gaps in ordinals.
4917            while _next_ordinal_to_read < 1 {
4918                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4919                _next_ordinal_to_read += 1;
4920                next_offset += envelope_size;
4921            }
4922
4923            let next_out_of_line = decoder.next_out_of_line();
4924            let handles_before = decoder.remaining_handles();
4925            if let Some((inlined, num_bytes, num_handles)) =
4926                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4927            {
4928                let member_inline_size = <fidl_fuchsia_net_matchers_common::Interface as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4929                if inlined != (member_inline_size <= 4) {
4930                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4931                }
4932                let inner_offset;
4933                let mut inner_depth = depth.clone();
4934                if inlined {
4935                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4936                    inner_offset = next_offset;
4937                } else {
4938                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4939                    inner_depth.increment()?;
4940                }
4941                let val_ref = self.in_interface.get_or_insert_with(|| {
4942                    fidl::new_empty!(fidl_fuchsia_net_matchers_common::Interface, D)
4943                });
4944                fidl::decode!(
4945                    fidl_fuchsia_net_matchers_common::Interface,
4946                    D,
4947                    val_ref,
4948                    decoder,
4949                    inner_offset,
4950                    inner_depth
4951                )?;
4952                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4953                {
4954                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4955                }
4956                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4957                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4958                }
4959            }
4960
4961            next_offset += envelope_size;
4962            _next_ordinal_to_read += 1;
4963            if next_offset >= end_offset {
4964                return Ok(());
4965            }
4966
4967            // Decode unknown envelopes for gaps in ordinals.
4968            while _next_ordinal_to_read < 2 {
4969                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4970                _next_ordinal_to_read += 1;
4971                next_offset += envelope_size;
4972            }
4973
4974            let next_out_of_line = decoder.next_out_of_line();
4975            let handles_before = decoder.remaining_handles();
4976            if let Some((inlined, num_bytes, num_handles)) =
4977                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4978            {
4979                let member_inline_size = <fidl_fuchsia_net_matchers_common::Interface as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4980                if inlined != (member_inline_size <= 4) {
4981                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4982                }
4983                let inner_offset;
4984                let mut inner_depth = depth.clone();
4985                if inlined {
4986                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4987                    inner_offset = next_offset;
4988                } else {
4989                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4990                    inner_depth.increment()?;
4991                }
4992                let val_ref = self.out_interface.get_or_insert_with(|| {
4993                    fidl::new_empty!(fidl_fuchsia_net_matchers_common::Interface, D)
4994                });
4995                fidl::decode!(
4996                    fidl_fuchsia_net_matchers_common::Interface,
4997                    D,
4998                    val_ref,
4999                    decoder,
5000                    inner_offset,
5001                    inner_depth
5002                )?;
5003                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5004                {
5005                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5006                }
5007                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5008                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5009                }
5010            }
5011
5012            next_offset += envelope_size;
5013            _next_ordinal_to_read += 1;
5014            if next_offset >= end_offset {
5015                return Ok(());
5016            }
5017
5018            // Decode unknown envelopes for gaps in ordinals.
5019            while _next_ordinal_to_read < 3 {
5020                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5021                _next_ordinal_to_read += 1;
5022                next_offset += envelope_size;
5023            }
5024
5025            let next_out_of_line = decoder.next_out_of_line();
5026            let handles_before = decoder.remaining_handles();
5027            if let Some((inlined, num_bytes, num_handles)) =
5028                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5029            {
5030                let member_inline_size = <fidl_fuchsia_net_matchers_common::Address as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5031                if inlined != (member_inline_size <= 4) {
5032                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5033                }
5034                let inner_offset;
5035                let mut inner_depth = depth.clone();
5036                if inlined {
5037                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5038                    inner_offset = next_offset;
5039                } else {
5040                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5041                    inner_depth.increment()?;
5042                }
5043                let val_ref = self.src_addr.get_or_insert_with(|| {
5044                    fidl::new_empty!(fidl_fuchsia_net_matchers_common::Address, D)
5045                });
5046                fidl::decode!(
5047                    fidl_fuchsia_net_matchers_common::Address,
5048                    D,
5049                    val_ref,
5050                    decoder,
5051                    inner_offset,
5052                    inner_depth
5053                )?;
5054                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5055                {
5056                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5057                }
5058                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5059                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5060                }
5061            }
5062
5063            next_offset += envelope_size;
5064            _next_ordinal_to_read += 1;
5065            if next_offset >= end_offset {
5066                return Ok(());
5067            }
5068
5069            // Decode unknown envelopes for gaps in ordinals.
5070            while _next_ordinal_to_read < 4 {
5071                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5072                _next_ordinal_to_read += 1;
5073                next_offset += envelope_size;
5074            }
5075
5076            let next_out_of_line = decoder.next_out_of_line();
5077            let handles_before = decoder.remaining_handles();
5078            if let Some((inlined, num_bytes, num_handles)) =
5079                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5080            {
5081                let member_inline_size = <fidl_fuchsia_net_matchers_common::Address as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5082                if inlined != (member_inline_size <= 4) {
5083                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5084                }
5085                let inner_offset;
5086                let mut inner_depth = depth.clone();
5087                if inlined {
5088                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5089                    inner_offset = next_offset;
5090                } else {
5091                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5092                    inner_depth.increment()?;
5093                }
5094                let val_ref = self.dst_addr.get_or_insert_with(|| {
5095                    fidl::new_empty!(fidl_fuchsia_net_matchers_common::Address, D)
5096                });
5097                fidl::decode!(
5098                    fidl_fuchsia_net_matchers_common::Address,
5099                    D,
5100                    val_ref,
5101                    decoder,
5102                    inner_offset,
5103                    inner_depth
5104                )?;
5105                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5106                {
5107                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5108                }
5109                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5110                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5111                }
5112            }
5113
5114            next_offset += envelope_size;
5115            _next_ordinal_to_read += 1;
5116            if next_offset >= end_offset {
5117                return Ok(());
5118            }
5119
5120            // Decode unknown envelopes for gaps in ordinals.
5121            while _next_ordinal_to_read < 5 {
5122                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5123                _next_ordinal_to_read += 1;
5124                next_offset += envelope_size;
5125            }
5126
5127            let next_out_of_line = decoder.next_out_of_line();
5128            let handles_before = decoder.remaining_handles();
5129            if let Some((inlined, num_bytes, num_handles)) =
5130                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5131            {
5132                let member_inline_size = <fidl_fuchsia_net_matchers_common::PacketTransportProtocol as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5133                if inlined != (member_inline_size <= 4) {
5134                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5135                }
5136                let inner_offset;
5137                let mut inner_depth = depth.clone();
5138                if inlined {
5139                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5140                    inner_offset = next_offset;
5141                } else {
5142                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5143                    inner_depth.increment()?;
5144                }
5145                let val_ref = self.transport_protocol.get_or_insert_with(|| {
5146                    fidl::new_empty!(fidl_fuchsia_net_matchers_common::PacketTransportProtocol, D)
5147                });
5148                fidl::decode!(
5149                    fidl_fuchsia_net_matchers_common::PacketTransportProtocol,
5150                    D,
5151                    val_ref,
5152                    decoder,
5153                    inner_offset,
5154                    inner_depth
5155                )?;
5156                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5157                {
5158                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5159                }
5160                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5161                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5162                }
5163            }
5164
5165            next_offset += envelope_size;
5166            _next_ordinal_to_read += 1;
5167            if next_offset >= end_offset {
5168                return Ok(());
5169            }
5170
5171            // Decode unknown envelopes for gaps in ordinals.
5172            while _next_ordinal_to_read < 6 {
5173                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5174                _next_ordinal_to_read += 1;
5175                next_offset += envelope_size;
5176            }
5177
5178            let next_out_of_line = decoder.next_out_of_line();
5179            let handles_before = decoder.remaining_handles();
5180            if let Some((inlined, num_bytes, num_handles)) =
5181                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5182            {
5183                let member_inline_size = <fidl_fuchsia_ebpf_common::ProgramId as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5184                if inlined != (member_inline_size <= 4) {
5185                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5186                }
5187                let inner_offset;
5188                let mut inner_depth = depth.clone();
5189                if inlined {
5190                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5191                    inner_offset = next_offset;
5192                } else {
5193                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5194                    inner_depth.increment()?;
5195                }
5196                let val_ref = self.ebpf_program.get_or_insert_with(|| {
5197                    fidl::new_empty!(fidl_fuchsia_ebpf_common::ProgramId, D)
5198                });
5199                fidl::decode!(
5200                    fidl_fuchsia_ebpf_common::ProgramId,
5201                    D,
5202                    val_ref,
5203                    decoder,
5204                    inner_offset,
5205                    inner_depth
5206                )?;
5207                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5208                {
5209                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5210                }
5211                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5212                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5213                }
5214            }
5215
5216            next_offset += envelope_size;
5217
5218            // Decode the remaining unknown envelopes.
5219            while next_offset < end_offset {
5220                _next_ordinal_to_read += 1;
5221                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5222                next_offset += envelope_size;
5223            }
5224
5225            Ok(())
5226        }
5227    }
5228
5229    impl Namespace {
5230        #[inline(always)]
5231        fn max_ordinal_present(&self) -> u64 {
5232            if let Some(_) = self.domain {
5233                return 2;
5234            }
5235            if let Some(_) = self.id {
5236                return 1;
5237            }
5238            0
5239        }
5240    }
5241
5242    impl fidl::encoding::ValueTypeMarker for Namespace {
5243        type Borrowed<'a> = &'a Self;
5244        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5245            value
5246        }
5247    }
5248
5249    unsafe impl fidl::encoding::TypeMarker for Namespace {
5250        type Owned = Self;
5251
5252        #[inline(always)]
5253        fn inline_align(_context: fidl::encoding::Context) -> usize {
5254            8
5255        }
5256
5257        #[inline(always)]
5258        fn inline_size(_context: fidl::encoding::Context) -> usize {
5259            16
5260        }
5261    }
5262
5263    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Namespace, D>
5264        for &Namespace
5265    {
5266        unsafe fn encode(
5267            self,
5268            encoder: &mut fidl::encoding::Encoder<'_, D>,
5269            offset: usize,
5270            mut depth: fidl::encoding::Depth,
5271        ) -> fidl::Result<()> {
5272            encoder.debug_check_bounds::<Namespace>(offset);
5273            // Vector header
5274            let max_ordinal: u64 = self.max_ordinal_present();
5275            encoder.write_num(max_ordinal, offset);
5276            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5277            // Calling encoder.out_of_line_offset(0) is not allowed.
5278            if max_ordinal == 0 {
5279                return Ok(());
5280            }
5281            depth.increment()?;
5282            let envelope_size = 8;
5283            let bytes_len = max_ordinal as usize * envelope_size;
5284            #[allow(unused_variables)]
5285            let offset = encoder.out_of_line_offset(bytes_len);
5286            let mut _prev_end_offset: usize = 0;
5287            if 1 > max_ordinal {
5288                return Ok(());
5289            }
5290
5291            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5292            // are envelope_size bytes.
5293            let cur_offset: usize = (1 - 1) * envelope_size;
5294
5295            // Zero reserved fields.
5296            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5297
5298            // Safety:
5299            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5300            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5301            //   envelope_size bytes, there is always sufficient room.
5302            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>, D>(
5303                self.id.as_ref().map(
5304                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
5305                ),
5306                encoder,
5307                offset + cur_offset,
5308                depth,
5309            )?;
5310
5311            _prev_end_offset = cur_offset + envelope_size;
5312            if 2 > max_ordinal {
5313                return Ok(());
5314            }
5315
5316            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5317            // are envelope_size bytes.
5318            let cur_offset: usize = (2 - 1) * envelope_size;
5319
5320            // Zero reserved fields.
5321            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5322
5323            // Safety:
5324            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5325            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5326            //   envelope_size bytes, there is always sufficient room.
5327            fidl::encoding::encode_in_envelope_optional::<Domain, D>(
5328                self.domain.as_ref().map(<Domain as fidl::encoding::ValueTypeMarker>::borrow),
5329                encoder,
5330                offset + cur_offset,
5331                depth,
5332            )?;
5333
5334            _prev_end_offset = cur_offset + envelope_size;
5335
5336            Ok(())
5337        }
5338    }
5339
5340    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Namespace {
5341        #[inline(always)]
5342        fn new_empty() -> Self {
5343            Self::default()
5344        }
5345
5346        unsafe fn decode(
5347            &mut self,
5348            decoder: &mut fidl::encoding::Decoder<'_, D>,
5349            offset: usize,
5350            mut depth: fidl::encoding::Depth,
5351        ) -> fidl::Result<()> {
5352            decoder.debug_check_bounds::<Self>(offset);
5353            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5354                None => return Err(fidl::Error::NotNullable),
5355                Some(len) => len,
5356            };
5357            // Calling decoder.out_of_line_offset(0) is not allowed.
5358            if len == 0 {
5359                return Ok(());
5360            };
5361            depth.increment()?;
5362            let envelope_size = 8;
5363            let bytes_len = len * envelope_size;
5364            let offset = decoder.out_of_line_offset(bytes_len)?;
5365            // Decode the envelope for each type.
5366            let mut _next_ordinal_to_read = 0;
5367            let mut next_offset = offset;
5368            let end_offset = offset + bytes_len;
5369            _next_ordinal_to_read += 1;
5370            if next_offset >= end_offset {
5371                return Ok(());
5372            }
5373
5374            // Decode unknown envelopes for gaps in ordinals.
5375            while _next_ordinal_to_read < 1 {
5376                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5377                _next_ordinal_to_read += 1;
5378                next_offset += envelope_size;
5379            }
5380
5381            let next_out_of_line = decoder.next_out_of_line();
5382            let handles_before = decoder.remaining_handles();
5383            if let Some((inlined, num_bytes, num_handles)) =
5384                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5385            {
5386                let member_inline_size =
5387                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
5388                        decoder.context,
5389                    );
5390                if inlined != (member_inline_size <= 4) {
5391                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5392                }
5393                let inner_offset;
5394                let mut inner_depth = depth.clone();
5395                if inlined {
5396                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5397                    inner_offset = next_offset;
5398                } else {
5399                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5400                    inner_depth.increment()?;
5401                }
5402                let val_ref = self
5403                    .id
5404                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>, D));
5405                fidl::decode!(
5406                    fidl::encoding::BoundedString<255>,
5407                    D,
5408                    val_ref,
5409                    decoder,
5410                    inner_offset,
5411                    inner_depth
5412                )?;
5413                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5414                {
5415                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5416                }
5417                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5418                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5419                }
5420            }
5421
5422            next_offset += envelope_size;
5423            _next_ordinal_to_read += 1;
5424            if next_offset >= end_offset {
5425                return Ok(());
5426            }
5427
5428            // Decode unknown envelopes for gaps in ordinals.
5429            while _next_ordinal_to_read < 2 {
5430                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5431                _next_ordinal_to_read += 1;
5432                next_offset += envelope_size;
5433            }
5434
5435            let next_out_of_line = decoder.next_out_of_line();
5436            let handles_before = decoder.remaining_handles();
5437            if let Some((inlined, num_bytes, num_handles)) =
5438                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5439            {
5440                let member_inline_size =
5441                    <Domain as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5442                if inlined != (member_inline_size <= 4) {
5443                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5444                }
5445                let inner_offset;
5446                let mut inner_depth = depth.clone();
5447                if inlined {
5448                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5449                    inner_offset = next_offset;
5450                } else {
5451                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5452                    inner_depth.increment()?;
5453                }
5454                let val_ref = self.domain.get_or_insert_with(|| fidl::new_empty!(Domain, D));
5455                fidl::decode!(Domain, D, val_ref, decoder, inner_offset, inner_depth)?;
5456                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5457                {
5458                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5459                }
5460                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5461                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5462                }
5463            }
5464
5465            next_offset += envelope_size;
5466
5467            // Decode the remaining unknown envelopes.
5468            while next_offset < end_offset {
5469                _next_ordinal_to_read += 1;
5470                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5471                next_offset += envelope_size;
5472            }
5473
5474            Ok(())
5475        }
5476    }
5477
5478    impl NatRoutine {
5479        #[inline(always)]
5480        fn max_ordinal_present(&self) -> u64 {
5481            if let Some(_) = self.installation {
5482                return 1;
5483            }
5484            0
5485        }
5486    }
5487
5488    impl fidl::encoding::ValueTypeMarker for NatRoutine {
5489        type Borrowed<'a> = &'a Self;
5490        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5491            value
5492        }
5493    }
5494
5495    unsafe impl fidl::encoding::TypeMarker for NatRoutine {
5496        type Owned = Self;
5497
5498        #[inline(always)]
5499        fn inline_align(_context: fidl::encoding::Context) -> usize {
5500            8
5501        }
5502
5503        #[inline(always)]
5504        fn inline_size(_context: fidl::encoding::Context) -> usize {
5505            16
5506        }
5507    }
5508
5509    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NatRoutine, D>
5510        for &NatRoutine
5511    {
5512        unsafe fn encode(
5513            self,
5514            encoder: &mut fidl::encoding::Encoder<'_, D>,
5515            offset: usize,
5516            mut depth: fidl::encoding::Depth,
5517        ) -> fidl::Result<()> {
5518            encoder.debug_check_bounds::<NatRoutine>(offset);
5519            // Vector header
5520            let max_ordinal: u64 = self.max_ordinal_present();
5521            encoder.write_num(max_ordinal, offset);
5522            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5523            // Calling encoder.out_of_line_offset(0) is not allowed.
5524            if max_ordinal == 0 {
5525                return Ok(());
5526            }
5527            depth.increment()?;
5528            let envelope_size = 8;
5529            let bytes_len = max_ordinal as usize * envelope_size;
5530            #[allow(unused_variables)]
5531            let offset = encoder.out_of_line_offset(bytes_len);
5532            let mut _prev_end_offset: usize = 0;
5533            if 1 > max_ordinal {
5534                return Ok(());
5535            }
5536
5537            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5538            // are envelope_size bytes.
5539            let cur_offset: usize = (1 - 1) * envelope_size;
5540
5541            // Zero reserved fields.
5542            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5543
5544            // Safety:
5545            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5546            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5547            //   envelope_size bytes, there is always sufficient room.
5548            fidl::encoding::encode_in_envelope_optional::<InstalledNatRoutine, D>(
5549                self.installation
5550                    .as_ref()
5551                    .map(<InstalledNatRoutine as fidl::encoding::ValueTypeMarker>::borrow),
5552                encoder,
5553                offset + cur_offset,
5554                depth,
5555            )?;
5556
5557            _prev_end_offset = cur_offset + envelope_size;
5558
5559            Ok(())
5560        }
5561    }
5562
5563    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NatRoutine {
5564        #[inline(always)]
5565        fn new_empty() -> Self {
5566            Self::default()
5567        }
5568
5569        unsafe fn decode(
5570            &mut self,
5571            decoder: &mut fidl::encoding::Decoder<'_, D>,
5572            offset: usize,
5573            mut depth: fidl::encoding::Depth,
5574        ) -> fidl::Result<()> {
5575            decoder.debug_check_bounds::<Self>(offset);
5576            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5577                None => return Err(fidl::Error::NotNullable),
5578                Some(len) => len,
5579            };
5580            // Calling decoder.out_of_line_offset(0) is not allowed.
5581            if len == 0 {
5582                return Ok(());
5583            };
5584            depth.increment()?;
5585            let envelope_size = 8;
5586            let bytes_len = len * envelope_size;
5587            let offset = decoder.out_of_line_offset(bytes_len)?;
5588            // Decode the envelope for each type.
5589            let mut _next_ordinal_to_read = 0;
5590            let mut next_offset = offset;
5591            let end_offset = offset + bytes_len;
5592            _next_ordinal_to_read += 1;
5593            if next_offset >= end_offset {
5594                return Ok(());
5595            }
5596
5597            // Decode unknown envelopes for gaps in ordinals.
5598            while _next_ordinal_to_read < 1 {
5599                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5600                _next_ordinal_to_read += 1;
5601                next_offset += envelope_size;
5602            }
5603
5604            let next_out_of_line = decoder.next_out_of_line();
5605            let handles_before = decoder.remaining_handles();
5606            if let Some((inlined, num_bytes, num_handles)) =
5607                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5608            {
5609                let member_inline_size =
5610                    <InstalledNatRoutine as fidl::encoding::TypeMarker>::inline_size(
5611                        decoder.context,
5612                    );
5613                if inlined != (member_inline_size <= 4) {
5614                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5615                }
5616                let inner_offset;
5617                let mut inner_depth = depth.clone();
5618                if inlined {
5619                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5620                    inner_offset = next_offset;
5621                } else {
5622                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5623                    inner_depth.increment()?;
5624                }
5625                let val_ref = self
5626                    .installation
5627                    .get_or_insert_with(|| fidl::new_empty!(InstalledNatRoutine, D));
5628                fidl::decode!(InstalledNatRoutine, D, val_ref, decoder, inner_offset, inner_depth)?;
5629                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5630                {
5631                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5632                }
5633                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5634                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5635                }
5636            }
5637
5638            next_offset += envelope_size;
5639
5640            // Decode the remaining unknown envelopes.
5641            while next_offset < end_offset {
5642                _next_ordinal_to_read += 1;
5643                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5644                next_offset += envelope_size;
5645            }
5646
5647            Ok(())
5648        }
5649    }
5650
5651    impl Redirect {
5652        #[inline(always)]
5653        fn max_ordinal_present(&self) -> u64 {
5654            if let Some(_) = self.dst_port {
5655                return 1;
5656            }
5657            0
5658        }
5659    }
5660
5661    impl fidl::encoding::ValueTypeMarker for Redirect {
5662        type Borrowed<'a> = &'a Self;
5663        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5664            value
5665        }
5666    }
5667
5668    unsafe impl fidl::encoding::TypeMarker for Redirect {
5669        type Owned = Self;
5670
5671        #[inline(always)]
5672        fn inline_align(_context: fidl::encoding::Context) -> usize {
5673            8
5674        }
5675
5676        #[inline(always)]
5677        fn inline_size(_context: fidl::encoding::Context) -> usize {
5678            16
5679        }
5680    }
5681
5682    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Redirect, D> for &Redirect {
5683        unsafe fn encode(
5684            self,
5685            encoder: &mut fidl::encoding::Encoder<'_, D>,
5686            offset: usize,
5687            mut depth: fidl::encoding::Depth,
5688        ) -> fidl::Result<()> {
5689            encoder.debug_check_bounds::<Redirect>(offset);
5690            // Vector header
5691            let max_ordinal: u64 = self.max_ordinal_present();
5692            encoder.write_num(max_ordinal, offset);
5693            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5694            // Calling encoder.out_of_line_offset(0) is not allowed.
5695            if max_ordinal == 0 {
5696                return Ok(());
5697            }
5698            depth.increment()?;
5699            let envelope_size = 8;
5700            let bytes_len = max_ordinal as usize * envelope_size;
5701            #[allow(unused_variables)]
5702            let offset = encoder.out_of_line_offset(bytes_len);
5703            let mut _prev_end_offset: usize = 0;
5704            if 1 > max_ordinal {
5705                return Ok(());
5706            }
5707
5708            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5709            // are envelope_size bytes.
5710            let cur_offset: usize = (1 - 1) * envelope_size;
5711
5712            // Zero reserved fields.
5713            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5714
5715            // Safety:
5716            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5717            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5718            //   envelope_size bytes, there is always sufficient room.
5719            fidl::encoding::encode_in_envelope_optional::<PortRange, D>(
5720                self.dst_port.as_ref().map(<PortRange as fidl::encoding::ValueTypeMarker>::borrow),
5721                encoder,
5722                offset + cur_offset,
5723                depth,
5724            )?;
5725
5726            _prev_end_offset = cur_offset + envelope_size;
5727
5728            Ok(())
5729        }
5730    }
5731
5732    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Redirect {
5733        #[inline(always)]
5734        fn new_empty() -> Self {
5735            Self::default()
5736        }
5737
5738        unsafe fn decode(
5739            &mut self,
5740            decoder: &mut fidl::encoding::Decoder<'_, D>,
5741            offset: usize,
5742            mut depth: fidl::encoding::Depth,
5743        ) -> fidl::Result<()> {
5744            decoder.debug_check_bounds::<Self>(offset);
5745            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5746                None => return Err(fidl::Error::NotNullable),
5747                Some(len) => len,
5748            };
5749            // Calling decoder.out_of_line_offset(0) is not allowed.
5750            if len == 0 {
5751                return Ok(());
5752            };
5753            depth.increment()?;
5754            let envelope_size = 8;
5755            let bytes_len = len * envelope_size;
5756            let offset = decoder.out_of_line_offset(bytes_len)?;
5757            // Decode the envelope for each type.
5758            let mut _next_ordinal_to_read = 0;
5759            let mut next_offset = offset;
5760            let end_offset = offset + bytes_len;
5761            _next_ordinal_to_read += 1;
5762            if next_offset >= end_offset {
5763                return Ok(());
5764            }
5765
5766            // Decode unknown envelopes for gaps in ordinals.
5767            while _next_ordinal_to_read < 1 {
5768                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5769                _next_ordinal_to_read += 1;
5770                next_offset += envelope_size;
5771            }
5772
5773            let next_out_of_line = decoder.next_out_of_line();
5774            let handles_before = decoder.remaining_handles();
5775            if let Some((inlined, num_bytes, num_handles)) =
5776                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5777            {
5778                let member_inline_size =
5779                    <PortRange as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5780                if inlined != (member_inline_size <= 4) {
5781                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5782                }
5783                let inner_offset;
5784                let mut inner_depth = depth.clone();
5785                if inlined {
5786                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5787                    inner_offset = next_offset;
5788                } else {
5789                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5790                    inner_depth.increment()?;
5791                }
5792                let val_ref = self.dst_port.get_or_insert_with(|| fidl::new_empty!(PortRange, D));
5793                fidl::decode!(PortRange, D, val_ref, decoder, inner_offset, inner_depth)?;
5794                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5795                {
5796                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5797                }
5798                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5799                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5800                }
5801            }
5802
5803            next_offset += envelope_size;
5804
5805            // Decode the remaining unknown envelopes.
5806            while next_offset < end_offset {
5807                _next_ordinal_to_read += 1;
5808                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5809                next_offset += envelope_size;
5810            }
5811
5812            Ok(())
5813        }
5814    }
5815
5816    impl Routine {
5817        #[inline(always)]
5818        fn max_ordinal_present(&self) -> u64 {
5819            if let Some(_) = self.type_ {
5820                return 2;
5821            }
5822            if let Some(_) = self.id {
5823                return 1;
5824            }
5825            0
5826        }
5827    }
5828
5829    impl fidl::encoding::ValueTypeMarker for Routine {
5830        type Borrowed<'a> = &'a Self;
5831        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5832            value
5833        }
5834    }
5835
5836    unsafe impl fidl::encoding::TypeMarker for Routine {
5837        type Owned = Self;
5838
5839        #[inline(always)]
5840        fn inline_align(_context: fidl::encoding::Context) -> usize {
5841            8
5842        }
5843
5844        #[inline(always)]
5845        fn inline_size(_context: fidl::encoding::Context) -> usize {
5846            16
5847        }
5848    }
5849
5850    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Routine, D> for &Routine {
5851        unsafe fn encode(
5852            self,
5853            encoder: &mut fidl::encoding::Encoder<'_, D>,
5854            offset: usize,
5855            mut depth: fidl::encoding::Depth,
5856        ) -> fidl::Result<()> {
5857            encoder.debug_check_bounds::<Routine>(offset);
5858            // Vector header
5859            let max_ordinal: u64 = self.max_ordinal_present();
5860            encoder.write_num(max_ordinal, offset);
5861            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5862            // Calling encoder.out_of_line_offset(0) is not allowed.
5863            if max_ordinal == 0 {
5864                return Ok(());
5865            }
5866            depth.increment()?;
5867            let envelope_size = 8;
5868            let bytes_len = max_ordinal as usize * envelope_size;
5869            #[allow(unused_variables)]
5870            let offset = encoder.out_of_line_offset(bytes_len);
5871            let mut _prev_end_offset: usize = 0;
5872            if 1 > max_ordinal {
5873                return Ok(());
5874            }
5875
5876            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5877            // are envelope_size bytes.
5878            let cur_offset: usize = (1 - 1) * envelope_size;
5879
5880            // Zero reserved fields.
5881            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5882
5883            // Safety:
5884            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5885            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5886            //   envelope_size bytes, there is always sufficient room.
5887            fidl::encoding::encode_in_envelope_optional::<RoutineId, D>(
5888                self.id.as_ref().map(<RoutineId as fidl::encoding::ValueTypeMarker>::borrow),
5889                encoder,
5890                offset + cur_offset,
5891                depth,
5892            )?;
5893
5894            _prev_end_offset = cur_offset + envelope_size;
5895            if 2 > max_ordinal {
5896                return Ok(());
5897            }
5898
5899            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5900            // are envelope_size bytes.
5901            let cur_offset: usize = (2 - 1) * envelope_size;
5902
5903            // Zero reserved fields.
5904            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5905
5906            // Safety:
5907            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5908            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5909            //   envelope_size bytes, there is always sufficient room.
5910            fidl::encoding::encode_in_envelope_optional::<RoutineType, D>(
5911                self.type_.as_ref().map(<RoutineType as fidl::encoding::ValueTypeMarker>::borrow),
5912                encoder,
5913                offset + cur_offset,
5914                depth,
5915            )?;
5916
5917            _prev_end_offset = cur_offset + envelope_size;
5918
5919            Ok(())
5920        }
5921    }
5922
5923    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Routine {
5924        #[inline(always)]
5925        fn new_empty() -> Self {
5926            Self::default()
5927        }
5928
5929        unsafe fn decode(
5930            &mut self,
5931            decoder: &mut fidl::encoding::Decoder<'_, D>,
5932            offset: usize,
5933            mut depth: fidl::encoding::Depth,
5934        ) -> fidl::Result<()> {
5935            decoder.debug_check_bounds::<Self>(offset);
5936            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5937                None => return Err(fidl::Error::NotNullable),
5938                Some(len) => len,
5939            };
5940            // Calling decoder.out_of_line_offset(0) is not allowed.
5941            if len == 0 {
5942                return Ok(());
5943            };
5944            depth.increment()?;
5945            let envelope_size = 8;
5946            let bytes_len = len * envelope_size;
5947            let offset = decoder.out_of_line_offset(bytes_len)?;
5948            // Decode the envelope for each type.
5949            let mut _next_ordinal_to_read = 0;
5950            let mut next_offset = offset;
5951            let end_offset = offset + bytes_len;
5952            _next_ordinal_to_read += 1;
5953            if next_offset >= end_offset {
5954                return Ok(());
5955            }
5956
5957            // Decode unknown envelopes for gaps in ordinals.
5958            while _next_ordinal_to_read < 1 {
5959                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5960                _next_ordinal_to_read += 1;
5961                next_offset += envelope_size;
5962            }
5963
5964            let next_out_of_line = decoder.next_out_of_line();
5965            let handles_before = decoder.remaining_handles();
5966            if let Some((inlined, num_bytes, num_handles)) =
5967                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5968            {
5969                let member_inline_size =
5970                    <RoutineId as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5971                if inlined != (member_inline_size <= 4) {
5972                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5973                }
5974                let inner_offset;
5975                let mut inner_depth = depth.clone();
5976                if inlined {
5977                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5978                    inner_offset = next_offset;
5979                } else {
5980                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5981                    inner_depth.increment()?;
5982                }
5983                let val_ref = self.id.get_or_insert_with(|| fidl::new_empty!(RoutineId, D));
5984                fidl::decode!(RoutineId, D, val_ref, decoder, inner_offset, inner_depth)?;
5985                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5986                {
5987                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5988                }
5989                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5990                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5991                }
5992            }
5993
5994            next_offset += envelope_size;
5995            _next_ordinal_to_read += 1;
5996            if next_offset >= end_offset {
5997                return Ok(());
5998            }
5999
6000            // Decode unknown envelopes for gaps in ordinals.
6001            while _next_ordinal_to_read < 2 {
6002                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6003                _next_ordinal_to_read += 1;
6004                next_offset += envelope_size;
6005            }
6006
6007            let next_out_of_line = decoder.next_out_of_line();
6008            let handles_before = decoder.remaining_handles();
6009            if let Some((inlined, num_bytes, num_handles)) =
6010                fidl::encoding::decode_envelope_header(decoder, next_offset)?
6011            {
6012                let member_inline_size =
6013                    <RoutineType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
6014                if inlined != (member_inline_size <= 4) {
6015                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
6016                }
6017                let inner_offset;
6018                let mut inner_depth = depth.clone();
6019                if inlined {
6020                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
6021                    inner_offset = next_offset;
6022                } else {
6023                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6024                    inner_depth.increment()?;
6025                }
6026                let val_ref = self.type_.get_or_insert_with(|| fidl::new_empty!(RoutineType, D));
6027                fidl::decode!(RoutineType, D, val_ref, decoder, inner_offset, inner_depth)?;
6028                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
6029                {
6030                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
6031                }
6032                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6033                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6034                }
6035            }
6036
6037            next_offset += envelope_size;
6038
6039            // Decode the remaining unknown envelopes.
6040            while next_offset < end_offset {
6041                _next_ordinal_to_read += 1;
6042                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6043                next_offset += envelope_size;
6044            }
6045
6046            Ok(())
6047        }
6048    }
6049
6050    impl WatcherOptions {
6051        #[inline(always)]
6052        fn max_ordinal_present(&self) -> u64 {
6053            0
6054        }
6055    }
6056
6057    impl fidl::encoding::ValueTypeMarker for WatcherOptions {
6058        type Borrowed<'a> = &'a Self;
6059        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6060            value
6061        }
6062    }
6063
6064    unsafe impl fidl::encoding::TypeMarker for WatcherOptions {
6065        type Owned = Self;
6066
6067        #[inline(always)]
6068        fn inline_align(_context: fidl::encoding::Context) -> usize {
6069            8
6070        }
6071
6072        #[inline(always)]
6073        fn inline_size(_context: fidl::encoding::Context) -> usize {
6074            16
6075        }
6076    }
6077
6078    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WatcherOptions, D>
6079        for &WatcherOptions
6080    {
6081        unsafe fn encode(
6082            self,
6083            encoder: &mut fidl::encoding::Encoder<'_, D>,
6084            offset: usize,
6085            mut depth: fidl::encoding::Depth,
6086        ) -> fidl::Result<()> {
6087            encoder.debug_check_bounds::<WatcherOptions>(offset);
6088            // Vector header
6089            let max_ordinal: u64 = self.max_ordinal_present();
6090            encoder.write_num(max_ordinal, offset);
6091            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
6092            // Calling encoder.out_of_line_offset(0) is not allowed.
6093            if max_ordinal == 0 {
6094                return Ok(());
6095            }
6096            depth.increment()?;
6097            let envelope_size = 8;
6098            let bytes_len = max_ordinal as usize * envelope_size;
6099            #[allow(unused_variables)]
6100            let offset = encoder.out_of_line_offset(bytes_len);
6101            let mut _prev_end_offset: usize = 0;
6102
6103            Ok(())
6104        }
6105    }
6106
6107    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WatcherOptions {
6108        #[inline(always)]
6109        fn new_empty() -> Self {
6110            Self::default()
6111        }
6112
6113        unsafe fn decode(
6114            &mut self,
6115            decoder: &mut fidl::encoding::Decoder<'_, D>,
6116            offset: usize,
6117            mut depth: fidl::encoding::Depth,
6118        ) -> fidl::Result<()> {
6119            decoder.debug_check_bounds::<Self>(offset);
6120            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
6121                None => return Err(fidl::Error::NotNullable),
6122                Some(len) => len,
6123            };
6124            // Calling decoder.out_of_line_offset(0) is not allowed.
6125            if len == 0 {
6126                return Ok(());
6127            };
6128            depth.increment()?;
6129            let envelope_size = 8;
6130            let bytes_len = len * envelope_size;
6131            let offset = decoder.out_of_line_offset(bytes_len)?;
6132            // Decode the envelope for each type.
6133            let mut _next_ordinal_to_read = 0;
6134            let mut next_offset = offset;
6135            let end_offset = offset + bytes_len;
6136
6137            // Decode the remaining unknown envelopes.
6138            while next_offset < end_offset {
6139                _next_ordinal_to_read += 1;
6140                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
6141                next_offset += envelope_size;
6142            }
6143
6144            Ok(())
6145        }
6146    }
6147
6148    impl fidl::encoding::ValueTypeMarker for Action {
6149        type Borrowed<'a> = &'a Self;
6150        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6151            value
6152        }
6153    }
6154
6155    unsafe impl fidl::encoding::TypeMarker for Action {
6156        type Owned = Self;
6157
6158        #[inline(always)]
6159        fn inline_align(_context: fidl::encoding::Context) -> usize {
6160            8
6161        }
6162
6163        #[inline(always)]
6164        fn inline_size(_context: fidl::encoding::Context) -> usize {
6165            16
6166        }
6167    }
6168
6169    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Action, D> for &Action {
6170        #[inline]
6171        unsafe fn encode(
6172            self,
6173            encoder: &mut fidl::encoding::Encoder<'_, D>,
6174            offset: usize,
6175            _depth: fidl::encoding::Depth,
6176        ) -> fidl::Result<()> {
6177            encoder.debug_check_bounds::<Action>(offset);
6178            encoder.write_num::<u64>(self.ordinal(), offset);
6179            match self {
6180                Action::Accept(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
6181                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
6182                    encoder,
6183                    offset + 8,
6184                    _depth,
6185                ),
6186                Action::Drop(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
6187                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
6188                    encoder,
6189                    offset + 8,
6190                    _depth,
6191                ),
6192                Action::Jump(ref val) => fidl::encoding::encode_in_envelope::<
6193                    fidl::encoding::BoundedString<255>,
6194                    D,
6195                >(
6196                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
6197                        val,
6198                    ),
6199                    encoder,
6200                    offset + 8,
6201                    _depth,
6202                ),
6203                Action::Return_(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
6204                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
6205                    encoder,
6206                    offset + 8,
6207                    _depth,
6208                ),
6209                Action::TransparentProxy(ref val) => {
6210                    fidl::encoding::encode_in_envelope::<TransparentProxy_, D>(
6211                        <TransparentProxy_ as fidl::encoding::ValueTypeMarker>::borrow(val),
6212                        encoder,
6213                        offset + 8,
6214                        _depth,
6215                    )
6216                }
6217                Action::Redirect(ref val) => fidl::encoding::encode_in_envelope::<Redirect, D>(
6218                    <Redirect as fidl::encoding::ValueTypeMarker>::borrow(val),
6219                    encoder,
6220                    offset + 8,
6221                    _depth,
6222                ),
6223                Action::Masquerade(ref val) => fidl::encoding::encode_in_envelope::<Masquerade, D>(
6224                    <Masquerade as fidl::encoding::ValueTypeMarker>::borrow(val),
6225                    encoder,
6226                    offset + 8,
6227                    _depth,
6228                ),
6229                Action::Mark(ref val) => fidl::encoding::encode_in_envelope::<Mark, D>(
6230                    <Mark as fidl::encoding::ValueTypeMarker>::borrow(val),
6231                    encoder,
6232                    offset + 8,
6233                    _depth,
6234                ),
6235                Action::None(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
6236                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
6237                    encoder,
6238                    offset + 8,
6239                    _depth,
6240                ),
6241                Action::Reject(ref val) => fidl::encoding::encode_in_envelope::<Reject, D>(
6242                    <Reject as fidl::encoding::ValueTypeMarker>::borrow(val),
6243                    encoder,
6244                    offset + 8,
6245                    _depth,
6246                ),
6247                Action::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
6248            }
6249        }
6250    }
6251
6252    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Action {
6253        #[inline(always)]
6254        fn new_empty() -> Self {
6255            Self::__SourceBreaking { unknown_ordinal: 0 }
6256        }
6257
6258        #[inline]
6259        unsafe fn decode(
6260            &mut self,
6261            decoder: &mut fidl::encoding::Decoder<'_, D>,
6262            offset: usize,
6263            mut depth: fidl::encoding::Depth,
6264        ) -> fidl::Result<()> {
6265            decoder.debug_check_bounds::<Self>(offset);
6266            #[allow(unused_variables)]
6267            let next_out_of_line = decoder.next_out_of_line();
6268            let handles_before = decoder.remaining_handles();
6269            let (ordinal, inlined, num_bytes, num_handles) =
6270                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
6271
6272            let member_inline_size = match ordinal {
6273                1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6274                2 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6275                3 => {
6276                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
6277                        decoder.context,
6278                    )
6279                }
6280                4 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6281                5 => {
6282                    <TransparentProxy_ as fidl::encoding::TypeMarker>::inline_size(decoder.context)
6283                }
6284                6 => <Redirect as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6285                7 => <Masquerade as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6286                8 => <Mark as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6287                9 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6288                10 => <Reject as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6289                0 => return Err(fidl::Error::UnknownUnionTag),
6290                _ => num_bytes as usize,
6291            };
6292
6293            if inlined != (member_inline_size <= 4) {
6294                return Err(fidl::Error::InvalidInlineBitInEnvelope);
6295            }
6296            let _inner_offset;
6297            if inlined {
6298                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
6299                _inner_offset = offset + 8;
6300            } else {
6301                depth.increment()?;
6302                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6303            }
6304            match ordinal {
6305                1 => {
6306                    #[allow(irrefutable_let_patterns)]
6307                    if let Action::Accept(_) = self {
6308                        // Do nothing, read the value into the object
6309                    } else {
6310                        // Initialize `self` to the right variant
6311                        *self = Action::Accept(fidl::new_empty!(Empty, D));
6312                    }
6313                    #[allow(irrefutable_let_patterns)]
6314                    if let Action::Accept(ref mut val) = self {
6315                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
6316                    } else {
6317                        unreachable!()
6318                    }
6319                }
6320                2 => {
6321                    #[allow(irrefutable_let_patterns)]
6322                    if let Action::Drop(_) = self {
6323                        // Do nothing, read the value into the object
6324                    } else {
6325                        // Initialize `self` to the right variant
6326                        *self = Action::Drop(fidl::new_empty!(Empty, D));
6327                    }
6328                    #[allow(irrefutable_let_patterns)]
6329                    if let Action::Drop(ref mut val) = self {
6330                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
6331                    } else {
6332                        unreachable!()
6333                    }
6334                }
6335                3 => {
6336                    #[allow(irrefutable_let_patterns)]
6337                    if let Action::Jump(_) = self {
6338                        // Do nothing, read the value into the object
6339                    } else {
6340                        // Initialize `self` to the right variant
6341                        *self =
6342                            Action::Jump(fidl::new_empty!(fidl::encoding::BoundedString<255>, D));
6343                    }
6344                    #[allow(irrefutable_let_patterns)]
6345                    if let Action::Jump(ref mut val) = self {
6346                        fidl::decode!(
6347                            fidl::encoding::BoundedString<255>,
6348                            D,
6349                            val,
6350                            decoder,
6351                            _inner_offset,
6352                            depth
6353                        )?;
6354                    } else {
6355                        unreachable!()
6356                    }
6357                }
6358                4 => {
6359                    #[allow(irrefutable_let_patterns)]
6360                    if let Action::Return_(_) = self {
6361                        // Do nothing, read the value into the object
6362                    } else {
6363                        // Initialize `self` to the right variant
6364                        *self = Action::Return_(fidl::new_empty!(Empty, D));
6365                    }
6366                    #[allow(irrefutable_let_patterns)]
6367                    if let Action::Return_(ref mut val) = self {
6368                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
6369                    } else {
6370                        unreachable!()
6371                    }
6372                }
6373                5 => {
6374                    #[allow(irrefutable_let_patterns)]
6375                    if let Action::TransparentProxy(_) = self {
6376                        // Do nothing, read the value into the object
6377                    } else {
6378                        // Initialize `self` to the right variant
6379                        *self = Action::TransparentProxy(fidl::new_empty!(TransparentProxy_, D));
6380                    }
6381                    #[allow(irrefutable_let_patterns)]
6382                    if let Action::TransparentProxy(ref mut val) = self {
6383                        fidl::decode!(TransparentProxy_, D, val, decoder, _inner_offset, depth)?;
6384                    } else {
6385                        unreachable!()
6386                    }
6387                }
6388                6 => {
6389                    #[allow(irrefutable_let_patterns)]
6390                    if let Action::Redirect(_) = self {
6391                        // Do nothing, read the value into the object
6392                    } else {
6393                        // Initialize `self` to the right variant
6394                        *self = Action::Redirect(fidl::new_empty!(Redirect, D));
6395                    }
6396                    #[allow(irrefutable_let_patterns)]
6397                    if let Action::Redirect(ref mut val) = self {
6398                        fidl::decode!(Redirect, D, val, decoder, _inner_offset, depth)?;
6399                    } else {
6400                        unreachable!()
6401                    }
6402                }
6403                7 => {
6404                    #[allow(irrefutable_let_patterns)]
6405                    if let Action::Masquerade(_) = self {
6406                        // Do nothing, read the value into the object
6407                    } else {
6408                        // Initialize `self` to the right variant
6409                        *self = Action::Masquerade(fidl::new_empty!(Masquerade, D));
6410                    }
6411                    #[allow(irrefutable_let_patterns)]
6412                    if let Action::Masquerade(ref mut val) = self {
6413                        fidl::decode!(Masquerade, D, val, decoder, _inner_offset, depth)?;
6414                    } else {
6415                        unreachable!()
6416                    }
6417                }
6418                8 => {
6419                    #[allow(irrefutable_let_patterns)]
6420                    if let Action::Mark(_) = self {
6421                        // Do nothing, read the value into the object
6422                    } else {
6423                        // Initialize `self` to the right variant
6424                        *self = Action::Mark(fidl::new_empty!(Mark, D));
6425                    }
6426                    #[allow(irrefutable_let_patterns)]
6427                    if let Action::Mark(ref mut val) = self {
6428                        fidl::decode!(Mark, D, val, decoder, _inner_offset, depth)?;
6429                    } else {
6430                        unreachable!()
6431                    }
6432                }
6433                9 => {
6434                    #[allow(irrefutable_let_patterns)]
6435                    if let Action::None(_) = self {
6436                        // Do nothing, read the value into the object
6437                    } else {
6438                        // Initialize `self` to the right variant
6439                        *self = Action::None(fidl::new_empty!(Empty, D));
6440                    }
6441                    #[allow(irrefutable_let_patterns)]
6442                    if let Action::None(ref mut val) = self {
6443                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
6444                    } else {
6445                        unreachable!()
6446                    }
6447                }
6448                10 => {
6449                    #[allow(irrefutable_let_patterns)]
6450                    if let Action::Reject(_) = self {
6451                        // Do nothing, read the value into the object
6452                    } else {
6453                        // Initialize `self` to the right variant
6454                        *self = Action::Reject(fidl::new_empty!(Reject, D));
6455                    }
6456                    #[allow(irrefutable_let_patterns)]
6457                    if let Action::Reject(ref mut val) = self {
6458                        fidl::decode!(Reject, D, val, decoder, _inner_offset, depth)?;
6459                    } else {
6460                        unreachable!()
6461                    }
6462                }
6463                #[allow(deprecated)]
6464                ordinal => {
6465                    for _ in 0..num_handles {
6466                        decoder.drop_next_handle()?;
6467                    }
6468                    *self = Action::__SourceBreaking { unknown_ordinal: ordinal };
6469                }
6470            }
6471            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
6472                return Err(fidl::Error::InvalidNumBytesInEnvelope);
6473            }
6474            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6475                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6476            }
6477            Ok(())
6478        }
6479    }
6480
6481    impl fidl::encoding::ValueTypeMarker for Change {
6482        type Borrowed<'a> = &'a Self;
6483        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6484            value
6485        }
6486    }
6487
6488    unsafe impl fidl::encoding::TypeMarker for Change {
6489        type Owned = Self;
6490
6491        #[inline(always)]
6492        fn inline_align(_context: fidl::encoding::Context) -> usize {
6493            8
6494        }
6495
6496        #[inline(always)]
6497        fn inline_size(_context: fidl::encoding::Context) -> usize {
6498            16
6499        }
6500    }
6501
6502    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Change, D> for &Change {
6503        #[inline]
6504        unsafe fn encode(
6505            self,
6506            encoder: &mut fidl::encoding::Encoder<'_, D>,
6507            offset: usize,
6508            _depth: fidl::encoding::Depth,
6509        ) -> fidl::Result<()> {
6510            encoder.debug_check_bounds::<Change>(offset);
6511            encoder.write_num::<u64>(self.ordinal(), offset);
6512            match self {
6513                Change::Create(ref val) => fidl::encoding::encode_in_envelope::<Resource, D>(
6514                    <Resource as fidl::encoding::ValueTypeMarker>::borrow(val),
6515                    encoder,
6516                    offset + 8,
6517                    _depth,
6518                ),
6519                Change::Remove(ref val) => fidl::encoding::encode_in_envelope::<ResourceId, D>(
6520                    <ResourceId as fidl::encoding::ValueTypeMarker>::borrow(val),
6521                    encoder,
6522                    offset + 8,
6523                    _depth,
6524                ),
6525                Change::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
6526            }
6527        }
6528    }
6529
6530    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Change {
6531        #[inline(always)]
6532        fn new_empty() -> Self {
6533            Self::__SourceBreaking { unknown_ordinal: 0 }
6534        }
6535
6536        #[inline]
6537        unsafe fn decode(
6538            &mut self,
6539            decoder: &mut fidl::encoding::Decoder<'_, D>,
6540            offset: usize,
6541            mut depth: fidl::encoding::Depth,
6542        ) -> fidl::Result<()> {
6543            decoder.debug_check_bounds::<Self>(offset);
6544            #[allow(unused_variables)]
6545            let next_out_of_line = decoder.next_out_of_line();
6546            let handles_before = decoder.remaining_handles();
6547            let (ordinal, inlined, num_bytes, num_handles) =
6548                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
6549
6550            let member_inline_size = match ordinal {
6551                1 => <Resource as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6552                2 => <ResourceId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6553                0 => return Err(fidl::Error::UnknownUnionTag),
6554                _ => num_bytes as usize,
6555            };
6556
6557            if inlined != (member_inline_size <= 4) {
6558                return Err(fidl::Error::InvalidInlineBitInEnvelope);
6559            }
6560            let _inner_offset;
6561            if inlined {
6562                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
6563                _inner_offset = offset + 8;
6564            } else {
6565                depth.increment()?;
6566                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6567            }
6568            match ordinal {
6569                1 => {
6570                    #[allow(irrefutable_let_patterns)]
6571                    if let Change::Create(_) = self {
6572                        // Do nothing, read the value into the object
6573                    } else {
6574                        // Initialize `self` to the right variant
6575                        *self = Change::Create(fidl::new_empty!(Resource, D));
6576                    }
6577                    #[allow(irrefutable_let_patterns)]
6578                    if let Change::Create(ref mut val) = self {
6579                        fidl::decode!(Resource, D, val, decoder, _inner_offset, depth)?;
6580                    } else {
6581                        unreachable!()
6582                    }
6583                }
6584                2 => {
6585                    #[allow(irrefutable_let_patterns)]
6586                    if let Change::Remove(_) = self {
6587                        // Do nothing, read the value into the object
6588                    } else {
6589                        // Initialize `self` to the right variant
6590                        *self = Change::Remove(fidl::new_empty!(ResourceId, D));
6591                    }
6592                    #[allow(irrefutable_let_patterns)]
6593                    if let Change::Remove(ref mut val) = self {
6594                        fidl::decode!(ResourceId, D, val, decoder, _inner_offset, depth)?;
6595                    } else {
6596                        unreachable!()
6597                    }
6598                }
6599                #[allow(deprecated)]
6600                ordinal => {
6601                    for _ in 0..num_handles {
6602                        decoder.drop_next_handle()?;
6603                    }
6604                    *self = Change::__SourceBreaking { unknown_ordinal: ordinal };
6605                }
6606            }
6607            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
6608                return Err(fidl::Error::InvalidNumBytesInEnvelope);
6609            }
6610            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6611                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6612            }
6613            Ok(())
6614        }
6615    }
6616
6617    impl fidl::encoding::ValueTypeMarker for Event {
6618        type Borrowed<'a> = &'a Self;
6619        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6620            value
6621        }
6622    }
6623
6624    unsafe impl fidl::encoding::TypeMarker for Event {
6625        type Owned = Self;
6626
6627        #[inline(always)]
6628        fn inline_align(_context: fidl::encoding::Context) -> usize {
6629            8
6630        }
6631
6632        #[inline(always)]
6633        fn inline_size(_context: fidl::encoding::Context) -> usize {
6634            16
6635        }
6636    }
6637
6638    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Event, D> for &Event {
6639        #[inline]
6640        unsafe fn encode(
6641            self,
6642            encoder: &mut fidl::encoding::Encoder<'_, D>,
6643            offset: usize,
6644            _depth: fidl::encoding::Depth,
6645        ) -> fidl::Result<()> {
6646            encoder.debug_check_bounds::<Event>(offset);
6647            encoder.write_num::<u64>(self.ordinal(), offset);
6648            match self {
6649                Event::Existing(ref val) => {
6650                    fidl::encoding::encode_in_envelope::<ExistingResource, D>(
6651                        <ExistingResource as fidl::encoding::ValueTypeMarker>::borrow(val),
6652                        encoder,
6653                        offset + 8,
6654                        _depth,
6655                    )
6656                }
6657                Event::Added(ref val) => fidl::encoding::encode_in_envelope::<AddedResource, D>(
6658                    <AddedResource as fidl::encoding::ValueTypeMarker>::borrow(val),
6659                    encoder,
6660                    offset + 8,
6661                    _depth,
6662                ),
6663                Event::Removed(ref val) => {
6664                    fidl::encoding::encode_in_envelope::<RemovedResource, D>(
6665                        <RemovedResource as fidl::encoding::ValueTypeMarker>::borrow(val),
6666                        encoder,
6667                        offset + 8,
6668                        _depth,
6669                    )
6670                }
6671                Event::Idle(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
6672                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
6673                    encoder,
6674                    offset + 8,
6675                    _depth,
6676                ),
6677                Event::EndOfUpdate(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
6678                    <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
6679                    encoder,
6680                    offset + 8,
6681                    _depth,
6682                ),
6683                Event::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
6684            }
6685        }
6686    }
6687
6688    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Event {
6689        #[inline(always)]
6690        fn new_empty() -> Self {
6691            Self::__SourceBreaking { unknown_ordinal: 0 }
6692        }
6693
6694        #[inline]
6695        unsafe fn decode(
6696            &mut self,
6697            decoder: &mut fidl::encoding::Decoder<'_, D>,
6698            offset: usize,
6699            mut depth: fidl::encoding::Depth,
6700        ) -> fidl::Result<()> {
6701            decoder.debug_check_bounds::<Self>(offset);
6702            #[allow(unused_variables)]
6703            let next_out_of_line = decoder.next_out_of_line();
6704            let handles_before = decoder.remaining_handles();
6705            let (ordinal, inlined, num_bytes, num_handles) =
6706                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
6707
6708            let member_inline_size = match ordinal {
6709                1 => <ExistingResource as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6710                2 => <AddedResource as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6711                3 => <RemovedResource as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6712                4 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6713                5 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6714                0 => return Err(fidl::Error::UnknownUnionTag),
6715                _ => num_bytes as usize,
6716            };
6717
6718            if inlined != (member_inline_size <= 4) {
6719                return Err(fidl::Error::InvalidInlineBitInEnvelope);
6720            }
6721            let _inner_offset;
6722            if inlined {
6723                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
6724                _inner_offset = offset + 8;
6725            } else {
6726                depth.increment()?;
6727                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6728            }
6729            match ordinal {
6730                1 => {
6731                    #[allow(irrefutable_let_patterns)]
6732                    if let Event::Existing(_) = self {
6733                        // Do nothing, read the value into the object
6734                    } else {
6735                        // Initialize `self` to the right variant
6736                        *self = Event::Existing(fidl::new_empty!(ExistingResource, D));
6737                    }
6738                    #[allow(irrefutable_let_patterns)]
6739                    if let Event::Existing(ref mut val) = self {
6740                        fidl::decode!(ExistingResource, D, val, decoder, _inner_offset, depth)?;
6741                    } else {
6742                        unreachable!()
6743                    }
6744                }
6745                2 => {
6746                    #[allow(irrefutable_let_patterns)]
6747                    if let Event::Added(_) = self {
6748                        // Do nothing, read the value into the object
6749                    } else {
6750                        // Initialize `self` to the right variant
6751                        *self = Event::Added(fidl::new_empty!(AddedResource, D));
6752                    }
6753                    #[allow(irrefutable_let_patterns)]
6754                    if let Event::Added(ref mut val) = self {
6755                        fidl::decode!(AddedResource, D, val, decoder, _inner_offset, depth)?;
6756                    } else {
6757                        unreachable!()
6758                    }
6759                }
6760                3 => {
6761                    #[allow(irrefutable_let_patterns)]
6762                    if let Event::Removed(_) = self {
6763                        // Do nothing, read the value into the object
6764                    } else {
6765                        // Initialize `self` to the right variant
6766                        *self = Event::Removed(fidl::new_empty!(RemovedResource, D));
6767                    }
6768                    #[allow(irrefutable_let_patterns)]
6769                    if let Event::Removed(ref mut val) = self {
6770                        fidl::decode!(RemovedResource, D, val, decoder, _inner_offset, depth)?;
6771                    } else {
6772                        unreachable!()
6773                    }
6774                }
6775                4 => {
6776                    #[allow(irrefutable_let_patterns)]
6777                    if let Event::Idle(_) = self {
6778                        // Do nothing, read the value into the object
6779                    } else {
6780                        // Initialize `self` to the right variant
6781                        *self = Event::Idle(fidl::new_empty!(Empty, D));
6782                    }
6783                    #[allow(irrefutable_let_patterns)]
6784                    if let Event::Idle(ref mut val) = self {
6785                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
6786                    } else {
6787                        unreachable!()
6788                    }
6789                }
6790                5 => {
6791                    #[allow(irrefutable_let_patterns)]
6792                    if let Event::EndOfUpdate(_) = self {
6793                        // Do nothing, read the value into the object
6794                    } else {
6795                        // Initialize `self` to the right variant
6796                        *self = Event::EndOfUpdate(fidl::new_empty!(Empty, D));
6797                    }
6798                    #[allow(irrefutable_let_patterns)]
6799                    if let Event::EndOfUpdate(ref mut val) = self {
6800                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
6801                    } else {
6802                        unreachable!()
6803                    }
6804                }
6805                #[allow(deprecated)]
6806                ordinal => {
6807                    for _ in 0..num_handles {
6808                        decoder.drop_next_handle()?;
6809                    }
6810                    *self = Event::__SourceBreaking { unknown_ordinal: ordinal };
6811                }
6812            }
6813            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
6814                return Err(fidl::Error::InvalidNumBytesInEnvelope);
6815            }
6816            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6817                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6818            }
6819            Ok(())
6820        }
6821    }
6822
6823    impl fidl::encoding::ValueTypeMarker for MarkAction {
6824        type Borrowed<'a> = &'a Self;
6825        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6826            value
6827        }
6828    }
6829
6830    unsafe impl fidl::encoding::TypeMarker for MarkAction {
6831        type Owned = Self;
6832
6833        #[inline(always)]
6834        fn inline_align(_context: fidl::encoding::Context) -> usize {
6835            8
6836        }
6837
6838        #[inline(always)]
6839        fn inline_size(_context: fidl::encoding::Context) -> usize {
6840            16
6841        }
6842    }
6843
6844    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<MarkAction, D>
6845        for &MarkAction
6846    {
6847        #[inline]
6848        unsafe fn encode(
6849            self,
6850            encoder: &mut fidl::encoding::Encoder<'_, D>,
6851            offset: usize,
6852            _depth: fidl::encoding::Depth,
6853        ) -> fidl::Result<()> {
6854            encoder.debug_check_bounds::<MarkAction>(offset);
6855            encoder.write_num::<u64>(self.ordinal(), offset);
6856            match self {
6857                MarkAction::SetMark(ref val) => fidl::encoding::encode_in_envelope::<SetMark, D>(
6858                    <SetMark as fidl::encoding::ValueTypeMarker>::borrow(val),
6859                    encoder,
6860                    offset + 8,
6861                    _depth,
6862                ),
6863                MarkAction::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
6864            }
6865        }
6866    }
6867
6868    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for MarkAction {
6869        #[inline(always)]
6870        fn new_empty() -> Self {
6871            Self::__SourceBreaking { unknown_ordinal: 0 }
6872        }
6873
6874        #[inline]
6875        unsafe fn decode(
6876            &mut self,
6877            decoder: &mut fidl::encoding::Decoder<'_, D>,
6878            offset: usize,
6879            mut depth: fidl::encoding::Depth,
6880        ) -> fidl::Result<()> {
6881            decoder.debug_check_bounds::<Self>(offset);
6882            #[allow(unused_variables)]
6883            let next_out_of_line = decoder.next_out_of_line();
6884            let handles_before = decoder.remaining_handles();
6885            let (ordinal, inlined, num_bytes, num_handles) =
6886                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
6887
6888            let member_inline_size = match ordinal {
6889                1 => <SetMark as fidl::encoding::TypeMarker>::inline_size(decoder.context),
6890                0 => return Err(fidl::Error::UnknownUnionTag),
6891                _ => num_bytes as usize,
6892            };
6893
6894            if inlined != (member_inline_size <= 4) {
6895                return Err(fidl::Error::InvalidInlineBitInEnvelope);
6896            }
6897            let _inner_offset;
6898            if inlined {
6899                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
6900                _inner_offset = offset + 8;
6901            } else {
6902                depth.increment()?;
6903                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
6904            }
6905            match ordinal {
6906                1 => {
6907                    #[allow(irrefutable_let_patterns)]
6908                    if let MarkAction::SetMark(_) = self {
6909                        // Do nothing, read the value into the object
6910                    } else {
6911                        // Initialize `self` to the right variant
6912                        *self = MarkAction::SetMark(fidl::new_empty!(SetMark, D));
6913                    }
6914                    #[allow(irrefutable_let_patterns)]
6915                    if let MarkAction::SetMark(ref mut val) = self {
6916                        fidl::decode!(SetMark, D, val, decoder, _inner_offset, depth)?;
6917                    } else {
6918                        unreachable!()
6919                    }
6920                }
6921                #[allow(deprecated)]
6922                ordinal => {
6923                    for _ in 0..num_handles {
6924                        decoder.drop_next_handle()?;
6925                    }
6926                    *self = MarkAction::__SourceBreaking { unknown_ordinal: ordinal };
6927                }
6928            }
6929            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
6930                return Err(fidl::Error::InvalidNumBytesInEnvelope);
6931            }
6932            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
6933                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
6934            }
6935            Ok(())
6936        }
6937    }
6938
6939    impl fidl::encoding::ValueTypeMarker for Resource {
6940        type Borrowed<'a> = &'a Self;
6941        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
6942            value
6943        }
6944    }
6945
6946    unsafe impl fidl::encoding::TypeMarker for Resource {
6947        type Owned = Self;
6948
6949        #[inline(always)]
6950        fn inline_align(_context: fidl::encoding::Context) -> usize {
6951            8
6952        }
6953
6954        #[inline(always)]
6955        fn inline_size(_context: fidl::encoding::Context) -> usize {
6956            16
6957        }
6958    }
6959
6960    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Resource, D> for &Resource {
6961        #[inline]
6962        unsafe fn encode(
6963            self,
6964            encoder: &mut fidl::encoding::Encoder<'_, D>,
6965            offset: usize,
6966            _depth: fidl::encoding::Depth,
6967        ) -> fidl::Result<()> {
6968            encoder.debug_check_bounds::<Resource>(offset);
6969            encoder.write_num::<u64>(self.ordinal(), offset);
6970            match self {
6971                Resource::Namespace(ref val) => fidl::encoding::encode_in_envelope::<Namespace, D>(
6972                    <Namespace as fidl::encoding::ValueTypeMarker>::borrow(val),
6973                    encoder,
6974                    offset + 8,
6975                    _depth,
6976                ),
6977                Resource::Routine(ref val) => fidl::encoding::encode_in_envelope::<Routine, D>(
6978                    <Routine as fidl::encoding::ValueTypeMarker>::borrow(val),
6979                    encoder,
6980                    offset + 8,
6981                    _depth,
6982                ),
6983                Resource::Rule(ref val) => fidl::encoding::encode_in_envelope::<Rule, D>(
6984                    <Rule as fidl::encoding::ValueTypeMarker>::borrow(val),
6985                    encoder,
6986                    offset + 8,
6987                    _depth,
6988                ),
6989                Resource::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
6990            }
6991        }
6992    }
6993
6994    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Resource {
6995        #[inline(always)]
6996        fn new_empty() -> Self {
6997            Self::__SourceBreaking { unknown_ordinal: 0 }
6998        }
6999
7000        #[inline]
7001        unsafe fn decode(
7002            &mut self,
7003            decoder: &mut fidl::encoding::Decoder<'_, D>,
7004            offset: usize,
7005            mut depth: fidl::encoding::Depth,
7006        ) -> fidl::Result<()> {
7007            decoder.debug_check_bounds::<Self>(offset);
7008            #[allow(unused_variables)]
7009            let next_out_of_line = decoder.next_out_of_line();
7010            let handles_before = decoder.remaining_handles();
7011            let (ordinal, inlined, num_bytes, num_handles) =
7012                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
7013
7014            let member_inline_size = match ordinal {
7015                1 => <Namespace as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7016                2 => <Routine as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7017                3 => <Rule as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7018                0 => return Err(fidl::Error::UnknownUnionTag),
7019                _ => num_bytes as usize,
7020            };
7021
7022            if inlined != (member_inline_size <= 4) {
7023                return Err(fidl::Error::InvalidInlineBitInEnvelope);
7024            }
7025            let _inner_offset;
7026            if inlined {
7027                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
7028                _inner_offset = offset + 8;
7029            } else {
7030                depth.increment()?;
7031                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7032            }
7033            match ordinal {
7034                1 => {
7035                    #[allow(irrefutable_let_patterns)]
7036                    if let Resource::Namespace(_) = self {
7037                        // Do nothing, read the value into the object
7038                    } else {
7039                        // Initialize `self` to the right variant
7040                        *self = Resource::Namespace(fidl::new_empty!(Namespace, D));
7041                    }
7042                    #[allow(irrefutable_let_patterns)]
7043                    if let Resource::Namespace(ref mut val) = self {
7044                        fidl::decode!(Namespace, D, val, decoder, _inner_offset, depth)?;
7045                    } else {
7046                        unreachable!()
7047                    }
7048                }
7049                2 => {
7050                    #[allow(irrefutable_let_patterns)]
7051                    if let Resource::Routine(_) = self {
7052                        // Do nothing, read the value into the object
7053                    } else {
7054                        // Initialize `self` to the right variant
7055                        *self = Resource::Routine(fidl::new_empty!(Routine, D));
7056                    }
7057                    #[allow(irrefutable_let_patterns)]
7058                    if let Resource::Routine(ref mut val) = self {
7059                        fidl::decode!(Routine, D, val, decoder, _inner_offset, depth)?;
7060                    } else {
7061                        unreachable!()
7062                    }
7063                }
7064                3 => {
7065                    #[allow(irrefutable_let_patterns)]
7066                    if let Resource::Rule(_) = self {
7067                        // Do nothing, read the value into the object
7068                    } else {
7069                        // Initialize `self` to the right variant
7070                        *self = Resource::Rule(fidl::new_empty!(Rule, D));
7071                    }
7072                    #[allow(irrefutable_let_patterns)]
7073                    if let Resource::Rule(ref mut val) = self {
7074                        fidl::decode!(Rule, D, val, decoder, _inner_offset, depth)?;
7075                    } else {
7076                        unreachable!()
7077                    }
7078                }
7079                #[allow(deprecated)]
7080                ordinal => {
7081                    for _ in 0..num_handles {
7082                        decoder.drop_next_handle()?;
7083                    }
7084                    *self = Resource::__SourceBreaking { unknown_ordinal: ordinal };
7085                }
7086            }
7087            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
7088                return Err(fidl::Error::InvalidNumBytesInEnvelope);
7089            }
7090            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7091                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7092            }
7093            Ok(())
7094        }
7095    }
7096
7097    impl fidl::encoding::ValueTypeMarker for ResourceId {
7098        type Borrowed<'a> = &'a Self;
7099        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7100            value
7101        }
7102    }
7103
7104    unsafe impl fidl::encoding::TypeMarker for ResourceId {
7105        type Owned = Self;
7106
7107        #[inline(always)]
7108        fn inline_align(_context: fidl::encoding::Context) -> usize {
7109            8
7110        }
7111
7112        #[inline(always)]
7113        fn inline_size(_context: fidl::encoding::Context) -> usize {
7114            16
7115        }
7116    }
7117
7118    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ResourceId, D>
7119        for &ResourceId
7120    {
7121        #[inline]
7122        unsafe fn encode(
7123            self,
7124            encoder: &mut fidl::encoding::Encoder<'_, D>,
7125            offset: usize,
7126            _depth: fidl::encoding::Depth,
7127        ) -> fidl::Result<()> {
7128            encoder.debug_check_bounds::<ResourceId>(offset);
7129            encoder.write_num::<u64>(self.ordinal(), offset);
7130            match self {
7131                ResourceId::Namespace(ref val) => fidl::encoding::encode_in_envelope::<
7132                    fidl::encoding::BoundedString<255>,
7133                    D,
7134                >(
7135                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
7136                        val,
7137                    ),
7138                    encoder,
7139                    offset + 8,
7140                    _depth,
7141                ),
7142                ResourceId::Routine(ref val) => fidl::encoding::encode_in_envelope::<RoutineId, D>(
7143                    <RoutineId as fidl::encoding::ValueTypeMarker>::borrow(val),
7144                    encoder,
7145                    offset + 8,
7146                    _depth,
7147                ),
7148                ResourceId::Rule(ref val) => fidl::encoding::encode_in_envelope::<RuleId, D>(
7149                    <RuleId as fidl::encoding::ValueTypeMarker>::borrow(val),
7150                    encoder,
7151                    offset + 8,
7152                    _depth,
7153                ),
7154                ResourceId::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
7155            }
7156        }
7157    }
7158
7159    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ResourceId {
7160        #[inline(always)]
7161        fn new_empty() -> Self {
7162            Self::__SourceBreaking { unknown_ordinal: 0 }
7163        }
7164
7165        #[inline]
7166        unsafe fn decode(
7167            &mut self,
7168            decoder: &mut fidl::encoding::Decoder<'_, D>,
7169            offset: usize,
7170            mut depth: fidl::encoding::Depth,
7171        ) -> fidl::Result<()> {
7172            decoder.debug_check_bounds::<Self>(offset);
7173            #[allow(unused_variables)]
7174            let next_out_of_line = decoder.next_out_of_line();
7175            let handles_before = decoder.remaining_handles();
7176            let (ordinal, inlined, num_bytes, num_handles) =
7177                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
7178
7179            let member_inline_size = match ordinal {
7180                1 => {
7181                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
7182                        decoder.context,
7183                    )
7184                }
7185                2 => <RoutineId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7186                3 => <RuleId as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7187                0 => return Err(fidl::Error::UnknownUnionTag),
7188                _ => num_bytes as usize,
7189            };
7190
7191            if inlined != (member_inline_size <= 4) {
7192                return Err(fidl::Error::InvalidInlineBitInEnvelope);
7193            }
7194            let _inner_offset;
7195            if inlined {
7196                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
7197                _inner_offset = offset + 8;
7198            } else {
7199                depth.increment()?;
7200                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7201            }
7202            match ordinal {
7203                1 => {
7204                    #[allow(irrefutable_let_patterns)]
7205                    if let ResourceId::Namespace(_) = self {
7206                        // Do nothing, read the value into the object
7207                    } else {
7208                        // Initialize `self` to the right variant
7209                        *self = ResourceId::Namespace(fidl::new_empty!(
7210                            fidl::encoding::BoundedString<255>,
7211                            D
7212                        ));
7213                    }
7214                    #[allow(irrefutable_let_patterns)]
7215                    if let ResourceId::Namespace(ref mut val) = self {
7216                        fidl::decode!(
7217                            fidl::encoding::BoundedString<255>,
7218                            D,
7219                            val,
7220                            decoder,
7221                            _inner_offset,
7222                            depth
7223                        )?;
7224                    } else {
7225                        unreachable!()
7226                    }
7227                }
7228                2 => {
7229                    #[allow(irrefutable_let_patterns)]
7230                    if let ResourceId::Routine(_) = self {
7231                        // Do nothing, read the value into the object
7232                    } else {
7233                        // Initialize `self` to the right variant
7234                        *self = ResourceId::Routine(fidl::new_empty!(RoutineId, D));
7235                    }
7236                    #[allow(irrefutable_let_patterns)]
7237                    if let ResourceId::Routine(ref mut val) = self {
7238                        fidl::decode!(RoutineId, D, val, decoder, _inner_offset, depth)?;
7239                    } else {
7240                        unreachable!()
7241                    }
7242                }
7243                3 => {
7244                    #[allow(irrefutable_let_patterns)]
7245                    if let ResourceId::Rule(_) = self {
7246                        // Do nothing, read the value into the object
7247                    } else {
7248                        // Initialize `self` to the right variant
7249                        *self = ResourceId::Rule(fidl::new_empty!(RuleId, D));
7250                    }
7251                    #[allow(irrefutable_let_patterns)]
7252                    if let ResourceId::Rule(ref mut val) = self {
7253                        fidl::decode!(RuleId, D, val, decoder, _inner_offset, depth)?;
7254                    } else {
7255                        unreachable!()
7256                    }
7257                }
7258                #[allow(deprecated)]
7259                ordinal => {
7260                    for _ in 0..num_handles {
7261                        decoder.drop_next_handle()?;
7262                    }
7263                    *self = ResourceId::__SourceBreaking { unknown_ordinal: ordinal };
7264                }
7265            }
7266            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
7267                return Err(fidl::Error::InvalidNumBytesInEnvelope);
7268            }
7269            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7270                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7271            }
7272            Ok(())
7273        }
7274    }
7275
7276    impl fidl::encoding::ValueTypeMarker for RoutineType {
7277        type Borrowed<'a> = &'a Self;
7278        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7279            value
7280        }
7281    }
7282
7283    unsafe impl fidl::encoding::TypeMarker for RoutineType {
7284        type Owned = Self;
7285
7286        #[inline(always)]
7287        fn inline_align(_context: fidl::encoding::Context) -> usize {
7288            8
7289        }
7290
7291        #[inline(always)]
7292        fn inline_size(_context: fidl::encoding::Context) -> usize {
7293            16
7294        }
7295    }
7296
7297    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RoutineType, D>
7298        for &RoutineType
7299    {
7300        #[inline]
7301        unsafe fn encode(
7302            self,
7303            encoder: &mut fidl::encoding::Encoder<'_, D>,
7304            offset: usize,
7305            _depth: fidl::encoding::Depth,
7306        ) -> fidl::Result<()> {
7307            encoder.debug_check_bounds::<RoutineType>(offset);
7308            encoder.write_num::<u64>(self.ordinal(), offset);
7309            match self {
7310                RoutineType::Ip(ref val) => fidl::encoding::encode_in_envelope::<IpRoutine, D>(
7311                    <IpRoutine as fidl::encoding::ValueTypeMarker>::borrow(val),
7312                    encoder,
7313                    offset + 8,
7314                    _depth,
7315                ),
7316                RoutineType::Nat(ref val) => fidl::encoding::encode_in_envelope::<NatRoutine, D>(
7317                    <NatRoutine as fidl::encoding::ValueTypeMarker>::borrow(val),
7318                    encoder,
7319                    offset + 8,
7320                    _depth,
7321                ),
7322                RoutineType::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
7323            }
7324        }
7325    }
7326
7327    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RoutineType {
7328        #[inline(always)]
7329        fn new_empty() -> Self {
7330            Self::__SourceBreaking { unknown_ordinal: 0 }
7331        }
7332
7333        #[inline]
7334        unsafe fn decode(
7335            &mut self,
7336            decoder: &mut fidl::encoding::Decoder<'_, D>,
7337            offset: usize,
7338            mut depth: fidl::encoding::Depth,
7339        ) -> fidl::Result<()> {
7340            decoder.debug_check_bounds::<Self>(offset);
7341            #[allow(unused_variables)]
7342            let next_out_of_line = decoder.next_out_of_line();
7343            let handles_before = decoder.remaining_handles();
7344            let (ordinal, inlined, num_bytes, num_handles) =
7345                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
7346
7347            let member_inline_size = match ordinal {
7348                1 => <IpRoutine as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7349                2 => <NatRoutine as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7350                0 => return Err(fidl::Error::UnknownUnionTag),
7351                _ => num_bytes as usize,
7352            };
7353
7354            if inlined != (member_inline_size <= 4) {
7355                return Err(fidl::Error::InvalidInlineBitInEnvelope);
7356            }
7357            let _inner_offset;
7358            if inlined {
7359                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
7360                _inner_offset = offset + 8;
7361            } else {
7362                depth.increment()?;
7363                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7364            }
7365            match ordinal {
7366                1 => {
7367                    #[allow(irrefutable_let_patterns)]
7368                    if let RoutineType::Ip(_) = self {
7369                        // Do nothing, read the value into the object
7370                    } else {
7371                        // Initialize `self` to the right variant
7372                        *self = RoutineType::Ip(fidl::new_empty!(IpRoutine, D));
7373                    }
7374                    #[allow(irrefutable_let_patterns)]
7375                    if let RoutineType::Ip(ref mut val) = self {
7376                        fidl::decode!(IpRoutine, D, val, decoder, _inner_offset, depth)?;
7377                    } else {
7378                        unreachable!()
7379                    }
7380                }
7381                2 => {
7382                    #[allow(irrefutable_let_patterns)]
7383                    if let RoutineType::Nat(_) = self {
7384                        // Do nothing, read the value into the object
7385                    } else {
7386                        // Initialize `self` to the right variant
7387                        *self = RoutineType::Nat(fidl::new_empty!(NatRoutine, D));
7388                    }
7389                    #[allow(irrefutable_let_patterns)]
7390                    if let RoutineType::Nat(ref mut val) = self {
7391                        fidl::decode!(NatRoutine, D, val, decoder, _inner_offset, depth)?;
7392                    } else {
7393                        unreachable!()
7394                    }
7395                }
7396                #[allow(deprecated)]
7397                ordinal => {
7398                    for _ in 0..num_handles {
7399                        decoder.drop_next_handle()?;
7400                    }
7401                    *self = RoutineType::__SourceBreaking { unknown_ordinal: ordinal };
7402                }
7403            }
7404            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
7405                return Err(fidl::Error::InvalidNumBytesInEnvelope);
7406            }
7407            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7408                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7409            }
7410            Ok(())
7411        }
7412    }
7413
7414    impl fidl::encoding::ValueTypeMarker for TransparentProxy_ {
7415        type Borrowed<'a> = &'a Self;
7416        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
7417            value
7418        }
7419    }
7420
7421    unsafe impl fidl::encoding::TypeMarker for TransparentProxy_ {
7422        type Owned = Self;
7423
7424        #[inline(always)]
7425        fn inline_align(_context: fidl::encoding::Context) -> usize {
7426            8
7427        }
7428
7429        #[inline(always)]
7430        fn inline_size(_context: fidl::encoding::Context) -> usize {
7431            16
7432        }
7433    }
7434
7435    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<TransparentProxy_, D>
7436        for &TransparentProxy_
7437    {
7438        #[inline]
7439        unsafe fn encode(
7440            self,
7441            encoder: &mut fidl::encoding::Encoder<'_, D>,
7442            offset: usize,
7443            _depth: fidl::encoding::Depth,
7444        ) -> fidl::Result<()> {
7445            encoder.debug_check_bounds::<TransparentProxy_>(offset);
7446            encoder.write_num::<u64>(self.ordinal(), offset);
7447            match self {
7448                TransparentProxy_::LocalAddr(ref val) => fidl::encoding::encode_in_envelope::<
7449                    fidl_fuchsia_net_common::IpAddress,
7450                    D,
7451                >(
7452                    <fidl_fuchsia_net_common::IpAddress as fidl::encoding::ValueTypeMarker>::borrow(
7453                        val,
7454                    ),
7455                    encoder,
7456                    offset + 8,
7457                    _depth,
7458                ),
7459                TransparentProxy_::LocalPort(ref val) => {
7460                    fidl::encoding::encode_in_envelope::<u16, D>(
7461                        <u16 as fidl::encoding::ValueTypeMarker>::borrow(val),
7462                        encoder,
7463                        offset + 8,
7464                        _depth,
7465                    )
7466                }
7467                TransparentProxy_::LocalAddrAndPort(ref val) => {
7468                    fidl::encoding::encode_in_envelope::<SocketAddr, D>(
7469                        <SocketAddr as fidl::encoding::ValueTypeMarker>::borrow(val),
7470                        encoder,
7471                        offset + 8,
7472                        _depth,
7473                    )
7474                }
7475                TransparentProxy_::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
7476            }
7477        }
7478    }
7479
7480    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for TransparentProxy_ {
7481        #[inline(always)]
7482        fn new_empty() -> Self {
7483            Self::__SourceBreaking { unknown_ordinal: 0 }
7484        }
7485
7486        #[inline]
7487        unsafe fn decode(
7488            &mut self,
7489            decoder: &mut fidl::encoding::Decoder<'_, D>,
7490            offset: usize,
7491            mut depth: fidl::encoding::Depth,
7492        ) -> fidl::Result<()> {
7493            decoder.debug_check_bounds::<Self>(offset);
7494            #[allow(unused_variables)]
7495            let next_out_of_line = decoder.next_out_of_line();
7496            let handles_before = decoder.remaining_handles();
7497            let (ordinal, inlined, num_bytes, num_handles) =
7498                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
7499
7500            let member_inline_size = match ordinal {
7501                1 => {
7502                    <fidl_fuchsia_net_common::IpAddress as fidl::encoding::TypeMarker>::inline_size(
7503                        decoder.context,
7504                    )
7505                }
7506                2 => <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7507                3 => <SocketAddr as fidl::encoding::TypeMarker>::inline_size(decoder.context),
7508                0 => return Err(fidl::Error::UnknownUnionTag),
7509                _ => num_bytes as usize,
7510            };
7511
7512            if inlined != (member_inline_size <= 4) {
7513                return Err(fidl::Error::InvalidInlineBitInEnvelope);
7514            }
7515            let _inner_offset;
7516            if inlined {
7517                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
7518                _inner_offset = offset + 8;
7519            } else {
7520                depth.increment()?;
7521                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
7522            }
7523            match ordinal {
7524                1 => {
7525                    #[allow(irrefutable_let_patterns)]
7526                    if let TransparentProxy_::LocalAddr(_) = self {
7527                        // Do nothing, read the value into the object
7528                    } else {
7529                        // Initialize `self` to the right variant
7530                        *self = TransparentProxy_::LocalAddr(fidl::new_empty!(
7531                            fidl_fuchsia_net_common::IpAddress,
7532                            D
7533                        ));
7534                    }
7535                    #[allow(irrefutable_let_patterns)]
7536                    if let TransparentProxy_::LocalAddr(ref mut val) = self {
7537                        fidl::decode!(
7538                            fidl_fuchsia_net_common::IpAddress,
7539                            D,
7540                            val,
7541                            decoder,
7542                            _inner_offset,
7543                            depth
7544                        )?;
7545                    } else {
7546                        unreachable!()
7547                    }
7548                }
7549                2 => {
7550                    #[allow(irrefutable_let_patterns)]
7551                    if let TransparentProxy_::LocalPort(_) = self {
7552                        // Do nothing, read the value into the object
7553                    } else {
7554                        // Initialize `self` to the right variant
7555                        *self = TransparentProxy_::LocalPort(fidl::new_empty!(u16, D));
7556                    }
7557                    #[allow(irrefutable_let_patterns)]
7558                    if let TransparentProxy_::LocalPort(ref mut val) = self {
7559                        fidl::decode!(u16, D, val, decoder, _inner_offset, depth)?;
7560                    } else {
7561                        unreachable!()
7562                    }
7563                }
7564                3 => {
7565                    #[allow(irrefutable_let_patterns)]
7566                    if let TransparentProxy_::LocalAddrAndPort(_) = self {
7567                        // Do nothing, read the value into the object
7568                    } else {
7569                        // Initialize `self` to the right variant
7570                        *self =
7571                            TransparentProxy_::LocalAddrAndPort(fidl::new_empty!(SocketAddr, D));
7572                    }
7573                    #[allow(irrefutable_let_patterns)]
7574                    if let TransparentProxy_::LocalAddrAndPort(ref mut val) = self {
7575                        fidl::decode!(SocketAddr, D, val, decoder, _inner_offset, depth)?;
7576                    } else {
7577                        unreachable!()
7578                    }
7579                }
7580                #[allow(deprecated)]
7581                ordinal => {
7582                    for _ in 0..num_handles {
7583                        decoder.drop_next_handle()?;
7584                    }
7585                    *self = TransparentProxy_::__SourceBreaking { unknown_ordinal: ordinal };
7586                }
7587            }
7588            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
7589                return Err(fidl::Error::InvalidNumBytesInEnvelope);
7590            }
7591            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
7592                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
7593            }
7594            Ok(())
7595        }
7596    }
7597}