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