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