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