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
11#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
12pub enum InterfaceRemovalReason {
13 OnlyOnePortSupported,
16 #[doc(hidden)]
17 __SourceBreaking { unknown_ordinal: u32 },
18}
19
20#[macro_export]
22macro_rules! InterfaceRemovalReasonUnknown {
23 () => {
24 _
25 };
26}
27
28impl InterfaceRemovalReason {
29 #[inline]
30 pub fn from_primitive(prim: u32) -> Option<Self> {
31 match prim {
32 1 => Some(Self::OnlyOnePortSupported),
33 _ => None,
34 }
35 }
36
37 #[inline]
38 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
39 match prim {
40 1 => Self::OnlyOnePortSupported,
41 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
42 }
43 }
44
45 #[inline]
46 pub fn unknown() -> Self {
47 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
48 }
49
50 #[inline]
51 pub const fn into_primitive(self) -> u32 {
52 match self {
53 Self::OnlyOnePortSupported => 1,
54 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
55 }
56 }
57
58 #[inline]
59 pub fn is_unknown(&self) -> bool {
60 match self {
61 Self::__SourceBreaking { unknown_ordinal: _ } => true,
62 _ => false,
63 }
64 }
65}
66
67#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
68pub enum NetworkRemovalReason {
69 InvalidConfig,
71 #[doc(hidden)]
72 __SourceBreaking { unknown_ordinal: u32 },
73}
74
75#[macro_export]
77macro_rules! NetworkRemovalReasonUnknown {
78 () => {
79 _
80 };
81}
82
83impl NetworkRemovalReason {
84 #[inline]
85 pub fn from_primitive(prim: u32) -> Option<Self> {
86 match prim {
87 1 => Some(Self::InvalidConfig),
88 _ => None,
89 }
90 }
91
92 #[inline]
93 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
94 match prim {
95 1 => Self::InvalidConfig,
96 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
97 }
98 }
99
100 #[inline]
101 pub fn unknown() -> Self {
102 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
103 }
104
105 #[inline]
106 pub const fn into_primitive(self) -> u32 {
107 match self {
108 Self::InvalidConfig => 1,
109 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
110 }
111 }
112
113 #[inline]
114 pub fn is_unknown(&self) -> bool {
115 match self {
116 Self::__SourceBreaking { unknown_ordinal: _ } => true,
117 _ => false,
118 }
119 }
120}
121
122#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
123pub struct InterfaceOnRemovedRequest {
124 pub reason: InterfaceRemovalReason,
125}
126
127impl fidl::Persistable for InterfaceOnRemovedRequest {}
128
129#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
130pub struct NetworkOnRemovedRequest {
131 pub reason: NetworkRemovalReason,
132}
133
134impl fidl::Persistable for NetworkOnRemovedRequest {}
135
136#[derive(Clone, Debug, Default, PartialEq)]
137pub struct Bridged {
138 #[doc(hidden)]
139 pub __source_breaking: fidl::marker::SourceBreaking,
140}
141
142impl fidl::Persistable for Bridged {}
143
144#[derive(Clone, Debug, Default, PartialEq)]
145pub struct IPv4NatConfig {
146 #[doc(hidden)]
147 pub __source_breaking: fidl::marker::SourceBreaking,
148}
149
150impl fidl::Persistable for IPv4NatConfig {}
151
152#[derive(Clone, Debug, Default, PartialEq)]
153pub struct Ipv4Config {
154 pub addr_config: Option<Ipv4AddressConfig>,
158 pub connectivity: Option<Ipv4Connectivity>,
164 #[doc(hidden)]
165 pub __source_breaking: fidl::marker::SourceBreaking,
166}
167
168impl fidl::Persistable for Ipv4Config {}
169
170#[derive(Clone, Debug, Default, PartialEq)]
171pub struct Ipv4RoutedConfig {
172 pub nat: Option<IPv4NatConfig>,
178 #[doc(hidden)]
179 pub __source_breaking: fidl::marker::SourceBreaking,
180}
181
182impl fidl::Persistable for Ipv4RoutedConfig {}
183
184#[derive(Clone, Debug, Default, PartialEq)]
185pub struct Networked {
186 pub ipv4: Option<Ipv4Config>,
193 #[doc(hidden)]
194 pub __source_breaking: fidl::marker::SourceBreaking,
195}
196
197impl fidl::Persistable for Networked {}
198
199#[derive(Clone, Debug)]
200pub enum Config {
201 Bridged(Bridged),
209 Networked(Networked),
212 #[doc(hidden)]
213 __SourceBreaking { unknown_ordinal: u64 },
214}
215
216#[macro_export]
218macro_rules! ConfigUnknown {
219 () => {
220 _
221 };
222}
223
224impl PartialEq for Config {
226 fn eq(&self, other: &Self) -> bool {
227 match (self, other) {
228 (Self::Bridged(x), Self::Bridged(y)) => *x == *y,
229 (Self::Networked(x), Self::Networked(y)) => *x == *y,
230 _ => false,
231 }
232 }
233}
234
235impl Config {
236 #[inline]
237 pub fn ordinal(&self) -> u64 {
238 match *self {
239 Self::Bridged(_) => 1,
240 Self::Networked(_) => 2,
241 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
242 }
243 }
244
245 #[inline]
246 pub fn unknown_variant_for_testing() -> Self {
247 Self::__SourceBreaking { unknown_ordinal: 0 }
248 }
249
250 #[inline]
251 pub fn is_unknown(&self) -> bool {
252 match self {
253 Self::__SourceBreaking { .. } => true,
254 _ => false,
255 }
256 }
257}
258
259impl fidl::Persistable for Config {}
260
261#[derive(Clone, Debug)]
262pub enum Ipv4AddressConfig {
263 Static_(fidl_fuchsia_net::Ipv4AddressWithPrefix),
267 #[doc(hidden)]
268 __SourceBreaking { unknown_ordinal: u64 },
269}
270
271#[macro_export]
273macro_rules! Ipv4AddressConfigUnknown {
274 () => {
275 _
276 };
277}
278
279impl PartialEq for Ipv4AddressConfig {
281 fn eq(&self, other: &Self) -> bool {
282 match (self, other) {
283 (Self::Static_(x), Self::Static_(y)) => *x == *y,
284 _ => false,
285 }
286 }
287}
288
289impl Ipv4AddressConfig {
290 #[inline]
291 pub fn ordinal(&self) -> u64 {
292 match *self {
293 Self::Static_(_) => 1,
294 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
295 }
296 }
297
298 #[inline]
299 pub fn unknown_variant_for_testing() -> Self {
300 Self::__SourceBreaking { unknown_ordinal: 0 }
301 }
302
303 #[inline]
304 pub fn is_unknown(&self) -> bool {
305 match self {
306 Self::__SourceBreaking { .. } => true,
307 _ => false,
308 }
309 }
310}
311
312impl fidl::Persistable for Ipv4AddressConfig {}
313
314#[derive(Clone, Debug)]
315pub enum Ipv4Connectivity {
316 Routed(Ipv4RoutedConfig),
321 #[doc(hidden)]
322 __SourceBreaking { unknown_ordinal: u64 },
323}
324
325#[macro_export]
327macro_rules! Ipv4ConnectivityUnknown {
328 () => {
329 _
330 };
331}
332
333impl PartialEq for Ipv4Connectivity {
335 fn eq(&self, other: &Self) -> bool {
336 match (self, other) {
337 (Self::Routed(x), Self::Routed(y)) => *x == *y,
338 _ => false,
339 }
340 }
341}
342
343impl Ipv4Connectivity {
344 #[inline]
345 pub fn ordinal(&self) -> u64 {
346 match *self {
347 Self::Routed(_) => 1,
348 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
349 }
350 }
351
352 #[inline]
353 pub fn unknown_variant_for_testing() -> Self {
354 Self::__SourceBreaking { unknown_ordinal: 0 }
355 }
356
357 #[inline]
358 pub fn is_unknown(&self) -> bool {
359 match self {
360 Self::__SourceBreaking { .. } => true,
361 _ => false,
362 }
363 }
364}
365
366impl fidl::Persistable for Ipv4Connectivity {}
367
368mod internal {
369 use super::*;
370 unsafe impl fidl::encoding::TypeMarker for InterfaceRemovalReason {
371 type Owned = Self;
372
373 #[inline(always)]
374 fn inline_align(_context: fidl::encoding::Context) -> usize {
375 std::mem::align_of::<u32>()
376 }
377
378 #[inline(always)]
379 fn inline_size(_context: fidl::encoding::Context) -> usize {
380 std::mem::size_of::<u32>()
381 }
382
383 #[inline(always)]
384 fn encode_is_copy() -> bool {
385 false
386 }
387
388 #[inline(always)]
389 fn decode_is_copy() -> bool {
390 false
391 }
392 }
393
394 impl fidl::encoding::ValueTypeMarker for InterfaceRemovalReason {
395 type Borrowed<'a> = Self;
396 #[inline(always)]
397 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
398 *value
399 }
400 }
401
402 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
403 for InterfaceRemovalReason
404 {
405 #[inline]
406 unsafe fn encode(
407 self,
408 encoder: &mut fidl::encoding::Encoder<'_, D>,
409 offset: usize,
410 _depth: fidl::encoding::Depth,
411 ) -> fidl::Result<()> {
412 encoder.debug_check_bounds::<Self>(offset);
413 encoder.write_num(self.into_primitive(), offset);
414 Ok(())
415 }
416 }
417
418 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
419 for InterfaceRemovalReason
420 {
421 #[inline(always)]
422 fn new_empty() -> Self {
423 Self::unknown()
424 }
425
426 #[inline]
427 unsafe fn decode(
428 &mut self,
429 decoder: &mut fidl::encoding::Decoder<'_, D>,
430 offset: usize,
431 _depth: fidl::encoding::Depth,
432 ) -> fidl::Result<()> {
433 decoder.debug_check_bounds::<Self>(offset);
434 let prim = decoder.read_num::<u32>(offset);
435
436 *self = Self::from_primitive_allow_unknown(prim);
437 Ok(())
438 }
439 }
440 unsafe impl fidl::encoding::TypeMarker for NetworkRemovalReason {
441 type Owned = Self;
442
443 #[inline(always)]
444 fn inline_align(_context: fidl::encoding::Context) -> usize {
445 std::mem::align_of::<u32>()
446 }
447
448 #[inline(always)]
449 fn inline_size(_context: fidl::encoding::Context) -> usize {
450 std::mem::size_of::<u32>()
451 }
452
453 #[inline(always)]
454 fn encode_is_copy() -> bool {
455 false
456 }
457
458 #[inline(always)]
459 fn decode_is_copy() -> bool {
460 false
461 }
462 }
463
464 impl fidl::encoding::ValueTypeMarker for NetworkRemovalReason {
465 type Borrowed<'a> = Self;
466 #[inline(always)]
467 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
468 *value
469 }
470 }
471
472 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
473 for NetworkRemovalReason
474 {
475 #[inline]
476 unsafe fn encode(
477 self,
478 encoder: &mut fidl::encoding::Encoder<'_, D>,
479 offset: usize,
480 _depth: fidl::encoding::Depth,
481 ) -> fidl::Result<()> {
482 encoder.debug_check_bounds::<Self>(offset);
483 encoder.write_num(self.into_primitive(), offset);
484 Ok(())
485 }
486 }
487
488 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NetworkRemovalReason {
489 #[inline(always)]
490 fn new_empty() -> Self {
491 Self::unknown()
492 }
493
494 #[inline]
495 unsafe fn decode(
496 &mut self,
497 decoder: &mut fidl::encoding::Decoder<'_, D>,
498 offset: usize,
499 _depth: fidl::encoding::Depth,
500 ) -> fidl::Result<()> {
501 decoder.debug_check_bounds::<Self>(offset);
502 let prim = decoder.read_num::<u32>(offset);
503
504 *self = Self::from_primitive_allow_unknown(prim);
505 Ok(())
506 }
507 }
508
509 impl fidl::encoding::ValueTypeMarker for InterfaceOnRemovedRequest {
510 type Borrowed<'a> = &'a Self;
511 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
512 value
513 }
514 }
515
516 unsafe impl fidl::encoding::TypeMarker for InterfaceOnRemovedRequest {
517 type Owned = Self;
518
519 #[inline(always)]
520 fn inline_align(_context: fidl::encoding::Context) -> usize {
521 4
522 }
523
524 #[inline(always)]
525 fn inline_size(_context: fidl::encoding::Context) -> usize {
526 4
527 }
528 }
529
530 unsafe impl<D: fidl::encoding::ResourceDialect>
531 fidl::encoding::Encode<InterfaceOnRemovedRequest, D> for &InterfaceOnRemovedRequest
532 {
533 #[inline]
534 unsafe fn encode(
535 self,
536 encoder: &mut fidl::encoding::Encoder<'_, D>,
537 offset: usize,
538 _depth: fidl::encoding::Depth,
539 ) -> fidl::Result<()> {
540 encoder.debug_check_bounds::<InterfaceOnRemovedRequest>(offset);
541 fidl::encoding::Encode::<InterfaceOnRemovedRequest, D>::encode(
543 (<InterfaceRemovalReason as fidl::encoding::ValueTypeMarker>::borrow(&self.reason),),
544 encoder,
545 offset,
546 _depth,
547 )
548 }
549 }
550 unsafe impl<
551 D: fidl::encoding::ResourceDialect,
552 T0: fidl::encoding::Encode<InterfaceRemovalReason, D>,
553 > fidl::encoding::Encode<InterfaceOnRemovedRequest, D> for (T0,)
554 {
555 #[inline]
556 unsafe fn encode(
557 self,
558 encoder: &mut fidl::encoding::Encoder<'_, D>,
559 offset: usize,
560 depth: fidl::encoding::Depth,
561 ) -> fidl::Result<()> {
562 encoder.debug_check_bounds::<InterfaceOnRemovedRequest>(offset);
563 self.0.encode(encoder, offset + 0, depth)?;
567 Ok(())
568 }
569 }
570
571 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
572 for InterfaceOnRemovedRequest
573 {
574 #[inline(always)]
575 fn new_empty() -> Self {
576 Self { reason: fidl::new_empty!(InterfaceRemovalReason, D) }
577 }
578
579 #[inline]
580 unsafe fn decode(
581 &mut self,
582 decoder: &mut fidl::encoding::Decoder<'_, D>,
583 offset: usize,
584 _depth: fidl::encoding::Depth,
585 ) -> fidl::Result<()> {
586 decoder.debug_check_bounds::<Self>(offset);
587 fidl::decode!(
589 InterfaceRemovalReason,
590 D,
591 &mut self.reason,
592 decoder,
593 offset + 0,
594 _depth
595 )?;
596 Ok(())
597 }
598 }
599
600 impl fidl::encoding::ValueTypeMarker for NetworkOnRemovedRequest {
601 type Borrowed<'a> = &'a Self;
602 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
603 value
604 }
605 }
606
607 unsafe impl fidl::encoding::TypeMarker for NetworkOnRemovedRequest {
608 type Owned = Self;
609
610 #[inline(always)]
611 fn inline_align(_context: fidl::encoding::Context) -> usize {
612 4
613 }
614
615 #[inline(always)]
616 fn inline_size(_context: fidl::encoding::Context) -> usize {
617 4
618 }
619 }
620
621 unsafe impl<D: fidl::encoding::ResourceDialect>
622 fidl::encoding::Encode<NetworkOnRemovedRequest, D> for &NetworkOnRemovedRequest
623 {
624 #[inline]
625 unsafe fn encode(
626 self,
627 encoder: &mut fidl::encoding::Encoder<'_, D>,
628 offset: usize,
629 _depth: fidl::encoding::Depth,
630 ) -> fidl::Result<()> {
631 encoder.debug_check_bounds::<NetworkOnRemovedRequest>(offset);
632 fidl::encoding::Encode::<NetworkOnRemovedRequest, D>::encode(
634 (<NetworkRemovalReason as fidl::encoding::ValueTypeMarker>::borrow(&self.reason),),
635 encoder,
636 offset,
637 _depth,
638 )
639 }
640 }
641 unsafe impl<
642 D: fidl::encoding::ResourceDialect,
643 T0: fidl::encoding::Encode<NetworkRemovalReason, D>,
644 > fidl::encoding::Encode<NetworkOnRemovedRequest, D> for (T0,)
645 {
646 #[inline]
647 unsafe fn encode(
648 self,
649 encoder: &mut fidl::encoding::Encoder<'_, D>,
650 offset: usize,
651 depth: fidl::encoding::Depth,
652 ) -> fidl::Result<()> {
653 encoder.debug_check_bounds::<NetworkOnRemovedRequest>(offset);
654 self.0.encode(encoder, offset + 0, depth)?;
658 Ok(())
659 }
660 }
661
662 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
663 for NetworkOnRemovedRequest
664 {
665 #[inline(always)]
666 fn new_empty() -> Self {
667 Self { reason: fidl::new_empty!(NetworkRemovalReason, D) }
668 }
669
670 #[inline]
671 unsafe fn decode(
672 &mut self,
673 decoder: &mut fidl::encoding::Decoder<'_, D>,
674 offset: usize,
675 _depth: fidl::encoding::Depth,
676 ) -> fidl::Result<()> {
677 decoder.debug_check_bounds::<Self>(offset);
678 fidl::decode!(NetworkRemovalReason, D, &mut self.reason, decoder, offset + 0, _depth)?;
680 Ok(())
681 }
682 }
683
684 impl Bridged {
685 #[inline(always)]
686 fn max_ordinal_present(&self) -> u64 {
687 0
688 }
689 }
690
691 impl fidl::encoding::ValueTypeMarker for Bridged {
692 type Borrowed<'a> = &'a Self;
693 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
694 value
695 }
696 }
697
698 unsafe impl fidl::encoding::TypeMarker for Bridged {
699 type Owned = Self;
700
701 #[inline(always)]
702 fn inline_align(_context: fidl::encoding::Context) -> usize {
703 8
704 }
705
706 #[inline(always)]
707 fn inline_size(_context: fidl::encoding::Context) -> usize {
708 16
709 }
710 }
711
712 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Bridged, D> for &Bridged {
713 unsafe fn encode(
714 self,
715 encoder: &mut fidl::encoding::Encoder<'_, D>,
716 offset: usize,
717 mut depth: fidl::encoding::Depth,
718 ) -> fidl::Result<()> {
719 encoder.debug_check_bounds::<Bridged>(offset);
720 let max_ordinal: u64 = self.max_ordinal_present();
722 encoder.write_num(max_ordinal, offset);
723 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
724 if max_ordinal == 0 {
726 return Ok(());
727 }
728 depth.increment()?;
729 let envelope_size = 8;
730 let bytes_len = max_ordinal as usize * envelope_size;
731 #[allow(unused_variables)]
732 let offset = encoder.out_of_line_offset(bytes_len);
733 let mut _prev_end_offset: usize = 0;
734
735 Ok(())
736 }
737 }
738
739 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Bridged {
740 #[inline(always)]
741 fn new_empty() -> Self {
742 Self::default()
743 }
744
745 unsafe fn decode(
746 &mut self,
747 decoder: &mut fidl::encoding::Decoder<'_, D>,
748 offset: usize,
749 mut depth: fidl::encoding::Depth,
750 ) -> fidl::Result<()> {
751 decoder.debug_check_bounds::<Self>(offset);
752 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
753 None => return Err(fidl::Error::NotNullable),
754 Some(len) => len,
755 };
756 if len == 0 {
758 return Ok(());
759 };
760 depth.increment()?;
761 let envelope_size = 8;
762 let bytes_len = len * envelope_size;
763 let offset = decoder.out_of_line_offset(bytes_len)?;
764 let mut _next_ordinal_to_read = 0;
766 let mut next_offset = offset;
767 let end_offset = offset + bytes_len;
768
769 while next_offset < end_offset {
771 _next_ordinal_to_read += 1;
772 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
773 next_offset += envelope_size;
774 }
775
776 Ok(())
777 }
778 }
779
780 impl IPv4NatConfig {
781 #[inline(always)]
782 fn max_ordinal_present(&self) -> u64 {
783 0
784 }
785 }
786
787 impl fidl::encoding::ValueTypeMarker for IPv4NatConfig {
788 type Borrowed<'a> = &'a Self;
789 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
790 value
791 }
792 }
793
794 unsafe impl fidl::encoding::TypeMarker for IPv4NatConfig {
795 type Owned = Self;
796
797 #[inline(always)]
798 fn inline_align(_context: fidl::encoding::Context) -> usize {
799 8
800 }
801
802 #[inline(always)]
803 fn inline_size(_context: fidl::encoding::Context) -> usize {
804 16
805 }
806 }
807
808 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<IPv4NatConfig, D>
809 for &IPv4NatConfig
810 {
811 unsafe fn encode(
812 self,
813 encoder: &mut fidl::encoding::Encoder<'_, D>,
814 offset: usize,
815 mut depth: fidl::encoding::Depth,
816 ) -> fidl::Result<()> {
817 encoder.debug_check_bounds::<IPv4NatConfig>(offset);
818 let max_ordinal: u64 = self.max_ordinal_present();
820 encoder.write_num(max_ordinal, offset);
821 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
822 if max_ordinal == 0 {
824 return Ok(());
825 }
826 depth.increment()?;
827 let envelope_size = 8;
828 let bytes_len = max_ordinal as usize * envelope_size;
829 #[allow(unused_variables)]
830 let offset = encoder.out_of_line_offset(bytes_len);
831 let mut _prev_end_offset: usize = 0;
832
833 Ok(())
834 }
835 }
836
837 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IPv4NatConfig {
838 #[inline(always)]
839 fn new_empty() -> Self {
840 Self::default()
841 }
842
843 unsafe fn decode(
844 &mut self,
845 decoder: &mut fidl::encoding::Decoder<'_, D>,
846 offset: usize,
847 mut depth: fidl::encoding::Depth,
848 ) -> fidl::Result<()> {
849 decoder.debug_check_bounds::<Self>(offset);
850 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
851 None => return Err(fidl::Error::NotNullable),
852 Some(len) => len,
853 };
854 if len == 0 {
856 return Ok(());
857 };
858 depth.increment()?;
859 let envelope_size = 8;
860 let bytes_len = len * envelope_size;
861 let offset = decoder.out_of_line_offset(bytes_len)?;
862 let mut _next_ordinal_to_read = 0;
864 let mut next_offset = offset;
865 let end_offset = offset + bytes_len;
866
867 while next_offset < end_offset {
869 _next_ordinal_to_read += 1;
870 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
871 next_offset += envelope_size;
872 }
873
874 Ok(())
875 }
876 }
877
878 impl Ipv4Config {
879 #[inline(always)]
880 fn max_ordinal_present(&self) -> u64 {
881 if let Some(_) = self.connectivity {
882 return 2;
883 }
884 if let Some(_) = self.addr_config {
885 return 1;
886 }
887 0
888 }
889 }
890
891 impl fidl::encoding::ValueTypeMarker for Ipv4Config {
892 type Borrowed<'a> = &'a Self;
893 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
894 value
895 }
896 }
897
898 unsafe impl fidl::encoding::TypeMarker for Ipv4Config {
899 type Owned = Self;
900
901 #[inline(always)]
902 fn inline_align(_context: fidl::encoding::Context) -> usize {
903 8
904 }
905
906 #[inline(always)]
907 fn inline_size(_context: fidl::encoding::Context) -> usize {
908 16
909 }
910 }
911
912 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Ipv4Config, D>
913 for &Ipv4Config
914 {
915 unsafe fn encode(
916 self,
917 encoder: &mut fidl::encoding::Encoder<'_, D>,
918 offset: usize,
919 mut depth: fidl::encoding::Depth,
920 ) -> fidl::Result<()> {
921 encoder.debug_check_bounds::<Ipv4Config>(offset);
922 let max_ordinal: u64 = self.max_ordinal_present();
924 encoder.write_num(max_ordinal, offset);
925 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
926 if max_ordinal == 0 {
928 return Ok(());
929 }
930 depth.increment()?;
931 let envelope_size = 8;
932 let bytes_len = max_ordinal as usize * envelope_size;
933 #[allow(unused_variables)]
934 let offset = encoder.out_of_line_offset(bytes_len);
935 let mut _prev_end_offset: usize = 0;
936 if 1 > max_ordinal {
937 return Ok(());
938 }
939
940 let cur_offset: usize = (1 - 1) * envelope_size;
943
944 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
946
947 fidl::encoding::encode_in_envelope_optional::<Ipv4AddressConfig, D>(
952 self.addr_config
953 .as_ref()
954 .map(<Ipv4AddressConfig as fidl::encoding::ValueTypeMarker>::borrow),
955 encoder,
956 offset + cur_offset,
957 depth,
958 )?;
959
960 _prev_end_offset = cur_offset + envelope_size;
961 if 2 > max_ordinal {
962 return Ok(());
963 }
964
965 let cur_offset: usize = (2 - 1) * envelope_size;
968
969 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
971
972 fidl::encoding::encode_in_envelope_optional::<Ipv4Connectivity, D>(
977 self.connectivity
978 .as_ref()
979 .map(<Ipv4Connectivity as fidl::encoding::ValueTypeMarker>::borrow),
980 encoder,
981 offset + cur_offset,
982 depth,
983 )?;
984
985 _prev_end_offset = cur_offset + envelope_size;
986
987 Ok(())
988 }
989 }
990
991 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Ipv4Config {
992 #[inline(always)]
993 fn new_empty() -> Self {
994 Self::default()
995 }
996
997 unsafe fn decode(
998 &mut self,
999 decoder: &mut fidl::encoding::Decoder<'_, D>,
1000 offset: usize,
1001 mut depth: fidl::encoding::Depth,
1002 ) -> fidl::Result<()> {
1003 decoder.debug_check_bounds::<Self>(offset);
1004 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1005 None => return Err(fidl::Error::NotNullable),
1006 Some(len) => len,
1007 };
1008 if len == 0 {
1010 return Ok(());
1011 };
1012 depth.increment()?;
1013 let envelope_size = 8;
1014 let bytes_len = len * envelope_size;
1015 let offset = decoder.out_of_line_offset(bytes_len)?;
1016 let mut _next_ordinal_to_read = 0;
1018 let mut next_offset = offset;
1019 let end_offset = offset + bytes_len;
1020 _next_ordinal_to_read += 1;
1021 if next_offset >= end_offset {
1022 return Ok(());
1023 }
1024
1025 while _next_ordinal_to_read < 1 {
1027 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1028 _next_ordinal_to_read += 1;
1029 next_offset += envelope_size;
1030 }
1031
1032 let next_out_of_line = decoder.next_out_of_line();
1033 let handles_before = decoder.remaining_handles();
1034 if let Some((inlined, num_bytes, num_handles)) =
1035 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1036 {
1037 let member_inline_size =
1038 <Ipv4AddressConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1039 if inlined != (member_inline_size <= 4) {
1040 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1041 }
1042 let inner_offset;
1043 let mut inner_depth = depth.clone();
1044 if inlined {
1045 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1046 inner_offset = next_offset;
1047 } else {
1048 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1049 inner_depth.increment()?;
1050 }
1051 let val_ref =
1052 self.addr_config.get_or_insert_with(|| fidl::new_empty!(Ipv4AddressConfig, D));
1053 fidl::decode!(Ipv4AddressConfig, D, val_ref, decoder, inner_offset, inner_depth)?;
1054 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1055 {
1056 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1057 }
1058 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1059 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1060 }
1061 }
1062
1063 next_offset += envelope_size;
1064 _next_ordinal_to_read += 1;
1065 if next_offset >= end_offset {
1066 return Ok(());
1067 }
1068
1069 while _next_ordinal_to_read < 2 {
1071 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1072 _next_ordinal_to_read += 1;
1073 next_offset += envelope_size;
1074 }
1075
1076 let next_out_of_line = decoder.next_out_of_line();
1077 let handles_before = decoder.remaining_handles();
1078 if let Some((inlined, num_bytes, num_handles)) =
1079 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1080 {
1081 let member_inline_size =
1082 <Ipv4Connectivity as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1083 if inlined != (member_inline_size <= 4) {
1084 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1085 }
1086 let inner_offset;
1087 let mut inner_depth = depth.clone();
1088 if inlined {
1089 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1090 inner_offset = next_offset;
1091 } else {
1092 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1093 inner_depth.increment()?;
1094 }
1095 let val_ref =
1096 self.connectivity.get_or_insert_with(|| fidl::new_empty!(Ipv4Connectivity, D));
1097 fidl::decode!(Ipv4Connectivity, D, val_ref, decoder, inner_offset, inner_depth)?;
1098 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1099 {
1100 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1101 }
1102 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1103 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1104 }
1105 }
1106
1107 next_offset += envelope_size;
1108
1109 while next_offset < end_offset {
1111 _next_ordinal_to_read += 1;
1112 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1113 next_offset += envelope_size;
1114 }
1115
1116 Ok(())
1117 }
1118 }
1119
1120 impl Ipv4RoutedConfig {
1121 #[inline(always)]
1122 fn max_ordinal_present(&self) -> u64 {
1123 if let Some(_) = self.nat {
1124 return 1;
1125 }
1126 0
1127 }
1128 }
1129
1130 impl fidl::encoding::ValueTypeMarker for Ipv4RoutedConfig {
1131 type Borrowed<'a> = &'a Self;
1132 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1133 value
1134 }
1135 }
1136
1137 unsafe impl fidl::encoding::TypeMarker for Ipv4RoutedConfig {
1138 type Owned = Self;
1139
1140 #[inline(always)]
1141 fn inline_align(_context: fidl::encoding::Context) -> usize {
1142 8
1143 }
1144
1145 #[inline(always)]
1146 fn inline_size(_context: fidl::encoding::Context) -> usize {
1147 16
1148 }
1149 }
1150
1151 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Ipv4RoutedConfig, D>
1152 for &Ipv4RoutedConfig
1153 {
1154 unsafe fn encode(
1155 self,
1156 encoder: &mut fidl::encoding::Encoder<'_, D>,
1157 offset: usize,
1158 mut depth: fidl::encoding::Depth,
1159 ) -> fidl::Result<()> {
1160 encoder.debug_check_bounds::<Ipv4RoutedConfig>(offset);
1161 let max_ordinal: u64 = self.max_ordinal_present();
1163 encoder.write_num(max_ordinal, offset);
1164 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1165 if max_ordinal == 0 {
1167 return Ok(());
1168 }
1169 depth.increment()?;
1170 let envelope_size = 8;
1171 let bytes_len = max_ordinal as usize * envelope_size;
1172 #[allow(unused_variables)]
1173 let offset = encoder.out_of_line_offset(bytes_len);
1174 let mut _prev_end_offset: usize = 0;
1175 if 1 > max_ordinal {
1176 return Ok(());
1177 }
1178
1179 let cur_offset: usize = (1 - 1) * envelope_size;
1182
1183 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1185
1186 fidl::encoding::encode_in_envelope_optional::<IPv4NatConfig, D>(
1191 self.nat.as_ref().map(<IPv4NatConfig as fidl::encoding::ValueTypeMarker>::borrow),
1192 encoder,
1193 offset + cur_offset,
1194 depth,
1195 )?;
1196
1197 _prev_end_offset = cur_offset + envelope_size;
1198
1199 Ok(())
1200 }
1201 }
1202
1203 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Ipv4RoutedConfig {
1204 #[inline(always)]
1205 fn new_empty() -> Self {
1206 Self::default()
1207 }
1208
1209 unsafe fn decode(
1210 &mut self,
1211 decoder: &mut fidl::encoding::Decoder<'_, D>,
1212 offset: usize,
1213 mut depth: fidl::encoding::Depth,
1214 ) -> fidl::Result<()> {
1215 decoder.debug_check_bounds::<Self>(offset);
1216 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1217 None => return Err(fidl::Error::NotNullable),
1218 Some(len) => len,
1219 };
1220 if len == 0 {
1222 return Ok(());
1223 };
1224 depth.increment()?;
1225 let envelope_size = 8;
1226 let bytes_len = len * envelope_size;
1227 let offset = decoder.out_of_line_offset(bytes_len)?;
1228 let mut _next_ordinal_to_read = 0;
1230 let mut next_offset = offset;
1231 let end_offset = offset + bytes_len;
1232 _next_ordinal_to_read += 1;
1233 if next_offset >= end_offset {
1234 return Ok(());
1235 }
1236
1237 while _next_ordinal_to_read < 1 {
1239 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1240 _next_ordinal_to_read += 1;
1241 next_offset += envelope_size;
1242 }
1243
1244 let next_out_of_line = decoder.next_out_of_line();
1245 let handles_before = decoder.remaining_handles();
1246 if let Some((inlined, num_bytes, num_handles)) =
1247 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1248 {
1249 let member_inline_size =
1250 <IPv4NatConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1251 if inlined != (member_inline_size <= 4) {
1252 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1253 }
1254 let inner_offset;
1255 let mut inner_depth = depth.clone();
1256 if inlined {
1257 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1258 inner_offset = next_offset;
1259 } else {
1260 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1261 inner_depth.increment()?;
1262 }
1263 let val_ref = self.nat.get_or_insert_with(|| fidl::new_empty!(IPv4NatConfig, D));
1264 fidl::decode!(IPv4NatConfig, D, val_ref, decoder, inner_offset, inner_depth)?;
1265 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1266 {
1267 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1268 }
1269 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1270 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1271 }
1272 }
1273
1274 next_offset += envelope_size;
1275
1276 while next_offset < end_offset {
1278 _next_ordinal_to_read += 1;
1279 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1280 next_offset += envelope_size;
1281 }
1282
1283 Ok(())
1284 }
1285 }
1286
1287 impl Networked {
1288 #[inline(always)]
1289 fn max_ordinal_present(&self) -> u64 {
1290 if let Some(_) = self.ipv4 {
1291 return 1;
1292 }
1293 0
1294 }
1295 }
1296
1297 impl fidl::encoding::ValueTypeMarker for Networked {
1298 type Borrowed<'a> = &'a Self;
1299 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1300 value
1301 }
1302 }
1303
1304 unsafe impl fidl::encoding::TypeMarker for Networked {
1305 type Owned = Self;
1306
1307 #[inline(always)]
1308 fn inline_align(_context: fidl::encoding::Context) -> usize {
1309 8
1310 }
1311
1312 #[inline(always)]
1313 fn inline_size(_context: fidl::encoding::Context) -> usize {
1314 16
1315 }
1316 }
1317
1318 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Networked, D>
1319 for &Networked
1320 {
1321 unsafe fn encode(
1322 self,
1323 encoder: &mut fidl::encoding::Encoder<'_, D>,
1324 offset: usize,
1325 mut depth: fidl::encoding::Depth,
1326 ) -> fidl::Result<()> {
1327 encoder.debug_check_bounds::<Networked>(offset);
1328 let max_ordinal: u64 = self.max_ordinal_present();
1330 encoder.write_num(max_ordinal, offset);
1331 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1332 if max_ordinal == 0 {
1334 return Ok(());
1335 }
1336 depth.increment()?;
1337 let envelope_size = 8;
1338 let bytes_len = max_ordinal as usize * envelope_size;
1339 #[allow(unused_variables)]
1340 let offset = encoder.out_of_line_offset(bytes_len);
1341 let mut _prev_end_offset: usize = 0;
1342 if 1 > max_ordinal {
1343 return Ok(());
1344 }
1345
1346 let cur_offset: usize = (1 - 1) * envelope_size;
1349
1350 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1352
1353 fidl::encoding::encode_in_envelope_optional::<Ipv4Config, D>(
1358 self.ipv4.as_ref().map(<Ipv4Config as fidl::encoding::ValueTypeMarker>::borrow),
1359 encoder,
1360 offset + cur_offset,
1361 depth,
1362 )?;
1363
1364 _prev_end_offset = cur_offset + envelope_size;
1365
1366 Ok(())
1367 }
1368 }
1369
1370 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Networked {
1371 #[inline(always)]
1372 fn new_empty() -> Self {
1373 Self::default()
1374 }
1375
1376 unsafe fn decode(
1377 &mut self,
1378 decoder: &mut fidl::encoding::Decoder<'_, D>,
1379 offset: usize,
1380 mut depth: fidl::encoding::Depth,
1381 ) -> fidl::Result<()> {
1382 decoder.debug_check_bounds::<Self>(offset);
1383 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1384 None => return Err(fidl::Error::NotNullable),
1385 Some(len) => len,
1386 };
1387 if len == 0 {
1389 return Ok(());
1390 };
1391 depth.increment()?;
1392 let envelope_size = 8;
1393 let bytes_len = len * envelope_size;
1394 let offset = decoder.out_of_line_offset(bytes_len)?;
1395 let mut _next_ordinal_to_read = 0;
1397 let mut next_offset = offset;
1398 let end_offset = offset + bytes_len;
1399 _next_ordinal_to_read += 1;
1400 if next_offset >= end_offset {
1401 return Ok(());
1402 }
1403
1404 while _next_ordinal_to_read < 1 {
1406 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1407 _next_ordinal_to_read += 1;
1408 next_offset += envelope_size;
1409 }
1410
1411 let next_out_of_line = decoder.next_out_of_line();
1412 let handles_before = decoder.remaining_handles();
1413 if let Some((inlined, num_bytes, num_handles)) =
1414 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1415 {
1416 let member_inline_size =
1417 <Ipv4Config as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1418 if inlined != (member_inline_size <= 4) {
1419 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1420 }
1421 let inner_offset;
1422 let mut inner_depth = depth.clone();
1423 if inlined {
1424 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1425 inner_offset = next_offset;
1426 } else {
1427 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1428 inner_depth.increment()?;
1429 }
1430 let val_ref = self.ipv4.get_or_insert_with(|| fidl::new_empty!(Ipv4Config, D));
1431 fidl::decode!(Ipv4Config, D, val_ref, decoder, inner_offset, inner_depth)?;
1432 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1433 {
1434 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1435 }
1436 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1437 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1438 }
1439 }
1440
1441 next_offset += envelope_size;
1442
1443 while next_offset < end_offset {
1445 _next_ordinal_to_read += 1;
1446 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1447 next_offset += envelope_size;
1448 }
1449
1450 Ok(())
1451 }
1452 }
1453
1454 impl fidl::encoding::ValueTypeMarker for Config {
1455 type Borrowed<'a> = &'a Self;
1456 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1457 value
1458 }
1459 }
1460
1461 unsafe impl fidl::encoding::TypeMarker for Config {
1462 type Owned = Self;
1463
1464 #[inline(always)]
1465 fn inline_align(_context: fidl::encoding::Context) -> usize {
1466 8
1467 }
1468
1469 #[inline(always)]
1470 fn inline_size(_context: fidl::encoding::Context) -> usize {
1471 16
1472 }
1473 }
1474
1475 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Config, D> for &Config {
1476 #[inline]
1477 unsafe fn encode(
1478 self,
1479 encoder: &mut fidl::encoding::Encoder<'_, D>,
1480 offset: usize,
1481 _depth: fidl::encoding::Depth,
1482 ) -> fidl::Result<()> {
1483 encoder.debug_check_bounds::<Config>(offset);
1484 encoder.write_num::<u64>(self.ordinal(), offset);
1485 match self {
1486 Config::Bridged(ref val) => fidl::encoding::encode_in_envelope::<Bridged, D>(
1487 <Bridged as fidl::encoding::ValueTypeMarker>::borrow(val),
1488 encoder,
1489 offset + 8,
1490 _depth,
1491 ),
1492 Config::Networked(ref val) => fidl::encoding::encode_in_envelope::<Networked, D>(
1493 <Networked as fidl::encoding::ValueTypeMarker>::borrow(val),
1494 encoder,
1495 offset + 8,
1496 _depth,
1497 ),
1498 Config::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
1499 }
1500 }
1501 }
1502
1503 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Config {
1504 #[inline(always)]
1505 fn new_empty() -> Self {
1506 Self::__SourceBreaking { unknown_ordinal: 0 }
1507 }
1508
1509 #[inline]
1510 unsafe fn decode(
1511 &mut self,
1512 decoder: &mut fidl::encoding::Decoder<'_, D>,
1513 offset: usize,
1514 mut depth: fidl::encoding::Depth,
1515 ) -> fidl::Result<()> {
1516 decoder.debug_check_bounds::<Self>(offset);
1517 #[allow(unused_variables)]
1518 let next_out_of_line = decoder.next_out_of_line();
1519 let handles_before = decoder.remaining_handles();
1520 let (ordinal, inlined, num_bytes, num_handles) =
1521 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1522
1523 let member_inline_size = match ordinal {
1524 1 => <Bridged as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1525 2 => <Networked as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1526 0 => return Err(fidl::Error::UnknownUnionTag),
1527 _ => num_bytes as usize,
1528 };
1529
1530 if inlined != (member_inline_size <= 4) {
1531 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1532 }
1533 let _inner_offset;
1534 if inlined {
1535 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1536 _inner_offset = offset + 8;
1537 } else {
1538 depth.increment()?;
1539 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1540 }
1541 match ordinal {
1542 1 => {
1543 #[allow(irrefutable_let_patterns)]
1544 if let Config::Bridged(_) = self {
1545 } else {
1547 *self = Config::Bridged(fidl::new_empty!(Bridged, D));
1549 }
1550 #[allow(irrefutable_let_patterns)]
1551 if let Config::Bridged(ref mut val) = self {
1552 fidl::decode!(Bridged, D, val, decoder, _inner_offset, depth)?;
1553 } else {
1554 unreachable!()
1555 }
1556 }
1557 2 => {
1558 #[allow(irrefutable_let_patterns)]
1559 if let Config::Networked(_) = self {
1560 } else {
1562 *self = Config::Networked(fidl::new_empty!(Networked, D));
1564 }
1565 #[allow(irrefutable_let_patterns)]
1566 if let Config::Networked(ref mut val) = self {
1567 fidl::decode!(Networked, D, val, decoder, _inner_offset, depth)?;
1568 } else {
1569 unreachable!()
1570 }
1571 }
1572 #[allow(deprecated)]
1573 ordinal => {
1574 for _ in 0..num_handles {
1575 decoder.drop_next_handle()?;
1576 }
1577 *self = Config::__SourceBreaking { unknown_ordinal: ordinal };
1578 }
1579 }
1580 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1581 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1582 }
1583 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1584 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1585 }
1586 Ok(())
1587 }
1588 }
1589
1590 impl fidl::encoding::ValueTypeMarker for Ipv4AddressConfig {
1591 type Borrowed<'a> = &'a Self;
1592 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1593 value
1594 }
1595 }
1596
1597 unsafe impl fidl::encoding::TypeMarker for Ipv4AddressConfig {
1598 type Owned = Self;
1599
1600 #[inline(always)]
1601 fn inline_align(_context: fidl::encoding::Context) -> usize {
1602 8
1603 }
1604
1605 #[inline(always)]
1606 fn inline_size(_context: fidl::encoding::Context) -> usize {
1607 16
1608 }
1609 }
1610
1611 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Ipv4AddressConfig, D>
1612 for &Ipv4AddressConfig
1613 {
1614 #[inline]
1615 unsafe fn encode(
1616 self,
1617 encoder: &mut fidl::encoding::Encoder<'_, D>,
1618 offset: usize,
1619 _depth: fidl::encoding::Depth,
1620 ) -> fidl::Result<()> {
1621 encoder.debug_check_bounds::<Ipv4AddressConfig>(offset);
1622 encoder.write_num::<u64>(self.ordinal(), offset);
1623 match self {
1624 Ipv4AddressConfig::Static_(ref val) => {
1625 fidl::encoding::encode_in_envelope::<fidl_fuchsia_net::Ipv4AddressWithPrefix, D>(
1626 <fidl_fuchsia_net::Ipv4AddressWithPrefix as fidl::encoding::ValueTypeMarker>::borrow(val),
1627 encoder, offset + 8, _depth
1628 )
1629 }
1630 Ipv4AddressConfig::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
1631 }
1632 }
1633 }
1634
1635 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Ipv4AddressConfig {
1636 #[inline(always)]
1637 fn new_empty() -> Self {
1638 Self::__SourceBreaking { unknown_ordinal: 0 }
1639 }
1640
1641 #[inline]
1642 unsafe fn decode(
1643 &mut self,
1644 decoder: &mut fidl::encoding::Decoder<'_, D>,
1645 offset: usize,
1646 mut depth: fidl::encoding::Depth,
1647 ) -> fidl::Result<()> {
1648 decoder.debug_check_bounds::<Self>(offset);
1649 #[allow(unused_variables)]
1650 let next_out_of_line = decoder.next_out_of_line();
1651 let handles_before = decoder.remaining_handles();
1652 let (ordinal, inlined, num_bytes, num_handles) =
1653 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1654
1655 let member_inline_size = match ordinal {
1656 1 => <fidl_fuchsia_net::Ipv4AddressWithPrefix as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1657 0 => return Err(fidl::Error::UnknownUnionTag),
1658 _ => num_bytes as usize,
1659 };
1660
1661 if inlined != (member_inline_size <= 4) {
1662 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1663 }
1664 let _inner_offset;
1665 if inlined {
1666 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1667 _inner_offset = offset + 8;
1668 } else {
1669 depth.increment()?;
1670 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1671 }
1672 match ordinal {
1673 1 => {
1674 #[allow(irrefutable_let_patterns)]
1675 if let Ipv4AddressConfig::Static_(_) = self {
1676 } else {
1678 *self = Ipv4AddressConfig::Static_(fidl::new_empty!(
1680 fidl_fuchsia_net::Ipv4AddressWithPrefix,
1681 D
1682 ));
1683 }
1684 #[allow(irrefutable_let_patterns)]
1685 if let Ipv4AddressConfig::Static_(ref mut val) = self {
1686 fidl::decode!(
1687 fidl_fuchsia_net::Ipv4AddressWithPrefix,
1688 D,
1689 val,
1690 decoder,
1691 _inner_offset,
1692 depth
1693 )?;
1694 } else {
1695 unreachable!()
1696 }
1697 }
1698 #[allow(deprecated)]
1699 ordinal => {
1700 for _ in 0..num_handles {
1701 decoder.drop_next_handle()?;
1702 }
1703 *self = Ipv4AddressConfig::__SourceBreaking { unknown_ordinal: ordinal };
1704 }
1705 }
1706 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1707 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1708 }
1709 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1710 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1711 }
1712 Ok(())
1713 }
1714 }
1715
1716 impl fidl::encoding::ValueTypeMarker for Ipv4Connectivity {
1717 type Borrowed<'a> = &'a Self;
1718 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1719 value
1720 }
1721 }
1722
1723 unsafe impl fidl::encoding::TypeMarker for Ipv4Connectivity {
1724 type Owned = Self;
1725
1726 #[inline(always)]
1727 fn inline_align(_context: fidl::encoding::Context) -> usize {
1728 8
1729 }
1730
1731 #[inline(always)]
1732 fn inline_size(_context: fidl::encoding::Context) -> usize {
1733 16
1734 }
1735 }
1736
1737 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Ipv4Connectivity, D>
1738 for &Ipv4Connectivity
1739 {
1740 #[inline]
1741 unsafe fn encode(
1742 self,
1743 encoder: &mut fidl::encoding::Encoder<'_, D>,
1744 offset: usize,
1745 _depth: fidl::encoding::Depth,
1746 ) -> fidl::Result<()> {
1747 encoder.debug_check_bounds::<Ipv4Connectivity>(offset);
1748 encoder.write_num::<u64>(self.ordinal(), offset);
1749 match self {
1750 Ipv4Connectivity::Routed(ref val) => {
1751 fidl::encoding::encode_in_envelope::<Ipv4RoutedConfig, D>(
1752 <Ipv4RoutedConfig as fidl::encoding::ValueTypeMarker>::borrow(val),
1753 encoder,
1754 offset + 8,
1755 _depth,
1756 )
1757 }
1758 Ipv4Connectivity::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
1759 }
1760 }
1761 }
1762
1763 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Ipv4Connectivity {
1764 #[inline(always)]
1765 fn new_empty() -> Self {
1766 Self::__SourceBreaking { unknown_ordinal: 0 }
1767 }
1768
1769 #[inline]
1770 unsafe fn decode(
1771 &mut self,
1772 decoder: &mut fidl::encoding::Decoder<'_, D>,
1773 offset: usize,
1774 mut depth: fidl::encoding::Depth,
1775 ) -> fidl::Result<()> {
1776 decoder.debug_check_bounds::<Self>(offset);
1777 #[allow(unused_variables)]
1778 let next_out_of_line = decoder.next_out_of_line();
1779 let handles_before = decoder.remaining_handles();
1780 let (ordinal, inlined, num_bytes, num_handles) =
1781 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1782
1783 let member_inline_size = match ordinal {
1784 1 => <Ipv4RoutedConfig as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1785 0 => return Err(fidl::Error::UnknownUnionTag),
1786 _ => num_bytes as usize,
1787 };
1788
1789 if inlined != (member_inline_size <= 4) {
1790 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1791 }
1792 let _inner_offset;
1793 if inlined {
1794 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1795 _inner_offset = offset + 8;
1796 } else {
1797 depth.increment()?;
1798 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1799 }
1800 match ordinal {
1801 1 => {
1802 #[allow(irrefutable_let_patterns)]
1803 if let Ipv4Connectivity::Routed(_) = self {
1804 } else {
1806 *self = Ipv4Connectivity::Routed(fidl::new_empty!(Ipv4RoutedConfig, D));
1808 }
1809 #[allow(irrefutable_let_patterns)]
1810 if let Ipv4Connectivity::Routed(ref mut val) = self {
1811 fidl::decode!(Ipv4RoutedConfig, D, val, decoder, _inner_offset, depth)?;
1812 } else {
1813 unreachable!()
1814 }
1815 }
1816 #[allow(deprecated)]
1817 ordinal => {
1818 for _ in 0..num_handles {
1819 decoder.drop_next_handle()?;
1820 }
1821 *self = Ipv4Connectivity::__SourceBreaking { unknown_ordinal: ordinal };
1822 }
1823 }
1824 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1825 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1826 }
1827 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1828 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1829 }
1830 Ok(())
1831 }
1832 }
1833}