Skip to main content

fidl_fuchsia_net_policy_properties_common/
fidl_fuchsia_net_policy_properties_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
11bitflags! {
12    /// Capabilities of a network.
13    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
14    pub struct NetworkCapability: u32 {
15        const UNMETERED = 1;
16        const UNCONGESTED = 2;
17        const NOT_BANDWIDTH_CONSTRAINED = 4;
18    }
19}
20
21impl NetworkCapability {
22    #[inline(always)]
23    pub fn from_bits_allow_unknown(bits: u32) -> Self {
24        Self::from_bits_retain(bits)
25    }
26
27    #[inline(always)]
28    pub fn has_unknown_bits(&self) -> bool {
29        self.get_unknown_bits() != 0
30    }
31
32    #[inline(always)]
33    pub fn get_unknown_bits(&self) -> u32 {
34        self.bits() & !Self::all().bits()
35    }
36}
37
38bitflags! {
39    /// A set of properties that a client may be interested in.
40    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
41    pub struct PropertyInterest: u32 {
42        const SOCKET_MARKS = 1;
43        const DNS_CONFIGURATION = 2;
44    }
45}
46
47impl PropertyInterest {
48    #[inline(always)]
49    pub fn from_bits_allow_unknown(bits: u32) -> Self {
50        Self::from_bits_retain(bits)
51    }
52
53    #[inline(always)]
54    pub fn has_unknown_bits(&self) -> bool {
55        self.get_unknown_bits() != 0
56    }
57
58    #[inline(always)]
59    pub fn get_unknown_bits(&self) -> u32 {
60        self.bits() & !Self::all().bits()
61    }
62}
63
64bitflags! {
65    /// A bitset to represent whether a condition is true across the
66    /// IPv4 and IPv6 protocols.
67    #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
68    pub struct ProtoProperties: u8 {
69        const V4 = 1;
70        const V6 = 2;
71    }
72}
73
74impl ProtoProperties {}
75
76/// The tier of connectivity for a network.
77#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
78pub enum ConnectivityState {
79    /// Indicates that a network cannot communicate with local
80    /// devices or reach the Internet.
81    NoConnectivity,
82    /// Indicates that a network can only communicate with other
83    /// devices on the local network.
84    LocalConnectivity,
85    /// Indicates that a network can only partially reach the Internet.
86    /// For example, it can send ICMP probes, but cannot resolve DNS.
87    PartialConnectivity,
88    /// Indicates that a network has been verified to reach the Internet.
89    /// For example, by successfully resolving DNS and HTTP requests.
90    FullConnectivity,
91    #[doc(hidden)]
92    __SourceBreaking { unknown_ordinal: u32 },
93}
94
95/// Pattern that matches an unknown `ConnectivityState` member.
96#[macro_export]
97macro_rules! ConnectivityStateUnknown {
98    () => {
99        _
100    };
101}
102
103impl ConnectivityState {
104    #[inline]
105    pub fn from_primitive(prim: u32) -> Option<Self> {
106        match prim {
107            1 => Some(Self::NoConnectivity),
108            3 => Some(Self::LocalConnectivity),
109            4 => Some(Self::PartialConnectivity),
110            5 => Some(Self::FullConnectivity),
111            _ => None,
112        }
113    }
114
115    #[inline]
116    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
117        match prim {
118            1 => Self::NoConnectivity,
119            3 => Self::LocalConnectivity,
120            4 => Self::PartialConnectivity,
121            5 => Self::FullConnectivity,
122            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
123        }
124    }
125
126    #[inline]
127    pub fn unknown() -> Self {
128        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
129    }
130
131    #[inline]
132    pub const fn into_primitive(self) -> u32 {
133        match self {
134            Self::NoConnectivity => 1,
135            Self::LocalConnectivity => 3,
136            Self::PartialConnectivity => 4,
137            Self::FullConnectivity => 5,
138            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
139        }
140    }
141
142    #[inline]
143    pub fn is_unknown(&self) -> bool {
144        match self {
145            Self::__SourceBreaking { unknown_ordinal: _ } => true,
146            _ => false,
147        }
148    }
149}
150
151#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
152pub enum LookupError {
153    NotFound,
154    #[doc(hidden)]
155    __SourceBreaking {
156        unknown_ordinal: u32,
157    },
158}
159
160/// Pattern that matches an unknown `LookupError` member.
161#[macro_export]
162macro_rules! LookupErrorUnknown {
163    () => {
164        _
165    };
166}
167
168impl LookupError {
169    #[inline]
170    pub fn from_primitive(prim: u32) -> Option<Self> {
171        match prim {
172            1 => Some(Self::NotFound),
173            _ => None,
174        }
175    }
176
177    #[inline]
178    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
179        match prim {
180            1 => Self::NotFound,
181            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
182        }
183    }
184
185    #[inline]
186    pub fn unknown() -> Self {
187        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
188    }
189
190    #[inline]
191    pub const fn into_primitive(self) -> u32 {
192        match self {
193            Self::NotFound => 1,
194            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
195        }
196    }
197
198    #[inline]
199    pub fn is_unknown(&self) -> bool {
200        match self {
201            Self::__SourceBreaking { unknown_ordinal: _ } => true,
202            _ => false,
203        }
204    }
205}
206
207#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
208pub enum NetworkRegistryAddError {
209    /// The `network_id` was not specified in the Network table.
210    MissingNetworkId,
211    /// The `info` was not specified in the Network table.
212    MissingNetworkInfo,
213    /// The `dns_servers` was not specified in the Network table.
214    MissingNetworkDnsServers,
215    /// There already exists a network with this network_id.
216    /// To update an existing network, use Update.
217    DuplicateNetworkId,
218    #[doc(hidden)]
219    __SourceBreaking { unknown_ordinal: u32 },
220}
221
222/// Pattern that matches an unknown `NetworkRegistryAddError` member.
223#[macro_export]
224macro_rules! NetworkRegistryAddErrorUnknown {
225    () => {
226        _
227    };
228}
229
230impl NetworkRegistryAddError {
231    #[inline]
232    pub fn from_primitive(prim: u32) -> Option<Self> {
233        match prim {
234            1 => Some(Self::MissingNetworkId),
235            2 => Some(Self::MissingNetworkInfo),
236            3 => Some(Self::MissingNetworkDnsServers),
237            4 => Some(Self::DuplicateNetworkId),
238            _ => None,
239        }
240    }
241
242    #[inline]
243    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
244        match prim {
245            1 => Self::MissingNetworkId,
246            2 => Self::MissingNetworkInfo,
247            3 => Self::MissingNetworkDnsServers,
248            4 => Self::DuplicateNetworkId,
249            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
250        }
251    }
252
253    #[inline]
254    pub fn unknown() -> Self {
255        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
256    }
257
258    #[inline]
259    pub const fn into_primitive(self) -> u32 {
260        match self {
261            Self::MissingNetworkId => 1,
262            Self::MissingNetworkInfo => 2,
263            Self::MissingNetworkDnsServers => 3,
264            Self::DuplicateNetworkId => 4,
265            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
266        }
267    }
268
269    #[inline]
270    pub fn is_unknown(&self) -> bool {
271        match self {
272            Self::__SourceBreaking { unknown_ordinal: _ } => true,
273            _ => false,
274        }
275    }
276}
277
278#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
279pub enum NetworkRegistryRemoveError {
280    /// No network with this network_id found.
281    NotFound,
282    /// The specified network is currently marked as the default network.
283    CannotRemoveDefaultNetwork,
284    #[doc(hidden)]
285    __SourceBreaking { unknown_ordinal: u32 },
286}
287
288/// Pattern that matches an unknown `NetworkRegistryRemoveError` member.
289#[macro_export]
290macro_rules! NetworkRegistryRemoveErrorUnknown {
291    () => {
292        _
293    };
294}
295
296impl NetworkRegistryRemoveError {
297    #[inline]
298    pub fn from_primitive(prim: u32) -> Option<Self> {
299        match prim {
300            1 => Some(Self::NotFound),
301            2 => Some(Self::CannotRemoveDefaultNetwork),
302            _ => None,
303        }
304    }
305
306    #[inline]
307    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
308        match prim {
309            1 => Self::NotFound,
310            2 => Self::CannotRemoveDefaultNetwork,
311            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
312        }
313    }
314
315    #[inline]
316    pub fn unknown() -> Self {
317        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
318    }
319
320    #[inline]
321    pub const fn into_primitive(self) -> u32 {
322        match self {
323            Self::NotFound => 1,
324            Self::CannotRemoveDefaultNetwork => 2,
325            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
326        }
327    }
328
329    #[inline]
330    pub fn is_unknown(&self) -> bool {
331        match self {
332            Self::__SourceBreaking { unknown_ordinal: _ } => true,
333            _ => false,
334        }
335    }
336}
337
338#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
339pub enum NetworkRegistrySetDefaultError {
340    /// No network with this network_id found.
341    NotFound,
342    #[doc(hidden)]
343    __SourceBreaking { unknown_ordinal: u32 },
344}
345
346/// Pattern that matches an unknown `NetworkRegistrySetDefaultError` member.
347#[macro_export]
348macro_rules! NetworkRegistrySetDefaultErrorUnknown {
349    () => {
350        _
351    };
352}
353
354impl NetworkRegistrySetDefaultError {
355    #[inline]
356    pub fn from_primitive(prim: u32) -> Option<Self> {
357        match prim {
358            1 => Some(Self::NotFound),
359            _ => None,
360        }
361    }
362
363    #[inline]
364    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
365        match prim {
366            1 => Self::NotFound,
367            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
368        }
369    }
370
371    #[inline]
372    pub fn unknown() -> Self {
373        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
374    }
375
376    #[inline]
377    pub const fn into_primitive(self) -> u32 {
378        match self {
379            Self::NotFound => 1,
380            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
381        }
382    }
383
384    #[inline]
385    pub fn is_unknown(&self) -> bool {
386        match self {
387            Self::__SourceBreaking { unknown_ordinal: _ } => true,
388            _ => false,
389        }
390    }
391}
392
393#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
394pub enum NetworkRegistryUpdateError {
395    /// The `network_id` was not specified in the Network table.
396    MissingNetworkId,
397    /// The `info` was not specified in the Network table.
398    MissingNetworkInfo,
399    /// The `dns_servers` was not specified in the Network table.
400    MissingNetworkDnsServers,
401    /// No network with this `network_id` found.
402    NotFound,
403    #[doc(hidden)]
404    __SourceBreaking { unknown_ordinal: u32 },
405}
406
407/// Pattern that matches an unknown `NetworkRegistryUpdateError` member.
408#[macro_export]
409macro_rules! NetworkRegistryUpdateErrorUnknown {
410    () => {
411        _
412    };
413}
414
415impl NetworkRegistryUpdateError {
416    #[inline]
417    pub fn from_primitive(prim: u32) -> Option<Self> {
418        match prim {
419            1 => Some(Self::MissingNetworkId),
420            2 => Some(Self::MissingNetworkInfo),
421            3 => Some(Self::MissingNetworkDnsServers),
422            4 => Some(Self::NotFound),
423            _ => None,
424        }
425    }
426
427    #[inline]
428    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
429        match prim {
430            1 => Self::MissingNetworkId,
431            2 => Self::MissingNetworkInfo,
432            3 => Self::MissingNetworkDnsServers,
433            4 => Self::NotFound,
434            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
435        }
436    }
437
438    #[inline]
439    pub fn unknown() -> Self {
440        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
441    }
442
443    #[inline]
444    pub const fn into_primitive(self) -> u32 {
445        match self {
446            Self::MissingNetworkId => 1,
447            Self::MissingNetworkInfo => 2,
448            Self::MissingNetworkDnsServers => 3,
449            Self::NotFound => 4,
450            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
451        }
452    }
453
454    #[inline]
455    pub fn is_unknown(&self) -> bool {
456        match self {
457            Self::__SourceBreaking { unknown_ordinal: _ } => true,
458            _ => false,
459        }
460    }
461}
462
463#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
464pub enum NetworkTokenResolverResolveTokenError {
465    /// The provided `NetworkToken` is invalid or out-of-date.
466    InvalidNetworkToken,
467    #[doc(hidden)]
468    __SourceBreaking { unknown_ordinal: u32 },
469}
470
471/// Pattern that matches an unknown `NetworkTokenResolverResolveTokenError` member.
472#[macro_export]
473macro_rules! NetworkTokenResolverResolveTokenErrorUnknown {
474    () => {
475        _
476    };
477}
478
479impl NetworkTokenResolverResolveTokenError {
480    #[inline]
481    pub fn from_primitive(prim: u32) -> Option<Self> {
482        match prim {
483            1 => Some(Self::InvalidNetworkToken),
484            _ => None,
485        }
486    }
487
488    #[inline]
489    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
490        match prim {
491            1 => Self::InvalidNetworkToken,
492            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
493        }
494    }
495
496    #[inline]
497    pub fn unknown() -> Self {
498        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
499    }
500
501    #[inline]
502    pub const fn into_primitive(self) -> u32 {
503        match self {
504            Self::InvalidNetworkToken => 1,
505            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
506        }
507    }
508
509    #[inline]
510    pub fn is_unknown(&self) -> bool {
511        match self {
512            Self::__SourceBreaking { unknown_ordinal: _ } => true,
513            _ => false,
514        }
515    }
516}
517
518/// The physical medium used for a network.
519#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
520pub enum NetworkType {
521    Unknown,
522    Ethernet,
523    Wifi,
524    Bluetooth,
525    Cellular,
526    #[doc(hidden)]
527    __SourceBreaking {
528        unknown_ordinal: u32,
529    },
530}
531
532/// Pattern that matches an unknown `NetworkType` member.
533#[macro_export]
534macro_rules! NetworkTypeUnknown {
535    () => {
536        _
537    };
538}
539
540impl NetworkType {
541    #[inline]
542    pub fn from_primitive(prim: u32) -> Option<Self> {
543        match prim {
544            1 => Some(Self::Unknown),
545            2 => Some(Self::Ethernet),
546            3 => Some(Self::Wifi),
547            4 => Some(Self::Bluetooth),
548            5 => Some(Self::Cellular),
549            _ => None,
550        }
551    }
552
553    #[inline]
554    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
555        match prim {
556            1 => Self::Unknown,
557            2 => Self::Ethernet,
558            3 => Self::Wifi,
559            4 => Self::Bluetooth,
560            5 => Self::Cellular,
561            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
562        }
563    }
564
565    #[inline]
566    pub fn unknown() -> Self {
567        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
568    }
569
570    #[inline]
571    pub const fn into_primitive(self) -> u32 {
572        match self {
573            Self::Unknown => 1,
574            Self::Ethernet => 2,
575            Self::Wifi => 3,
576            Self::Bluetooth => 4,
577            Self::Cellular => 5,
578            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
579        }
580    }
581
582    #[inline]
583    pub fn is_unknown(&self) -> bool {
584        match self {
585            Self::__SourceBreaking { unknown_ordinal: _ } => true,
586            _ => false,
587        }
588    }
589}
590
591#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
592pub enum PropertyWatcherError {
593    /// When the network watched by this watcher no longer exists, a new
594    /// [`NetworkToken`] must be acquired. After delivering this error, the
595    /// server immediately closes the `PropertyWatcher` connection.
596    NetworkGone,
597    #[doc(hidden)]
598    __SourceBreaking { unknown_ordinal: u32 },
599}
600
601/// Pattern that matches an unknown `PropertyWatcherError` member.
602#[macro_export]
603macro_rules! PropertyWatcherErrorUnknown {
604    () => {
605        _
606    };
607}
608
609impl PropertyWatcherError {
610    #[inline]
611    pub fn from_primitive(prim: u32) -> Option<Self> {
612        match prim {
613            1 => Some(Self::NetworkGone),
614            _ => None,
615        }
616    }
617
618    #[inline]
619    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
620        match prim {
621            1 => Self::NetworkGone,
622            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
623        }
624    }
625
626    #[inline]
627    pub fn unknown() -> Self {
628        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
629    }
630
631    #[inline]
632    pub const fn into_primitive(self) -> u32 {
633        match self {
634            Self::NetworkGone => 1,
635            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
636        }
637    }
638
639    #[inline]
640    pub fn is_unknown(&self) -> bool {
641        match self {
642            Self::__SourceBreaking { unknown_ordinal: _ } => true,
643            _ => false,
644        }
645    }
646}
647
648#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
649pub enum WatchError {
650    /// The provided `properties` had no bits set.
651    NoProperties,
652    /// The provided NetworkToken was either not acquired from
653    /// [`WatchDefault`] or [`PrivilegedNetworkLookup.Lookup`], or
654    /// is no longer valid.
655    InvalidNetworkToken,
656    /// An argument marked above as REQUIRED was not provided.
657    MissingRequiredArgument,
658    #[doc(hidden)]
659    __SourceBreaking { unknown_ordinal: u32 },
660}
661
662/// Pattern that matches an unknown `WatchError` member.
663#[macro_export]
664macro_rules! WatchErrorUnknown {
665    () => {
666        _
667    };
668}
669
670impl WatchError {
671    #[inline]
672    pub fn from_primitive(prim: u32) -> Option<Self> {
673        match prim {
674            1 => Some(Self::NoProperties),
675            2 => Some(Self::InvalidNetworkToken),
676            99 => Some(Self::MissingRequiredArgument),
677            _ => None,
678        }
679    }
680
681    #[inline]
682    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
683        match prim {
684            1 => Self::NoProperties,
685            2 => Self::InvalidNetworkToken,
686            99 => Self::MissingRequiredArgument,
687            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
688        }
689    }
690
691    #[inline]
692    pub fn unknown() -> Self {
693        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
694    }
695
696    #[inline]
697    pub const fn into_primitive(self) -> u32 {
698        match self {
699            Self::NoProperties => 1,
700            Self::InvalidNetworkToken => 2,
701            Self::MissingRequiredArgument => 99,
702            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
703        }
704    }
705
706    #[inline]
707    pub fn is_unknown(&self) -> bool {
708        match self {
709            Self::__SourceBreaking { unknown_ordinal: _ } => true,
710            _ => false,
711        }
712    }
713}
714
715#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
716pub struct Empty;
717
718impl fidl::Persistable for Empty {}
719
720#[derive(Clone, Debug, PartialEq)]
721pub struct NetworkRegistryAddRequest {
722    pub network: Network,
723}
724
725impl fidl::Persistable for NetworkRegistryAddRequest {}
726
727#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
728#[repr(C)]
729pub struct NetworkRegistryRemoveRequest {
730    pub network_id: u32,
731}
732
733impl fidl::Persistable for NetworkRegistryRemoveRequest {}
734
735#[derive(Clone, Debug, PartialEq)]
736pub struct NetworkRegistrySetDefaultRequest {
737    pub network_id: fidl_fuchsia_posix_socket_common::OptionalUint32,
738}
739
740impl fidl::Persistable for NetworkRegistrySetDefaultRequest {}
741
742#[derive(Clone, Debug, PartialEq)]
743pub struct NetworkRegistryUpdateRequest {
744    pub network: Network,
745}
746
747impl fidl::Persistable for NetworkRegistryUpdateRequest {}
748
749#[derive(Clone, Debug, PartialEq)]
750pub struct PropertyWatcherWatchResponse {
751    /// A table of updates that have occurred since the last update was
752    /// reported via this watcher. If a property changes multiple times
753    /// between updates, only the most recent version is reported.
754    pub updates: PropertyUpdate,
755}
756
757impl fidl::Persistable for PropertyWatcherWatchResponse {}
758
759#[derive(Clone, Debug, Default, PartialEq)]
760pub struct DnsConfiguration {
761    /// A preference ordered list of [`fuchsia.net.name.DnsServer`]s.
762    /// NOTE: Required, this field must always be set.
763    pub servers: Option<Vec<fidl_fuchsia_net_name_common::DnsServer_>>,
764    #[doc(hidden)]
765    pub __source_breaking: fidl::marker::SourceBreaking,
766}
767
768impl fidl::Persistable for DnsConfiguration {}
769
770#[derive(Clone, Debug, Default, PartialEq)]
771pub struct FuchsiaNetworkInfo {
772    #[doc(hidden)]
773    pub __source_breaking: fidl::marker::SourceBreaking,
774}
775
776impl fidl::Persistable for FuchsiaNetworkInfo {}
777
778/// Network describes a single network interface provided to NetworkRegistry.
779#[derive(Clone, Debug, Default, PartialEq)]
780pub struct Network {
781    /// A unique ID for the registered network.
782    ///
783    /// Required.
784    pub network_id: Option<u32>,
785    /// Platform specific information about the network.
786    ///
787    /// Required.
788    pub info: Option<NetworkInfo>,
789    /// REQUIRED. The DNS servers associated with this network.
790    pub dns_servers: Option<NetworkDnsServers>,
791    /// The transport type for the network.
792    ///
793    /// Added in FuchsiaNetworkMonitorFs NetworkMessage version 2. Interpreted
794    /// as NetworkType::UNKNOWN when absent.
795    pub network_type: Option<NetworkType>,
796    /// The capabilities for the network.
797    ///
798    /// Added in FuchsiaNetworkMonitorFs NetworkMessage version 2. Interpreted
799    /// as an empty list when absent.
800    pub capabilities: Option<Vec<NetworkCapability>>,
801    /// The level of connectivity for the network.
802    ///
803    /// Added in FuchsiaNetworkMonitorFs NetworkMessage version 2. Interpreted
804    /// as ConnectivityState::NO_CONNECTIVITY when absent.
805    pub connectivity: Option<ConnectivityState>,
806    /// The name of the underlying interface for the network.
807    ///
808    /// Added in FuchsiaNetworkMonitorFs NetworkMessage version 2. Interpreted
809    /// as the empty string when absent.
810    pub name: Option<String>,
811    /// Whether the underlying interface has a v4/v6 address assigned.
812    ///
813    /// Added in FuchsiaNetworkMonitorFs NetworkMessage version 2. Interpreted
814    /// as no information is available when absent.
815    pub has_address: Option<ProtoProperties>,
816    /// Whether the underlying interface has a v4/v6 default route.
817    ///
818    /// Added in FuchsiaNetworkMonitorFs NetworkMessage version 2. Interpereted
819    /// as no information is available when absent.
820    pub has_default_route: Option<ProtoProperties>,
821    #[doc(hidden)]
822    pub __source_breaking: fidl::marker::SourceBreaking,
823}
824
825impl fidl::Persistable for Network {}
826
827#[derive(Clone, Debug, Default, PartialEq)]
828pub struct NetworkDnsServers {
829    pub v4: Option<Vec<fidl_fuchsia_net_common::Ipv4Address>>,
830    pub v6: Option<Vec<fidl_fuchsia_net_common::Ipv6Address>>,
831    #[doc(hidden)]
832    pub __source_breaking: fidl::marker::SourceBreaking,
833}
834
835impl fidl::Persistable for NetworkDnsServers {}
836
837/// An update from [`Networks.WatchProperties`]. Only the fields specified in
838/// [`PropertyInterest`] may be set.
839#[derive(Clone, Debug, Default, PartialEq)]
840pub struct PropertyUpdate {
841    /// The socket marks associated with this network.
842    pub socket_marks: Option<fidl_fuchsia_net_common::Marks>,
843    /// The DNS Configuration associated with this network.
844    pub dns_configuration: Option<DnsConfiguration>,
845    #[doc(hidden)]
846    pub __source_breaking: fidl::marker::SourceBreaking,
847}
848
849impl fidl::Persistable for PropertyUpdate {}
850
851#[derive(Clone, Debug, Default, PartialEq)]
852pub struct StarnixNetworkInfo {
853    pub mark: Option<u32>,
854    pub handle: Option<u64>,
855    #[doc(hidden)]
856    pub __source_breaking: fidl::marker::SourceBreaking,
857}
858
859impl fidl::Persistable for StarnixNetworkInfo {}
860
861#[derive(Clone, Debug)]
862pub enum LookupRequest {
863    /// If the provided [`starnix_handle`] matches one provided to
864    /// [`NetworkRegistry`], return a token representing that network.
865    StarnixHandle(u64),
866    #[doc(hidden)]
867    __SourceBreaking { unknown_ordinal: u64 },
868}
869
870/// Pattern that matches an unknown `LookupRequest` member.
871#[macro_export]
872macro_rules! LookupRequestUnknown {
873    () => {
874        _
875    };
876}
877
878// Custom PartialEq so that unknown variants are not equal to themselves.
879impl PartialEq for LookupRequest {
880    fn eq(&self, other: &Self) -> bool {
881        match (self, other) {
882            (Self::StarnixHandle(x), Self::StarnixHandle(y)) => *x == *y,
883            _ => false,
884        }
885    }
886}
887
888impl LookupRequest {
889    #[inline]
890    pub fn ordinal(&self) -> u64 {
891        match *self {
892            Self::StarnixHandle(_) => 1,
893            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
894        }
895    }
896
897    #[inline]
898    pub fn unknown_variant_for_testing() -> Self {
899        Self::__SourceBreaking { unknown_ordinal: 0 }
900    }
901
902    #[inline]
903    pub fn is_unknown(&self) -> bool {
904        match self {
905            Self::__SourceBreaking { .. } => true,
906            _ => false,
907        }
908    }
909}
910
911impl fidl::Persistable for LookupRequest {}
912
913#[derive(Clone, Debug)]
914pub enum NetworkInfo {
915    /// Information about Starnix registered networks.
916    Starnix(StarnixNetworkInfo),
917    /// Information about Fuchsia registered networks.
918    Fuchsia(FuchsiaNetworkInfo),
919    #[doc(hidden)]
920    __SourceBreaking { unknown_ordinal: u64 },
921}
922
923/// Pattern that matches an unknown `NetworkInfo` member.
924#[macro_export]
925macro_rules! NetworkInfoUnknown {
926    () => {
927        _
928    };
929}
930
931// Custom PartialEq so that unknown variants are not equal to themselves.
932impl PartialEq for NetworkInfo {
933    fn eq(&self, other: &Self) -> bool {
934        match (self, other) {
935            (Self::Starnix(x), Self::Starnix(y)) => *x == *y,
936            (Self::Fuchsia(x), Self::Fuchsia(y)) => *x == *y,
937            _ => false,
938        }
939    }
940}
941
942impl NetworkInfo {
943    #[inline]
944    pub fn ordinal(&self) -> u64 {
945        match *self {
946            Self::Starnix(_) => 1,
947            Self::Fuchsia(_) => 2,
948            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
949        }
950    }
951
952    #[inline]
953    pub fn unknown_variant_for_testing() -> Self {
954        Self::__SourceBreaking { unknown_ordinal: 0 }
955    }
956
957    #[inline]
958    pub fn is_unknown(&self) -> bool {
959        match self {
960            Self::__SourceBreaking { .. } => true,
961            _ => false,
962        }
963    }
964}
965
966impl fidl::Persistable for NetworkInfo {}
967
968pub mod network_registry_ordinals {
969    pub const SET_DEFAULT: u64 = 0x76934538265b2f00;
970    pub const ADD: u64 = 0x31a251a7d0f8fa36;
971    pub const UPDATE: u64 = 0x727f5ca0c0b2caa4;
972    pub const REMOVE: u64 = 0xcf5055a455ce1c0;
973}
974
975pub mod network_token_resolver_ordinals {
976    pub const RESOLVE_TOKEN: u64 = 0x4176f67517941bac;
977}
978
979pub mod networks_ordinals {
980    pub const WATCH_DEFAULT: u64 = 0x346880b2d7db0f98;
981    pub const WATCH_PROPERTIES: u64 = 0x24d2340905f7dcc6;
982}
983
984pub mod privileged_network_lookup_ordinals {
985    pub const LOOKUP: u64 = 0x56c60798dfd78cab;
986}
987
988pub mod property_watcher_ordinals {
989    pub const WATCH: u64 = 0xde56bd724694478;
990}
991
992mod internal {
993    use super::*;
994    unsafe impl fidl::encoding::TypeMarker for NetworkCapability {
995        type Owned = Self;
996
997        #[inline(always)]
998        fn inline_align(_context: fidl::encoding::Context) -> usize {
999            4
1000        }
1001
1002        #[inline(always)]
1003        fn inline_size(_context: fidl::encoding::Context) -> usize {
1004            4
1005        }
1006    }
1007
1008    impl fidl::encoding::ValueTypeMarker for NetworkCapability {
1009        type Borrowed<'a> = Self;
1010        #[inline(always)]
1011        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1012            *value
1013        }
1014    }
1015
1016    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1017        for NetworkCapability
1018    {
1019        #[inline]
1020        unsafe fn encode(
1021            self,
1022            encoder: &mut fidl::encoding::Encoder<'_, D>,
1023            offset: usize,
1024            _depth: fidl::encoding::Depth,
1025        ) -> fidl::Result<()> {
1026            encoder.debug_check_bounds::<Self>(offset);
1027            encoder.write_num(self.bits(), offset);
1028            Ok(())
1029        }
1030    }
1031
1032    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NetworkCapability {
1033        #[inline(always)]
1034        fn new_empty() -> Self {
1035            Self::empty()
1036        }
1037
1038        #[inline]
1039        unsafe fn decode(
1040            &mut self,
1041            decoder: &mut fidl::encoding::Decoder<'_, D>,
1042            offset: usize,
1043            _depth: fidl::encoding::Depth,
1044        ) -> fidl::Result<()> {
1045            decoder.debug_check_bounds::<Self>(offset);
1046            let prim = decoder.read_num::<u32>(offset);
1047            *self = Self::from_bits_allow_unknown(prim);
1048            Ok(())
1049        }
1050    }
1051    unsafe impl fidl::encoding::TypeMarker for PropertyInterest {
1052        type Owned = Self;
1053
1054        #[inline(always)]
1055        fn inline_align(_context: fidl::encoding::Context) -> usize {
1056            4
1057        }
1058
1059        #[inline(always)]
1060        fn inline_size(_context: fidl::encoding::Context) -> usize {
1061            4
1062        }
1063    }
1064
1065    impl fidl::encoding::ValueTypeMarker for PropertyInterest {
1066        type Borrowed<'a> = Self;
1067        #[inline(always)]
1068        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1069            *value
1070        }
1071    }
1072
1073    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1074        for PropertyInterest
1075    {
1076        #[inline]
1077        unsafe fn encode(
1078            self,
1079            encoder: &mut fidl::encoding::Encoder<'_, D>,
1080            offset: usize,
1081            _depth: fidl::encoding::Depth,
1082        ) -> fidl::Result<()> {
1083            encoder.debug_check_bounds::<Self>(offset);
1084            encoder.write_num(self.bits(), offset);
1085            Ok(())
1086        }
1087    }
1088
1089    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PropertyInterest {
1090        #[inline(always)]
1091        fn new_empty() -> Self {
1092            Self::empty()
1093        }
1094
1095        #[inline]
1096        unsafe fn decode(
1097            &mut self,
1098            decoder: &mut fidl::encoding::Decoder<'_, D>,
1099            offset: usize,
1100            _depth: fidl::encoding::Depth,
1101        ) -> fidl::Result<()> {
1102            decoder.debug_check_bounds::<Self>(offset);
1103            let prim = decoder.read_num::<u32>(offset);
1104            *self = Self::from_bits_allow_unknown(prim);
1105            Ok(())
1106        }
1107    }
1108    unsafe impl fidl::encoding::TypeMarker for ProtoProperties {
1109        type Owned = Self;
1110
1111        #[inline(always)]
1112        fn inline_align(_context: fidl::encoding::Context) -> usize {
1113            1
1114        }
1115
1116        #[inline(always)]
1117        fn inline_size(_context: fidl::encoding::Context) -> usize {
1118            1
1119        }
1120    }
1121
1122    impl fidl::encoding::ValueTypeMarker for ProtoProperties {
1123        type Borrowed<'a> = Self;
1124        #[inline(always)]
1125        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1126            *value
1127        }
1128    }
1129
1130    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1131        for ProtoProperties
1132    {
1133        #[inline]
1134        unsafe fn encode(
1135            self,
1136            encoder: &mut fidl::encoding::Encoder<'_, D>,
1137            offset: usize,
1138            _depth: fidl::encoding::Depth,
1139        ) -> fidl::Result<()> {
1140            encoder.debug_check_bounds::<Self>(offset);
1141            if self.bits() & Self::all().bits() != self.bits() {
1142                return Err(fidl::Error::InvalidBitsValue);
1143            }
1144            encoder.write_num(self.bits(), offset);
1145            Ok(())
1146        }
1147    }
1148
1149    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ProtoProperties {
1150        #[inline(always)]
1151        fn new_empty() -> Self {
1152            Self::empty()
1153        }
1154
1155        #[inline]
1156        unsafe fn decode(
1157            &mut self,
1158            decoder: &mut fidl::encoding::Decoder<'_, D>,
1159            offset: usize,
1160            _depth: fidl::encoding::Depth,
1161        ) -> fidl::Result<()> {
1162            decoder.debug_check_bounds::<Self>(offset);
1163            let prim = decoder.read_num::<u8>(offset);
1164            *self = Self::from_bits(prim).ok_or(fidl::Error::InvalidBitsValue)?;
1165            Ok(())
1166        }
1167    }
1168    unsafe impl fidl::encoding::TypeMarker for ConnectivityState {
1169        type Owned = Self;
1170
1171        #[inline(always)]
1172        fn inline_align(_context: fidl::encoding::Context) -> usize {
1173            std::mem::align_of::<u32>()
1174        }
1175
1176        #[inline(always)]
1177        fn inline_size(_context: fidl::encoding::Context) -> usize {
1178            std::mem::size_of::<u32>()
1179        }
1180
1181        #[inline(always)]
1182        fn encode_is_copy() -> bool {
1183            false
1184        }
1185
1186        #[inline(always)]
1187        fn decode_is_copy() -> bool {
1188            false
1189        }
1190    }
1191
1192    impl fidl::encoding::ValueTypeMarker for ConnectivityState {
1193        type Borrowed<'a> = Self;
1194        #[inline(always)]
1195        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1196            *value
1197        }
1198    }
1199
1200    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1201        for ConnectivityState
1202    {
1203        #[inline]
1204        unsafe fn encode(
1205            self,
1206            encoder: &mut fidl::encoding::Encoder<'_, D>,
1207            offset: usize,
1208            _depth: fidl::encoding::Depth,
1209        ) -> fidl::Result<()> {
1210            encoder.debug_check_bounds::<Self>(offset);
1211            encoder.write_num(self.into_primitive(), offset);
1212            Ok(())
1213        }
1214    }
1215
1216    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ConnectivityState {
1217        #[inline(always)]
1218        fn new_empty() -> Self {
1219            Self::unknown()
1220        }
1221
1222        #[inline]
1223        unsafe fn decode(
1224            &mut self,
1225            decoder: &mut fidl::encoding::Decoder<'_, D>,
1226            offset: usize,
1227            _depth: fidl::encoding::Depth,
1228        ) -> fidl::Result<()> {
1229            decoder.debug_check_bounds::<Self>(offset);
1230            let prim = decoder.read_num::<u32>(offset);
1231
1232            *self = Self::from_primitive_allow_unknown(prim);
1233            Ok(())
1234        }
1235    }
1236    unsafe impl fidl::encoding::TypeMarker for LookupError {
1237        type Owned = Self;
1238
1239        #[inline(always)]
1240        fn inline_align(_context: fidl::encoding::Context) -> usize {
1241            std::mem::align_of::<u32>()
1242        }
1243
1244        #[inline(always)]
1245        fn inline_size(_context: fidl::encoding::Context) -> usize {
1246            std::mem::size_of::<u32>()
1247        }
1248
1249        #[inline(always)]
1250        fn encode_is_copy() -> bool {
1251            false
1252        }
1253
1254        #[inline(always)]
1255        fn decode_is_copy() -> bool {
1256            false
1257        }
1258    }
1259
1260    impl fidl::encoding::ValueTypeMarker for LookupError {
1261        type Borrowed<'a> = Self;
1262        #[inline(always)]
1263        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1264            *value
1265        }
1266    }
1267
1268    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for LookupError {
1269        #[inline]
1270        unsafe fn encode(
1271            self,
1272            encoder: &mut fidl::encoding::Encoder<'_, D>,
1273            offset: usize,
1274            _depth: fidl::encoding::Depth,
1275        ) -> fidl::Result<()> {
1276            encoder.debug_check_bounds::<Self>(offset);
1277            encoder.write_num(self.into_primitive(), offset);
1278            Ok(())
1279        }
1280    }
1281
1282    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LookupError {
1283        #[inline(always)]
1284        fn new_empty() -> Self {
1285            Self::unknown()
1286        }
1287
1288        #[inline]
1289        unsafe fn decode(
1290            &mut self,
1291            decoder: &mut fidl::encoding::Decoder<'_, D>,
1292            offset: usize,
1293            _depth: fidl::encoding::Depth,
1294        ) -> fidl::Result<()> {
1295            decoder.debug_check_bounds::<Self>(offset);
1296            let prim = decoder.read_num::<u32>(offset);
1297
1298            *self = Self::from_primitive_allow_unknown(prim);
1299            Ok(())
1300        }
1301    }
1302    unsafe impl fidl::encoding::TypeMarker for NetworkRegistryAddError {
1303        type Owned = Self;
1304
1305        #[inline(always)]
1306        fn inline_align(_context: fidl::encoding::Context) -> usize {
1307            std::mem::align_of::<u32>()
1308        }
1309
1310        #[inline(always)]
1311        fn inline_size(_context: fidl::encoding::Context) -> usize {
1312            std::mem::size_of::<u32>()
1313        }
1314
1315        #[inline(always)]
1316        fn encode_is_copy() -> bool {
1317            false
1318        }
1319
1320        #[inline(always)]
1321        fn decode_is_copy() -> bool {
1322            false
1323        }
1324    }
1325
1326    impl fidl::encoding::ValueTypeMarker for NetworkRegistryAddError {
1327        type Borrowed<'a> = Self;
1328        #[inline(always)]
1329        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1330            *value
1331        }
1332    }
1333
1334    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1335        for NetworkRegistryAddError
1336    {
1337        #[inline]
1338        unsafe fn encode(
1339            self,
1340            encoder: &mut fidl::encoding::Encoder<'_, D>,
1341            offset: usize,
1342            _depth: fidl::encoding::Depth,
1343        ) -> fidl::Result<()> {
1344            encoder.debug_check_bounds::<Self>(offset);
1345            encoder.write_num(self.into_primitive(), offset);
1346            Ok(())
1347        }
1348    }
1349
1350    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1351        for NetworkRegistryAddError
1352    {
1353        #[inline(always)]
1354        fn new_empty() -> Self {
1355            Self::unknown()
1356        }
1357
1358        #[inline]
1359        unsafe fn decode(
1360            &mut self,
1361            decoder: &mut fidl::encoding::Decoder<'_, D>,
1362            offset: usize,
1363            _depth: fidl::encoding::Depth,
1364        ) -> fidl::Result<()> {
1365            decoder.debug_check_bounds::<Self>(offset);
1366            let prim = decoder.read_num::<u32>(offset);
1367
1368            *self = Self::from_primitive_allow_unknown(prim);
1369            Ok(())
1370        }
1371    }
1372    unsafe impl fidl::encoding::TypeMarker for NetworkRegistryRemoveError {
1373        type Owned = Self;
1374
1375        #[inline(always)]
1376        fn inline_align(_context: fidl::encoding::Context) -> usize {
1377            std::mem::align_of::<u32>()
1378        }
1379
1380        #[inline(always)]
1381        fn inline_size(_context: fidl::encoding::Context) -> usize {
1382            std::mem::size_of::<u32>()
1383        }
1384
1385        #[inline(always)]
1386        fn encode_is_copy() -> bool {
1387            false
1388        }
1389
1390        #[inline(always)]
1391        fn decode_is_copy() -> bool {
1392            false
1393        }
1394    }
1395
1396    impl fidl::encoding::ValueTypeMarker for NetworkRegistryRemoveError {
1397        type Borrowed<'a> = Self;
1398        #[inline(always)]
1399        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1400            *value
1401        }
1402    }
1403
1404    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1405        for NetworkRegistryRemoveError
1406    {
1407        #[inline]
1408        unsafe fn encode(
1409            self,
1410            encoder: &mut fidl::encoding::Encoder<'_, D>,
1411            offset: usize,
1412            _depth: fidl::encoding::Depth,
1413        ) -> fidl::Result<()> {
1414            encoder.debug_check_bounds::<Self>(offset);
1415            encoder.write_num(self.into_primitive(), offset);
1416            Ok(())
1417        }
1418    }
1419
1420    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1421        for NetworkRegistryRemoveError
1422    {
1423        #[inline(always)]
1424        fn new_empty() -> Self {
1425            Self::unknown()
1426        }
1427
1428        #[inline]
1429        unsafe fn decode(
1430            &mut self,
1431            decoder: &mut fidl::encoding::Decoder<'_, D>,
1432            offset: usize,
1433            _depth: fidl::encoding::Depth,
1434        ) -> fidl::Result<()> {
1435            decoder.debug_check_bounds::<Self>(offset);
1436            let prim = decoder.read_num::<u32>(offset);
1437
1438            *self = Self::from_primitive_allow_unknown(prim);
1439            Ok(())
1440        }
1441    }
1442    unsafe impl fidl::encoding::TypeMarker for NetworkRegistrySetDefaultError {
1443        type Owned = Self;
1444
1445        #[inline(always)]
1446        fn inline_align(_context: fidl::encoding::Context) -> usize {
1447            std::mem::align_of::<u32>()
1448        }
1449
1450        #[inline(always)]
1451        fn inline_size(_context: fidl::encoding::Context) -> usize {
1452            std::mem::size_of::<u32>()
1453        }
1454
1455        #[inline(always)]
1456        fn encode_is_copy() -> bool {
1457            false
1458        }
1459
1460        #[inline(always)]
1461        fn decode_is_copy() -> bool {
1462            false
1463        }
1464    }
1465
1466    impl fidl::encoding::ValueTypeMarker for NetworkRegistrySetDefaultError {
1467        type Borrowed<'a> = Self;
1468        #[inline(always)]
1469        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1470            *value
1471        }
1472    }
1473
1474    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1475        for NetworkRegistrySetDefaultError
1476    {
1477        #[inline]
1478        unsafe fn encode(
1479            self,
1480            encoder: &mut fidl::encoding::Encoder<'_, D>,
1481            offset: usize,
1482            _depth: fidl::encoding::Depth,
1483        ) -> fidl::Result<()> {
1484            encoder.debug_check_bounds::<Self>(offset);
1485            encoder.write_num(self.into_primitive(), offset);
1486            Ok(())
1487        }
1488    }
1489
1490    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1491        for NetworkRegistrySetDefaultError
1492    {
1493        #[inline(always)]
1494        fn new_empty() -> Self {
1495            Self::unknown()
1496        }
1497
1498        #[inline]
1499        unsafe fn decode(
1500            &mut self,
1501            decoder: &mut fidl::encoding::Decoder<'_, D>,
1502            offset: usize,
1503            _depth: fidl::encoding::Depth,
1504        ) -> fidl::Result<()> {
1505            decoder.debug_check_bounds::<Self>(offset);
1506            let prim = decoder.read_num::<u32>(offset);
1507
1508            *self = Self::from_primitive_allow_unknown(prim);
1509            Ok(())
1510        }
1511    }
1512    unsafe impl fidl::encoding::TypeMarker for NetworkRegistryUpdateError {
1513        type Owned = Self;
1514
1515        #[inline(always)]
1516        fn inline_align(_context: fidl::encoding::Context) -> usize {
1517            std::mem::align_of::<u32>()
1518        }
1519
1520        #[inline(always)]
1521        fn inline_size(_context: fidl::encoding::Context) -> usize {
1522            std::mem::size_of::<u32>()
1523        }
1524
1525        #[inline(always)]
1526        fn encode_is_copy() -> bool {
1527            false
1528        }
1529
1530        #[inline(always)]
1531        fn decode_is_copy() -> bool {
1532            false
1533        }
1534    }
1535
1536    impl fidl::encoding::ValueTypeMarker for NetworkRegistryUpdateError {
1537        type Borrowed<'a> = Self;
1538        #[inline(always)]
1539        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1540            *value
1541        }
1542    }
1543
1544    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1545        for NetworkRegistryUpdateError
1546    {
1547        #[inline]
1548        unsafe fn encode(
1549            self,
1550            encoder: &mut fidl::encoding::Encoder<'_, D>,
1551            offset: usize,
1552            _depth: fidl::encoding::Depth,
1553        ) -> fidl::Result<()> {
1554            encoder.debug_check_bounds::<Self>(offset);
1555            encoder.write_num(self.into_primitive(), offset);
1556            Ok(())
1557        }
1558    }
1559
1560    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1561        for NetworkRegistryUpdateError
1562    {
1563        #[inline(always)]
1564        fn new_empty() -> Self {
1565            Self::unknown()
1566        }
1567
1568        #[inline]
1569        unsafe fn decode(
1570            &mut self,
1571            decoder: &mut fidl::encoding::Decoder<'_, D>,
1572            offset: usize,
1573            _depth: fidl::encoding::Depth,
1574        ) -> fidl::Result<()> {
1575            decoder.debug_check_bounds::<Self>(offset);
1576            let prim = decoder.read_num::<u32>(offset);
1577
1578            *self = Self::from_primitive_allow_unknown(prim);
1579            Ok(())
1580        }
1581    }
1582    unsafe impl fidl::encoding::TypeMarker for NetworkTokenResolverResolveTokenError {
1583        type Owned = Self;
1584
1585        #[inline(always)]
1586        fn inline_align(_context: fidl::encoding::Context) -> usize {
1587            std::mem::align_of::<u32>()
1588        }
1589
1590        #[inline(always)]
1591        fn inline_size(_context: fidl::encoding::Context) -> usize {
1592            std::mem::size_of::<u32>()
1593        }
1594
1595        #[inline(always)]
1596        fn encode_is_copy() -> bool {
1597            false
1598        }
1599
1600        #[inline(always)]
1601        fn decode_is_copy() -> bool {
1602            false
1603        }
1604    }
1605
1606    impl fidl::encoding::ValueTypeMarker for NetworkTokenResolverResolveTokenError {
1607        type Borrowed<'a> = Self;
1608        #[inline(always)]
1609        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1610            *value
1611        }
1612    }
1613
1614    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1615        for NetworkTokenResolverResolveTokenError
1616    {
1617        #[inline]
1618        unsafe fn encode(
1619            self,
1620            encoder: &mut fidl::encoding::Encoder<'_, D>,
1621            offset: usize,
1622            _depth: fidl::encoding::Depth,
1623        ) -> fidl::Result<()> {
1624            encoder.debug_check_bounds::<Self>(offset);
1625            encoder.write_num(self.into_primitive(), offset);
1626            Ok(())
1627        }
1628    }
1629
1630    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1631        for NetworkTokenResolverResolveTokenError
1632    {
1633        #[inline(always)]
1634        fn new_empty() -> Self {
1635            Self::unknown()
1636        }
1637
1638        #[inline]
1639        unsafe fn decode(
1640            &mut self,
1641            decoder: &mut fidl::encoding::Decoder<'_, D>,
1642            offset: usize,
1643            _depth: fidl::encoding::Depth,
1644        ) -> fidl::Result<()> {
1645            decoder.debug_check_bounds::<Self>(offset);
1646            let prim = decoder.read_num::<u32>(offset);
1647
1648            *self = Self::from_primitive_allow_unknown(prim);
1649            Ok(())
1650        }
1651    }
1652    unsafe impl fidl::encoding::TypeMarker for NetworkType {
1653        type Owned = Self;
1654
1655        #[inline(always)]
1656        fn inline_align(_context: fidl::encoding::Context) -> usize {
1657            std::mem::align_of::<u32>()
1658        }
1659
1660        #[inline(always)]
1661        fn inline_size(_context: fidl::encoding::Context) -> usize {
1662            std::mem::size_of::<u32>()
1663        }
1664
1665        #[inline(always)]
1666        fn encode_is_copy() -> bool {
1667            false
1668        }
1669
1670        #[inline(always)]
1671        fn decode_is_copy() -> bool {
1672            false
1673        }
1674    }
1675
1676    impl fidl::encoding::ValueTypeMarker for NetworkType {
1677        type Borrowed<'a> = Self;
1678        #[inline(always)]
1679        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1680            *value
1681        }
1682    }
1683
1684    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for NetworkType {
1685        #[inline]
1686        unsafe fn encode(
1687            self,
1688            encoder: &mut fidl::encoding::Encoder<'_, D>,
1689            offset: usize,
1690            _depth: fidl::encoding::Depth,
1691        ) -> fidl::Result<()> {
1692            encoder.debug_check_bounds::<Self>(offset);
1693            encoder.write_num(self.into_primitive(), offset);
1694            Ok(())
1695        }
1696    }
1697
1698    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NetworkType {
1699        #[inline(always)]
1700        fn new_empty() -> Self {
1701            Self::unknown()
1702        }
1703
1704        #[inline]
1705        unsafe fn decode(
1706            &mut self,
1707            decoder: &mut fidl::encoding::Decoder<'_, D>,
1708            offset: usize,
1709            _depth: fidl::encoding::Depth,
1710        ) -> fidl::Result<()> {
1711            decoder.debug_check_bounds::<Self>(offset);
1712            let prim = decoder.read_num::<u32>(offset);
1713
1714            *self = Self::from_primitive_allow_unknown(prim);
1715            Ok(())
1716        }
1717    }
1718    unsafe impl fidl::encoding::TypeMarker for PropertyWatcherError {
1719        type Owned = Self;
1720
1721        #[inline(always)]
1722        fn inline_align(_context: fidl::encoding::Context) -> usize {
1723            std::mem::align_of::<u32>()
1724        }
1725
1726        #[inline(always)]
1727        fn inline_size(_context: fidl::encoding::Context) -> usize {
1728            std::mem::size_of::<u32>()
1729        }
1730
1731        #[inline(always)]
1732        fn encode_is_copy() -> bool {
1733            false
1734        }
1735
1736        #[inline(always)]
1737        fn decode_is_copy() -> bool {
1738            false
1739        }
1740    }
1741
1742    impl fidl::encoding::ValueTypeMarker for PropertyWatcherError {
1743        type Borrowed<'a> = Self;
1744        #[inline(always)]
1745        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1746            *value
1747        }
1748    }
1749
1750    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1751        for PropertyWatcherError
1752    {
1753        #[inline]
1754        unsafe fn encode(
1755            self,
1756            encoder: &mut fidl::encoding::Encoder<'_, D>,
1757            offset: usize,
1758            _depth: fidl::encoding::Depth,
1759        ) -> fidl::Result<()> {
1760            encoder.debug_check_bounds::<Self>(offset);
1761            encoder.write_num(self.into_primitive(), offset);
1762            Ok(())
1763        }
1764    }
1765
1766    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PropertyWatcherError {
1767        #[inline(always)]
1768        fn new_empty() -> Self {
1769            Self::unknown()
1770        }
1771
1772        #[inline]
1773        unsafe fn decode(
1774            &mut self,
1775            decoder: &mut fidl::encoding::Decoder<'_, D>,
1776            offset: usize,
1777            _depth: fidl::encoding::Depth,
1778        ) -> fidl::Result<()> {
1779            decoder.debug_check_bounds::<Self>(offset);
1780            let prim = decoder.read_num::<u32>(offset);
1781
1782            *self = Self::from_primitive_allow_unknown(prim);
1783            Ok(())
1784        }
1785    }
1786    unsafe impl fidl::encoding::TypeMarker for WatchError {
1787        type Owned = Self;
1788
1789        #[inline(always)]
1790        fn inline_align(_context: fidl::encoding::Context) -> usize {
1791            std::mem::align_of::<u32>()
1792        }
1793
1794        #[inline(always)]
1795        fn inline_size(_context: fidl::encoding::Context) -> usize {
1796            std::mem::size_of::<u32>()
1797        }
1798
1799        #[inline(always)]
1800        fn encode_is_copy() -> bool {
1801            false
1802        }
1803
1804        #[inline(always)]
1805        fn decode_is_copy() -> bool {
1806            false
1807        }
1808    }
1809
1810    impl fidl::encoding::ValueTypeMarker for WatchError {
1811        type Borrowed<'a> = Self;
1812        #[inline(always)]
1813        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1814            *value
1815        }
1816    }
1817
1818    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for WatchError {
1819        #[inline]
1820        unsafe fn encode(
1821            self,
1822            encoder: &mut fidl::encoding::Encoder<'_, D>,
1823            offset: usize,
1824            _depth: fidl::encoding::Depth,
1825        ) -> fidl::Result<()> {
1826            encoder.debug_check_bounds::<Self>(offset);
1827            encoder.write_num(self.into_primitive(), offset);
1828            Ok(())
1829        }
1830    }
1831
1832    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WatchError {
1833        #[inline(always)]
1834        fn new_empty() -> Self {
1835            Self::unknown()
1836        }
1837
1838        #[inline]
1839        unsafe fn decode(
1840            &mut self,
1841            decoder: &mut fidl::encoding::Decoder<'_, D>,
1842            offset: usize,
1843            _depth: fidl::encoding::Depth,
1844        ) -> fidl::Result<()> {
1845            decoder.debug_check_bounds::<Self>(offset);
1846            let prim = decoder.read_num::<u32>(offset);
1847
1848            *self = Self::from_primitive_allow_unknown(prim);
1849            Ok(())
1850        }
1851    }
1852
1853    impl fidl::encoding::ValueTypeMarker for Empty {
1854        type Borrowed<'a> = &'a Self;
1855        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1856            value
1857        }
1858    }
1859
1860    unsafe impl fidl::encoding::TypeMarker for Empty {
1861        type Owned = Self;
1862
1863        #[inline(always)]
1864        fn inline_align(_context: fidl::encoding::Context) -> usize {
1865            1
1866        }
1867
1868        #[inline(always)]
1869        fn inline_size(_context: fidl::encoding::Context) -> usize {
1870            1
1871        }
1872    }
1873
1874    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Empty, D> for &Empty {
1875        #[inline]
1876        unsafe fn encode(
1877            self,
1878            encoder: &mut fidl::encoding::Encoder<'_, D>,
1879            offset: usize,
1880            _depth: fidl::encoding::Depth,
1881        ) -> fidl::Result<()> {
1882            encoder.debug_check_bounds::<Empty>(offset);
1883            encoder.write_num(0u8, offset);
1884            Ok(())
1885        }
1886    }
1887
1888    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Empty {
1889        #[inline(always)]
1890        fn new_empty() -> Self {
1891            Self
1892        }
1893
1894        #[inline]
1895        unsafe fn decode(
1896            &mut self,
1897            decoder: &mut fidl::encoding::Decoder<'_, D>,
1898            offset: usize,
1899            _depth: fidl::encoding::Depth,
1900        ) -> fidl::Result<()> {
1901            decoder.debug_check_bounds::<Self>(offset);
1902            match decoder.read_num::<u8>(offset) {
1903                0 => Ok(()),
1904                _ => Err(fidl::Error::Invalid),
1905            }
1906        }
1907    }
1908
1909    impl fidl::encoding::ValueTypeMarker for NetworkRegistryAddRequest {
1910        type Borrowed<'a> = &'a Self;
1911        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1912            value
1913        }
1914    }
1915
1916    unsafe impl fidl::encoding::TypeMarker for NetworkRegistryAddRequest {
1917        type Owned = Self;
1918
1919        #[inline(always)]
1920        fn inline_align(_context: fidl::encoding::Context) -> usize {
1921            8
1922        }
1923
1924        #[inline(always)]
1925        fn inline_size(_context: fidl::encoding::Context) -> usize {
1926            16
1927        }
1928    }
1929
1930    unsafe impl<D: fidl::encoding::ResourceDialect>
1931        fidl::encoding::Encode<NetworkRegistryAddRequest, D> for &NetworkRegistryAddRequest
1932    {
1933        #[inline]
1934        unsafe fn encode(
1935            self,
1936            encoder: &mut fidl::encoding::Encoder<'_, D>,
1937            offset: usize,
1938            _depth: fidl::encoding::Depth,
1939        ) -> fidl::Result<()> {
1940            encoder.debug_check_bounds::<NetworkRegistryAddRequest>(offset);
1941            // Delegate to tuple encoding.
1942            fidl::encoding::Encode::<NetworkRegistryAddRequest, D>::encode(
1943                (<Network as fidl::encoding::ValueTypeMarker>::borrow(&self.network),),
1944                encoder,
1945                offset,
1946                _depth,
1947            )
1948        }
1949    }
1950    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Network, D>>
1951        fidl::encoding::Encode<NetworkRegistryAddRequest, D> for (T0,)
1952    {
1953        #[inline]
1954        unsafe fn encode(
1955            self,
1956            encoder: &mut fidl::encoding::Encoder<'_, D>,
1957            offset: usize,
1958            depth: fidl::encoding::Depth,
1959        ) -> fidl::Result<()> {
1960            encoder.debug_check_bounds::<NetworkRegistryAddRequest>(offset);
1961            // Zero out padding regions. There's no need to apply masks
1962            // because the unmasked parts will be overwritten by fields.
1963            // Write the fields.
1964            self.0.encode(encoder, offset + 0, depth)?;
1965            Ok(())
1966        }
1967    }
1968
1969    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1970        for NetworkRegistryAddRequest
1971    {
1972        #[inline(always)]
1973        fn new_empty() -> Self {
1974            Self { network: fidl::new_empty!(Network, D) }
1975        }
1976
1977        #[inline]
1978        unsafe fn decode(
1979            &mut self,
1980            decoder: &mut fidl::encoding::Decoder<'_, D>,
1981            offset: usize,
1982            _depth: fidl::encoding::Depth,
1983        ) -> fidl::Result<()> {
1984            decoder.debug_check_bounds::<Self>(offset);
1985            // Verify that padding bytes are zero.
1986            fidl::decode!(Network, D, &mut self.network, decoder, offset + 0, _depth)?;
1987            Ok(())
1988        }
1989    }
1990
1991    impl fidl::encoding::ValueTypeMarker for NetworkRegistryRemoveRequest {
1992        type Borrowed<'a> = &'a Self;
1993        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1994            value
1995        }
1996    }
1997
1998    unsafe impl fidl::encoding::TypeMarker for NetworkRegistryRemoveRequest {
1999        type Owned = Self;
2000
2001        #[inline(always)]
2002        fn inline_align(_context: fidl::encoding::Context) -> usize {
2003            4
2004        }
2005
2006        #[inline(always)]
2007        fn inline_size(_context: fidl::encoding::Context) -> usize {
2008            4
2009        }
2010        #[inline(always)]
2011        fn encode_is_copy() -> bool {
2012            true
2013        }
2014
2015        #[inline(always)]
2016        fn decode_is_copy() -> bool {
2017            true
2018        }
2019    }
2020
2021    unsafe impl<D: fidl::encoding::ResourceDialect>
2022        fidl::encoding::Encode<NetworkRegistryRemoveRequest, D> for &NetworkRegistryRemoveRequest
2023    {
2024        #[inline]
2025        unsafe fn encode(
2026            self,
2027            encoder: &mut fidl::encoding::Encoder<'_, D>,
2028            offset: usize,
2029            _depth: fidl::encoding::Depth,
2030        ) -> fidl::Result<()> {
2031            encoder.debug_check_bounds::<NetworkRegistryRemoveRequest>(offset);
2032            unsafe {
2033                // Copy the object into the buffer.
2034                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2035                (buf_ptr as *mut NetworkRegistryRemoveRequest)
2036                    .write_unaligned((self as *const NetworkRegistryRemoveRequest).read());
2037                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2038                // done second because the memcpy will write garbage to these bytes.
2039            }
2040            Ok(())
2041        }
2042    }
2043    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
2044        fidl::encoding::Encode<NetworkRegistryRemoveRequest, D> for (T0,)
2045    {
2046        #[inline]
2047        unsafe fn encode(
2048            self,
2049            encoder: &mut fidl::encoding::Encoder<'_, D>,
2050            offset: usize,
2051            depth: fidl::encoding::Depth,
2052        ) -> fidl::Result<()> {
2053            encoder.debug_check_bounds::<NetworkRegistryRemoveRequest>(offset);
2054            // Zero out padding regions. There's no need to apply masks
2055            // because the unmasked parts will be overwritten by fields.
2056            // Write the fields.
2057            self.0.encode(encoder, offset + 0, depth)?;
2058            Ok(())
2059        }
2060    }
2061
2062    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2063        for NetworkRegistryRemoveRequest
2064    {
2065        #[inline(always)]
2066        fn new_empty() -> Self {
2067            Self { network_id: fidl::new_empty!(u32, D) }
2068        }
2069
2070        #[inline]
2071        unsafe fn decode(
2072            &mut self,
2073            decoder: &mut fidl::encoding::Decoder<'_, D>,
2074            offset: usize,
2075            _depth: fidl::encoding::Depth,
2076        ) -> fidl::Result<()> {
2077            decoder.debug_check_bounds::<Self>(offset);
2078            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2079            // Verify that padding bytes are zero.
2080            // Copy from the buffer into the object.
2081            unsafe {
2082                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
2083            }
2084            Ok(())
2085        }
2086    }
2087
2088    impl fidl::encoding::ValueTypeMarker for NetworkRegistrySetDefaultRequest {
2089        type Borrowed<'a> = &'a Self;
2090        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2091            value
2092        }
2093    }
2094
2095    unsafe impl fidl::encoding::TypeMarker for NetworkRegistrySetDefaultRequest {
2096        type Owned = Self;
2097
2098        #[inline(always)]
2099        fn inline_align(_context: fidl::encoding::Context) -> usize {
2100            8
2101        }
2102
2103        #[inline(always)]
2104        fn inline_size(_context: fidl::encoding::Context) -> usize {
2105            16
2106        }
2107    }
2108
2109    unsafe impl<D: fidl::encoding::ResourceDialect>
2110        fidl::encoding::Encode<NetworkRegistrySetDefaultRequest, D>
2111        for &NetworkRegistrySetDefaultRequest
2112    {
2113        #[inline]
2114        unsafe fn encode(
2115            self,
2116            encoder: &mut fidl::encoding::Encoder<'_, D>,
2117            offset: usize,
2118            _depth: fidl::encoding::Depth,
2119        ) -> fidl::Result<()> {
2120            encoder.debug_check_bounds::<NetworkRegistrySetDefaultRequest>(offset);
2121            // Delegate to tuple encoding.
2122            fidl::encoding::Encode::<NetworkRegistrySetDefaultRequest, D>::encode(
2123                (
2124                    <fidl_fuchsia_posix_socket_common::OptionalUint32 as fidl::encoding::ValueTypeMarker>::borrow(&self.network_id),
2125                ),
2126                encoder, offset, _depth
2127            )
2128        }
2129    }
2130    unsafe impl<
2131        D: fidl::encoding::ResourceDialect,
2132        T0: fidl::encoding::Encode<fidl_fuchsia_posix_socket_common::OptionalUint32, D>,
2133    > fidl::encoding::Encode<NetworkRegistrySetDefaultRequest, D> for (T0,)
2134    {
2135        #[inline]
2136        unsafe fn encode(
2137            self,
2138            encoder: &mut fidl::encoding::Encoder<'_, D>,
2139            offset: usize,
2140            depth: fidl::encoding::Depth,
2141        ) -> fidl::Result<()> {
2142            encoder.debug_check_bounds::<NetworkRegistrySetDefaultRequest>(offset);
2143            // Zero out padding regions. There's no need to apply masks
2144            // because the unmasked parts will be overwritten by fields.
2145            // Write the fields.
2146            self.0.encode(encoder, offset + 0, depth)?;
2147            Ok(())
2148        }
2149    }
2150
2151    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2152        for NetworkRegistrySetDefaultRequest
2153    {
2154        #[inline(always)]
2155        fn new_empty() -> Self {
2156            Self {
2157                network_id: fidl::new_empty!(fidl_fuchsia_posix_socket_common::OptionalUint32, D),
2158            }
2159        }
2160
2161        #[inline]
2162        unsafe fn decode(
2163            &mut self,
2164            decoder: &mut fidl::encoding::Decoder<'_, D>,
2165            offset: usize,
2166            _depth: fidl::encoding::Depth,
2167        ) -> fidl::Result<()> {
2168            decoder.debug_check_bounds::<Self>(offset);
2169            // Verify that padding bytes are zero.
2170            fidl::decode!(
2171                fidl_fuchsia_posix_socket_common::OptionalUint32,
2172                D,
2173                &mut self.network_id,
2174                decoder,
2175                offset + 0,
2176                _depth
2177            )?;
2178            Ok(())
2179        }
2180    }
2181
2182    impl fidl::encoding::ValueTypeMarker for NetworkRegistryUpdateRequest {
2183        type Borrowed<'a> = &'a Self;
2184        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2185            value
2186        }
2187    }
2188
2189    unsafe impl fidl::encoding::TypeMarker for NetworkRegistryUpdateRequest {
2190        type Owned = Self;
2191
2192        #[inline(always)]
2193        fn inline_align(_context: fidl::encoding::Context) -> usize {
2194            8
2195        }
2196
2197        #[inline(always)]
2198        fn inline_size(_context: fidl::encoding::Context) -> usize {
2199            16
2200        }
2201    }
2202
2203    unsafe impl<D: fidl::encoding::ResourceDialect>
2204        fidl::encoding::Encode<NetworkRegistryUpdateRequest, D> for &NetworkRegistryUpdateRequest
2205    {
2206        #[inline]
2207        unsafe fn encode(
2208            self,
2209            encoder: &mut fidl::encoding::Encoder<'_, D>,
2210            offset: usize,
2211            _depth: fidl::encoding::Depth,
2212        ) -> fidl::Result<()> {
2213            encoder.debug_check_bounds::<NetworkRegistryUpdateRequest>(offset);
2214            // Delegate to tuple encoding.
2215            fidl::encoding::Encode::<NetworkRegistryUpdateRequest, D>::encode(
2216                (<Network as fidl::encoding::ValueTypeMarker>::borrow(&self.network),),
2217                encoder,
2218                offset,
2219                _depth,
2220            )
2221        }
2222    }
2223    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Network, D>>
2224        fidl::encoding::Encode<NetworkRegistryUpdateRequest, D> for (T0,)
2225    {
2226        #[inline]
2227        unsafe fn encode(
2228            self,
2229            encoder: &mut fidl::encoding::Encoder<'_, D>,
2230            offset: usize,
2231            depth: fidl::encoding::Depth,
2232        ) -> fidl::Result<()> {
2233            encoder.debug_check_bounds::<NetworkRegistryUpdateRequest>(offset);
2234            // Zero out padding regions. There's no need to apply masks
2235            // because the unmasked parts will be overwritten by fields.
2236            // Write the fields.
2237            self.0.encode(encoder, offset + 0, depth)?;
2238            Ok(())
2239        }
2240    }
2241
2242    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2243        for NetworkRegistryUpdateRequest
2244    {
2245        #[inline(always)]
2246        fn new_empty() -> Self {
2247            Self { network: fidl::new_empty!(Network, D) }
2248        }
2249
2250        #[inline]
2251        unsafe fn decode(
2252            &mut self,
2253            decoder: &mut fidl::encoding::Decoder<'_, D>,
2254            offset: usize,
2255            _depth: fidl::encoding::Depth,
2256        ) -> fidl::Result<()> {
2257            decoder.debug_check_bounds::<Self>(offset);
2258            // Verify that padding bytes are zero.
2259            fidl::decode!(Network, D, &mut self.network, decoder, offset + 0, _depth)?;
2260            Ok(())
2261        }
2262    }
2263
2264    impl fidl::encoding::ValueTypeMarker for PropertyWatcherWatchResponse {
2265        type Borrowed<'a> = &'a Self;
2266        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2267            value
2268        }
2269    }
2270
2271    unsafe impl fidl::encoding::TypeMarker for PropertyWatcherWatchResponse {
2272        type Owned = Self;
2273
2274        #[inline(always)]
2275        fn inline_align(_context: fidl::encoding::Context) -> usize {
2276            8
2277        }
2278
2279        #[inline(always)]
2280        fn inline_size(_context: fidl::encoding::Context) -> usize {
2281            16
2282        }
2283    }
2284
2285    unsafe impl<D: fidl::encoding::ResourceDialect>
2286        fidl::encoding::Encode<PropertyWatcherWatchResponse, D> for &PropertyWatcherWatchResponse
2287    {
2288        #[inline]
2289        unsafe fn encode(
2290            self,
2291            encoder: &mut fidl::encoding::Encoder<'_, D>,
2292            offset: usize,
2293            _depth: fidl::encoding::Depth,
2294        ) -> fidl::Result<()> {
2295            encoder.debug_check_bounds::<PropertyWatcherWatchResponse>(offset);
2296            // Delegate to tuple encoding.
2297            fidl::encoding::Encode::<PropertyWatcherWatchResponse, D>::encode(
2298                (<PropertyUpdate as fidl::encoding::ValueTypeMarker>::borrow(&self.updates),),
2299                encoder,
2300                offset,
2301                _depth,
2302            )
2303        }
2304    }
2305    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PropertyUpdate, D>>
2306        fidl::encoding::Encode<PropertyWatcherWatchResponse, D> for (T0,)
2307    {
2308        #[inline]
2309        unsafe fn encode(
2310            self,
2311            encoder: &mut fidl::encoding::Encoder<'_, D>,
2312            offset: usize,
2313            depth: fidl::encoding::Depth,
2314        ) -> fidl::Result<()> {
2315            encoder.debug_check_bounds::<PropertyWatcherWatchResponse>(offset);
2316            // Zero out padding regions. There's no need to apply masks
2317            // because the unmasked parts will be overwritten by fields.
2318            // Write the fields.
2319            self.0.encode(encoder, offset + 0, depth)?;
2320            Ok(())
2321        }
2322    }
2323
2324    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2325        for PropertyWatcherWatchResponse
2326    {
2327        #[inline(always)]
2328        fn new_empty() -> Self {
2329            Self { updates: fidl::new_empty!(PropertyUpdate, D) }
2330        }
2331
2332        #[inline]
2333        unsafe fn decode(
2334            &mut self,
2335            decoder: &mut fidl::encoding::Decoder<'_, D>,
2336            offset: usize,
2337            _depth: fidl::encoding::Depth,
2338        ) -> fidl::Result<()> {
2339            decoder.debug_check_bounds::<Self>(offset);
2340            // Verify that padding bytes are zero.
2341            fidl::decode!(PropertyUpdate, D, &mut self.updates, decoder, offset + 0, _depth)?;
2342            Ok(())
2343        }
2344    }
2345
2346    impl DnsConfiguration {
2347        #[inline(always)]
2348        fn max_ordinal_present(&self) -> u64 {
2349            if let Some(_) = self.servers {
2350                return 1;
2351            }
2352            0
2353        }
2354    }
2355
2356    impl fidl::encoding::ValueTypeMarker for DnsConfiguration {
2357        type Borrowed<'a> = &'a Self;
2358        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2359            value
2360        }
2361    }
2362
2363    unsafe impl fidl::encoding::TypeMarker for DnsConfiguration {
2364        type Owned = Self;
2365
2366        #[inline(always)]
2367        fn inline_align(_context: fidl::encoding::Context) -> usize {
2368            8
2369        }
2370
2371        #[inline(always)]
2372        fn inline_size(_context: fidl::encoding::Context) -> usize {
2373            16
2374        }
2375    }
2376
2377    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DnsConfiguration, D>
2378        for &DnsConfiguration
2379    {
2380        unsafe fn encode(
2381            self,
2382            encoder: &mut fidl::encoding::Encoder<'_, D>,
2383            offset: usize,
2384            mut depth: fidl::encoding::Depth,
2385        ) -> fidl::Result<()> {
2386            encoder.debug_check_bounds::<DnsConfiguration>(offset);
2387            // Vector header
2388            let max_ordinal: u64 = self.max_ordinal_present();
2389            encoder.write_num(max_ordinal, offset);
2390            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2391            // Calling encoder.out_of_line_offset(0) is not allowed.
2392            if max_ordinal == 0 {
2393                return Ok(());
2394            }
2395            depth.increment()?;
2396            let envelope_size = 8;
2397            let bytes_len = max_ordinal as usize * envelope_size;
2398            #[allow(unused_variables)]
2399            let offset = encoder.out_of_line_offset(bytes_len);
2400            let mut _prev_end_offset: usize = 0;
2401            if 1 > max_ordinal {
2402                return Ok(());
2403            }
2404
2405            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2406            // are envelope_size bytes.
2407            let cur_offset: usize = (1 - 1) * envelope_size;
2408
2409            // Zero reserved fields.
2410            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2411
2412            // Safety:
2413            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2414            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2415            //   envelope_size bytes, there is always sufficient room.
2416            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_net_name_common::DnsServer_>, D>(
2417            self.servers.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_net_name_common::DnsServer_> as fidl::encoding::ValueTypeMarker>::borrow),
2418            encoder, offset + cur_offset, depth
2419        )?;
2420
2421            _prev_end_offset = cur_offset + envelope_size;
2422
2423            Ok(())
2424        }
2425    }
2426
2427    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DnsConfiguration {
2428        #[inline(always)]
2429        fn new_empty() -> Self {
2430            Self::default()
2431        }
2432
2433        unsafe fn decode(
2434            &mut self,
2435            decoder: &mut fidl::encoding::Decoder<'_, D>,
2436            offset: usize,
2437            mut depth: fidl::encoding::Depth,
2438        ) -> fidl::Result<()> {
2439            decoder.debug_check_bounds::<Self>(offset);
2440            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2441                None => return Err(fidl::Error::NotNullable),
2442                Some(len) => len,
2443            };
2444            // Calling decoder.out_of_line_offset(0) is not allowed.
2445            if len == 0 {
2446                return Ok(());
2447            };
2448            depth.increment()?;
2449            let envelope_size = 8;
2450            let bytes_len = len * envelope_size;
2451            let offset = decoder.out_of_line_offset(bytes_len)?;
2452            // Decode the envelope for each type.
2453            let mut _next_ordinal_to_read = 0;
2454            let mut next_offset = offset;
2455            let end_offset = offset + bytes_len;
2456            _next_ordinal_to_read += 1;
2457            if next_offset >= end_offset {
2458                return Ok(());
2459            }
2460
2461            // Decode unknown envelopes for gaps in ordinals.
2462            while _next_ordinal_to_read < 1 {
2463                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2464                _next_ordinal_to_read += 1;
2465                next_offset += envelope_size;
2466            }
2467
2468            let next_out_of_line = decoder.next_out_of_line();
2469            let handles_before = decoder.remaining_handles();
2470            if let Some((inlined, num_bytes, num_handles)) =
2471                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2472            {
2473                let member_inline_size = <fidl::encoding::UnboundedVector<
2474                    fidl_fuchsia_net_name_common::DnsServer_,
2475                > as fidl::encoding::TypeMarker>::inline_size(
2476                    decoder.context
2477                );
2478                if inlined != (member_inline_size <= 4) {
2479                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2480                }
2481                let inner_offset;
2482                let mut inner_depth = depth.clone();
2483                if inlined {
2484                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2485                    inner_offset = next_offset;
2486                } else {
2487                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2488                    inner_depth.increment()?;
2489                }
2490                let val_ref = self.servers.get_or_insert_with(|| {
2491                    fidl::new_empty!(
2492                        fidl::encoding::UnboundedVector<fidl_fuchsia_net_name_common::DnsServer_>,
2493                        D
2494                    )
2495                });
2496                fidl::decode!(
2497                    fidl::encoding::UnboundedVector<fidl_fuchsia_net_name_common::DnsServer_>,
2498                    D,
2499                    val_ref,
2500                    decoder,
2501                    inner_offset,
2502                    inner_depth
2503                )?;
2504                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2505                {
2506                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2507                }
2508                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2509                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2510                }
2511            }
2512
2513            next_offset += envelope_size;
2514
2515            // Decode the remaining unknown envelopes.
2516            while next_offset < end_offset {
2517                _next_ordinal_to_read += 1;
2518                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2519                next_offset += envelope_size;
2520            }
2521
2522            Ok(())
2523        }
2524    }
2525
2526    impl FuchsiaNetworkInfo {
2527        #[inline(always)]
2528        fn max_ordinal_present(&self) -> u64 {
2529            0
2530        }
2531    }
2532
2533    impl fidl::encoding::ValueTypeMarker for FuchsiaNetworkInfo {
2534        type Borrowed<'a> = &'a Self;
2535        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2536            value
2537        }
2538    }
2539
2540    unsafe impl fidl::encoding::TypeMarker for FuchsiaNetworkInfo {
2541        type Owned = Self;
2542
2543        #[inline(always)]
2544        fn inline_align(_context: fidl::encoding::Context) -> usize {
2545            8
2546        }
2547
2548        #[inline(always)]
2549        fn inline_size(_context: fidl::encoding::Context) -> usize {
2550            16
2551        }
2552    }
2553
2554    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FuchsiaNetworkInfo, D>
2555        for &FuchsiaNetworkInfo
2556    {
2557        unsafe fn encode(
2558            self,
2559            encoder: &mut fidl::encoding::Encoder<'_, D>,
2560            offset: usize,
2561            mut depth: fidl::encoding::Depth,
2562        ) -> fidl::Result<()> {
2563            encoder.debug_check_bounds::<FuchsiaNetworkInfo>(offset);
2564            // Vector header
2565            let max_ordinal: u64 = self.max_ordinal_present();
2566            encoder.write_num(max_ordinal, offset);
2567            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2568            // Calling encoder.out_of_line_offset(0) is not allowed.
2569            if max_ordinal == 0 {
2570                return Ok(());
2571            }
2572            depth.increment()?;
2573            let envelope_size = 8;
2574            let bytes_len = max_ordinal as usize * envelope_size;
2575            #[allow(unused_variables)]
2576            let offset = encoder.out_of_line_offset(bytes_len);
2577            let mut _prev_end_offset: usize = 0;
2578
2579            Ok(())
2580        }
2581    }
2582
2583    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FuchsiaNetworkInfo {
2584        #[inline(always)]
2585        fn new_empty() -> Self {
2586            Self::default()
2587        }
2588
2589        unsafe fn decode(
2590            &mut self,
2591            decoder: &mut fidl::encoding::Decoder<'_, D>,
2592            offset: usize,
2593            mut depth: fidl::encoding::Depth,
2594        ) -> fidl::Result<()> {
2595            decoder.debug_check_bounds::<Self>(offset);
2596            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2597                None => return Err(fidl::Error::NotNullable),
2598                Some(len) => len,
2599            };
2600            // Calling decoder.out_of_line_offset(0) is not allowed.
2601            if len == 0 {
2602                return Ok(());
2603            };
2604            depth.increment()?;
2605            let envelope_size = 8;
2606            let bytes_len = len * envelope_size;
2607            let offset = decoder.out_of_line_offset(bytes_len)?;
2608            // Decode the envelope for each type.
2609            let mut _next_ordinal_to_read = 0;
2610            let mut next_offset = offset;
2611            let end_offset = offset + bytes_len;
2612
2613            // Decode the remaining unknown envelopes.
2614            while next_offset < end_offset {
2615                _next_ordinal_to_read += 1;
2616                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2617                next_offset += envelope_size;
2618            }
2619
2620            Ok(())
2621        }
2622    }
2623
2624    impl Network {
2625        #[inline(always)]
2626        fn max_ordinal_present(&self) -> u64 {
2627            if let Some(_) = self.has_default_route {
2628                return 9;
2629            }
2630            if let Some(_) = self.has_address {
2631                return 8;
2632            }
2633            if let Some(_) = self.name {
2634                return 7;
2635            }
2636            if let Some(_) = self.connectivity {
2637                return 6;
2638            }
2639            if let Some(_) = self.capabilities {
2640                return 5;
2641            }
2642            if let Some(_) = self.network_type {
2643                return 4;
2644            }
2645            if let Some(_) = self.dns_servers {
2646                return 3;
2647            }
2648            if let Some(_) = self.info {
2649                return 2;
2650            }
2651            if let Some(_) = self.network_id {
2652                return 1;
2653            }
2654            0
2655        }
2656    }
2657
2658    impl fidl::encoding::ValueTypeMarker for Network {
2659        type Borrowed<'a> = &'a Self;
2660        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2661            value
2662        }
2663    }
2664
2665    unsafe impl fidl::encoding::TypeMarker for Network {
2666        type Owned = Self;
2667
2668        #[inline(always)]
2669        fn inline_align(_context: fidl::encoding::Context) -> usize {
2670            8
2671        }
2672
2673        #[inline(always)]
2674        fn inline_size(_context: fidl::encoding::Context) -> usize {
2675            16
2676        }
2677    }
2678
2679    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Network, D> for &Network {
2680        unsafe fn encode(
2681            self,
2682            encoder: &mut fidl::encoding::Encoder<'_, D>,
2683            offset: usize,
2684            mut depth: fidl::encoding::Depth,
2685        ) -> fidl::Result<()> {
2686            encoder.debug_check_bounds::<Network>(offset);
2687            // Vector header
2688            let max_ordinal: u64 = self.max_ordinal_present();
2689            encoder.write_num(max_ordinal, offset);
2690            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2691            // Calling encoder.out_of_line_offset(0) is not allowed.
2692            if max_ordinal == 0 {
2693                return Ok(());
2694            }
2695            depth.increment()?;
2696            let envelope_size = 8;
2697            let bytes_len = max_ordinal as usize * envelope_size;
2698            #[allow(unused_variables)]
2699            let offset = encoder.out_of_line_offset(bytes_len);
2700            let mut _prev_end_offset: usize = 0;
2701            if 1 > max_ordinal {
2702                return Ok(());
2703            }
2704
2705            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2706            // are envelope_size bytes.
2707            let cur_offset: usize = (1 - 1) * envelope_size;
2708
2709            // Zero reserved fields.
2710            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2711
2712            // Safety:
2713            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2714            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2715            //   envelope_size bytes, there is always sufficient room.
2716            fidl::encoding::encode_in_envelope_optional::<u32, D>(
2717                self.network_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2718                encoder,
2719                offset + cur_offset,
2720                depth,
2721            )?;
2722
2723            _prev_end_offset = cur_offset + envelope_size;
2724            if 2 > max_ordinal {
2725                return Ok(());
2726            }
2727
2728            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2729            // are envelope_size bytes.
2730            let cur_offset: usize = (2 - 1) * envelope_size;
2731
2732            // Zero reserved fields.
2733            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2734
2735            // Safety:
2736            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2737            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2738            //   envelope_size bytes, there is always sufficient room.
2739            fidl::encoding::encode_in_envelope_optional::<NetworkInfo, D>(
2740                self.info.as_ref().map(<NetworkInfo as fidl::encoding::ValueTypeMarker>::borrow),
2741                encoder,
2742                offset + cur_offset,
2743                depth,
2744            )?;
2745
2746            _prev_end_offset = cur_offset + envelope_size;
2747            if 3 > max_ordinal {
2748                return Ok(());
2749            }
2750
2751            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2752            // are envelope_size bytes.
2753            let cur_offset: usize = (3 - 1) * envelope_size;
2754
2755            // Zero reserved fields.
2756            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2757
2758            // Safety:
2759            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2760            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2761            //   envelope_size bytes, there is always sufficient room.
2762            fidl::encoding::encode_in_envelope_optional::<NetworkDnsServers, D>(
2763                self.dns_servers
2764                    .as_ref()
2765                    .map(<NetworkDnsServers as fidl::encoding::ValueTypeMarker>::borrow),
2766                encoder,
2767                offset + cur_offset,
2768                depth,
2769            )?;
2770
2771            _prev_end_offset = cur_offset + envelope_size;
2772            if 4 > max_ordinal {
2773                return Ok(());
2774            }
2775
2776            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2777            // are envelope_size bytes.
2778            let cur_offset: usize = (4 - 1) * envelope_size;
2779
2780            // Zero reserved fields.
2781            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2782
2783            // Safety:
2784            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2785            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2786            //   envelope_size bytes, there is always sufficient room.
2787            fidl::encoding::encode_in_envelope_optional::<NetworkType, D>(
2788                self.network_type
2789                    .as_ref()
2790                    .map(<NetworkType as fidl::encoding::ValueTypeMarker>::borrow),
2791                encoder,
2792                offset + cur_offset,
2793                depth,
2794            )?;
2795
2796            _prev_end_offset = cur_offset + envelope_size;
2797            if 5 > max_ordinal {
2798                return Ok(());
2799            }
2800
2801            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2802            // are envelope_size bytes.
2803            let cur_offset: usize = (5 - 1) * envelope_size;
2804
2805            // Zero reserved fields.
2806            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2807
2808            // Safety:
2809            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2810            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2811            //   envelope_size bytes, there is always sufficient room.
2812            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<NetworkCapability>, D>(
2813            self.capabilities.as_ref().map(<fidl::encoding::UnboundedVector<NetworkCapability> as fidl::encoding::ValueTypeMarker>::borrow),
2814            encoder, offset + cur_offset, depth
2815        )?;
2816
2817            _prev_end_offset = cur_offset + envelope_size;
2818            if 6 > max_ordinal {
2819                return Ok(());
2820            }
2821
2822            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2823            // are envelope_size bytes.
2824            let cur_offset: usize = (6 - 1) * envelope_size;
2825
2826            // Zero reserved fields.
2827            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2828
2829            // Safety:
2830            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2831            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2832            //   envelope_size bytes, there is always sufficient room.
2833            fidl::encoding::encode_in_envelope_optional::<ConnectivityState, D>(
2834                self.connectivity
2835                    .as_ref()
2836                    .map(<ConnectivityState as fidl::encoding::ValueTypeMarker>::borrow),
2837                encoder,
2838                offset + cur_offset,
2839                depth,
2840            )?;
2841
2842            _prev_end_offset = cur_offset + envelope_size;
2843            if 7 > max_ordinal {
2844                return Ok(());
2845            }
2846
2847            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2848            // are envelope_size bytes.
2849            let cur_offset: usize = (7 - 1) * envelope_size;
2850
2851            // Zero reserved fields.
2852            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2853
2854            // Safety:
2855            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2856            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2857            //   envelope_size bytes, there is always sufficient room.
2858            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<15>, D>(
2859                self.name.as_ref().map(
2860                    <fidl::encoding::BoundedString<15> as fidl::encoding::ValueTypeMarker>::borrow,
2861                ),
2862                encoder,
2863                offset + cur_offset,
2864                depth,
2865            )?;
2866
2867            _prev_end_offset = cur_offset + envelope_size;
2868            if 8 > max_ordinal {
2869                return Ok(());
2870            }
2871
2872            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2873            // are envelope_size bytes.
2874            let cur_offset: usize = (8 - 1) * envelope_size;
2875
2876            // Zero reserved fields.
2877            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2878
2879            // Safety:
2880            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2881            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2882            //   envelope_size bytes, there is always sufficient room.
2883            fidl::encoding::encode_in_envelope_optional::<ProtoProperties, D>(
2884                self.has_address
2885                    .as_ref()
2886                    .map(<ProtoProperties as fidl::encoding::ValueTypeMarker>::borrow),
2887                encoder,
2888                offset + cur_offset,
2889                depth,
2890            )?;
2891
2892            _prev_end_offset = cur_offset + envelope_size;
2893            if 9 > max_ordinal {
2894                return Ok(());
2895            }
2896
2897            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2898            // are envelope_size bytes.
2899            let cur_offset: usize = (9 - 1) * envelope_size;
2900
2901            // Zero reserved fields.
2902            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2903
2904            // Safety:
2905            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2906            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2907            //   envelope_size bytes, there is always sufficient room.
2908            fidl::encoding::encode_in_envelope_optional::<ProtoProperties, D>(
2909                self.has_default_route
2910                    .as_ref()
2911                    .map(<ProtoProperties as fidl::encoding::ValueTypeMarker>::borrow),
2912                encoder,
2913                offset + cur_offset,
2914                depth,
2915            )?;
2916
2917            _prev_end_offset = cur_offset + envelope_size;
2918
2919            Ok(())
2920        }
2921    }
2922
2923    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Network {
2924        #[inline(always)]
2925        fn new_empty() -> Self {
2926            Self::default()
2927        }
2928
2929        unsafe fn decode(
2930            &mut self,
2931            decoder: &mut fidl::encoding::Decoder<'_, D>,
2932            offset: usize,
2933            mut depth: fidl::encoding::Depth,
2934        ) -> fidl::Result<()> {
2935            decoder.debug_check_bounds::<Self>(offset);
2936            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2937                None => return Err(fidl::Error::NotNullable),
2938                Some(len) => len,
2939            };
2940            // Calling decoder.out_of_line_offset(0) is not allowed.
2941            if len == 0 {
2942                return Ok(());
2943            };
2944            depth.increment()?;
2945            let envelope_size = 8;
2946            let bytes_len = len * envelope_size;
2947            let offset = decoder.out_of_line_offset(bytes_len)?;
2948            // Decode the envelope for each type.
2949            let mut _next_ordinal_to_read = 0;
2950            let mut next_offset = offset;
2951            let end_offset = offset + bytes_len;
2952            _next_ordinal_to_read += 1;
2953            if next_offset >= end_offset {
2954                return Ok(());
2955            }
2956
2957            // Decode unknown envelopes for gaps in ordinals.
2958            while _next_ordinal_to_read < 1 {
2959                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2960                _next_ordinal_to_read += 1;
2961                next_offset += envelope_size;
2962            }
2963
2964            let next_out_of_line = decoder.next_out_of_line();
2965            let handles_before = decoder.remaining_handles();
2966            if let Some((inlined, num_bytes, num_handles)) =
2967                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2968            {
2969                let member_inline_size =
2970                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2971                if inlined != (member_inline_size <= 4) {
2972                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2973                }
2974                let inner_offset;
2975                let mut inner_depth = depth.clone();
2976                if inlined {
2977                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2978                    inner_offset = next_offset;
2979                } else {
2980                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2981                    inner_depth.increment()?;
2982                }
2983                let val_ref = self.network_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
2984                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
2985                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2986                {
2987                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2988                }
2989                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2990                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2991                }
2992            }
2993
2994            next_offset += envelope_size;
2995            _next_ordinal_to_read += 1;
2996            if next_offset >= end_offset {
2997                return Ok(());
2998            }
2999
3000            // Decode unknown envelopes for gaps in ordinals.
3001            while _next_ordinal_to_read < 2 {
3002                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3003                _next_ordinal_to_read += 1;
3004                next_offset += envelope_size;
3005            }
3006
3007            let next_out_of_line = decoder.next_out_of_line();
3008            let handles_before = decoder.remaining_handles();
3009            if let Some((inlined, num_bytes, num_handles)) =
3010                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3011            {
3012                let member_inline_size =
3013                    <NetworkInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3014                if inlined != (member_inline_size <= 4) {
3015                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3016                }
3017                let inner_offset;
3018                let mut inner_depth = depth.clone();
3019                if inlined {
3020                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3021                    inner_offset = next_offset;
3022                } else {
3023                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3024                    inner_depth.increment()?;
3025                }
3026                let val_ref = self.info.get_or_insert_with(|| fidl::new_empty!(NetworkInfo, D));
3027                fidl::decode!(NetworkInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
3028                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3029                {
3030                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3031                }
3032                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3033                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3034                }
3035            }
3036
3037            next_offset += envelope_size;
3038            _next_ordinal_to_read += 1;
3039            if next_offset >= end_offset {
3040                return Ok(());
3041            }
3042
3043            // Decode unknown envelopes for gaps in ordinals.
3044            while _next_ordinal_to_read < 3 {
3045                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3046                _next_ordinal_to_read += 1;
3047                next_offset += envelope_size;
3048            }
3049
3050            let next_out_of_line = decoder.next_out_of_line();
3051            let handles_before = decoder.remaining_handles();
3052            if let Some((inlined, num_bytes, num_handles)) =
3053                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3054            {
3055                let member_inline_size =
3056                    <NetworkDnsServers as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3057                if inlined != (member_inline_size <= 4) {
3058                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3059                }
3060                let inner_offset;
3061                let mut inner_depth = depth.clone();
3062                if inlined {
3063                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3064                    inner_offset = next_offset;
3065                } else {
3066                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3067                    inner_depth.increment()?;
3068                }
3069                let val_ref =
3070                    self.dns_servers.get_or_insert_with(|| fidl::new_empty!(NetworkDnsServers, D));
3071                fidl::decode!(NetworkDnsServers, D, val_ref, decoder, inner_offset, inner_depth)?;
3072                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3073                {
3074                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3075                }
3076                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3077                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3078                }
3079            }
3080
3081            next_offset += envelope_size;
3082            _next_ordinal_to_read += 1;
3083            if next_offset >= end_offset {
3084                return Ok(());
3085            }
3086
3087            // Decode unknown envelopes for gaps in ordinals.
3088            while _next_ordinal_to_read < 4 {
3089                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3090                _next_ordinal_to_read += 1;
3091                next_offset += envelope_size;
3092            }
3093
3094            let next_out_of_line = decoder.next_out_of_line();
3095            let handles_before = decoder.remaining_handles();
3096            if let Some((inlined, num_bytes, num_handles)) =
3097                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3098            {
3099                let member_inline_size =
3100                    <NetworkType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3101                if inlined != (member_inline_size <= 4) {
3102                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3103                }
3104                let inner_offset;
3105                let mut inner_depth = depth.clone();
3106                if inlined {
3107                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3108                    inner_offset = next_offset;
3109                } else {
3110                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3111                    inner_depth.increment()?;
3112                }
3113                let val_ref =
3114                    self.network_type.get_or_insert_with(|| fidl::new_empty!(NetworkType, D));
3115                fidl::decode!(NetworkType, D, val_ref, decoder, inner_offset, inner_depth)?;
3116                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3117                {
3118                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3119                }
3120                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3121                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3122                }
3123            }
3124
3125            next_offset += envelope_size;
3126            _next_ordinal_to_read += 1;
3127            if next_offset >= end_offset {
3128                return Ok(());
3129            }
3130
3131            // Decode unknown envelopes for gaps in ordinals.
3132            while _next_ordinal_to_read < 5 {
3133                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3134                _next_ordinal_to_read += 1;
3135                next_offset += envelope_size;
3136            }
3137
3138            let next_out_of_line = decoder.next_out_of_line();
3139            let handles_before = decoder.remaining_handles();
3140            if let Some((inlined, num_bytes, num_handles)) =
3141                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3142            {
3143                let member_inline_size = <fidl::encoding::UnboundedVector<NetworkCapability> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3144                if inlined != (member_inline_size <= 4) {
3145                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3146                }
3147                let inner_offset;
3148                let mut inner_depth = depth.clone();
3149                if inlined {
3150                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3151                    inner_offset = next_offset;
3152                } else {
3153                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3154                    inner_depth.increment()?;
3155                }
3156                let val_ref = self.capabilities.get_or_insert_with(|| {
3157                    fidl::new_empty!(fidl::encoding::UnboundedVector<NetworkCapability>, D)
3158                });
3159                fidl::decode!(
3160                    fidl::encoding::UnboundedVector<NetworkCapability>,
3161                    D,
3162                    val_ref,
3163                    decoder,
3164                    inner_offset,
3165                    inner_depth
3166                )?;
3167                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3168                {
3169                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3170                }
3171                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3172                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3173                }
3174            }
3175
3176            next_offset += envelope_size;
3177            _next_ordinal_to_read += 1;
3178            if next_offset >= end_offset {
3179                return Ok(());
3180            }
3181
3182            // Decode unknown envelopes for gaps in ordinals.
3183            while _next_ordinal_to_read < 6 {
3184                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3185                _next_ordinal_to_read += 1;
3186                next_offset += envelope_size;
3187            }
3188
3189            let next_out_of_line = decoder.next_out_of_line();
3190            let handles_before = decoder.remaining_handles();
3191            if let Some((inlined, num_bytes, num_handles)) =
3192                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3193            {
3194                let member_inline_size =
3195                    <ConnectivityState as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3196                if inlined != (member_inline_size <= 4) {
3197                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3198                }
3199                let inner_offset;
3200                let mut inner_depth = depth.clone();
3201                if inlined {
3202                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3203                    inner_offset = next_offset;
3204                } else {
3205                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3206                    inner_depth.increment()?;
3207                }
3208                let val_ref =
3209                    self.connectivity.get_or_insert_with(|| fidl::new_empty!(ConnectivityState, D));
3210                fidl::decode!(ConnectivityState, D, val_ref, decoder, inner_offset, inner_depth)?;
3211                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3212                {
3213                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3214                }
3215                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3216                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3217                }
3218            }
3219
3220            next_offset += envelope_size;
3221            _next_ordinal_to_read += 1;
3222            if next_offset >= end_offset {
3223                return Ok(());
3224            }
3225
3226            // Decode unknown envelopes for gaps in ordinals.
3227            while _next_ordinal_to_read < 7 {
3228                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3229                _next_ordinal_to_read += 1;
3230                next_offset += envelope_size;
3231            }
3232
3233            let next_out_of_line = decoder.next_out_of_line();
3234            let handles_before = decoder.remaining_handles();
3235            if let Some((inlined, num_bytes, num_handles)) =
3236                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3237            {
3238                let member_inline_size =
3239                    <fidl::encoding::BoundedString<15> as fidl::encoding::TypeMarker>::inline_size(
3240                        decoder.context,
3241                    );
3242                if inlined != (member_inline_size <= 4) {
3243                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3244                }
3245                let inner_offset;
3246                let mut inner_depth = depth.clone();
3247                if inlined {
3248                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3249                    inner_offset = next_offset;
3250                } else {
3251                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3252                    inner_depth.increment()?;
3253                }
3254                let val_ref = self
3255                    .name
3256                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<15>, D));
3257                fidl::decode!(
3258                    fidl::encoding::BoundedString<15>,
3259                    D,
3260                    val_ref,
3261                    decoder,
3262                    inner_offset,
3263                    inner_depth
3264                )?;
3265                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3266                {
3267                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3268                }
3269                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3270                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3271                }
3272            }
3273
3274            next_offset += envelope_size;
3275            _next_ordinal_to_read += 1;
3276            if next_offset >= end_offset {
3277                return Ok(());
3278            }
3279
3280            // Decode unknown envelopes for gaps in ordinals.
3281            while _next_ordinal_to_read < 8 {
3282                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3283                _next_ordinal_to_read += 1;
3284                next_offset += envelope_size;
3285            }
3286
3287            let next_out_of_line = decoder.next_out_of_line();
3288            let handles_before = decoder.remaining_handles();
3289            if let Some((inlined, num_bytes, num_handles)) =
3290                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3291            {
3292                let member_inline_size =
3293                    <ProtoProperties as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3294                if inlined != (member_inline_size <= 4) {
3295                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3296                }
3297                let inner_offset;
3298                let mut inner_depth = depth.clone();
3299                if inlined {
3300                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3301                    inner_offset = next_offset;
3302                } else {
3303                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3304                    inner_depth.increment()?;
3305                }
3306                let val_ref =
3307                    self.has_address.get_or_insert_with(|| fidl::new_empty!(ProtoProperties, D));
3308                fidl::decode!(ProtoProperties, D, val_ref, decoder, inner_offset, inner_depth)?;
3309                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3310                {
3311                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3312                }
3313                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3314                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3315                }
3316            }
3317
3318            next_offset += envelope_size;
3319            _next_ordinal_to_read += 1;
3320            if next_offset >= end_offset {
3321                return Ok(());
3322            }
3323
3324            // Decode unknown envelopes for gaps in ordinals.
3325            while _next_ordinal_to_read < 9 {
3326                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3327                _next_ordinal_to_read += 1;
3328                next_offset += envelope_size;
3329            }
3330
3331            let next_out_of_line = decoder.next_out_of_line();
3332            let handles_before = decoder.remaining_handles();
3333            if let Some((inlined, num_bytes, num_handles)) =
3334                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3335            {
3336                let member_inline_size =
3337                    <ProtoProperties as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3338                if inlined != (member_inline_size <= 4) {
3339                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3340                }
3341                let inner_offset;
3342                let mut inner_depth = depth.clone();
3343                if inlined {
3344                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3345                    inner_offset = next_offset;
3346                } else {
3347                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3348                    inner_depth.increment()?;
3349                }
3350                let val_ref = self
3351                    .has_default_route
3352                    .get_or_insert_with(|| fidl::new_empty!(ProtoProperties, D));
3353                fidl::decode!(ProtoProperties, D, val_ref, decoder, inner_offset, inner_depth)?;
3354                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3355                {
3356                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3357                }
3358                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3359                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3360                }
3361            }
3362
3363            next_offset += envelope_size;
3364
3365            // Decode the remaining unknown envelopes.
3366            while next_offset < end_offset {
3367                _next_ordinal_to_read += 1;
3368                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3369                next_offset += envelope_size;
3370            }
3371
3372            Ok(())
3373        }
3374    }
3375
3376    impl NetworkDnsServers {
3377        #[inline(always)]
3378        fn max_ordinal_present(&self) -> u64 {
3379            if let Some(_) = self.v6 {
3380                return 2;
3381            }
3382            if let Some(_) = self.v4 {
3383                return 1;
3384            }
3385            0
3386        }
3387    }
3388
3389    impl fidl::encoding::ValueTypeMarker for NetworkDnsServers {
3390        type Borrowed<'a> = &'a Self;
3391        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3392            value
3393        }
3394    }
3395
3396    unsafe impl fidl::encoding::TypeMarker for NetworkDnsServers {
3397        type Owned = Self;
3398
3399        #[inline(always)]
3400        fn inline_align(_context: fidl::encoding::Context) -> usize {
3401            8
3402        }
3403
3404        #[inline(always)]
3405        fn inline_size(_context: fidl::encoding::Context) -> usize {
3406            16
3407        }
3408    }
3409
3410    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NetworkDnsServers, D>
3411        for &NetworkDnsServers
3412    {
3413        unsafe fn encode(
3414            self,
3415            encoder: &mut fidl::encoding::Encoder<'_, D>,
3416            offset: usize,
3417            mut depth: fidl::encoding::Depth,
3418        ) -> fidl::Result<()> {
3419            encoder.debug_check_bounds::<NetworkDnsServers>(offset);
3420            // Vector header
3421            let max_ordinal: u64 = self.max_ordinal_present();
3422            encoder.write_num(max_ordinal, offset);
3423            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3424            // Calling encoder.out_of_line_offset(0) is not allowed.
3425            if max_ordinal == 0 {
3426                return Ok(());
3427            }
3428            depth.increment()?;
3429            let envelope_size = 8;
3430            let bytes_len = max_ordinal as usize * envelope_size;
3431            #[allow(unused_variables)]
3432            let offset = encoder.out_of_line_offset(bytes_len);
3433            let mut _prev_end_offset: usize = 0;
3434            if 1 > max_ordinal {
3435                return Ok(());
3436            }
3437
3438            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3439            // are envelope_size bytes.
3440            let cur_offset: usize = (1 - 1) * envelope_size;
3441
3442            // Zero reserved fields.
3443            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3444
3445            // Safety:
3446            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3447            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3448            //   envelope_size bytes, there is always sufficient room.
3449            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_net_common::Ipv4Address>, D>(
3450            self.v4.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_net_common::Ipv4Address> as fidl::encoding::ValueTypeMarker>::borrow),
3451            encoder, offset + cur_offset, depth
3452        )?;
3453
3454            _prev_end_offset = cur_offset + envelope_size;
3455            if 2 > max_ordinal {
3456                return Ok(());
3457            }
3458
3459            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3460            // are envelope_size bytes.
3461            let cur_offset: usize = (2 - 1) * envelope_size;
3462
3463            // Zero reserved fields.
3464            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3465
3466            // Safety:
3467            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3468            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3469            //   envelope_size bytes, there is always sufficient room.
3470            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_net_common::Ipv6Address>, D>(
3471            self.v6.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_net_common::Ipv6Address> as fidl::encoding::ValueTypeMarker>::borrow),
3472            encoder, offset + cur_offset, depth
3473        )?;
3474
3475            _prev_end_offset = cur_offset + envelope_size;
3476
3477            Ok(())
3478        }
3479    }
3480
3481    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NetworkDnsServers {
3482        #[inline(always)]
3483        fn new_empty() -> Self {
3484            Self::default()
3485        }
3486
3487        unsafe fn decode(
3488            &mut self,
3489            decoder: &mut fidl::encoding::Decoder<'_, D>,
3490            offset: usize,
3491            mut depth: fidl::encoding::Depth,
3492        ) -> fidl::Result<()> {
3493            decoder.debug_check_bounds::<Self>(offset);
3494            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3495                None => return Err(fidl::Error::NotNullable),
3496                Some(len) => len,
3497            };
3498            // Calling decoder.out_of_line_offset(0) is not allowed.
3499            if len == 0 {
3500                return Ok(());
3501            };
3502            depth.increment()?;
3503            let envelope_size = 8;
3504            let bytes_len = len * envelope_size;
3505            let offset = decoder.out_of_line_offset(bytes_len)?;
3506            // Decode the envelope for each type.
3507            let mut _next_ordinal_to_read = 0;
3508            let mut next_offset = offset;
3509            let end_offset = offset + bytes_len;
3510            _next_ordinal_to_read += 1;
3511            if next_offset >= end_offset {
3512                return Ok(());
3513            }
3514
3515            // Decode unknown envelopes for gaps in ordinals.
3516            while _next_ordinal_to_read < 1 {
3517                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3518                _next_ordinal_to_read += 1;
3519                next_offset += envelope_size;
3520            }
3521
3522            let next_out_of_line = decoder.next_out_of_line();
3523            let handles_before = decoder.remaining_handles();
3524            if let Some((inlined, num_bytes, num_handles)) =
3525                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3526            {
3527                let member_inline_size = <fidl::encoding::UnboundedVector<
3528                    fidl_fuchsia_net_common::Ipv4Address,
3529                > as fidl::encoding::TypeMarker>::inline_size(
3530                    decoder.context
3531                );
3532                if inlined != (member_inline_size <= 4) {
3533                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3534                }
3535                let inner_offset;
3536                let mut inner_depth = depth.clone();
3537                if inlined {
3538                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3539                    inner_offset = next_offset;
3540                } else {
3541                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3542                    inner_depth.increment()?;
3543                }
3544                let val_ref = self.v4.get_or_insert_with(|| {
3545                    fidl::new_empty!(
3546                        fidl::encoding::UnboundedVector<fidl_fuchsia_net_common::Ipv4Address>,
3547                        D
3548                    )
3549                });
3550                fidl::decode!(
3551                    fidl::encoding::UnboundedVector<fidl_fuchsia_net_common::Ipv4Address>,
3552                    D,
3553                    val_ref,
3554                    decoder,
3555                    inner_offset,
3556                    inner_depth
3557                )?;
3558                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3559                {
3560                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3561                }
3562                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3563                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3564                }
3565            }
3566
3567            next_offset += envelope_size;
3568            _next_ordinal_to_read += 1;
3569            if next_offset >= end_offset {
3570                return Ok(());
3571            }
3572
3573            // Decode unknown envelopes for gaps in ordinals.
3574            while _next_ordinal_to_read < 2 {
3575                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3576                _next_ordinal_to_read += 1;
3577                next_offset += envelope_size;
3578            }
3579
3580            let next_out_of_line = decoder.next_out_of_line();
3581            let handles_before = decoder.remaining_handles();
3582            if let Some((inlined, num_bytes, num_handles)) =
3583                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3584            {
3585                let member_inline_size = <fidl::encoding::UnboundedVector<
3586                    fidl_fuchsia_net_common::Ipv6Address,
3587                > as fidl::encoding::TypeMarker>::inline_size(
3588                    decoder.context
3589                );
3590                if inlined != (member_inline_size <= 4) {
3591                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3592                }
3593                let inner_offset;
3594                let mut inner_depth = depth.clone();
3595                if inlined {
3596                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3597                    inner_offset = next_offset;
3598                } else {
3599                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3600                    inner_depth.increment()?;
3601                }
3602                let val_ref = self.v6.get_or_insert_with(|| {
3603                    fidl::new_empty!(
3604                        fidl::encoding::UnboundedVector<fidl_fuchsia_net_common::Ipv6Address>,
3605                        D
3606                    )
3607                });
3608                fidl::decode!(
3609                    fidl::encoding::UnboundedVector<fidl_fuchsia_net_common::Ipv6Address>,
3610                    D,
3611                    val_ref,
3612                    decoder,
3613                    inner_offset,
3614                    inner_depth
3615                )?;
3616                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3617                {
3618                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3619                }
3620                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3621                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3622                }
3623            }
3624
3625            next_offset += envelope_size;
3626
3627            // Decode the remaining unknown envelopes.
3628            while next_offset < end_offset {
3629                _next_ordinal_to_read += 1;
3630                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3631                next_offset += envelope_size;
3632            }
3633
3634            Ok(())
3635        }
3636    }
3637
3638    impl PropertyUpdate {
3639        #[inline(always)]
3640        fn max_ordinal_present(&self) -> u64 {
3641            if let Some(_) = self.dns_configuration {
3642                return 2;
3643            }
3644            if let Some(_) = self.socket_marks {
3645                return 1;
3646            }
3647            0
3648        }
3649    }
3650
3651    impl fidl::encoding::ValueTypeMarker for PropertyUpdate {
3652        type Borrowed<'a> = &'a Self;
3653        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3654            value
3655        }
3656    }
3657
3658    unsafe impl fidl::encoding::TypeMarker for PropertyUpdate {
3659        type Owned = Self;
3660
3661        #[inline(always)]
3662        fn inline_align(_context: fidl::encoding::Context) -> usize {
3663            8
3664        }
3665
3666        #[inline(always)]
3667        fn inline_size(_context: fidl::encoding::Context) -> usize {
3668            16
3669        }
3670    }
3671
3672    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PropertyUpdate, D>
3673        for &PropertyUpdate
3674    {
3675        unsafe fn encode(
3676            self,
3677            encoder: &mut fidl::encoding::Encoder<'_, D>,
3678            offset: usize,
3679            mut depth: fidl::encoding::Depth,
3680        ) -> fidl::Result<()> {
3681            encoder.debug_check_bounds::<PropertyUpdate>(offset);
3682            // Vector header
3683            let max_ordinal: u64 = self.max_ordinal_present();
3684            encoder.write_num(max_ordinal, offset);
3685            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3686            // Calling encoder.out_of_line_offset(0) is not allowed.
3687            if max_ordinal == 0 {
3688                return Ok(());
3689            }
3690            depth.increment()?;
3691            let envelope_size = 8;
3692            let bytes_len = max_ordinal as usize * envelope_size;
3693            #[allow(unused_variables)]
3694            let offset = encoder.out_of_line_offset(bytes_len);
3695            let mut _prev_end_offset: usize = 0;
3696            if 1 > max_ordinal {
3697                return Ok(());
3698            }
3699
3700            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3701            // are envelope_size bytes.
3702            let cur_offset: usize = (1 - 1) * envelope_size;
3703
3704            // Zero reserved fields.
3705            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3706
3707            // Safety:
3708            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3709            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3710            //   envelope_size bytes, there is always sufficient room.
3711            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net_common::Marks, D>(
3712                self.socket_marks.as_ref().map(
3713                    <fidl_fuchsia_net_common::Marks as fidl::encoding::ValueTypeMarker>::borrow,
3714                ),
3715                encoder,
3716                offset + cur_offset,
3717                depth,
3718            )?;
3719
3720            _prev_end_offset = cur_offset + envelope_size;
3721            if 2 > max_ordinal {
3722                return Ok(());
3723            }
3724
3725            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3726            // are envelope_size bytes.
3727            let cur_offset: usize = (2 - 1) * envelope_size;
3728
3729            // Zero reserved fields.
3730            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3731
3732            // Safety:
3733            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3734            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3735            //   envelope_size bytes, there is always sufficient room.
3736            fidl::encoding::encode_in_envelope_optional::<DnsConfiguration, D>(
3737                self.dns_configuration
3738                    .as_ref()
3739                    .map(<DnsConfiguration as fidl::encoding::ValueTypeMarker>::borrow),
3740                encoder,
3741                offset + cur_offset,
3742                depth,
3743            )?;
3744
3745            _prev_end_offset = cur_offset + envelope_size;
3746
3747            Ok(())
3748        }
3749    }
3750
3751    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PropertyUpdate {
3752        #[inline(always)]
3753        fn new_empty() -> Self {
3754            Self::default()
3755        }
3756
3757        unsafe fn decode(
3758            &mut self,
3759            decoder: &mut fidl::encoding::Decoder<'_, D>,
3760            offset: usize,
3761            mut depth: fidl::encoding::Depth,
3762        ) -> fidl::Result<()> {
3763            decoder.debug_check_bounds::<Self>(offset);
3764            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3765                None => return Err(fidl::Error::NotNullable),
3766                Some(len) => len,
3767            };
3768            // Calling decoder.out_of_line_offset(0) is not allowed.
3769            if len == 0 {
3770                return Ok(());
3771            };
3772            depth.increment()?;
3773            let envelope_size = 8;
3774            let bytes_len = len * envelope_size;
3775            let offset = decoder.out_of_line_offset(bytes_len)?;
3776            // Decode the envelope for each type.
3777            let mut _next_ordinal_to_read = 0;
3778            let mut next_offset = offset;
3779            let end_offset = offset + bytes_len;
3780            _next_ordinal_to_read += 1;
3781            if next_offset >= end_offset {
3782                return Ok(());
3783            }
3784
3785            // Decode unknown envelopes for gaps in ordinals.
3786            while _next_ordinal_to_read < 1 {
3787                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3788                _next_ordinal_to_read += 1;
3789                next_offset += envelope_size;
3790            }
3791
3792            let next_out_of_line = decoder.next_out_of_line();
3793            let handles_before = decoder.remaining_handles();
3794            if let Some((inlined, num_bytes, num_handles)) =
3795                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3796            {
3797                let member_inline_size =
3798                    <fidl_fuchsia_net_common::Marks as fidl::encoding::TypeMarker>::inline_size(
3799                        decoder.context,
3800                    );
3801                if inlined != (member_inline_size <= 4) {
3802                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3803                }
3804                let inner_offset;
3805                let mut inner_depth = depth.clone();
3806                if inlined {
3807                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3808                    inner_offset = next_offset;
3809                } else {
3810                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3811                    inner_depth.increment()?;
3812                }
3813                let val_ref = self
3814                    .socket_marks
3815                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_net_common::Marks, D));
3816                fidl::decode!(
3817                    fidl_fuchsia_net_common::Marks,
3818                    D,
3819                    val_ref,
3820                    decoder,
3821                    inner_offset,
3822                    inner_depth
3823                )?;
3824                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3825                {
3826                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3827                }
3828                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3829                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3830                }
3831            }
3832
3833            next_offset += envelope_size;
3834            _next_ordinal_to_read += 1;
3835            if next_offset >= end_offset {
3836                return Ok(());
3837            }
3838
3839            // Decode unknown envelopes for gaps in ordinals.
3840            while _next_ordinal_to_read < 2 {
3841                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3842                _next_ordinal_to_read += 1;
3843                next_offset += envelope_size;
3844            }
3845
3846            let next_out_of_line = decoder.next_out_of_line();
3847            let handles_before = decoder.remaining_handles();
3848            if let Some((inlined, num_bytes, num_handles)) =
3849                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3850            {
3851                let member_inline_size =
3852                    <DnsConfiguration as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3853                if inlined != (member_inline_size <= 4) {
3854                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3855                }
3856                let inner_offset;
3857                let mut inner_depth = depth.clone();
3858                if inlined {
3859                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3860                    inner_offset = next_offset;
3861                } else {
3862                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3863                    inner_depth.increment()?;
3864                }
3865                let val_ref = self
3866                    .dns_configuration
3867                    .get_or_insert_with(|| fidl::new_empty!(DnsConfiguration, D));
3868                fidl::decode!(DnsConfiguration, D, val_ref, decoder, inner_offset, inner_depth)?;
3869                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3870                {
3871                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3872                }
3873                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3874                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3875                }
3876            }
3877
3878            next_offset += envelope_size;
3879
3880            // Decode the remaining unknown envelopes.
3881            while next_offset < end_offset {
3882                _next_ordinal_to_read += 1;
3883                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3884                next_offset += envelope_size;
3885            }
3886
3887            Ok(())
3888        }
3889    }
3890
3891    impl StarnixNetworkInfo {
3892        #[inline(always)]
3893        fn max_ordinal_present(&self) -> u64 {
3894            if let Some(_) = self.handle {
3895                return 2;
3896            }
3897            if let Some(_) = self.mark {
3898                return 1;
3899            }
3900            0
3901        }
3902    }
3903
3904    impl fidl::encoding::ValueTypeMarker for StarnixNetworkInfo {
3905        type Borrowed<'a> = &'a Self;
3906        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3907            value
3908        }
3909    }
3910
3911    unsafe impl fidl::encoding::TypeMarker for StarnixNetworkInfo {
3912        type Owned = Self;
3913
3914        #[inline(always)]
3915        fn inline_align(_context: fidl::encoding::Context) -> usize {
3916            8
3917        }
3918
3919        #[inline(always)]
3920        fn inline_size(_context: fidl::encoding::Context) -> usize {
3921            16
3922        }
3923    }
3924
3925    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StarnixNetworkInfo, D>
3926        for &StarnixNetworkInfo
3927    {
3928        unsafe fn encode(
3929            self,
3930            encoder: &mut fidl::encoding::Encoder<'_, D>,
3931            offset: usize,
3932            mut depth: fidl::encoding::Depth,
3933        ) -> fidl::Result<()> {
3934            encoder.debug_check_bounds::<StarnixNetworkInfo>(offset);
3935            // Vector header
3936            let max_ordinal: u64 = self.max_ordinal_present();
3937            encoder.write_num(max_ordinal, offset);
3938            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3939            // Calling encoder.out_of_line_offset(0) is not allowed.
3940            if max_ordinal == 0 {
3941                return Ok(());
3942            }
3943            depth.increment()?;
3944            let envelope_size = 8;
3945            let bytes_len = max_ordinal as usize * envelope_size;
3946            #[allow(unused_variables)]
3947            let offset = encoder.out_of_line_offset(bytes_len);
3948            let mut _prev_end_offset: usize = 0;
3949            if 1 > max_ordinal {
3950                return Ok(());
3951            }
3952
3953            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3954            // are envelope_size bytes.
3955            let cur_offset: usize = (1 - 1) * envelope_size;
3956
3957            // Zero reserved fields.
3958            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3959
3960            // Safety:
3961            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3962            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3963            //   envelope_size bytes, there is always sufficient room.
3964            fidl::encoding::encode_in_envelope_optional::<u32, D>(
3965                self.mark.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
3966                encoder,
3967                offset + cur_offset,
3968                depth,
3969            )?;
3970
3971            _prev_end_offset = cur_offset + envelope_size;
3972            if 2 > max_ordinal {
3973                return Ok(());
3974            }
3975
3976            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3977            // are envelope_size bytes.
3978            let cur_offset: usize = (2 - 1) * envelope_size;
3979
3980            // Zero reserved fields.
3981            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3982
3983            // Safety:
3984            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3985            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3986            //   envelope_size bytes, there is always sufficient room.
3987            fidl::encoding::encode_in_envelope_optional::<u64, D>(
3988                self.handle.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3989                encoder,
3990                offset + cur_offset,
3991                depth,
3992            )?;
3993
3994            _prev_end_offset = cur_offset + envelope_size;
3995
3996            Ok(())
3997        }
3998    }
3999
4000    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StarnixNetworkInfo {
4001        #[inline(always)]
4002        fn new_empty() -> Self {
4003            Self::default()
4004        }
4005
4006        unsafe fn decode(
4007            &mut self,
4008            decoder: &mut fidl::encoding::Decoder<'_, D>,
4009            offset: usize,
4010            mut depth: fidl::encoding::Depth,
4011        ) -> fidl::Result<()> {
4012            decoder.debug_check_bounds::<Self>(offset);
4013            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4014                None => return Err(fidl::Error::NotNullable),
4015                Some(len) => len,
4016            };
4017            // Calling decoder.out_of_line_offset(0) is not allowed.
4018            if len == 0 {
4019                return Ok(());
4020            };
4021            depth.increment()?;
4022            let envelope_size = 8;
4023            let bytes_len = len * envelope_size;
4024            let offset = decoder.out_of_line_offset(bytes_len)?;
4025            // Decode the envelope for each type.
4026            let mut _next_ordinal_to_read = 0;
4027            let mut next_offset = offset;
4028            let end_offset = offset + bytes_len;
4029            _next_ordinal_to_read += 1;
4030            if next_offset >= end_offset {
4031                return Ok(());
4032            }
4033
4034            // Decode unknown envelopes for gaps in ordinals.
4035            while _next_ordinal_to_read < 1 {
4036                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4037                _next_ordinal_to_read += 1;
4038                next_offset += envelope_size;
4039            }
4040
4041            let next_out_of_line = decoder.next_out_of_line();
4042            let handles_before = decoder.remaining_handles();
4043            if let Some((inlined, num_bytes, num_handles)) =
4044                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4045            {
4046                let member_inline_size =
4047                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4048                if inlined != (member_inline_size <= 4) {
4049                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4050                }
4051                let inner_offset;
4052                let mut inner_depth = depth.clone();
4053                if inlined {
4054                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4055                    inner_offset = next_offset;
4056                } else {
4057                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4058                    inner_depth.increment()?;
4059                }
4060                let val_ref = self.mark.get_or_insert_with(|| fidl::new_empty!(u32, D));
4061                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
4062                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4063                {
4064                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4065                }
4066                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4067                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4068                }
4069            }
4070
4071            next_offset += envelope_size;
4072            _next_ordinal_to_read += 1;
4073            if next_offset >= end_offset {
4074                return Ok(());
4075            }
4076
4077            // Decode unknown envelopes for gaps in ordinals.
4078            while _next_ordinal_to_read < 2 {
4079                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4080                _next_ordinal_to_read += 1;
4081                next_offset += envelope_size;
4082            }
4083
4084            let next_out_of_line = decoder.next_out_of_line();
4085            let handles_before = decoder.remaining_handles();
4086            if let Some((inlined, num_bytes, num_handles)) =
4087                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4088            {
4089                let member_inline_size =
4090                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4091                if inlined != (member_inline_size <= 4) {
4092                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4093                }
4094                let inner_offset;
4095                let mut inner_depth = depth.clone();
4096                if inlined {
4097                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4098                    inner_offset = next_offset;
4099                } else {
4100                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4101                    inner_depth.increment()?;
4102                }
4103                let val_ref = self.handle.get_or_insert_with(|| fidl::new_empty!(u64, D));
4104                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
4105                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4106                {
4107                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4108                }
4109                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4110                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4111                }
4112            }
4113
4114            next_offset += envelope_size;
4115
4116            // Decode the remaining unknown envelopes.
4117            while next_offset < end_offset {
4118                _next_ordinal_to_read += 1;
4119                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4120                next_offset += envelope_size;
4121            }
4122
4123            Ok(())
4124        }
4125    }
4126
4127    impl fidl::encoding::ValueTypeMarker for LookupRequest {
4128        type Borrowed<'a> = &'a Self;
4129        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4130            value
4131        }
4132    }
4133
4134    unsafe impl fidl::encoding::TypeMarker for LookupRequest {
4135        type Owned = Self;
4136
4137        #[inline(always)]
4138        fn inline_align(_context: fidl::encoding::Context) -> usize {
4139            8
4140        }
4141
4142        #[inline(always)]
4143        fn inline_size(_context: fidl::encoding::Context) -> usize {
4144            16
4145        }
4146    }
4147
4148    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LookupRequest, D>
4149        for &LookupRequest
4150    {
4151        #[inline]
4152        unsafe fn encode(
4153            self,
4154            encoder: &mut fidl::encoding::Encoder<'_, D>,
4155            offset: usize,
4156            _depth: fidl::encoding::Depth,
4157        ) -> fidl::Result<()> {
4158            encoder.debug_check_bounds::<LookupRequest>(offset);
4159            encoder.write_num::<u64>(self.ordinal(), offset);
4160            match self {
4161                LookupRequest::StarnixHandle(ref val) => {
4162                    fidl::encoding::encode_in_envelope::<u64, D>(
4163                        <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
4164                        encoder,
4165                        offset + 8,
4166                        _depth,
4167                    )
4168                }
4169                LookupRequest::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
4170            }
4171        }
4172    }
4173
4174    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LookupRequest {
4175        #[inline(always)]
4176        fn new_empty() -> Self {
4177            Self::__SourceBreaking { unknown_ordinal: 0 }
4178        }
4179
4180        #[inline]
4181        unsafe fn decode(
4182            &mut self,
4183            decoder: &mut fidl::encoding::Decoder<'_, D>,
4184            offset: usize,
4185            mut depth: fidl::encoding::Depth,
4186        ) -> fidl::Result<()> {
4187            decoder.debug_check_bounds::<Self>(offset);
4188            #[allow(unused_variables)]
4189            let next_out_of_line = decoder.next_out_of_line();
4190            let handles_before = decoder.remaining_handles();
4191            let (ordinal, inlined, num_bytes, num_handles) =
4192                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
4193
4194            let member_inline_size = match ordinal {
4195                1 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
4196                0 => return Err(fidl::Error::UnknownUnionTag),
4197                _ => num_bytes as usize,
4198            };
4199
4200            if inlined != (member_inline_size <= 4) {
4201                return Err(fidl::Error::InvalidInlineBitInEnvelope);
4202            }
4203            let _inner_offset;
4204            if inlined {
4205                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
4206                _inner_offset = offset + 8;
4207            } else {
4208                depth.increment()?;
4209                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4210            }
4211            match ordinal {
4212                1 => {
4213                    #[allow(irrefutable_let_patterns)]
4214                    if let LookupRequest::StarnixHandle(_) = self {
4215                        // Do nothing, read the value into the object
4216                    } else {
4217                        // Initialize `self` to the right variant
4218                        *self = LookupRequest::StarnixHandle(fidl::new_empty!(u64, D));
4219                    }
4220                    #[allow(irrefutable_let_patterns)]
4221                    if let LookupRequest::StarnixHandle(ref mut val) = self {
4222                        fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
4223                    } else {
4224                        unreachable!()
4225                    }
4226                }
4227                #[allow(deprecated)]
4228                ordinal => {
4229                    for _ in 0..num_handles {
4230                        decoder.drop_next_handle()?;
4231                    }
4232                    *self = LookupRequest::__SourceBreaking { unknown_ordinal: ordinal };
4233                }
4234            }
4235            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
4236                return Err(fidl::Error::InvalidNumBytesInEnvelope);
4237            }
4238            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4239                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4240            }
4241            Ok(())
4242        }
4243    }
4244
4245    impl fidl::encoding::ValueTypeMarker for NetworkInfo {
4246        type Borrowed<'a> = &'a Self;
4247        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4248            value
4249        }
4250    }
4251
4252    unsafe impl fidl::encoding::TypeMarker for NetworkInfo {
4253        type Owned = Self;
4254
4255        #[inline(always)]
4256        fn inline_align(_context: fidl::encoding::Context) -> usize {
4257            8
4258        }
4259
4260        #[inline(always)]
4261        fn inline_size(_context: fidl::encoding::Context) -> usize {
4262            16
4263        }
4264    }
4265
4266    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NetworkInfo, D>
4267        for &NetworkInfo
4268    {
4269        #[inline]
4270        unsafe fn encode(
4271            self,
4272            encoder: &mut fidl::encoding::Encoder<'_, D>,
4273            offset: usize,
4274            _depth: fidl::encoding::Depth,
4275        ) -> fidl::Result<()> {
4276            encoder.debug_check_bounds::<NetworkInfo>(offset);
4277            encoder.write_num::<u64>(self.ordinal(), offset);
4278            match self {
4279                NetworkInfo::Starnix(ref val) => {
4280                    fidl::encoding::encode_in_envelope::<StarnixNetworkInfo, D>(
4281                        <StarnixNetworkInfo as fidl::encoding::ValueTypeMarker>::borrow(val),
4282                        encoder,
4283                        offset + 8,
4284                        _depth,
4285                    )
4286                }
4287                NetworkInfo::Fuchsia(ref val) => {
4288                    fidl::encoding::encode_in_envelope::<FuchsiaNetworkInfo, D>(
4289                        <FuchsiaNetworkInfo as fidl::encoding::ValueTypeMarker>::borrow(val),
4290                        encoder,
4291                        offset + 8,
4292                        _depth,
4293                    )
4294                }
4295                NetworkInfo::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
4296            }
4297        }
4298    }
4299
4300    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NetworkInfo {
4301        #[inline(always)]
4302        fn new_empty() -> Self {
4303            Self::__SourceBreaking { unknown_ordinal: 0 }
4304        }
4305
4306        #[inline]
4307        unsafe fn decode(
4308            &mut self,
4309            decoder: &mut fidl::encoding::Decoder<'_, D>,
4310            offset: usize,
4311            mut depth: fidl::encoding::Depth,
4312        ) -> fidl::Result<()> {
4313            decoder.debug_check_bounds::<Self>(offset);
4314            #[allow(unused_variables)]
4315            let next_out_of_line = decoder.next_out_of_line();
4316            let handles_before = decoder.remaining_handles();
4317            let (ordinal, inlined, num_bytes, num_handles) =
4318                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
4319
4320            let member_inline_size = match ordinal {
4321                1 => {
4322                    <StarnixNetworkInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context)
4323                }
4324                2 => {
4325                    <FuchsiaNetworkInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context)
4326                }
4327                0 => return Err(fidl::Error::UnknownUnionTag),
4328                _ => num_bytes as usize,
4329            };
4330
4331            if inlined != (member_inline_size <= 4) {
4332                return Err(fidl::Error::InvalidInlineBitInEnvelope);
4333            }
4334            let _inner_offset;
4335            if inlined {
4336                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
4337                _inner_offset = offset + 8;
4338            } else {
4339                depth.increment()?;
4340                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4341            }
4342            match ordinal {
4343                1 => {
4344                    #[allow(irrefutable_let_patterns)]
4345                    if let NetworkInfo::Starnix(_) = self {
4346                        // Do nothing, read the value into the object
4347                    } else {
4348                        // Initialize `self` to the right variant
4349                        *self = NetworkInfo::Starnix(fidl::new_empty!(StarnixNetworkInfo, D));
4350                    }
4351                    #[allow(irrefutable_let_patterns)]
4352                    if let NetworkInfo::Starnix(ref mut val) = self {
4353                        fidl::decode!(StarnixNetworkInfo, D, val, decoder, _inner_offset, depth)?;
4354                    } else {
4355                        unreachable!()
4356                    }
4357                }
4358                2 => {
4359                    #[allow(irrefutable_let_patterns)]
4360                    if let NetworkInfo::Fuchsia(_) = self {
4361                        // Do nothing, read the value into the object
4362                    } else {
4363                        // Initialize `self` to the right variant
4364                        *self = NetworkInfo::Fuchsia(fidl::new_empty!(FuchsiaNetworkInfo, D));
4365                    }
4366                    #[allow(irrefutable_let_patterns)]
4367                    if let NetworkInfo::Fuchsia(ref mut val) = self {
4368                        fidl::decode!(FuchsiaNetworkInfo, D, val, decoder, _inner_offset, depth)?;
4369                    } else {
4370                        unreachable!()
4371                    }
4372                }
4373                #[allow(deprecated)]
4374                ordinal => {
4375                    for _ in 0..num_handles {
4376                        decoder.drop_next_handle()?;
4377                    }
4378                    *self = NetworkInfo::__SourceBreaking { unknown_ordinal: ordinal };
4379                }
4380            }
4381            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
4382                return Err(fidl::Error::InvalidNumBytesInEnvelope);
4383            }
4384            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4385                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4386            }
4387            Ok(())
4388        }
4389    }
4390}