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