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)]
14pub enum AuthenticateForInterfaceError {
15 InvalidAuthentication,
24 #[doc(hidden)]
25 __SourceBreaking { unknown_ordinal: u32 },
26}
27
28#[macro_export]
30macro_rules! AuthenticateForInterfaceErrorUnknown {
31 () => {
32 _
33 };
34}
35
36impl AuthenticateForInterfaceError {
37 #[inline]
38 pub fn from_primitive(prim: u32) -> Option<Self> {
39 match prim {
40 1 => Some(Self::InvalidAuthentication),
41 _ => None,
42 }
43 }
44
45 #[inline]
46 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
47 match prim {
48 1 => Self::InvalidAuthentication,
49 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
50 }
51 }
52
53 #[inline]
54 pub fn unknown() -> Self {
55 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
56 }
57
58 #[inline]
59 pub const fn into_primitive(self) -> u32 {
60 match self {
61 Self::InvalidAuthentication => 1,
62 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
63 }
64 }
65
66 #[inline]
67 pub fn is_unknown(&self) -> bool {
68 match self {
69 Self::__SourceBreaking { unknown_ordinal: _ } => true,
70 _ => false,
71 }
72 }
73}
74
75#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
78pub enum AuthenticateForRouteTableError {
79 InvalidAuthentication,
87 #[doc(hidden)]
88 __SourceBreaking { unknown_ordinal: u32 },
89}
90
91#[macro_export]
93macro_rules! AuthenticateForRouteTableErrorUnknown {
94 () => {
95 _
96 };
97}
98
99impl AuthenticateForRouteTableError {
100 #[inline]
101 pub fn from_primitive(prim: u32) -> Option<Self> {
102 match prim {
103 1 => Some(Self::InvalidAuthentication),
104 _ => None,
105 }
106 }
107
108 #[inline]
109 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
110 match prim {
111 1 => Self::InvalidAuthentication,
112 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
113 }
114 }
115
116 #[inline]
117 pub fn unknown() -> Self {
118 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
119 }
120
121 #[inline]
122 pub const fn into_primitive(self) -> u32 {
123 match self {
124 Self::InvalidAuthentication => 1,
125 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
126 }
127 }
128
129 #[inline]
130 pub fn is_unknown(&self) -> bool {
131 match self {
132 Self::__SourceBreaking { unknown_ordinal: _ } => true,
133 _ => false,
134 }
135 }
136}
137
138#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
139pub enum BaseRouteTableRemoveError {
140 InvalidOpOnMainTable,
141 #[doc(hidden)]
142 __SourceBreaking {
143 unknown_ordinal: u32,
144 },
145}
146
147#[macro_export]
149macro_rules! BaseRouteTableRemoveErrorUnknown {
150 () => {
151 _
152 };
153}
154
155impl BaseRouteTableRemoveError {
156 #[inline]
157 pub fn from_primitive(prim: u32) -> Option<Self> {
158 match prim {
159 1 => Some(Self::InvalidOpOnMainTable),
160 _ => None,
161 }
162 }
163
164 #[inline]
165 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
166 match prim {
167 1 => Self::InvalidOpOnMainTable,
168 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
169 }
170 }
171
172 #[inline]
173 pub fn unknown() -> Self {
174 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
175 }
176
177 #[inline]
178 pub const fn into_primitive(self) -> u32 {
179 match self {
180 Self::InvalidOpOnMainTable => 1,
181 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
182 }
183 }
184
185 #[inline]
186 pub fn is_unknown(&self) -> bool {
187 match self {
188 Self::__SourceBreaking { unknown_ordinal: _ } => true,
189 _ => false,
190 }
191 }
192}
193
194#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
196pub enum RouteSetError {
197 Unauthenticated,
202 InvalidDestinationSubnet,
205 InvalidNextHop,
208 UnsupportedAction,
211 PreviouslyAuthenticatedInterfaceNoLongerExists,
214 MissingRouteProperties,
217 MissingMetric,
220 #[doc(hidden)]
221 __SourceBreaking { unknown_ordinal: u32 },
222}
223
224#[macro_export]
226macro_rules! RouteSetErrorUnknown {
227 () => {
228 _
229 };
230}
231
232impl RouteSetError {
233 #[inline]
234 pub fn from_primitive(prim: u32) -> Option<Self> {
235 match prim {
236 1 => Some(Self::Unauthenticated),
237 2 => Some(Self::InvalidDestinationSubnet),
238 3 => Some(Self::InvalidNextHop),
239 4 => Some(Self::UnsupportedAction),
240 5 => Some(Self::PreviouslyAuthenticatedInterfaceNoLongerExists),
241 6 => Some(Self::MissingRouteProperties),
242 7 => Some(Self::MissingMetric),
243 _ => None,
244 }
245 }
246
247 #[inline]
248 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
249 match prim {
250 1 => Self::Unauthenticated,
251 2 => Self::InvalidDestinationSubnet,
252 3 => Self::InvalidNextHop,
253 4 => Self::UnsupportedAction,
254 5 => Self::PreviouslyAuthenticatedInterfaceNoLongerExists,
255 6 => Self::MissingRouteProperties,
256 7 => Self::MissingMetric,
257 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
258 }
259 }
260
261 #[inline]
262 pub fn unknown() -> Self {
263 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
264 }
265
266 #[inline]
267 pub const fn into_primitive(self) -> u32 {
268 match self {
269 Self::Unauthenticated => 1,
270 Self::InvalidDestinationSubnet => 2,
271 Self::InvalidNextHop => 3,
272 Self::UnsupportedAction => 4,
273 Self::PreviouslyAuthenticatedInterfaceNoLongerExists => 5,
274 Self::MissingRouteProperties => 6,
275 Self::MissingMetric => 7,
276 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
277 }
278 }
279
280 #[inline]
281 pub fn is_unknown(&self) -> bool {
282 match self {
283 Self::__SourceBreaking { unknown_ordinal: _ } => true,
284 _ => false,
285 }
286 }
287}
288
289#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
291pub enum RuleSetError {
292 Unauthenticated,
295 InvalidAction,
298 RuleAlreadyExists,
300 RuleDoesNotExist,
302 BaseMatcherMissing,
304 InvalidMatcher,
306 #[doc(hidden)]
307 __SourceBreaking { unknown_ordinal: u32 },
308}
309
310#[macro_export]
312macro_rules! RuleSetErrorUnknown {
313 () => {
314 _
315 };
316}
317
318impl RuleSetError {
319 #[inline]
320 pub fn from_primitive(prim: u32) -> Option<Self> {
321 match prim {
322 1 => Some(Self::Unauthenticated),
323 2 => Some(Self::InvalidAction),
324 3 => Some(Self::RuleAlreadyExists),
325 4 => Some(Self::RuleDoesNotExist),
326 5 => Some(Self::BaseMatcherMissing),
327 6 => Some(Self::InvalidMatcher),
328 _ => None,
329 }
330 }
331
332 #[inline]
333 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
334 match prim {
335 1 => Self::Unauthenticated,
336 2 => Self::InvalidAction,
337 3 => Self::RuleAlreadyExists,
338 4 => Self::RuleDoesNotExist,
339 5 => Self::BaseMatcherMissing,
340 6 => Self::InvalidMatcher,
341 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
342 }
343 }
344
345 #[inline]
346 pub fn unknown() -> Self {
347 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
348 }
349
350 #[inline]
351 pub const fn into_primitive(self) -> u32 {
352 match self {
353 Self::Unauthenticated => 1,
354 Self::InvalidAction => 2,
355 Self::RuleAlreadyExists => 3,
356 Self::RuleDoesNotExist => 4,
357 Self::BaseMatcherMissing => 5,
358 Self::InvalidMatcher => 6,
359 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
360 }
361 }
362
363 #[inline]
364 pub fn is_unknown(&self) -> bool {
365 match self {
366 Self::__SourceBreaking { unknown_ordinal: _ } => true,
367 _ => false,
368 }
369 }
370}
371
372#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
373#[repr(C)]
374pub struct BaseRouteTableGetTableIdResponse {
375 pub table_id: u32,
376}
377
378impl fidl::Persistable for BaseRouteTableGetTableIdResponse {}
379
380#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
381#[repr(C)]
382pub struct BaseRuleSetRemoveRuleRequest {
383 pub index: u32,
384}
385
386impl fidl::Persistable for BaseRuleSetRemoveRuleRequest {}
387
388#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
389pub struct RouteSetV4AddRouteResponse {
390 pub did_add: bool,
391}
392
393impl fidl::Persistable for RouteSetV4AddRouteResponse {}
394
395#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
396pub struct RouteSetV4RemoveRouteResponse {
397 pub did_remove: bool,
398}
399
400impl fidl::Persistable for RouteSetV4RemoveRouteResponse {}
401
402#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
403pub struct RouteSetV6AddRouteResponse {
404 pub did_add: bool,
405}
406
407impl fidl::Persistable for RouteSetV6AddRouteResponse {}
408
409#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
410pub struct RouteSetV6RemoveRouteResponse {
411 pub did_remove: bool,
412}
413
414impl fidl::Persistable for RouteSetV6RemoveRouteResponse {}
415
416#[derive(Clone, Debug, Default, PartialEq)]
417pub struct RouteTableOptionsV4 {
418 pub name: Option<String>,
420 #[doc(hidden)]
421 pub __source_breaking: fidl::marker::SourceBreaking,
422}
423
424impl fidl::Persistable for RouteTableOptionsV4 {}
425
426#[derive(Clone, Debug, Default, PartialEq)]
427pub struct RouteTableOptionsV6 {
428 pub name: Option<String>,
430 #[doc(hidden)]
431 pub __source_breaking: fidl::marker::SourceBreaking,
432}
433
434impl fidl::Persistable for RouteTableOptionsV6 {}
435
436mod internal {
437 use super::*;
438 unsafe impl fidl::encoding::TypeMarker for AuthenticateForInterfaceError {
439 type Owned = Self;
440
441 #[inline(always)]
442 fn inline_align(_context: fidl::encoding::Context) -> usize {
443 std::mem::align_of::<u32>()
444 }
445
446 #[inline(always)]
447 fn inline_size(_context: fidl::encoding::Context) -> usize {
448 std::mem::size_of::<u32>()
449 }
450
451 #[inline(always)]
452 fn encode_is_copy() -> bool {
453 false
454 }
455
456 #[inline(always)]
457 fn decode_is_copy() -> bool {
458 false
459 }
460 }
461
462 impl fidl::encoding::ValueTypeMarker for AuthenticateForInterfaceError {
463 type Borrowed<'a> = Self;
464 #[inline(always)]
465 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
466 *value
467 }
468 }
469
470 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
471 for AuthenticateForInterfaceError
472 {
473 #[inline]
474 unsafe fn encode(
475 self,
476 encoder: &mut fidl::encoding::Encoder<'_, D>,
477 offset: usize,
478 _depth: fidl::encoding::Depth,
479 ) -> fidl::Result<()> {
480 encoder.debug_check_bounds::<Self>(offset);
481 encoder.write_num(self.into_primitive(), offset);
482 Ok(())
483 }
484 }
485
486 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
487 for AuthenticateForInterfaceError
488 {
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 unsafe impl fidl::encoding::TypeMarker for AuthenticateForRouteTableError {
509 type Owned = Self;
510
511 #[inline(always)]
512 fn inline_align(_context: fidl::encoding::Context) -> usize {
513 std::mem::align_of::<u32>()
514 }
515
516 #[inline(always)]
517 fn inline_size(_context: fidl::encoding::Context) -> usize {
518 std::mem::size_of::<u32>()
519 }
520
521 #[inline(always)]
522 fn encode_is_copy() -> bool {
523 false
524 }
525
526 #[inline(always)]
527 fn decode_is_copy() -> bool {
528 false
529 }
530 }
531
532 impl fidl::encoding::ValueTypeMarker for AuthenticateForRouteTableError {
533 type Borrowed<'a> = Self;
534 #[inline(always)]
535 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
536 *value
537 }
538 }
539
540 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
541 for AuthenticateForRouteTableError
542 {
543 #[inline]
544 unsafe fn encode(
545 self,
546 encoder: &mut fidl::encoding::Encoder<'_, D>,
547 offset: usize,
548 _depth: fidl::encoding::Depth,
549 ) -> fidl::Result<()> {
550 encoder.debug_check_bounds::<Self>(offset);
551 encoder.write_num(self.into_primitive(), offset);
552 Ok(())
553 }
554 }
555
556 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
557 for AuthenticateForRouteTableError
558 {
559 #[inline(always)]
560 fn new_empty() -> Self {
561 Self::unknown()
562 }
563
564 #[inline]
565 unsafe fn decode(
566 &mut self,
567 decoder: &mut fidl::encoding::Decoder<'_, D>,
568 offset: usize,
569 _depth: fidl::encoding::Depth,
570 ) -> fidl::Result<()> {
571 decoder.debug_check_bounds::<Self>(offset);
572 let prim = decoder.read_num::<u32>(offset);
573
574 *self = Self::from_primitive_allow_unknown(prim);
575 Ok(())
576 }
577 }
578 unsafe impl fidl::encoding::TypeMarker for BaseRouteTableRemoveError {
579 type Owned = Self;
580
581 #[inline(always)]
582 fn inline_align(_context: fidl::encoding::Context) -> usize {
583 std::mem::align_of::<u32>()
584 }
585
586 #[inline(always)]
587 fn inline_size(_context: fidl::encoding::Context) -> usize {
588 std::mem::size_of::<u32>()
589 }
590
591 #[inline(always)]
592 fn encode_is_copy() -> bool {
593 false
594 }
595
596 #[inline(always)]
597 fn decode_is_copy() -> bool {
598 false
599 }
600 }
601
602 impl fidl::encoding::ValueTypeMarker for BaseRouteTableRemoveError {
603 type Borrowed<'a> = Self;
604 #[inline(always)]
605 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
606 *value
607 }
608 }
609
610 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
611 for BaseRouteTableRemoveError
612 {
613 #[inline]
614 unsafe fn encode(
615 self,
616 encoder: &mut fidl::encoding::Encoder<'_, D>,
617 offset: usize,
618 _depth: fidl::encoding::Depth,
619 ) -> fidl::Result<()> {
620 encoder.debug_check_bounds::<Self>(offset);
621 encoder.write_num(self.into_primitive(), offset);
622 Ok(())
623 }
624 }
625
626 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
627 for BaseRouteTableRemoveError
628 {
629 #[inline(always)]
630 fn new_empty() -> Self {
631 Self::unknown()
632 }
633
634 #[inline]
635 unsafe fn decode(
636 &mut self,
637 decoder: &mut fidl::encoding::Decoder<'_, D>,
638 offset: usize,
639 _depth: fidl::encoding::Depth,
640 ) -> fidl::Result<()> {
641 decoder.debug_check_bounds::<Self>(offset);
642 let prim = decoder.read_num::<u32>(offset);
643
644 *self = Self::from_primitive_allow_unknown(prim);
645 Ok(())
646 }
647 }
648 unsafe impl fidl::encoding::TypeMarker for RouteSetError {
649 type Owned = Self;
650
651 #[inline(always)]
652 fn inline_align(_context: fidl::encoding::Context) -> usize {
653 std::mem::align_of::<u32>()
654 }
655
656 #[inline(always)]
657 fn inline_size(_context: fidl::encoding::Context) -> usize {
658 std::mem::size_of::<u32>()
659 }
660
661 #[inline(always)]
662 fn encode_is_copy() -> bool {
663 false
664 }
665
666 #[inline(always)]
667 fn decode_is_copy() -> bool {
668 false
669 }
670 }
671
672 impl fidl::encoding::ValueTypeMarker for RouteSetError {
673 type Borrowed<'a> = Self;
674 #[inline(always)]
675 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
676 *value
677 }
678 }
679
680 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for RouteSetError {
681 #[inline]
682 unsafe fn encode(
683 self,
684 encoder: &mut fidl::encoding::Encoder<'_, D>,
685 offset: usize,
686 _depth: fidl::encoding::Depth,
687 ) -> fidl::Result<()> {
688 encoder.debug_check_bounds::<Self>(offset);
689 encoder.write_num(self.into_primitive(), offset);
690 Ok(())
691 }
692 }
693
694 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RouteSetError {
695 #[inline(always)]
696 fn new_empty() -> Self {
697 Self::unknown()
698 }
699
700 #[inline]
701 unsafe fn decode(
702 &mut self,
703 decoder: &mut fidl::encoding::Decoder<'_, D>,
704 offset: usize,
705 _depth: fidl::encoding::Depth,
706 ) -> fidl::Result<()> {
707 decoder.debug_check_bounds::<Self>(offset);
708 let prim = decoder.read_num::<u32>(offset);
709
710 *self = Self::from_primitive_allow_unknown(prim);
711 Ok(())
712 }
713 }
714 unsafe impl fidl::encoding::TypeMarker for RuleSetError {
715 type Owned = Self;
716
717 #[inline(always)]
718 fn inline_align(_context: fidl::encoding::Context) -> usize {
719 std::mem::align_of::<u32>()
720 }
721
722 #[inline(always)]
723 fn inline_size(_context: fidl::encoding::Context) -> usize {
724 std::mem::size_of::<u32>()
725 }
726
727 #[inline(always)]
728 fn encode_is_copy() -> bool {
729 false
730 }
731
732 #[inline(always)]
733 fn decode_is_copy() -> bool {
734 false
735 }
736 }
737
738 impl fidl::encoding::ValueTypeMarker for RuleSetError {
739 type Borrowed<'a> = Self;
740 #[inline(always)]
741 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
742 *value
743 }
744 }
745
746 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for RuleSetError {
747 #[inline]
748 unsafe fn encode(
749 self,
750 encoder: &mut fidl::encoding::Encoder<'_, D>,
751 offset: usize,
752 _depth: fidl::encoding::Depth,
753 ) -> fidl::Result<()> {
754 encoder.debug_check_bounds::<Self>(offset);
755 encoder.write_num(self.into_primitive(), offset);
756 Ok(())
757 }
758 }
759
760 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RuleSetError {
761 #[inline(always)]
762 fn new_empty() -> Self {
763 Self::unknown()
764 }
765
766 #[inline]
767 unsafe fn decode(
768 &mut self,
769 decoder: &mut fidl::encoding::Decoder<'_, D>,
770 offset: usize,
771 _depth: fidl::encoding::Depth,
772 ) -> fidl::Result<()> {
773 decoder.debug_check_bounds::<Self>(offset);
774 let prim = decoder.read_num::<u32>(offset);
775
776 *self = Self::from_primitive_allow_unknown(prim);
777 Ok(())
778 }
779 }
780
781 impl fidl::encoding::ValueTypeMarker for BaseRouteTableGetTableIdResponse {
782 type Borrowed<'a> = &'a Self;
783 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
784 value
785 }
786 }
787
788 unsafe impl fidl::encoding::TypeMarker for BaseRouteTableGetTableIdResponse {
789 type Owned = Self;
790
791 #[inline(always)]
792 fn inline_align(_context: fidl::encoding::Context) -> usize {
793 4
794 }
795
796 #[inline(always)]
797 fn inline_size(_context: fidl::encoding::Context) -> usize {
798 4
799 }
800 #[inline(always)]
801 fn encode_is_copy() -> bool {
802 true
803 }
804
805 #[inline(always)]
806 fn decode_is_copy() -> bool {
807 true
808 }
809 }
810
811 unsafe impl<D: fidl::encoding::ResourceDialect>
812 fidl::encoding::Encode<BaseRouteTableGetTableIdResponse, D>
813 for &BaseRouteTableGetTableIdResponse
814 {
815 #[inline]
816 unsafe fn encode(
817 self,
818 encoder: &mut fidl::encoding::Encoder<'_, D>,
819 offset: usize,
820 _depth: fidl::encoding::Depth,
821 ) -> fidl::Result<()> {
822 encoder.debug_check_bounds::<BaseRouteTableGetTableIdResponse>(offset);
823 unsafe {
824 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
826 (buf_ptr as *mut BaseRouteTableGetTableIdResponse)
827 .write_unaligned((self as *const BaseRouteTableGetTableIdResponse).read());
828 }
831 Ok(())
832 }
833 }
834 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
835 fidl::encoding::Encode<BaseRouteTableGetTableIdResponse, 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::<BaseRouteTableGetTableIdResponse>(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 BaseRouteTableGetTableIdResponse
855 {
856 #[inline(always)]
857 fn new_empty() -> Self {
858 Self { table_id: fidl::new_empty!(u32, 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 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
870 unsafe {
873 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
874 }
875 Ok(())
876 }
877 }
878
879 impl fidl::encoding::ValueTypeMarker for BaseRuleSetRemoveRuleRequest {
880 type Borrowed<'a> = &'a Self;
881 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
882 value
883 }
884 }
885
886 unsafe impl fidl::encoding::TypeMarker for BaseRuleSetRemoveRuleRequest {
887 type Owned = Self;
888
889 #[inline(always)]
890 fn inline_align(_context: fidl::encoding::Context) -> usize {
891 4
892 }
893
894 #[inline(always)]
895 fn inline_size(_context: fidl::encoding::Context) -> usize {
896 4
897 }
898 #[inline(always)]
899 fn encode_is_copy() -> bool {
900 true
901 }
902
903 #[inline(always)]
904 fn decode_is_copy() -> bool {
905 true
906 }
907 }
908
909 unsafe impl<D: fidl::encoding::ResourceDialect>
910 fidl::encoding::Encode<BaseRuleSetRemoveRuleRequest, D> for &BaseRuleSetRemoveRuleRequest
911 {
912 #[inline]
913 unsafe fn encode(
914 self,
915 encoder: &mut fidl::encoding::Encoder<'_, D>,
916 offset: usize,
917 _depth: fidl::encoding::Depth,
918 ) -> fidl::Result<()> {
919 encoder.debug_check_bounds::<BaseRuleSetRemoveRuleRequest>(offset);
920 unsafe {
921 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
923 (buf_ptr as *mut BaseRuleSetRemoveRuleRequest)
924 .write_unaligned((self as *const BaseRuleSetRemoveRuleRequest).read());
925 }
928 Ok(())
929 }
930 }
931 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
932 fidl::encoding::Encode<BaseRuleSetRemoveRuleRequest, D> for (T0,)
933 {
934 #[inline]
935 unsafe fn encode(
936 self,
937 encoder: &mut fidl::encoding::Encoder<'_, D>,
938 offset: usize,
939 depth: fidl::encoding::Depth,
940 ) -> fidl::Result<()> {
941 encoder.debug_check_bounds::<BaseRuleSetRemoveRuleRequest>(offset);
942 self.0.encode(encoder, offset + 0, depth)?;
946 Ok(())
947 }
948 }
949
950 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
951 for BaseRuleSetRemoveRuleRequest
952 {
953 #[inline(always)]
954 fn new_empty() -> Self {
955 Self { index: fidl::new_empty!(u32, D) }
956 }
957
958 #[inline]
959 unsafe fn decode(
960 &mut self,
961 decoder: &mut fidl::encoding::Decoder<'_, D>,
962 offset: usize,
963 _depth: fidl::encoding::Depth,
964 ) -> fidl::Result<()> {
965 decoder.debug_check_bounds::<Self>(offset);
966 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
967 unsafe {
970 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
971 }
972 Ok(())
973 }
974 }
975
976 impl fidl::encoding::ValueTypeMarker for RouteSetV4AddRouteResponse {
977 type Borrowed<'a> = &'a Self;
978 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
979 value
980 }
981 }
982
983 unsafe impl fidl::encoding::TypeMarker for RouteSetV4AddRouteResponse {
984 type Owned = Self;
985
986 #[inline(always)]
987 fn inline_align(_context: fidl::encoding::Context) -> usize {
988 1
989 }
990
991 #[inline(always)]
992 fn inline_size(_context: fidl::encoding::Context) -> usize {
993 1
994 }
995 }
996
997 unsafe impl<D: fidl::encoding::ResourceDialect>
998 fidl::encoding::Encode<RouteSetV4AddRouteResponse, D> for &RouteSetV4AddRouteResponse
999 {
1000 #[inline]
1001 unsafe fn encode(
1002 self,
1003 encoder: &mut fidl::encoding::Encoder<'_, D>,
1004 offset: usize,
1005 _depth: fidl::encoding::Depth,
1006 ) -> fidl::Result<()> {
1007 encoder.debug_check_bounds::<RouteSetV4AddRouteResponse>(offset);
1008 fidl::encoding::Encode::<RouteSetV4AddRouteResponse, D>::encode(
1010 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.did_add),),
1011 encoder,
1012 offset,
1013 _depth,
1014 )
1015 }
1016 }
1017 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1018 fidl::encoding::Encode<RouteSetV4AddRouteResponse, D> for (T0,)
1019 {
1020 #[inline]
1021 unsafe fn encode(
1022 self,
1023 encoder: &mut fidl::encoding::Encoder<'_, D>,
1024 offset: usize,
1025 depth: fidl::encoding::Depth,
1026 ) -> fidl::Result<()> {
1027 encoder.debug_check_bounds::<RouteSetV4AddRouteResponse>(offset);
1028 self.0.encode(encoder, offset + 0, depth)?;
1032 Ok(())
1033 }
1034 }
1035
1036 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1037 for RouteSetV4AddRouteResponse
1038 {
1039 #[inline(always)]
1040 fn new_empty() -> Self {
1041 Self { did_add: fidl::new_empty!(bool, D) }
1042 }
1043
1044 #[inline]
1045 unsafe fn decode(
1046 &mut self,
1047 decoder: &mut fidl::encoding::Decoder<'_, D>,
1048 offset: usize,
1049 _depth: fidl::encoding::Depth,
1050 ) -> fidl::Result<()> {
1051 decoder.debug_check_bounds::<Self>(offset);
1052 fidl::decode!(bool, D, &mut self.did_add, decoder, offset + 0, _depth)?;
1054 Ok(())
1055 }
1056 }
1057
1058 impl fidl::encoding::ValueTypeMarker for RouteSetV4RemoveRouteResponse {
1059 type Borrowed<'a> = &'a Self;
1060 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1061 value
1062 }
1063 }
1064
1065 unsafe impl fidl::encoding::TypeMarker for RouteSetV4RemoveRouteResponse {
1066 type Owned = Self;
1067
1068 #[inline(always)]
1069 fn inline_align(_context: fidl::encoding::Context) -> usize {
1070 1
1071 }
1072
1073 #[inline(always)]
1074 fn inline_size(_context: fidl::encoding::Context) -> usize {
1075 1
1076 }
1077 }
1078
1079 unsafe impl<D: fidl::encoding::ResourceDialect>
1080 fidl::encoding::Encode<RouteSetV4RemoveRouteResponse, D>
1081 for &RouteSetV4RemoveRouteResponse
1082 {
1083 #[inline]
1084 unsafe fn encode(
1085 self,
1086 encoder: &mut fidl::encoding::Encoder<'_, D>,
1087 offset: usize,
1088 _depth: fidl::encoding::Depth,
1089 ) -> fidl::Result<()> {
1090 encoder.debug_check_bounds::<RouteSetV4RemoveRouteResponse>(offset);
1091 fidl::encoding::Encode::<RouteSetV4RemoveRouteResponse, D>::encode(
1093 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.did_remove),),
1094 encoder,
1095 offset,
1096 _depth,
1097 )
1098 }
1099 }
1100 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1101 fidl::encoding::Encode<RouteSetV4RemoveRouteResponse, D> for (T0,)
1102 {
1103 #[inline]
1104 unsafe fn encode(
1105 self,
1106 encoder: &mut fidl::encoding::Encoder<'_, D>,
1107 offset: usize,
1108 depth: fidl::encoding::Depth,
1109 ) -> fidl::Result<()> {
1110 encoder.debug_check_bounds::<RouteSetV4RemoveRouteResponse>(offset);
1111 self.0.encode(encoder, offset + 0, depth)?;
1115 Ok(())
1116 }
1117 }
1118
1119 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1120 for RouteSetV4RemoveRouteResponse
1121 {
1122 #[inline(always)]
1123 fn new_empty() -> Self {
1124 Self { did_remove: fidl::new_empty!(bool, D) }
1125 }
1126
1127 #[inline]
1128 unsafe fn decode(
1129 &mut self,
1130 decoder: &mut fidl::encoding::Decoder<'_, D>,
1131 offset: usize,
1132 _depth: fidl::encoding::Depth,
1133 ) -> fidl::Result<()> {
1134 decoder.debug_check_bounds::<Self>(offset);
1135 fidl::decode!(bool, D, &mut self.did_remove, decoder, offset + 0, _depth)?;
1137 Ok(())
1138 }
1139 }
1140
1141 impl fidl::encoding::ValueTypeMarker for RouteSetV6AddRouteResponse {
1142 type Borrowed<'a> = &'a Self;
1143 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1144 value
1145 }
1146 }
1147
1148 unsafe impl fidl::encoding::TypeMarker for RouteSetV6AddRouteResponse {
1149 type Owned = Self;
1150
1151 #[inline(always)]
1152 fn inline_align(_context: fidl::encoding::Context) -> usize {
1153 1
1154 }
1155
1156 #[inline(always)]
1157 fn inline_size(_context: fidl::encoding::Context) -> usize {
1158 1
1159 }
1160 }
1161
1162 unsafe impl<D: fidl::encoding::ResourceDialect>
1163 fidl::encoding::Encode<RouteSetV6AddRouteResponse, D> for &RouteSetV6AddRouteResponse
1164 {
1165 #[inline]
1166 unsafe fn encode(
1167 self,
1168 encoder: &mut fidl::encoding::Encoder<'_, D>,
1169 offset: usize,
1170 _depth: fidl::encoding::Depth,
1171 ) -> fidl::Result<()> {
1172 encoder.debug_check_bounds::<RouteSetV6AddRouteResponse>(offset);
1173 fidl::encoding::Encode::<RouteSetV6AddRouteResponse, D>::encode(
1175 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.did_add),),
1176 encoder,
1177 offset,
1178 _depth,
1179 )
1180 }
1181 }
1182 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1183 fidl::encoding::Encode<RouteSetV6AddRouteResponse, D> for (T0,)
1184 {
1185 #[inline]
1186 unsafe fn encode(
1187 self,
1188 encoder: &mut fidl::encoding::Encoder<'_, D>,
1189 offset: usize,
1190 depth: fidl::encoding::Depth,
1191 ) -> fidl::Result<()> {
1192 encoder.debug_check_bounds::<RouteSetV6AddRouteResponse>(offset);
1193 self.0.encode(encoder, offset + 0, depth)?;
1197 Ok(())
1198 }
1199 }
1200
1201 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1202 for RouteSetV6AddRouteResponse
1203 {
1204 #[inline(always)]
1205 fn new_empty() -> Self {
1206 Self { did_add: fidl::new_empty!(bool, D) }
1207 }
1208
1209 #[inline]
1210 unsafe fn decode(
1211 &mut self,
1212 decoder: &mut fidl::encoding::Decoder<'_, D>,
1213 offset: usize,
1214 _depth: fidl::encoding::Depth,
1215 ) -> fidl::Result<()> {
1216 decoder.debug_check_bounds::<Self>(offset);
1217 fidl::decode!(bool, D, &mut self.did_add, decoder, offset + 0, _depth)?;
1219 Ok(())
1220 }
1221 }
1222
1223 impl fidl::encoding::ValueTypeMarker for RouteSetV6RemoveRouteResponse {
1224 type Borrowed<'a> = &'a Self;
1225 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1226 value
1227 }
1228 }
1229
1230 unsafe impl fidl::encoding::TypeMarker for RouteSetV6RemoveRouteResponse {
1231 type Owned = Self;
1232
1233 #[inline(always)]
1234 fn inline_align(_context: fidl::encoding::Context) -> usize {
1235 1
1236 }
1237
1238 #[inline(always)]
1239 fn inline_size(_context: fidl::encoding::Context) -> usize {
1240 1
1241 }
1242 }
1243
1244 unsafe impl<D: fidl::encoding::ResourceDialect>
1245 fidl::encoding::Encode<RouteSetV6RemoveRouteResponse, D>
1246 for &RouteSetV6RemoveRouteResponse
1247 {
1248 #[inline]
1249 unsafe fn encode(
1250 self,
1251 encoder: &mut fidl::encoding::Encoder<'_, D>,
1252 offset: usize,
1253 _depth: fidl::encoding::Depth,
1254 ) -> fidl::Result<()> {
1255 encoder.debug_check_bounds::<RouteSetV6RemoveRouteResponse>(offset);
1256 fidl::encoding::Encode::<RouteSetV6RemoveRouteResponse, D>::encode(
1258 (<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.did_remove),),
1259 encoder,
1260 offset,
1261 _depth,
1262 )
1263 }
1264 }
1265 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
1266 fidl::encoding::Encode<RouteSetV6RemoveRouteResponse, D> for (T0,)
1267 {
1268 #[inline]
1269 unsafe fn encode(
1270 self,
1271 encoder: &mut fidl::encoding::Encoder<'_, D>,
1272 offset: usize,
1273 depth: fidl::encoding::Depth,
1274 ) -> fidl::Result<()> {
1275 encoder.debug_check_bounds::<RouteSetV6RemoveRouteResponse>(offset);
1276 self.0.encode(encoder, offset + 0, depth)?;
1280 Ok(())
1281 }
1282 }
1283
1284 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1285 for RouteSetV6RemoveRouteResponse
1286 {
1287 #[inline(always)]
1288 fn new_empty() -> Self {
1289 Self { did_remove: fidl::new_empty!(bool, D) }
1290 }
1291
1292 #[inline]
1293 unsafe fn decode(
1294 &mut self,
1295 decoder: &mut fidl::encoding::Decoder<'_, D>,
1296 offset: usize,
1297 _depth: fidl::encoding::Depth,
1298 ) -> fidl::Result<()> {
1299 decoder.debug_check_bounds::<Self>(offset);
1300 fidl::decode!(bool, D, &mut self.did_remove, decoder, offset + 0, _depth)?;
1302 Ok(())
1303 }
1304 }
1305
1306 impl RouteTableOptionsV4 {
1307 #[inline(always)]
1308 fn max_ordinal_present(&self) -> u64 {
1309 if let Some(_) = self.name {
1310 return 1;
1311 }
1312 0
1313 }
1314 }
1315
1316 impl fidl::encoding::ValueTypeMarker for RouteTableOptionsV4 {
1317 type Borrowed<'a> = &'a Self;
1318 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1319 value
1320 }
1321 }
1322
1323 unsafe impl fidl::encoding::TypeMarker for RouteTableOptionsV4 {
1324 type Owned = Self;
1325
1326 #[inline(always)]
1327 fn inline_align(_context: fidl::encoding::Context) -> usize {
1328 8
1329 }
1330
1331 #[inline(always)]
1332 fn inline_size(_context: fidl::encoding::Context) -> usize {
1333 16
1334 }
1335 }
1336
1337 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RouteTableOptionsV4, D>
1338 for &RouteTableOptionsV4
1339 {
1340 unsafe fn encode(
1341 self,
1342 encoder: &mut fidl::encoding::Encoder<'_, D>,
1343 offset: usize,
1344 mut depth: fidl::encoding::Depth,
1345 ) -> fidl::Result<()> {
1346 encoder.debug_check_bounds::<RouteTableOptionsV4>(offset);
1347 let max_ordinal: u64 = self.max_ordinal_present();
1349 encoder.write_num(max_ordinal, offset);
1350 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1351 if max_ordinal == 0 {
1353 return Ok(());
1354 }
1355 depth.increment()?;
1356 let envelope_size = 8;
1357 let bytes_len = max_ordinal as usize * envelope_size;
1358 #[allow(unused_variables)]
1359 let offset = encoder.out_of_line_offset(bytes_len);
1360 let mut _prev_end_offset: usize = 0;
1361 if 1 > max_ordinal {
1362 return Ok(());
1363 }
1364
1365 let cur_offset: usize = (1 - 1) * envelope_size;
1368
1369 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1371
1372 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>, D>(
1377 self.name.as_ref().map(
1378 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
1379 ),
1380 encoder,
1381 offset + cur_offset,
1382 depth,
1383 )?;
1384
1385 _prev_end_offset = cur_offset + envelope_size;
1386
1387 Ok(())
1388 }
1389 }
1390
1391 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RouteTableOptionsV4 {
1392 #[inline(always)]
1393 fn new_empty() -> Self {
1394 Self::default()
1395 }
1396
1397 unsafe fn decode(
1398 &mut self,
1399 decoder: &mut fidl::encoding::Decoder<'_, D>,
1400 offset: usize,
1401 mut depth: fidl::encoding::Depth,
1402 ) -> fidl::Result<()> {
1403 decoder.debug_check_bounds::<Self>(offset);
1404 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1405 None => return Err(fidl::Error::NotNullable),
1406 Some(len) => len,
1407 };
1408 if len == 0 {
1410 return Ok(());
1411 };
1412 depth.increment()?;
1413 let envelope_size = 8;
1414 let bytes_len = len * envelope_size;
1415 let offset = decoder.out_of_line_offset(bytes_len)?;
1416 let mut _next_ordinal_to_read = 0;
1418 let mut next_offset = offset;
1419 let end_offset = offset + bytes_len;
1420 _next_ordinal_to_read += 1;
1421 if next_offset >= end_offset {
1422 return Ok(());
1423 }
1424
1425 while _next_ordinal_to_read < 1 {
1427 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1428 _next_ordinal_to_read += 1;
1429 next_offset += envelope_size;
1430 }
1431
1432 let next_out_of_line = decoder.next_out_of_line();
1433 let handles_before = decoder.remaining_handles();
1434 if let Some((inlined, num_bytes, num_handles)) =
1435 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1436 {
1437 let member_inline_size =
1438 <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
1439 decoder.context,
1440 );
1441 if inlined != (member_inline_size <= 4) {
1442 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1443 }
1444 let inner_offset;
1445 let mut inner_depth = depth.clone();
1446 if inlined {
1447 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1448 inner_offset = next_offset;
1449 } else {
1450 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1451 inner_depth.increment()?;
1452 }
1453 let val_ref = self
1454 .name
1455 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>, D));
1456 fidl::decode!(
1457 fidl::encoding::BoundedString<255>,
1458 D,
1459 val_ref,
1460 decoder,
1461 inner_offset,
1462 inner_depth
1463 )?;
1464 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1465 {
1466 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1467 }
1468 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1469 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1470 }
1471 }
1472
1473 next_offset += envelope_size;
1474
1475 while next_offset < end_offset {
1477 _next_ordinal_to_read += 1;
1478 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1479 next_offset += envelope_size;
1480 }
1481
1482 Ok(())
1483 }
1484 }
1485
1486 impl RouteTableOptionsV6 {
1487 #[inline(always)]
1488 fn max_ordinal_present(&self) -> u64 {
1489 if let Some(_) = self.name {
1490 return 1;
1491 }
1492 0
1493 }
1494 }
1495
1496 impl fidl::encoding::ValueTypeMarker for RouteTableOptionsV6 {
1497 type Borrowed<'a> = &'a Self;
1498 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1499 value
1500 }
1501 }
1502
1503 unsafe impl fidl::encoding::TypeMarker for RouteTableOptionsV6 {
1504 type Owned = Self;
1505
1506 #[inline(always)]
1507 fn inline_align(_context: fidl::encoding::Context) -> usize {
1508 8
1509 }
1510
1511 #[inline(always)]
1512 fn inline_size(_context: fidl::encoding::Context) -> usize {
1513 16
1514 }
1515 }
1516
1517 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RouteTableOptionsV6, D>
1518 for &RouteTableOptionsV6
1519 {
1520 unsafe fn encode(
1521 self,
1522 encoder: &mut fidl::encoding::Encoder<'_, D>,
1523 offset: usize,
1524 mut depth: fidl::encoding::Depth,
1525 ) -> fidl::Result<()> {
1526 encoder.debug_check_bounds::<RouteTableOptionsV6>(offset);
1527 let max_ordinal: u64 = self.max_ordinal_present();
1529 encoder.write_num(max_ordinal, offset);
1530 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1531 if max_ordinal == 0 {
1533 return Ok(());
1534 }
1535 depth.increment()?;
1536 let envelope_size = 8;
1537 let bytes_len = max_ordinal as usize * envelope_size;
1538 #[allow(unused_variables)]
1539 let offset = encoder.out_of_line_offset(bytes_len);
1540 let mut _prev_end_offset: usize = 0;
1541 if 1 > max_ordinal {
1542 return Ok(());
1543 }
1544
1545 let cur_offset: usize = (1 - 1) * envelope_size;
1548
1549 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1551
1552 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>, D>(
1557 self.name.as_ref().map(
1558 <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
1559 ),
1560 encoder,
1561 offset + cur_offset,
1562 depth,
1563 )?;
1564
1565 _prev_end_offset = cur_offset + envelope_size;
1566
1567 Ok(())
1568 }
1569 }
1570
1571 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RouteTableOptionsV6 {
1572 #[inline(always)]
1573 fn new_empty() -> Self {
1574 Self::default()
1575 }
1576
1577 unsafe fn decode(
1578 &mut self,
1579 decoder: &mut fidl::encoding::Decoder<'_, D>,
1580 offset: usize,
1581 mut depth: fidl::encoding::Depth,
1582 ) -> fidl::Result<()> {
1583 decoder.debug_check_bounds::<Self>(offset);
1584 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1585 None => return Err(fidl::Error::NotNullable),
1586 Some(len) => len,
1587 };
1588 if len == 0 {
1590 return Ok(());
1591 };
1592 depth.increment()?;
1593 let envelope_size = 8;
1594 let bytes_len = len * envelope_size;
1595 let offset = decoder.out_of_line_offset(bytes_len)?;
1596 let mut _next_ordinal_to_read = 0;
1598 let mut next_offset = offset;
1599 let end_offset = offset + bytes_len;
1600 _next_ordinal_to_read += 1;
1601 if next_offset >= end_offset {
1602 return Ok(());
1603 }
1604
1605 while _next_ordinal_to_read < 1 {
1607 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1608 _next_ordinal_to_read += 1;
1609 next_offset += envelope_size;
1610 }
1611
1612 let next_out_of_line = decoder.next_out_of_line();
1613 let handles_before = decoder.remaining_handles();
1614 if let Some((inlined, num_bytes, num_handles)) =
1615 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1616 {
1617 let member_inline_size =
1618 <fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
1619 decoder.context,
1620 );
1621 if inlined != (member_inline_size <= 4) {
1622 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1623 }
1624 let inner_offset;
1625 let mut inner_depth = depth.clone();
1626 if inlined {
1627 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1628 inner_offset = next_offset;
1629 } else {
1630 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1631 inner_depth.increment()?;
1632 }
1633 let val_ref = self
1634 .name
1635 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>, D));
1636 fidl::decode!(
1637 fidl::encoding::BoundedString<255>,
1638 D,
1639 val_ref,
1640 decoder,
1641 inner_offset,
1642 inner_depth
1643 )?;
1644 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1645 {
1646 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1647 }
1648 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1649 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1650 }
1651 }
1652
1653 next_offset += envelope_size;
1654
1655 while next_offset < end_offset {
1657 _next_ordinal_to_read += 1;
1658 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1659 next_offset += envelope_size;
1660 }
1661
1662 Ok(())
1663 }
1664 }
1665}