fidl_fuchsia_net_name__common/
fidl_fuchsia_net_name__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/// Maximum number of addresses that can be returned by a lookup.
12pub const MAX_ADDRESSES: u16 = 1024;
13
14/// Lookup operation errors.
15#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
16#[repr(u32)]
17pub enum LookupError {
18    /// No result was found for this query.
19    NotFound = 1,
20    /// The lookup failed, but may succeed at a later time. For instance, the
21    /// network or DNS server may be unreachable.
22    Transient = 2,
23    /// The lookup failed due to an invalid argument (for instance, the hostname
24    /// was not encoded correctly, or was too long).
25    InvalidArgs = 3,
26    /// The lookup failed due to an internal error.
27    InternalError = 4,
28}
29
30impl LookupError {
31    #[inline]
32    pub fn from_primitive(prim: u32) -> Option<Self> {
33        match prim {
34            1 => Some(Self::NotFound),
35            2 => Some(Self::Transient),
36            3 => Some(Self::InvalidArgs),
37            4 => Some(Self::InternalError),
38            _ => None,
39        }
40    }
41
42    #[inline]
43    pub const fn into_primitive(self) -> u32 {
44        self as u32
45    }
46}
47
48#[derive(Clone, Debug, PartialEq)]
49pub struct DnsServerWatcherWatchServersResponse {
50    pub servers: Vec<DnsServer_>,
51}
52
53impl fidl::Persistable for DnsServerWatcherWatchServersResponse {}
54
55#[derive(Clone, Debug, PartialEq)]
56pub struct LookupAdminGetDnsServersResponse {
57    pub servers: Vec<fidl_fuchsia_net__common::SocketAddress>,
58}
59
60impl fidl::Persistable for LookupAdminGetDnsServersResponse {}
61
62#[derive(Clone, Debug, PartialEq)]
63pub struct LookupAdminSetDnsServersRequest {
64    pub servers: Vec<fidl_fuchsia_net__common::SocketAddress>,
65}
66
67impl fidl::Persistable for LookupAdminSetDnsServersRequest {}
68
69#[derive(Clone, Debug, PartialEq)]
70pub struct LookupLookupHostnameRequest {
71    pub addr: fidl_fuchsia_net__common::IpAddress,
72}
73
74impl fidl::Persistable for LookupLookupHostnameRequest {}
75
76#[derive(Clone, Debug, PartialEq)]
77pub struct LookupLookupIpRequest {
78    /// The hostname to look up.
79    ///
80    /// Must be a valid host domain name; i.e. may not be an IP address in
81    /// dotted-decimal notation.
82    ///
83    /// If it is an Internationalized Domain Name, it must be encoded as per
84    /// RFC 3490.
85    pub hostname: String,
86    pub options: LookupIpOptions,
87}
88
89impl fidl::Persistable for LookupLookupIpRequest {}
90
91#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
92pub struct LookupLookupHostnameResponse {
93    pub hostname: String,
94}
95
96impl fidl::Persistable for LookupLookupHostnameResponse {}
97
98#[derive(Clone, Debug, PartialEq)]
99pub struct LookupLookupIpResponse {
100    pub result: LookupResult,
101}
102
103impl fidl::Persistable for LookupLookupIpResponse {}
104
105#[derive(Clone, Debug, Default, PartialEq)]
106pub struct DhcpDnsServerSource {
107    /// The interface index over which this server was discovered.
108    pub source_interface: Option<u64>,
109    #[doc(hidden)]
110    pub __source_breaking: fidl::marker::SourceBreaking,
111}
112
113impl fidl::Persistable for DhcpDnsServerSource {}
114
115#[derive(Clone, Debug, Default, PartialEq)]
116pub struct Dhcpv6DnsServerSource {
117    /// The interface index over which this server was discovered.
118    pub source_interface: Option<u64>,
119    #[doc(hidden)]
120    pub __source_breaking: fidl::marker::SourceBreaking,
121}
122
123impl fidl::Persistable for Dhcpv6DnsServerSource {}
124
125/// A DNS server configuration.
126#[derive(Clone, Debug, Default, PartialEq)]
127pub struct DnsServer_ {
128    /// The server's address, must be provided.
129    pub address: Option<fidl_fuchsia_net__common::SocketAddress>,
130    /// The configuration source for this server. Defaults to
131    /// [`fuchsia.net.name/DnsServerSource.static_source`].
132    pub source: Option<DnsServerSource>,
133    #[doc(hidden)]
134    pub __source_breaking: fidl::marker::SourceBreaking,
135}
136
137impl fidl::Persistable for DnsServer_ {}
138
139#[derive(Clone, Debug, Default, PartialEq)]
140pub struct LookupIpOptions {
141    /// Include IPv4 results.
142    ///
143    /// If not set, interpreted as false.
144    pub ipv4_lookup: Option<bool>,
145    /// Include IPv6 results.
146    ///
147    /// If not set, interpreted as false.
148    pub ipv6_lookup: Option<bool>,
149    /// Sort addresses in order of preference.
150    ///
151    /// It true, Addresses are sorted according to destination address
152    /// selection described in
153    /// [RFC 6724 Section 6](https://tools.ietf.org/html/rfc6724#section-6).
154    ///
155    /// If not set, interpreted as false.
156    pub sort_addresses: Option<bool>,
157    /// Include the canonical name.
158    ///
159    /// If not set, interpreted as false.
160    pub canonical_name_lookup: Option<bool>,
161    #[doc(hidden)]
162    pub __source_breaking: fidl::marker::SourceBreaking,
163}
164
165impl fidl::Persistable for LookupIpOptions {}
166
167#[derive(Clone, Debug, Default, PartialEq)]
168pub struct LookupResult {
169    /// The IP addresses resulting from a lookup.
170    ///
171    /// If sorting was requested, `addresses` is sorted in order of
172    /// preference, most preferred destination address first.
173    pub addresses: Option<Vec<fidl_fuchsia_net__common::IpAddress>>,
174    /// The canonical name of the requested hostname.
175    ///
176    /// Provided only if requested.
177    pub canonical_name: Option<String>,
178    #[doc(hidden)]
179    pub __source_breaking: fidl::marker::SourceBreaking,
180}
181
182impl fidl::Persistable for LookupResult {}
183
184#[derive(Clone, Debug, Default, PartialEq)]
185pub struct NdpDnsServerSource {
186    /// The interface index over which this server was discovered.
187    pub source_interface: Option<u64>,
188    #[doc(hidden)]
189    pub __source_breaking: fidl::marker::SourceBreaking,
190}
191
192impl fidl::Persistable for NdpDnsServerSource {}
193
194#[derive(Clone, Debug, Default, PartialEq)]
195pub struct SocketProxyDnsServerSource {
196    /// The interface index over which this server was discovered.
197    pub source_interface: Option<u64>,
198    #[doc(hidden)]
199    pub __source_breaking: fidl::marker::SourceBreaking,
200}
201
202impl fidl::Persistable for SocketProxyDnsServerSource {}
203
204#[derive(Clone, Debug, Default, PartialEq)]
205pub struct StaticDnsServerSource {
206    #[doc(hidden)]
207    pub __source_breaking: fidl::marker::SourceBreaking,
208}
209
210impl fidl::Persistable for StaticDnsServerSource {}
211
212#[derive(Clone, Debug)]
213pub enum DnsServerSource {
214    /// The server is statically configured through
215    /// [`fuchsia.net.name/LookupAdmin.SetDefaultServers`].
216    StaticSource(StaticDnsServerSource),
217    /// The server was discovered through DHCPv4.
218    Dhcp(DhcpDnsServerSource),
219    /// The server was discovered through an NDP Router Advertisement.
220    Ndp(NdpDnsServerSource),
221    /// The server was discovered through DHCPv6.
222    Dhcpv6(Dhcpv6DnsServerSource),
223    /// The server was discovered through the socketproxy component, which
224    /// communicates DNS information from networks that are provisioned by
225    /// an agent other than Fuchsia.
226    SocketProxy(SocketProxyDnsServerSource),
227    #[doc(hidden)]
228    __SourceBreaking { unknown_ordinal: u64 },
229}
230
231/// Pattern that matches an unknown `DnsServerSource` member.
232#[macro_export]
233macro_rules! DnsServerSourceUnknown {
234    () => {
235        _
236    };
237}
238
239// Custom PartialEq so that unknown variants are not equal to themselves.
240impl PartialEq for DnsServerSource {
241    fn eq(&self, other: &Self) -> bool {
242        match (self, other) {
243            (Self::StaticSource(x), Self::StaticSource(y)) => *x == *y,
244            (Self::Dhcp(x), Self::Dhcp(y)) => *x == *y,
245            (Self::Ndp(x), Self::Ndp(y)) => *x == *y,
246            (Self::Dhcpv6(x), Self::Dhcpv6(y)) => *x == *y,
247            (Self::SocketProxy(x), Self::SocketProxy(y)) => *x == *y,
248            _ => false,
249        }
250    }
251}
252
253impl DnsServerSource {
254    #[inline]
255    pub fn ordinal(&self) -> u64 {
256        match *self {
257            Self::StaticSource(_) => 1,
258            Self::Dhcp(_) => 2,
259            Self::Ndp(_) => 3,
260            Self::Dhcpv6(_) => 4,
261            Self::SocketProxy(_) => 5,
262            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
263        }
264    }
265
266    #[inline]
267    pub fn unknown_variant_for_testing() -> Self {
268        Self::__SourceBreaking { unknown_ordinal: 0 }
269    }
270
271    #[inline]
272    pub fn is_unknown(&self) -> bool {
273        match self {
274            Self::__SourceBreaking { .. } => true,
275            _ => false,
276        }
277    }
278}
279
280impl fidl::Persistable for DnsServerSource {}
281
282pub mod dns_server_watcher_ordinals {
283    pub const WATCH_SERVERS: u64 = 0x5748907e7f11b632;
284}
285
286pub mod lookup_ordinals {
287    pub const LOOKUP_IP: u64 = 0x59247caf7560c1d0;
288    pub const LOOKUP_HOSTNAME: u64 = 0x1b456b0e84888324;
289}
290
291pub mod lookup_admin_ordinals {
292    pub const SET_DNS_SERVERS: u64 = 0x55e2b9fcc777be96;
293    pub const GET_DNS_SERVERS: u64 = 0x614303bf6e72f80f;
294}
295
296mod internal {
297    use super::*;
298    unsafe impl fidl::encoding::TypeMarker for LookupError {
299        type Owned = Self;
300
301        #[inline(always)]
302        fn inline_align(_context: fidl::encoding::Context) -> usize {
303            std::mem::align_of::<u32>()
304        }
305
306        #[inline(always)]
307        fn inline_size(_context: fidl::encoding::Context) -> usize {
308            std::mem::size_of::<u32>()
309        }
310
311        #[inline(always)]
312        fn encode_is_copy() -> bool {
313            true
314        }
315
316        #[inline(always)]
317        fn decode_is_copy() -> bool {
318            false
319        }
320    }
321
322    impl fidl::encoding::ValueTypeMarker for LookupError {
323        type Borrowed<'a> = Self;
324        #[inline(always)]
325        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
326            *value
327        }
328    }
329
330    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for LookupError {
331        #[inline]
332        unsafe fn encode(
333            self,
334            encoder: &mut fidl::encoding::Encoder<'_, D>,
335            offset: usize,
336            _depth: fidl::encoding::Depth,
337        ) -> fidl::Result<()> {
338            encoder.debug_check_bounds::<Self>(offset);
339            encoder.write_num(self.into_primitive(), offset);
340            Ok(())
341        }
342    }
343
344    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LookupError {
345        #[inline(always)]
346        fn new_empty() -> Self {
347            Self::NotFound
348        }
349
350        #[inline]
351        unsafe fn decode(
352            &mut self,
353            decoder: &mut fidl::encoding::Decoder<'_, D>,
354            offset: usize,
355            _depth: fidl::encoding::Depth,
356        ) -> fidl::Result<()> {
357            decoder.debug_check_bounds::<Self>(offset);
358            let prim = decoder.read_num::<u32>(offset);
359
360            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
361            Ok(())
362        }
363    }
364
365    impl fidl::encoding::ValueTypeMarker for DnsServerWatcherWatchServersResponse {
366        type Borrowed<'a> = &'a Self;
367        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
368            value
369        }
370    }
371
372    unsafe impl fidl::encoding::TypeMarker for DnsServerWatcherWatchServersResponse {
373        type Owned = Self;
374
375        #[inline(always)]
376        fn inline_align(_context: fidl::encoding::Context) -> usize {
377            8
378        }
379
380        #[inline(always)]
381        fn inline_size(_context: fidl::encoding::Context) -> usize {
382            16
383        }
384    }
385
386    unsafe impl<D: fidl::encoding::ResourceDialect>
387        fidl::encoding::Encode<DnsServerWatcherWatchServersResponse, D>
388        for &DnsServerWatcherWatchServersResponse
389    {
390        #[inline]
391        unsafe fn encode(
392            self,
393            encoder: &mut fidl::encoding::Encoder<'_, D>,
394            offset: usize,
395            _depth: fidl::encoding::Depth,
396        ) -> fidl::Result<()> {
397            encoder.debug_check_bounds::<DnsServerWatcherWatchServersResponse>(offset);
398            // Delegate to tuple encoding.
399            fidl::encoding::Encode::<DnsServerWatcherWatchServersResponse, D>::encode(
400                (
401                    <fidl::encoding::UnboundedVector<DnsServer_> as fidl::encoding::ValueTypeMarker>::borrow(&self.servers),
402                ),
403                encoder, offset, _depth
404            )
405        }
406    }
407    unsafe impl<
408            D: fidl::encoding::ResourceDialect,
409            T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<DnsServer_>, D>,
410        > fidl::encoding::Encode<DnsServerWatcherWatchServersResponse, D> for (T0,)
411    {
412        #[inline]
413        unsafe fn encode(
414            self,
415            encoder: &mut fidl::encoding::Encoder<'_, D>,
416            offset: usize,
417            depth: fidl::encoding::Depth,
418        ) -> fidl::Result<()> {
419            encoder.debug_check_bounds::<DnsServerWatcherWatchServersResponse>(offset);
420            // Zero out padding regions. There's no need to apply masks
421            // because the unmasked parts will be overwritten by fields.
422            // Write the fields.
423            self.0.encode(encoder, offset + 0, depth)?;
424            Ok(())
425        }
426    }
427
428    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
429        for DnsServerWatcherWatchServersResponse
430    {
431        #[inline(always)]
432        fn new_empty() -> Self {
433            Self { servers: fidl::new_empty!(fidl::encoding::UnboundedVector<DnsServer_>, D) }
434        }
435
436        #[inline]
437        unsafe fn decode(
438            &mut self,
439            decoder: &mut fidl::encoding::Decoder<'_, D>,
440            offset: usize,
441            _depth: fidl::encoding::Depth,
442        ) -> fidl::Result<()> {
443            decoder.debug_check_bounds::<Self>(offset);
444            // Verify that padding bytes are zero.
445            fidl::decode!(
446                fidl::encoding::UnboundedVector<DnsServer_>,
447                D,
448                &mut self.servers,
449                decoder,
450                offset + 0,
451                _depth
452            )?;
453            Ok(())
454        }
455    }
456
457    impl fidl::encoding::ValueTypeMarker for LookupAdminGetDnsServersResponse {
458        type Borrowed<'a> = &'a Self;
459        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
460            value
461        }
462    }
463
464    unsafe impl fidl::encoding::TypeMarker for LookupAdminGetDnsServersResponse {
465        type Owned = Self;
466
467        #[inline(always)]
468        fn inline_align(_context: fidl::encoding::Context) -> usize {
469            8
470        }
471
472        #[inline(always)]
473        fn inline_size(_context: fidl::encoding::Context) -> usize {
474            16
475        }
476    }
477
478    unsafe impl<D: fidl::encoding::ResourceDialect>
479        fidl::encoding::Encode<LookupAdminGetDnsServersResponse, D>
480        for &LookupAdminGetDnsServersResponse
481    {
482        #[inline]
483        unsafe fn encode(
484            self,
485            encoder: &mut fidl::encoding::Encoder<'_, D>,
486            offset: usize,
487            _depth: fidl::encoding::Depth,
488        ) -> fidl::Result<()> {
489            encoder.debug_check_bounds::<LookupAdminGetDnsServersResponse>(offset);
490            // Delegate to tuple encoding.
491            fidl::encoding::Encode::<LookupAdminGetDnsServersResponse, D>::encode(
492                (
493                    <fidl::encoding::UnboundedVector<fidl_fuchsia_net__common::SocketAddress> as fidl::encoding::ValueTypeMarker>::borrow(&self.servers),
494                ),
495                encoder, offset, _depth
496            )
497        }
498    }
499    unsafe impl<
500            D: fidl::encoding::ResourceDialect,
501            T0: fidl::encoding::Encode<
502                fidl::encoding::UnboundedVector<fidl_fuchsia_net__common::SocketAddress>,
503                D,
504            >,
505        > fidl::encoding::Encode<LookupAdminGetDnsServersResponse, D> for (T0,)
506    {
507        #[inline]
508        unsafe fn encode(
509            self,
510            encoder: &mut fidl::encoding::Encoder<'_, D>,
511            offset: usize,
512            depth: fidl::encoding::Depth,
513        ) -> fidl::Result<()> {
514            encoder.debug_check_bounds::<LookupAdminGetDnsServersResponse>(offset);
515            // Zero out padding regions. There's no need to apply masks
516            // because the unmasked parts will be overwritten by fields.
517            // Write the fields.
518            self.0.encode(encoder, offset + 0, depth)?;
519            Ok(())
520        }
521    }
522
523    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
524        for LookupAdminGetDnsServersResponse
525    {
526        #[inline(always)]
527        fn new_empty() -> Self {
528            Self {
529                servers: fidl::new_empty!(
530                    fidl::encoding::UnboundedVector<fidl_fuchsia_net__common::SocketAddress>,
531                    D
532                ),
533            }
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            // Verify that padding bytes are zero.
545            fidl::decode!(
546                fidl::encoding::UnboundedVector<fidl_fuchsia_net__common::SocketAddress>,
547                D,
548                &mut self.servers,
549                decoder,
550                offset + 0,
551                _depth
552            )?;
553            Ok(())
554        }
555    }
556
557    impl fidl::encoding::ValueTypeMarker for LookupAdminSetDnsServersRequest {
558        type Borrowed<'a> = &'a Self;
559        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
560            value
561        }
562    }
563
564    unsafe impl fidl::encoding::TypeMarker for LookupAdminSetDnsServersRequest {
565        type Owned = Self;
566
567        #[inline(always)]
568        fn inline_align(_context: fidl::encoding::Context) -> usize {
569            8
570        }
571
572        #[inline(always)]
573        fn inline_size(_context: fidl::encoding::Context) -> usize {
574            16
575        }
576    }
577
578    unsafe impl<D: fidl::encoding::ResourceDialect>
579        fidl::encoding::Encode<LookupAdminSetDnsServersRequest, D>
580        for &LookupAdminSetDnsServersRequest
581    {
582        #[inline]
583        unsafe fn encode(
584            self,
585            encoder: &mut fidl::encoding::Encoder<'_, D>,
586            offset: usize,
587            _depth: fidl::encoding::Depth,
588        ) -> fidl::Result<()> {
589            encoder.debug_check_bounds::<LookupAdminSetDnsServersRequest>(offset);
590            // Delegate to tuple encoding.
591            fidl::encoding::Encode::<LookupAdminSetDnsServersRequest, D>::encode(
592                (
593                    <fidl::encoding::UnboundedVector<fidl_fuchsia_net__common::SocketAddress> as fidl::encoding::ValueTypeMarker>::borrow(&self.servers),
594                ),
595                encoder, offset, _depth
596            )
597        }
598    }
599    unsafe impl<
600            D: fidl::encoding::ResourceDialect,
601            T0: fidl::encoding::Encode<
602                fidl::encoding::UnboundedVector<fidl_fuchsia_net__common::SocketAddress>,
603                D,
604            >,
605        > fidl::encoding::Encode<LookupAdminSetDnsServersRequest, D> for (T0,)
606    {
607        #[inline]
608        unsafe fn encode(
609            self,
610            encoder: &mut fidl::encoding::Encoder<'_, D>,
611            offset: usize,
612            depth: fidl::encoding::Depth,
613        ) -> fidl::Result<()> {
614            encoder.debug_check_bounds::<LookupAdminSetDnsServersRequest>(offset);
615            // Zero out padding regions. There's no need to apply masks
616            // because the unmasked parts will be overwritten by fields.
617            // Write the fields.
618            self.0.encode(encoder, offset + 0, depth)?;
619            Ok(())
620        }
621    }
622
623    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
624        for LookupAdminSetDnsServersRequest
625    {
626        #[inline(always)]
627        fn new_empty() -> Self {
628            Self {
629                servers: fidl::new_empty!(
630                    fidl::encoding::UnboundedVector<fidl_fuchsia_net__common::SocketAddress>,
631                    D
632                ),
633            }
634        }
635
636        #[inline]
637        unsafe fn decode(
638            &mut self,
639            decoder: &mut fidl::encoding::Decoder<'_, D>,
640            offset: usize,
641            _depth: fidl::encoding::Depth,
642        ) -> fidl::Result<()> {
643            decoder.debug_check_bounds::<Self>(offset);
644            // Verify that padding bytes are zero.
645            fidl::decode!(
646                fidl::encoding::UnboundedVector<fidl_fuchsia_net__common::SocketAddress>,
647                D,
648                &mut self.servers,
649                decoder,
650                offset + 0,
651                _depth
652            )?;
653            Ok(())
654        }
655    }
656
657    impl fidl::encoding::ValueTypeMarker for LookupLookupHostnameRequest {
658        type Borrowed<'a> = &'a Self;
659        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
660            value
661        }
662    }
663
664    unsafe impl fidl::encoding::TypeMarker for LookupLookupHostnameRequest {
665        type Owned = Self;
666
667        #[inline(always)]
668        fn inline_align(_context: fidl::encoding::Context) -> usize {
669            8
670        }
671
672        #[inline(always)]
673        fn inline_size(_context: fidl::encoding::Context) -> usize {
674            16
675        }
676    }
677
678    unsafe impl<D: fidl::encoding::ResourceDialect>
679        fidl::encoding::Encode<LookupLookupHostnameRequest, D> for &LookupLookupHostnameRequest
680    {
681        #[inline]
682        unsafe fn encode(
683            self,
684            encoder: &mut fidl::encoding::Encoder<'_, D>,
685            offset: usize,
686            _depth: fidl::encoding::Depth,
687        ) -> fidl::Result<()> {
688            encoder.debug_check_bounds::<LookupLookupHostnameRequest>(offset);
689            // Delegate to tuple encoding.
690            fidl::encoding::Encode::<LookupLookupHostnameRequest, D>::encode(
691                (<fidl_fuchsia_net__common::IpAddress as fidl::encoding::ValueTypeMarker>::borrow(
692                    &self.addr,
693                ),),
694                encoder,
695                offset,
696                _depth,
697            )
698        }
699    }
700    unsafe impl<
701            D: fidl::encoding::ResourceDialect,
702            T0: fidl::encoding::Encode<fidl_fuchsia_net__common::IpAddress, D>,
703        > fidl::encoding::Encode<LookupLookupHostnameRequest, D> for (T0,)
704    {
705        #[inline]
706        unsafe fn encode(
707            self,
708            encoder: &mut fidl::encoding::Encoder<'_, D>,
709            offset: usize,
710            depth: fidl::encoding::Depth,
711        ) -> fidl::Result<()> {
712            encoder.debug_check_bounds::<LookupLookupHostnameRequest>(offset);
713            // Zero out padding regions. There's no need to apply masks
714            // because the unmasked parts will be overwritten by fields.
715            // Write the fields.
716            self.0.encode(encoder, offset + 0, depth)?;
717            Ok(())
718        }
719    }
720
721    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
722        for LookupLookupHostnameRequest
723    {
724        #[inline(always)]
725        fn new_empty() -> Self {
726            Self { addr: fidl::new_empty!(fidl_fuchsia_net__common::IpAddress, D) }
727        }
728
729        #[inline]
730        unsafe fn decode(
731            &mut self,
732            decoder: &mut fidl::encoding::Decoder<'_, D>,
733            offset: usize,
734            _depth: fidl::encoding::Depth,
735        ) -> fidl::Result<()> {
736            decoder.debug_check_bounds::<Self>(offset);
737            // Verify that padding bytes are zero.
738            fidl::decode!(
739                fidl_fuchsia_net__common::IpAddress,
740                D,
741                &mut self.addr,
742                decoder,
743                offset + 0,
744                _depth
745            )?;
746            Ok(())
747        }
748    }
749
750    impl fidl::encoding::ValueTypeMarker for LookupLookupIpRequest {
751        type Borrowed<'a> = &'a Self;
752        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
753            value
754        }
755    }
756
757    unsafe impl fidl::encoding::TypeMarker for LookupLookupIpRequest {
758        type Owned = Self;
759
760        #[inline(always)]
761        fn inline_align(_context: fidl::encoding::Context) -> usize {
762            8
763        }
764
765        #[inline(always)]
766        fn inline_size(_context: fidl::encoding::Context) -> usize {
767            32
768        }
769    }
770
771    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LookupLookupIpRequest, D>
772        for &LookupLookupIpRequest
773    {
774        #[inline]
775        unsafe fn encode(
776            self,
777            encoder: &mut fidl::encoding::Encoder<'_, D>,
778            offset: usize,
779            _depth: fidl::encoding::Depth,
780        ) -> fidl::Result<()> {
781            encoder.debug_check_bounds::<LookupLookupIpRequest>(offset);
782            // Delegate to tuple encoding.
783            fidl::encoding::Encode::<LookupLookupIpRequest, D>::encode(
784                (
785                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
786                        &self.hostname,
787                    ),
788                    <LookupIpOptions as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
789                ),
790                encoder,
791                offset,
792                _depth,
793            )
794        }
795    }
796    unsafe impl<
797            D: fidl::encoding::ResourceDialect,
798            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
799            T1: fidl::encoding::Encode<LookupIpOptions, D>,
800        > fidl::encoding::Encode<LookupLookupIpRequest, D> for (T0, T1)
801    {
802        #[inline]
803        unsafe fn encode(
804            self,
805            encoder: &mut fidl::encoding::Encoder<'_, D>,
806            offset: usize,
807            depth: fidl::encoding::Depth,
808        ) -> fidl::Result<()> {
809            encoder.debug_check_bounds::<LookupLookupIpRequest>(offset);
810            // Zero out padding regions. There's no need to apply masks
811            // because the unmasked parts will be overwritten by fields.
812            // Write the fields.
813            self.0.encode(encoder, offset + 0, depth)?;
814            self.1.encode(encoder, offset + 16, depth)?;
815            Ok(())
816        }
817    }
818
819    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LookupLookupIpRequest {
820        #[inline(always)]
821        fn new_empty() -> Self {
822            Self {
823                hostname: fidl::new_empty!(fidl::encoding::BoundedString<255>, D),
824                options: fidl::new_empty!(LookupIpOptions, D),
825            }
826        }
827
828        #[inline]
829        unsafe fn decode(
830            &mut self,
831            decoder: &mut fidl::encoding::Decoder<'_, D>,
832            offset: usize,
833            _depth: fidl::encoding::Depth,
834        ) -> fidl::Result<()> {
835            decoder.debug_check_bounds::<Self>(offset);
836            // Verify that padding bytes are zero.
837            fidl::decode!(
838                fidl::encoding::BoundedString<255>,
839                D,
840                &mut self.hostname,
841                decoder,
842                offset + 0,
843                _depth
844            )?;
845            fidl::decode!(LookupIpOptions, D, &mut self.options, decoder, offset + 16, _depth)?;
846            Ok(())
847        }
848    }
849
850    impl fidl::encoding::ValueTypeMarker for LookupLookupHostnameResponse {
851        type Borrowed<'a> = &'a Self;
852        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
853            value
854        }
855    }
856
857    unsafe impl fidl::encoding::TypeMarker for LookupLookupHostnameResponse {
858        type Owned = Self;
859
860        #[inline(always)]
861        fn inline_align(_context: fidl::encoding::Context) -> usize {
862            8
863        }
864
865        #[inline(always)]
866        fn inline_size(_context: fidl::encoding::Context) -> usize {
867            16
868        }
869    }
870
871    unsafe impl<D: fidl::encoding::ResourceDialect>
872        fidl::encoding::Encode<LookupLookupHostnameResponse, D> for &LookupLookupHostnameResponse
873    {
874        #[inline]
875        unsafe fn encode(
876            self,
877            encoder: &mut fidl::encoding::Encoder<'_, D>,
878            offset: usize,
879            _depth: fidl::encoding::Depth,
880        ) -> fidl::Result<()> {
881            encoder.debug_check_bounds::<LookupLookupHostnameResponse>(offset);
882            // Delegate to tuple encoding.
883            fidl::encoding::Encode::<LookupLookupHostnameResponse, D>::encode(
884                (<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
885                    &self.hostname,
886                ),),
887                encoder,
888                offset,
889                _depth,
890            )
891        }
892    }
893    unsafe impl<
894            D: fidl::encoding::ResourceDialect,
895            T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
896        > fidl::encoding::Encode<LookupLookupHostnameResponse, D> for (T0,)
897    {
898        #[inline]
899        unsafe fn encode(
900            self,
901            encoder: &mut fidl::encoding::Encoder<'_, D>,
902            offset: usize,
903            depth: fidl::encoding::Depth,
904        ) -> fidl::Result<()> {
905            encoder.debug_check_bounds::<LookupLookupHostnameResponse>(offset);
906            // Zero out padding regions. There's no need to apply masks
907            // because the unmasked parts will be overwritten by fields.
908            // Write the fields.
909            self.0.encode(encoder, offset + 0, depth)?;
910            Ok(())
911        }
912    }
913
914    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
915        for LookupLookupHostnameResponse
916    {
917        #[inline(always)]
918        fn new_empty() -> Self {
919            Self { hostname: fidl::new_empty!(fidl::encoding::BoundedString<255>, D) }
920        }
921
922        #[inline]
923        unsafe fn decode(
924            &mut self,
925            decoder: &mut fidl::encoding::Decoder<'_, D>,
926            offset: usize,
927            _depth: fidl::encoding::Depth,
928        ) -> fidl::Result<()> {
929            decoder.debug_check_bounds::<Self>(offset);
930            // Verify that padding bytes are zero.
931            fidl::decode!(
932                fidl::encoding::BoundedString<255>,
933                D,
934                &mut self.hostname,
935                decoder,
936                offset + 0,
937                _depth
938            )?;
939            Ok(())
940        }
941    }
942
943    impl fidl::encoding::ValueTypeMarker for LookupLookupIpResponse {
944        type Borrowed<'a> = &'a Self;
945        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
946            value
947        }
948    }
949
950    unsafe impl fidl::encoding::TypeMarker for LookupLookupIpResponse {
951        type Owned = Self;
952
953        #[inline(always)]
954        fn inline_align(_context: fidl::encoding::Context) -> usize {
955            8
956        }
957
958        #[inline(always)]
959        fn inline_size(_context: fidl::encoding::Context) -> usize {
960            16
961        }
962    }
963
964    unsafe impl<D: fidl::encoding::ResourceDialect>
965        fidl::encoding::Encode<LookupLookupIpResponse, D> for &LookupLookupIpResponse
966    {
967        #[inline]
968        unsafe fn encode(
969            self,
970            encoder: &mut fidl::encoding::Encoder<'_, D>,
971            offset: usize,
972            _depth: fidl::encoding::Depth,
973        ) -> fidl::Result<()> {
974            encoder.debug_check_bounds::<LookupLookupIpResponse>(offset);
975            // Delegate to tuple encoding.
976            fidl::encoding::Encode::<LookupLookupIpResponse, D>::encode(
977                (<LookupResult as fidl::encoding::ValueTypeMarker>::borrow(&self.result),),
978                encoder,
979                offset,
980                _depth,
981            )
982        }
983    }
984    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<LookupResult, D>>
985        fidl::encoding::Encode<LookupLookupIpResponse, D> for (T0,)
986    {
987        #[inline]
988        unsafe fn encode(
989            self,
990            encoder: &mut fidl::encoding::Encoder<'_, D>,
991            offset: usize,
992            depth: fidl::encoding::Depth,
993        ) -> fidl::Result<()> {
994            encoder.debug_check_bounds::<LookupLookupIpResponse>(offset);
995            // Zero out padding regions. There's no need to apply masks
996            // because the unmasked parts will be overwritten by fields.
997            // Write the fields.
998            self.0.encode(encoder, offset + 0, depth)?;
999            Ok(())
1000        }
1001    }
1002
1003    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1004        for LookupLookupIpResponse
1005    {
1006        #[inline(always)]
1007        fn new_empty() -> Self {
1008            Self { result: fidl::new_empty!(LookupResult, D) }
1009        }
1010
1011        #[inline]
1012        unsafe fn decode(
1013            &mut self,
1014            decoder: &mut fidl::encoding::Decoder<'_, D>,
1015            offset: usize,
1016            _depth: fidl::encoding::Depth,
1017        ) -> fidl::Result<()> {
1018            decoder.debug_check_bounds::<Self>(offset);
1019            // Verify that padding bytes are zero.
1020            fidl::decode!(LookupResult, D, &mut self.result, decoder, offset + 0, _depth)?;
1021            Ok(())
1022        }
1023    }
1024
1025    impl DhcpDnsServerSource {
1026        #[inline(always)]
1027        fn max_ordinal_present(&self) -> u64 {
1028            if let Some(_) = self.source_interface {
1029                return 1;
1030            }
1031            0
1032        }
1033    }
1034
1035    impl fidl::encoding::ValueTypeMarker for DhcpDnsServerSource {
1036        type Borrowed<'a> = &'a Self;
1037        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1038            value
1039        }
1040    }
1041
1042    unsafe impl fidl::encoding::TypeMarker for DhcpDnsServerSource {
1043        type Owned = Self;
1044
1045        #[inline(always)]
1046        fn inline_align(_context: fidl::encoding::Context) -> usize {
1047            8
1048        }
1049
1050        #[inline(always)]
1051        fn inline_size(_context: fidl::encoding::Context) -> usize {
1052            16
1053        }
1054    }
1055
1056    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DhcpDnsServerSource, D>
1057        for &DhcpDnsServerSource
1058    {
1059        unsafe fn encode(
1060            self,
1061            encoder: &mut fidl::encoding::Encoder<'_, D>,
1062            offset: usize,
1063            mut depth: fidl::encoding::Depth,
1064        ) -> fidl::Result<()> {
1065            encoder.debug_check_bounds::<DhcpDnsServerSource>(offset);
1066            // Vector header
1067            let max_ordinal: u64 = self.max_ordinal_present();
1068            encoder.write_num(max_ordinal, offset);
1069            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1070            // Calling encoder.out_of_line_offset(0) is not allowed.
1071            if max_ordinal == 0 {
1072                return Ok(());
1073            }
1074            depth.increment()?;
1075            let envelope_size = 8;
1076            let bytes_len = max_ordinal as usize * envelope_size;
1077            #[allow(unused_variables)]
1078            let offset = encoder.out_of_line_offset(bytes_len);
1079            let mut _prev_end_offset: usize = 0;
1080            if 1 > max_ordinal {
1081                return Ok(());
1082            }
1083
1084            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1085            // are envelope_size bytes.
1086            let cur_offset: usize = (1 - 1) * envelope_size;
1087
1088            // Zero reserved fields.
1089            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1090
1091            // Safety:
1092            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1093            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1094            //   envelope_size bytes, there is always sufficient room.
1095            fidl::encoding::encode_in_envelope_optional::<u64, D>(
1096                self.source_interface
1097                    .as_ref()
1098                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1099                encoder,
1100                offset + cur_offset,
1101                depth,
1102            )?;
1103
1104            _prev_end_offset = cur_offset + envelope_size;
1105
1106            Ok(())
1107        }
1108    }
1109
1110    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DhcpDnsServerSource {
1111        #[inline(always)]
1112        fn new_empty() -> Self {
1113            Self::default()
1114        }
1115
1116        unsafe fn decode(
1117            &mut self,
1118            decoder: &mut fidl::encoding::Decoder<'_, D>,
1119            offset: usize,
1120            mut depth: fidl::encoding::Depth,
1121        ) -> fidl::Result<()> {
1122            decoder.debug_check_bounds::<Self>(offset);
1123            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1124                None => return Err(fidl::Error::NotNullable),
1125                Some(len) => len,
1126            };
1127            // Calling decoder.out_of_line_offset(0) is not allowed.
1128            if len == 0 {
1129                return Ok(());
1130            };
1131            depth.increment()?;
1132            let envelope_size = 8;
1133            let bytes_len = len * envelope_size;
1134            let offset = decoder.out_of_line_offset(bytes_len)?;
1135            // Decode the envelope for each type.
1136            let mut _next_ordinal_to_read = 0;
1137            let mut next_offset = offset;
1138            let end_offset = offset + bytes_len;
1139            _next_ordinal_to_read += 1;
1140            if next_offset >= end_offset {
1141                return Ok(());
1142            }
1143
1144            // Decode unknown envelopes for gaps in ordinals.
1145            while _next_ordinal_to_read < 1 {
1146                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1147                _next_ordinal_to_read += 1;
1148                next_offset += envelope_size;
1149            }
1150
1151            let next_out_of_line = decoder.next_out_of_line();
1152            let handles_before = decoder.remaining_handles();
1153            if let Some((inlined, num_bytes, num_handles)) =
1154                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1155            {
1156                let member_inline_size =
1157                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1158                if inlined != (member_inline_size <= 4) {
1159                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1160                }
1161                let inner_offset;
1162                let mut inner_depth = depth.clone();
1163                if inlined {
1164                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1165                    inner_offset = next_offset;
1166                } else {
1167                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1168                    inner_depth.increment()?;
1169                }
1170                let val_ref = self.source_interface.get_or_insert_with(|| fidl::new_empty!(u64, D));
1171                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
1172                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1173                {
1174                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1175                }
1176                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1177                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1178                }
1179            }
1180
1181            next_offset += envelope_size;
1182
1183            // Decode the remaining unknown envelopes.
1184            while next_offset < end_offset {
1185                _next_ordinal_to_read += 1;
1186                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1187                next_offset += envelope_size;
1188            }
1189
1190            Ok(())
1191        }
1192    }
1193
1194    impl Dhcpv6DnsServerSource {
1195        #[inline(always)]
1196        fn max_ordinal_present(&self) -> u64 {
1197            if let Some(_) = self.source_interface {
1198                return 1;
1199            }
1200            0
1201        }
1202    }
1203
1204    impl fidl::encoding::ValueTypeMarker for Dhcpv6DnsServerSource {
1205        type Borrowed<'a> = &'a Self;
1206        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1207            value
1208        }
1209    }
1210
1211    unsafe impl fidl::encoding::TypeMarker for Dhcpv6DnsServerSource {
1212        type Owned = Self;
1213
1214        #[inline(always)]
1215        fn inline_align(_context: fidl::encoding::Context) -> usize {
1216            8
1217        }
1218
1219        #[inline(always)]
1220        fn inline_size(_context: fidl::encoding::Context) -> usize {
1221            16
1222        }
1223    }
1224
1225    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Dhcpv6DnsServerSource, D>
1226        for &Dhcpv6DnsServerSource
1227    {
1228        unsafe fn encode(
1229            self,
1230            encoder: &mut fidl::encoding::Encoder<'_, D>,
1231            offset: usize,
1232            mut depth: fidl::encoding::Depth,
1233        ) -> fidl::Result<()> {
1234            encoder.debug_check_bounds::<Dhcpv6DnsServerSource>(offset);
1235            // Vector header
1236            let max_ordinal: u64 = self.max_ordinal_present();
1237            encoder.write_num(max_ordinal, offset);
1238            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1239            // Calling encoder.out_of_line_offset(0) is not allowed.
1240            if max_ordinal == 0 {
1241                return Ok(());
1242            }
1243            depth.increment()?;
1244            let envelope_size = 8;
1245            let bytes_len = max_ordinal as usize * envelope_size;
1246            #[allow(unused_variables)]
1247            let offset = encoder.out_of_line_offset(bytes_len);
1248            let mut _prev_end_offset: usize = 0;
1249            if 1 > max_ordinal {
1250                return Ok(());
1251            }
1252
1253            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1254            // are envelope_size bytes.
1255            let cur_offset: usize = (1 - 1) * envelope_size;
1256
1257            // Zero reserved fields.
1258            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1259
1260            // Safety:
1261            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1262            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1263            //   envelope_size bytes, there is always sufficient room.
1264            fidl::encoding::encode_in_envelope_optional::<u64, D>(
1265                self.source_interface
1266                    .as_ref()
1267                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1268                encoder,
1269                offset + cur_offset,
1270                depth,
1271            )?;
1272
1273            _prev_end_offset = cur_offset + envelope_size;
1274
1275            Ok(())
1276        }
1277    }
1278
1279    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Dhcpv6DnsServerSource {
1280        #[inline(always)]
1281        fn new_empty() -> Self {
1282            Self::default()
1283        }
1284
1285        unsafe fn decode(
1286            &mut self,
1287            decoder: &mut fidl::encoding::Decoder<'_, D>,
1288            offset: usize,
1289            mut depth: fidl::encoding::Depth,
1290        ) -> fidl::Result<()> {
1291            decoder.debug_check_bounds::<Self>(offset);
1292            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1293                None => return Err(fidl::Error::NotNullable),
1294                Some(len) => len,
1295            };
1296            // Calling decoder.out_of_line_offset(0) is not allowed.
1297            if len == 0 {
1298                return Ok(());
1299            };
1300            depth.increment()?;
1301            let envelope_size = 8;
1302            let bytes_len = len * envelope_size;
1303            let offset = decoder.out_of_line_offset(bytes_len)?;
1304            // Decode the envelope for each type.
1305            let mut _next_ordinal_to_read = 0;
1306            let mut next_offset = offset;
1307            let end_offset = offset + bytes_len;
1308            _next_ordinal_to_read += 1;
1309            if next_offset >= end_offset {
1310                return Ok(());
1311            }
1312
1313            // Decode unknown envelopes for gaps in ordinals.
1314            while _next_ordinal_to_read < 1 {
1315                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1316                _next_ordinal_to_read += 1;
1317                next_offset += envelope_size;
1318            }
1319
1320            let next_out_of_line = decoder.next_out_of_line();
1321            let handles_before = decoder.remaining_handles();
1322            if let Some((inlined, num_bytes, num_handles)) =
1323                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1324            {
1325                let member_inline_size =
1326                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1327                if inlined != (member_inline_size <= 4) {
1328                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1329                }
1330                let inner_offset;
1331                let mut inner_depth = depth.clone();
1332                if inlined {
1333                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1334                    inner_offset = next_offset;
1335                } else {
1336                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1337                    inner_depth.increment()?;
1338                }
1339                let val_ref = self.source_interface.get_or_insert_with(|| fidl::new_empty!(u64, D));
1340                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
1341                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1342                {
1343                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1344                }
1345                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1346                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1347                }
1348            }
1349
1350            next_offset += envelope_size;
1351
1352            // Decode the remaining unknown envelopes.
1353            while next_offset < end_offset {
1354                _next_ordinal_to_read += 1;
1355                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1356                next_offset += envelope_size;
1357            }
1358
1359            Ok(())
1360        }
1361    }
1362
1363    impl DnsServer_ {
1364        #[inline(always)]
1365        fn max_ordinal_present(&self) -> u64 {
1366            if let Some(_) = self.source {
1367                return 2;
1368            }
1369            if let Some(_) = self.address {
1370                return 1;
1371            }
1372            0
1373        }
1374    }
1375
1376    impl fidl::encoding::ValueTypeMarker for DnsServer_ {
1377        type Borrowed<'a> = &'a Self;
1378        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1379            value
1380        }
1381    }
1382
1383    unsafe impl fidl::encoding::TypeMarker for DnsServer_ {
1384        type Owned = Self;
1385
1386        #[inline(always)]
1387        fn inline_align(_context: fidl::encoding::Context) -> usize {
1388            8
1389        }
1390
1391        #[inline(always)]
1392        fn inline_size(_context: fidl::encoding::Context) -> usize {
1393            16
1394        }
1395    }
1396
1397    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DnsServer_, D>
1398        for &DnsServer_
1399    {
1400        unsafe fn encode(
1401            self,
1402            encoder: &mut fidl::encoding::Encoder<'_, D>,
1403            offset: usize,
1404            mut depth: fidl::encoding::Depth,
1405        ) -> fidl::Result<()> {
1406            encoder.debug_check_bounds::<DnsServer_>(offset);
1407            // Vector header
1408            let max_ordinal: u64 = self.max_ordinal_present();
1409            encoder.write_num(max_ordinal, offset);
1410            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1411            // Calling encoder.out_of_line_offset(0) is not allowed.
1412            if max_ordinal == 0 {
1413                return Ok(());
1414            }
1415            depth.increment()?;
1416            let envelope_size = 8;
1417            let bytes_len = max_ordinal as usize * envelope_size;
1418            #[allow(unused_variables)]
1419            let offset = encoder.out_of_line_offset(bytes_len);
1420            let mut _prev_end_offset: usize = 0;
1421            if 1 > max_ordinal {
1422                return Ok(());
1423            }
1424
1425            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1426            // are envelope_size bytes.
1427            let cur_offset: usize = (1 - 1) * envelope_size;
1428
1429            // Zero reserved fields.
1430            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1431
1432            // Safety:
1433            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1434            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1435            //   envelope_size bytes, there is always sufficient room.
1436            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net__common::SocketAddress, D>(
1437            self.address.as_ref().map(<fidl_fuchsia_net__common::SocketAddress as fidl::encoding::ValueTypeMarker>::borrow),
1438            encoder, offset + cur_offset, depth
1439        )?;
1440
1441            _prev_end_offset = cur_offset + envelope_size;
1442            if 2 > max_ordinal {
1443                return Ok(());
1444            }
1445
1446            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1447            // are envelope_size bytes.
1448            let cur_offset: usize = (2 - 1) * envelope_size;
1449
1450            // Zero reserved fields.
1451            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1452
1453            // Safety:
1454            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1455            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1456            //   envelope_size bytes, there is always sufficient room.
1457            fidl::encoding::encode_in_envelope_optional::<DnsServerSource, D>(
1458                self.source
1459                    .as_ref()
1460                    .map(<DnsServerSource as fidl::encoding::ValueTypeMarker>::borrow),
1461                encoder,
1462                offset + cur_offset,
1463                depth,
1464            )?;
1465
1466            _prev_end_offset = cur_offset + envelope_size;
1467
1468            Ok(())
1469        }
1470    }
1471
1472    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DnsServer_ {
1473        #[inline(always)]
1474        fn new_empty() -> Self {
1475            Self::default()
1476        }
1477
1478        unsafe fn decode(
1479            &mut self,
1480            decoder: &mut fidl::encoding::Decoder<'_, D>,
1481            offset: usize,
1482            mut depth: fidl::encoding::Depth,
1483        ) -> fidl::Result<()> {
1484            decoder.debug_check_bounds::<Self>(offset);
1485            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1486                None => return Err(fidl::Error::NotNullable),
1487                Some(len) => len,
1488            };
1489            // Calling decoder.out_of_line_offset(0) is not allowed.
1490            if len == 0 {
1491                return Ok(());
1492            };
1493            depth.increment()?;
1494            let envelope_size = 8;
1495            let bytes_len = len * envelope_size;
1496            let offset = decoder.out_of_line_offset(bytes_len)?;
1497            // Decode the envelope for each type.
1498            let mut _next_ordinal_to_read = 0;
1499            let mut next_offset = offset;
1500            let end_offset = offset + bytes_len;
1501            _next_ordinal_to_read += 1;
1502            if next_offset >= end_offset {
1503                return Ok(());
1504            }
1505
1506            // Decode unknown envelopes for gaps in ordinals.
1507            while _next_ordinal_to_read < 1 {
1508                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1509                _next_ordinal_to_read += 1;
1510                next_offset += envelope_size;
1511            }
1512
1513            let next_out_of_line = decoder.next_out_of_line();
1514            let handles_before = decoder.remaining_handles();
1515            if let Some((inlined, num_bytes, num_handles)) =
1516                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1517            {
1518                let member_inline_size = <fidl_fuchsia_net__common::SocketAddress as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1519                if inlined != (member_inline_size <= 4) {
1520                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1521                }
1522                let inner_offset;
1523                let mut inner_depth = depth.clone();
1524                if inlined {
1525                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1526                    inner_offset = next_offset;
1527                } else {
1528                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1529                    inner_depth.increment()?;
1530                }
1531                let val_ref = self.address.get_or_insert_with(|| {
1532                    fidl::new_empty!(fidl_fuchsia_net__common::SocketAddress, D)
1533                });
1534                fidl::decode!(
1535                    fidl_fuchsia_net__common::SocketAddress,
1536                    D,
1537                    val_ref,
1538                    decoder,
1539                    inner_offset,
1540                    inner_depth
1541                )?;
1542                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1543                {
1544                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1545                }
1546                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1547                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1548                }
1549            }
1550
1551            next_offset += envelope_size;
1552            _next_ordinal_to_read += 1;
1553            if next_offset >= end_offset {
1554                return Ok(());
1555            }
1556
1557            // Decode unknown envelopes for gaps in ordinals.
1558            while _next_ordinal_to_read < 2 {
1559                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1560                _next_ordinal_to_read += 1;
1561                next_offset += envelope_size;
1562            }
1563
1564            let next_out_of_line = decoder.next_out_of_line();
1565            let handles_before = decoder.remaining_handles();
1566            if let Some((inlined, num_bytes, num_handles)) =
1567                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1568            {
1569                let member_inline_size =
1570                    <DnsServerSource as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1571                if inlined != (member_inline_size <= 4) {
1572                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1573                }
1574                let inner_offset;
1575                let mut inner_depth = depth.clone();
1576                if inlined {
1577                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1578                    inner_offset = next_offset;
1579                } else {
1580                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1581                    inner_depth.increment()?;
1582                }
1583                let val_ref =
1584                    self.source.get_or_insert_with(|| fidl::new_empty!(DnsServerSource, D));
1585                fidl::decode!(DnsServerSource, D, val_ref, decoder, inner_offset, inner_depth)?;
1586                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1587                {
1588                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1589                }
1590                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1591                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1592                }
1593            }
1594
1595            next_offset += envelope_size;
1596
1597            // Decode the remaining unknown envelopes.
1598            while next_offset < end_offset {
1599                _next_ordinal_to_read += 1;
1600                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1601                next_offset += envelope_size;
1602            }
1603
1604            Ok(())
1605        }
1606    }
1607
1608    impl LookupIpOptions {
1609        #[inline(always)]
1610        fn max_ordinal_present(&self) -> u64 {
1611            if let Some(_) = self.canonical_name_lookup {
1612                return 4;
1613            }
1614            if let Some(_) = self.sort_addresses {
1615                return 3;
1616            }
1617            if let Some(_) = self.ipv6_lookup {
1618                return 2;
1619            }
1620            if let Some(_) = self.ipv4_lookup {
1621                return 1;
1622            }
1623            0
1624        }
1625    }
1626
1627    impl fidl::encoding::ValueTypeMarker for LookupIpOptions {
1628        type Borrowed<'a> = &'a Self;
1629        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1630            value
1631        }
1632    }
1633
1634    unsafe impl fidl::encoding::TypeMarker for LookupIpOptions {
1635        type Owned = Self;
1636
1637        #[inline(always)]
1638        fn inline_align(_context: fidl::encoding::Context) -> usize {
1639            8
1640        }
1641
1642        #[inline(always)]
1643        fn inline_size(_context: fidl::encoding::Context) -> usize {
1644            16
1645        }
1646    }
1647
1648    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LookupIpOptions, D>
1649        for &LookupIpOptions
1650    {
1651        unsafe fn encode(
1652            self,
1653            encoder: &mut fidl::encoding::Encoder<'_, D>,
1654            offset: usize,
1655            mut depth: fidl::encoding::Depth,
1656        ) -> fidl::Result<()> {
1657            encoder.debug_check_bounds::<LookupIpOptions>(offset);
1658            // Vector header
1659            let max_ordinal: u64 = self.max_ordinal_present();
1660            encoder.write_num(max_ordinal, offset);
1661            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1662            // Calling encoder.out_of_line_offset(0) is not allowed.
1663            if max_ordinal == 0 {
1664                return Ok(());
1665            }
1666            depth.increment()?;
1667            let envelope_size = 8;
1668            let bytes_len = max_ordinal as usize * envelope_size;
1669            #[allow(unused_variables)]
1670            let offset = encoder.out_of_line_offset(bytes_len);
1671            let mut _prev_end_offset: usize = 0;
1672            if 1 > max_ordinal {
1673                return Ok(());
1674            }
1675
1676            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1677            // are envelope_size bytes.
1678            let cur_offset: usize = (1 - 1) * envelope_size;
1679
1680            // Zero reserved fields.
1681            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1682
1683            // Safety:
1684            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1685            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1686            //   envelope_size bytes, there is always sufficient room.
1687            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1688                self.ipv4_lookup.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1689                encoder,
1690                offset + cur_offset,
1691                depth,
1692            )?;
1693
1694            _prev_end_offset = cur_offset + envelope_size;
1695            if 2 > max_ordinal {
1696                return Ok(());
1697            }
1698
1699            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1700            // are envelope_size bytes.
1701            let cur_offset: usize = (2 - 1) * envelope_size;
1702
1703            // Zero reserved fields.
1704            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1705
1706            // Safety:
1707            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1708            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1709            //   envelope_size bytes, there is always sufficient room.
1710            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1711                self.ipv6_lookup.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1712                encoder,
1713                offset + cur_offset,
1714                depth,
1715            )?;
1716
1717            _prev_end_offset = cur_offset + envelope_size;
1718            if 3 > max_ordinal {
1719                return Ok(());
1720            }
1721
1722            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1723            // are envelope_size bytes.
1724            let cur_offset: usize = (3 - 1) * envelope_size;
1725
1726            // Zero reserved fields.
1727            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1728
1729            // Safety:
1730            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1731            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1732            //   envelope_size bytes, there is always sufficient room.
1733            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1734                self.sort_addresses.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1735                encoder,
1736                offset + cur_offset,
1737                depth,
1738            )?;
1739
1740            _prev_end_offset = cur_offset + envelope_size;
1741            if 4 > max_ordinal {
1742                return Ok(());
1743            }
1744
1745            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1746            // are envelope_size bytes.
1747            let cur_offset: usize = (4 - 1) * envelope_size;
1748
1749            // Zero reserved fields.
1750            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1751
1752            // Safety:
1753            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1754            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1755            //   envelope_size bytes, there is always sufficient room.
1756            fidl::encoding::encode_in_envelope_optional::<bool, D>(
1757                self.canonical_name_lookup
1758                    .as_ref()
1759                    .map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
1760                encoder,
1761                offset + cur_offset,
1762                depth,
1763            )?;
1764
1765            _prev_end_offset = cur_offset + envelope_size;
1766
1767            Ok(())
1768        }
1769    }
1770
1771    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LookupIpOptions {
1772        #[inline(always)]
1773        fn new_empty() -> Self {
1774            Self::default()
1775        }
1776
1777        unsafe fn decode(
1778            &mut self,
1779            decoder: &mut fidl::encoding::Decoder<'_, D>,
1780            offset: usize,
1781            mut depth: fidl::encoding::Depth,
1782        ) -> fidl::Result<()> {
1783            decoder.debug_check_bounds::<Self>(offset);
1784            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1785                None => return Err(fidl::Error::NotNullable),
1786                Some(len) => len,
1787            };
1788            // Calling decoder.out_of_line_offset(0) is not allowed.
1789            if len == 0 {
1790                return Ok(());
1791            };
1792            depth.increment()?;
1793            let envelope_size = 8;
1794            let bytes_len = len * envelope_size;
1795            let offset = decoder.out_of_line_offset(bytes_len)?;
1796            // Decode the envelope for each type.
1797            let mut _next_ordinal_to_read = 0;
1798            let mut next_offset = offset;
1799            let end_offset = offset + bytes_len;
1800            _next_ordinal_to_read += 1;
1801            if next_offset >= end_offset {
1802                return Ok(());
1803            }
1804
1805            // Decode unknown envelopes for gaps in ordinals.
1806            while _next_ordinal_to_read < 1 {
1807                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1808                _next_ordinal_to_read += 1;
1809                next_offset += envelope_size;
1810            }
1811
1812            let next_out_of_line = decoder.next_out_of_line();
1813            let handles_before = decoder.remaining_handles();
1814            if let Some((inlined, num_bytes, num_handles)) =
1815                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1816            {
1817                let member_inline_size =
1818                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1819                if inlined != (member_inline_size <= 4) {
1820                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1821                }
1822                let inner_offset;
1823                let mut inner_depth = depth.clone();
1824                if inlined {
1825                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1826                    inner_offset = next_offset;
1827                } else {
1828                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1829                    inner_depth.increment()?;
1830                }
1831                let val_ref = self.ipv4_lookup.get_or_insert_with(|| fidl::new_empty!(bool, D));
1832                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1833                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1834                {
1835                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1836                }
1837                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1838                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1839                }
1840            }
1841
1842            next_offset += envelope_size;
1843            _next_ordinal_to_read += 1;
1844            if next_offset >= end_offset {
1845                return Ok(());
1846            }
1847
1848            // Decode unknown envelopes for gaps in ordinals.
1849            while _next_ordinal_to_read < 2 {
1850                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1851                _next_ordinal_to_read += 1;
1852                next_offset += envelope_size;
1853            }
1854
1855            let next_out_of_line = decoder.next_out_of_line();
1856            let handles_before = decoder.remaining_handles();
1857            if let Some((inlined, num_bytes, num_handles)) =
1858                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1859            {
1860                let member_inline_size =
1861                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1862                if inlined != (member_inline_size <= 4) {
1863                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1864                }
1865                let inner_offset;
1866                let mut inner_depth = depth.clone();
1867                if inlined {
1868                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1869                    inner_offset = next_offset;
1870                } else {
1871                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1872                    inner_depth.increment()?;
1873                }
1874                let val_ref = self.ipv6_lookup.get_or_insert_with(|| fidl::new_empty!(bool, D));
1875                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1876                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1877                {
1878                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1879                }
1880                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1881                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1882                }
1883            }
1884
1885            next_offset += envelope_size;
1886            _next_ordinal_to_read += 1;
1887            if next_offset >= end_offset {
1888                return Ok(());
1889            }
1890
1891            // Decode unknown envelopes for gaps in ordinals.
1892            while _next_ordinal_to_read < 3 {
1893                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1894                _next_ordinal_to_read += 1;
1895                next_offset += envelope_size;
1896            }
1897
1898            let next_out_of_line = decoder.next_out_of_line();
1899            let handles_before = decoder.remaining_handles();
1900            if let Some((inlined, num_bytes, num_handles)) =
1901                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1902            {
1903                let member_inline_size =
1904                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1905                if inlined != (member_inline_size <= 4) {
1906                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1907                }
1908                let inner_offset;
1909                let mut inner_depth = depth.clone();
1910                if inlined {
1911                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1912                    inner_offset = next_offset;
1913                } else {
1914                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1915                    inner_depth.increment()?;
1916                }
1917                let val_ref = self.sort_addresses.get_or_insert_with(|| fidl::new_empty!(bool, D));
1918                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1919                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1920                {
1921                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1922                }
1923                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1924                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1925                }
1926            }
1927
1928            next_offset += envelope_size;
1929            _next_ordinal_to_read += 1;
1930            if next_offset >= end_offset {
1931                return Ok(());
1932            }
1933
1934            // Decode unknown envelopes for gaps in ordinals.
1935            while _next_ordinal_to_read < 4 {
1936                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1937                _next_ordinal_to_read += 1;
1938                next_offset += envelope_size;
1939            }
1940
1941            let next_out_of_line = decoder.next_out_of_line();
1942            let handles_before = decoder.remaining_handles();
1943            if let Some((inlined, num_bytes, num_handles)) =
1944                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1945            {
1946                let member_inline_size =
1947                    <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1948                if inlined != (member_inline_size <= 4) {
1949                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1950                }
1951                let inner_offset;
1952                let mut inner_depth = depth.clone();
1953                if inlined {
1954                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1955                    inner_offset = next_offset;
1956                } else {
1957                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1958                    inner_depth.increment()?;
1959                }
1960                let val_ref =
1961                    self.canonical_name_lookup.get_or_insert_with(|| fidl::new_empty!(bool, D));
1962                fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
1963                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1964                {
1965                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1966                }
1967                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1968                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1969                }
1970            }
1971
1972            next_offset += envelope_size;
1973
1974            // Decode the remaining unknown envelopes.
1975            while next_offset < end_offset {
1976                _next_ordinal_to_read += 1;
1977                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1978                next_offset += envelope_size;
1979            }
1980
1981            Ok(())
1982        }
1983    }
1984
1985    impl LookupResult {
1986        #[inline(always)]
1987        fn max_ordinal_present(&self) -> u64 {
1988            if let Some(_) = self.canonical_name {
1989                return 2;
1990            }
1991            if let Some(_) = self.addresses {
1992                return 1;
1993            }
1994            0
1995        }
1996    }
1997
1998    impl fidl::encoding::ValueTypeMarker for LookupResult {
1999        type Borrowed<'a> = &'a Self;
2000        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2001            value
2002        }
2003    }
2004
2005    unsafe impl fidl::encoding::TypeMarker for LookupResult {
2006        type Owned = Self;
2007
2008        #[inline(always)]
2009        fn inline_align(_context: fidl::encoding::Context) -> usize {
2010            8
2011        }
2012
2013        #[inline(always)]
2014        fn inline_size(_context: fidl::encoding::Context) -> usize {
2015            16
2016        }
2017    }
2018
2019    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LookupResult, D>
2020        for &LookupResult
2021    {
2022        unsafe fn encode(
2023            self,
2024            encoder: &mut fidl::encoding::Encoder<'_, D>,
2025            offset: usize,
2026            mut depth: fidl::encoding::Depth,
2027        ) -> fidl::Result<()> {
2028            encoder.debug_check_bounds::<LookupResult>(offset);
2029            // Vector header
2030            let max_ordinal: u64 = self.max_ordinal_present();
2031            encoder.write_num(max_ordinal, offset);
2032            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2033            // Calling encoder.out_of_line_offset(0) is not allowed.
2034            if max_ordinal == 0 {
2035                return Ok(());
2036            }
2037            depth.increment()?;
2038            let envelope_size = 8;
2039            let bytes_len = max_ordinal as usize * envelope_size;
2040            #[allow(unused_variables)]
2041            let offset = encoder.out_of_line_offset(bytes_len);
2042            let mut _prev_end_offset: usize = 0;
2043            if 1 > max_ordinal {
2044                return Ok(());
2045            }
2046
2047            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2048            // are envelope_size bytes.
2049            let cur_offset: usize = (1 - 1) * envelope_size;
2050
2051            // Zero reserved fields.
2052            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2053
2054            // Safety:
2055            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2056            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2057            //   envelope_size bytes, there is always sufficient room.
2058            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_net__common::IpAddress, 1024>, D>(
2059            self.addresses.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_net__common::IpAddress, 1024> as fidl::encoding::ValueTypeMarker>::borrow),
2060            encoder, offset + cur_offset, depth
2061        )?;
2062
2063            _prev_end_offset = cur_offset + envelope_size;
2064            if 2 > max_ordinal {
2065                return Ok(());
2066            }
2067
2068            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2069            // are envelope_size bytes.
2070            let cur_offset: usize = (2 - 1) * envelope_size;
2071
2072            // Zero reserved fields.
2073            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2074
2075            // Safety:
2076            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2077            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2078            //   envelope_size bytes, there is always sufficient room.
2079            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>, D>(
2080                self.canonical_name.as_ref().map(
2081                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
2082                ),
2083                encoder,
2084                offset + cur_offset,
2085                depth,
2086            )?;
2087
2088            _prev_end_offset = cur_offset + envelope_size;
2089
2090            Ok(())
2091        }
2092    }
2093
2094    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LookupResult {
2095        #[inline(always)]
2096        fn new_empty() -> Self {
2097            Self::default()
2098        }
2099
2100        unsafe fn decode(
2101            &mut self,
2102            decoder: &mut fidl::encoding::Decoder<'_, D>,
2103            offset: usize,
2104            mut depth: fidl::encoding::Depth,
2105        ) -> fidl::Result<()> {
2106            decoder.debug_check_bounds::<Self>(offset);
2107            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2108                None => return Err(fidl::Error::NotNullable),
2109                Some(len) => len,
2110            };
2111            // Calling decoder.out_of_line_offset(0) is not allowed.
2112            if len == 0 {
2113                return Ok(());
2114            };
2115            depth.increment()?;
2116            let envelope_size = 8;
2117            let bytes_len = len * envelope_size;
2118            let offset = decoder.out_of_line_offset(bytes_len)?;
2119            // Decode the envelope for each type.
2120            let mut _next_ordinal_to_read = 0;
2121            let mut next_offset = offset;
2122            let end_offset = offset + bytes_len;
2123            _next_ordinal_to_read += 1;
2124            if next_offset >= end_offset {
2125                return Ok(());
2126            }
2127
2128            // Decode unknown envelopes for gaps in ordinals.
2129            while _next_ordinal_to_read < 1 {
2130                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2131                _next_ordinal_to_read += 1;
2132                next_offset += envelope_size;
2133            }
2134
2135            let next_out_of_line = decoder.next_out_of_line();
2136            let handles_before = decoder.remaining_handles();
2137            if let Some((inlined, num_bytes, num_handles)) =
2138                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2139            {
2140                let member_inline_size = <fidl::encoding::Vector<
2141                    fidl_fuchsia_net__common::IpAddress,
2142                    1024,
2143                > as fidl::encoding::TypeMarker>::inline_size(
2144                    decoder.context
2145                );
2146                if inlined != (member_inline_size <= 4) {
2147                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2148                }
2149                let inner_offset;
2150                let mut inner_depth = depth.clone();
2151                if inlined {
2152                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2153                    inner_offset = next_offset;
2154                } else {
2155                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2156                    inner_depth.increment()?;
2157                }
2158                let val_ref =
2159                self.addresses.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_net__common::IpAddress, 1024>, D));
2160                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_net__common::IpAddress, 1024>, D, val_ref, decoder, inner_offset, inner_depth)?;
2161                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2162                {
2163                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2164                }
2165                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2166                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2167                }
2168            }
2169
2170            next_offset += envelope_size;
2171            _next_ordinal_to_read += 1;
2172            if next_offset >= end_offset {
2173                return Ok(());
2174            }
2175
2176            // Decode unknown envelopes for gaps in ordinals.
2177            while _next_ordinal_to_read < 2 {
2178                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2179                _next_ordinal_to_read += 1;
2180                next_offset += envelope_size;
2181            }
2182
2183            let next_out_of_line = decoder.next_out_of_line();
2184            let handles_before = decoder.remaining_handles();
2185            if let Some((inlined, num_bytes, num_handles)) =
2186                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2187            {
2188                let member_inline_size =
2189                    <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
2190                        decoder.context,
2191                    );
2192                if inlined != (member_inline_size <= 4) {
2193                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2194                }
2195                let inner_offset;
2196                let mut inner_depth = depth.clone();
2197                if inlined {
2198                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2199                    inner_offset = next_offset;
2200                } else {
2201                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2202                    inner_depth.increment()?;
2203                }
2204                let val_ref = self
2205                    .canonical_name
2206                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>, D));
2207                fidl::decode!(
2208                    fidl::encoding::BoundedString<255>,
2209                    D,
2210                    val_ref,
2211                    decoder,
2212                    inner_offset,
2213                    inner_depth
2214                )?;
2215                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2216                {
2217                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2218                }
2219                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2220                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2221                }
2222            }
2223
2224            next_offset += envelope_size;
2225
2226            // Decode the remaining unknown envelopes.
2227            while next_offset < end_offset {
2228                _next_ordinal_to_read += 1;
2229                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2230                next_offset += envelope_size;
2231            }
2232
2233            Ok(())
2234        }
2235    }
2236
2237    impl NdpDnsServerSource {
2238        #[inline(always)]
2239        fn max_ordinal_present(&self) -> u64 {
2240            if let Some(_) = self.source_interface {
2241                return 1;
2242            }
2243            0
2244        }
2245    }
2246
2247    impl fidl::encoding::ValueTypeMarker for NdpDnsServerSource {
2248        type Borrowed<'a> = &'a Self;
2249        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2250            value
2251        }
2252    }
2253
2254    unsafe impl fidl::encoding::TypeMarker for NdpDnsServerSource {
2255        type Owned = Self;
2256
2257        #[inline(always)]
2258        fn inline_align(_context: fidl::encoding::Context) -> usize {
2259            8
2260        }
2261
2262        #[inline(always)]
2263        fn inline_size(_context: fidl::encoding::Context) -> usize {
2264            16
2265        }
2266    }
2267
2268    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NdpDnsServerSource, D>
2269        for &NdpDnsServerSource
2270    {
2271        unsafe fn encode(
2272            self,
2273            encoder: &mut fidl::encoding::Encoder<'_, D>,
2274            offset: usize,
2275            mut depth: fidl::encoding::Depth,
2276        ) -> fidl::Result<()> {
2277            encoder.debug_check_bounds::<NdpDnsServerSource>(offset);
2278            // Vector header
2279            let max_ordinal: u64 = self.max_ordinal_present();
2280            encoder.write_num(max_ordinal, offset);
2281            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2282            // Calling encoder.out_of_line_offset(0) is not allowed.
2283            if max_ordinal == 0 {
2284                return Ok(());
2285            }
2286            depth.increment()?;
2287            let envelope_size = 8;
2288            let bytes_len = max_ordinal as usize * envelope_size;
2289            #[allow(unused_variables)]
2290            let offset = encoder.out_of_line_offset(bytes_len);
2291            let mut _prev_end_offset: usize = 0;
2292            if 1 > max_ordinal {
2293                return Ok(());
2294            }
2295
2296            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2297            // are envelope_size bytes.
2298            let cur_offset: usize = (1 - 1) * envelope_size;
2299
2300            // Zero reserved fields.
2301            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2302
2303            // Safety:
2304            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2305            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2306            //   envelope_size bytes, there is always sufficient room.
2307            fidl::encoding::encode_in_envelope_optional::<u64, D>(
2308                self.source_interface
2309                    .as_ref()
2310                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2311                encoder,
2312                offset + cur_offset,
2313                depth,
2314            )?;
2315
2316            _prev_end_offset = cur_offset + envelope_size;
2317
2318            Ok(())
2319        }
2320    }
2321
2322    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NdpDnsServerSource {
2323        #[inline(always)]
2324        fn new_empty() -> Self {
2325            Self::default()
2326        }
2327
2328        unsafe fn decode(
2329            &mut self,
2330            decoder: &mut fidl::encoding::Decoder<'_, D>,
2331            offset: usize,
2332            mut depth: fidl::encoding::Depth,
2333        ) -> fidl::Result<()> {
2334            decoder.debug_check_bounds::<Self>(offset);
2335            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2336                None => return Err(fidl::Error::NotNullable),
2337                Some(len) => len,
2338            };
2339            // Calling decoder.out_of_line_offset(0) is not allowed.
2340            if len == 0 {
2341                return Ok(());
2342            };
2343            depth.increment()?;
2344            let envelope_size = 8;
2345            let bytes_len = len * envelope_size;
2346            let offset = decoder.out_of_line_offset(bytes_len)?;
2347            // Decode the envelope for each type.
2348            let mut _next_ordinal_to_read = 0;
2349            let mut next_offset = offset;
2350            let end_offset = offset + bytes_len;
2351            _next_ordinal_to_read += 1;
2352            if next_offset >= end_offset {
2353                return Ok(());
2354            }
2355
2356            // Decode unknown envelopes for gaps in ordinals.
2357            while _next_ordinal_to_read < 1 {
2358                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2359                _next_ordinal_to_read += 1;
2360                next_offset += envelope_size;
2361            }
2362
2363            let next_out_of_line = decoder.next_out_of_line();
2364            let handles_before = decoder.remaining_handles();
2365            if let Some((inlined, num_bytes, num_handles)) =
2366                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2367            {
2368                let member_inline_size =
2369                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2370                if inlined != (member_inline_size <= 4) {
2371                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2372                }
2373                let inner_offset;
2374                let mut inner_depth = depth.clone();
2375                if inlined {
2376                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2377                    inner_offset = next_offset;
2378                } else {
2379                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2380                    inner_depth.increment()?;
2381                }
2382                let val_ref = self.source_interface.get_or_insert_with(|| fidl::new_empty!(u64, D));
2383                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2384                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2385                {
2386                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2387                }
2388                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2389                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2390                }
2391            }
2392
2393            next_offset += envelope_size;
2394
2395            // Decode the remaining unknown envelopes.
2396            while next_offset < end_offset {
2397                _next_ordinal_to_read += 1;
2398                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2399                next_offset += envelope_size;
2400            }
2401
2402            Ok(())
2403        }
2404    }
2405
2406    impl SocketProxyDnsServerSource {
2407        #[inline(always)]
2408        fn max_ordinal_present(&self) -> u64 {
2409            if let Some(_) = self.source_interface {
2410                return 1;
2411            }
2412            0
2413        }
2414    }
2415
2416    impl fidl::encoding::ValueTypeMarker for SocketProxyDnsServerSource {
2417        type Borrowed<'a> = &'a Self;
2418        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2419            value
2420        }
2421    }
2422
2423    unsafe impl fidl::encoding::TypeMarker for SocketProxyDnsServerSource {
2424        type Owned = Self;
2425
2426        #[inline(always)]
2427        fn inline_align(_context: fidl::encoding::Context) -> usize {
2428            8
2429        }
2430
2431        #[inline(always)]
2432        fn inline_size(_context: fidl::encoding::Context) -> usize {
2433            16
2434        }
2435    }
2436
2437    unsafe impl<D: fidl::encoding::ResourceDialect>
2438        fidl::encoding::Encode<SocketProxyDnsServerSource, D> for &SocketProxyDnsServerSource
2439    {
2440        unsafe fn encode(
2441            self,
2442            encoder: &mut fidl::encoding::Encoder<'_, D>,
2443            offset: usize,
2444            mut depth: fidl::encoding::Depth,
2445        ) -> fidl::Result<()> {
2446            encoder.debug_check_bounds::<SocketProxyDnsServerSource>(offset);
2447            // Vector header
2448            let max_ordinal: u64 = self.max_ordinal_present();
2449            encoder.write_num(max_ordinal, offset);
2450            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2451            // Calling encoder.out_of_line_offset(0) is not allowed.
2452            if max_ordinal == 0 {
2453                return Ok(());
2454            }
2455            depth.increment()?;
2456            let envelope_size = 8;
2457            let bytes_len = max_ordinal as usize * envelope_size;
2458            #[allow(unused_variables)]
2459            let offset = encoder.out_of_line_offset(bytes_len);
2460            let mut _prev_end_offset: usize = 0;
2461            if 1 > max_ordinal {
2462                return Ok(());
2463            }
2464
2465            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2466            // are envelope_size bytes.
2467            let cur_offset: usize = (1 - 1) * envelope_size;
2468
2469            // Zero reserved fields.
2470            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2471
2472            // Safety:
2473            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2474            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2475            //   envelope_size bytes, there is always sufficient room.
2476            fidl::encoding::encode_in_envelope_optional::<u64, D>(
2477                self.source_interface
2478                    .as_ref()
2479                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2480                encoder,
2481                offset + cur_offset,
2482                depth,
2483            )?;
2484
2485            _prev_end_offset = cur_offset + envelope_size;
2486
2487            Ok(())
2488        }
2489    }
2490
2491    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2492        for SocketProxyDnsServerSource
2493    {
2494        #[inline(always)]
2495        fn new_empty() -> Self {
2496            Self::default()
2497        }
2498
2499        unsafe fn decode(
2500            &mut self,
2501            decoder: &mut fidl::encoding::Decoder<'_, D>,
2502            offset: usize,
2503            mut depth: fidl::encoding::Depth,
2504        ) -> fidl::Result<()> {
2505            decoder.debug_check_bounds::<Self>(offset);
2506            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2507                None => return Err(fidl::Error::NotNullable),
2508                Some(len) => len,
2509            };
2510            // Calling decoder.out_of_line_offset(0) is not allowed.
2511            if len == 0 {
2512                return Ok(());
2513            };
2514            depth.increment()?;
2515            let envelope_size = 8;
2516            let bytes_len = len * envelope_size;
2517            let offset = decoder.out_of_line_offset(bytes_len)?;
2518            // Decode the envelope for each type.
2519            let mut _next_ordinal_to_read = 0;
2520            let mut next_offset = offset;
2521            let end_offset = offset + bytes_len;
2522            _next_ordinal_to_read += 1;
2523            if next_offset >= end_offset {
2524                return Ok(());
2525            }
2526
2527            // Decode unknown envelopes for gaps in ordinals.
2528            while _next_ordinal_to_read < 1 {
2529                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2530                _next_ordinal_to_read += 1;
2531                next_offset += envelope_size;
2532            }
2533
2534            let next_out_of_line = decoder.next_out_of_line();
2535            let handles_before = decoder.remaining_handles();
2536            if let Some((inlined, num_bytes, num_handles)) =
2537                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2538            {
2539                let member_inline_size =
2540                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2541                if inlined != (member_inline_size <= 4) {
2542                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2543                }
2544                let inner_offset;
2545                let mut inner_depth = depth.clone();
2546                if inlined {
2547                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2548                    inner_offset = next_offset;
2549                } else {
2550                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2551                    inner_depth.increment()?;
2552                }
2553                let val_ref = self.source_interface.get_or_insert_with(|| fidl::new_empty!(u64, D));
2554                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2555                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2556                {
2557                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2558                }
2559                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2560                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2561                }
2562            }
2563
2564            next_offset += envelope_size;
2565
2566            // Decode the remaining unknown envelopes.
2567            while next_offset < end_offset {
2568                _next_ordinal_to_read += 1;
2569                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2570                next_offset += envelope_size;
2571            }
2572
2573            Ok(())
2574        }
2575    }
2576
2577    impl StaticDnsServerSource {
2578        #[inline(always)]
2579        fn max_ordinal_present(&self) -> u64 {
2580            0
2581        }
2582    }
2583
2584    impl fidl::encoding::ValueTypeMarker for StaticDnsServerSource {
2585        type Borrowed<'a> = &'a Self;
2586        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2587            value
2588        }
2589    }
2590
2591    unsafe impl fidl::encoding::TypeMarker for StaticDnsServerSource {
2592        type Owned = Self;
2593
2594        #[inline(always)]
2595        fn inline_align(_context: fidl::encoding::Context) -> usize {
2596            8
2597        }
2598
2599        #[inline(always)]
2600        fn inline_size(_context: fidl::encoding::Context) -> usize {
2601            16
2602        }
2603    }
2604
2605    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StaticDnsServerSource, D>
2606        for &StaticDnsServerSource
2607    {
2608        unsafe fn encode(
2609            self,
2610            encoder: &mut fidl::encoding::Encoder<'_, D>,
2611            offset: usize,
2612            mut depth: fidl::encoding::Depth,
2613        ) -> fidl::Result<()> {
2614            encoder.debug_check_bounds::<StaticDnsServerSource>(offset);
2615            // Vector header
2616            let max_ordinal: u64 = self.max_ordinal_present();
2617            encoder.write_num(max_ordinal, offset);
2618            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2619            // Calling encoder.out_of_line_offset(0) is not allowed.
2620            if max_ordinal == 0 {
2621                return Ok(());
2622            }
2623            depth.increment()?;
2624            let envelope_size = 8;
2625            let bytes_len = max_ordinal as usize * envelope_size;
2626            #[allow(unused_variables)]
2627            let offset = encoder.out_of_line_offset(bytes_len);
2628            let mut _prev_end_offset: usize = 0;
2629
2630            Ok(())
2631        }
2632    }
2633
2634    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StaticDnsServerSource {
2635        #[inline(always)]
2636        fn new_empty() -> Self {
2637            Self::default()
2638        }
2639
2640        unsafe fn decode(
2641            &mut self,
2642            decoder: &mut fidl::encoding::Decoder<'_, D>,
2643            offset: usize,
2644            mut depth: fidl::encoding::Depth,
2645        ) -> fidl::Result<()> {
2646            decoder.debug_check_bounds::<Self>(offset);
2647            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2648                None => return Err(fidl::Error::NotNullable),
2649                Some(len) => len,
2650            };
2651            // Calling decoder.out_of_line_offset(0) is not allowed.
2652            if len == 0 {
2653                return Ok(());
2654            };
2655            depth.increment()?;
2656            let envelope_size = 8;
2657            let bytes_len = len * envelope_size;
2658            let offset = decoder.out_of_line_offset(bytes_len)?;
2659            // Decode the envelope for each type.
2660            let mut _next_ordinal_to_read = 0;
2661            let mut next_offset = offset;
2662            let end_offset = offset + bytes_len;
2663
2664            // Decode the remaining unknown envelopes.
2665            while next_offset < end_offset {
2666                _next_ordinal_to_read += 1;
2667                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2668                next_offset += envelope_size;
2669            }
2670
2671            Ok(())
2672        }
2673    }
2674
2675    impl fidl::encoding::ValueTypeMarker for DnsServerSource {
2676        type Borrowed<'a> = &'a Self;
2677        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2678            value
2679        }
2680    }
2681
2682    unsafe impl fidl::encoding::TypeMarker for DnsServerSource {
2683        type Owned = Self;
2684
2685        #[inline(always)]
2686        fn inline_align(_context: fidl::encoding::Context) -> usize {
2687            8
2688        }
2689
2690        #[inline(always)]
2691        fn inline_size(_context: fidl::encoding::Context) -> usize {
2692            16
2693        }
2694    }
2695
2696    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DnsServerSource, D>
2697        for &DnsServerSource
2698    {
2699        #[inline]
2700        unsafe fn encode(
2701            self,
2702            encoder: &mut fidl::encoding::Encoder<'_, D>,
2703            offset: usize,
2704            _depth: fidl::encoding::Depth,
2705        ) -> fidl::Result<()> {
2706            encoder.debug_check_bounds::<DnsServerSource>(offset);
2707            encoder.write_num::<u64>(self.ordinal(), offset);
2708            match self {
2709                DnsServerSource::StaticSource(ref val) => {
2710                    fidl::encoding::encode_in_envelope::<StaticDnsServerSource, D>(
2711                        <StaticDnsServerSource as fidl::encoding::ValueTypeMarker>::borrow(val),
2712                        encoder,
2713                        offset + 8,
2714                        _depth,
2715                    )
2716                }
2717                DnsServerSource::Dhcp(ref val) => {
2718                    fidl::encoding::encode_in_envelope::<DhcpDnsServerSource, D>(
2719                        <DhcpDnsServerSource as fidl::encoding::ValueTypeMarker>::borrow(val),
2720                        encoder,
2721                        offset + 8,
2722                        _depth,
2723                    )
2724                }
2725                DnsServerSource::Ndp(ref val) => {
2726                    fidl::encoding::encode_in_envelope::<NdpDnsServerSource, D>(
2727                        <NdpDnsServerSource as fidl::encoding::ValueTypeMarker>::borrow(val),
2728                        encoder,
2729                        offset + 8,
2730                        _depth,
2731                    )
2732                }
2733                DnsServerSource::Dhcpv6(ref val) => {
2734                    fidl::encoding::encode_in_envelope::<Dhcpv6DnsServerSource, D>(
2735                        <Dhcpv6DnsServerSource as fidl::encoding::ValueTypeMarker>::borrow(val),
2736                        encoder,
2737                        offset + 8,
2738                        _depth,
2739                    )
2740                }
2741                DnsServerSource::SocketProxy(ref val) => fidl::encoding::encode_in_envelope::<
2742                    SocketProxyDnsServerSource,
2743                    D,
2744                >(
2745                    <SocketProxyDnsServerSource as fidl::encoding::ValueTypeMarker>::borrow(val),
2746                    encoder,
2747                    offset + 8,
2748                    _depth,
2749                ),
2750                DnsServerSource::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2751            }
2752        }
2753    }
2754
2755    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DnsServerSource {
2756        #[inline(always)]
2757        fn new_empty() -> Self {
2758            Self::__SourceBreaking { unknown_ordinal: 0 }
2759        }
2760
2761        #[inline]
2762        unsafe fn decode(
2763            &mut self,
2764            decoder: &mut fidl::encoding::Decoder<'_, D>,
2765            offset: usize,
2766            mut depth: fidl::encoding::Depth,
2767        ) -> fidl::Result<()> {
2768            decoder.debug_check_bounds::<Self>(offset);
2769            #[allow(unused_variables)]
2770            let next_out_of_line = decoder.next_out_of_line();
2771            let handles_before = decoder.remaining_handles();
2772            let (ordinal, inlined, num_bytes, num_handles) =
2773                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2774
2775            let member_inline_size = match ordinal {
2776                1 => <StaticDnsServerSource as fidl::encoding::TypeMarker>::inline_size(
2777                    decoder.context,
2778                ),
2779                2 => <DhcpDnsServerSource as fidl::encoding::TypeMarker>::inline_size(
2780                    decoder.context,
2781                ),
2782                3 => {
2783                    <NdpDnsServerSource as fidl::encoding::TypeMarker>::inline_size(decoder.context)
2784                }
2785                4 => <Dhcpv6DnsServerSource as fidl::encoding::TypeMarker>::inline_size(
2786                    decoder.context,
2787                ),
2788                5 => <SocketProxyDnsServerSource as fidl::encoding::TypeMarker>::inline_size(
2789                    decoder.context,
2790                ),
2791                0 => return Err(fidl::Error::UnknownUnionTag),
2792                _ => num_bytes as usize,
2793            };
2794
2795            if inlined != (member_inline_size <= 4) {
2796                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2797            }
2798            let _inner_offset;
2799            if inlined {
2800                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2801                _inner_offset = offset + 8;
2802            } else {
2803                depth.increment()?;
2804                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2805            }
2806            match ordinal {
2807                1 => {
2808                    #[allow(irrefutable_let_patterns)]
2809                    if let DnsServerSource::StaticSource(_) = self {
2810                        // Do nothing, read the value into the object
2811                    } else {
2812                        // Initialize `self` to the right variant
2813                        *self = DnsServerSource::StaticSource(fidl::new_empty!(
2814                            StaticDnsServerSource,
2815                            D
2816                        ));
2817                    }
2818                    #[allow(irrefutable_let_patterns)]
2819                    if let DnsServerSource::StaticSource(ref mut val) = self {
2820                        fidl::decode!(
2821                            StaticDnsServerSource,
2822                            D,
2823                            val,
2824                            decoder,
2825                            _inner_offset,
2826                            depth
2827                        )?;
2828                    } else {
2829                        unreachable!()
2830                    }
2831                }
2832                2 => {
2833                    #[allow(irrefutable_let_patterns)]
2834                    if let DnsServerSource::Dhcp(_) = self {
2835                        // Do nothing, read the value into the object
2836                    } else {
2837                        // Initialize `self` to the right variant
2838                        *self = DnsServerSource::Dhcp(fidl::new_empty!(DhcpDnsServerSource, D));
2839                    }
2840                    #[allow(irrefutable_let_patterns)]
2841                    if let DnsServerSource::Dhcp(ref mut val) = self {
2842                        fidl::decode!(DhcpDnsServerSource, D, val, decoder, _inner_offset, depth)?;
2843                    } else {
2844                        unreachable!()
2845                    }
2846                }
2847                3 => {
2848                    #[allow(irrefutable_let_patterns)]
2849                    if let DnsServerSource::Ndp(_) = self {
2850                        // Do nothing, read the value into the object
2851                    } else {
2852                        // Initialize `self` to the right variant
2853                        *self = DnsServerSource::Ndp(fidl::new_empty!(NdpDnsServerSource, D));
2854                    }
2855                    #[allow(irrefutable_let_patterns)]
2856                    if let DnsServerSource::Ndp(ref mut val) = self {
2857                        fidl::decode!(NdpDnsServerSource, D, val, decoder, _inner_offset, depth)?;
2858                    } else {
2859                        unreachable!()
2860                    }
2861                }
2862                4 => {
2863                    #[allow(irrefutable_let_patterns)]
2864                    if let DnsServerSource::Dhcpv6(_) = self {
2865                        // Do nothing, read the value into the object
2866                    } else {
2867                        // Initialize `self` to the right variant
2868                        *self = DnsServerSource::Dhcpv6(fidl::new_empty!(Dhcpv6DnsServerSource, D));
2869                    }
2870                    #[allow(irrefutable_let_patterns)]
2871                    if let DnsServerSource::Dhcpv6(ref mut val) = self {
2872                        fidl::decode!(
2873                            Dhcpv6DnsServerSource,
2874                            D,
2875                            val,
2876                            decoder,
2877                            _inner_offset,
2878                            depth
2879                        )?;
2880                    } else {
2881                        unreachable!()
2882                    }
2883                }
2884                5 => {
2885                    #[allow(irrefutable_let_patterns)]
2886                    if let DnsServerSource::SocketProxy(_) = self {
2887                        // Do nothing, read the value into the object
2888                    } else {
2889                        // Initialize `self` to the right variant
2890                        *self = DnsServerSource::SocketProxy(fidl::new_empty!(
2891                            SocketProxyDnsServerSource,
2892                            D
2893                        ));
2894                    }
2895                    #[allow(irrefutable_let_patterns)]
2896                    if let DnsServerSource::SocketProxy(ref mut val) = self {
2897                        fidl::decode!(
2898                            SocketProxyDnsServerSource,
2899                            D,
2900                            val,
2901                            decoder,
2902                            _inner_offset,
2903                            depth
2904                        )?;
2905                    } else {
2906                        unreachable!()
2907                    }
2908                }
2909                #[allow(deprecated)]
2910                ordinal => {
2911                    for _ in 0..num_handles {
2912                        decoder.drop_next_handle()?;
2913                    }
2914                    *self = DnsServerSource::__SourceBreaking { unknown_ordinal: ordinal };
2915                }
2916            }
2917            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2918                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2919            }
2920            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2921                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2922            }
2923            Ok(())
2924        }
2925    }
2926}