fidl_fuchsia_net_policy_socketproxy__common/
fidl_fuchsia_net_policy_socketproxy__common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
12pub enum NetworkRegistryAddError {
13    /// The `network_id` was not specified in the Network table.
14    MissingNetworkId,
15    /// The `info` was not specified in the Network table.
16    MissingNetworkInfo,
17    /// The `dns_servers` was not specified in the Network table.
18    MissingNetworkDnsServers,
19    /// There already exists a network with this network_id.
20    /// To update an existing network, use Update.
21    DuplicateNetworkId,
22    #[doc(hidden)]
23    __SourceBreaking { unknown_ordinal: u32 },
24}
25
26/// Pattern that matches an unknown `NetworkRegistryAddError` member.
27#[macro_export]
28macro_rules! NetworkRegistryAddErrorUnknown {
29    () => {
30        _
31    };
32}
33
34impl NetworkRegistryAddError {
35    #[inline]
36    pub fn from_primitive(prim: u32) -> Option<Self> {
37        match prim {
38            1 => Some(Self::MissingNetworkId),
39            2 => Some(Self::MissingNetworkInfo),
40            3 => Some(Self::MissingNetworkDnsServers),
41            4 => Some(Self::DuplicateNetworkId),
42            _ => None,
43        }
44    }
45
46    #[inline]
47    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
48        match prim {
49            1 => Self::MissingNetworkId,
50            2 => Self::MissingNetworkInfo,
51            3 => Self::MissingNetworkDnsServers,
52            4 => Self::DuplicateNetworkId,
53            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
54        }
55    }
56
57    #[inline]
58    pub fn unknown() -> Self {
59        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
60    }
61
62    #[inline]
63    pub const fn into_primitive(self) -> u32 {
64        match self {
65            Self::MissingNetworkId => 1,
66            Self::MissingNetworkInfo => 2,
67            Self::MissingNetworkDnsServers => 3,
68            Self::DuplicateNetworkId => 4,
69            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
70        }
71    }
72
73    #[inline]
74    pub fn is_unknown(&self) -> bool {
75        match self {
76            Self::__SourceBreaking { unknown_ordinal: _ } => true,
77            _ => false,
78        }
79    }
80}
81
82#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
83pub enum NetworkRegistryRemoveError {
84    /// No network with this network_id found.
85    NotFound,
86    /// The specified network is currently marked as the default network.
87    CannotRemoveDefaultNetwork,
88    #[doc(hidden)]
89    __SourceBreaking { unknown_ordinal: u32 },
90}
91
92/// Pattern that matches an unknown `NetworkRegistryRemoveError` member.
93#[macro_export]
94macro_rules! NetworkRegistryRemoveErrorUnknown {
95    () => {
96        _
97    };
98}
99
100impl NetworkRegistryRemoveError {
101    #[inline]
102    pub fn from_primitive(prim: u32) -> Option<Self> {
103        match prim {
104            1 => Some(Self::NotFound),
105            2 => Some(Self::CannotRemoveDefaultNetwork),
106            _ => None,
107        }
108    }
109
110    #[inline]
111    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
112        match prim {
113            1 => Self::NotFound,
114            2 => Self::CannotRemoveDefaultNetwork,
115            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
116        }
117    }
118
119    #[inline]
120    pub fn unknown() -> Self {
121        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
122    }
123
124    #[inline]
125    pub const fn into_primitive(self) -> u32 {
126        match self {
127            Self::NotFound => 1,
128            Self::CannotRemoveDefaultNetwork => 2,
129            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
130        }
131    }
132
133    #[inline]
134    pub fn is_unknown(&self) -> bool {
135        match self {
136            Self::__SourceBreaking { unknown_ordinal: _ } => true,
137            _ => false,
138        }
139    }
140}
141
142#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
143pub enum NetworkRegistrySetDefaultError {
144    /// No network with this network_id found.
145    NotFound,
146    #[doc(hidden)]
147    __SourceBreaking { unknown_ordinal: u32 },
148}
149
150/// Pattern that matches an unknown `NetworkRegistrySetDefaultError` member.
151#[macro_export]
152macro_rules! NetworkRegistrySetDefaultErrorUnknown {
153    () => {
154        _
155    };
156}
157
158impl NetworkRegistrySetDefaultError {
159    #[inline]
160    pub fn from_primitive(prim: u32) -> Option<Self> {
161        match prim {
162            1 => Some(Self::NotFound),
163            _ => None,
164        }
165    }
166
167    #[inline]
168    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
169        match prim {
170            1 => Self::NotFound,
171            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
172        }
173    }
174
175    #[inline]
176    pub fn unknown() -> Self {
177        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
178    }
179
180    #[inline]
181    pub const fn into_primitive(self) -> u32 {
182        match self {
183            Self::NotFound => 1,
184            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
185        }
186    }
187
188    #[inline]
189    pub fn is_unknown(&self) -> bool {
190        match self {
191            Self::__SourceBreaking { unknown_ordinal: _ } => true,
192            _ => false,
193        }
194    }
195}
196
197#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
198pub enum NetworkRegistryUpdateError {
199    /// The `network_id` was not specified in the Network table.
200    MissingNetworkId,
201    /// The `info` was not specified in the Network table.
202    MissingNetworkInfo,
203    /// The `dns_servers` was not specified in the Network table.
204    MissingNetworkDnsServers,
205    /// No network with this `network_id` found.
206    NotFound,
207    #[doc(hidden)]
208    __SourceBreaking { unknown_ordinal: u32 },
209}
210
211/// Pattern that matches an unknown `NetworkRegistryUpdateError` member.
212#[macro_export]
213macro_rules! NetworkRegistryUpdateErrorUnknown {
214    () => {
215        _
216    };
217}
218
219impl NetworkRegistryUpdateError {
220    #[inline]
221    pub fn from_primitive(prim: u32) -> Option<Self> {
222        match prim {
223            1 => Some(Self::MissingNetworkId),
224            2 => Some(Self::MissingNetworkInfo),
225            3 => Some(Self::MissingNetworkDnsServers),
226            4 => Some(Self::NotFound),
227            _ => None,
228        }
229    }
230
231    #[inline]
232    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
233        match prim {
234            1 => Self::MissingNetworkId,
235            2 => Self::MissingNetworkInfo,
236            3 => Self::MissingNetworkDnsServers,
237            4 => Self::NotFound,
238            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
239        }
240    }
241
242    #[inline]
243    pub fn unknown() -> Self {
244        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
245    }
246
247    #[inline]
248    pub const fn into_primitive(self) -> u32 {
249        match self {
250            Self::MissingNetworkId => 1,
251            Self::MissingNetworkInfo => 2,
252            Self::MissingNetworkDnsServers => 3,
253            Self::NotFound => 4,
254            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
255        }
256    }
257
258    #[inline]
259    pub fn is_unknown(&self) -> bool {
260        match self {
261            Self::__SourceBreaking { unknown_ordinal: _ } => true,
262            _ => false,
263        }
264    }
265}
266
267#[derive(Clone, Debug, PartialEq)]
268pub struct DnsServerWatcherWatchServersResponse {
269    pub servers: Vec<DnsServerList>,
270}
271
272impl fidl::Persistable for DnsServerWatcherWatchServersResponse {}
273
274#[derive(Clone, Debug, PartialEq)]
275pub struct NetworkRegistryAddRequest {
276    pub network: Network,
277}
278
279impl fidl::Persistable for NetworkRegistryAddRequest {}
280
281#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
282#[repr(C)]
283pub struct NetworkRegistryRemoveRequest {
284    pub network_id: u32,
285}
286
287impl fidl::Persistable for NetworkRegistryRemoveRequest {}
288
289#[derive(Clone, Debug, PartialEq)]
290pub struct NetworkRegistrySetDefaultRequest {
291    pub network_id: fidl_fuchsia_posix_socket__common::OptionalUint32,
292}
293
294impl fidl::Persistable for NetworkRegistrySetDefaultRequest {}
295
296#[derive(Clone, Debug, PartialEq)]
297pub struct NetworkRegistryUpdateRequest {
298    pub network: Network,
299}
300
301impl fidl::Persistable for NetworkRegistryUpdateRequest {}
302
303/// A DNS server configuration.
304///
305/// All table fields are currently required.
306#[derive(Clone, Debug, Default, PartialEq)]
307pub struct DnsServerList {
308    /// The server addresses.
309    pub addresses: Option<Vec<fidl_fuchsia_net__common::SocketAddress>>,
310    /// The corresponding `network_id` for the DNS server addresses.
311    pub source_network_id: Option<u32>,
312    #[doc(hidden)]
313    pub __source_breaking: fidl::marker::SourceBreaking,
314}
315
316impl fidl::Persistable for DnsServerList {}
317
318#[derive(Clone, Debug, Default, PartialEq)]
319pub struct FuchsiaNetworkInfo {
320    #[doc(hidden)]
321    pub __source_breaking: fidl::marker::SourceBreaking,
322}
323
324impl fidl::Persistable for FuchsiaNetworkInfo {}
325
326/// Network describes a single network interface provided to NetworkRegistry.
327///
328/// All table fields are currently required.
329#[derive(Clone, Debug, Default, PartialEq)]
330pub struct Network {
331    /// A unique ID for the registered network.
332    pub network_id: Option<u32>,
333    /// Platform specific information about the network.
334    pub info: Option<NetworkInfo>,
335    /// The DNS servers associated with this network.
336    pub dns_servers: Option<NetworkDnsServers>,
337    #[doc(hidden)]
338    pub __source_breaking: fidl::marker::SourceBreaking,
339}
340
341impl fidl::Persistable for Network {}
342
343#[derive(Clone, Debug, Default, PartialEq)]
344pub struct NetworkDnsServers {
345    pub v4: Option<Vec<fidl_fuchsia_net__common::Ipv4Address>>,
346    pub v6: Option<Vec<fidl_fuchsia_net__common::Ipv6Address>>,
347    #[doc(hidden)]
348    pub __source_breaking: fidl::marker::SourceBreaking,
349}
350
351impl fidl::Persistable for NetworkDnsServers {}
352
353#[derive(Clone, Debug, Default, PartialEq)]
354pub struct StarnixNetworkInfo {
355    pub mark: Option<u32>,
356    pub handle: Option<u64>,
357    #[doc(hidden)]
358    pub __source_breaking: fidl::marker::SourceBreaking,
359}
360
361impl fidl::Persistable for StarnixNetworkInfo {}
362
363#[derive(Clone, Debug)]
364pub enum NetworkInfo {
365    /// Information about Starnix registered networks.
366    Starnix(StarnixNetworkInfo),
367    /// Information about Fuchsia registered networks.
368    Fuchsia(FuchsiaNetworkInfo),
369    #[doc(hidden)]
370    __SourceBreaking { unknown_ordinal: u64 },
371}
372
373/// Pattern that matches an unknown `NetworkInfo` member.
374#[macro_export]
375macro_rules! NetworkInfoUnknown {
376    () => {
377        _
378    };
379}
380
381// Custom PartialEq so that unknown variants are not equal to themselves.
382impl PartialEq for NetworkInfo {
383    fn eq(&self, other: &Self) -> bool {
384        match (self, other) {
385            (Self::Starnix(x), Self::Starnix(y)) => *x == *y,
386            (Self::Fuchsia(x), Self::Fuchsia(y)) => *x == *y,
387            _ => false,
388        }
389    }
390}
391
392impl NetworkInfo {
393    #[inline]
394    pub fn ordinal(&self) -> u64 {
395        match *self {
396            Self::Starnix(_) => 1,
397            Self::Fuchsia(_) => 2,
398            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
399        }
400    }
401
402    #[inline]
403    pub fn unknown_variant_for_testing() -> Self {
404        Self::__SourceBreaking { unknown_ordinal: 0 }
405    }
406
407    #[inline]
408    pub fn is_unknown(&self) -> bool {
409        match self {
410            Self::__SourceBreaking { .. } => true,
411            _ => false,
412        }
413    }
414}
415
416impl fidl::Persistable for NetworkInfo {}
417
418pub mod dns_server_watcher_ordinals {
419    pub const WATCH_SERVERS: u64 = 0x767ad6d8df671383;
420}
421
422pub mod fuchsia_networks_ordinals {
423    pub const SET_DEFAULT: u64 = 0x787930c67b8cf82c;
424    pub const ADD: u64 = 0x197e70a1cbeab3ad;
425    pub const UPDATE: u64 = 0x3bc790ae5418ff0e;
426    pub const REMOVE: u64 = 0x1302df41dca6379e;
427}
428
429pub mod network_registry_ordinals {
430    pub const SET_DEFAULT: u64 = 0x787930c67b8cf82c;
431    pub const ADD: u64 = 0x197e70a1cbeab3ad;
432    pub const UPDATE: u64 = 0x3bc790ae5418ff0e;
433    pub const REMOVE: u64 = 0x1302df41dca6379e;
434}
435
436pub mod starnix_networks_ordinals {
437    pub const SET_DEFAULT: u64 = 0x787930c67b8cf82c;
438    pub const ADD: u64 = 0x197e70a1cbeab3ad;
439    pub const UPDATE: u64 = 0x3bc790ae5418ff0e;
440    pub const REMOVE: u64 = 0x1302df41dca6379e;
441}
442
443mod internal {
444    use super::*;
445    unsafe impl fidl::encoding::TypeMarker for NetworkRegistryAddError {
446        type Owned = Self;
447
448        #[inline(always)]
449        fn inline_align(_context: fidl::encoding::Context) -> usize {
450            std::mem::align_of::<u32>()
451        }
452
453        #[inline(always)]
454        fn inline_size(_context: fidl::encoding::Context) -> usize {
455            std::mem::size_of::<u32>()
456        }
457
458        #[inline(always)]
459        fn encode_is_copy() -> bool {
460            false
461        }
462
463        #[inline(always)]
464        fn decode_is_copy() -> bool {
465            false
466        }
467    }
468
469    impl fidl::encoding::ValueTypeMarker for NetworkRegistryAddError {
470        type Borrowed<'a> = Self;
471        #[inline(always)]
472        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
473            *value
474        }
475    }
476
477    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
478        for NetworkRegistryAddError
479    {
480        #[inline]
481        unsafe fn encode(
482            self,
483            encoder: &mut fidl::encoding::Encoder<'_, D>,
484            offset: usize,
485            _depth: fidl::encoding::Depth,
486        ) -> fidl::Result<()> {
487            encoder.debug_check_bounds::<Self>(offset);
488            encoder.write_num(self.into_primitive(), offset);
489            Ok(())
490        }
491    }
492
493    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
494        for NetworkRegistryAddError
495    {
496        #[inline(always)]
497        fn new_empty() -> Self {
498            Self::unknown()
499        }
500
501        #[inline]
502        unsafe fn decode(
503            &mut self,
504            decoder: &mut fidl::encoding::Decoder<'_, D>,
505            offset: usize,
506            _depth: fidl::encoding::Depth,
507        ) -> fidl::Result<()> {
508            decoder.debug_check_bounds::<Self>(offset);
509            let prim = decoder.read_num::<u32>(offset);
510
511            *self = Self::from_primitive_allow_unknown(prim);
512            Ok(())
513        }
514    }
515    unsafe impl fidl::encoding::TypeMarker for NetworkRegistryRemoveError {
516        type Owned = Self;
517
518        #[inline(always)]
519        fn inline_align(_context: fidl::encoding::Context) -> usize {
520            std::mem::align_of::<u32>()
521        }
522
523        #[inline(always)]
524        fn inline_size(_context: fidl::encoding::Context) -> usize {
525            std::mem::size_of::<u32>()
526        }
527
528        #[inline(always)]
529        fn encode_is_copy() -> bool {
530            false
531        }
532
533        #[inline(always)]
534        fn decode_is_copy() -> bool {
535            false
536        }
537    }
538
539    impl fidl::encoding::ValueTypeMarker for NetworkRegistryRemoveError {
540        type Borrowed<'a> = Self;
541        #[inline(always)]
542        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
543            *value
544        }
545    }
546
547    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
548        for NetworkRegistryRemoveError
549    {
550        #[inline]
551        unsafe fn encode(
552            self,
553            encoder: &mut fidl::encoding::Encoder<'_, D>,
554            offset: usize,
555            _depth: fidl::encoding::Depth,
556        ) -> fidl::Result<()> {
557            encoder.debug_check_bounds::<Self>(offset);
558            encoder.write_num(self.into_primitive(), offset);
559            Ok(())
560        }
561    }
562
563    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
564        for NetworkRegistryRemoveError
565    {
566        #[inline(always)]
567        fn new_empty() -> Self {
568            Self::unknown()
569        }
570
571        #[inline]
572        unsafe fn decode(
573            &mut self,
574            decoder: &mut fidl::encoding::Decoder<'_, D>,
575            offset: usize,
576            _depth: fidl::encoding::Depth,
577        ) -> fidl::Result<()> {
578            decoder.debug_check_bounds::<Self>(offset);
579            let prim = decoder.read_num::<u32>(offset);
580
581            *self = Self::from_primitive_allow_unknown(prim);
582            Ok(())
583        }
584    }
585    unsafe impl fidl::encoding::TypeMarker for NetworkRegistrySetDefaultError {
586        type Owned = Self;
587
588        #[inline(always)]
589        fn inline_align(_context: fidl::encoding::Context) -> usize {
590            std::mem::align_of::<u32>()
591        }
592
593        #[inline(always)]
594        fn inline_size(_context: fidl::encoding::Context) -> usize {
595            std::mem::size_of::<u32>()
596        }
597
598        #[inline(always)]
599        fn encode_is_copy() -> bool {
600            false
601        }
602
603        #[inline(always)]
604        fn decode_is_copy() -> bool {
605            false
606        }
607    }
608
609    impl fidl::encoding::ValueTypeMarker for NetworkRegistrySetDefaultError {
610        type Borrowed<'a> = Self;
611        #[inline(always)]
612        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
613            *value
614        }
615    }
616
617    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
618        for NetworkRegistrySetDefaultError
619    {
620        #[inline]
621        unsafe fn encode(
622            self,
623            encoder: &mut fidl::encoding::Encoder<'_, D>,
624            offset: usize,
625            _depth: fidl::encoding::Depth,
626        ) -> fidl::Result<()> {
627            encoder.debug_check_bounds::<Self>(offset);
628            encoder.write_num(self.into_primitive(), offset);
629            Ok(())
630        }
631    }
632
633    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
634        for NetworkRegistrySetDefaultError
635    {
636        #[inline(always)]
637        fn new_empty() -> Self {
638            Self::unknown()
639        }
640
641        #[inline]
642        unsafe fn decode(
643            &mut self,
644            decoder: &mut fidl::encoding::Decoder<'_, D>,
645            offset: usize,
646            _depth: fidl::encoding::Depth,
647        ) -> fidl::Result<()> {
648            decoder.debug_check_bounds::<Self>(offset);
649            let prim = decoder.read_num::<u32>(offset);
650
651            *self = Self::from_primitive_allow_unknown(prim);
652            Ok(())
653        }
654    }
655    unsafe impl fidl::encoding::TypeMarker for NetworkRegistryUpdateError {
656        type Owned = Self;
657
658        #[inline(always)]
659        fn inline_align(_context: fidl::encoding::Context) -> usize {
660            std::mem::align_of::<u32>()
661        }
662
663        #[inline(always)]
664        fn inline_size(_context: fidl::encoding::Context) -> usize {
665            std::mem::size_of::<u32>()
666        }
667
668        #[inline(always)]
669        fn encode_is_copy() -> bool {
670            false
671        }
672
673        #[inline(always)]
674        fn decode_is_copy() -> bool {
675            false
676        }
677    }
678
679    impl fidl::encoding::ValueTypeMarker for NetworkRegistryUpdateError {
680        type Borrowed<'a> = Self;
681        #[inline(always)]
682        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
683            *value
684        }
685    }
686
687    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
688        for NetworkRegistryUpdateError
689    {
690        #[inline]
691        unsafe fn encode(
692            self,
693            encoder: &mut fidl::encoding::Encoder<'_, D>,
694            offset: usize,
695            _depth: fidl::encoding::Depth,
696        ) -> fidl::Result<()> {
697            encoder.debug_check_bounds::<Self>(offset);
698            encoder.write_num(self.into_primitive(), offset);
699            Ok(())
700        }
701    }
702
703    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
704        for NetworkRegistryUpdateError
705    {
706        #[inline(always)]
707        fn new_empty() -> Self {
708            Self::unknown()
709        }
710
711        #[inline]
712        unsafe fn decode(
713            &mut self,
714            decoder: &mut fidl::encoding::Decoder<'_, D>,
715            offset: usize,
716            _depth: fidl::encoding::Depth,
717        ) -> fidl::Result<()> {
718            decoder.debug_check_bounds::<Self>(offset);
719            let prim = decoder.read_num::<u32>(offset);
720
721            *self = Self::from_primitive_allow_unknown(prim);
722            Ok(())
723        }
724    }
725
726    impl fidl::encoding::ValueTypeMarker for DnsServerWatcherWatchServersResponse {
727        type Borrowed<'a> = &'a Self;
728        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
729            value
730        }
731    }
732
733    unsafe impl fidl::encoding::TypeMarker for DnsServerWatcherWatchServersResponse {
734        type Owned = Self;
735
736        #[inline(always)]
737        fn inline_align(_context: fidl::encoding::Context) -> usize {
738            8
739        }
740
741        #[inline(always)]
742        fn inline_size(_context: fidl::encoding::Context) -> usize {
743            16
744        }
745    }
746
747    unsafe impl<D: fidl::encoding::ResourceDialect>
748        fidl::encoding::Encode<DnsServerWatcherWatchServersResponse, D>
749        for &DnsServerWatcherWatchServersResponse
750    {
751        #[inline]
752        unsafe fn encode(
753            self,
754            encoder: &mut fidl::encoding::Encoder<'_, D>,
755            offset: usize,
756            _depth: fidl::encoding::Depth,
757        ) -> fidl::Result<()> {
758            encoder.debug_check_bounds::<DnsServerWatcherWatchServersResponse>(offset);
759            // Delegate to tuple encoding.
760            fidl::encoding::Encode::<DnsServerWatcherWatchServersResponse, D>::encode(
761                (
762                    <fidl::encoding::UnboundedVector<DnsServerList> as fidl::encoding::ValueTypeMarker>::borrow(&self.servers),
763                ),
764                encoder, offset, _depth
765            )
766        }
767    }
768    unsafe impl<
769        D: fidl::encoding::ResourceDialect,
770        T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<DnsServerList>, D>,
771    > fidl::encoding::Encode<DnsServerWatcherWatchServersResponse, D> for (T0,)
772    {
773        #[inline]
774        unsafe fn encode(
775            self,
776            encoder: &mut fidl::encoding::Encoder<'_, D>,
777            offset: usize,
778            depth: fidl::encoding::Depth,
779        ) -> fidl::Result<()> {
780            encoder.debug_check_bounds::<DnsServerWatcherWatchServersResponse>(offset);
781            // Zero out padding regions. There's no need to apply masks
782            // because the unmasked parts will be overwritten by fields.
783            // Write the fields.
784            self.0.encode(encoder, offset + 0, depth)?;
785            Ok(())
786        }
787    }
788
789    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
790        for DnsServerWatcherWatchServersResponse
791    {
792        #[inline(always)]
793        fn new_empty() -> Self {
794            Self { servers: fidl::new_empty!(fidl::encoding::UnboundedVector<DnsServerList>, D) }
795        }
796
797        #[inline]
798        unsafe fn decode(
799            &mut self,
800            decoder: &mut fidl::encoding::Decoder<'_, D>,
801            offset: usize,
802            _depth: fidl::encoding::Depth,
803        ) -> fidl::Result<()> {
804            decoder.debug_check_bounds::<Self>(offset);
805            // Verify that padding bytes are zero.
806            fidl::decode!(
807                fidl::encoding::UnboundedVector<DnsServerList>,
808                D,
809                &mut self.servers,
810                decoder,
811                offset + 0,
812                _depth
813            )?;
814            Ok(())
815        }
816    }
817
818    impl fidl::encoding::ValueTypeMarker for NetworkRegistryAddRequest {
819        type Borrowed<'a> = &'a Self;
820        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
821            value
822        }
823    }
824
825    unsafe impl fidl::encoding::TypeMarker for NetworkRegistryAddRequest {
826        type Owned = Self;
827
828        #[inline(always)]
829        fn inline_align(_context: fidl::encoding::Context) -> usize {
830            8
831        }
832
833        #[inline(always)]
834        fn inline_size(_context: fidl::encoding::Context) -> usize {
835            16
836        }
837    }
838
839    unsafe impl<D: fidl::encoding::ResourceDialect>
840        fidl::encoding::Encode<NetworkRegistryAddRequest, D> for &NetworkRegistryAddRequest
841    {
842        #[inline]
843        unsafe fn encode(
844            self,
845            encoder: &mut fidl::encoding::Encoder<'_, D>,
846            offset: usize,
847            _depth: fidl::encoding::Depth,
848        ) -> fidl::Result<()> {
849            encoder.debug_check_bounds::<NetworkRegistryAddRequest>(offset);
850            // Delegate to tuple encoding.
851            fidl::encoding::Encode::<NetworkRegistryAddRequest, D>::encode(
852                (<Network as fidl::encoding::ValueTypeMarker>::borrow(&self.network),),
853                encoder,
854                offset,
855                _depth,
856            )
857        }
858    }
859    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Network, D>>
860        fidl::encoding::Encode<NetworkRegistryAddRequest, D> for (T0,)
861    {
862        #[inline]
863        unsafe fn encode(
864            self,
865            encoder: &mut fidl::encoding::Encoder<'_, D>,
866            offset: usize,
867            depth: fidl::encoding::Depth,
868        ) -> fidl::Result<()> {
869            encoder.debug_check_bounds::<NetworkRegistryAddRequest>(offset);
870            // Zero out padding regions. There's no need to apply masks
871            // because the unmasked parts will be overwritten by fields.
872            // Write the fields.
873            self.0.encode(encoder, offset + 0, depth)?;
874            Ok(())
875        }
876    }
877
878    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
879        for NetworkRegistryAddRequest
880    {
881        #[inline(always)]
882        fn new_empty() -> Self {
883            Self { network: fidl::new_empty!(Network, D) }
884        }
885
886        #[inline]
887        unsafe fn decode(
888            &mut self,
889            decoder: &mut fidl::encoding::Decoder<'_, D>,
890            offset: usize,
891            _depth: fidl::encoding::Depth,
892        ) -> fidl::Result<()> {
893            decoder.debug_check_bounds::<Self>(offset);
894            // Verify that padding bytes are zero.
895            fidl::decode!(Network, D, &mut self.network, decoder, offset + 0, _depth)?;
896            Ok(())
897        }
898    }
899
900    impl fidl::encoding::ValueTypeMarker for NetworkRegistryRemoveRequest {
901        type Borrowed<'a> = &'a Self;
902        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
903            value
904        }
905    }
906
907    unsafe impl fidl::encoding::TypeMarker for NetworkRegistryRemoveRequest {
908        type Owned = Self;
909
910        #[inline(always)]
911        fn inline_align(_context: fidl::encoding::Context) -> usize {
912            4
913        }
914
915        #[inline(always)]
916        fn inline_size(_context: fidl::encoding::Context) -> usize {
917            4
918        }
919        #[inline(always)]
920        fn encode_is_copy() -> bool {
921            true
922        }
923
924        #[inline(always)]
925        fn decode_is_copy() -> bool {
926            true
927        }
928    }
929
930    unsafe impl<D: fidl::encoding::ResourceDialect>
931        fidl::encoding::Encode<NetworkRegistryRemoveRequest, D> for &NetworkRegistryRemoveRequest
932    {
933        #[inline]
934        unsafe fn encode(
935            self,
936            encoder: &mut fidl::encoding::Encoder<'_, D>,
937            offset: usize,
938            _depth: fidl::encoding::Depth,
939        ) -> fidl::Result<()> {
940            encoder.debug_check_bounds::<NetworkRegistryRemoveRequest>(offset);
941            unsafe {
942                // Copy the object into the buffer.
943                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
944                (buf_ptr as *mut NetworkRegistryRemoveRequest)
945                    .write_unaligned((self as *const NetworkRegistryRemoveRequest).read());
946                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
947                // done second because the memcpy will write garbage to these bytes.
948            }
949            Ok(())
950        }
951    }
952    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
953        fidl::encoding::Encode<NetworkRegistryRemoveRequest, D> for (T0,)
954    {
955        #[inline]
956        unsafe fn encode(
957            self,
958            encoder: &mut fidl::encoding::Encoder<'_, D>,
959            offset: usize,
960            depth: fidl::encoding::Depth,
961        ) -> fidl::Result<()> {
962            encoder.debug_check_bounds::<NetworkRegistryRemoveRequest>(offset);
963            // Zero out padding regions. There's no need to apply masks
964            // because the unmasked parts will be overwritten by fields.
965            // Write the fields.
966            self.0.encode(encoder, offset + 0, depth)?;
967            Ok(())
968        }
969    }
970
971    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
972        for NetworkRegistryRemoveRequest
973    {
974        #[inline(always)]
975        fn new_empty() -> Self {
976            Self { network_id: fidl::new_empty!(u32, D) }
977        }
978
979        #[inline]
980        unsafe fn decode(
981            &mut self,
982            decoder: &mut fidl::encoding::Decoder<'_, D>,
983            offset: usize,
984            _depth: fidl::encoding::Depth,
985        ) -> fidl::Result<()> {
986            decoder.debug_check_bounds::<Self>(offset);
987            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
988            // Verify that padding bytes are zero.
989            // Copy from the buffer into the object.
990            unsafe {
991                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
992            }
993            Ok(())
994        }
995    }
996
997    impl fidl::encoding::ValueTypeMarker for NetworkRegistrySetDefaultRequest {
998        type Borrowed<'a> = &'a Self;
999        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1000            value
1001        }
1002    }
1003
1004    unsafe impl fidl::encoding::TypeMarker for NetworkRegistrySetDefaultRequest {
1005        type Owned = Self;
1006
1007        #[inline(always)]
1008        fn inline_align(_context: fidl::encoding::Context) -> usize {
1009            8
1010        }
1011
1012        #[inline(always)]
1013        fn inline_size(_context: fidl::encoding::Context) -> usize {
1014            16
1015        }
1016    }
1017
1018    unsafe impl<D: fidl::encoding::ResourceDialect>
1019        fidl::encoding::Encode<NetworkRegistrySetDefaultRequest, D>
1020        for &NetworkRegistrySetDefaultRequest
1021    {
1022        #[inline]
1023        unsafe fn encode(
1024            self,
1025            encoder: &mut fidl::encoding::Encoder<'_, D>,
1026            offset: usize,
1027            _depth: fidl::encoding::Depth,
1028        ) -> fidl::Result<()> {
1029            encoder.debug_check_bounds::<NetworkRegistrySetDefaultRequest>(offset);
1030            // Delegate to tuple encoding.
1031            fidl::encoding::Encode::<NetworkRegistrySetDefaultRequest, D>::encode(
1032                (
1033                    <fidl_fuchsia_posix_socket__common::OptionalUint32 as fidl::encoding::ValueTypeMarker>::borrow(&self.network_id),
1034                ),
1035                encoder, offset, _depth
1036            )
1037        }
1038    }
1039    unsafe impl<
1040        D: fidl::encoding::ResourceDialect,
1041        T0: fidl::encoding::Encode<fidl_fuchsia_posix_socket__common::OptionalUint32, D>,
1042    > fidl::encoding::Encode<NetworkRegistrySetDefaultRequest, D> for (T0,)
1043    {
1044        #[inline]
1045        unsafe fn encode(
1046            self,
1047            encoder: &mut fidl::encoding::Encoder<'_, D>,
1048            offset: usize,
1049            depth: fidl::encoding::Depth,
1050        ) -> fidl::Result<()> {
1051            encoder.debug_check_bounds::<NetworkRegistrySetDefaultRequest>(offset);
1052            // Zero out padding regions. There's no need to apply masks
1053            // because the unmasked parts will be overwritten by fields.
1054            // Write the fields.
1055            self.0.encode(encoder, offset + 0, depth)?;
1056            Ok(())
1057        }
1058    }
1059
1060    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1061        for NetworkRegistrySetDefaultRequest
1062    {
1063        #[inline(always)]
1064        fn new_empty() -> Self {
1065            Self {
1066                network_id: fidl::new_empty!(fidl_fuchsia_posix_socket__common::OptionalUint32, D),
1067            }
1068        }
1069
1070        #[inline]
1071        unsafe fn decode(
1072            &mut self,
1073            decoder: &mut fidl::encoding::Decoder<'_, D>,
1074            offset: usize,
1075            _depth: fidl::encoding::Depth,
1076        ) -> fidl::Result<()> {
1077            decoder.debug_check_bounds::<Self>(offset);
1078            // Verify that padding bytes are zero.
1079            fidl::decode!(
1080                fidl_fuchsia_posix_socket__common::OptionalUint32,
1081                D,
1082                &mut self.network_id,
1083                decoder,
1084                offset + 0,
1085                _depth
1086            )?;
1087            Ok(())
1088        }
1089    }
1090
1091    impl fidl::encoding::ValueTypeMarker for NetworkRegistryUpdateRequest {
1092        type Borrowed<'a> = &'a Self;
1093        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1094            value
1095        }
1096    }
1097
1098    unsafe impl fidl::encoding::TypeMarker for NetworkRegistryUpdateRequest {
1099        type Owned = Self;
1100
1101        #[inline(always)]
1102        fn inline_align(_context: fidl::encoding::Context) -> usize {
1103            8
1104        }
1105
1106        #[inline(always)]
1107        fn inline_size(_context: fidl::encoding::Context) -> usize {
1108            16
1109        }
1110    }
1111
1112    unsafe impl<D: fidl::encoding::ResourceDialect>
1113        fidl::encoding::Encode<NetworkRegistryUpdateRequest, D> for &NetworkRegistryUpdateRequest
1114    {
1115        #[inline]
1116        unsafe fn encode(
1117            self,
1118            encoder: &mut fidl::encoding::Encoder<'_, D>,
1119            offset: usize,
1120            _depth: fidl::encoding::Depth,
1121        ) -> fidl::Result<()> {
1122            encoder.debug_check_bounds::<NetworkRegistryUpdateRequest>(offset);
1123            // Delegate to tuple encoding.
1124            fidl::encoding::Encode::<NetworkRegistryUpdateRequest, D>::encode(
1125                (<Network as fidl::encoding::ValueTypeMarker>::borrow(&self.network),),
1126                encoder,
1127                offset,
1128                _depth,
1129            )
1130        }
1131    }
1132    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Network, D>>
1133        fidl::encoding::Encode<NetworkRegistryUpdateRequest, D> for (T0,)
1134    {
1135        #[inline]
1136        unsafe fn encode(
1137            self,
1138            encoder: &mut fidl::encoding::Encoder<'_, D>,
1139            offset: usize,
1140            depth: fidl::encoding::Depth,
1141        ) -> fidl::Result<()> {
1142            encoder.debug_check_bounds::<NetworkRegistryUpdateRequest>(offset);
1143            // Zero out padding regions. There's no need to apply masks
1144            // because the unmasked parts will be overwritten by fields.
1145            // Write the fields.
1146            self.0.encode(encoder, offset + 0, depth)?;
1147            Ok(())
1148        }
1149    }
1150
1151    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1152        for NetworkRegistryUpdateRequest
1153    {
1154        #[inline(always)]
1155        fn new_empty() -> Self {
1156            Self { network: fidl::new_empty!(Network, D) }
1157        }
1158
1159        #[inline]
1160        unsafe fn decode(
1161            &mut self,
1162            decoder: &mut fidl::encoding::Decoder<'_, D>,
1163            offset: usize,
1164            _depth: fidl::encoding::Depth,
1165        ) -> fidl::Result<()> {
1166            decoder.debug_check_bounds::<Self>(offset);
1167            // Verify that padding bytes are zero.
1168            fidl::decode!(Network, D, &mut self.network, decoder, offset + 0, _depth)?;
1169            Ok(())
1170        }
1171    }
1172
1173    impl DnsServerList {
1174        #[inline(always)]
1175        fn max_ordinal_present(&self) -> u64 {
1176            if let Some(_) = self.source_network_id {
1177                return 2;
1178            }
1179            if let Some(_) = self.addresses {
1180                return 1;
1181            }
1182            0
1183        }
1184    }
1185
1186    impl fidl::encoding::ValueTypeMarker for DnsServerList {
1187        type Borrowed<'a> = &'a Self;
1188        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1189            value
1190        }
1191    }
1192
1193    unsafe impl fidl::encoding::TypeMarker for DnsServerList {
1194        type Owned = Self;
1195
1196        #[inline(always)]
1197        fn inline_align(_context: fidl::encoding::Context) -> usize {
1198            8
1199        }
1200
1201        #[inline(always)]
1202        fn inline_size(_context: fidl::encoding::Context) -> usize {
1203            16
1204        }
1205    }
1206
1207    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DnsServerList, D>
1208        for &DnsServerList
1209    {
1210        unsafe fn encode(
1211            self,
1212            encoder: &mut fidl::encoding::Encoder<'_, D>,
1213            offset: usize,
1214            mut depth: fidl::encoding::Depth,
1215        ) -> fidl::Result<()> {
1216            encoder.debug_check_bounds::<DnsServerList>(offset);
1217            // Vector header
1218            let max_ordinal: u64 = self.max_ordinal_present();
1219            encoder.write_num(max_ordinal, offset);
1220            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1221            // Calling encoder.out_of_line_offset(0) is not allowed.
1222            if max_ordinal == 0 {
1223                return Ok(());
1224            }
1225            depth.increment()?;
1226            let envelope_size = 8;
1227            let bytes_len = max_ordinal as usize * envelope_size;
1228            #[allow(unused_variables)]
1229            let offset = encoder.out_of_line_offset(bytes_len);
1230            let mut _prev_end_offset: usize = 0;
1231            if 1 > max_ordinal {
1232                return Ok(());
1233            }
1234
1235            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1236            // are envelope_size bytes.
1237            let cur_offset: usize = (1 - 1) * envelope_size;
1238
1239            // Zero reserved fields.
1240            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1241
1242            // Safety:
1243            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1244            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1245            //   envelope_size bytes, there is always sufficient room.
1246            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_net__common::SocketAddress>, D>(
1247            self.addresses.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_net__common::SocketAddress> as fidl::encoding::ValueTypeMarker>::borrow),
1248            encoder, offset + cur_offset, depth
1249        )?;
1250
1251            _prev_end_offset = cur_offset + envelope_size;
1252            if 2 > max_ordinal {
1253                return Ok(());
1254            }
1255
1256            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1257            // are envelope_size bytes.
1258            let cur_offset: usize = (2 - 1) * envelope_size;
1259
1260            // Zero reserved fields.
1261            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1262
1263            // Safety:
1264            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1265            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1266            //   envelope_size bytes, there is always sufficient room.
1267            fidl::encoding::encode_in_envelope_optional::<u32, D>(
1268                self.source_network_id
1269                    .as_ref()
1270                    .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1271                encoder,
1272                offset + cur_offset,
1273                depth,
1274            )?;
1275
1276            _prev_end_offset = cur_offset + envelope_size;
1277
1278            Ok(())
1279        }
1280    }
1281
1282    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DnsServerList {
1283        #[inline(always)]
1284        fn new_empty() -> Self {
1285            Self::default()
1286        }
1287
1288        unsafe fn decode(
1289            &mut self,
1290            decoder: &mut fidl::encoding::Decoder<'_, D>,
1291            offset: usize,
1292            mut depth: fidl::encoding::Depth,
1293        ) -> fidl::Result<()> {
1294            decoder.debug_check_bounds::<Self>(offset);
1295            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1296                None => return Err(fidl::Error::NotNullable),
1297                Some(len) => len,
1298            };
1299            // Calling decoder.out_of_line_offset(0) is not allowed.
1300            if len == 0 {
1301                return Ok(());
1302            };
1303            depth.increment()?;
1304            let envelope_size = 8;
1305            let bytes_len = len * envelope_size;
1306            let offset = decoder.out_of_line_offset(bytes_len)?;
1307            // Decode the envelope for each type.
1308            let mut _next_ordinal_to_read = 0;
1309            let mut next_offset = offset;
1310            let end_offset = offset + bytes_len;
1311            _next_ordinal_to_read += 1;
1312            if next_offset >= end_offset {
1313                return Ok(());
1314            }
1315
1316            // Decode unknown envelopes for gaps in ordinals.
1317            while _next_ordinal_to_read < 1 {
1318                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1319                _next_ordinal_to_read += 1;
1320                next_offset += envelope_size;
1321            }
1322
1323            let next_out_of_line = decoder.next_out_of_line();
1324            let handles_before = decoder.remaining_handles();
1325            if let Some((inlined, num_bytes, num_handles)) =
1326                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1327            {
1328                let member_inline_size = <fidl::encoding::UnboundedVector<
1329                    fidl_fuchsia_net__common::SocketAddress,
1330                > as fidl::encoding::TypeMarker>::inline_size(
1331                    decoder.context
1332                );
1333                if inlined != (member_inline_size <= 4) {
1334                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1335                }
1336                let inner_offset;
1337                let mut inner_depth = depth.clone();
1338                if inlined {
1339                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1340                    inner_offset = next_offset;
1341                } else {
1342                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1343                    inner_depth.increment()?;
1344                }
1345                let val_ref = self.addresses.get_or_insert_with(|| {
1346                    fidl::new_empty!(
1347                        fidl::encoding::UnboundedVector<fidl_fuchsia_net__common::SocketAddress>,
1348                        D
1349                    )
1350                });
1351                fidl::decode!(
1352                    fidl::encoding::UnboundedVector<fidl_fuchsia_net__common::SocketAddress>,
1353                    D,
1354                    val_ref,
1355                    decoder,
1356                    inner_offset,
1357                    inner_depth
1358                )?;
1359                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1360                {
1361                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1362                }
1363                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1364                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1365                }
1366            }
1367
1368            next_offset += envelope_size;
1369            _next_ordinal_to_read += 1;
1370            if next_offset >= end_offset {
1371                return Ok(());
1372            }
1373
1374            // Decode unknown envelopes for gaps in ordinals.
1375            while _next_ordinal_to_read < 2 {
1376                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1377                _next_ordinal_to_read += 1;
1378                next_offset += envelope_size;
1379            }
1380
1381            let next_out_of_line = decoder.next_out_of_line();
1382            let handles_before = decoder.remaining_handles();
1383            if let Some((inlined, num_bytes, num_handles)) =
1384                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1385            {
1386                let member_inline_size =
1387                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1388                if inlined != (member_inline_size <= 4) {
1389                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1390                }
1391                let inner_offset;
1392                let mut inner_depth = depth.clone();
1393                if inlined {
1394                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1395                    inner_offset = next_offset;
1396                } else {
1397                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1398                    inner_depth.increment()?;
1399                }
1400                let val_ref =
1401                    self.source_network_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
1402                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
1403                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1404                {
1405                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1406                }
1407                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1408                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1409                }
1410            }
1411
1412            next_offset += envelope_size;
1413
1414            // Decode the remaining unknown envelopes.
1415            while next_offset < end_offset {
1416                _next_ordinal_to_read += 1;
1417                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1418                next_offset += envelope_size;
1419            }
1420
1421            Ok(())
1422        }
1423    }
1424
1425    impl FuchsiaNetworkInfo {
1426        #[inline(always)]
1427        fn max_ordinal_present(&self) -> u64 {
1428            0
1429        }
1430    }
1431
1432    impl fidl::encoding::ValueTypeMarker for FuchsiaNetworkInfo {
1433        type Borrowed<'a> = &'a Self;
1434        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1435            value
1436        }
1437    }
1438
1439    unsafe impl fidl::encoding::TypeMarker for FuchsiaNetworkInfo {
1440        type Owned = Self;
1441
1442        #[inline(always)]
1443        fn inline_align(_context: fidl::encoding::Context) -> usize {
1444            8
1445        }
1446
1447        #[inline(always)]
1448        fn inline_size(_context: fidl::encoding::Context) -> usize {
1449            16
1450        }
1451    }
1452
1453    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FuchsiaNetworkInfo, D>
1454        for &FuchsiaNetworkInfo
1455    {
1456        unsafe fn encode(
1457            self,
1458            encoder: &mut fidl::encoding::Encoder<'_, D>,
1459            offset: usize,
1460            mut depth: fidl::encoding::Depth,
1461        ) -> fidl::Result<()> {
1462            encoder.debug_check_bounds::<FuchsiaNetworkInfo>(offset);
1463            // Vector header
1464            let max_ordinal: u64 = self.max_ordinal_present();
1465            encoder.write_num(max_ordinal, offset);
1466            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1467            // Calling encoder.out_of_line_offset(0) is not allowed.
1468            if max_ordinal == 0 {
1469                return Ok(());
1470            }
1471            depth.increment()?;
1472            let envelope_size = 8;
1473            let bytes_len = max_ordinal as usize * envelope_size;
1474            #[allow(unused_variables)]
1475            let offset = encoder.out_of_line_offset(bytes_len);
1476            let mut _prev_end_offset: usize = 0;
1477
1478            Ok(())
1479        }
1480    }
1481
1482    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FuchsiaNetworkInfo {
1483        #[inline(always)]
1484        fn new_empty() -> Self {
1485            Self::default()
1486        }
1487
1488        unsafe fn decode(
1489            &mut self,
1490            decoder: &mut fidl::encoding::Decoder<'_, D>,
1491            offset: usize,
1492            mut depth: fidl::encoding::Depth,
1493        ) -> fidl::Result<()> {
1494            decoder.debug_check_bounds::<Self>(offset);
1495            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1496                None => return Err(fidl::Error::NotNullable),
1497                Some(len) => len,
1498            };
1499            // Calling decoder.out_of_line_offset(0) is not allowed.
1500            if len == 0 {
1501                return Ok(());
1502            };
1503            depth.increment()?;
1504            let envelope_size = 8;
1505            let bytes_len = len * envelope_size;
1506            let offset = decoder.out_of_line_offset(bytes_len)?;
1507            // Decode the envelope for each type.
1508            let mut _next_ordinal_to_read = 0;
1509            let mut next_offset = offset;
1510            let end_offset = offset + bytes_len;
1511
1512            // Decode the remaining unknown envelopes.
1513            while next_offset < end_offset {
1514                _next_ordinal_to_read += 1;
1515                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1516                next_offset += envelope_size;
1517            }
1518
1519            Ok(())
1520        }
1521    }
1522
1523    impl Network {
1524        #[inline(always)]
1525        fn max_ordinal_present(&self) -> u64 {
1526            if let Some(_) = self.dns_servers {
1527                return 3;
1528            }
1529            if let Some(_) = self.info {
1530                return 2;
1531            }
1532            if let Some(_) = self.network_id {
1533                return 1;
1534            }
1535            0
1536        }
1537    }
1538
1539    impl fidl::encoding::ValueTypeMarker for Network {
1540        type Borrowed<'a> = &'a Self;
1541        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1542            value
1543        }
1544    }
1545
1546    unsafe impl fidl::encoding::TypeMarker for Network {
1547        type Owned = Self;
1548
1549        #[inline(always)]
1550        fn inline_align(_context: fidl::encoding::Context) -> usize {
1551            8
1552        }
1553
1554        #[inline(always)]
1555        fn inline_size(_context: fidl::encoding::Context) -> usize {
1556            16
1557        }
1558    }
1559
1560    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Network, D> for &Network {
1561        unsafe fn encode(
1562            self,
1563            encoder: &mut fidl::encoding::Encoder<'_, D>,
1564            offset: usize,
1565            mut depth: fidl::encoding::Depth,
1566        ) -> fidl::Result<()> {
1567            encoder.debug_check_bounds::<Network>(offset);
1568            // Vector header
1569            let max_ordinal: u64 = self.max_ordinal_present();
1570            encoder.write_num(max_ordinal, offset);
1571            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1572            // Calling encoder.out_of_line_offset(0) is not allowed.
1573            if max_ordinal == 0 {
1574                return Ok(());
1575            }
1576            depth.increment()?;
1577            let envelope_size = 8;
1578            let bytes_len = max_ordinal as usize * envelope_size;
1579            #[allow(unused_variables)]
1580            let offset = encoder.out_of_line_offset(bytes_len);
1581            let mut _prev_end_offset: usize = 0;
1582            if 1 > max_ordinal {
1583                return Ok(());
1584            }
1585
1586            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1587            // are envelope_size bytes.
1588            let cur_offset: usize = (1 - 1) * envelope_size;
1589
1590            // Zero reserved fields.
1591            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1592
1593            // Safety:
1594            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1595            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1596            //   envelope_size bytes, there is always sufficient room.
1597            fidl::encoding::encode_in_envelope_optional::<u32, D>(
1598                self.network_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1599                encoder,
1600                offset + cur_offset,
1601                depth,
1602            )?;
1603
1604            _prev_end_offset = cur_offset + envelope_size;
1605            if 2 > max_ordinal {
1606                return Ok(());
1607            }
1608
1609            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1610            // are envelope_size bytes.
1611            let cur_offset: usize = (2 - 1) * envelope_size;
1612
1613            // Zero reserved fields.
1614            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1615
1616            // Safety:
1617            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1618            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1619            //   envelope_size bytes, there is always sufficient room.
1620            fidl::encoding::encode_in_envelope_optional::<NetworkInfo, D>(
1621                self.info.as_ref().map(<NetworkInfo as fidl::encoding::ValueTypeMarker>::borrow),
1622                encoder,
1623                offset + cur_offset,
1624                depth,
1625            )?;
1626
1627            _prev_end_offset = cur_offset + envelope_size;
1628            if 3 > max_ordinal {
1629                return Ok(());
1630            }
1631
1632            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1633            // are envelope_size bytes.
1634            let cur_offset: usize = (3 - 1) * envelope_size;
1635
1636            // Zero reserved fields.
1637            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1638
1639            // Safety:
1640            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1641            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1642            //   envelope_size bytes, there is always sufficient room.
1643            fidl::encoding::encode_in_envelope_optional::<NetworkDnsServers, D>(
1644                self.dns_servers
1645                    .as_ref()
1646                    .map(<NetworkDnsServers as fidl::encoding::ValueTypeMarker>::borrow),
1647                encoder,
1648                offset + cur_offset,
1649                depth,
1650            )?;
1651
1652            _prev_end_offset = cur_offset + envelope_size;
1653
1654            Ok(())
1655        }
1656    }
1657
1658    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Network {
1659        #[inline(always)]
1660        fn new_empty() -> Self {
1661            Self::default()
1662        }
1663
1664        unsafe fn decode(
1665            &mut self,
1666            decoder: &mut fidl::encoding::Decoder<'_, D>,
1667            offset: usize,
1668            mut depth: fidl::encoding::Depth,
1669        ) -> fidl::Result<()> {
1670            decoder.debug_check_bounds::<Self>(offset);
1671            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1672                None => return Err(fidl::Error::NotNullable),
1673                Some(len) => len,
1674            };
1675            // Calling decoder.out_of_line_offset(0) is not allowed.
1676            if len == 0 {
1677                return Ok(());
1678            };
1679            depth.increment()?;
1680            let envelope_size = 8;
1681            let bytes_len = len * envelope_size;
1682            let offset = decoder.out_of_line_offset(bytes_len)?;
1683            // Decode the envelope for each type.
1684            let mut _next_ordinal_to_read = 0;
1685            let mut next_offset = offset;
1686            let end_offset = offset + bytes_len;
1687            _next_ordinal_to_read += 1;
1688            if next_offset >= end_offset {
1689                return Ok(());
1690            }
1691
1692            // Decode unknown envelopes for gaps in ordinals.
1693            while _next_ordinal_to_read < 1 {
1694                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1695                _next_ordinal_to_read += 1;
1696                next_offset += envelope_size;
1697            }
1698
1699            let next_out_of_line = decoder.next_out_of_line();
1700            let handles_before = decoder.remaining_handles();
1701            if let Some((inlined, num_bytes, num_handles)) =
1702                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1703            {
1704                let member_inline_size =
1705                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1706                if inlined != (member_inline_size <= 4) {
1707                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1708                }
1709                let inner_offset;
1710                let mut inner_depth = depth.clone();
1711                if inlined {
1712                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1713                    inner_offset = next_offset;
1714                } else {
1715                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1716                    inner_depth.increment()?;
1717                }
1718                let val_ref = self.network_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
1719                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
1720                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1721                {
1722                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1723                }
1724                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1725                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1726                }
1727            }
1728
1729            next_offset += envelope_size;
1730            _next_ordinal_to_read += 1;
1731            if next_offset >= end_offset {
1732                return Ok(());
1733            }
1734
1735            // Decode unknown envelopes for gaps in ordinals.
1736            while _next_ordinal_to_read < 2 {
1737                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1738                _next_ordinal_to_read += 1;
1739                next_offset += envelope_size;
1740            }
1741
1742            let next_out_of_line = decoder.next_out_of_line();
1743            let handles_before = decoder.remaining_handles();
1744            if let Some((inlined, num_bytes, num_handles)) =
1745                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1746            {
1747                let member_inline_size =
1748                    <NetworkInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1749                if inlined != (member_inline_size <= 4) {
1750                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1751                }
1752                let inner_offset;
1753                let mut inner_depth = depth.clone();
1754                if inlined {
1755                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1756                    inner_offset = next_offset;
1757                } else {
1758                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1759                    inner_depth.increment()?;
1760                }
1761                let val_ref = self.info.get_or_insert_with(|| fidl::new_empty!(NetworkInfo, D));
1762                fidl::decode!(NetworkInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
1763                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1764                {
1765                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1766                }
1767                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1768                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1769                }
1770            }
1771
1772            next_offset += envelope_size;
1773            _next_ordinal_to_read += 1;
1774            if next_offset >= end_offset {
1775                return Ok(());
1776            }
1777
1778            // Decode unknown envelopes for gaps in ordinals.
1779            while _next_ordinal_to_read < 3 {
1780                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1781                _next_ordinal_to_read += 1;
1782                next_offset += envelope_size;
1783            }
1784
1785            let next_out_of_line = decoder.next_out_of_line();
1786            let handles_before = decoder.remaining_handles();
1787            if let Some((inlined, num_bytes, num_handles)) =
1788                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1789            {
1790                let member_inline_size =
1791                    <NetworkDnsServers as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1792                if inlined != (member_inline_size <= 4) {
1793                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1794                }
1795                let inner_offset;
1796                let mut inner_depth = depth.clone();
1797                if inlined {
1798                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1799                    inner_offset = next_offset;
1800                } else {
1801                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1802                    inner_depth.increment()?;
1803                }
1804                let val_ref =
1805                    self.dns_servers.get_or_insert_with(|| fidl::new_empty!(NetworkDnsServers, D));
1806                fidl::decode!(NetworkDnsServers, D, val_ref, decoder, inner_offset, inner_depth)?;
1807                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1808                {
1809                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1810                }
1811                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1812                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1813                }
1814            }
1815
1816            next_offset += envelope_size;
1817
1818            // Decode the remaining unknown envelopes.
1819            while next_offset < end_offset {
1820                _next_ordinal_to_read += 1;
1821                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1822                next_offset += envelope_size;
1823            }
1824
1825            Ok(())
1826        }
1827    }
1828
1829    impl NetworkDnsServers {
1830        #[inline(always)]
1831        fn max_ordinal_present(&self) -> u64 {
1832            if let Some(_) = self.v6 {
1833                return 2;
1834            }
1835            if let Some(_) = self.v4 {
1836                return 1;
1837            }
1838            0
1839        }
1840    }
1841
1842    impl fidl::encoding::ValueTypeMarker for NetworkDnsServers {
1843        type Borrowed<'a> = &'a Self;
1844        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1845            value
1846        }
1847    }
1848
1849    unsafe impl fidl::encoding::TypeMarker for NetworkDnsServers {
1850        type Owned = Self;
1851
1852        #[inline(always)]
1853        fn inline_align(_context: fidl::encoding::Context) -> usize {
1854            8
1855        }
1856
1857        #[inline(always)]
1858        fn inline_size(_context: fidl::encoding::Context) -> usize {
1859            16
1860        }
1861    }
1862
1863    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NetworkDnsServers, D>
1864        for &NetworkDnsServers
1865    {
1866        unsafe fn encode(
1867            self,
1868            encoder: &mut fidl::encoding::Encoder<'_, D>,
1869            offset: usize,
1870            mut depth: fidl::encoding::Depth,
1871        ) -> fidl::Result<()> {
1872            encoder.debug_check_bounds::<NetworkDnsServers>(offset);
1873            // Vector header
1874            let max_ordinal: u64 = self.max_ordinal_present();
1875            encoder.write_num(max_ordinal, offset);
1876            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1877            // Calling encoder.out_of_line_offset(0) is not allowed.
1878            if max_ordinal == 0 {
1879                return Ok(());
1880            }
1881            depth.increment()?;
1882            let envelope_size = 8;
1883            let bytes_len = max_ordinal as usize * envelope_size;
1884            #[allow(unused_variables)]
1885            let offset = encoder.out_of_line_offset(bytes_len);
1886            let mut _prev_end_offset: usize = 0;
1887            if 1 > max_ordinal {
1888                return Ok(());
1889            }
1890
1891            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1892            // are envelope_size bytes.
1893            let cur_offset: usize = (1 - 1) * envelope_size;
1894
1895            // Zero reserved fields.
1896            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1897
1898            // Safety:
1899            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1900            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1901            //   envelope_size bytes, there is always sufficient room.
1902            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_net__common::Ipv4Address>, D>(
1903            self.v4.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_net__common::Ipv4Address> as fidl::encoding::ValueTypeMarker>::borrow),
1904            encoder, offset + cur_offset, depth
1905        )?;
1906
1907            _prev_end_offset = cur_offset + envelope_size;
1908            if 2 > max_ordinal {
1909                return Ok(());
1910            }
1911
1912            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1913            // are envelope_size bytes.
1914            let cur_offset: usize = (2 - 1) * envelope_size;
1915
1916            // Zero reserved fields.
1917            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1918
1919            // Safety:
1920            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1921            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1922            //   envelope_size bytes, there is always sufficient room.
1923            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_net__common::Ipv6Address>, D>(
1924            self.v6.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_net__common::Ipv6Address> as fidl::encoding::ValueTypeMarker>::borrow),
1925            encoder, offset + cur_offset, depth
1926        )?;
1927
1928            _prev_end_offset = cur_offset + envelope_size;
1929
1930            Ok(())
1931        }
1932    }
1933
1934    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NetworkDnsServers {
1935        #[inline(always)]
1936        fn new_empty() -> Self {
1937            Self::default()
1938        }
1939
1940        unsafe fn decode(
1941            &mut self,
1942            decoder: &mut fidl::encoding::Decoder<'_, D>,
1943            offset: usize,
1944            mut depth: fidl::encoding::Depth,
1945        ) -> fidl::Result<()> {
1946            decoder.debug_check_bounds::<Self>(offset);
1947            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1948                None => return Err(fidl::Error::NotNullable),
1949                Some(len) => len,
1950            };
1951            // Calling decoder.out_of_line_offset(0) is not allowed.
1952            if len == 0 {
1953                return Ok(());
1954            };
1955            depth.increment()?;
1956            let envelope_size = 8;
1957            let bytes_len = len * envelope_size;
1958            let offset = decoder.out_of_line_offset(bytes_len)?;
1959            // Decode the envelope for each type.
1960            let mut _next_ordinal_to_read = 0;
1961            let mut next_offset = offset;
1962            let end_offset = offset + bytes_len;
1963            _next_ordinal_to_read += 1;
1964            if next_offset >= end_offset {
1965                return Ok(());
1966            }
1967
1968            // Decode unknown envelopes for gaps in ordinals.
1969            while _next_ordinal_to_read < 1 {
1970                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1971                _next_ordinal_to_read += 1;
1972                next_offset += envelope_size;
1973            }
1974
1975            let next_out_of_line = decoder.next_out_of_line();
1976            let handles_before = decoder.remaining_handles();
1977            if let Some((inlined, num_bytes, num_handles)) =
1978                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1979            {
1980                let member_inline_size = <fidl::encoding::UnboundedVector<
1981                    fidl_fuchsia_net__common::Ipv4Address,
1982                > as fidl::encoding::TypeMarker>::inline_size(
1983                    decoder.context
1984                );
1985                if inlined != (member_inline_size <= 4) {
1986                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1987                }
1988                let inner_offset;
1989                let mut inner_depth = depth.clone();
1990                if inlined {
1991                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1992                    inner_offset = next_offset;
1993                } else {
1994                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1995                    inner_depth.increment()?;
1996                }
1997                let val_ref = self.v4.get_or_insert_with(|| {
1998                    fidl::new_empty!(
1999                        fidl::encoding::UnboundedVector<fidl_fuchsia_net__common::Ipv4Address>,
2000                        D
2001                    )
2002                });
2003                fidl::decode!(
2004                    fidl::encoding::UnboundedVector<fidl_fuchsia_net__common::Ipv4Address>,
2005                    D,
2006                    val_ref,
2007                    decoder,
2008                    inner_offset,
2009                    inner_depth
2010                )?;
2011                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2012                {
2013                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2014                }
2015                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2016                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2017                }
2018            }
2019
2020            next_offset += envelope_size;
2021            _next_ordinal_to_read += 1;
2022            if next_offset >= end_offset {
2023                return Ok(());
2024            }
2025
2026            // Decode unknown envelopes for gaps in ordinals.
2027            while _next_ordinal_to_read < 2 {
2028                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2029                _next_ordinal_to_read += 1;
2030                next_offset += envelope_size;
2031            }
2032
2033            let next_out_of_line = decoder.next_out_of_line();
2034            let handles_before = decoder.remaining_handles();
2035            if let Some((inlined, num_bytes, num_handles)) =
2036                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2037            {
2038                let member_inline_size = <fidl::encoding::UnboundedVector<
2039                    fidl_fuchsia_net__common::Ipv6Address,
2040                > as fidl::encoding::TypeMarker>::inline_size(
2041                    decoder.context
2042                );
2043                if inlined != (member_inline_size <= 4) {
2044                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2045                }
2046                let inner_offset;
2047                let mut inner_depth = depth.clone();
2048                if inlined {
2049                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2050                    inner_offset = next_offset;
2051                } else {
2052                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2053                    inner_depth.increment()?;
2054                }
2055                let val_ref = self.v6.get_or_insert_with(|| {
2056                    fidl::new_empty!(
2057                        fidl::encoding::UnboundedVector<fidl_fuchsia_net__common::Ipv6Address>,
2058                        D
2059                    )
2060                });
2061                fidl::decode!(
2062                    fidl::encoding::UnboundedVector<fidl_fuchsia_net__common::Ipv6Address>,
2063                    D,
2064                    val_ref,
2065                    decoder,
2066                    inner_offset,
2067                    inner_depth
2068                )?;
2069                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2070                {
2071                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2072                }
2073                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2074                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2075                }
2076            }
2077
2078            next_offset += envelope_size;
2079
2080            // Decode the remaining unknown envelopes.
2081            while next_offset < end_offset {
2082                _next_ordinal_to_read += 1;
2083                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2084                next_offset += envelope_size;
2085            }
2086
2087            Ok(())
2088        }
2089    }
2090
2091    impl StarnixNetworkInfo {
2092        #[inline(always)]
2093        fn max_ordinal_present(&self) -> u64 {
2094            if let Some(_) = self.handle {
2095                return 2;
2096            }
2097            if let Some(_) = self.mark {
2098                return 1;
2099            }
2100            0
2101        }
2102    }
2103
2104    impl fidl::encoding::ValueTypeMarker for StarnixNetworkInfo {
2105        type Borrowed<'a> = &'a Self;
2106        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2107            value
2108        }
2109    }
2110
2111    unsafe impl fidl::encoding::TypeMarker for StarnixNetworkInfo {
2112        type Owned = Self;
2113
2114        #[inline(always)]
2115        fn inline_align(_context: fidl::encoding::Context) -> usize {
2116            8
2117        }
2118
2119        #[inline(always)]
2120        fn inline_size(_context: fidl::encoding::Context) -> usize {
2121            16
2122        }
2123    }
2124
2125    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StarnixNetworkInfo, D>
2126        for &StarnixNetworkInfo
2127    {
2128        unsafe fn encode(
2129            self,
2130            encoder: &mut fidl::encoding::Encoder<'_, D>,
2131            offset: usize,
2132            mut depth: fidl::encoding::Depth,
2133        ) -> fidl::Result<()> {
2134            encoder.debug_check_bounds::<StarnixNetworkInfo>(offset);
2135            // Vector header
2136            let max_ordinal: u64 = self.max_ordinal_present();
2137            encoder.write_num(max_ordinal, offset);
2138            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2139            // Calling encoder.out_of_line_offset(0) is not allowed.
2140            if max_ordinal == 0 {
2141                return Ok(());
2142            }
2143            depth.increment()?;
2144            let envelope_size = 8;
2145            let bytes_len = max_ordinal as usize * envelope_size;
2146            #[allow(unused_variables)]
2147            let offset = encoder.out_of_line_offset(bytes_len);
2148            let mut _prev_end_offset: usize = 0;
2149            if 1 > max_ordinal {
2150                return Ok(());
2151            }
2152
2153            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2154            // are envelope_size bytes.
2155            let cur_offset: usize = (1 - 1) * envelope_size;
2156
2157            // Zero reserved fields.
2158            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2159
2160            // Safety:
2161            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2162            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2163            //   envelope_size bytes, there is always sufficient room.
2164            fidl::encoding::encode_in_envelope_optional::<u32, D>(
2165                self.mark.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2166                encoder,
2167                offset + cur_offset,
2168                depth,
2169            )?;
2170
2171            _prev_end_offset = cur_offset + envelope_size;
2172            if 2 > max_ordinal {
2173                return Ok(());
2174            }
2175
2176            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2177            // are envelope_size bytes.
2178            let cur_offset: usize = (2 - 1) * envelope_size;
2179
2180            // Zero reserved fields.
2181            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2182
2183            // Safety:
2184            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2185            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2186            //   envelope_size bytes, there is always sufficient room.
2187            fidl::encoding::encode_in_envelope_optional::<u64, D>(
2188                self.handle.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2189                encoder,
2190                offset + cur_offset,
2191                depth,
2192            )?;
2193
2194            _prev_end_offset = cur_offset + envelope_size;
2195
2196            Ok(())
2197        }
2198    }
2199
2200    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StarnixNetworkInfo {
2201        #[inline(always)]
2202        fn new_empty() -> Self {
2203            Self::default()
2204        }
2205
2206        unsafe fn decode(
2207            &mut self,
2208            decoder: &mut fidl::encoding::Decoder<'_, D>,
2209            offset: usize,
2210            mut depth: fidl::encoding::Depth,
2211        ) -> fidl::Result<()> {
2212            decoder.debug_check_bounds::<Self>(offset);
2213            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2214                None => return Err(fidl::Error::NotNullable),
2215                Some(len) => len,
2216            };
2217            // Calling decoder.out_of_line_offset(0) is not allowed.
2218            if len == 0 {
2219                return Ok(());
2220            };
2221            depth.increment()?;
2222            let envelope_size = 8;
2223            let bytes_len = len * envelope_size;
2224            let offset = decoder.out_of_line_offset(bytes_len)?;
2225            // Decode the envelope for each type.
2226            let mut _next_ordinal_to_read = 0;
2227            let mut next_offset = offset;
2228            let end_offset = offset + bytes_len;
2229            _next_ordinal_to_read += 1;
2230            if next_offset >= end_offset {
2231                return Ok(());
2232            }
2233
2234            // Decode unknown envelopes for gaps in ordinals.
2235            while _next_ordinal_to_read < 1 {
2236                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2237                _next_ordinal_to_read += 1;
2238                next_offset += envelope_size;
2239            }
2240
2241            let next_out_of_line = decoder.next_out_of_line();
2242            let handles_before = decoder.remaining_handles();
2243            if let Some((inlined, num_bytes, num_handles)) =
2244                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2245            {
2246                let member_inline_size =
2247                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2248                if inlined != (member_inline_size <= 4) {
2249                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2250                }
2251                let inner_offset;
2252                let mut inner_depth = depth.clone();
2253                if inlined {
2254                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2255                    inner_offset = next_offset;
2256                } else {
2257                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2258                    inner_depth.increment()?;
2259                }
2260                let val_ref = self.mark.get_or_insert_with(|| fidl::new_empty!(u32, D));
2261                fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
2262                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2263                {
2264                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2265                }
2266                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2267                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2268                }
2269            }
2270
2271            next_offset += envelope_size;
2272            _next_ordinal_to_read += 1;
2273            if next_offset >= end_offset {
2274                return Ok(());
2275            }
2276
2277            // Decode unknown envelopes for gaps in ordinals.
2278            while _next_ordinal_to_read < 2 {
2279                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2280                _next_ordinal_to_read += 1;
2281                next_offset += envelope_size;
2282            }
2283
2284            let next_out_of_line = decoder.next_out_of_line();
2285            let handles_before = decoder.remaining_handles();
2286            if let Some((inlined, num_bytes, num_handles)) =
2287                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2288            {
2289                let member_inline_size =
2290                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2291                if inlined != (member_inline_size <= 4) {
2292                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2293                }
2294                let inner_offset;
2295                let mut inner_depth = depth.clone();
2296                if inlined {
2297                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2298                    inner_offset = next_offset;
2299                } else {
2300                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2301                    inner_depth.increment()?;
2302                }
2303                let val_ref = self.handle.get_or_insert_with(|| fidl::new_empty!(u64, D));
2304                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2305                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2306                {
2307                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2308                }
2309                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2310                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2311                }
2312            }
2313
2314            next_offset += envelope_size;
2315
2316            // Decode the remaining unknown envelopes.
2317            while next_offset < end_offset {
2318                _next_ordinal_to_read += 1;
2319                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2320                next_offset += envelope_size;
2321            }
2322
2323            Ok(())
2324        }
2325    }
2326
2327    impl fidl::encoding::ValueTypeMarker for NetworkInfo {
2328        type Borrowed<'a> = &'a Self;
2329        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2330            value
2331        }
2332    }
2333
2334    unsafe impl fidl::encoding::TypeMarker for NetworkInfo {
2335        type Owned = Self;
2336
2337        #[inline(always)]
2338        fn inline_align(_context: fidl::encoding::Context) -> usize {
2339            8
2340        }
2341
2342        #[inline(always)]
2343        fn inline_size(_context: fidl::encoding::Context) -> usize {
2344            16
2345        }
2346    }
2347
2348    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NetworkInfo, D>
2349        for &NetworkInfo
2350    {
2351        #[inline]
2352        unsafe fn encode(
2353            self,
2354            encoder: &mut fidl::encoding::Encoder<'_, D>,
2355            offset: usize,
2356            _depth: fidl::encoding::Depth,
2357        ) -> fidl::Result<()> {
2358            encoder.debug_check_bounds::<NetworkInfo>(offset);
2359            encoder.write_num::<u64>(self.ordinal(), offset);
2360            match self {
2361                NetworkInfo::Starnix(ref val) => {
2362                    fidl::encoding::encode_in_envelope::<StarnixNetworkInfo, D>(
2363                        <StarnixNetworkInfo as fidl::encoding::ValueTypeMarker>::borrow(val),
2364                        encoder,
2365                        offset + 8,
2366                        _depth,
2367                    )
2368                }
2369                NetworkInfo::Fuchsia(ref val) => {
2370                    fidl::encoding::encode_in_envelope::<FuchsiaNetworkInfo, D>(
2371                        <FuchsiaNetworkInfo as fidl::encoding::ValueTypeMarker>::borrow(val),
2372                        encoder,
2373                        offset + 8,
2374                        _depth,
2375                    )
2376                }
2377                NetworkInfo::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2378            }
2379        }
2380    }
2381
2382    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NetworkInfo {
2383        #[inline(always)]
2384        fn new_empty() -> Self {
2385            Self::__SourceBreaking { unknown_ordinal: 0 }
2386        }
2387
2388        #[inline]
2389        unsafe fn decode(
2390            &mut self,
2391            decoder: &mut fidl::encoding::Decoder<'_, D>,
2392            offset: usize,
2393            mut depth: fidl::encoding::Depth,
2394        ) -> fidl::Result<()> {
2395            decoder.debug_check_bounds::<Self>(offset);
2396            #[allow(unused_variables)]
2397            let next_out_of_line = decoder.next_out_of_line();
2398            let handles_before = decoder.remaining_handles();
2399            let (ordinal, inlined, num_bytes, num_handles) =
2400                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2401
2402            let member_inline_size = match ordinal {
2403                1 => {
2404                    <StarnixNetworkInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context)
2405                }
2406                2 => {
2407                    <FuchsiaNetworkInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context)
2408                }
2409                0 => return Err(fidl::Error::UnknownUnionTag),
2410                _ => num_bytes as usize,
2411            };
2412
2413            if inlined != (member_inline_size <= 4) {
2414                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2415            }
2416            let _inner_offset;
2417            if inlined {
2418                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2419                _inner_offset = offset + 8;
2420            } else {
2421                depth.increment()?;
2422                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2423            }
2424            match ordinal {
2425                1 => {
2426                    #[allow(irrefutable_let_patterns)]
2427                    if let NetworkInfo::Starnix(_) = self {
2428                        // Do nothing, read the value into the object
2429                    } else {
2430                        // Initialize `self` to the right variant
2431                        *self = NetworkInfo::Starnix(fidl::new_empty!(StarnixNetworkInfo, D));
2432                    }
2433                    #[allow(irrefutable_let_patterns)]
2434                    if let NetworkInfo::Starnix(ref mut val) = self {
2435                        fidl::decode!(StarnixNetworkInfo, D, val, decoder, _inner_offset, depth)?;
2436                    } else {
2437                        unreachable!()
2438                    }
2439                }
2440                2 => {
2441                    #[allow(irrefutable_let_patterns)]
2442                    if let NetworkInfo::Fuchsia(_) = self {
2443                        // Do nothing, read the value into the object
2444                    } else {
2445                        // Initialize `self` to the right variant
2446                        *self = NetworkInfo::Fuchsia(fidl::new_empty!(FuchsiaNetworkInfo, D));
2447                    }
2448                    #[allow(irrefutable_let_patterns)]
2449                    if let NetworkInfo::Fuchsia(ref mut val) = self {
2450                        fidl::decode!(FuchsiaNetworkInfo, D, val, decoder, _inner_offset, depth)?;
2451                    } else {
2452                        unreachable!()
2453                    }
2454                }
2455                #[allow(deprecated)]
2456                ordinal => {
2457                    for _ in 0..num_handles {
2458                        decoder.drop_next_handle()?;
2459                    }
2460                    *self = NetworkInfo::__SourceBreaking { unknown_ordinal: ordinal };
2461                }
2462            }
2463            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2464                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2465            }
2466            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2467                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2468            }
2469            Ok(())
2470        }
2471    }
2472}