Skip to main content

fidl_fuchsia_net_policy_properties__common/
fidl_fuchsia_net_policy_properties__common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
12pub enum NetworkTokenResolverResolveTokenError {
13    /// The provided `NetworkToken` is invalid or out-of-date.
14    InvalidNetworkToken,
15    #[doc(hidden)]
16    __SourceBreaking { unknown_ordinal: u32 },
17}
18
19/// Pattern that matches an unknown `NetworkTokenResolverResolveTokenError` member.
20#[macro_export]
21macro_rules! NetworkTokenResolverResolveTokenErrorUnknown {
22    () => {
23        _
24    };
25}
26
27impl NetworkTokenResolverResolveTokenError {
28    #[inline]
29    pub fn from_primitive(prim: u32) -> Option<Self> {
30        match prim {
31            1 => Some(Self::InvalidNetworkToken),
32            _ => None,
33        }
34    }
35
36    #[inline]
37    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
38        match prim {
39            1 => Self::InvalidNetworkToken,
40            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
41        }
42    }
43
44    #[inline]
45    pub fn unknown() -> Self {
46        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
47    }
48
49    #[inline]
50    pub const fn into_primitive(self) -> u32 {
51        match self {
52            Self::InvalidNetworkToken => 1,
53            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
54        }
55    }
56
57    #[inline]
58    pub fn is_unknown(&self) -> bool {
59        match self {
60            Self::__SourceBreaking { unknown_ordinal: _ } => true,
61            _ => false,
62        }
63    }
64}
65
66#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
67pub enum Property {
68    SocketMarks,
69    DnsConfiguration,
70    #[doc(hidden)]
71    __SourceBreaking {
72        unknown_ordinal: u32,
73    },
74}
75
76/// Pattern that matches an unknown `Property` member.
77#[macro_export]
78macro_rules! PropertyUnknown {
79    () => {
80        _
81    };
82}
83
84impl Property {
85    #[inline]
86    pub fn from_primitive(prim: u32) -> Option<Self> {
87        match prim {
88            1 => Some(Self::SocketMarks),
89            2 => Some(Self::DnsConfiguration),
90            _ => None,
91        }
92    }
93
94    #[inline]
95    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
96        match prim {
97            1 => Self::SocketMarks,
98            2 => Self::DnsConfiguration,
99            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
100        }
101    }
102
103    #[inline]
104    pub fn unknown() -> Self {
105        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
106    }
107
108    #[inline]
109    pub const fn into_primitive(self) -> u32 {
110        match self {
111            Self::SocketMarks => 1,
112            Self::DnsConfiguration => 2,
113            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
114        }
115    }
116
117    #[inline]
118    pub fn is_unknown(&self) -> bool {
119        match self {
120            Self::__SourceBreaking { unknown_ordinal: _ } => true,
121            _ => false,
122        }
123    }
124}
125
126#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
127pub enum WatchError {
128    /// The provided `properties` list was empty.
129    NoProperties,
130    /// The provided NetworkToken was either not acquired from
131    /// [`WatchDefault`] or is no longer valid.
132    InvalidNetworkToken,
133    /// When the network represented by `network` no longer exists, a new
134    /// [`NetworkToken`] must be acquired.
135    NetworkGone,
136    /// An argument marked above as REQUIRED was not provided.
137    MissingRequiredArgument,
138    #[doc(hidden)]
139    __SourceBreaking { unknown_ordinal: u32 },
140}
141
142/// Pattern that matches an unknown `WatchError` member.
143#[macro_export]
144macro_rules! WatchErrorUnknown {
145    () => {
146        _
147    };
148}
149
150impl WatchError {
151    #[inline]
152    pub fn from_primitive(prim: u32) -> Option<Self> {
153        match prim {
154            1 => Some(Self::NoProperties),
155            2 => Some(Self::InvalidNetworkToken),
156            3 => Some(Self::NetworkGone),
157            99 => Some(Self::MissingRequiredArgument),
158            _ => None,
159        }
160    }
161
162    #[inline]
163    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
164        match prim {
165            1 => Self::NoProperties,
166            2 => Self::InvalidNetworkToken,
167            3 => Self::NetworkGone,
168            99 => Self::MissingRequiredArgument,
169            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
170        }
171    }
172
173    #[inline]
174    pub fn unknown() -> Self {
175        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
176    }
177
178    #[inline]
179    pub const fn into_primitive(self) -> u32 {
180        match self {
181            Self::NoProperties => 1,
182            Self::InvalidNetworkToken => 2,
183            Self::NetworkGone => 3,
184            Self::MissingRequiredArgument => 99,
185            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
186        }
187    }
188
189    #[inline]
190    pub fn is_unknown(&self) -> bool {
191        match self {
192            Self::__SourceBreaking { unknown_ordinal: _ } => true,
193            _ => false,
194        }
195    }
196}
197
198#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
199pub struct Empty;
200
201impl fidl::Persistable for Empty {}
202
203#[derive(Clone, Debug, PartialEq)]
204pub struct NetworksWatchPropertiesResponse {
205    /// A list of updates that have happened since the last call to
206    /// `WatchProperties` returned. There is no guarantee of ordering. If a
207    /// property changes multiple times between updates, only the most
208    /// recent version will be reported.
209    pub updates: Vec<PropertyUpdate>,
210}
211
212impl fidl::Persistable for NetworksWatchPropertiesResponse {}
213
214#[derive(Clone, Debug, Default, PartialEq)]
215pub struct DnsConfiguration {
216    /// A preference ordered list of [`fuchsia.net.name.DnsServer`]s.
217    /// NOTE: Required, this field must always be set.
218    pub servers: Option<Vec<fidl_fuchsia_net_name__common::DnsServer_>>,
219    #[doc(hidden)]
220    pub __source_breaking: fidl::marker::SourceBreaking,
221}
222
223impl fidl::Persistable for DnsConfiguration {}
224
225/// A single update from [`Networks.WatchProperties`].
226#[derive(Clone, Debug)]
227pub enum PropertyUpdate {
228    /// The socket marks associated with this network.
229    SocketMarks(fidl_fuchsia_net__common::Marks),
230    /// The DNS Configuration associated with this network.
231    DnsConfiguration(DnsConfiguration),
232    #[doc(hidden)]
233    __SourceBreaking { unknown_ordinal: u64 },
234}
235
236/// Pattern that matches an unknown `PropertyUpdate` member.
237#[macro_export]
238macro_rules! PropertyUpdateUnknown {
239    () => {
240        _
241    };
242}
243
244// Custom PartialEq so that unknown variants are not equal to themselves.
245impl PartialEq for PropertyUpdate {
246    fn eq(&self, other: &Self) -> bool {
247        match (self, other) {
248            (Self::SocketMarks(x), Self::SocketMarks(y)) => *x == *y,
249            (Self::DnsConfiguration(x), Self::DnsConfiguration(y)) => *x == *y,
250            _ => false,
251        }
252    }
253}
254
255impl PropertyUpdate {
256    #[inline]
257    pub fn ordinal(&self) -> u64 {
258        match *self {
259            Self::SocketMarks(_) => 1,
260            Self::DnsConfiguration(_) => 2,
261            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
262        }
263    }
264
265    #[inline]
266    pub fn unknown_variant_for_testing() -> Self {
267        Self::__SourceBreaking { unknown_ordinal: 0 }
268    }
269
270    #[inline]
271    pub fn is_unknown(&self) -> bool {
272        match self {
273            Self::__SourceBreaking { .. } => true,
274            _ => false,
275        }
276    }
277}
278
279impl fidl::Persistable for PropertyUpdate {}
280
281pub mod network_token_resolver_ordinals {
282    pub const RESOLVE_TOKEN: u64 = 0x4176f67517941bac;
283}
284
285pub mod networks_ordinals {
286    pub const WATCH_DEFAULT: u64 = 0x346880b2d7db0f98;
287    pub const WATCH_PROPERTIES: u64 = 0x24d2340905f7dcc6;
288}
289
290mod internal {
291    use super::*;
292    unsafe impl fidl::encoding::TypeMarker for NetworkTokenResolverResolveTokenError {
293        type Owned = Self;
294
295        #[inline(always)]
296        fn inline_align(_context: fidl::encoding::Context) -> usize {
297            std::mem::align_of::<u32>()
298        }
299
300        #[inline(always)]
301        fn inline_size(_context: fidl::encoding::Context) -> usize {
302            std::mem::size_of::<u32>()
303        }
304
305        #[inline(always)]
306        fn encode_is_copy() -> bool {
307            false
308        }
309
310        #[inline(always)]
311        fn decode_is_copy() -> bool {
312            false
313        }
314    }
315
316    impl fidl::encoding::ValueTypeMarker for NetworkTokenResolverResolveTokenError {
317        type Borrowed<'a> = Self;
318        #[inline(always)]
319        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
320            *value
321        }
322    }
323
324    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
325        for NetworkTokenResolverResolveTokenError
326    {
327        #[inline]
328        unsafe fn encode(
329            self,
330            encoder: &mut fidl::encoding::Encoder<'_, D>,
331            offset: usize,
332            _depth: fidl::encoding::Depth,
333        ) -> fidl::Result<()> {
334            encoder.debug_check_bounds::<Self>(offset);
335            encoder.write_num(self.into_primitive(), offset);
336            Ok(())
337        }
338    }
339
340    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
341        for NetworkTokenResolverResolveTokenError
342    {
343        #[inline(always)]
344        fn new_empty() -> Self {
345            Self::unknown()
346        }
347
348        #[inline]
349        unsafe fn decode(
350            &mut self,
351            decoder: &mut fidl::encoding::Decoder<'_, D>,
352            offset: usize,
353            _depth: fidl::encoding::Depth,
354        ) -> fidl::Result<()> {
355            decoder.debug_check_bounds::<Self>(offset);
356            let prim = decoder.read_num::<u32>(offset);
357
358            *self = Self::from_primitive_allow_unknown(prim);
359            Ok(())
360        }
361    }
362    unsafe impl fidl::encoding::TypeMarker for Property {
363        type Owned = Self;
364
365        #[inline(always)]
366        fn inline_align(_context: fidl::encoding::Context) -> usize {
367            std::mem::align_of::<u32>()
368        }
369
370        #[inline(always)]
371        fn inline_size(_context: fidl::encoding::Context) -> usize {
372            std::mem::size_of::<u32>()
373        }
374
375        #[inline(always)]
376        fn encode_is_copy() -> bool {
377            false
378        }
379
380        #[inline(always)]
381        fn decode_is_copy() -> bool {
382            false
383        }
384    }
385
386    impl fidl::encoding::ValueTypeMarker for Property {
387        type Borrowed<'a> = Self;
388        #[inline(always)]
389        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
390            *value
391        }
392    }
393
394    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Property {
395        #[inline]
396        unsafe fn encode(
397            self,
398            encoder: &mut fidl::encoding::Encoder<'_, D>,
399            offset: usize,
400            _depth: fidl::encoding::Depth,
401        ) -> fidl::Result<()> {
402            encoder.debug_check_bounds::<Self>(offset);
403            encoder.write_num(self.into_primitive(), offset);
404            Ok(())
405        }
406    }
407
408    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Property {
409        #[inline(always)]
410        fn new_empty() -> Self {
411            Self::unknown()
412        }
413
414        #[inline]
415        unsafe fn decode(
416            &mut self,
417            decoder: &mut fidl::encoding::Decoder<'_, D>,
418            offset: usize,
419            _depth: fidl::encoding::Depth,
420        ) -> fidl::Result<()> {
421            decoder.debug_check_bounds::<Self>(offset);
422            let prim = decoder.read_num::<u32>(offset);
423
424            *self = Self::from_primitive_allow_unknown(prim);
425            Ok(())
426        }
427    }
428    unsafe impl fidl::encoding::TypeMarker for WatchError {
429        type Owned = Self;
430
431        #[inline(always)]
432        fn inline_align(_context: fidl::encoding::Context) -> usize {
433            std::mem::align_of::<u32>()
434        }
435
436        #[inline(always)]
437        fn inline_size(_context: fidl::encoding::Context) -> usize {
438            std::mem::size_of::<u32>()
439        }
440
441        #[inline(always)]
442        fn encode_is_copy() -> bool {
443            false
444        }
445
446        #[inline(always)]
447        fn decode_is_copy() -> bool {
448            false
449        }
450    }
451
452    impl fidl::encoding::ValueTypeMarker for WatchError {
453        type Borrowed<'a> = Self;
454        #[inline(always)]
455        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
456            *value
457        }
458    }
459
460    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for WatchError {
461        #[inline]
462        unsafe fn encode(
463            self,
464            encoder: &mut fidl::encoding::Encoder<'_, D>,
465            offset: usize,
466            _depth: fidl::encoding::Depth,
467        ) -> fidl::Result<()> {
468            encoder.debug_check_bounds::<Self>(offset);
469            encoder.write_num(self.into_primitive(), offset);
470            Ok(())
471        }
472    }
473
474    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WatchError {
475        #[inline(always)]
476        fn new_empty() -> Self {
477            Self::unknown()
478        }
479
480        #[inline]
481        unsafe fn decode(
482            &mut self,
483            decoder: &mut fidl::encoding::Decoder<'_, D>,
484            offset: usize,
485            _depth: fidl::encoding::Depth,
486        ) -> fidl::Result<()> {
487            decoder.debug_check_bounds::<Self>(offset);
488            let prim = decoder.read_num::<u32>(offset);
489
490            *self = Self::from_primitive_allow_unknown(prim);
491            Ok(())
492        }
493    }
494
495    impl fidl::encoding::ValueTypeMarker for Empty {
496        type Borrowed<'a> = &'a Self;
497        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
498            value
499        }
500    }
501
502    unsafe impl fidl::encoding::TypeMarker for Empty {
503        type Owned = Self;
504
505        #[inline(always)]
506        fn inline_align(_context: fidl::encoding::Context) -> usize {
507            1
508        }
509
510        #[inline(always)]
511        fn inline_size(_context: fidl::encoding::Context) -> usize {
512            1
513        }
514    }
515
516    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Empty, D> for &Empty {
517        #[inline]
518        unsafe fn encode(
519            self,
520            encoder: &mut fidl::encoding::Encoder<'_, D>,
521            offset: usize,
522            _depth: fidl::encoding::Depth,
523        ) -> fidl::Result<()> {
524            encoder.debug_check_bounds::<Empty>(offset);
525            encoder.write_num(0u8, offset);
526            Ok(())
527        }
528    }
529
530    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Empty {
531        #[inline(always)]
532        fn new_empty() -> Self {
533            Self
534        }
535
536        #[inline]
537        unsafe fn decode(
538            &mut self,
539            decoder: &mut fidl::encoding::Decoder<'_, D>,
540            offset: usize,
541            _depth: fidl::encoding::Depth,
542        ) -> fidl::Result<()> {
543            decoder.debug_check_bounds::<Self>(offset);
544            match decoder.read_num::<u8>(offset) {
545                0 => Ok(()),
546                _ => Err(fidl::Error::Invalid),
547            }
548        }
549    }
550
551    impl fidl::encoding::ValueTypeMarker for NetworksWatchPropertiesResponse {
552        type Borrowed<'a> = &'a Self;
553        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
554            value
555        }
556    }
557
558    unsafe impl fidl::encoding::TypeMarker for NetworksWatchPropertiesResponse {
559        type Owned = Self;
560
561        #[inline(always)]
562        fn inline_align(_context: fidl::encoding::Context) -> usize {
563            8
564        }
565
566        #[inline(always)]
567        fn inline_size(_context: fidl::encoding::Context) -> usize {
568            16
569        }
570    }
571
572    unsafe impl<D: fidl::encoding::ResourceDialect>
573        fidl::encoding::Encode<NetworksWatchPropertiesResponse, D>
574        for &NetworksWatchPropertiesResponse
575    {
576        #[inline]
577        unsafe fn encode(
578            self,
579            encoder: &mut fidl::encoding::Encoder<'_, D>,
580            offset: usize,
581            _depth: fidl::encoding::Depth,
582        ) -> fidl::Result<()> {
583            encoder.debug_check_bounds::<NetworksWatchPropertiesResponse>(offset);
584            // Delegate to tuple encoding.
585            fidl::encoding::Encode::<NetworksWatchPropertiesResponse, D>::encode(
586                (
587                    <fidl::encoding::UnboundedVector<PropertyUpdate> as fidl::encoding::ValueTypeMarker>::borrow(&self.updates),
588                ),
589                encoder, offset, _depth
590            )
591        }
592    }
593    unsafe impl<
594        D: fidl::encoding::ResourceDialect,
595        T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<PropertyUpdate>, D>,
596    > fidl::encoding::Encode<NetworksWatchPropertiesResponse, D> for (T0,)
597    {
598        #[inline]
599        unsafe fn encode(
600            self,
601            encoder: &mut fidl::encoding::Encoder<'_, D>,
602            offset: usize,
603            depth: fidl::encoding::Depth,
604        ) -> fidl::Result<()> {
605            encoder.debug_check_bounds::<NetworksWatchPropertiesResponse>(offset);
606            // Zero out padding regions. There's no need to apply masks
607            // because the unmasked parts will be overwritten by fields.
608            // Write the fields.
609            self.0.encode(encoder, offset + 0, depth)?;
610            Ok(())
611        }
612    }
613
614    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
615        for NetworksWatchPropertiesResponse
616    {
617        #[inline(always)]
618        fn new_empty() -> Self {
619            Self { updates: fidl::new_empty!(fidl::encoding::UnboundedVector<PropertyUpdate>, D) }
620        }
621
622        #[inline]
623        unsafe fn decode(
624            &mut self,
625            decoder: &mut fidl::encoding::Decoder<'_, D>,
626            offset: usize,
627            _depth: fidl::encoding::Depth,
628        ) -> fidl::Result<()> {
629            decoder.debug_check_bounds::<Self>(offset);
630            // Verify that padding bytes are zero.
631            fidl::decode!(
632                fidl::encoding::UnboundedVector<PropertyUpdate>,
633                D,
634                &mut self.updates,
635                decoder,
636                offset + 0,
637                _depth
638            )?;
639            Ok(())
640        }
641    }
642
643    impl DnsConfiguration {
644        #[inline(always)]
645        fn max_ordinal_present(&self) -> u64 {
646            if let Some(_) = self.servers {
647                return 1;
648            }
649            0
650        }
651    }
652
653    impl fidl::encoding::ValueTypeMarker for DnsConfiguration {
654        type Borrowed<'a> = &'a Self;
655        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
656            value
657        }
658    }
659
660    unsafe impl fidl::encoding::TypeMarker for DnsConfiguration {
661        type Owned = Self;
662
663        #[inline(always)]
664        fn inline_align(_context: fidl::encoding::Context) -> usize {
665            8
666        }
667
668        #[inline(always)]
669        fn inline_size(_context: fidl::encoding::Context) -> usize {
670            16
671        }
672    }
673
674    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DnsConfiguration, D>
675        for &DnsConfiguration
676    {
677        unsafe fn encode(
678            self,
679            encoder: &mut fidl::encoding::Encoder<'_, D>,
680            offset: usize,
681            mut depth: fidl::encoding::Depth,
682        ) -> fidl::Result<()> {
683            encoder.debug_check_bounds::<DnsConfiguration>(offset);
684            // Vector header
685            let max_ordinal: u64 = self.max_ordinal_present();
686            encoder.write_num(max_ordinal, offset);
687            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
688            // Calling encoder.out_of_line_offset(0) is not allowed.
689            if max_ordinal == 0 {
690                return Ok(());
691            }
692            depth.increment()?;
693            let envelope_size = 8;
694            let bytes_len = max_ordinal as usize * envelope_size;
695            #[allow(unused_variables)]
696            let offset = encoder.out_of_line_offset(bytes_len);
697            let mut _prev_end_offset: usize = 0;
698            if 1 > max_ordinal {
699                return Ok(());
700            }
701
702            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
703            // are envelope_size bytes.
704            let cur_offset: usize = (1 - 1) * envelope_size;
705
706            // Zero reserved fields.
707            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
708
709            // Safety:
710            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
711            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
712            //   envelope_size bytes, there is always sufficient room.
713            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_net_name__common::DnsServer_>, D>(
714            self.servers.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_net_name__common::DnsServer_> as fidl::encoding::ValueTypeMarker>::borrow),
715            encoder, offset + cur_offset, depth
716        )?;
717
718            _prev_end_offset = cur_offset + envelope_size;
719
720            Ok(())
721        }
722    }
723
724    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DnsConfiguration {
725        #[inline(always)]
726        fn new_empty() -> Self {
727            Self::default()
728        }
729
730        unsafe fn decode(
731            &mut self,
732            decoder: &mut fidl::encoding::Decoder<'_, D>,
733            offset: usize,
734            mut depth: fidl::encoding::Depth,
735        ) -> fidl::Result<()> {
736            decoder.debug_check_bounds::<Self>(offset);
737            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
738                None => return Err(fidl::Error::NotNullable),
739                Some(len) => len,
740            };
741            // Calling decoder.out_of_line_offset(0) is not allowed.
742            if len == 0 {
743                return Ok(());
744            };
745            depth.increment()?;
746            let envelope_size = 8;
747            let bytes_len = len * envelope_size;
748            let offset = decoder.out_of_line_offset(bytes_len)?;
749            // Decode the envelope for each type.
750            let mut _next_ordinal_to_read = 0;
751            let mut next_offset = offset;
752            let end_offset = offset + bytes_len;
753            _next_ordinal_to_read += 1;
754            if next_offset >= end_offset {
755                return Ok(());
756            }
757
758            // Decode unknown envelopes for gaps in ordinals.
759            while _next_ordinal_to_read < 1 {
760                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
761                _next_ordinal_to_read += 1;
762                next_offset += envelope_size;
763            }
764
765            let next_out_of_line = decoder.next_out_of_line();
766            let handles_before = decoder.remaining_handles();
767            if let Some((inlined, num_bytes, num_handles)) =
768                fidl::encoding::decode_envelope_header(decoder, next_offset)?
769            {
770                let member_inline_size = <fidl::encoding::UnboundedVector<
771                    fidl_fuchsia_net_name__common::DnsServer_,
772                > as fidl::encoding::TypeMarker>::inline_size(
773                    decoder.context
774                );
775                if inlined != (member_inline_size <= 4) {
776                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
777                }
778                let inner_offset;
779                let mut inner_depth = depth.clone();
780                if inlined {
781                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
782                    inner_offset = next_offset;
783                } else {
784                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
785                    inner_depth.increment()?;
786                }
787                let val_ref = self.servers.get_or_insert_with(|| {
788                    fidl::new_empty!(
789                        fidl::encoding::UnboundedVector<fidl_fuchsia_net_name__common::DnsServer_>,
790                        D
791                    )
792                });
793                fidl::decode!(
794                    fidl::encoding::UnboundedVector<fidl_fuchsia_net_name__common::DnsServer_>,
795                    D,
796                    val_ref,
797                    decoder,
798                    inner_offset,
799                    inner_depth
800                )?;
801                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
802                {
803                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
804                }
805                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
806                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
807                }
808            }
809
810            next_offset += envelope_size;
811
812            // Decode the remaining unknown envelopes.
813            while next_offset < end_offset {
814                _next_ordinal_to_read += 1;
815                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
816                next_offset += envelope_size;
817            }
818
819            Ok(())
820        }
821    }
822
823    impl fidl::encoding::ValueTypeMarker for PropertyUpdate {
824        type Borrowed<'a> = &'a Self;
825        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
826            value
827        }
828    }
829
830    unsafe impl fidl::encoding::TypeMarker for PropertyUpdate {
831        type Owned = Self;
832
833        #[inline(always)]
834        fn inline_align(_context: fidl::encoding::Context) -> usize {
835            8
836        }
837
838        #[inline(always)]
839        fn inline_size(_context: fidl::encoding::Context) -> usize {
840            16
841        }
842    }
843
844    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PropertyUpdate, D>
845        for &PropertyUpdate
846    {
847        #[inline]
848        unsafe fn encode(
849            self,
850            encoder: &mut fidl::encoding::Encoder<'_, D>,
851            offset: usize,
852            _depth: fidl::encoding::Depth,
853        ) -> fidl::Result<()> {
854            encoder.debug_check_bounds::<PropertyUpdate>(offset);
855            encoder.write_num::<u64>(self.ordinal(), offset);
856            match self {
857                PropertyUpdate::SocketMarks(ref val) => fidl::encoding::encode_in_envelope::<
858                    fidl_fuchsia_net__common::Marks,
859                    D,
860                >(
861                    <fidl_fuchsia_net__common::Marks as fidl::encoding::ValueTypeMarker>::borrow(
862                        val,
863                    ),
864                    encoder,
865                    offset + 8,
866                    _depth,
867                ),
868                PropertyUpdate::DnsConfiguration(ref val) => {
869                    fidl::encoding::encode_in_envelope::<DnsConfiguration, D>(
870                        <DnsConfiguration as fidl::encoding::ValueTypeMarker>::borrow(val),
871                        encoder,
872                        offset + 8,
873                        _depth,
874                    )
875                }
876                PropertyUpdate::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
877            }
878        }
879    }
880
881    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PropertyUpdate {
882        #[inline(always)]
883        fn new_empty() -> Self {
884            Self::__SourceBreaking { unknown_ordinal: 0 }
885        }
886
887        #[inline]
888        unsafe fn decode(
889            &mut self,
890            decoder: &mut fidl::encoding::Decoder<'_, D>,
891            offset: usize,
892            mut depth: fidl::encoding::Depth,
893        ) -> fidl::Result<()> {
894            decoder.debug_check_bounds::<Self>(offset);
895            #[allow(unused_variables)]
896            let next_out_of_line = decoder.next_out_of_line();
897            let handles_before = decoder.remaining_handles();
898            let (ordinal, inlined, num_bytes, num_handles) =
899                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
900
901            let member_inline_size = match ordinal {
902                1 => <fidl_fuchsia_net__common::Marks as fidl::encoding::TypeMarker>::inline_size(
903                    decoder.context,
904                ),
905                2 => <DnsConfiguration as fidl::encoding::TypeMarker>::inline_size(decoder.context),
906                0 => return Err(fidl::Error::UnknownUnionTag),
907                _ => num_bytes as usize,
908            };
909
910            if inlined != (member_inline_size <= 4) {
911                return Err(fidl::Error::InvalidInlineBitInEnvelope);
912            }
913            let _inner_offset;
914            if inlined {
915                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
916                _inner_offset = offset + 8;
917            } else {
918                depth.increment()?;
919                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
920            }
921            match ordinal {
922                1 => {
923                    #[allow(irrefutable_let_patterns)]
924                    if let PropertyUpdate::SocketMarks(_) = self {
925                        // Do nothing, read the value into the object
926                    } else {
927                        // Initialize `self` to the right variant
928                        *self = PropertyUpdate::SocketMarks(fidl::new_empty!(
929                            fidl_fuchsia_net__common::Marks,
930                            D
931                        ));
932                    }
933                    #[allow(irrefutable_let_patterns)]
934                    if let PropertyUpdate::SocketMarks(ref mut val) = self {
935                        fidl::decode!(
936                            fidl_fuchsia_net__common::Marks,
937                            D,
938                            val,
939                            decoder,
940                            _inner_offset,
941                            depth
942                        )?;
943                    } else {
944                        unreachable!()
945                    }
946                }
947                2 => {
948                    #[allow(irrefutable_let_patterns)]
949                    if let PropertyUpdate::DnsConfiguration(_) = self {
950                        // Do nothing, read the value into the object
951                    } else {
952                        // Initialize `self` to the right variant
953                        *self =
954                            PropertyUpdate::DnsConfiguration(fidl::new_empty!(DnsConfiguration, D));
955                    }
956                    #[allow(irrefutable_let_patterns)]
957                    if let PropertyUpdate::DnsConfiguration(ref mut val) = self {
958                        fidl::decode!(DnsConfiguration, D, val, decoder, _inner_offset, depth)?;
959                    } else {
960                        unreachable!()
961                    }
962                }
963                #[allow(deprecated)]
964                ordinal => {
965                    for _ in 0..num_handles {
966                        decoder.drop_next_handle()?;
967                    }
968                    *self = PropertyUpdate::__SourceBreaking { unknown_ordinal: ordinal };
969                }
970            }
971            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
972                return Err(fidl::Error::InvalidNumBytesInEnvelope);
973            }
974            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
975                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
976            }
977            Ok(())
978        }
979    }
980}