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