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 DEFAULT_CLIENT_PORT: u16 = 546;
14
15pub const RELAY_AGENT_AND_SERVER_LINK_LOCAL_MULTICAST_ADDRESS: &str = "ff02::1:2";
20
21pub const RELAY_AGENT_AND_SERVER_PORT: u16 = 547;
24
25#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
26pub enum PrefixControlExitReason {
27 InvalidInterface,
29 InvalidPrefixLength,
31 AlreadyAcquiring,
34 InterfaceRemoved,
38 DoubleWatch,
40 NotSupported,
42 #[doc(hidden)]
43 __SourceBreaking { unknown_ordinal: u32 },
44}
45
46#[macro_export]
48macro_rules! PrefixControlExitReasonUnknown {
49 () => {
50 _
51 };
52}
53
54impl PrefixControlExitReason {
55 #[inline]
56 pub fn from_primitive(prim: u32) -> Option<Self> {
57 match prim {
58 1 => Some(Self::InvalidInterface),
59 2 => Some(Self::InvalidPrefixLength),
60 3 => Some(Self::AlreadyAcquiring),
61 4 => Some(Self::InterfaceRemoved),
62 5 => Some(Self::DoubleWatch),
63 6 => Some(Self::NotSupported),
64 _ => None,
65 }
66 }
67
68 #[inline]
69 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
70 match prim {
71 1 => Self::InvalidInterface,
72 2 => Self::InvalidPrefixLength,
73 3 => Self::AlreadyAcquiring,
74 4 => Self::InterfaceRemoved,
75 5 => Self::DoubleWatch,
76 6 => Self::NotSupported,
77 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
78 }
79 }
80
81 #[inline]
82 pub fn unknown() -> Self {
83 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
84 }
85
86 #[inline]
87 pub const fn into_primitive(self) -> u32 {
88 match self {
89 Self::InvalidInterface => 1,
90 Self::InvalidPrefixLength => 2,
91 Self::AlreadyAcquiring => 3,
92 Self::InterfaceRemoved => 4,
93 Self::DoubleWatch => 5,
94 Self::NotSupported => 6,
95 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
96 }
97 }
98
99 #[inline]
100 pub fn is_unknown(&self) -> bool {
101 match self {
102 Self::__SourceBreaking { unknown_ordinal: _ } => true,
103 _ => false,
104 }
105 }
106}
107
108#[derive(Clone, Debug, PartialEq)]
109pub struct ClientWatchPrefixesResponse {
110 pub prefixes: Vec<Prefix>,
122}
123
124impl fidl::Persistable for ClientWatchPrefixesResponse {}
125
126#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
127pub struct Empty;
128
129impl fidl::Persistable for Empty {}
130
131#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
132#[repr(C)]
133pub struct Lifetimes {
134 pub valid_until: i64,
148 pub preferred_until: i64,
163}
164
165impl fidl::Persistable for Lifetimes {}
166
167#[derive(Clone, Debug, PartialEq)]
168pub struct LinkLayerAddressPlusTime {
169 pub time: u32,
178 pub link_layer_address: LinkLayerAddress,
180}
181
182impl fidl::Persistable for LinkLayerAddressPlusTime {}
183
184#[derive(Clone, Debug, PartialEq)]
186pub struct Prefix {
187 pub prefix: fidl_fuchsia_net::Ipv6AddressWithPrefix,
191 pub lifetimes: Lifetimes,
193}
194
195impl fidl::Persistable for Prefix {}
196
197#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
198pub struct PrefixControlOnExitRequest {
199 pub reason: PrefixControlExitReason,
200}
201
202impl fidl::Persistable for PrefixControlOnExitRequest {}
203
204#[derive(Clone, Debug, PartialEq)]
205pub struct PrefixControlWatchPrefixResponse {
206 pub event: PrefixEvent,
207}
208
209impl fidl::Persistable for PrefixControlWatchPrefixResponse {}
210
211#[derive(Clone, Debug, Default, PartialEq)]
212pub struct AcquirePrefixConfig {
213 pub interface_id: Option<u64>,
217 pub preferred_prefix_len: Option<u8>,
227 #[doc(hidden)]
228 pub __source_breaking: fidl::marker::SourceBreaking,
229}
230
231impl fidl::Persistable for AcquirePrefixConfig {}
232
233#[derive(Clone, Debug, Default, PartialEq)]
234pub struct AddressConfig {
235 pub address_count: Option<u8>,
243 pub preferred_addresses: Option<Vec<fidl_fuchsia_net::Ipv6Address>>,
256 #[doc(hidden)]
257 pub __source_breaking: fidl::marker::SourceBreaking,
258}
259
260impl fidl::Persistable for AddressConfig {}
261
262#[derive(Clone, Debug, Default, PartialEq)]
263pub struct ClientConfig {
264 pub information_config: Option<InformationConfig>,
269 pub non_temporary_address_config: Option<AddressConfig>,
279 pub prefix_delegation_config: Option<PrefixDelegationConfig>,
290 #[doc(hidden)]
291 pub __source_breaking: fidl::marker::SourceBreaking,
292}
293
294impl fidl::Persistable for ClientConfig {}
295
296#[derive(Clone, Debug, Default, PartialEq)]
297pub struct InformationConfig {
298 pub dns_servers: Option<bool>,
303 #[doc(hidden)]
304 pub __source_breaking: fidl::marker::SourceBreaking,
305}
306
307impl fidl::Persistable for InformationConfig {}
308
309#[derive(Clone, Debug, Default, PartialEq)]
311pub struct NewClientParams {
312 pub interface_id: Option<u64>,
316 pub address: Option<fidl_fuchsia_net::Ipv6SocketAddress>,
333 pub config: Option<ClientConfig>,
348 pub duid: Option<Duid>,
357 #[doc(hidden)]
358 pub __source_breaking: fidl::marker::SourceBreaking,
359}
360
361impl fidl::Persistable for NewClientParams {}
362
363#[derive(Clone, Debug)]
364pub enum Duid {
365 LinkLayerAddressPlusTime(LinkLayerAddressPlusTime),
370 LinkLayerAddress(LinkLayerAddress),
375 Uuid([u8; 16]),
379 #[doc(hidden)]
380 __SourceBreaking { unknown_ordinal: u64 },
381}
382
383#[macro_export]
385macro_rules! DuidUnknown {
386 () => {
387 _
388 };
389}
390
391impl PartialEq for Duid {
393 fn eq(&self, other: &Self) -> bool {
394 match (self, other) {
395 (Self::LinkLayerAddressPlusTime(x), Self::LinkLayerAddressPlusTime(y)) => *x == *y,
396 (Self::LinkLayerAddress(x), Self::LinkLayerAddress(y)) => *x == *y,
397 (Self::Uuid(x), Self::Uuid(y)) => *x == *y,
398 _ => false,
399 }
400 }
401}
402
403impl Duid {
404 #[inline]
405 pub fn ordinal(&self) -> u64 {
406 match *self {
407 Self::LinkLayerAddressPlusTime(_) => 1,
408 Self::LinkLayerAddress(_) => 2,
409 Self::Uuid(_) => 3,
410 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
411 }
412 }
413
414 #[inline]
415 pub fn unknown_variant_for_testing() -> Self {
416 Self::__SourceBreaking { unknown_ordinal: 0 }
417 }
418
419 #[inline]
420 pub fn is_unknown(&self) -> bool {
421 match self {
422 Self::__SourceBreaking { .. } => true,
423 _ => false,
424 }
425 }
426}
427
428impl fidl::Persistable for Duid {}
429
430#[derive(Clone, Debug)]
435pub enum LinkLayerAddress {
436 Ethernet(fidl_fuchsia_net::MacAddress),
437 #[doc(hidden)]
438 __SourceBreaking {
439 unknown_ordinal: u64,
440 },
441}
442
443#[macro_export]
445macro_rules! LinkLayerAddressUnknown {
446 () => {
447 _
448 };
449}
450
451impl PartialEq for LinkLayerAddress {
453 fn eq(&self, other: &Self) -> bool {
454 match (self, other) {
455 (Self::Ethernet(x), Self::Ethernet(y)) => *x == *y,
456 _ => false,
457 }
458 }
459}
460
461impl LinkLayerAddress {
462 #[inline]
463 pub fn ordinal(&self) -> u64 {
464 match *self {
465 Self::Ethernet(_) => 1,
466 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
467 }
468 }
469
470 #[inline]
471 pub fn unknown_variant_for_testing() -> Self {
472 Self::__SourceBreaking { unknown_ordinal: 0 }
473 }
474
475 #[inline]
476 pub fn is_unknown(&self) -> bool {
477 match self {
478 Self::__SourceBreaking { .. } => true,
479 _ => false,
480 }
481 }
482}
483
484impl fidl::Persistable for LinkLayerAddress {}
485
486#[derive(Clone, Debug, PartialEq)]
487pub enum PrefixDelegationConfig {
488 Empty(Empty),
490 PrefixLength(u8),
494 Prefix(fidl_fuchsia_net::Ipv6AddressWithPrefix),
499}
500
501impl PrefixDelegationConfig {
502 #[inline]
503 pub fn ordinal(&self) -> u64 {
504 match *self {
505 Self::Empty(_) => 1,
506 Self::PrefixLength(_) => 2,
507 Self::Prefix(_) => 3,
508 }
509 }
510
511 #[deprecated = "Strict unions should not use `is_unknown`"]
512 #[inline]
513 pub fn is_unknown(&self) -> bool {
514 false
515 }
516}
517
518impl fidl::Persistable for PrefixDelegationConfig {}
519
520#[derive(Clone, Debug, PartialEq)]
521pub enum PrefixEvent {
522 Unassigned(Empty),
527 Assigned(Prefix),
535}
536
537impl PrefixEvent {
538 #[inline]
539 pub fn ordinal(&self) -> u64 {
540 match *self {
541 Self::Unassigned(_) => 1,
542 Self::Assigned(_) => 2,
543 }
544 }
545
546 #[deprecated = "Strict unions should not use `is_unknown`"]
547 #[inline]
548 pub fn is_unknown(&self) -> bool {
549 false
550 }
551}
552
553impl fidl::Persistable for PrefixEvent {}
554
555mod internal {
556 use super::*;
557 unsafe impl fidl::encoding::TypeMarker for PrefixControlExitReason {
558 type Owned = Self;
559
560 #[inline(always)]
561 fn inline_align(_context: fidl::encoding::Context) -> usize {
562 std::mem::align_of::<u32>()
563 }
564
565 #[inline(always)]
566 fn inline_size(_context: fidl::encoding::Context) -> usize {
567 std::mem::size_of::<u32>()
568 }
569
570 #[inline(always)]
571 fn encode_is_copy() -> bool {
572 false
573 }
574
575 #[inline(always)]
576 fn decode_is_copy() -> bool {
577 false
578 }
579 }
580
581 impl fidl::encoding::ValueTypeMarker for PrefixControlExitReason {
582 type Borrowed<'a> = Self;
583 #[inline(always)]
584 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
585 *value
586 }
587 }
588
589 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
590 for PrefixControlExitReason
591 {
592 #[inline]
593 unsafe fn encode(
594 self,
595 encoder: &mut fidl::encoding::Encoder<'_, D>,
596 offset: usize,
597 _depth: fidl::encoding::Depth,
598 ) -> fidl::Result<()> {
599 encoder.debug_check_bounds::<Self>(offset);
600 encoder.write_num(self.into_primitive(), offset);
601 Ok(())
602 }
603 }
604
605 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
606 for PrefixControlExitReason
607 {
608 #[inline(always)]
609 fn new_empty() -> Self {
610 Self::unknown()
611 }
612
613 #[inline]
614 unsafe fn decode(
615 &mut self,
616 decoder: &mut fidl::encoding::Decoder<'_, D>,
617 offset: usize,
618 _depth: fidl::encoding::Depth,
619 ) -> fidl::Result<()> {
620 decoder.debug_check_bounds::<Self>(offset);
621 let prim = decoder.read_num::<u32>(offset);
622
623 *self = Self::from_primitive_allow_unknown(prim);
624 Ok(())
625 }
626 }
627
628 impl fidl::encoding::ValueTypeMarker for ClientWatchPrefixesResponse {
629 type Borrowed<'a> = &'a Self;
630 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
631 value
632 }
633 }
634
635 unsafe impl fidl::encoding::TypeMarker for ClientWatchPrefixesResponse {
636 type Owned = Self;
637
638 #[inline(always)]
639 fn inline_align(_context: fidl::encoding::Context) -> usize {
640 8
641 }
642
643 #[inline(always)]
644 fn inline_size(_context: fidl::encoding::Context) -> usize {
645 16
646 }
647 }
648
649 unsafe impl<D: fidl::encoding::ResourceDialect>
650 fidl::encoding::Encode<ClientWatchPrefixesResponse, D> for &ClientWatchPrefixesResponse
651 {
652 #[inline]
653 unsafe fn encode(
654 self,
655 encoder: &mut fidl::encoding::Encoder<'_, D>,
656 offset: usize,
657 _depth: fidl::encoding::Depth,
658 ) -> fidl::Result<()> {
659 encoder.debug_check_bounds::<ClientWatchPrefixesResponse>(offset);
660 fidl::encoding::Encode::<ClientWatchPrefixesResponse, D>::encode(
662 (
663 <fidl::encoding::UnboundedVector<Prefix> as fidl::encoding::ValueTypeMarker>::borrow(&self.prefixes),
664 ),
665 encoder, offset, _depth
666 )
667 }
668 }
669 unsafe impl<
670 D: fidl::encoding::ResourceDialect,
671 T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<Prefix>, D>,
672 > fidl::encoding::Encode<ClientWatchPrefixesResponse, D> for (T0,)
673 {
674 #[inline]
675 unsafe fn encode(
676 self,
677 encoder: &mut fidl::encoding::Encoder<'_, D>,
678 offset: usize,
679 depth: fidl::encoding::Depth,
680 ) -> fidl::Result<()> {
681 encoder.debug_check_bounds::<ClientWatchPrefixesResponse>(offset);
682 self.0.encode(encoder, offset + 0, depth)?;
686 Ok(())
687 }
688 }
689
690 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
691 for ClientWatchPrefixesResponse
692 {
693 #[inline(always)]
694 fn new_empty() -> Self {
695 Self { prefixes: fidl::new_empty!(fidl::encoding::UnboundedVector<Prefix>, D) }
696 }
697
698 #[inline]
699 unsafe fn decode(
700 &mut self,
701 decoder: &mut fidl::encoding::Decoder<'_, D>,
702 offset: usize,
703 _depth: fidl::encoding::Depth,
704 ) -> fidl::Result<()> {
705 decoder.debug_check_bounds::<Self>(offset);
706 fidl::decode!(
708 fidl::encoding::UnboundedVector<Prefix>,
709 D,
710 &mut self.prefixes,
711 decoder,
712 offset + 0,
713 _depth
714 )?;
715 Ok(())
716 }
717 }
718
719 impl fidl::encoding::ValueTypeMarker for Empty {
720 type Borrowed<'a> = &'a Self;
721 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
722 value
723 }
724 }
725
726 unsafe impl fidl::encoding::TypeMarker for Empty {
727 type Owned = Self;
728
729 #[inline(always)]
730 fn inline_align(_context: fidl::encoding::Context) -> usize {
731 1
732 }
733
734 #[inline(always)]
735 fn inline_size(_context: fidl::encoding::Context) -> usize {
736 1
737 }
738 }
739
740 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Empty, D> for &Empty {
741 #[inline]
742 unsafe fn encode(
743 self,
744 encoder: &mut fidl::encoding::Encoder<'_, D>,
745 offset: usize,
746 _depth: fidl::encoding::Depth,
747 ) -> fidl::Result<()> {
748 encoder.debug_check_bounds::<Empty>(offset);
749 encoder.write_num(0u8, offset);
750 Ok(())
751 }
752 }
753
754 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Empty {
755 #[inline(always)]
756 fn new_empty() -> Self {
757 Self
758 }
759
760 #[inline]
761 unsafe fn decode(
762 &mut self,
763 decoder: &mut fidl::encoding::Decoder<'_, D>,
764 offset: usize,
765 _depth: fidl::encoding::Depth,
766 ) -> fidl::Result<()> {
767 decoder.debug_check_bounds::<Self>(offset);
768 match decoder.read_num::<u8>(offset) {
769 0 => Ok(()),
770 _ => Err(fidl::Error::Invalid),
771 }
772 }
773 }
774
775 impl fidl::encoding::ValueTypeMarker for Lifetimes {
776 type Borrowed<'a> = &'a Self;
777 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
778 value
779 }
780 }
781
782 unsafe impl fidl::encoding::TypeMarker for Lifetimes {
783 type Owned = Self;
784
785 #[inline(always)]
786 fn inline_align(_context: fidl::encoding::Context) -> usize {
787 8
788 }
789
790 #[inline(always)]
791 fn inline_size(_context: fidl::encoding::Context) -> usize {
792 16
793 }
794 #[inline(always)]
795 fn encode_is_copy() -> bool {
796 true
797 }
798
799 #[inline(always)]
800 fn decode_is_copy() -> bool {
801 true
802 }
803 }
804
805 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Lifetimes, D>
806 for &Lifetimes
807 {
808 #[inline]
809 unsafe fn encode(
810 self,
811 encoder: &mut fidl::encoding::Encoder<'_, D>,
812 offset: usize,
813 _depth: fidl::encoding::Depth,
814 ) -> fidl::Result<()> {
815 encoder.debug_check_bounds::<Lifetimes>(offset);
816 unsafe {
817 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
819 (buf_ptr as *mut Lifetimes).write_unaligned((self as *const Lifetimes).read());
820 }
823 Ok(())
824 }
825 }
826 unsafe impl<
827 D: fidl::encoding::ResourceDialect,
828 T0: fidl::encoding::Encode<i64, D>,
829 T1: fidl::encoding::Encode<i64, D>,
830 > fidl::encoding::Encode<Lifetimes, D> for (T0, T1)
831 {
832 #[inline]
833 unsafe fn encode(
834 self,
835 encoder: &mut fidl::encoding::Encoder<'_, D>,
836 offset: usize,
837 depth: fidl::encoding::Depth,
838 ) -> fidl::Result<()> {
839 encoder.debug_check_bounds::<Lifetimes>(offset);
840 self.0.encode(encoder, offset + 0, depth)?;
844 self.1.encode(encoder, offset + 8, depth)?;
845 Ok(())
846 }
847 }
848
849 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Lifetimes {
850 #[inline(always)]
851 fn new_empty() -> Self {
852 Self {
853 valid_until: fidl::new_empty!(i64, D),
854 preferred_until: fidl::new_empty!(i64, D),
855 }
856 }
857
858 #[inline]
859 unsafe fn decode(
860 &mut self,
861 decoder: &mut fidl::encoding::Decoder<'_, D>,
862 offset: usize,
863 _depth: fidl::encoding::Depth,
864 ) -> fidl::Result<()> {
865 decoder.debug_check_bounds::<Self>(offset);
866 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
867 unsafe {
870 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
871 }
872 Ok(())
873 }
874 }
875
876 impl fidl::encoding::ValueTypeMarker for LinkLayerAddressPlusTime {
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 LinkLayerAddressPlusTime {
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 24
894 }
895 }
896
897 unsafe impl<D: fidl::encoding::ResourceDialect>
898 fidl::encoding::Encode<LinkLayerAddressPlusTime, D> for &LinkLayerAddressPlusTime
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::<LinkLayerAddressPlusTime>(offset);
908 fidl::encoding::Encode::<LinkLayerAddressPlusTime, D>::encode(
910 (
911 <u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.time),
912 <LinkLayerAddress as fidl::encoding::ValueTypeMarker>::borrow(
913 &self.link_layer_address,
914 ),
915 ),
916 encoder,
917 offset,
918 _depth,
919 )
920 }
921 }
922 unsafe impl<
923 D: fidl::encoding::ResourceDialect,
924 T0: fidl::encoding::Encode<u32, D>,
925 T1: fidl::encoding::Encode<LinkLayerAddress, D>,
926 > fidl::encoding::Encode<LinkLayerAddressPlusTime, D> for (T0, T1)
927 {
928 #[inline]
929 unsafe fn encode(
930 self,
931 encoder: &mut fidl::encoding::Encoder<'_, D>,
932 offset: usize,
933 depth: fidl::encoding::Depth,
934 ) -> fidl::Result<()> {
935 encoder.debug_check_bounds::<LinkLayerAddressPlusTime>(offset);
936 unsafe {
939 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
940 (ptr as *mut u64).write_unaligned(0);
941 }
942 self.0.encode(encoder, offset + 0, depth)?;
944 self.1.encode(encoder, offset + 8, depth)?;
945 Ok(())
946 }
947 }
948
949 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
950 for LinkLayerAddressPlusTime
951 {
952 #[inline(always)]
953 fn new_empty() -> Self {
954 Self {
955 time: fidl::new_empty!(u32, D),
956 link_layer_address: fidl::new_empty!(LinkLayerAddress, D),
957 }
958 }
959
960 #[inline]
961 unsafe fn decode(
962 &mut self,
963 decoder: &mut fidl::encoding::Decoder<'_, D>,
964 offset: usize,
965 _depth: fidl::encoding::Depth,
966 ) -> fidl::Result<()> {
967 decoder.debug_check_bounds::<Self>(offset);
968 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
970 let padval = unsafe { (ptr as *const u64).read_unaligned() };
971 let mask = 0xffffffff00000000u64;
972 let maskedval = padval & mask;
973 if maskedval != 0 {
974 return Err(fidl::Error::NonZeroPadding {
975 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
976 });
977 }
978 fidl::decode!(u32, D, &mut self.time, decoder, offset + 0, _depth)?;
979 fidl::decode!(
980 LinkLayerAddress,
981 D,
982 &mut self.link_layer_address,
983 decoder,
984 offset + 8,
985 _depth
986 )?;
987 Ok(())
988 }
989 }
990
991 impl fidl::encoding::ValueTypeMarker for Prefix {
992 type Borrowed<'a> = &'a Self;
993 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
994 value
995 }
996 }
997
998 unsafe impl fidl::encoding::TypeMarker for Prefix {
999 type Owned = Self;
1000
1001 #[inline(always)]
1002 fn inline_align(_context: fidl::encoding::Context) -> usize {
1003 8
1004 }
1005
1006 #[inline(always)]
1007 fn inline_size(_context: fidl::encoding::Context) -> usize {
1008 40
1009 }
1010 }
1011
1012 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Prefix, D> for &Prefix {
1013 #[inline]
1014 unsafe fn encode(
1015 self,
1016 encoder: &mut fidl::encoding::Encoder<'_, D>,
1017 offset: usize,
1018 _depth: fidl::encoding::Depth,
1019 ) -> fidl::Result<()> {
1020 encoder.debug_check_bounds::<Prefix>(offset);
1021 fidl::encoding::Encode::<Prefix, D>::encode(
1023 (
1024 <fidl_fuchsia_net::Ipv6AddressWithPrefix as fidl::encoding::ValueTypeMarker>::borrow(&self.prefix),
1025 <Lifetimes as fidl::encoding::ValueTypeMarker>::borrow(&self.lifetimes),
1026 ),
1027 encoder, offset, _depth
1028 )
1029 }
1030 }
1031 unsafe impl<
1032 D: fidl::encoding::ResourceDialect,
1033 T0: fidl::encoding::Encode<fidl_fuchsia_net::Ipv6AddressWithPrefix, D>,
1034 T1: fidl::encoding::Encode<Lifetimes, D>,
1035 > fidl::encoding::Encode<Prefix, D> for (T0, T1)
1036 {
1037 #[inline]
1038 unsafe fn encode(
1039 self,
1040 encoder: &mut fidl::encoding::Encoder<'_, D>,
1041 offset: usize,
1042 depth: fidl::encoding::Depth,
1043 ) -> fidl::Result<()> {
1044 encoder.debug_check_bounds::<Prefix>(offset);
1045 unsafe {
1048 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1049 (ptr as *mut u64).write_unaligned(0);
1050 }
1051 self.0.encode(encoder, offset + 0, depth)?;
1053 self.1.encode(encoder, offset + 24, depth)?;
1054 Ok(())
1055 }
1056 }
1057
1058 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Prefix {
1059 #[inline(always)]
1060 fn new_empty() -> Self {
1061 Self {
1062 prefix: fidl::new_empty!(fidl_fuchsia_net::Ipv6AddressWithPrefix, D),
1063 lifetimes: fidl::new_empty!(Lifetimes, D),
1064 }
1065 }
1066
1067 #[inline]
1068 unsafe fn decode(
1069 &mut self,
1070 decoder: &mut fidl::encoding::Decoder<'_, D>,
1071 offset: usize,
1072 _depth: fidl::encoding::Depth,
1073 ) -> fidl::Result<()> {
1074 decoder.debug_check_bounds::<Self>(offset);
1075 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1077 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1078 let mask = 0xffffffffffffff00u64;
1079 let maskedval = padval & mask;
1080 if maskedval != 0 {
1081 return Err(fidl::Error::NonZeroPadding {
1082 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1083 });
1084 }
1085 fidl::decode!(
1086 fidl_fuchsia_net::Ipv6AddressWithPrefix,
1087 D,
1088 &mut self.prefix,
1089 decoder,
1090 offset + 0,
1091 _depth
1092 )?;
1093 fidl::decode!(Lifetimes, D, &mut self.lifetimes, decoder, offset + 24, _depth)?;
1094 Ok(())
1095 }
1096 }
1097
1098 impl fidl::encoding::ValueTypeMarker for PrefixControlOnExitRequest {
1099 type Borrowed<'a> = &'a Self;
1100 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1101 value
1102 }
1103 }
1104
1105 unsafe impl fidl::encoding::TypeMarker for PrefixControlOnExitRequest {
1106 type Owned = Self;
1107
1108 #[inline(always)]
1109 fn inline_align(_context: fidl::encoding::Context) -> usize {
1110 4
1111 }
1112
1113 #[inline(always)]
1114 fn inline_size(_context: fidl::encoding::Context) -> usize {
1115 4
1116 }
1117 }
1118
1119 unsafe impl<D: fidl::encoding::ResourceDialect>
1120 fidl::encoding::Encode<PrefixControlOnExitRequest, D> for &PrefixControlOnExitRequest
1121 {
1122 #[inline]
1123 unsafe fn encode(
1124 self,
1125 encoder: &mut fidl::encoding::Encoder<'_, D>,
1126 offset: usize,
1127 _depth: fidl::encoding::Depth,
1128 ) -> fidl::Result<()> {
1129 encoder.debug_check_bounds::<PrefixControlOnExitRequest>(offset);
1130 fidl::encoding::Encode::<PrefixControlOnExitRequest, D>::encode(
1132 (<PrefixControlExitReason as fidl::encoding::ValueTypeMarker>::borrow(
1133 &self.reason,
1134 ),),
1135 encoder,
1136 offset,
1137 _depth,
1138 )
1139 }
1140 }
1141 unsafe impl<
1142 D: fidl::encoding::ResourceDialect,
1143 T0: fidl::encoding::Encode<PrefixControlExitReason, D>,
1144 > fidl::encoding::Encode<PrefixControlOnExitRequest, D> for (T0,)
1145 {
1146 #[inline]
1147 unsafe fn encode(
1148 self,
1149 encoder: &mut fidl::encoding::Encoder<'_, D>,
1150 offset: usize,
1151 depth: fidl::encoding::Depth,
1152 ) -> fidl::Result<()> {
1153 encoder.debug_check_bounds::<PrefixControlOnExitRequest>(offset);
1154 self.0.encode(encoder, offset + 0, depth)?;
1158 Ok(())
1159 }
1160 }
1161
1162 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1163 for PrefixControlOnExitRequest
1164 {
1165 #[inline(always)]
1166 fn new_empty() -> Self {
1167 Self { reason: fidl::new_empty!(PrefixControlExitReason, D) }
1168 }
1169
1170 #[inline]
1171 unsafe fn decode(
1172 &mut self,
1173 decoder: &mut fidl::encoding::Decoder<'_, D>,
1174 offset: usize,
1175 _depth: fidl::encoding::Depth,
1176 ) -> fidl::Result<()> {
1177 decoder.debug_check_bounds::<Self>(offset);
1178 fidl::decode!(
1180 PrefixControlExitReason,
1181 D,
1182 &mut self.reason,
1183 decoder,
1184 offset + 0,
1185 _depth
1186 )?;
1187 Ok(())
1188 }
1189 }
1190
1191 impl fidl::encoding::ValueTypeMarker for PrefixControlWatchPrefixResponse {
1192 type Borrowed<'a> = &'a Self;
1193 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1194 value
1195 }
1196 }
1197
1198 unsafe impl fidl::encoding::TypeMarker for PrefixControlWatchPrefixResponse {
1199 type Owned = Self;
1200
1201 #[inline(always)]
1202 fn inline_align(_context: fidl::encoding::Context) -> usize {
1203 8
1204 }
1205
1206 #[inline(always)]
1207 fn inline_size(_context: fidl::encoding::Context) -> usize {
1208 16
1209 }
1210 }
1211
1212 unsafe impl<D: fidl::encoding::ResourceDialect>
1213 fidl::encoding::Encode<PrefixControlWatchPrefixResponse, D>
1214 for &PrefixControlWatchPrefixResponse
1215 {
1216 #[inline]
1217 unsafe fn encode(
1218 self,
1219 encoder: &mut fidl::encoding::Encoder<'_, D>,
1220 offset: usize,
1221 _depth: fidl::encoding::Depth,
1222 ) -> fidl::Result<()> {
1223 encoder.debug_check_bounds::<PrefixControlWatchPrefixResponse>(offset);
1224 fidl::encoding::Encode::<PrefixControlWatchPrefixResponse, D>::encode(
1226 (<PrefixEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),),
1227 encoder,
1228 offset,
1229 _depth,
1230 )
1231 }
1232 }
1233 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<PrefixEvent, D>>
1234 fidl::encoding::Encode<PrefixControlWatchPrefixResponse, D> for (T0,)
1235 {
1236 #[inline]
1237 unsafe fn encode(
1238 self,
1239 encoder: &mut fidl::encoding::Encoder<'_, D>,
1240 offset: usize,
1241 depth: fidl::encoding::Depth,
1242 ) -> fidl::Result<()> {
1243 encoder.debug_check_bounds::<PrefixControlWatchPrefixResponse>(offset);
1244 self.0.encode(encoder, offset + 0, depth)?;
1248 Ok(())
1249 }
1250 }
1251
1252 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1253 for PrefixControlWatchPrefixResponse
1254 {
1255 #[inline(always)]
1256 fn new_empty() -> Self {
1257 Self { event: fidl::new_empty!(PrefixEvent, D) }
1258 }
1259
1260 #[inline]
1261 unsafe fn decode(
1262 &mut self,
1263 decoder: &mut fidl::encoding::Decoder<'_, D>,
1264 offset: usize,
1265 _depth: fidl::encoding::Depth,
1266 ) -> fidl::Result<()> {
1267 decoder.debug_check_bounds::<Self>(offset);
1268 fidl::decode!(PrefixEvent, D, &mut self.event, decoder, offset + 0, _depth)?;
1270 Ok(())
1271 }
1272 }
1273
1274 impl AcquirePrefixConfig {
1275 #[inline(always)]
1276 fn max_ordinal_present(&self) -> u64 {
1277 if let Some(_) = self.preferred_prefix_len {
1278 return 2;
1279 }
1280 if let Some(_) = self.interface_id {
1281 return 1;
1282 }
1283 0
1284 }
1285 }
1286
1287 impl fidl::encoding::ValueTypeMarker for AcquirePrefixConfig {
1288 type Borrowed<'a> = &'a Self;
1289 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1290 value
1291 }
1292 }
1293
1294 unsafe impl fidl::encoding::TypeMarker for AcquirePrefixConfig {
1295 type Owned = Self;
1296
1297 #[inline(always)]
1298 fn inline_align(_context: fidl::encoding::Context) -> usize {
1299 8
1300 }
1301
1302 #[inline(always)]
1303 fn inline_size(_context: fidl::encoding::Context) -> usize {
1304 16
1305 }
1306 }
1307
1308 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AcquirePrefixConfig, D>
1309 for &AcquirePrefixConfig
1310 {
1311 unsafe fn encode(
1312 self,
1313 encoder: &mut fidl::encoding::Encoder<'_, D>,
1314 offset: usize,
1315 mut depth: fidl::encoding::Depth,
1316 ) -> fidl::Result<()> {
1317 encoder.debug_check_bounds::<AcquirePrefixConfig>(offset);
1318 let max_ordinal: u64 = self.max_ordinal_present();
1320 encoder.write_num(max_ordinal, offset);
1321 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1322 if max_ordinal == 0 {
1324 return Ok(());
1325 }
1326 depth.increment()?;
1327 let envelope_size = 8;
1328 let bytes_len = max_ordinal as usize * envelope_size;
1329 #[allow(unused_variables)]
1330 let offset = encoder.out_of_line_offset(bytes_len);
1331 let mut _prev_end_offset: usize = 0;
1332 if 1 > max_ordinal {
1333 return Ok(());
1334 }
1335
1336 let cur_offset: usize = (1 - 1) * envelope_size;
1339
1340 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1342
1343 fidl::encoding::encode_in_envelope_optional::<u64, D>(
1348 self.interface_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1349 encoder,
1350 offset + cur_offset,
1351 depth,
1352 )?;
1353
1354 _prev_end_offset = cur_offset + envelope_size;
1355 if 2 > max_ordinal {
1356 return Ok(());
1357 }
1358
1359 let cur_offset: usize = (2 - 1) * envelope_size;
1362
1363 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1365
1366 fidl::encoding::encode_in_envelope_optional::<u8, D>(
1371 self.preferred_prefix_len
1372 .as_ref()
1373 .map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
1374 encoder,
1375 offset + cur_offset,
1376 depth,
1377 )?;
1378
1379 _prev_end_offset = cur_offset + envelope_size;
1380
1381 Ok(())
1382 }
1383 }
1384
1385 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AcquirePrefixConfig {
1386 #[inline(always)]
1387 fn new_empty() -> Self {
1388 Self::default()
1389 }
1390
1391 unsafe fn decode(
1392 &mut self,
1393 decoder: &mut fidl::encoding::Decoder<'_, D>,
1394 offset: usize,
1395 mut depth: fidl::encoding::Depth,
1396 ) -> fidl::Result<()> {
1397 decoder.debug_check_bounds::<Self>(offset);
1398 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1399 None => return Err(fidl::Error::NotNullable),
1400 Some(len) => len,
1401 };
1402 if len == 0 {
1404 return Ok(());
1405 };
1406 depth.increment()?;
1407 let envelope_size = 8;
1408 let bytes_len = len * envelope_size;
1409 let offset = decoder.out_of_line_offset(bytes_len)?;
1410 let mut _next_ordinal_to_read = 0;
1412 let mut next_offset = offset;
1413 let end_offset = offset + bytes_len;
1414 _next_ordinal_to_read += 1;
1415 if next_offset >= end_offset {
1416 return Ok(());
1417 }
1418
1419 while _next_ordinal_to_read < 1 {
1421 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1422 _next_ordinal_to_read += 1;
1423 next_offset += envelope_size;
1424 }
1425
1426 let next_out_of_line = decoder.next_out_of_line();
1427 let handles_before = decoder.remaining_handles();
1428 if let Some((inlined, num_bytes, num_handles)) =
1429 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1430 {
1431 let member_inline_size =
1432 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1433 if inlined != (member_inline_size <= 4) {
1434 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1435 }
1436 let inner_offset;
1437 let mut inner_depth = depth.clone();
1438 if inlined {
1439 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1440 inner_offset = next_offset;
1441 } else {
1442 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1443 inner_depth.increment()?;
1444 }
1445 let val_ref = self.interface_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
1446 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
1447 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1448 {
1449 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1450 }
1451 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1452 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1453 }
1454 }
1455
1456 next_offset += envelope_size;
1457 _next_ordinal_to_read += 1;
1458 if next_offset >= end_offset {
1459 return Ok(());
1460 }
1461
1462 while _next_ordinal_to_read < 2 {
1464 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1465 _next_ordinal_to_read += 1;
1466 next_offset += envelope_size;
1467 }
1468
1469 let next_out_of_line = decoder.next_out_of_line();
1470 let handles_before = decoder.remaining_handles();
1471 if let Some((inlined, num_bytes, num_handles)) =
1472 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1473 {
1474 let member_inline_size =
1475 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1476 if inlined != (member_inline_size <= 4) {
1477 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1478 }
1479 let inner_offset;
1480 let mut inner_depth = depth.clone();
1481 if inlined {
1482 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1483 inner_offset = next_offset;
1484 } else {
1485 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1486 inner_depth.increment()?;
1487 }
1488 let val_ref =
1489 self.preferred_prefix_len.get_or_insert_with(|| fidl::new_empty!(u8, D));
1490 fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
1491 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1492 {
1493 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1494 }
1495 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1496 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1497 }
1498 }
1499
1500 next_offset += envelope_size;
1501
1502 while next_offset < end_offset {
1504 _next_ordinal_to_read += 1;
1505 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1506 next_offset += envelope_size;
1507 }
1508
1509 Ok(())
1510 }
1511 }
1512
1513 impl AddressConfig {
1514 #[inline(always)]
1515 fn max_ordinal_present(&self) -> u64 {
1516 if let Some(_) = self.preferred_addresses {
1517 return 2;
1518 }
1519 if let Some(_) = self.address_count {
1520 return 1;
1521 }
1522 0
1523 }
1524 }
1525
1526 impl fidl::encoding::ValueTypeMarker for AddressConfig {
1527 type Borrowed<'a> = &'a Self;
1528 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1529 value
1530 }
1531 }
1532
1533 unsafe impl fidl::encoding::TypeMarker for AddressConfig {
1534 type Owned = Self;
1535
1536 #[inline(always)]
1537 fn inline_align(_context: fidl::encoding::Context) -> usize {
1538 8
1539 }
1540
1541 #[inline(always)]
1542 fn inline_size(_context: fidl::encoding::Context) -> usize {
1543 16
1544 }
1545 }
1546
1547 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<AddressConfig, D>
1548 for &AddressConfig
1549 {
1550 unsafe fn encode(
1551 self,
1552 encoder: &mut fidl::encoding::Encoder<'_, D>,
1553 offset: usize,
1554 mut depth: fidl::encoding::Depth,
1555 ) -> fidl::Result<()> {
1556 encoder.debug_check_bounds::<AddressConfig>(offset);
1557 let max_ordinal: u64 = self.max_ordinal_present();
1559 encoder.write_num(max_ordinal, offset);
1560 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1561 if max_ordinal == 0 {
1563 return Ok(());
1564 }
1565 depth.increment()?;
1566 let envelope_size = 8;
1567 let bytes_len = max_ordinal as usize * envelope_size;
1568 #[allow(unused_variables)]
1569 let offset = encoder.out_of_line_offset(bytes_len);
1570 let mut _prev_end_offset: usize = 0;
1571 if 1 > max_ordinal {
1572 return Ok(());
1573 }
1574
1575 let cur_offset: usize = (1 - 1) * envelope_size;
1578
1579 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1581
1582 fidl::encoding::encode_in_envelope_optional::<u8, D>(
1587 self.address_count.as_ref().map(<u8 as fidl::encoding::ValueTypeMarker>::borrow),
1588 encoder,
1589 offset + cur_offset,
1590 depth,
1591 )?;
1592
1593 _prev_end_offset = cur_offset + envelope_size;
1594 if 2 > max_ordinal {
1595 return Ok(());
1596 }
1597
1598 let cur_offset: usize = (2 - 1) * envelope_size;
1601
1602 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1604
1605 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_net::Ipv6Address>, D>(
1610 self.preferred_addresses.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_net::Ipv6Address> as fidl::encoding::ValueTypeMarker>::borrow),
1611 encoder, offset + cur_offset, depth
1612 )?;
1613
1614 _prev_end_offset = cur_offset + envelope_size;
1615
1616 Ok(())
1617 }
1618 }
1619
1620 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for AddressConfig {
1621 #[inline(always)]
1622 fn new_empty() -> Self {
1623 Self::default()
1624 }
1625
1626 unsafe fn decode(
1627 &mut self,
1628 decoder: &mut fidl::encoding::Decoder<'_, D>,
1629 offset: usize,
1630 mut depth: fidl::encoding::Depth,
1631 ) -> fidl::Result<()> {
1632 decoder.debug_check_bounds::<Self>(offset);
1633 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1634 None => return Err(fidl::Error::NotNullable),
1635 Some(len) => len,
1636 };
1637 if len == 0 {
1639 return Ok(());
1640 };
1641 depth.increment()?;
1642 let envelope_size = 8;
1643 let bytes_len = len * envelope_size;
1644 let offset = decoder.out_of_line_offset(bytes_len)?;
1645 let mut _next_ordinal_to_read = 0;
1647 let mut next_offset = offset;
1648 let end_offset = offset + bytes_len;
1649 _next_ordinal_to_read += 1;
1650 if next_offset >= end_offset {
1651 return Ok(());
1652 }
1653
1654 while _next_ordinal_to_read < 1 {
1656 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1657 _next_ordinal_to_read += 1;
1658 next_offset += envelope_size;
1659 }
1660
1661 let next_out_of_line = decoder.next_out_of_line();
1662 let handles_before = decoder.remaining_handles();
1663 if let Some((inlined, num_bytes, num_handles)) =
1664 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1665 {
1666 let member_inline_size =
1667 <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1668 if inlined != (member_inline_size <= 4) {
1669 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1670 }
1671 let inner_offset;
1672 let mut inner_depth = depth.clone();
1673 if inlined {
1674 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1675 inner_offset = next_offset;
1676 } else {
1677 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1678 inner_depth.increment()?;
1679 }
1680 let val_ref = self.address_count.get_or_insert_with(|| fidl::new_empty!(u8, D));
1681 fidl::decode!(u8, D, val_ref, decoder, inner_offset, inner_depth)?;
1682 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1683 {
1684 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1685 }
1686 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1687 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1688 }
1689 }
1690
1691 next_offset += envelope_size;
1692 _next_ordinal_to_read += 1;
1693 if next_offset >= end_offset {
1694 return Ok(());
1695 }
1696
1697 while _next_ordinal_to_read < 2 {
1699 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1700 _next_ordinal_to_read += 1;
1701 next_offset += envelope_size;
1702 }
1703
1704 let next_out_of_line = decoder.next_out_of_line();
1705 let handles_before = decoder.remaining_handles();
1706 if let Some((inlined, num_bytes, num_handles)) =
1707 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1708 {
1709 let member_inline_size = <fidl::encoding::UnboundedVector<
1710 fidl_fuchsia_net::Ipv6Address,
1711 > as fidl::encoding::TypeMarker>::inline_size(
1712 decoder.context
1713 );
1714 if inlined != (member_inline_size <= 4) {
1715 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1716 }
1717 let inner_offset;
1718 let mut inner_depth = depth.clone();
1719 if inlined {
1720 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1721 inner_offset = next_offset;
1722 } else {
1723 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1724 inner_depth.increment()?;
1725 }
1726 let val_ref = self.preferred_addresses.get_or_insert_with(|| {
1727 fidl::new_empty!(
1728 fidl::encoding::UnboundedVector<fidl_fuchsia_net::Ipv6Address>,
1729 D
1730 )
1731 });
1732 fidl::decode!(
1733 fidl::encoding::UnboundedVector<fidl_fuchsia_net::Ipv6Address>,
1734 D,
1735 val_ref,
1736 decoder,
1737 inner_offset,
1738 inner_depth
1739 )?;
1740 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1741 {
1742 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1743 }
1744 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1745 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1746 }
1747 }
1748
1749 next_offset += envelope_size;
1750
1751 while next_offset < end_offset {
1753 _next_ordinal_to_read += 1;
1754 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1755 next_offset += envelope_size;
1756 }
1757
1758 Ok(())
1759 }
1760 }
1761
1762 impl ClientConfig {
1763 #[inline(always)]
1764 fn max_ordinal_present(&self) -> u64 {
1765 if let Some(_) = self.prefix_delegation_config {
1766 return 3;
1767 }
1768 if let Some(_) = self.non_temporary_address_config {
1769 return 2;
1770 }
1771 if let Some(_) = self.information_config {
1772 return 1;
1773 }
1774 0
1775 }
1776 }
1777
1778 impl fidl::encoding::ValueTypeMarker for ClientConfig {
1779 type Borrowed<'a> = &'a Self;
1780 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1781 value
1782 }
1783 }
1784
1785 unsafe impl fidl::encoding::TypeMarker for ClientConfig {
1786 type Owned = Self;
1787
1788 #[inline(always)]
1789 fn inline_align(_context: fidl::encoding::Context) -> usize {
1790 8
1791 }
1792
1793 #[inline(always)]
1794 fn inline_size(_context: fidl::encoding::Context) -> usize {
1795 16
1796 }
1797 }
1798
1799 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ClientConfig, D>
1800 for &ClientConfig
1801 {
1802 unsafe fn encode(
1803 self,
1804 encoder: &mut fidl::encoding::Encoder<'_, D>,
1805 offset: usize,
1806 mut depth: fidl::encoding::Depth,
1807 ) -> fidl::Result<()> {
1808 encoder.debug_check_bounds::<ClientConfig>(offset);
1809 let max_ordinal: u64 = self.max_ordinal_present();
1811 encoder.write_num(max_ordinal, offset);
1812 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1813 if max_ordinal == 0 {
1815 return Ok(());
1816 }
1817 depth.increment()?;
1818 let envelope_size = 8;
1819 let bytes_len = max_ordinal as usize * envelope_size;
1820 #[allow(unused_variables)]
1821 let offset = encoder.out_of_line_offset(bytes_len);
1822 let mut _prev_end_offset: usize = 0;
1823 if 1 > max_ordinal {
1824 return Ok(());
1825 }
1826
1827 let cur_offset: usize = (1 - 1) * envelope_size;
1830
1831 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1833
1834 fidl::encoding::encode_in_envelope_optional::<InformationConfig, D>(
1839 self.information_config
1840 .as_ref()
1841 .map(<InformationConfig as fidl::encoding::ValueTypeMarker>::borrow),
1842 encoder,
1843 offset + cur_offset,
1844 depth,
1845 )?;
1846
1847 _prev_end_offset = cur_offset + envelope_size;
1848 if 2 > max_ordinal {
1849 return Ok(());
1850 }
1851
1852 let cur_offset: usize = (2 - 1) * envelope_size;
1855
1856 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1858
1859 fidl::encoding::encode_in_envelope_optional::<AddressConfig, D>(
1864 self.non_temporary_address_config
1865 .as_ref()
1866 .map(<AddressConfig as fidl::encoding::ValueTypeMarker>::borrow),
1867 encoder,
1868 offset + cur_offset,
1869 depth,
1870 )?;
1871
1872 _prev_end_offset = cur_offset + envelope_size;
1873 if 3 > max_ordinal {
1874 return Ok(());
1875 }
1876
1877 let cur_offset: usize = (3 - 1) * envelope_size;
1880
1881 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1883
1884 fidl::encoding::encode_in_envelope_optional::<PrefixDelegationConfig, D>(
1889 self.prefix_delegation_config
1890 .as_ref()
1891 .map(<PrefixDelegationConfig as fidl::encoding::ValueTypeMarker>::borrow),
1892 encoder,
1893 offset + cur_offset,
1894 depth,
1895 )?;
1896
1897 _prev_end_offset = cur_offset + envelope_size;
1898
1899 Ok(())
1900 }
1901 }
1902
1903 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ClientConfig {
1904 #[inline(always)]
1905 fn new_empty() -> Self {
1906 Self::default()
1907 }
1908
1909 unsafe fn decode(
1910 &mut self,
1911 decoder: &mut fidl::encoding::Decoder<'_, D>,
1912 offset: usize,
1913 mut depth: fidl::encoding::Depth,
1914 ) -> fidl::Result<()> {
1915 decoder.debug_check_bounds::<Self>(offset);
1916 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1917 None => return Err(fidl::Error::NotNullable),
1918 Some(len) => len,
1919 };
1920 if len == 0 {
1922 return Ok(());
1923 };
1924 depth.increment()?;
1925 let envelope_size = 8;
1926 let bytes_len = len * envelope_size;
1927 let offset = decoder.out_of_line_offset(bytes_len)?;
1928 let mut _next_ordinal_to_read = 0;
1930 let mut next_offset = offset;
1931 let end_offset = offset + bytes_len;
1932 _next_ordinal_to_read += 1;
1933 if next_offset >= end_offset {
1934 return Ok(());
1935 }
1936
1937 while _next_ordinal_to_read < 1 {
1939 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1940 _next_ordinal_to_read += 1;
1941 next_offset += envelope_size;
1942 }
1943
1944 let next_out_of_line = decoder.next_out_of_line();
1945 let handles_before = decoder.remaining_handles();
1946 if let Some((inlined, num_bytes, num_handles)) =
1947 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1948 {
1949 let member_inline_size =
1950 <InformationConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1951 if inlined != (member_inline_size <= 4) {
1952 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1953 }
1954 let inner_offset;
1955 let mut inner_depth = depth.clone();
1956 if inlined {
1957 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1958 inner_offset = next_offset;
1959 } else {
1960 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1961 inner_depth.increment()?;
1962 }
1963 let val_ref = self
1964 .information_config
1965 .get_or_insert_with(|| fidl::new_empty!(InformationConfig, D));
1966 fidl::decode!(InformationConfig, D, val_ref, decoder, inner_offset, inner_depth)?;
1967 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1968 {
1969 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1970 }
1971 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1972 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1973 }
1974 }
1975
1976 next_offset += envelope_size;
1977 _next_ordinal_to_read += 1;
1978 if next_offset >= end_offset {
1979 return Ok(());
1980 }
1981
1982 while _next_ordinal_to_read < 2 {
1984 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1985 _next_ordinal_to_read += 1;
1986 next_offset += envelope_size;
1987 }
1988
1989 let next_out_of_line = decoder.next_out_of_line();
1990 let handles_before = decoder.remaining_handles();
1991 if let Some((inlined, num_bytes, num_handles)) =
1992 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1993 {
1994 let member_inline_size =
1995 <AddressConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1996 if inlined != (member_inline_size <= 4) {
1997 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1998 }
1999 let inner_offset;
2000 let mut inner_depth = depth.clone();
2001 if inlined {
2002 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2003 inner_offset = next_offset;
2004 } else {
2005 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2006 inner_depth.increment()?;
2007 }
2008 let val_ref = self
2009 .non_temporary_address_config
2010 .get_or_insert_with(|| fidl::new_empty!(AddressConfig, D));
2011 fidl::decode!(AddressConfig, D, val_ref, decoder, inner_offset, inner_depth)?;
2012 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2013 {
2014 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2015 }
2016 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2017 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2018 }
2019 }
2020
2021 next_offset += envelope_size;
2022 _next_ordinal_to_read += 1;
2023 if next_offset >= end_offset {
2024 return Ok(());
2025 }
2026
2027 while _next_ordinal_to_read < 3 {
2029 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2030 _next_ordinal_to_read += 1;
2031 next_offset += envelope_size;
2032 }
2033
2034 let next_out_of_line = decoder.next_out_of_line();
2035 let handles_before = decoder.remaining_handles();
2036 if let Some((inlined, num_bytes, num_handles)) =
2037 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2038 {
2039 let member_inline_size =
2040 <PrefixDelegationConfig as fidl::encoding::TypeMarker>::inline_size(
2041 decoder.context,
2042 );
2043 if inlined != (member_inline_size <= 4) {
2044 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2045 }
2046 let inner_offset;
2047 let mut inner_depth = depth.clone();
2048 if inlined {
2049 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2050 inner_offset = next_offset;
2051 } else {
2052 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2053 inner_depth.increment()?;
2054 }
2055 let val_ref = self
2056 .prefix_delegation_config
2057 .get_or_insert_with(|| fidl::new_empty!(PrefixDelegationConfig, D));
2058 fidl::decode!(
2059 PrefixDelegationConfig,
2060 D,
2061 val_ref,
2062 decoder,
2063 inner_offset,
2064 inner_depth
2065 )?;
2066 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2067 {
2068 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2069 }
2070 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2071 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2072 }
2073 }
2074
2075 next_offset += envelope_size;
2076
2077 while next_offset < end_offset {
2079 _next_ordinal_to_read += 1;
2080 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2081 next_offset += envelope_size;
2082 }
2083
2084 Ok(())
2085 }
2086 }
2087
2088 impl InformationConfig {
2089 #[inline(always)]
2090 fn max_ordinal_present(&self) -> u64 {
2091 if let Some(_) = self.dns_servers {
2092 return 1;
2093 }
2094 0
2095 }
2096 }
2097
2098 impl fidl::encoding::ValueTypeMarker for InformationConfig {
2099 type Borrowed<'a> = &'a Self;
2100 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2101 value
2102 }
2103 }
2104
2105 unsafe impl fidl::encoding::TypeMarker for InformationConfig {
2106 type Owned = Self;
2107
2108 #[inline(always)]
2109 fn inline_align(_context: fidl::encoding::Context) -> usize {
2110 8
2111 }
2112
2113 #[inline(always)]
2114 fn inline_size(_context: fidl::encoding::Context) -> usize {
2115 16
2116 }
2117 }
2118
2119 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InformationConfig, D>
2120 for &InformationConfig
2121 {
2122 unsafe fn encode(
2123 self,
2124 encoder: &mut fidl::encoding::Encoder<'_, D>,
2125 offset: usize,
2126 mut depth: fidl::encoding::Depth,
2127 ) -> fidl::Result<()> {
2128 encoder.debug_check_bounds::<InformationConfig>(offset);
2129 let max_ordinal: u64 = self.max_ordinal_present();
2131 encoder.write_num(max_ordinal, offset);
2132 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2133 if max_ordinal == 0 {
2135 return Ok(());
2136 }
2137 depth.increment()?;
2138 let envelope_size = 8;
2139 let bytes_len = max_ordinal as usize * envelope_size;
2140 #[allow(unused_variables)]
2141 let offset = encoder.out_of_line_offset(bytes_len);
2142 let mut _prev_end_offset: usize = 0;
2143 if 1 > max_ordinal {
2144 return Ok(());
2145 }
2146
2147 let cur_offset: usize = (1 - 1) * envelope_size;
2150
2151 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2153
2154 fidl::encoding::encode_in_envelope_optional::<bool, D>(
2159 self.dns_servers.as_ref().map(<bool as fidl::encoding::ValueTypeMarker>::borrow),
2160 encoder,
2161 offset + cur_offset,
2162 depth,
2163 )?;
2164
2165 _prev_end_offset = cur_offset + envelope_size;
2166
2167 Ok(())
2168 }
2169 }
2170
2171 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InformationConfig {
2172 #[inline(always)]
2173 fn new_empty() -> Self {
2174 Self::default()
2175 }
2176
2177 unsafe fn decode(
2178 &mut self,
2179 decoder: &mut fidl::encoding::Decoder<'_, D>,
2180 offset: usize,
2181 mut depth: fidl::encoding::Depth,
2182 ) -> fidl::Result<()> {
2183 decoder.debug_check_bounds::<Self>(offset);
2184 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2185 None => return Err(fidl::Error::NotNullable),
2186 Some(len) => len,
2187 };
2188 if len == 0 {
2190 return Ok(());
2191 };
2192 depth.increment()?;
2193 let envelope_size = 8;
2194 let bytes_len = len * envelope_size;
2195 let offset = decoder.out_of_line_offset(bytes_len)?;
2196 let mut _next_ordinal_to_read = 0;
2198 let mut next_offset = offset;
2199 let end_offset = offset + bytes_len;
2200 _next_ordinal_to_read += 1;
2201 if next_offset >= end_offset {
2202 return Ok(());
2203 }
2204
2205 while _next_ordinal_to_read < 1 {
2207 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2208 _next_ordinal_to_read += 1;
2209 next_offset += envelope_size;
2210 }
2211
2212 let next_out_of_line = decoder.next_out_of_line();
2213 let handles_before = decoder.remaining_handles();
2214 if let Some((inlined, num_bytes, num_handles)) =
2215 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2216 {
2217 let member_inline_size =
2218 <bool as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2219 if inlined != (member_inline_size <= 4) {
2220 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2221 }
2222 let inner_offset;
2223 let mut inner_depth = depth.clone();
2224 if inlined {
2225 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2226 inner_offset = next_offset;
2227 } else {
2228 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2229 inner_depth.increment()?;
2230 }
2231 let val_ref = self.dns_servers.get_or_insert_with(|| fidl::new_empty!(bool, D));
2232 fidl::decode!(bool, D, val_ref, decoder, inner_offset, inner_depth)?;
2233 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2234 {
2235 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2236 }
2237 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2238 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2239 }
2240 }
2241
2242 next_offset += envelope_size;
2243
2244 while next_offset < end_offset {
2246 _next_ordinal_to_read += 1;
2247 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2248 next_offset += envelope_size;
2249 }
2250
2251 Ok(())
2252 }
2253 }
2254
2255 impl NewClientParams {
2256 #[inline(always)]
2257 fn max_ordinal_present(&self) -> u64 {
2258 if let Some(_) = self.duid {
2259 return 4;
2260 }
2261 if let Some(_) = self.config {
2262 return 3;
2263 }
2264 if let Some(_) = self.address {
2265 return 2;
2266 }
2267 if let Some(_) = self.interface_id {
2268 return 1;
2269 }
2270 0
2271 }
2272 }
2273
2274 impl fidl::encoding::ValueTypeMarker for NewClientParams {
2275 type Borrowed<'a> = &'a Self;
2276 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2277 value
2278 }
2279 }
2280
2281 unsafe impl fidl::encoding::TypeMarker for NewClientParams {
2282 type Owned = Self;
2283
2284 #[inline(always)]
2285 fn inline_align(_context: fidl::encoding::Context) -> usize {
2286 8
2287 }
2288
2289 #[inline(always)]
2290 fn inline_size(_context: fidl::encoding::Context) -> usize {
2291 16
2292 }
2293 }
2294
2295 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NewClientParams, D>
2296 for &NewClientParams
2297 {
2298 unsafe fn encode(
2299 self,
2300 encoder: &mut fidl::encoding::Encoder<'_, D>,
2301 offset: usize,
2302 mut depth: fidl::encoding::Depth,
2303 ) -> fidl::Result<()> {
2304 encoder.debug_check_bounds::<NewClientParams>(offset);
2305 let max_ordinal: u64 = self.max_ordinal_present();
2307 encoder.write_num(max_ordinal, offset);
2308 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2309 if max_ordinal == 0 {
2311 return Ok(());
2312 }
2313 depth.increment()?;
2314 let envelope_size = 8;
2315 let bytes_len = max_ordinal as usize * envelope_size;
2316 #[allow(unused_variables)]
2317 let offset = encoder.out_of_line_offset(bytes_len);
2318 let mut _prev_end_offset: usize = 0;
2319 if 1 > max_ordinal {
2320 return Ok(());
2321 }
2322
2323 let cur_offset: usize = (1 - 1) * envelope_size;
2326
2327 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2329
2330 fidl::encoding::encode_in_envelope_optional::<u64, D>(
2335 self.interface_id.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2336 encoder,
2337 offset + cur_offset,
2338 depth,
2339 )?;
2340
2341 _prev_end_offset = cur_offset + envelope_size;
2342 if 2 > max_ordinal {
2343 return Ok(());
2344 }
2345
2346 let cur_offset: usize = (2 - 1) * envelope_size;
2349
2350 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2352
2353 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net::Ipv6SocketAddress, D>(
2358 self.address.as_ref().map(<fidl_fuchsia_net::Ipv6SocketAddress as fidl::encoding::ValueTypeMarker>::borrow),
2359 encoder, offset + cur_offset, depth
2360 )?;
2361
2362 _prev_end_offset = cur_offset + envelope_size;
2363 if 3 > max_ordinal {
2364 return Ok(());
2365 }
2366
2367 let cur_offset: usize = (3 - 1) * envelope_size;
2370
2371 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2373
2374 fidl::encoding::encode_in_envelope_optional::<ClientConfig, D>(
2379 self.config.as_ref().map(<ClientConfig as fidl::encoding::ValueTypeMarker>::borrow),
2380 encoder,
2381 offset + cur_offset,
2382 depth,
2383 )?;
2384
2385 _prev_end_offset = cur_offset + envelope_size;
2386 if 4 > max_ordinal {
2387 return Ok(());
2388 }
2389
2390 let cur_offset: usize = (4 - 1) * envelope_size;
2393
2394 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2396
2397 fidl::encoding::encode_in_envelope_optional::<Duid, D>(
2402 self.duid.as_ref().map(<Duid as fidl::encoding::ValueTypeMarker>::borrow),
2403 encoder,
2404 offset + cur_offset,
2405 depth,
2406 )?;
2407
2408 _prev_end_offset = cur_offset + envelope_size;
2409
2410 Ok(())
2411 }
2412 }
2413
2414 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NewClientParams {
2415 #[inline(always)]
2416 fn new_empty() -> Self {
2417 Self::default()
2418 }
2419
2420 unsafe fn decode(
2421 &mut self,
2422 decoder: &mut fidl::encoding::Decoder<'_, D>,
2423 offset: usize,
2424 mut depth: fidl::encoding::Depth,
2425 ) -> fidl::Result<()> {
2426 decoder.debug_check_bounds::<Self>(offset);
2427 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2428 None => return Err(fidl::Error::NotNullable),
2429 Some(len) => len,
2430 };
2431 if len == 0 {
2433 return Ok(());
2434 };
2435 depth.increment()?;
2436 let envelope_size = 8;
2437 let bytes_len = len * envelope_size;
2438 let offset = decoder.out_of_line_offset(bytes_len)?;
2439 let mut _next_ordinal_to_read = 0;
2441 let mut next_offset = offset;
2442 let end_offset = offset + bytes_len;
2443 _next_ordinal_to_read += 1;
2444 if next_offset >= end_offset {
2445 return Ok(());
2446 }
2447
2448 while _next_ordinal_to_read < 1 {
2450 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2451 _next_ordinal_to_read += 1;
2452 next_offset += envelope_size;
2453 }
2454
2455 let next_out_of_line = decoder.next_out_of_line();
2456 let handles_before = decoder.remaining_handles();
2457 if let Some((inlined, num_bytes, num_handles)) =
2458 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2459 {
2460 let member_inline_size =
2461 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2462 if inlined != (member_inline_size <= 4) {
2463 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2464 }
2465 let inner_offset;
2466 let mut inner_depth = depth.clone();
2467 if inlined {
2468 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2469 inner_offset = next_offset;
2470 } else {
2471 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2472 inner_depth.increment()?;
2473 }
2474 let val_ref = self.interface_id.get_or_insert_with(|| fidl::new_empty!(u64, D));
2475 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2476 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2477 {
2478 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2479 }
2480 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2481 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2482 }
2483 }
2484
2485 next_offset += envelope_size;
2486 _next_ordinal_to_read += 1;
2487 if next_offset >= end_offset {
2488 return Ok(());
2489 }
2490
2491 while _next_ordinal_to_read < 2 {
2493 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2494 _next_ordinal_to_read += 1;
2495 next_offset += envelope_size;
2496 }
2497
2498 let next_out_of_line = decoder.next_out_of_line();
2499 let handles_before = decoder.remaining_handles();
2500 if let Some((inlined, num_bytes, num_handles)) =
2501 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2502 {
2503 let member_inline_size = <fidl_fuchsia_net::Ipv6SocketAddress as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2504 if inlined != (member_inline_size <= 4) {
2505 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2506 }
2507 let inner_offset;
2508 let mut inner_depth = depth.clone();
2509 if inlined {
2510 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2511 inner_offset = next_offset;
2512 } else {
2513 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2514 inner_depth.increment()?;
2515 }
2516 let val_ref = self.address.get_or_insert_with(|| {
2517 fidl::new_empty!(fidl_fuchsia_net::Ipv6SocketAddress, D)
2518 });
2519 fidl::decode!(
2520 fidl_fuchsia_net::Ipv6SocketAddress,
2521 D,
2522 val_ref,
2523 decoder,
2524 inner_offset,
2525 inner_depth
2526 )?;
2527 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2528 {
2529 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2530 }
2531 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2532 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2533 }
2534 }
2535
2536 next_offset += envelope_size;
2537 _next_ordinal_to_read += 1;
2538 if next_offset >= end_offset {
2539 return Ok(());
2540 }
2541
2542 while _next_ordinal_to_read < 3 {
2544 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2545 _next_ordinal_to_read += 1;
2546 next_offset += envelope_size;
2547 }
2548
2549 let next_out_of_line = decoder.next_out_of_line();
2550 let handles_before = decoder.remaining_handles();
2551 if let Some((inlined, num_bytes, num_handles)) =
2552 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2553 {
2554 let member_inline_size =
2555 <ClientConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2556 if inlined != (member_inline_size <= 4) {
2557 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2558 }
2559 let inner_offset;
2560 let mut inner_depth = depth.clone();
2561 if inlined {
2562 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2563 inner_offset = next_offset;
2564 } else {
2565 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2566 inner_depth.increment()?;
2567 }
2568 let val_ref = self.config.get_or_insert_with(|| fidl::new_empty!(ClientConfig, D));
2569 fidl::decode!(ClientConfig, D, val_ref, decoder, inner_offset, inner_depth)?;
2570 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2571 {
2572 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2573 }
2574 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2575 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2576 }
2577 }
2578
2579 next_offset += envelope_size;
2580 _next_ordinal_to_read += 1;
2581 if next_offset >= end_offset {
2582 return Ok(());
2583 }
2584
2585 while _next_ordinal_to_read < 4 {
2587 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2588 _next_ordinal_to_read += 1;
2589 next_offset += envelope_size;
2590 }
2591
2592 let next_out_of_line = decoder.next_out_of_line();
2593 let handles_before = decoder.remaining_handles();
2594 if let Some((inlined, num_bytes, num_handles)) =
2595 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2596 {
2597 let member_inline_size =
2598 <Duid as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2599 if inlined != (member_inline_size <= 4) {
2600 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2601 }
2602 let inner_offset;
2603 let mut inner_depth = depth.clone();
2604 if inlined {
2605 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2606 inner_offset = next_offset;
2607 } else {
2608 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2609 inner_depth.increment()?;
2610 }
2611 let val_ref = self.duid.get_or_insert_with(|| fidl::new_empty!(Duid, D));
2612 fidl::decode!(Duid, D, val_ref, decoder, inner_offset, inner_depth)?;
2613 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2614 {
2615 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2616 }
2617 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2618 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2619 }
2620 }
2621
2622 next_offset += envelope_size;
2623
2624 while next_offset < end_offset {
2626 _next_ordinal_to_read += 1;
2627 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2628 next_offset += envelope_size;
2629 }
2630
2631 Ok(())
2632 }
2633 }
2634
2635 impl fidl::encoding::ValueTypeMarker for Duid {
2636 type Borrowed<'a> = &'a Self;
2637 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2638 value
2639 }
2640 }
2641
2642 unsafe impl fidl::encoding::TypeMarker for Duid {
2643 type Owned = Self;
2644
2645 #[inline(always)]
2646 fn inline_align(_context: fidl::encoding::Context) -> usize {
2647 8
2648 }
2649
2650 #[inline(always)]
2651 fn inline_size(_context: fidl::encoding::Context) -> usize {
2652 16
2653 }
2654 }
2655
2656 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Duid, D> for &Duid {
2657 #[inline]
2658 unsafe fn encode(
2659 self,
2660 encoder: &mut fidl::encoding::Encoder<'_, D>,
2661 offset: usize,
2662 _depth: fidl::encoding::Depth,
2663 ) -> fidl::Result<()> {
2664 encoder.debug_check_bounds::<Duid>(offset);
2665 encoder.write_num::<u64>(self.ordinal(), offset);
2666 match self {
2667 Duid::LinkLayerAddressPlusTime(ref val) => {
2668 fidl::encoding::encode_in_envelope::<LinkLayerAddressPlusTime, D>(
2669 <LinkLayerAddressPlusTime as fidl::encoding::ValueTypeMarker>::borrow(val),
2670 encoder,
2671 offset + 8,
2672 _depth,
2673 )
2674 }
2675 Duid::LinkLayerAddress(ref val) => {
2676 fidl::encoding::encode_in_envelope::<LinkLayerAddress, D>(
2677 <LinkLayerAddress as fidl::encoding::ValueTypeMarker>::borrow(val),
2678 encoder,
2679 offset + 8,
2680 _depth,
2681 )
2682 }
2683 Duid::Uuid(ref val) => fidl::encoding::encode_in_envelope::<
2684 fidl::encoding::Array<u8, 16>,
2685 D,
2686 >(
2687 <fidl::encoding::Array<u8, 16> as fidl::encoding::ValueTypeMarker>::borrow(val),
2688 encoder,
2689 offset + 8,
2690 _depth,
2691 ),
2692 Duid::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2693 }
2694 }
2695 }
2696
2697 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Duid {
2698 #[inline(always)]
2699 fn new_empty() -> Self {
2700 Self::__SourceBreaking { unknown_ordinal: 0 }
2701 }
2702
2703 #[inline]
2704 unsafe fn decode(
2705 &mut self,
2706 decoder: &mut fidl::encoding::Decoder<'_, D>,
2707 offset: usize,
2708 mut depth: fidl::encoding::Depth,
2709 ) -> fidl::Result<()> {
2710 decoder.debug_check_bounds::<Self>(offset);
2711 #[allow(unused_variables)]
2712 let next_out_of_line = decoder.next_out_of_line();
2713 let handles_before = decoder.remaining_handles();
2714 let (ordinal, inlined, num_bytes, num_handles) =
2715 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2716
2717 let member_inline_size = match ordinal {
2718 1 => <LinkLayerAddressPlusTime as fidl::encoding::TypeMarker>::inline_size(
2719 decoder.context,
2720 ),
2721 2 => <LinkLayerAddress as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2722 3 => <fidl::encoding::Array<u8, 16> as fidl::encoding::TypeMarker>::inline_size(
2723 decoder.context,
2724 ),
2725 0 => return Err(fidl::Error::UnknownUnionTag),
2726 _ => num_bytes as usize,
2727 };
2728
2729 if inlined != (member_inline_size <= 4) {
2730 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2731 }
2732 let _inner_offset;
2733 if inlined {
2734 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2735 _inner_offset = offset + 8;
2736 } else {
2737 depth.increment()?;
2738 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2739 }
2740 match ordinal {
2741 1 => {
2742 #[allow(irrefutable_let_patterns)]
2743 if let Duid::LinkLayerAddressPlusTime(_) = self {
2744 } else {
2746 *self = Duid::LinkLayerAddressPlusTime(fidl::new_empty!(
2748 LinkLayerAddressPlusTime,
2749 D
2750 ));
2751 }
2752 #[allow(irrefutable_let_patterns)]
2753 if let Duid::LinkLayerAddressPlusTime(ref mut val) = self {
2754 fidl::decode!(
2755 LinkLayerAddressPlusTime,
2756 D,
2757 val,
2758 decoder,
2759 _inner_offset,
2760 depth
2761 )?;
2762 } else {
2763 unreachable!()
2764 }
2765 }
2766 2 => {
2767 #[allow(irrefutable_let_patterns)]
2768 if let Duid::LinkLayerAddress(_) = self {
2769 } else {
2771 *self = Duid::LinkLayerAddress(fidl::new_empty!(LinkLayerAddress, D));
2773 }
2774 #[allow(irrefutable_let_patterns)]
2775 if let Duid::LinkLayerAddress(ref mut val) = self {
2776 fidl::decode!(LinkLayerAddress, D, val, decoder, _inner_offset, depth)?;
2777 } else {
2778 unreachable!()
2779 }
2780 }
2781 3 => {
2782 #[allow(irrefutable_let_patterns)]
2783 if let Duid::Uuid(_) = self {
2784 } else {
2786 *self = Duid::Uuid(fidl::new_empty!(fidl::encoding::Array<u8, 16>, D));
2788 }
2789 #[allow(irrefutable_let_patterns)]
2790 if let Duid::Uuid(ref mut val) = self {
2791 fidl::decode!(fidl::encoding::Array<u8, 16>, D, val, decoder, _inner_offset, depth)?;
2792 } else {
2793 unreachable!()
2794 }
2795 }
2796 #[allow(deprecated)]
2797 ordinal => {
2798 for _ in 0..num_handles {
2799 decoder.drop_next_handle()?;
2800 }
2801 *self = Duid::__SourceBreaking { unknown_ordinal: ordinal };
2802 }
2803 }
2804 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2805 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2806 }
2807 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2808 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2809 }
2810 Ok(())
2811 }
2812 }
2813
2814 impl fidl::encoding::ValueTypeMarker for LinkLayerAddress {
2815 type Borrowed<'a> = &'a Self;
2816 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2817 value
2818 }
2819 }
2820
2821 unsafe impl fidl::encoding::TypeMarker for LinkLayerAddress {
2822 type Owned = Self;
2823
2824 #[inline(always)]
2825 fn inline_align(_context: fidl::encoding::Context) -> usize {
2826 8
2827 }
2828
2829 #[inline(always)]
2830 fn inline_size(_context: fidl::encoding::Context) -> usize {
2831 16
2832 }
2833 }
2834
2835 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<LinkLayerAddress, D>
2836 for &LinkLayerAddress
2837 {
2838 #[inline]
2839 unsafe fn encode(
2840 self,
2841 encoder: &mut fidl::encoding::Encoder<'_, D>,
2842 offset: usize,
2843 _depth: fidl::encoding::Depth,
2844 ) -> fidl::Result<()> {
2845 encoder.debug_check_bounds::<LinkLayerAddress>(offset);
2846 encoder.write_num::<u64>(self.ordinal(), offset);
2847 match self {
2848 LinkLayerAddress::Ethernet(ref val) => fidl::encoding::encode_in_envelope::<
2849 fidl_fuchsia_net::MacAddress,
2850 D,
2851 >(
2852 <fidl_fuchsia_net::MacAddress as fidl::encoding::ValueTypeMarker>::borrow(val),
2853 encoder,
2854 offset + 8,
2855 _depth,
2856 ),
2857 LinkLayerAddress::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2858 }
2859 }
2860 }
2861
2862 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for LinkLayerAddress {
2863 #[inline(always)]
2864 fn new_empty() -> Self {
2865 Self::__SourceBreaking { unknown_ordinal: 0 }
2866 }
2867
2868 #[inline]
2869 unsafe fn decode(
2870 &mut self,
2871 decoder: &mut fidl::encoding::Decoder<'_, D>,
2872 offset: usize,
2873 mut depth: fidl::encoding::Depth,
2874 ) -> fidl::Result<()> {
2875 decoder.debug_check_bounds::<Self>(offset);
2876 #[allow(unused_variables)]
2877 let next_out_of_line = decoder.next_out_of_line();
2878 let handles_before = decoder.remaining_handles();
2879 let (ordinal, inlined, num_bytes, num_handles) =
2880 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2881
2882 let member_inline_size = match ordinal {
2883 1 => <fidl_fuchsia_net::MacAddress as fidl::encoding::TypeMarker>::inline_size(
2884 decoder.context,
2885 ),
2886 0 => return Err(fidl::Error::UnknownUnionTag),
2887 _ => num_bytes as usize,
2888 };
2889
2890 if inlined != (member_inline_size <= 4) {
2891 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2892 }
2893 let _inner_offset;
2894 if inlined {
2895 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2896 _inner_offset = offset + 8;
2897 } else {
2898 depth.increment()?;
2899 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2900 }
2901 match ordinal {
2902 1 => {
2903 #[allow(irrefutable_let_patterns)]
2904 if let LinkLayerAddress::Ethernet(_) = self {
2905 } else {
2907 *self = LinkLayerAddress::Ethernet(fidl::new_empty!(
2909 fidl_fuchsia_net::MacAddress,
2910 D
2911 ));
2912 }
2913 #[allow(irrefutable_let_patterns)]
2914 if let LinkLayerAddress::Ethernet(ref mut val) = self {
2915 fidl::decode!(
2916 fidl_fuchsia_net::MacAddress,
2917 D,
2918 val,
2919 decoder,
2920 _inner_offset,
2921 depth
2922 )?;
2923 } else {
2924 unreachable!()
2925 }
2926 }
2927 #[allow(deprecated)]
2928 ordinal => {
2929 for _ in 0..num_handles {
2930 decoder.drop_next_handle()?;
2931 }
2932 *self = LinkLayerAddress::__SourceBreaking { unknown_ordinal: ordinal };
2933 }
2934 }
2935 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2936 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2937 }
2938 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2939 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2940 }
2941 Ok(())
2942 }
2943 }
2944
2945 impl fidl::encoding::ValueTypeMarker for PrefixDelegationConfig {
2946 type Borrowed<'a> = &'a Self;
2947 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2948 value
2949 }
2950 }
2951
2952 unsafe impl fidl::encoding::TypeMarker for PrefixDelegationConfig {
2953 type Owned = Self;
2954
2955 #[inline(always)]
2956 fn inline_align(_context: fidl::encoding::Context) -> usize {
2957 8
2958 }
2959
2960 #[inline(always)]
2961 fn inline_size(_context: fidl::encoding::Context) -> usize {
2962 16
2963 }
2964 }
2965
2966 unsafe impl<D: fidl::encoding::ResourceDialect>
2967 fidl::encoding::Encode<PrefixDelegationConfig, D> for &PrefixDelegationConfig
2968 {
2969 #[inline]
2970 unsafe fn encode(
2971 self,
2972 encoder: &mut fidl::encoding::Encoder<'_, D>,
2973 offset: usize,
2974 _depth: fidl::encoding::Depth,
2975 ) -> fidl::Result<()> {
2976 encoder.debug_check_bounds::<PrefixDelegationConfig>(offset);
2977 encoder.write_num::<u64>(self.ordinal(), offset);
2978 match self {
2979 PrefixDelegationConfig::Empty(ref val) => {
2980 fidl::encoding::encode_in_envelope::<Empty, D>(
2981 <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
2982 encoder, offset + 8, _depth
2983 )
2984 }
2985 PrefixDelegationConfig::PrefixLength(ref val) => {
2986 fidl::encoding::encode_in_envelope::<u8, D>(
2987 <u8 as fidl::encoding::ValueTypeMarker>::borrow(val),
2988 encoder, offset + 8, _depth
2989 )
2990 }
2991 PrefixDelegationConfig::Prefix(ref val) => {
2992 fidl::encoding::encode_in_envelope::<fidl_fuchsia_net::Ipv6AddressWithPrefix, D>(
2993 <fidl_fuchsia_net::Ipv6AddressWithPrefix as fidl::encoding::ValueTypeMarker>::borrow(val),
2994 encoder, offset + 8, _depth
2995 )
2996 }
2997 }
2998 }
2999 }
3000
3001 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3002 for PrefixDelegationConfig
3003 {
3004 #[inline(always)]
3005 fn new_empty() -> Self {
3006 Self::Empty(fidl::new_empty!(Empty, D))
3007 }
3008
3009 #[inline]
3010 unsafe fn decode(
3011 &mut self,
3012 decoder: &mut fidl::encoding::Decoder<'_, D>,
3013 offset: usize,
3014 mut depth: fidl::encoding::Depth,
3015 ) -> fidl::Result<()> {
3016 decoder.debug_check_bounds::<Self>(offset);
3017 #[allow(unused_variables)]
3018 let next_out_of_line = decoder.next_out_of_line();
3019 let handles_before = decoder.remaining_handles();
3020 let (ordinal, inlined, num_bytes, num_handles) =
3021 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3022
3023 let member_inline_size = match ordinal {
3024 1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3025 2 => <u8 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3026 3 => <fidl_fuchsia_net::Ipv6AddressWithPrefix as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3027 _ => return Err(fidl::Error::UnknownUnionTag),
3028 };
3029
3030 if inlined != (member_inline_size <= 4) {
3031 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3032 }
3033 let _inner_offset;
3034 if inlined {
3035 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3036 _inner_offset = offset + 8;
3037 } else {
3038 depth.increment()?;
3039 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3040 }
3041 match ordinal {
3042 1 => {
3043 #[allow(irrefutable_let_patterns)]
3044 if let PrefixDelegationConfig::Empty(_) = self {
3045 } else {
3047 *self = PrefixDelegationConfig::Empty(fidl::new_empty!(Empty, D));
3049 }
3050 #[allow(irrefutable_let_patterns)]
3051 if let PrefixDelegationConfig::Empty(ref mut val) = self {
3052 fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
3053 } else {
3054 unreachable!()
3055 }
3056 }
3057 2 => {
3058 #[allow(irrefutable_let_patterns)]
3059 if let PrefixDelegationConfig::PrefixLength(_) = self {
3060 } else {
3062 *self = PrefixDelegationConfig::PrefixLength(fidl::new_empty!(u8, D));
3064 }
3065 #[allow(irrefutable_let_patterns)]
3066 if let PrefixDelegationConfig::PrefixLength(ref mut val) = self {
3067 fidl::decode!(u8, D, val, decoder, _inner_offset, depth)?;
3068 } else {
3069 unreachable!()
3070 }
3071 }
3072 3 => {
3073 #[allow(irrefutable_let_patterns)]
3074 if let PrefixDelegationConfig::Prefix(_) = self {
3075 } else {
3077 *self = PrefixDelegationConfig::Prefix(fidl::new_empty!(
3079 fidl_fuchsia_net::Ipv6AddressWithPrefix,
3080 D
3081 ));
3082 }
3083 #[allow(irrefutable_let_patterns)]
3084 if let PrefixDelegationConfig::Prefix(ref mut val) = self {
3085 fidl::decode!(
3086 fidl_fuchsia_net::Ipv6AddressWithPrefix,
3087 D,
3088 val,
3089 decoder,
3090 _inner_offset,
3091 depth
3092 )?;
3093 } else {
3094 unreachable!()
3095 }
3096 }
3097 ordinal => panic!("unexpected ordinal {:?}", ordinal),
3098 }
3099 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3100 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3101 }
3102 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3103 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3104 }
3105 Ok(())
3106 }
3107 }
3108
3109 impl fidl::encoding::ValueTypeMarker for PrefixEvent {
3110 type Borrowed<'a> = &'a Self;
3111 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3112 value
3113 }
3114 }
3115
3116 unsafe impl fidl::encoding::TypeMarker for PrefixEvent {
3117 type Owned = Self;
3118
3119 #[inline(always)]
3120 fn inline_align(_context: fidl::encoding::Context) -> usize {
3121 8
3122 }
3123
3124 #[inline(always)]
3125 fn inline_size(_context: fidl::encoding::Context) -> usize {
3126 16
3127 }
3128 }
3129
3130 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<PrefixEvent, D>
3131 for &PrefixEvent
3132 {
3133 #[inline]
3134 unsafe fn encode(
3135 self,
3136 encoder: &mut fidl::encoding::Encoder<'_, D>,
3137 offset: usize,
3138 _depth: fidl::encoding::Depth,
3139 ) -> fidl::Result<()> {
3140 encoder.debug_check_bounds::<PrefixEvent>(offset);
3141 encoder.write_num::<u64>(self.ordinal(), offset);
3142 match self {
3143 PrefixEvent::Unassigned(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
3144 <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
3145 encoder,
3146 offset + 8,
3147 _depth,
3148 ),
3149 PrefixEvent::Assigned(ref val) => fidl::encoding::encode_in_envelope::<Prefix, D>(
3150 <Prefix as fidl::encoding::ValueTypeMarker>::borrow(val),
3151 encoder,
3152 offset + 8,
3153 _depth,
3154 ),
3155 }
3156 }
3157 }
3158
3159 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for PrefixEvent {
3160 #[inline(always)]
3161 fn new_empty() -> Self {
3162 Self::Unassigned(fidl::new_empty!(Empty, D))
3163 }
3164
3165 #[inline]
3166 unsafe fn decode(
3167 &mut self,
3168 decoder: &mut fidl::encoding::Decoder<'_, D>,
3169 offset: usize,
3170 mut depth: fidl::encoding::Depth,
3171 ) -> fidl::Result<()> {
3172 decoder.debug_check_bounds::<Self>(offset);
3173 #[allow(unused_variables)]
3174 let next_out_of_line = decoder.next_out_of_line();
3175 let handles_before = decoder.remaining_handles();
3176 let (ordinal, inlined, num_bytes, num_handles) =
3177 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3178
3179 let member_inline_size = match ordinal {
3180 1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3181 2 => <Prefix as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3182 _ => return Err(fidl::Error::UnknownUnionTag),
3183 };
3184
3185 if inlined != (member_inline_size <= 4) {
3186 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3187 }
3188 let _inner_offset;
3189 if inlined {
3190 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3191 _inner_offset = offset + 8;
3192 } else {
3193 depth.increment()?;
3194 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3195 }
3196 match ordinal {
3197 1 => {
3198 #[allow(irrefutable_let_patterns)]
3199 if let PrefixEvent::Unassigned(_) = self {
3200 } else {
3202 *self = PrefixEvent::Unassigned(fidl::new_empty!(Empty, D));
3204 }
3205 #[allow(irrefutable_let_patterns)]
3206 if let PrefixEvent::Unassigned(ref mut val) = self {
3207 fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
3208 } else {
3209 unreachable!()
3210 }
3211 }
3212 2 => {
3213 #[allow(irrefutable_let_patterns)]
3214 if let PrefixEvent::Assigned(_) = self {
3215 } else {
3217 *self = PrefixEvent::Assigned(fidl::new_empty!(Prefix, D));
3219 }
3220 #[allow(irrefutable_let_patterns)]
3221 if let PrefixEvent::Assigned(ref mut val) = self {
3222 fidl::decode!(Prefix, D, val, decoder, _inner_offset, depth)?;
3223 } else {
3224 unreachable!()
3225 }
3226 }
3227 ordinal => panic!("unexpected ordinal {:?}", ordinal),
3228 }
3229 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3230 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3231 }
3232 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3233 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3234 }
3235 Ok(())
3236 }
3237 }
3238}