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 NetworkRegistryAddError {
13 MissingNetworkId,
15 MissingNetworkInfo,
17 MissingNetworkDnsServers,
19 DuplicateNetworkId,
22 #[doc(hidden)]
23 __SourceBreaking { unknown_ordinal: u32 },
24}
25
26#[macro_export]
28macro_rules! NetworkRegistryAddErrorUnknown {
29 () => {
30 _
31 };
32}
33
34impl NetworkRegistryAddError {
35 #[inline]
36 pub fn from_primitive(prim: u32) -> Option<Self> {
37 match prim {
38 1 => Some(Self::MissingNetworkId),
39 2 => Some(Self::MissingNetworkInfo),
40 3 => Some(Self::MissingNetworkDnsServers),
41 4 => Some(Self::DuplicateNetworkId),
42 _ => None,
43 }
44 }
45
46 #[inline]
47 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
48 match prim {
49 1 => Self::MissingNetworkId,
50 2 => Self::MissingNetworkInfo,
51 3 => Self::MissingNetworkDnsServers,
52 4 => Self::DuplicateNetworkId,
53 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
54 }
55 }
56
57 #[inline]
58 pub fn unknown() -> Self {
59 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
60 }
61
62 #[inline]
63 pub const fn into_primitive(self) -> u32 {
64 match self {
65 Self::MissingNetworkId => 1,
66 Self::MissingNetworkInfo => 2,
67 Self::MissingNetworkDnsServers => 3,
68 Self::DuplicateNetworkId => 4,
69 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
70 }
71 }
72
73 #[inline]
74 pub fn is_unknown(&self) -> bool {
75 match self {
76 Self::__SourceBreaking { unknown_ordinal: _ } => true,
77 _ => false,
78 }
79 }
80}
81
82#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
83pub enum NetworkRegistryRemoveError {
84 NotFound,
86 CannotRemoveDefaultNetwork,
88 #[doc(hidden)]
89 __SourceBreaking { unknown_ordinal: u32 },
90}
91
92#[macro_export]
94macro_rules! NetworkRegistryRemoveErrorUnknown {
95 () => {
96 _
97 };
98}
99
100impl NetworkRegistryRemoveError {
101 #[inline]
102 pub fn from_primitive(prim: u32) -> Option<Self> {
103 match prim {
104 1 => Some(Self::NotFound),
105 2 => Some(Self::CannotRemoveDefaultNetwork),
106 _ => None,
107 }
108 }
109
110 #[inline]
111 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
112 match prim {
113 1 => Self::NotFound,
114 2 => Self::CannotRemoveDefaultNetwork,
115 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
116 }
117 }
118
119 #[inline]
120 pub fn unknown() -> Self {
121 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
122 }
123
124 #[inline]
125 pub const fn into_primitive(self) -> u32 {
126 match self {
127 Self::NotFound => 1,
128 Self::CannotRemoveDefaultNetwork => 2,
129 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
130 }
131 }
132
133 #[inline]
134 pub fn is_unknown(&self) -> bool {
135 match self {
136 Self::__SourceBreaking { unknown_ordinal: _ } => true,
137 _ => false,
138 }
139 }
140}
141
142#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
143pub enum NetworkRegistrySetDefaultError {
144 NotFound,
146 #[doc(hidden)]
147 __SourceBreaking { unknown_ordinal: u32 },
148}
149
150#[macro_export]
152macro_rules! NetworkRegistrySetDefaultErrorUnknown {
153 () => {
154 _
155 };
156}
157
158impl NetworkRegistrySetDefaultError {
159 #[inline]
160 pub fn from_primitive(prim: u32) -> Option<Self> {
161 match prim {
162 1 => Some(Self::NotFound),
163 _ => None,
164 }
165 }
166
167 #[inline]
168 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
169 match prim {
170 1 => Self::NotFound,
171 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
172 }
173 }
174
175 #[inline]
176 pub fn unknown() -> Self {
177 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
178 }
179
180 #[inline]
181 pub const fn into_primitive(self) -> u32 {
182 match self {
183 Self::NotFound => 1,
184 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
185 }
186 }
187
188 #[inline]
189 pub fn is_unknown(&self) -> bool {
190 match self {
191 Self::__SourceBreaking { unknown_ordinal: _ } => true,
192 _ => false,
193 }
194 }
195}
196
197#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
198pub enum NetworkRegistryUpdateError {
199 MissingNetworkId,
201 MissingNetworkInfo,
203 MissingNetworkDnsServers,
205 NotFound,
207 #[doc(hidden)]
208 __SourceBreaking { unknown_ordinal: u32 },
209}
210
211#[macro_export]
213macro_rules! NetworkRegistryUpdateErrorUnknown {
214 () => {
215 _
216 };
217}
218
219impl NetworkRegistryUpdateError {
220 #[inline]
221 pub fn from_primitive(prim: u32) -> Option<Self> {
222 match prim {
223 1 => Some(Self::MissingNetworkId),
224 2 => Some(Self::MissingNetworkInfo),
225 3 => Some(Self::MissingNetworkDnsServers),
226 4 => Some(Self::NotFound),
227 _ => None,
228 }
229 }
230
231 #[inline]
232 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
233 match prim {
234 1 => Self::MissingNetworkId,
235 2 => Self::MissingNetworkInfo,
236 3 => Self::MissingNetworkDnsServers,
237 4 => Self::NotFound,
238 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
239 }
240 }
241
242 #[inline]
243 pub fn unknown() -> Self {
244 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
245 }
246
247 #[inline]
248 pub const fn into_primitive(self) -> u32 {
249 match self {
250 Self::MissingNetworkId => 1,
251 Self::MissingNetworkInfo => 2,
252 Self::MissingNetworkDnsServers => 3,
253 Self::NotFound => 4,
254 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
255 }
256 }
257
258 #[inline]
259 pub fn is_unknown(&self) -> bool {
260 match self {
261 Self::__SourceBreaking { unknown_ordinal: _ } => true,
262 _ => false,
263 }
264 }
265}
266
267#[derive(Clone, Debug, PartialEq)]
268pub struct DnsServerWatcherWatchServersResponse {
269 pub servers: Vec<DnsServerList>,
270}
271
272impl fidl::Persistable for DnsServerWatcherWatchServersResponse {}
273
274#[derive(Clone, Debug, PartialEq)]
275pub struct NetworkRegistryAddRequest {
276 pub network: Network,
277}
278
279impl fidl::Persistable for NetworkRegistryAddRequest {}
280
281#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
282#[repr(C)]
283pub struct NetworkRegistryRemoveRequest {
284 pub network_id: u32,
285}
286
287impl fidl::Persistable for NetworkRegistryRemoveRequest {}
288
289#[derive(Clone, Debug, PartialEq)]
290pub struct NetworkRegistrySetDefaultRequest {
291 pub network_id: fidl_fuchsia_posix_socket::OptionalUint32,
292}
293
294impl fidl::Persistable for NetworkRegistrySetDefaultRequest {}
295
296#[derive(Clone, Debug, PartialEq)]
297pub struct NetworkRegistryUpdateRequest {
298 pub network: Network,
299}
300
301impl fidl::Persistable for NetworkRegistryUpdateRequest {}
302
303#[derive(Clone, Debug, Default, PartialEq)]
307pub struct DnsServerList {
308 pub addresses: Option<Vec<fidl_fuchsia_net::SocketAddress>>,
310 pub source_network_id: Option<u32>,
312 #[doc(hidden)]
313 pub __source_breaking: fidl::marker::SourceBreaking,
314}
315
316impl fidl::Persistable for DnsServerList {}
317
318#[derive(Clone, Debug, Default, PartialEq)]
319pub struct FuchsiaNetworkInfo {
320 #[doc(hidden)]
321 pub __source_breaking: fidl::marker::SourceBreaking,
322}
323
324impl fidl::Persistable for FuchsiaNetworkInfo {}
325
326#[derive(Clone, Debug, Default, PartialEq)]
330pub struct Network {
331 pub network_id: Option<u32>,
333 pub info: Option<NetworkInfo>,
335 pub dns_servers: Option<NetworkDnsServers>,
337 #[doc(hidden)]
338 pub __source_breaking: fidl::marker::SourceBreaking,
339}
340
341impl fidl::Persistable for Network {}
342
343#[derive(Clone, Debug, Default, PartialEq)]
344pub struct NetworkDnsServers {
345 pub v4: Option<Vec<fidl_fuchsia_net::Ipv4Address>>,
346 pub v6: Option<Vec<fidl_fuchsia_net::Ipv6Address>>,
347 #[doc(hidden)]
348 pub __source_breaking: fidl::marker::SourceBreaking,
349}
350
351impl fidl::Persistable for NetworkDnsServers {}
352
353#[derive(Clone, Debug, Default, PartialEq)]
354pub struct StarnixNetworkInfo {
355 pub mark: Option<u32>,
356 pub handle: Option<u64>,
357 #[doc(hidden)]
358 pub __source_breaking: fidl::marker::SourceBreaking,
359}
360
361impl fidl::Persistable for StarnixNetworkInfo {}
362
363#[derive(Clone, Debug)]
364pub enum NetworkInfo {
365 Starnix(StarnixNetworkInfo),
367 Fuchsia(FuchsiaNetworkInfo),
369 #[doc(hidden)]
370 __SourceBreaking { unknown_ordinal: u64 },
371}
372
373#[macro_export]
375macro_rules! NetworkInfoUnknown {
376 () => {
377 _
378 };
379}
380
381impl PartialEq for NetworkInfo {
383 fn eq(&self, other: &Self) -> bool {
384 match (self, other) {
385 (Self::Starnix(x), Self::Starnix(y)) => *x == *y,
386 (Self::Fuchsia(x), Self::Fuchsia(y)) => *x == *y,
387 _ => false,
388 }
389 }
390}
391
392impl NetworkInfo {
393 #[inline]
394 pub fn ordinal(&self) -> u64 {
395 match *self {
396 Self::Starnix(_) => 1,
397 Self::Fuchsia(_) => 2,
398 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
399 }
400 }
401
402 #[inline]
403 pub fn unknown_variant_for_testing() -> Self {
404 Self::__SourceBreaking { unknown_ordinal: 0 }
405 }
406
407 #[inline]
408 pub fn is_unknown(&self) -> bool {
409 match self {
410 Self::__SourceBreaking { .. } => true,
411 _ => false,
412 }
413 }
414}
415
416impl fidl::Persistable for NetworkInfo {}
417
418mod internal {
419 use super::*;
420 unsafe impl fidl::encoding::TypeMarker for NetworkRegistryAddError {
421 type Owned = Self;
422
423 #[inline(always)]
424 fn inline_align(_context: fidl::encoding::Context) -> usize {
425 std::mem::align_of::<u32>()
426 }
427
428 #[inline(always)]
429 fn inline_size(_context: fidl::encoding::Context) -> usize {
430 std::mem::size_of::<u32>()
431 }
432
433 #[inline(always)]
434 fn encode_is_copy() -> bool {
435 false
436 }
437
438 #[inline(always)]
439 fn decode_is_copy() -> bool {
440 false
441 }
442 }
443
444 impl fidl::encoding::ValueTypeMarker for NetworkRegistryAddError {
445 type Borrowed<'a> = Self;
446 #[inline(always)]
447 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
448 *value
449 }
450 }
451
452 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
453 for NetworkRegistryAddError
454 {
455 #[inline]
456 unsafe fn encode(
457 self,
458 encoder: &mut fidl::encoding::Encoder<'_, D>,
459 offset: usize,
460 _depth: fidl::encoding::Depth,
461 ) -> fidl::Result<()> {
462 encoder.debug_check_bounds::<Self>(offset);
463 encoder.write_num(self.into_primitive(), offset);
464 Ok(())
465 }
466 }
467
468 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
469 for NetworkRegistryAddError
470 {
471 #[inline(always)]
472 fn new_empty() -> Self {
473 Self::unknown()
474 }
475
476 #[inline]
477 unsafe fn decode(
478 &mut self,
479 decoder: &mut fidl::encoding::Decoder<'_, D>,
480 offset: usize,
481 _depth: fidl::encoding::Depth,
482 ) -> fidl::Result<()> {
483 decoder.debug_check_bounds::<Self>(offset);
484 let prim = decoder.read_num::<u32>(offset);
485
486 *self = Self::from_primitive_allow_unknown(prim);
487 Ok(())
488 }
489 }
490 unsafe impl fidl::encoding::TypeMarker for NetworkRegistryRemoveError {
491 type Owned = Self;
492
493 #[inline(always)]
494 fn inline_align(_context: fidl::encoding::Context) -> usize {
495 std::mem::align_of::<u32>()
496 }
497
498 #[inline(always)]
499 fn inline_size(_context: fidl::encoding::Context) -> usize {
500 std::mem::size_of::<u32>()
501 }
502
503 #[inline(always)]
504 fn encode_is_copy() -> bool {
505 false
506 }
507
508 #[inline(always)]
509 fn decode_is_copy() -> bool {
510 false
511 }
512 }
513
514 impl fidl::encoding::ValueTypeMarker for NetworkRegistryRemoveError {
515 type Borrowed<'a> = Self;
516 #[inline(always)]
517 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
518 *value
519 }
520 }
521
522 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
523 for NetworkRegistryRemoveError
524 {
525 #[inline]
526 unsafe fn encode(
527 self,
528 encoder: &mut fidl::encoding::Encoder<'_, D>,
529 offset: usize,
530 _depth: fidl::encoding::Depth,
531 ) -> fidl::Result<()> {
532 encoder.debug_check_bounds::<Self>(offset);
533 encoder.write_num(self.into_primitive(), offset);
534 Ok(())
535 }
536 }
537
538 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
539 for NetworkRegistryRemoveError
540 {
541 #[inline(always)]
542 fn new_empty() -> Self {
543 Self::unknown()
544 }
545
546 #[inline]
547 unsafe fn decode(
548 &mut self,
549 decoder: &mut fidl::encoding::Decoder<'_, D>,
550 offset: usize,
551 _depth: fidl::encoding::Depth,
552 ) -> fidl::Result<()> {
553 decoder.debug_check_bounds::<Self>(offset);
554 let prim = decoder.read_num::<u32>(offset);
555
556 *self = Self::from_primitive_allow_unknown(prim);
557 Ok(())
558 }
559 }
560 unsafe impl fidl::encoding::TypeMarker for NetworkRegistrySetDefaultError {
561 type Owned = Self;
562
563 #[inline(always)]
564 fn inline_align(_context: fidl::encoding::Context) -> usize {
565 std::mem::align_of::<u32>()
566 }
567
568 #[inline(always)]
569 fn inline_size(_context: fidl::encoding::Context) -> usize {
570 std::mem::size_of::<u32>()
571 }
572
573 #[inline(always)]
574 fn encode_is_copy() -> bool {
575 false
576 }
577
578 #[inline(always)]
579 fn decode_is_copy() -> bool {
580 false
581 }
582 }
583
584 impl fidl::encoding::ValueTypeMarker for NetworkRegistrySetDefaultError {
585 type Borrowed<'a> = Self;
586 #[inline(always)]
587 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
588 *value
589 }
590 }
591
592 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
593 for NetworkRegistrySetDefaultError
594 {
595 #[inline]
596 unsafe fn encode(
597 self,
598 encoder: &mut fidl::encoding::Encoder<'_, D>,
599 offset: usize,
600 _depth: fidl::encoding::Depth,
601 ) -> fidl::Result<()> {
602 encoder.debug_check_bounds::<Self>(offset);
603 encoder.write_num(self.into_primitive(), offset);
604 Ok(())
605 }
606 }
607
608 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
609 for NetworkRegistrySetDefaultError
610 {
611 #[inline(always)]
612 fn new_empty() -> Self {
613 Self::unknown()
614 }
615
616 #[inline]
617 unsafe fn decode(
618 &mut self,
619 decoder: &mut fidl::encoding::Decoder<'_, D>,
620 offset: usize,
621 _depth: fidl::encoding::Depth,
622 ) -> fidl::Result<()> {
623 decoder.debug_check_bounds::<Self>(offset);
624 let prim = decoder.read_num::<u32>(offset);
625
626 *self = Self::from_primitive_allow_unknown(prim);
627 Ok(())
628 }
629 }
630 unsafe impl fidl::encoding::TypeMarker for NetworkRegistryUpdateError {
631 type Owned = Self;
632
633 #[inline(always)]
634 fn inline_align(_context: fidl::encoding::Context) -> usize {
635 std::mem::align_of::<u32>()
636 }
637
638 #[inline(always)]
639 fn inline_size(_context: fidl::encoding::Context) -> usize {
640 std::mem::size_of::<u32>()
641 }
642
643 #[inline(always)]
644 fn encode_is_copy() -> bool {
645 false
646 }
647
648 #[inline(always)]
649 fn decode_is_copy() -> bool {
650 false
651 }
652 }
653
654 impl fidl::encoding::ValueTypeMarker for NetworkRegistryUpdateError {
655 type Borrowed<'a> = Self;
656 #[inline(always)]
657 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
658 *value
659 }
660 }
661
662 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
663 for NetworkRegistryUpdateError
664 {
665 #[inline]
666 unsafe fn encode(
667 self,
668 encoder: &mut fidl::encoding::Encoder<'_, D>,
669 offset: usize,
670 _depth: fidl::encoding::Depth,
671 ) -> fidl::Result<()> {
672 encoder.debug_check_bounds::<Self>(offset);
673 encoder.write_num(self.into_primitive(), offset);
674 Ok(())
675 }
676 }
677
678 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
679 for NetworkRegistryUpdateError
680 {
681 #[inline(always)]
682 fn new_empty() -> Self {
683 Self::unknown()
684 }
685
686 #[inline]
687 unsafe fn decode(
688 &mut self,
689 decoder: &mut fidl::encoding::Decoder<'_, D>,
690 offset: usize,
691 _depth: fidl::encoding::Depth,
692 ) -> fidl::Result<()> {
693 decoder.debug_check_bounds::<Self>(offset);
694 let prim = decoder.read_num::<u32>(offset);
695
696 *self = Self::from_primitive_allow_unknown(prim);
697 Ok(())
698 }
699 }
700
701 impl fidl::encoding::ValueTypeMarker for DnsServerWatcherWatchServersResponse {
702 type Borrowed<'a> = &'a Self;
703 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
704 value
705 }
706 }
707
708 unsafe impl fidl::encoding::TypeMarker for DnsServerWatcherWatchServersResponse {
709 type Owned = Self;
710
711 #[inline(always)]
712 fn inline_align(_context: fidl::encoding::Context) -> usize {
713 8
714 }
715
716 #[inline(always)]
717 fn inline_size(_context: fidl::encoding::Context) -> usize {
718 16
719 }
720 }
721
722 unsafe impl<D: fidl::encoding::ResourceDialect>
723 fidl::encoding::Encode<DnsServerWatcherWatchServersResponse, D>
724 for &DnsServerWatcherWatchServersResponse
725 {
726 #[inline]
727 unsafe fn encode(
728 self,
729 encoder: &mut fidl::encoding::Encoder<'_, D>,
730 offset: usize,
731 _depth: fidl::encoding::Depth,
732 ) -> fidl::Result<()> {
733 encoder.debug_check_bounds::<DnsServerWatcherWatchServersResponse>(offset);
734 fidl::encoding::Encode::<DnsServerWatcherWatchServersResponse, D>::encode(
736 (
737 <fidl::encoding::UnboundedVector<DnsServerList> as fidl::encoding::ValueTypeMarker>::borrow(&self.servers),
738 ),
739 encoder, offset, _depth
740 )
741 }
742 }
743 unsafe impl<
744 D: fidl::encoding::ResourceDialect,
745 T0: fidl::encoding::Encode<fidl::encoding::UnboundedVector<DnsServerList>, D>,
746 > fidl::encoding::Encode<DnsServerWatcherWatchServersResponse, D> for (T0,)
747 {
748 #[inline]
749 unsafe fn encode(
750 self,
751 encoder: &mut fidl::encoding::Encoder<'_, D>,
752 offset: usize,
753 depth: fidl::encoding::Depth,
754 ) -> fidl::Result<()> {
755 encoder.debug_check_bounds::<DnsServerWatcherWatchServersResponse>(offset);
756 self.0.encode(encoder, offset + 0, depth)?;
760 Ok(())
761 }
762 }
763
764 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
765 for DnsServerWatcherWatchServersResponse
766 {
767 #[inline(always)]
768 fn new_empty() -> Self {
769 Self { servers: fidl::new_empty!(fidl::encoding::UnboundedVector<DnsServerList>, D) }
770 }
771
772 #[inline]
773 unsafe fn decode(
774 &mut self,
775 decoder: &mut fidl::encoding::Decoder<'_, D>,
776 offset: usize,
777 _depth: fidl::encoding::Depth,
778 ) -> fidl::Result<()> {
779 decoder.debug_check_bounds::<Self>(offset);
780 fidl::decode!(
782 fidl::encoding::UnboundedVector<DnsServerList>,
783 D,
784 &mut self.servers,
785 decoder,
786 offset + 0,
787 _depth
788 )?;
789 Ok(())
790 }
791 }
792
793 impl fidl::encoding::ValueTypeMarker for NetworkRegistryAddRequest {
794 type Borrowed<'a> = &'a Self;
795 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
796 value
797 }
798 }
799
800 unsafe impl fidl::encoding::TypeMarker for NetworkRegistryAddRequest {
801 type Owned = Self;
802
803 #[inline(always)]
804 fn inline_align(_context: fidl::encoding::Context) -> usize {
805 8
806 }
807
808 #[inline(always)]
809 fn inline_size(_context: fidl::encoding::Context) -> usize {
810 16
811 }
812 }
813
814 unsafe impl<D: fidl::encoding::ResourceDialect>
815 fidl::encoding::Encode<NetworkRegistryAddRequest, D> for &NetworkRegistryAddRequest
816 {
817 #[inline]
818 unsafe fn encode(
819 self,
820 encoder: &mut fidl::encoding::Encoder<'_, D>,
821 offset: usize,
822 _depth: fidl::encoding::Depth,
823 ) -> fidl::Result<()> {
824 encoder.debug_check_bounds::<NetworkRegistryAddRequest>(offset);
825 fidl::encoding::Encode::<NetworkRegistryAddRequest, D>::encode(
827 (<Network as fidl::encoding::ValueTypeMarker>::borrow(&self.network),),
828 encoder,
829 offset,
830 _depth,
831 )
832 }
833 }
834 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Network, D>>
835 fidl::encoding::Encode<NetworkRegistryAddRequest, D> for (T0,)
836 {
837 #[inline]
838 unsafe fn encode(
839 self,
840 encoder: &mut fidl::encoding::Encoder<'_, D>,
841 offset: usize,
842 depth: fidl::encoding::Depth,
843 ) -> fidl::Result<()> {
844 encoder.debug_check_bounds::<NetworkRegistryAddRequest>(offset);
845 self.0.encode(encoder, offset + 0, depth)?;
849 Ok(())
850 }
851 }
852
853 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
854 for NetworkRegistryAddRequest
855 {
856 #[inline(always)]
857 fn new_empty() -> Self {
858 Self { network: fidl::new_empty!(Network, D) }
859 }
860
861 #[inline]
862 unsafe fn decode(
863 &mut self,
864 decoder: &mut fidl::encoding::Decoder<'_, D>,
865 offset: usize,
866 _depth: fidl::encoding::Depth,
867 ) -> fidl::Result<()> {
868 decoder.debug_check_bounds::<Self>(offset);
869 fidl::decode!(Network, D, &mut self.network, decoder, offset + 0, _depth)?;
871 Ok(())
872 }
873 }
874
875 impl fidl::encoding::ValueTypeMarker for NetworkRegistryRemoveRequest {
876 type Borrowed<'a> = &'a Self;
877 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
878 value
879 }
880 }
881
882 unsafe impl fidl::encoding::TypeMarker for NetworkRegistryRemoveRequest {
883 type Owned = Self;
884
885 #[inline(always)]
886 fn inline_align(_context: fidl::encoding::Context) -> usize {
887 4
888 }
889
890 #[inline(always)]
891 fn inline_size(_context: fidl::encoding::Context) -> usize {
892 4
893 }
894 #[inline(always)]
895 fn encode_is_copy() -> bool {
896 true
897 }
898
899 #[inline(always)]
900 fn decode_is_copy() -> bool {
901 true
902 }
903 }
904
905 unsafe impl<D: fidl::encoding::ResourceDialect>
906 fidl::encoding::Encode<NetworkRegistryRemoveRequest, D> for &NetworkRegistryRemoveRequest
907 {
908 #[inline]
909 unsafe fn encode(
910 self,
911 encoder: &mut fidl::encoding::Encoder<'_, D>,
912 offset: usize,
913 _depth: fidl::encoding::Depth,
914 ) -> fidl::Result<()> {
915 encoder.debug_check_bounds::<NetworkRegistryRemoveRequest>(offset);
916 unsafe {
917 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
919 (buf_ptr as *mut NetworkRegistryRemoveRequest)
920 .write_unaligned((self as *const NetworkRegistryRemoveRequest).read());
921 }
924 Ok(())
925 }
926 }
927 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
928 fidl::encoding::Encode<NetworkRegistryRemoveRequest, D> for (T0,)
929 {
930 #[inline]
931 unsafe fn encode(
932 self,
933 encoder: &mut fidl::encoding::Encoder<'_, D>,
934 offset: usize,
935 depth: fidl::encoding::Depth,
936 ) -> fidl::Result<()> {
937 encoder.debug_check_bounds::<NetworkRegistryRemoveRequest>(offset);
938 self.0.encode(encoder, offset + 0, depth)?;
942 Ok(())
943 }
944 }
945
946 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
947 for NetworkRegistryRemoveRequest
948 {
949 #[inline(always)]
950 fn new_empty() -> Self {
951 Self { network_id: fidl::new_empty!(u32, D) }
952 }
953
954 #[inline]
955 unsafe fn decode(
956 &mut self,
957 decoder: &mut fidl::encoding::Decoder<'_, D>,
958 offset: usize,
959 _depth: fidl::encoding::Depth,
960 ) -> fidl::Result<()> {
961 decoder.debug_check_bounds::<Self>(offset);
962 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
963 unsafe {
966 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
967 }
968 Ok(())
969 }
970 }
971
972 impl fidl::encoding::ValueTypeMarker for NetworkRegistrySetDefaultRequest {
973 type Borrowed<'a> = &'a Self;
974 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
975 value
976 }
977 }
978
979 unsafe impl fidl::encoding::TypeMarker for NetworkRegistrySetDefaultRequest {
980 type Owned = Self;
981
982 #[inline(always)]
983 fn inline_align(_context: fidl::encoding::Context) -> usize {
984 8
985 }
986
987 #[inline(always)]
988 fn inline_size(_context: fidl::encoding::Context) -> usize {
989 16
990 }
991 }
992
993 unsafe impl<D: fidl::encoding::ResourceDialect>
994 fidl::encoding::Encode<NetworkRegistrySetDefaultRequest, D>
995 for &NetworkRegistrySetDefaultRequest
996 {
997 #[inline]
998 unsafe fn encode(
999 self,
1000 encoder: &mut fidl::encoding::Encoder<'_, D>,
1001 offset: usize,
1002 _depth: fidl::encoding::Depth,
1003 ) -> fidl::Result<()> {
1004 encoder.debug_check_bounds::<NetworkRegistrySetDefaultRequest>(offset);
1005 fidl::encoding::Encode::<NetworkRegistrySetDefaultRequest, D>::encode(
1007 (
1008 <fidl_fuchsia_posix_socket::OptionalUint32 as fidl::encoding::ValueTypeMarker>::borrow(&self.network_id),
1009 ),
1010 encoder, offset, _depth
1011 )
1012 }
1013 }
1014 unsafe impl<
1015 D: fidl::encoding::ResourceDialect,
1016 T0: fidl::encoding::Encode<fidl_fuchsia_posix_socket::OptionalUint32, D>,
1017 > fidl::encoding::Encode<NetworkRegistrySetDefaultRequest, D> for (T0,)
1018 {
1019 #[inline]
1020 unsafe fn encode(
1021 self,
1022 encoder: &mut fidl::encoding::Encoder<'_, D>,
1023 offset: usize,
1024 depth: fidl::encoding::Depth,
1025 ) -> fidl::Result<()> {
1026 encoder.debug_check_bounds::<NetworkRegistrySetDefaultRequest>(offset);
1027 self.0.encode(encoder, offset + 0, depth)?;
1031 Ok(())
1032 }
1033 }
1034
1035 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1036 for NetworkRegistrySetDefaultRequest
1037 {
1038 #[inline(always)]
1039 fn new_empty() -> Self {
1040 Self { network_id: fidl::new_empty!(fidl_fuchsia_posix_socket::OptionalUint32, D) }
1041 }
1042
1043 #[inline]
1044 unsafe fn decode(
1045 &mut self,
1046 decoder: &mut fidl::encoding::Decoder<'_, D>,
1047 offset: usize,
1048 _depth: fidl::encoding::Depth,
1049 ) -> fidl::Result<()> {
1050 decoder.debug_check_bounds::<Self>(offset);
1051 fidl::decode!(
1053 fidl_fuchsia_posix_socket::OptionalUint32,
1054 D,
1055 &mut self.network_id,
1056 decoder,
1057 offset + 0,
1058 _depth
1059 )?;
1060 Ok(())
1061 }
1062 }
1063
1064 impl fidl::encoding::ValueTypeMarker for NetworkRegistryUpdateRequest {
1065 type Borrowed<'a> = &'a Self;
1066 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1067 value
1068 }
1069 }
1070
1071 unsafe impl fidl::encoding::TypeMarker for NetworkRegistryUpdateRequest {
1072 type Owned = Self;
1073
1074 #[inline(always)]
1075 fn inline_align(_context: fidl::encoding::Context) -> usize {
1076 8
1077 }
1078
1079 #[inline(always)]
1080 fn inline_size(_context: fidl::encoding::Context) -> usize {
1081 16
1082 }
1083 }
1084
1085 unsafe impl<D: fidl::encoding::ResourceDialect>
1086 fidl::encoding::Encode<NetworkRegistryUpdateRequest, D> for &NetworkRegistryUpdateRequest
1087 {
1088 #[inline]
1089 unsafe fn encode(
1090 self,
1091 encoder: &mut fidl::encoding::Encoder<'_, D>,
1092 offset: usize,
1093 _depth: fidl::encoding::Depth,
1094 ) -> fidl::Result<()> {
1095 encoder.debug_check_bounds::<NetworkRegistryUpdateRequest>(offset);
1096 fidl::encoding::Encode::<NetworkRegistryUpdateRequest, D>::encode(
1098 (<Network as fidl::encoding::ValueTypeMarker>::borrow(&self.network),),
1099 encoder,
1100 offset,
1101 _depth,
1102 )
1103 }
1104 }
1105 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<Network, D>>
1106 fidl::encoding::Encode<NetworkRegistryUpdateRequest, D> for (T0,)
1107 {
1108 #[inline]
1109 unsafe fn encode(
1110 self,
1111 encoder: &mut fidl::encoding::Encoder<'_, D>,
1112 offset: usize,
1113 depth: fidl::encoding::Depth,
1114 ) -> fidl::Result<()> {
1115 encoder.debug_check_bounds::<NetworkRegistryUpdateRequest>(offset);
1116 self.0.encode(encoder, offset + 0, depth)?;
1120 Ok(())
1121 }
1122 }
1123
1124 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1125 for NetworkRegistryUpdateRequest
1126 {
1127 #[inline(always)]
1128 fn new_empty() -> Self {
1129 Self { network: fidl::new_empty!(Network, D) }
1130 }
1131
1132 #[inline]
1133 unsafe fn decode(
1134 &mut self,
1135 decoder: &mut fidl::encoding::Decoder<'_, D>,
1136 offset: usize,
1137 _depth: fidl::encoding::Depth,
1138 ) -> fidl::Result<()> {
1139 decoder.debug_check_bounds::<Self>(offset);
1140 fidl::decode!(Network, D, &mut self.network, decoder, offset + 0, _depth)?;
1142 Ok(())
1143 }
1144 }
1145
1146 impl DnsServerList {
1147 #[inline(always)]
1148 fn max_ordinal_present(&self) -> u64 {
1149 if let Some(_) = self.source_network_id {
1150 return 2;
1151 }
1152 if let Some(_) = self.addresses {
1153 return 1;
1154 }
1155 0
1156 }
1157 }
1158
1159 impl fidl::encoding::ValueTypeMarker for DnsServerList {
1160 type Borrowed<'a> = &'a Self;
1161 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1162 value
1163 }
1164 }
1165
1166 unsafe impl fidl::encoding::TypeMarker for DnsServerList {
1167 type Owned = Self;
1168
1169 #[inline(always)]
1170 fn inline_align(_context: fidl::encoding::Context) -> usize {
1171 8
1172 }
1173
1174 #[inline(always)]
1175 fn inline_size(_context: fidl::encoding::Context) -> usize {
1176 16
1177 }
1178 }
1179
1180 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DnsServerList, D>
1181 for &DnsServerList
1182 {
1183 unsafe fn encode(
1184 self,
1185 encoder: &mut fidl::encoding::Encoder<'_, D>,
1186 offset: usize,
1187 mut depth: fidl::encoding::Depth,
1188 ) -> fidl::Result<()> {
1189 encoder.debug_check_bounds::<DnsServerList>(offset);
1190 let max_ordinal: u64 = self.max_ordinal_present();
1192 encoder.write_num(max_ordinal, offset);
1193 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1194 if max_ordinal == 0 {
1196 return Ok(());
1197 }
1198 depth.increment()?;
1199 let envelope_size = 8;
1200 let bytes_len = max_ordinal as usize * envelope_size;
1201 #[allow(unused_variables)]
1202 let offset = encoder.out_of_line_offset(bytes_len);
1203 let mut _prev_end_offset: usize = 0;
1204 if 1 > max_ordinal {
1205 return Ok(());
1206 }
1207
1208 let cur_offset: usize = (1 - 1) * envelope_size;
1211
1212 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1214
1215 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_net::SocketAddress>, D>(
1220 self.addresses.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_net::SocketAddress> as fidl::encoding::ValueTypeMarker>::borrow),
1221 encoder, offset + cur_offset, depth
1222 )?;
1223
1224 _prev_end_offset = cur_offset + envelope_size;
1225 if 2 > max_ordinal {
1226 return Ok(());
1227 }
1228
1229 let cur_offset: usize = (2 - 1) * envelope_size;
1232
1233 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1235
1236 fidl::encoding::encode_in_envelope_optional::<u32, D>(
1241 self.source_network_id
1242 .as_ref()
1243 .map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1244 encoder,
1245 offset + cur_offset,
1246 depth,
1247 )?;
1248
1249 _prev_end_offset = cur_offset + envelope_size;
1250
1251 Ok(())
1252 }
1253 }
1254
1255 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DnsServerList {
1256 #[inline(always)]
1257 fn new_empty() -> Self {
1258 Self::default()
1259 }
1260
1261 unsafe fn decode(
1262 &mut self,
1263 decoder: &mut fidl::encoding::Decoder<'_, D>,
1264 offset: usize,
1265 mut depth: fidl::encoding::Depth,
1266 ) -> fidl::Result<()> {
1267 decoder.debug_check_bounds::<Self>(offset);
1268 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1269 None => return Err(fidl::Error::NotNullable),
1270 Some(len) => len,
1271 };
1272 if len == 0 {
1274 return Ok(());
1275 };
1276 depth.increment()?;
1277 let envelope_size = 8;
1278 let bytes_len = len * envelope_size;
1279 let offset = decoder.out_of_line_offset(bytes_len)?;
1280 let mut _next_ordinal_to_read = 0;
1282 let mut next_offset = offset;
1283 let end_offset = offset + bytes_len;
1284 _next_ordinal_to_read += 1;
1285 if next_offset >= end_offset {
1286 return Ok(());
1287 }
1288
1289 while _next_ordinal_to_read < 1 {
1291 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1292 _next_ordinal_to_read += 1;
1293 next_offset += envelope_size;
1294 }
1295
1296 let next_out_of_line = decoder.next_out_of_line();
1297 let handles_before = decoder.remaining_handles();
1298 if let Some((inlined, num_bytes, num_handles)) =
1299 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1300 {
1301 let member_inline_size = <fidl::encoding::UnboundedVector<
1302 fidl_fuchsia_net::SocketAddress,
1303 > as fidl::encoding::TypeMarker>::inline_size(
1304 decoder.context
1305 );
1306 if inlined != (member_inline_size <= 4) {
1307 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1308 }
1309 let inner_offset;
1310 let mut inner_depth = depth.clone();
1311 if inlined {
1312 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1313 inner_offset = next_offset;
1314 } else {
1315 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1316 inner_depth.increment()?;
1317 }
1318 let val_ref = self.addresses.get_or_insert_with(|| {
1319 fidl::new_empty!(
1320 fidl::encoding::UnboundedVector<fidl_fuchsia_net::SocketAddress>,
1321 D
1322 )
1323 });
1324 fidl::decode!(
1325 fidl::encoding::UnboundedVector<fidl_fuchsia_net::SocketAddress>,
1326 D,
1327 val_ref,
1328 decoder,
1329 inner_offset,
1330 inner_depth
1331 )?;
1332 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1333 {
1334 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1335 }
1336 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1337 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1338 }
1339 }
1340
1341 next_offset += envelope_size;
1342 _next_ordinal_to_read += 1;
1343 if next_offset >= end_offset {
1344 return Ok(());
1345 }
1346
1347 while _next_ordinal_to_read < 2 {
1349 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1350 _next_ordinal_to_read += 1;
1351 next_offset += envelope_size;
1352 }
1353
1354 let next_out_of_line = decoder.next_out_of_line();
1355 let handles_before = decoder.remaining_handles();
1356 if let Some((inlined, num_bytes, num_handles)) =
1357 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1358 {
1359 let member_inline_size =
1360 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1361 if inlined != (member_inline_size <= 4) {
1362 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1363 }
1364 let inner_offset;
1365 let mut inner_depth = depth.clone();
1366 if inlined {
1367 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1368 inner_offset = next_offset;
1369 } else {
1370 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1371 inner_depth.increment()?;
1372 }
1373 let val_ref =
1374 self.source_network_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
1375 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
1376 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1377 {
1378 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1379 }
1380 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1381 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1382 }
1383 }
1384
1385 next_offset += envelope_size;
1386
1387 while next_offset < end_offset {
1389 _next_ordinal_to_read += 1;
1390 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1391 next_offset += envelope_size;
1392 }
1393
1394 Ok(())
1395 }
1396 }
1397
1398 impl FuchsiaNetworkInfo {
1399 #[inline(always)]
1400 fn max_ordinal_present(&self) -> u64 {
1401 0
1402 }
1403 }
1404
1405 impl fidl::encoding::ValueTypeMarker for FuchsiaNetworkInfo {
1406 type Borrowed<'a> = &'a Self;
1407 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1408 value
1409 }
1410 }
1411
1412 unsafe impl fidl::encoding::TypeMarker for FuchsiaNetworkInfo {
1413 type Owned = Self;
1414
1415 #[inline(always)]
1416 fn inline_align(_context: fidl::encoding::Context) -> usize {
1417 8
1418 }
1419
1420 #[inline(always)]
1421 fn inline_size(_context: fidl::encoding::Context) -> usize {
1422 16
1423 }
1424 }
1425
1426 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<FuchsiaNetworkInfo, D>
1427 for &FuchsiaNetworkInfo
1428 {
1429 unsafe fn encode(
1430 self,
1431 encoder: &mut fidl::encoding::Encoder<'_, D>,
1432 offset: usize,
1433 mut depth: fidl::encoding::Depth,
1434 ) -> fidl::Result<()> {
1435 encoder.debug_check_bounds::<FuchsiaNetworkInfo>(offset);
1436 let max_ordinal: u64 = self.max_ordinal_present();
1438 encoder.write_num(max_ordinal, offset);
1439 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1440 if max_ordinal == 0 {
1442 return Ok(());
1443 }
1444 depth.increment()?;
1445 let envelope_size = 8;
1446 let bytes_len = max_ordinal as usize * envelope_size;
1447 #[allow(unused_variables)]
1448 let offset = encoder.out_of_line_offset(bytes_len);
1449 let mut _prev_end_offset: usize = 0;
1450
1451 Ok(())
1452 }
1453 }
1454
1455 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for FuchsiaNetworkInfo {
1456 #[inline(always)]
1457 fn new_empty() -> Self {
1458 Self::default()
1459 }
1460
1461 unsafe fn decode(
1462 &mut self,
1463 decoder: &mut fidl::encoding::Decoder<'_, D>,
1464 offset: usize,
1465 mut depth: fidl::encoding::Depth,
1466 ) -> fidl::Result<()> {
1467 decoder.debug_check_bounds::<Self>(offset);
1468 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1469 None => return Err(fidl::Error::NotNullable),
1470 Some(len) => len,
1471 };
1472 if len == 0 {
1474 return Ok(());
1475 };
1476 depth.increment()?;
1477 let envelope_size = 8;
1478 let bytes_len = len * envelope_size;
1479 let offset = decoder.out_of_line_offset(bytes_len)?;
1480 let mut _next_ordinal_to_read = 0;
1482 let mut next_offset = offset;
1483 let end_offset = offset + bytes_len;
1484
1485 while next_offset < end_offset {
1487 _next_ordinal_to_read += 1;
1488 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1489 next_offset += envelope_size;
1490 }
1491
1492 Ok(())
1493 }
1494 }
1495
1496 impl Network {
1497 #[inline(always)]
1498 fn max_ordinal_present(&self) -> u64 {
1499 if let Some(_) = self.dns_servers {
1500 return 3;
1501 }
1502 if let Some(_) = self.info {
1503 return 2;
1504 }
1505 if let Some(_) = self.network_id {
1506 return 1;
1507 }
1508 0
1509 }
1510 }
1511
1512 impl fidl::encoding::ValueTypeMarker for Network {
1513 type Borrowed<'a> = &'a Self;
1514 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1515 value
1516 }
1517 }
1518
1519 unsafe impl fidl::encoding::TypeMarker for Network {
1520 type Owned = Self;
1521
1522 #[inline(always)]
1523 fn inline_align(_context: fidl::encoding::Context) -> usize {
1524 8
1525 }
1526
1527 #[inline(always)]
1528 fn inline_size(_context: fidl::encoding::Context) -> usize {
1529 16
1530 }
1531 }
1532
1533 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Network, D> for &Network {
1534 unsafe fn encode(
1535 self,
1536 encoder: &mut fidl::encoding::Encoder<'_, D>,
1537 offset: usize,
1538 mut depth: fidl::encoding::Depth,
1539 ) -> fidl::Result<()> {
1540 encoder.debug_check_bounds::<Network>(offset);
1541 let max_ordinal: u64 = self.max_ordinal_present();
1543 encoder.write_num(max_ordinal, offset);
1544 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1545 if max_ordinal == 0 {
1547 return Ok(());
1548 }
1549 depth.increment()?;
1550 let envelope_size = 8;
1551 let bytes_len = max_ordinal as usize * envelope_size;
1552 #[allow(unused_variables)]
1553 let offset = encoder.out_of_line_offset(bytes_len);
1554 let mut _prev_end_offset: usize = 0;
1555 if 1 > max_ordinal {
1556 return Ok(());
1557 }
1558
1559 let cur_offset: usize = (1 - 1) * envelope_size;
1562
1563 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1565
1566 fidl::encoding::encode_in_envelope_optional::<u32, D>(
1571 self.network_id.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1572 encoder,
1573 offset + cur_offset,
1574 depth,
1575 )?;
1576
1577 _prev_end_offset = cur_offset + envelope_size;
1578 if 2 > max_ordinal {
1579 return Ok(());
1580 }
1581
1582 let cur_offset: usize = (2 - 1) * envelope_size;
1585
1586 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1588
1589 fidl::encoding::encode_in_envelope_optional::<NetworkInfo, D>(
1594 self.info.as_ref().map(<NetworkInfo as fidl::encoding::ValueTypeMarker>::borrow),
1595 encoder,
1596 offset + cur_offset,
1597 depth,
1598 )?;
1599
1600 _prev_end_offset = cur_offset + envelope_size;
1601 if 3 > max_ordinal {
1602 return Ok(());
1603 }
1604
1605 let cur_offset: usize = (3 - 1) * envelope_size;
1608
1609 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1611
1612 fidl::encoding::encode_in_envelope_optional::<NetworkDnsServers, D>(
1617 self.dns_servers
1618 .as_ref()
1619 .map(<NetworkDnsServers as fidl::encoding::ValueTypeMarker>::borrow),
1620 encoder,
1621 offset + cur_offset,
1622 depth,
1623 )?;
1624
1625 _prev_end_offset = cur_offset + envelope_size;
1626
1627 Ok(())
1628 }
1629 }
1630
1631 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Network {
1632 #[inline(always)]
1633 fn new_empty() -> Self {
1634 Self::default()
1635 }
1636
1637 unsafe fn decode(
1638 &mut self,
1639 decoder: &mut fidl::encoding::Decoder<'_, D>,
1640 offset: usize,
1641 mut depth: fidl::encoding::Depth,
1642 ) -> fidl::Result<()> {
1643 decoder.debug_check_bounds::<Self>(offset);
1644 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1645 None => return Err(fidl::Error::NotNullable),
1646 Some(len) => len,
1647 };
1648 if len == 0 {
1650 return Ok(());
1651 };
1652 depth.increment()?;
1653 let envelope_size = 8;
1654 let bytes_len = len * envelope_size;
1655 let offset = decoder.out_of_line_offset(bytes_len)?;
1656 let mut _next_ordinal_to_read = 0;
1658 let mut next_offset = offset;
1659 let end_offset = offset + bytes_len;
1660 _next_ordinal_to_read += 1;
1661 if next_offset >= end_offset {
1662 return Ok(());
1663 }
1664
1665 while _next_ordinal_to_read < 1 {
1667 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1668 _next_ordinal_to_read += 1;
1669 next_offset += envelope_size;
1670 }
1671
1672 let next_out_of_line = decoder.next_out_of_line();
1673 let handles_before = decoder.remaining_handles();
1674 if let Some((inlined, num_bytes, num_handles)) =
1675 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1676 {
1677 let member_inline_size =
1678 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1679 if inlined != (member_inline_size <= 4) {
1680 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1681 }
1682 let inner_offset;
1683 let mut inner_depth = depth.clone();
1684 if inlined {
1685 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1686 inner_offset = next_offset;
1687 } else {
1688 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1689 inner_depth.increment()?;
1690 }
1691 let val_ref = self.network_id.get_or_insert_with(|| fidl::new_empty!(u32, D));
1692 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
1693 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1694 {
1695 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1696 }
1697 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1698 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1699 }
1700 }
1701
1702 next_offset += envelope_size;
1703 _next_ordinal_to_read += 1;
1704 if next_offset >= end_offset {
1705 return Ok(());
1706 }
1707
1708 while _next_ordinal_to_read < 2 {
1710 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1711 _next_ordinal_to_read += 1;
1712 next_offset += envelope_size;
1713 }
1714
1715 let next_out_of_line = decoder.next_out_of_line();
1716 let handles_before = decoder.remaining_handles();
1717 if let Some((inlined, num_bytes, num_handles)) =
1718 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1719 {
1720 let member_inline_size =
1721 <NetworkInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1722 if inlined != (member_inline_size <= 4) {
1723 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1724 }
1725 let inner_offset;
1726 let mut inner_depth = depth.clone();
1727 if inlined {
1728 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1729 inner_offset = next_offset;
1730 } else {
1731 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1732 inner_depth.increment()?;
1733 }
1734 let val_ref = self.info.get_or_insert_with(|| fidl::new_empty!(NetworkInfo, D));
1735 fidl::decode!(NetworkInfo, D, val_ref, decoder, inner_offset, inner_depth)?;
1736 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1737 {
1738 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1739 }
1740 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1741 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1742 }
1743 }
1744
1745 next_offset += envelope_size;
1746 _next_ordinal_to_read += 1;
1747 if next_offset >= end_offset {
1748 return Ok(());
1749 }
1750
1751 while _next_ordinal_to_read < 3 {
1753 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1754 _next_ordinal_to_read += 1;
1755 next_offset += envelope_size;
1756 }
1757
1758 let next_out_of_line = decoder.next_out_of_line();
1759 let handles_before = decoder.remaining_handles();
1760 if let Some((inlined, num_bytes, num_handles)) =
1761 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1762 {
1763 let member_inline_size =
1764 <NetworkDnsServers as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1765 if inlined != (member_inline_size <= 4) {
1766 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1767 }
1768 let inner_offset;
1769 let mut inner_depth = depth.clone();
1770 if inlined {
1771 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1772 inner_offset = next_offset;
1773 } else {
1774 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1775 inner_depth.increment()?;
1776 }
1777 let val_ref =
1778 self.dns_servers.get_or_insert_with(|| fidl::new_empty!(NetworkDnsServers, D));
1779 fidl::decode!(NetworkDnsServers, D, val_ref, decoder, inner_offset, inner_depth)?;
1780 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1781 {
1782 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1783 }
1784 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1785 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1786 }
1787 }
1788
1789 next_offset += envelope_size;
1790
1791 while next_offset < end_offset {
1793 _next_ordinal_to_read += 1;
1794 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1795 next_offset += envelope_size;
1796 }
1797
1798 Ok(())
1799 }
1800 }
1801
1802 impl NetworkDnsServers {
1803 #[inline(always)]
1804 fn max_ordinal_present(&self) -> u64 {
1805 if let Some(_) = self.v6 {
1806 return 2;
1807 }
1808 if let Some(_) = self.v4 {
1809 return 1;
1810 }
1811 0
1812 }
1813 }
1814
1815 impl fidl::encoding::ValueTypeMarker for NetworkDnsServers {
1816 type Borrowed<'a> = &'a Self;
1817 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1818 value
1819 }
1820 }
1821
1822 unsafe impl fidl::encoding::TypeMarker for NetworkDnsServers {
1823 type Owned = Self;
1824
1825 #[inline(always)]
1826 fn inline_align(_context: fidl::encoding::Context) -> usize {
1827 8
1828 }
1829
1830 #[inline(always)]
1831 fn inline_size(_context: fidl::encoding::Context) -> usize {
1832 16
1833 }
1834 }
1835
1836 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NetworkDnsServers, D>
1837 for &NetworkDnsServers
1838 {
1839 unsafe fn encode(
1840 self,
1841 encoder: &mut fidl::encoding::Encoder<'_, D>,
1842 offset: usize,
1843 mut depth: fidl::encoding::Depth,
1844 ) -> fidl::Result<()> {
1845 encoder.debug_check_bounds::<NetworkDnsServers>(offset);
1846 let max_ordinal: u64 = self.max_ordinal_present();
1848 encoder.write_num(max_ordinal, offset);
1849 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1850 if max_ordinal == 0 {
1852 return Ok(());
1853 }
1854 depth.increment()?;
1855 let envelope_size = 8;
1856 let bytes_len = max_ordinal as usize * envelope_size;
1857 #[allow(unused_variables)]
1858 let offset = encoder.out_of_line_offset(bytes_len);
1859 let mut _prev_end_offset: usize = 0;
1860 if 1 > max_ordinal {
1861 return Ok(());
1862 }
1863
1864 let cur_offset: usize = (1 - 1) * envelope_size;
1867
1868 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1870
1871 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_net::Ipv4Address>, D>(
1876 self.v4.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_net::Ipv4Address> as fidl::encoding::ValueTypeMarker>::borrow),
1877 encoder, offset + cur_offset, depth
1878 )?;
1879
1880 _prev_end_offset = cur_offset + envelope_size;
1881 if 2 > max_ordinal {
1882 return Ok(());
1883 }
1884
1885 let cur_offset: usize = (2 - 1) * envelope_size;
1888
1889 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1891
1892 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::UnboundedVector<fidl_fuchsia_net::Ipv6Address>, D>(
1897 self.v6.as_ref().map(<fidl::encoding::UnboundedVector<fidl_fuchsia_net::Ipv6Address> as fidl::encoding::ValueTypeMarker>::borrow),
1898 encoder, offset + cur_offset, depth
1899 )?;
1900
1901 _prev_end_offset = cur_offset + envelope_size;
1902
1903 Ok(())
1904 }
1905 }
1906
1907 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NetworkDnsServers {
1908 #[inline(always)]
1909 fn new_empty() -> Self {
1910 Self::default()
1911 }
1912
1913 unsafe fn decode(
1914 &mut self,
1915 decoder: &mut fidl::encoding::Decoder<'_, D>,
1916 offset: usize,
1917 mut depth: fidl::encoding::Depth,
1918 ) -> fidl::Result<()> {
1919 decoder.debug_check_bounds::<Self>(offset);
1920 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1921 None => return Err(fidl::Error::NotNullable),
1922 Some(len) => len,
1923 };
1924 if len == 0 {
1926 return Ok(());
1927 };
1928 depth.increment()?;
1929 let envelope_size = 8;
1930 let bytes_len = len * envelope_size;
1931 let offset = decoder.out_of_line_offset(bytes_len)?;
1932 let mut _next_ordinal_to_read = 0;
1934 let mut next_offset = offset;
1935 let end_offset = offset + bytes_len;
1936 _next_ordinal_to_read += 1;
1937 if next_offset >= end_offset {
1938 return Ok(());
1939 }
1940
1941 while _next_ordinal_to_read < 1 {
1943 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1944 _next_ordinal_to_read += 1;
1945 next_offset += envelope_size;
1946 }
1947
1948 let next_out_of_line = decoder.next_out_of_line();
1949 let handles_before = decoder.remaining_handles();
1950 if let Some((inlined, num_bytes, num_handles)) =
1951 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1952 {
1953 let member_inline_size = <fidl::encoding::UnboundedVector<
1954 fidl_fuchsia_net::Ipv4Address,
1955 > as fidl::encoding::TypeMarker>::inline_size(
1956 decoder.context
1957 );
1958 if inlined != (member_inline_size <= 4) {
1959 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1960 }
1961 let inner_offset;
1962 let mut inner_depth = depth.clone();
1963 if inlined {
1964 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1965 inner_offset = next_offset;
1966 } else {
1967 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1968 inner_depth.increment()?;
1969 }
1970 let val_ref = self.v4.get_or_insert_with(|| {
1971 fidl::new_empty!(
1972 fidl::encoding::UnboundedVector<fidl_fuchsia_net::Ipv4Address>,
1973 D
1974 )
1975 });
1976 fidl::decode!(
1977 fidl::encoding::UnboundedVector<fidl_fuchsia_net::Ipv4Address>,
1978 D,
1979 val_ref,
1980 decoder,
1981 inner_offset,
1982 inner_depth
1983 )?;
1984 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1985 {
1986 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1987 }
1988 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1989 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1990 }
1991 }
1992
1993 next_offset += envelope_size;
1994 _next_ordinal_to_read += 1;
1995 if next_offset >= end_offset {
1996 return Ok(());
1997 }
1998
1999 while _next_ordinal_to_read < 2 {
2001 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2002 _next_ordinal_to_read += 1;
2003 next_offset += envelope_size;
2004 }
2005
2006 let next_out_of_line = decoder.next_out_of_line();
2007 let handles_before = decoder.remaining_handles();
2008 if let Some((inlined, num_bytes, num_handles)) =
2009 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2010 {
2011 let member_inline_size = <fidl::encoding::UnboundedVector<
2012 fidl_fuchsia_net::Ipv6Address,
2013 > as fidl::encoding::TypeMarker>::inline_size(
2014 decoder.context
2015 );
2016 if inlined != (member_inline_size <= 4) {
2017 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2018 }
2019 let inner_offset;
2020 let mut inner_depth = depth.clone();
2021 if inlined {
2022 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2023 inner_offset = next_offset;
2024 } else {
2025 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2026 inner_depth.increment()?;
2027 }
2028 let val_ref = self.v6.get_or_insert_with(|| {
2029 fidl::new_empty!(
2030 fidl::encoding::UnboundedVector<fidl_fuchsia_net::Ipv6Address>,
2031 D
2032 )
2033 });
2034 fidl::decode!(
2035 fidl::encoding::UnboundedVector<fidl_fuchsia_net::Ipv6Address>,
2036 D,
2037 val_ref,
2038 decoder,
2039 inner_offset,
2040 inner_depth
2041 )?;
2042 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2043 {
2044 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2045 }
2046 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2047 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2048 }
2049 }
2050
2051 next_offset += envelope_size;
2052
2053 while next_offset < end_offset {
2055 _next_ordinal_to_read += 1;
2056 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2057 next_offset += envelope_size;
2058 }
2059
2060 Ok(())
2061 }
2062 }
2063
2064 impl StarnixNetworkInfo {
2065 #[inline(always)]
2066 fn max_ordinal_present(&self) -> u64 {
2067 if let Some(_) = self.handle {
2068 return 2;
2069 }
2070 if let Some(_) = self.mark {
2071 return 1;
2072 }
2073 0
2074 }
2075 }
2076
2077 impl fidl::encoding::ValueTypeMarker for StarnixNetworkInfo {
2078 type Borrowed<'a> = &'a Self;
2079 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2080 value
2081 }
2082 }
2083
2084 unsafe impl fidl::encoding::TypeMarker for StarnixNetworkInfo {
2085 type Owned = Self;
2086
2087 #[inline(always)]
2088 fn inline_align(_context: fidl::encoding::Context) -> usize {
2089 8
2090 }
2091
2092 #[inline(always)]
2093 fn inline_size(_context: fidl::encoding::Context) -> usize {
2094 16
2095 }
2096 }
2097
2098 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<StarnixNetworkInfo, D>
2099 for &StarnixNetworkInfo
2100 {
2101 unsafe fn encode(
2102 self,
2103 encoder: &mut fidl::encoding::Encoder<'_, D>,
2104 offset: usize,
2105 mut depth: fidl::encoding::Depth,
2106 ) -> fidl::Result<()> {
2107 encoder.debug_check_bounds::<StarnixNetworkInfo>(offset);
2108 let max_ordinal: u64 = self.max_ordinal_present();
2110 encoder.write_num(max_ordinal, offset);
2111 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2112 if max_ordinal == 0 {
2114 return Ok(());
2115 }
2116 depth.increment()?;
2117 let envelope_size = 8;
2118 let bytes_len = max_ordinal as usize * envelope_size;
2119 #[allow(unused_variables)]
2120 let offset = encoder.out_of_line_offset(bytes_len);
2121 let mut _prev_end_offset: usize = 0;
2122 if 1 > max_ordinal {
2123 return Ok(());
2124 }
2125
2126 let cur_offset: usize = (1 - 1) * envelope_size;
2129
2130 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2132
2133 fidl::encoding::encode_in_envelope_optional::<u32, D>(
2138 self.mark.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
2139 encoder,
2140 offset + cur_offset,
2141 depth,
2142 )?;
2143
2144 _prev_end_offset = cur_offset + envelope_size;
2145 if 2 > max_ordinal {
2146 return Ok(());
2147 }
2148
2149 let cur_offset: usize = (2 - 1) * envelope_size;
2152
2153 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2155
2156 fidl::encoding::encode_in_envelope_optional::<u64, D>(
2161 self.handle.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2162 encoder,
2163 offset + cur_offset,
2164 depth,
2165 )?;
2166
2167 _prev_end_offset = cur_offset + envelope_size;
2168
2169 Ok(())
2170 }
2171 }
2172
2173 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StarnixNetworkInfo {
2174 #[inline(always)]
2175 fn new_empty() -> Self {
2176 Self::default()
2177 }
2178
2179 unsafe fn decode(
2180 &mut self,
2181 decoder: &mut fidl::encoding::Decoder<'_, D>,
2182 offset: usize,
2183 mut depth: fidl::encoding::Depth,
2184 ) -> fidl::Result<()> {
2185 decoder.debug_check_bounds::<Self>(offset);
2186 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2187 None => return Err(fidl::Error::NotNullable),
2188 Some(len) => len,
2189 };
2190 if len == 0 {
2192 return Ok(());
2193 };
2194 depth.increment()?;
2195 let envelope_size = 8;
2196 let bytes_len = len * envelope_size;
2197 let offset = decoder.out_of_line_offset(bytes_len)?;
2198 let mut _next_ordinal_to_read = 0;
2200 let mut next_offset = offset;
2201 let end_offset = offset + bytes_len;
2202 _next_ordinal_to_read += 1;
2203 if next_offset >= end_offset {
2204 return Ok(());
2205 }
2206
2207 while _next_ordinal_to_read < 1 {
2209 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2210 _next_ordinal_to_read += 1;
2211 next_offset += envelope_size;
2212 }
2213
2214 let next_out_of_line = decoder.next_out_of_line();
2215 let handles_before = decoder.remaining_handles();
2216 if let Some((inlined, num_bytes, num_handles)) =
2217 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2218 {
2219 let member_inline_size =
2220 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2221 if inlined != (member_inline_size <= 4) {
2222 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2223 }
2224 let inner_offset;
2225 let mut inner_depth = depth.clone();
2226 if inlined {
2227 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2228 inner_offset = next_offset;
2229 } else {
2230 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2231 inner_depth.increment()?;
2232 }
2233 let val_ref = self.mark.get_or_insert_with(|| fidl::new_empty!(u32, D));
2234 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
2235 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2236 {
2237 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2238 }
2239 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2240 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2241 }
2242 }
2243
2244 next_offset += envelope_size;
2245 _next_ordinal_to_read += 1;
2246 if next_offset >= end_offset {
2247 return Ok(());
2248 }
2249
2250 while _next_ordinal_to_read < 2 {
2252 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2253 _next_ordinal_to_read += 1;
2254 next_offset += envelope_size;
2255 }
2256
2257 let next_out_of_line = decoder.next_out_of_line();
2258 let handles_before = decoder.remaining_handles();
2259 if let Some((inlined, num_bytes, num_handles)) =
2260 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2261 {
2262 let member_inline_size =
2263 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2264 if inlined != (member_inline_size <= 4) {
2265 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2266 }
2267 let inner_offset;
2268 let mut inner_depth = depth.clone();
2269 if inlined {
2270 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2271 inner_offset = next_offset;
2272 } else {
2273 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2274 inner_depth.increment()?;
2275 }
2276 let val_ref = self.handle.get_or_insert_with(|| fidl::new_empty!(u64, D));
2277 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2278 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2279 {
2280 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2281 }
2282 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2283 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2284 }
2285 }
2286
2287 next_offset += envelope_size;
2288
2289 while next_offset < end_offset {
2291 _next_ordinal_to_read += 1;
2292 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2293 next_offset += envelope_size;
2294 }
2295
2296 Ok(())
2297 }
2298 }
2299
2300 impl fidl::encoding::ValueTypeMarker for NetworkInfo {
2301 type Borrowed<'a> = &'a Self;
2302 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2303 value
2304 }
2305 }
2306
2307 unsafe impl fidl::encoding::TypeMarker for NetworkInfo {
2308 type Owned = Self;
2309
2310 #[inline(always)]
2311 fn inline_align(_context: fidl::encoding::Context) -> usize {
2312 8
2313 }
2314
2315 #[inline(always)]
2316 fn inline_size(_context: fidl::encoding::Context) -> usize {
2317 16
2318 }
2319 }
2320
2321 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<NetworkInfo, D>
2322 for &NetworkInfo
2323 {
2324 #[inline]
2325 unsafe fn encode(
2326 self,
2327 encoder: &mut fidl::encoding::Encoder<'_, D>,
2328 offset: usize,
2329 _depth: fidl::encoding::Depth,
2330 ) -> fidl::Result<()> {
2331 encoder.debug_check_bounds::<NetworkInfo>(offset);
2332 encoder.write_num::<u64>(self.ordinal(), offset);
2333 match self {
2334 NetworkInfo::Starnix(ref val) => {
2335 fidl::encoding::encode_in_envelope::<StarnixNetworkInfo, D>(
2336 <StarnixNetworkInfo as fidl::encoding::ValueTypeMarker>::borrow(val),
2337 encoder,
2338 offset + 8,
2339 _depth,
2340 )
2341 }
2342 NetworkInfo::Fuchsia(ref val) => {
2343 fidl::encoding::encode_in_envelope::<FuchsiaNetworkInfo, D>(
2344 <FuchsiaNetworkInfo as fidl::encoding::ValueTypeMarker>::borrow(val),
2345 encoder,
2346 offset + 8,
2347 _depth,
2348 )
2349 }
2350 NetworkInfo::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2351 }
2352 }
2353 }
2354
2355 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for NetworkInfo {
2356 #[inline(always)]
2357 fn new_empty() -> Self {
2358 Self::__SourceBreaking { unknown_ordinal: 0 }
2359 }
2360
2361 #[inline]
2362 unsafe fn decode(
2363 &mut self,
2364 decoder: &mut fidl::encoding::Decoder<'_, D>,
2365 offset: usize,
2366 mut depth: fidl::encoding::Depth,
2367 ) -> fidl::Result<()> {
2368 decoder.debug_check_bounds::<Self>(offset);
2369 #[allow(unused_variables)]
2370 let next_out_of_line = decoder.next_out_of_line();
2371 let handles_before = decoder.remaining_handles();
2372 let (ordinal, inlined, num_bytes, num_handles) =
2373 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2374
2375 let member_inline_size = match ordinal {
2376 1 => {
2377 <StarnixNetworkInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context)
2378 }
2379 2 => {
2380 <FuchsiaNetworkInfo as fidl::encoding::TypeMarker>::inline_size(decoder.context)
2381 }
2382 0 => return Err(fidl::Error::UnknownUnionTag),
2383 _ => num_bytes as usize,
2384 };
2385
2386 if inlined != (member_inline_size <= 4) {
2387 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2388 }
2389 let _inner_offset;
2390 if inlined {
2391 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2392 _inner_offset = offset + 8;
2393 } else {
2394 depth.increment()?;
2395 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2396 }
2397 match ordinal {
2398 1 => {
2399 #[allow(irrefutable_let_patterns)]
2400 if let NetworkInfo::Starnix(_) = self {
2401 } else {
2403 *self = NetworkInfo::Starnix(fidl::new_empty!(StarnixNetworkInfo, D));
2405 }
2406 #[allow(irrefutable_let_patterns)]
2407 if let NetworkInfo::Starnix(ref mut val) = self {
2408 fidl::decode!(StarnixNetworkInfo, D, val, decoder, _inner_offset, depth)?;
2409 } else {
2410 unreachable!()
2411 }
2412 }
2413 2 => {
2414 #[allow(irrefutable_let_patterns)]
2415 if let NetworkInfo::Fuchsia(_) = self {
2416 } else {
2418 *self = NetworkInfo::Fuchsia(fidl::new_empty!(FuchsiaNetworkInfo, D));
2420 }
2421 #[allow(irrefutable_let_patterns)]
2422 if let NetworkInfo::Fuchsia(ref mut val) = self {
2423 fidl::decode!(FuchsiaNetworkInfo, D, val, decoder, _inner_offset, depth)?;
2424 } else {
2425 unreachable!()
2426 }
2427 }
2428 #[allow(deprecated)]
2429 ordinal => {
2430 for _ in 0..num_handles {
2431 decoder.drop_next_handle()?;
2432 }
2433 *self = NetworkInfo::__SourceBreaking { unknown_ordinal: ordinal };
2434 }
2435 }
2436 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2437 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2438 }
2439 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2440 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2441 }
2442 Ok(())
2443 }
2444 }
2445}