1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub const MAX_MULTICAST_INTERFACES: u8 = 32;
19
20pub const MAX_ROUTING_EVENTS: u16 = 128;
22
23#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
24#[repr(u32)]
25pub enum Ipv4RoutingTableControllerAddRouteError {
26 InvalidAddress = 1,
29 RequiredRouteFieldsMissing = 2,
31 InterfaceNotFound = 3,
33 InputCannotBeOutput = 4,
36 DuplicateOutput = 5,
39}
40
41impl Ipv4RoutingTableControllerAddRouteError {
42 #[inline]
43 pub fn from_primitive(prim: u32) -> Option<Self> {
44 match prim {
45 1 => Some(Self::InvalidAddress),
46 2 => Some(Self::RequiredRouteFieldsMissing),
47 3 => Some(Self::InterfaceNotFound),
48 4 => Some(Self::InputCannotBeOutput),
49 5 => Some(Self::DuplicateOutput),
50 _ => None,
51 }
52 }
53
54 #[inline]
55 pub const fn into_primitive(self) -> u32 {
56 self as u32
57 }
58}
59
60#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
61#[repr(u32)]
62pub enum Ipv4RoutingTableControllerDelRouteError {
63 InvalidAddress = 1,
66 NotFound = 2,
68}
69
70impl Ipv4RoutingTableControllerDelRouteError {
71 #[inline]
72 pub fn from_primitive(prim: u32) -> Option<Self> {
73 match prim {
74 1 => Some(Self::InvalidAddress),
75 2 => Some(Self::NotFound),
76 _ => None,
77 }
78 }
79
80 #[inline]
81 pub const fn into_primitive(self) -> u32 {
82 self as u32
83 }
84}
85
86#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
87#[repr(u32)]
88pub enum Ipv4RoutingTableControllerGetRouteStatsError {
89 InvalidAddress = 1,
92 NotFound = 2,
94}
95
96impl Ipv4RoutingTableControllerGetRouteStatsError {
97 #[inline]
98 pub fn from_primitive(prim: u32) -> Option<Self> {
99 match prim {
100 1 => Some(Self::InvalidAddress),
101 2 => Some(Self::NotFound),
102 _ => None,
103 }
104 }
105
106 #[inline]
107 pub const fn into_primitive(self) -> u32 {
108 self as u32
109 }
110}
111
112#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
113#[repr(u32)]
114pub enum Ipv6RoutingTableControllerAddRouteError {
115 InvalidAddress = 1,
118 RequiredRouteFieldsMissing = 2,
120 InterfaceNotFound = 3,
122 InputCannotBeOutput = 4,
125 DuplicateOutput = 5,
128}
129
130impl Ipv6RoutingTableControllerAddRouteError {
131 #[inline]
132 pub fn from_primitive(prim: u32) -> Option<Self> {
133 match prim {
134 1 => Some(Self::InvalidAddress),
135 2 => Some(Self::RequiredRouteFieldsMissing),
136 3 => Some(Self::InterfaceNotFound),
137 4 => Some(Self::InputCannotBeOutput),
138 5 => Some(Self::DuplicateOutput),
139 _ => None,
140 }
141 }
142
143 #[inline]
144 pub const fn into_primitive(self) -> u32 {
145 self as u32
146 }
147}
148
149#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
150#[repr(u32)]
151pub enum Ipv6RoutingTableControllerDelRouteError {
152 InvalidAddress = 1,
155 NotFound = 2,
157}
158
159impl Ipv6RoutingTableControllerDelRouteError {
160 #[inline]
161 pub fn from_primitive(prim: u32) -> Option<Self> {
162 match prim {
163 1 => Some(Self::InvalidAddress),
164 2 => Some(Self::NotFound),
165 _ => None,
166 }
167 }
168
169 #[inline]
170 pub const fn into_primitive(self) -> u32 {
171 self as u32
172 }
173}
174
175#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
176#[repr(u32)]
177pub enum Ipv6RoutingTableControllerGetRouteStatsError {
178 InvalidAddress = 1,
181 NotFound = 2,
183}
184
185impl Ipv6RoutingTableControllerGetRouteStatsError {
186 #[inline]
187 pub fn from_primitive(prim: u32) -> Option<Self> {
188 match prim {
189 1 => Some(Self::InvalidAddress),
190 2 => Some(Self::NotFound),
191 _ => None,
192 }
193 }
194
195 #[inline]
196 pub const fn into_primitive(self) -> u32 {
197 self as u32
198 }
199}
200
201#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
203#[repr(u32)]
204pub enum TableControllerCloseReason {
205 AlreadyInUse = 1,
207 HangingGetError = 2,
210}
211
212impl TableControllerCloseReason {
213 #[inline]
214 pub fn from_primitive(prim: u32) -> Option<Self> {
215 match prim {
216 1 => Some(Self::AlreadyInUse),
217 2 => Some(Self::HangingGetError),
218 _ => None,
219 }
220 }
221
222 #[inline]
223 pub const fn into_primitive(self) -> u32 {
224 self as u32
225 }
226}
227
228#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
229pub struct Empty;
230
231impl fidl::Persistable for Empty {}
232
233#[derive(Clone, Debug, PartialEq)]
234pub struct Ipv4RoutingTableControllerAddRouteRequest {
235 pub addresses: Ipv4UnicastSourceAndMulticastDestination,
236 pub route: Route,
237}
238
239impl fidl::Persistable for Ipv4RoutingTableControllerAddRouteRequest {}
240
241#[derive(Clone, Debug, PartialEq)]
242pub struct Ipv4RoutingTableControllerDelRouteRequest {
243 pub addresses: Ipv4UnicastSourceAndMulticastDestination,
244}
245
246impl fidl::Persistable for Ipv4RoutingTableControllerDelRouteRequest {}
247
248#[derive(Clone, Debug, PartialEq)]
249pub struct Ipv4RoutingTableControllerGetRouteStatsRequest {
250 pub addresses: Ipv4UnicastSourceAndMulticastDestination,
251}
252
253impl fidl::Persistable for Ipv4RoutingTableControllerGetRouteStatsRequest {}
254
255#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
256pub struct Ipv4RoutingTableControllerOnCloseRequest {
257 pub error: TableControllerCloseReason,
258}
259
260impl fidl::Persistable for Ipv4RoutingTableControllerOnCloseRequest {}
261
262#[derive(Clone, Debug, PartialEq)]
263pub struct Ipv4RoutingTableControllerWatchRoutingEventsResponse {
264 pub dropped_events: u64,
265 pub addresses: Ipv4UnicastSourceAndMulticastDestination,
266 pub input_interface: u64,
267 pub event: RoutingEvent,
268}
269
270impl fidl::Persistable for Ipv4RoutingTableControllerWatchRoutingEventsResponse {}
271
272#[derive(Clone, Debug, PartialEq)]
273pub struct Ipv4RoutingTableControllerGetRouteStatsResponse {
274 pub stats: RouteStats,
275}
276
277impl fidl::Persistable for Ipv4RoutingTableControllerGetRouteStatsResponse {}
278
279#[derive(Clone, Debug, PartialEq)]
283pub struct Ipv4UnicastSourceAndMulticastDestination {
284 pub unicast_source: fidl_fuchsia_net__common::Ipv4Address,
286 pub multicast_destination: fidl_fuchsia_net__common::Ipv4Address,
288}
289
290impl fidl::Persistable for Ipv4UnicastSourceAndMulticastDestination {}
291
292#[derive(Clone, Debug, PartialEq)]
293pub struct Ipv6RoutingTableControllerAddRouteRequest {
294 pub addresses: Ipv6UnicastSourceAndMulticastDestination,
295 pub route: Route,
296}
297
298impl fidl::Persistable for Ipv6RoutingTableControllerAddRouteRequest {}
299
300#[derive(Clone, Debug, PartialEq)]
301pub struct Ipv6RoutingTableControllerDelRouteRequest {
302 pub addresses: Ipv6UnicastSourceAndMulticastDestination,
303}
304
305impl fidl::Persistable for Ipv6RoutingTableControllerDelRouteRequest {}
306
307#[derive(Clone, Debug, PartialEq)]
308pub struct Ipv6RoutingTableControllerGetRouteStatsRequest {
309 pub addresses: Ipv6UnicastSourceAndMulticastDestination,
310}
311
312impl fidl::Persistable for Ipv6RoutingTableControllerGetRouteStatsRequest {}
313
314#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
315pub struct Ipv6RoutingTableControllerOnCloseRequest {
316 pub error: TableControllerCloseReason,
317}
318
319impl fidl::Persistable for Ipv6RoutingTableControllerOnCloseRequest {}
320
321#[derive(Clone, Debug, PartialEq)]
322pub struct Ipv6RoutingTableControllerWatchRoutingEventsResponse {
323 pub dropped_events: u64,
324 pub addresses: Ipv6UnicastSourceAndMulticastDestination,
325 pub input_interface: u64,
326 pub event: RoutingEvent,
327}
328
329impl fidl::Persistable for Ipv6RoutingTableControllerWatchRoutingEventsResponse {}
330
331#[derive(Clone, Debug, PartialEq)]
332pub struct Ipv6RoutingTableControllerGetRouteStatsResponse {
333 pub stats: RouteStats,
334}
335
336impl fidl::Persistable for Ipv6RoutingTableControllerGetRouteStatsResponse {}
337
338#[derive(Clone, Debug, PartialEq)]
342pub struct Ipv6UnicastSourceAndMulticastDestination {
343 pub unicast_source: fidl_fuchsia_net__common::Ipv6Address,
345 pub multicast_destination: fidl_fuchsia_net__common::Ipv6Address,
347}
348
349impl fidl::Persistable for Ipv6UnicastSourceAndMulticastDestination {}
350
351#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
352#[repr(C)]
353pub struct OutgoingInterfaces {
354 pub id: u64,
356 pub min_ttl: u8,
361}
362
363impl fidl::Persistable for OutgoingInterfaces {}
364
365#[derive(Clone, Debug, Default, PartialEq)]
367pub struct Route {
368 pub expected_input_interface: Option<u64>,
372 pub action: Option<Action>,
376 #[doc(hidden)]
377 pub __source_breaking: fidl::marker::SourceBreaking,
378}
379
380impl fidl::Persistable for Route {}
381
382#[derive(Clone, Debug, Default, PartialEq)]
384pub struct RouteStats {
385 pub last_used: Option<i64>,
391 #[doc(hidden)]
392 pub __source_breaking: fidl::marker::SourceBreaking,
393}
394
395impl fidl::Persistable for RouteStats {}
396
397#[derive(Clone, Debug, Default, PartialEq)]
398pub struct WrongInputInterface {
399 pub expected_input_interface: Option<u64>,
401 #[doc(hidden)]
402 pub __source_breaking: fidl::marker::SourceBreaking,
403}
404
405impl fidl::Persistable for WrongInputInterface {}
406
407#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
408pub enum Action {
409 OutgoingInterfaces(Vec<OutgoingInterfaces>),
413}
414
415impl Action {
416 #[inline]
417 pub fn ordinal(&self) -> u64 {
418 match *self {
419 Self::OutgoingInterfaces(_) => 1,
420 }
421 }
422}
423
424impl fidl::Persistable for Action {}
425
426#[derive(Clone, Debug, PartialEq)]
428pub enum RoutingEvent {
429 MissingRoute(Empty),
436 WrongInputInterface(WrongInputInterface),
442}
443
444impl RoutingEvent {
445 #[inline]
446 pub fn ordinal(&self) -> u64 {
447 match *self {
448 Self::MissingRoute(_) => 1,
449 Self::WrongInputInterface(_) => 2,
450 }
451 }
452}
453
454impl fidl::Persistable for RoutingEvent {}
455
456pub mod ipv4_routing_table_controller_ordinals {
457 pub const ADD_ROUTE: u64 = 0x6098a90553ef1aed;
458 pub const DEL_ROUTE: u64 = 0x14a0727b797aff74;
459 pub const GET_ROUTE_STATS: u64 = 0x176ad8488370c1e9;
460 pub const WATCH_ROUTING_EVENTS: u64 = 0x3e4336c50718d7f9;
461 pub const ON_CLOSE: u64 = 0x3dec49c6c2070f14;
462}
463
464pub mod ipv6_routing_table_controller_ordinals {
465 pub const ADD_ROUTE: u64 = 0x71ca1f54a716de90;
466 pub const DEL_ROUTE: u64 = 0x35b6c2ce4a7b3f13;
467 pub const GET_ROUTE_STATS: u64 = 0x6d7fa5e9f18ef79f;
468 pub const WATCH_ROUTING_EVENTS: u64 = 0x22a94526a0ea1078;
469 pub const ON_CLOSE: u64 = 0x2d3a353489d1e0be;
470}
471
472mod internal {
473 use super::*;
474 unsafe impl fidl::encoding::TypeMarker for Ipv4RoutingTableControllerAddRouteError {
475 type Owned = Self;
476
477 #[inline(always)]
478 fn inline_align(_context: fidl::encoding::Context) -> usize {
479 std::mem::align_of::<u32>()
480 }
481
482 #[inline(always)]
483 fn inline_size(_context: fidl::encoding::Context) -> usize {
484 std::mem::size_of::<u32>()
485 }
486
487 #[inline(always)]
488 fn encode_is_copy() -> bool {
489 true
490 }
491
492 #[inline(always)]
493 fn decode_is_copy() -> bool {
494 false
495 }
496 }
497
498 impl fidl::encoding::ValueTypeMarker for Ipv4RoutingTableControllerAddRouteError {
499 type Borrowed<'a> = Self;
500 #[inline(always)]
501 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
502 *value
503 }
504 }
505
506 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
507 for Ipv4RoutingTableControllerAddRouteError
508 {
509 #[inline]
510 unsafe fn encode(
511 self,
512 encoder: &mut fidl::encoding::Encoder<'_, D>,
513 offset: usize,
514 _depth: fidl::encoding::Depth,
515 ) -> fidl::Result<()> {
516 encoder.debug_check_bounds::<Self>(offset);
517 encoder.write_num(self.into_primitive(), offset);
518 Ok(())
519 }
520 }
521
522 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
523 for Ipv4RoutingTableControllerAddRouteError
524 {
525 #[inline(always)]
526 fn new_empty() -> Self {
527 Self::InvalidAddress
528 }
529
530 #[inline]
531 unsafe fn decode(
532 &mut self,
533 decoder: &mut fidl::encoding::Decoder<'_, D>,
534 offset: usize,
535 _depth: fidl::encoding::Depth,
536 ) -> fidl::Result<()> {
537 decoder.debug_check_bounds::<Self>(offset);
538 let prim = decoder.read_num::<u32>(offset);
539
540 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
541 Ok(())
542 }
543 }
544 unsafe impl fidl::encoding::TypeMarker for Ipv4RoutingTableControllerDelRouteError {
545 type Owned = Self;
546
547 #[inline(always)]
548 fn inline_align(_context: fidl::encoding::Context) -> usize {
549 std::mem::align_of::<u32>()
550 }
551
552 #[inline(always)]
553 fn inline_size(_context: fidl::encoding::Context) -> usize {
554 std::mem::size_of::<u32>()
555 }
556
557 #[inline(always)]
558 fn encode_is_copy() -> bool {
559 true
560 }
561
562 #[inline(always)]
563 fn decode_is_copy() -> bool {
564 false
565 }
566 }
567
568 impl fidl::encoding::ValueTypeMarker for Ipv4RoutingTableControllerDelRouteError {
569 type Borrowed<'a> = Self;
570 #[inline(always)]
571 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
572 *value
573 }
574 }
575
576 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
577 for Ipv4RoutingTableControllerDelRouteError
578 {
579 #[inline]
580 unsafe fn encode(
581 self,
582 encoder: &mut fidl::encoding::Encoder<'_, D>,
583 offset: usize,
584 _depth: fidl::encoding::Depth,
585 ) -> fidl::Result<()> {
586 encoder.debug_check_bounds::<Self>(offset);
587 encoder.write_num(self.into_primitive(), offset);
588 Ok(())
589 }
590 }
591
592 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
593 for Ipv4RoutingTableControllerDelRouteError
594 {
595 #[inline(always)]
596 fn new_empty() -> Self {
597 Self::InvalidAddress
598 }
599
600 #[inline]
601 unsafe fn decode(
602 &mut self,
603 decoder: &mut fidl::encoding::Decoder<'_, D>,
604 offset: usize,
605 _depth: fidl::encoding::Depth,
606 ) -> fidl::Result<()> {
607 decoder.debug_check_bounds::<Self>(offset);
608 let prim = decoder.read_num::<u32>(offset);
609
610 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
611 Ok(())
612 }
613 }
614 unsafe impl fidl::encoding::TypeMarker for Ipv4RoutingTableControllerGetRouteStatsError {
615 type Owned = Self;
616
617 #[inline(always)]
618 fn inline_align(_context: fidl::encoding::Context) -> usize {
619 std::mem::align_of::<u32>()
620 }
621
622 #[inline(always)]
623 fn inline_size(_context: fidl::encoding::Context) -> usize {
624 std::mem::size_of::<u32>()
625 }
626
627 #[inline(always)]
628 fn encode_is_copy() -> bool {
629 true
630 }
631
632 #[inline(always)]
633 fn decode_is_copy() -> bool {
634 false
635 }
636 }
637
638 impl fidl::encoding::ValueTypeMarker for Ipv4RoutingTableControllerGetRouteStatsError {
639 type Borrowed<'a> = Self;
640 #[inline(always)]
641 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
642 *value
643 }
644 }
645
646 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
647 for Ipv4RoutingTableControllerGetRouteStatsError
648 {
649 #[inline]
650 unsafe fn encode(
651 self,
652 encoder: &mut fidl::encoding::Encoder<'_, D>,
653 offset: usize,
654 _depth: fidl::encoding::Depth,
655 ) -> fidl::Result<()> {
656 encoder.debug_check_bounds::<Self>(offset);
657 encoder.write_num(self.into_primitive(), offset);
658 Ok(())
659 }
660 }
661
662 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
663 for Ipv4RoutingTableControllerGetRouteStatsError
664 {
665 #[inline(always)]
666 fn new_empty() -> Self {
667 Self::InvalidAddress
668 }
669
670 #[inline]
671 unsafe fn decode(
672 &mut self,
673 decoder: &mut fidl::encoding::Decoder<'_, D>,
674 offset: usize,
675 _depth: fidl::encoding::Depth,
676 ) -> fidl::Result<()> {
677 decoder.debug_check_bounds::<Self>(offset);
678 let prim = decoder.read_num::<u32>(offset);
679
680 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
681 Ok(())
682 }
683 }
684 unsafe impl fidl::encoding::TypeMarker for Ipv6RoutingTableControllerAddRouteError {
685 type Owned = Self;
686
687 #[inline(always)]
688 fn inline_align(_context: fidl::encoding::Context) -> usize {
689 std::mem::align_of::<u32>()
690 }
691
692 #[inline(always)]
693 fn inline_size(_context: fidl::encoding::Context) -> usize {
694 std::mem::size_of::<u32>()
695 }
696
697 #[inline(always)]
698 fn encode_is_copy() -> bool {
699 true
700 }
701
702 #[inline(always)]
703 fn decode_is_copy() -> bool {
704 false
705 }
706 }
707
708 impl fidl::encoding::ValueTypeMarker for Ipv6RoutingTableControllerAddRouteError {
709 type Borrowed<'a> = Self;
710 #[inline(always)]
711 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
712 *value
713 }
714 }
715
716 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
717 for Ipv6RoutingTableControllerAddRouteError
718 {
719 #[inline]
720 unsafe fn encode(
721 self,
722 encoder: &mut fidl::encoding::Encoder<'_, D>,
723 offset: usize,
724 _depth: fidl::encoding::Depth,
725 ) -> fidl::Result<()> {
726 encoder.debug_check_bounds::<Self>(offset);
727 encoder.write_num(self.into_primitive(), offset);
728 Ok(())
729 }
730 }
731
732 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
733 for Ipv6RoutingTableControllerAddRouteError
734 {
735 #[inline(always)]
736 fn new_empty() -> Self {
737 Self::InvalidAddress
738 }
739
740 #[inline]
741 unsafe fn decode(
742 &mut self,
743 decoder: &mut fidl::encoding::Decoder<'_, D>,
744 offset: usize,
745 _depth: fidl::encoding::Depth,
746 ) -> fidl::Result<()> {
747 decoder.debug_check_bounds::<Self>(offset);
748 let prim = decoder.read_num::<u32>(offset);
749
750 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
751 Ok(())
752 }
753 }
754 unsafe impl fidl::encoding::TypeMarker for Ipv6RoutingTableControllerDelRouteError {
755 type Owned = Self;
756
757 #[inline(always)]
758 fn inline_align(_context: fidl::encoding::Context) -> usize {
759 std::mem::align_of::<u32>()
760 }
761
762 #[inline(always)]
763 fn inline_size(_context: fidl::encoding::Context) -> usize {
764 std::mem::size_of::<u32>()
765 }
766
767 #[inline(always)]
768 fn encode_is_copy() -> bool {
769 true
770 }
771
772 #[inline(always)]
773 fn decode_is_copy() -> bool {
774 false
775 }
776 }
777
778 impl fidl::encoding::ValueTypeMarker for Ipv6RoutingTableControllerDelRouteError {
779 type Borrowed<'a> = Self;
780 #[inline(always)]
781 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
782 *value
783 }
784 }
785
786 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
787 for Ipv6RoutingTableControllerDelRouteError
788 {
789 #[inline]
790 unsafe fn encode(
791 self,
792 encoder: &mut fidl::encoding::Encoder<'_, D>,
793 offset: usize,
794 _depth: fidl::encoding::Depth,
795 ) -> fidl::Result<()> {
796 encoder.debug_check_bounds::<Self>(offset);
797 encoder.write_num(self.into_primitive(), offset);
798 Ok(())
799 }
800 }
801
802 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
803 for Ipv6RoutingTableControllerDelRouteError
804 {
805 #[inline(always)]
806 fn new_empty() -> Self {
807 Self::InvalidAddress
808 }
809
810 #[inline]
811 unsafe fn decode(
812 &mut self,
813 decoder: &mut fidl::encoding::Decoder<'_, D>,
814 offset: usize,
815 _depth: fidl::encoding::Depth,
816 ) -> fidl::Result<()> {
817 decoder.debug_check_bounds::<Self>(offset);
818 let prim = decoder.read_num::<u32>(offset);
819
820 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
821 Ok(())
822 }
823 }
824 unsafe impl fidl::encoding::TypeMarker for Ipv6RoutingTableControllerGetRouteStatsError {
825 type Owned = Self;
826
827 #[inline(always)]
828 fn inline_align(_context: fidl::encoding::Context) -> usize {
829 std::mem::align_of::<u32>()
830 }
831
832 #[inline(always)]
833 fn inline_size(_context: fidl::encoding::Context) -> usize {
834 std::mem::size_of::<u32>()
835 }
836
837 #[inline(always)]
838 fn encode_is_copy() -> bool {
839 true
840 }
841
842 #[inline(always)]
843 fn decode_is_copy() -> bool {
844 false
845 }
846 }
847
848 impl fidl::encoding::ValueTypeMarker for Ipv6RoutingTableControllerGetRouteStatsError {
849 type Borrowed<'a> = Self;
850 #[inline(always)]
851 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
852 *value
853 }
854 }
855
856 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
857 for Ipv6RoutingTableControllerGetRouteStatsError
858 {
859 #[inline]
860 unsafe fn encode(
861 self,
862 encoder: &mut fidl::encoding::Encoder<'_, D>,
863 offset: usize,
864 _depth: fidl::encoding::Depth,
865 ) -> fidl::Result<()> {
866 encoder.debug_check_bounds::<Self>(offset);
867 encoder.write_num(self.into_primitive(), offset);
868 Ok(())
869 }
870 }
871
872 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
873 for Ipv6RoutingTableControllerGetRouteStatsError
874 {
875 #[inline(always)]
876 fn new_empty() -> Self {
877 Self::InvalidAddress
878 }
879
880 #[inline]
881 unsafe fn decode(
882 &mut self,
883 decoder: &mut fidl::encoding::Decoder<'_, D>,
884 offset: usize,
885 _depth: fidl::encoding::Depth,
886 ) -> fidl::Result<()> {
887 decoder.debug_check_bounds::<Self>(offset);
888 let prim = decoder.read_num::<u32>(offset);
889
890 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
891 Ok(())
892 }
893 }
894 unsafe impl fidl::encoding::TypeMarker for TableControllerCloseReason {
895 type Owned = Self;
896
897 #[inline(always)]
898 fn inline_align(_context: fidl::encoding::Context) -> usize {
899 std::mem::align_of::<u32>()
900 }
901
902 #[inline(always)]
903 fn inline_size(_context: fidl::encoding::Context) -> usize {
904 std::mem::size_of::<u32>()
905 }
906
907 #[inline(always)]
908 fn encode_is_copy() -> bool {
909 true
910 }
911
912 #[inline(always)]
913 fn decode_is_copy() -> bool {
914 false
915 }
916 }
917
918 impl fidl::encoding::ValueTypeMarker for TableControllerCloseReason {
919 type Borrowed<'a> = Self;
920 #[inline(always)]
921 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
922 *value
923 }
924 }
925
926 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
927 for TableControllerCloseReason
928 {
929 #[inline]
930 unsafe fn encode(
931 self,
932 encoder: &mut fidl::encoding::Encoder<'_, D>,
933 offset: usize,
934 _depth: fidl::encoding::Depth,
935 ) -> fidl::Result<()> {
936 encoder.debug_check_bounds::<Self>(offset);
937 encoder.write_num(self.into_primitive(), offset);
938 Ok(())
939 }
940 }
941
942 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
943 for TableControllerCloseReason
944 {
945 #[inline(always)]
946 fn new_empty() -> Self {
947 Self::AlreadyInUse
948 }
949
950 #[inline]
951 unsafe fn decode(
952 &mut self,
953 decoder: &mut fidl::encoding::Decoder<'_, D>,
954 offset: usize,
955 _depth: fidl::encoding::Depth,
956 ) -> fidl::Result<()> {
957 decoder.debug_check_bounds::<Self>(offset);
958 let prim = decoder.read_num::<u32>(offset);
959
960 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
961 Ok(())
962 }
963 }
964
965 impl fidl::encoding::ValueTypeMarker for Empty {
966 type Borrowed<'a> = &'a Self;
967 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
968 value
969 }
970 }
971
972 unsafe impl fidl::encoding::TypeMarker for Empty {
973 type Owned = Self;
974
975 #[inline(always)]
976 fn inline_align(_context: fidl::encoding::Context) -> usize {
977 1
978 }
979
980 #[inline(always)]
981 fn inline_size(_context: fidl::encoding::Context) -> usize {
982 1
983 }
984 }
985
986 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Empty, D> for &Empty {
987 #[inline]
988 unsafe fn encode(
989 self,
990 encoder: &mut fidl::encoding::Encoder<'_, D>,
991 offset: usize,
992 _depth: fidl::encoding::Depth,
993 ) -> fidl::Result<()> {
994 encoder.debug_check_bounds::<Empty>(offset);
995 encoder.write_num(0u8, offset);
996 Ok(())
997 }
998 }
999
1000 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Empty {
1001 #[inline(always)]
1002 fn new_empty() -> Self {
1003 Self
1004 }
1005
1006 #[inline]
1007 unsafe fn decode(
1008 &mut self,
1009 decoder: &mut fidl::encoding::Decoder<'_, D>,
1010 offset: usize,
1011 _depth: fidl::encoding::Depth,
1012 ) -> fidl::Result<()> {
1013 decoder.debug_check_bounds::<Self>(offset);
1014 match decoder.read_num::<u8>(offset) {
1015 0 => Ok(()),
1016 _ => Err(fidl::Error::Invalid),
1017 }
1018 }
1019 }
1020
1021 impl fidl::encoding::ValueTypeMarker for Ipv4RoutingTableControllerAddRouteRequest {
1022 type Borrowed<'a> = &'a Self;
1023 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1024 value
1025 }
1026 }
1027
1028 unsafe impl fidl::encoding::TypeMarker for Ipv4RoutingTableControllerAddRouteRequest {
1029 type Owned = Self;
1030
1031 #[inline(always)]
1032 fn inline_align(_context: fidl::encoding::Context) -> usize {
1033 8
1034 }
1035
1036 #[inline(always)]
1037 fn inline_size(_context: fidl::encoding::Context) -> usize {
1038 24
1039 }
1040 }
1041
1042 unsafe impl<D: fidl::encoding::ResourceDialect>
1043 fidl::encoding::Encode<Ipv4RoutingTableControllerAddRouteRequest, D>
1044 for &Ipv4RoutingTableControllerAddRouteRequest
1045 {
1046 #[inline]
1047 unsafe fn encode(
1048 self,
1049 encoder: &mut fidl::encoding::Encoder<'_, D>,
1050 offset: usize,
1051 _depth: fidl::encoding::Depth,
1052 ) -> fidl::Result<()> {
1053 encoder.debug_check_bounds::<Ipv4RoutingTableControllerAddRouteRequest>(offset);
1054 fidl::encoding::Encode::<Ipv4RoutingTableControllerAddRouteRequest, D>::encode(
1056 (
1057 <Ipv4UnicastSourceAndMulticastDestination as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
1058 <Route as fidl::encoding::ValueTypeMarker>::borrow(&self.route),
1059 ),
1060 encoder, offset, _depth
1061 )
1062 }
1063 }
1064 unsafe impl<
1065 D: fidl::encoding::ResourceDialect,
1066 T0: fidl::encoding::Encode<Ipv4UnicastSourceAndMulticastDestination, D>,
1067 T1: fidl::encoding::Encode<Route, D>,
1068 > fidl::encoding::Encode<Ipv4RoutingTableControllerAddRouteRequest, D> for (T0, T1)
1069 {
1070 #[inline]
1071 unsafe fn encode(
1072 self,
1073 encoder: &mut fidl::encoding::Encoder<'_, D>,
1074 offset: usize,
1075 depth: fidl::encoding::Depth,
1076 ) -> fidl::Result<()> {
1077 encoder.debug_check_bounds::<Ipv4RoutingTableControllerAddRouteRequest>(offset);
1078 self.0.encode(encoder, offset + 0, depth)?;
1082 self.1.encode(encoder, offset + 8, depth)?;
1083 Ok(())
1084 }
1085 }
1086
1087 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1088 for Ipv4RoutingTableControllerAddRouteRequest
1089 {
1090 #[inline(always)]
1091 fn new_empty() -> Self {
1092 Self {
1093 addresses: fidl::new_empty!(Ipv4UnicastSourceAndMulticastDestination, D),
1094 route: fidl::new_empty!(Route, D),
1095 }
1096 }
1097
1098 #[inline]
1099 unsafe fn decode(
1100 &mut self,
1101 decoder: &mut fidl::encoding::Decoder<'_, D>,
1102 offset: usize,
1103 _depth: fidl::encoding::Depth,
1104 ) -> fidl::Result<()> {
1105 decoder.debug_check_bounds::<Self>(offset);
1106 fidl::decode!(
1108 Ipv4UnicastSourceAndMulticastDestination,
1109 D,
1110 &mut self.addresses,
1111 decoder,
1112 offset + 0,
1113 _depth
1114 )?;
1115 fidl::decode!(Route, D, &mut self.route, decoder, offset + 8, _depth)?;
1116 Ok(())
1117 }
1118 }
1119
1120 impl fidl::encoding::ValueTypeMarker for Ipv4RoutingTableControllerDelRouteRequest {
1121 type Borrowed<'a> = &'a Self;
1122 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1123 value
1124 }
1125 }
1126
1127 unsafe impl fidl::encoding::TypeMarker for Ipv4RoutingTableControllerDelRouteRequest {
1128 type Owned = Self;
1129
1130 #[inline(always)]
1131 fn inline_align(_context: fidl::encoding::Context) -> usize {
1132 1
1133 }
1134
1135 #[inline(always)]
1136 fn inline_size(_context: fidl::encoding::Context) -> usize {
1137 8
1138 }
1139 }
1140
1141 unsafe impl<D: fidl::encoding::ResourceDialect>
1142 fidl::encoding::Encode<Ipv4RoutingTableControllerDelRouteRequest, D>
1143 for &Ipv4RoutingTableControllerDelRouteRequest
1144 {
1145 #[inline]
1146 unsafe fn encode(
1147 self,
1148 encoder: &mut fidl::encoding::Encoder<'_, D>,
1149 offset: usize,
1150 _depth: fidl::encoding::Depth,
1151 ) -> fidl::Result<()> {
1152 encoder.debug_check_bounds::<Ipv4RoutingTableControllerDelRouteRequest>(offset);
1153 fidl::encoding::Encode::<Ipv4RoutingTableControllerDelRouteRequest, D>::encode(
1155 (
1156 <Ipv4UnicastSourceAndMulticastDestination as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
1157 ),
1158 encoder, offset, _depth
1159 )
1160 }
1161 }
1162 unsafe impl<
1163 D: fidl::encoding::ResourceDialect,
1164 T0: fidl::encoding::Encode<Ipv4UnicastSourceAndMulticastDestination, D>,
1165 > fidl::encoding::Encode<Ipv4RoutingTableControllerDelRouteRequest, D> for (T0,)
1166 {
1167 #[inline]
1168 unsafe fn encode(
1169 self,
1170 encoder: &mut fidl::encoding::Encoder<'_, D>,
1171 offset: usize,
1172 depth: fidl::encoding::Depth,
1173 ) -> fidl::Result<()> {
1174 encoder.debug_check_bounds::<Ipv4RoutingTableControllerDelRouteRequest>(offset);
1175 self.0.encode(encoder, offset + 0, depth)?;
1179 Ok(())
1180 }
1181 }
1182
1183 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1184 for Ipv4RoutingTableControllerDelRouteRequest
1185 {
1186 #[inline(always)]
1187 fn new_empty() -> Self {
1188 Self { addresses: fidl::new_empty!(Ipv4UnicastSourceAndMulticastDestination, D) }
1189 }
1190
1191 #[inline]
1192 unsafe fn decode(
1193 &mut self,
1194 decoder: &mut fidl::encoding::Decoder<'_, D>,
1195 offset: usize,
1196 _depth: fidl::encoding::Depth,
1197 ) -> fidl::Result<()> {
1198 decoder.debug_check_bounds::<Self>(offset);
1199 fidl::decode!(
1201 Ipv4UnicastSourceAndMulticastDestination,
1202 D,
1203 &mut self.addresses,
1204 decoder,
1205 offset + 0,
1206 _depth
1207 )?;
1208 Ok(())
1209 }
1210 }
1211
1212 impl fidl::encoding::ValueTypeMarker for Ipv4RoutingTableControllerGetRouteStatsRequest {
1213 type Borrowed<'a> = &'a Self;
1214 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1215 value
1216 }
1217 }
1218
1219 unsafe impl fidl::encoding::TypeMarker for Ipv4RoutingTableControllerGetRouteStatsRequest {
1220 type Owned = Self;
1221
1222 #[inline(always)]
1223 fn inline_align(_context: fidl::encoding::Context) -> usize {
1224 1
1225 }
1226
1227 #[inline(always)]
1228 fn inline_size(_context: fidl::encoding::Context) -> usize {
1229 8
1230 }
1231 }
1232
1233 unsafe impl<D: fidl::encoding::ResourceDialect>
1234 fidl::encoding::Encode<Ipv4RoutingTableControllerGetRouteStatsRequest, D>
1235 for &Ipv4RoutingTableControllerGetRouteStatsRequest
1236 {
1237 #[inline]
1238 unsafe fn encode(
1239 self,
1240 encoder: &mut fidl::encoding::Encoder<'_, D>,
1241 offset: usize,
1242 _depth: fidl::encoding::Depth,
1243 ) -> fidl::Result<()> {
1244 encoder.debug_check_bounds::<Ipv4RoutingTableControllerGetRouteStatsRequest>(offset);
1245 fidl::encoding::Encode::<Ipv4RoutingTableControllerGetRouteStatsRequest, D>::encode(
1247 (
1248 <Ipv4UnicastSourceAndMulticastDestination as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
1249 ),
1250 encoder, offset, _depth
1251 )
1252 }
1253 }
1254 unsafe impl<
1255 D: fidl::encoding::ResourceDialect,
1256 T0: fidl::encoding::Encode<Ipv4UnicastSourceAndMulticastDestination, D>,
1257 > fidl::encoding::Encode<Ipv4RoutingTableControllerGetRouteStatsRequest, D> for (T0,)
1258 {
1259 #[inline]
1260 unsafe fn encode(
1261 self,
1262 encoder: &mut fidl::encoding::Encoder<'_, D>,
1263 offset: usize,
1264 depth: fidl::encoding::Depth,
1265 ) -> fidl::Result<()> {
1266 encoder.debug_check_bounds::<Ipv4RoutingTableControllerGetRouteStatsRequest>(offset);
1267 self.0.encode(encoder, offset + 0, depth)?;
1271 Ok(())
1272 }
1273 }
1274
1275 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1276 for Ipv4RoutingTableControllerGetRouteStatsRequest
1277 {
1278 #[inline(always)]
1279 fn new_empty() -> Self {
1280 Self { addresses: fidl::new_empty!(Ipv4UnicastSourceAndMulticastDestination, D) }
1281 }
1282
1283 #[inline]
1284 unsafe fn decode(
1285 &mut self,
1286 decoder: &mut fidl::encoding::Decoder<'_, D>,
1287 offset: usize,
1288 _depth: fidl::encoding::Depth,
1289 ) -> fidl::Result<()> {
1290 decoder.debug_check_bounds::<Self>(offset);
1291 fidl::decode!(
1293 Ipv4UnicastSourceAndMulticastDestination,
1294 D,
1295 &mut self.addresses,
1296 decoder,
1297 offset + 0,
1298 _depth
1299 )?;
1300 Ok(())
1301 }
1302 }
1303
1304 impl fidl::encoding::ValueTypeMarker for Ipv4RoutingTableControllerOnCloseRequest {
1305 type Borrowed<'a> = &'a Self;
1306 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1307 value
1308 }
1309 }
1310
1311 unsafe impl fidl::encoding::TypeMarker for Ipv4RoutingTableControllerOnCloseRequest {
1312 type Owned = Self;
1313
1314 #[inline(always)]
1315 fn inline_align(_context: fidl::encoding::Context) -> usize {
1316 4
1317 }
1318
1319 #[inline(always)]
1320 fn inline_size(_context: fidl::encoding::Context) -> usize {
1321 4
1322 }
1323 }
1324
1325 unsafe impl<D: fidl::encoding::ResourceDialect>
1326 fidl::encoding::Encode<Ipv4RoutingTableControllerOnCloseRequest, D>
1327 for &Ipv4RoutingTableControllerOnCloseRequest
1328 {
1329 #[inline]
1330 unsafe fn encode(
1331 self,
1332 encoder: &mut fidl::encoding::Encoder<'_, D>,
1333 offset: usize,
1334 _depth: fidl::encoding::Depth,
1335 ) -> fidl::Result<()> {
1336 encoder.debug_check_bounds::<Ipv4RoutingTableControllerOnCloseRequest>(offset);
1337 fidl::encoding::Encode::<Ipv4RoutingTableControllerOnCloseRequest, D>::encode(
1339 (<TableControllerCloseReason as fidl::encoding::ValueTypeMarker>::borrow(
1340 &self.error,
1341 ),),
1342 encoder,
1343 offset,
1344 _depth,
1345 )
1346 }
1347 }
1348 unsafe impl<
1349 D: fidl::encoding::ResourceDialect,
1350 T0: fidl::encoding::Encode<TableControllerCloseReason, D>,
1351 > fidl::encoding::Encode<Ipv4RoutingTableControllerOnCloseRequest, D> for (T0,)
1352 {
1353 #[inline]
1354 unsafe fn encode(
1355 self,
1356 encoder: &mut fidl::encoding::Encoder<'_, D>,
1357 offset: usize,
1358 depth: fidl::encoding::Depth,
1359 ) -> fidl::Result<()> {
1360 encoder.debug_check_bounds::<Ipv4RoutingTableControllerOnCloseRequest>(offset);
1361 self.0.encode(encoder, offset + 0, depth)?;
1365 Ok(())
1366 }
1367 }
1368
1369 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1370 for Ipv4RoutingTableControllerOnCloseRequest
1371 {
1372 #[inline(always)]
1373 fn new_empty() -> Self {
1374 Self { error: fidl::new_empty!(TableControllerCloseReason, D) }
1375 }
1376
1377 #[inline]
1378 unsafe fn decode(
1379 &mut self,
1380 decoder: &mut fidl::encoding::Decoder<'_, D>,
1381 offset: usize,
1382 _depth: fidl::encoding::Depth,
1383 ) -> fidl::Result<()> {
1384 decoder.debug_check_bounds::<Self>(offset);
1385 fidl::decode!(
1387 TableControllerCloseReason,
1388 D,
1389 &mut self.error,
1390 decoder,
1391 offset + 0,
1392 _depth
1393 )?;
1394 Ok(())
1395 }
1396 }
1397
1398 impl fidl::encoding::ValueTypeMarker for Ipv4RoutingTableControllerWatchRoutingEventsResponse {
1399 type Borrowed<'a> = &'a Self;
1400 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1401 value
1402 }
1403 }
1404
1405 unsafe impl fidl::encoding::TypeMarker for Ipv4RoutingTableControllerWatchRoutingEventsResponse {
1406 type Owned = Self;
1407
1408 #[inline(always)]
1409 fn inline_align(_context: fidl::encoding::Context) -> usize {
1410 8
1411 }
1412
1413 #[inline(always)]
1414 fn inline_size(_context: fidl::encoding::Context) -> usize {
1415 40
1416 }
1417 }
1418
1419 unsafe impl<D: fidl::encoding::ResourceDialect>
1420 fidl::encoding::Encode<Ipv4RoutingTableControllerWatchRoutingEventsResponse, D>
1421 for &Ipv4RoutingTableControllerWatchRoutingEventsResponse
1422 {
1423 #[inline]
1424 unsafe fn encode(
1425 self,
1426 encoder: &mut fidl::encoding::Encoder<'_, D>,
1427 offset: usize,
1428 _depth: fidl::encoding::Depth,
1429 ) -> fidl::Result<()> {
1430 encoder
1431 .debug_check_bounds::<Ipv4RoutingTableControllerWatchRoutingEventsResponse>(offset);
1432 fidl::encoding::Encode::<Ipv4RoutingTableControllerWatchRoutingEventsResponse, D>::encode(
1434 (
1435 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.dropped_events),
1436 <Ipv4UnicastSourceAndMulticastDestination as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
1437 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.input_interface),
1438 <RoutingEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),
1439 ),
1440 encoder, offset, _depth
1441 )
1442 }
1443 }
1444 unsafe impl<
1445 D: fidl::encoding::ResourceDialect,
1446 T0: fidl::encoding::Encode<u64, D>,
1447 T1: fidl::encoding::Encode<Ipv4UnicastSourceAndMulticastDestination, D>,
1448 T2: fidl::encoding::Encode<u64, D>,
1449 T3: fidl::encoding::Encode<RoutingEvent, D>,
1450 > fidl::encoding::Encode<Ipv4RoutingTableControllerWatchRoutingEventsResponse, D>
1451 for (T0, T1, T2, T3)
1452 {
1453 #[inline]
1454 unsafe fn encode(
1455 self,
1456 encoder: &mut fidl::encoding::Encoder<'_, D>,
1457 offset: usize,
1458 depth: fidl::encoding::Depth,
1459 ) -> fidl::Result<()> {
1460 encoder
1461 .debug_check_bounds::<Ipv4RoutingTableControllerWatchRoutingEventsResponse>(offset);
1462 self.0.encode(encoder, offset + 0, depth)?;
1466 self.1.encode(encoder, offset + 8, depth)?;
1467 self.2.encode(encoder, offset + 16, depth)?;
1468 self.3.encode(encoder, offset + 24, depth)?;
1469 Ok(())
1470 }
1471 }
1472
1473 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1474 for Ipv4RoutingTableControllerWatchRoutingEventsResponse
1475 {
1476 #[inline(always)]
1477 fn new_empty() -> Self {
1478 Self {
1479 dropped_events: fidl::new_empty!(u64, D),
1480 addresses: fidl::new_empty!(Ipv4UnicastSourceAndMulticastDestination, D),
1481 input_interface: fidl::new_empty!(u64, D),
1482 event: fidl::new_empty!(RoutingEvent, D),
1483 }
1484 }
1485
1486 #[inline]
1487 unsafe fn decode(
1488 &mut self,
1489 decoder: &mut fidl::encoding::Decoder<'_, D>,
1490 offset: usize,
1491 _depth: fidl::encoding::Depth,
1492 ) -> fidl::Result<()> {
1493 decoder.debug_check_bounds::<Self>(offset);
1494 fidl::decode!(u64, D, &mut self.dropped_events, decoder, offset + 0, _depth)?;
1496 fidl::decode!(
1497 Ipv4UnicastSourceAndMulticastDestination,
1498 D,
1499 &mut self.addresses,
1500 decoder,
1501 offset + 8,
1502 _depth
1503 )?;
1504 fidl::decode!(u64, D, &mut self.input_interface, decoder, offset + 16, _depth)?;
1505 fidl::decode!(RoutingEvent, D, &mut self.event, decoder, offset + 24, _depth)?;
1506 Ok(())
1507 }
1508 }
1509
1510 impl fidl::encoding::ValueTypeMarker for Ipv4RoutingTableControllerGetRouteStatsResponse {
1511 type Borrowed<'a> = &'a Self;
1512 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1513 value
1514 }
1515 }
1516
1517 unsafe impl fidl::encoding::TypeMarker for Ipv4RoutingTableControllerGetRouteStatsResponse {
1518 type Owned = Self;
1519
1520 #[inline(always)]
1521 fn inline_align(_context: fidl::encoding::Context) -> usize {
1522 8
1523 }
1524
1525 #[inline(always)]
1526 fn inline_size(_context: fidl::encoding::Context) -> usize {
1527 16
1528 }
1529 }
1530
1531 unsafe impl<D: fidl::encoding::ResourceDialect>
1532 fidl::encoding::Encode<Ipv4RoutingTableControllerGetRouteStatsResponse, D>
1533 for &Ipv4RoutingTableControllerGetRouteStatsResponse
1534 {
1535 #[inline]
1536 unsafe fn encode(
1537 self,
1538 encoder: &mut fidl::encoding::Encoder<'_, D>,
1539 offset: usize,
1540 _depth: fidl::encoding::Depth,
1541 ) -> fidl::Result<()> {
1542 encoder.debug_check_bounds::<Ipv4RoutingTableControllerGetRouteStatsResponse>(offset);
1543 fidl::encoding::Encode::<Ipv4RoutingTableControllerGetRouteStatsResponse, D>::encode(
1545 (<RouteStats as fidl::encoding::ValueTypeMarker>::borrow(&self.stats),),
1546 encoder,
1547 offset,
1548 _depth,
1549 )
1550 }
1551 }
1552 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<RouteStats, D>>
1553 fidl::encoding::Encode<Ipv4RoutingTableControllerGetRouteStatsResponse, D> for (T0,)
1554 {
1555 #[inline]
1556 unsafe fn encode(
1557 self,
1558 encoder: &mut fidl::encoding::Encoder<'_, D>,
1559 offset: usize,
1560 depth: fidl::encoding::Depth,
1561 ) -> fidl::Result<()> {
1562 encoder.debug_check_bounds::<Ipv4RoutingTableControllerGetRouteStatsResponse>(offset);
1563 self.0.encode(encoder, offset + 0, depth)?;
1567 Ok(())
1568 }
1569 }
1570
1571 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1572 for Ipv4RoutingTableControllerGetRouteStatsResponse
1573 {
1574 #[inline(always)]
1575 fn new_empty() -> Self {
1576 Self { stats: fidl::new_empty!(RouteStats, D) }
1577 }
1578
1579 #[inline]
1580 unsafe fn decode(
1581 &mut self,
1582 decoder: &mut fidl::encoding::Decoder<'_, D>,
1583 offset: usize,
1584 _depth: fidl::encoding::Depth,
1585 ) -> fidl::Result<()> {
1586 decoder.debug_check_bounds::<Self>(offset);
1587 fidl::decode!(RouteStats, D, &mut self.stats, decoder, offset + 0, _depth)?;
1589 Ok(())
1590 }
1591 }
1592
1593 impl fidl::encoding::ValueTypeMarker for Ipv4UnicastSourceAndMulticastDestination {
1594 type Borrowed<'a> = &'a Self;
1595 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1596 value
1597 }
1598 }
1599
1600 unsafe impl fidl::encoding::TypeMarker for Ipv4UnicastSourceAndMulticastDestination {
1601 type Owned = Self;
1602
1603 #[inline(always)]
1604 fn inline_align(_context: fidl::encoding::Context) -> usize {
1605 1
1606 }
1607
1608 #[inline(always)]
1609 fn inline_size(_context: fidl::encoding::Context) -> usize {
1610 8
1611 }
1612 }
1613
1614 unsafe impl<D: fidl::encoding::ResourceDialect>
1615 fidl::encoding::Encode<Ipv4UnicastSourceAndMulticastDestination, D>
1616 for &Ipv4UnicastSourceAndMulticastDestination
1617 {
1618 #[inline]
1619 unsafe fn encode(
1620 self,
1621 encoder: &mut fidl::encoding::Encoder<'_, D>,
1622 offset: usize,
1623 _depth: fidl::encoding::Depth,
1624 ) -> fidl::Result<()> {
1625 encoder.debug_check_bounds::<Ipv4UnicastSourceAndMulticastDestination>(offset);
1626 fidl::encoding::Encode::<Ipv4UnicastSourceAndMulticastDestination, D>::encode(
1628 (
1629 <fidl_fuchsia_net__common::Ipv4Address as fidl::encoding::ValueTypeMarker>::borrow(&self.unicast_source),
1630 <fidl_fuchsia_net__common::Ipv4Address as fidl::encoding::ValueTypeMarker>::borrow(&self.multicast_destination),
1631 ),
1632 encoder, offset, _depth
1633 )
1634 }
1635 }
1636 unsafe impl<
1637 D: fidl::encoding::ResourceDialect,
1638 T0: fidl::encoding::Encode<fidl_fuchsia_net__common::Ipv4Address, D>,
1639 T1: fidl::encoding::Encode<fidl_fuchsia_net__common::Ipv4Address, D>,
1640 > fidl::encoding::Encode<Ipv4UnicastSourceAndMulticastDestination, D> for (T0, T1)
1641 {
1642 #[inline]
1643 unsafe fn encode(
1644 self,
1645 encoder: &mut fidl::encoding::Encoder<'_, D>,
1646 offset: usize,
1647 depth: fidl::encoding::Depth,
1648 ) -> fidl::Result<()> {
1649 encoder.debug_check_bounds::<Ipv4UnicastSourceAndMulticastDestination>(offset);
1650 self.0.encode(encoder, offset + 0, depth)?;
1654 self.1.encode(encoder, offset + 4, depth)?;
1655 Ok(())
1656 }
1657 }
1658
1659 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1660 for Ipv4UnicastSourceAndMulticastDestination
1661 {
1662 #[inline(always)]
1663 fn new_empty() -> Self {
1664 Self {
1665 unicast_source: fidl::new_empty!(fidl_fuchsia_net__common::Ipv4Address, D),
1666 multicast_destination: fidl::new_empty!(fidl_fuchsia_net__common::Ipv4Address, D),
1667 }
1668 }
1669
1670 #[inline]
1671 unsafe fn decode(
1672 &mut self,
1673 decoder: &mut fidl::encoding::Decoder<'_, D>,
1674 offset: usize,
1675 _depth: fidl::encoding::Depth,
1676 ) -> fidl::Result<()> {
1677 decoder.debug_check_bounds::<Self>(offset);
1678 fidl::decode!(
1680 fidl_fuchsia_net__common::Ipv4Address,
1681 D,
1682 &mut self.unicast_source,
1683 decoder,
1684 offset + 0,
1685 _depth
1686 )?;
1687 fidl::decode!(
1688 fidl_fuchsia_net__common::Ipv4Address,
1689 D,
1690 &mut self.multicast_destination,
1691 decoder,
1692 offset + 4,
1693 _depth
1694 )?;
1695 Ok(())
1696 }
1697 }
1698
1699 impl fidl::encoding::ValueTypeMarker for Ipv6RoutingTableControllerAddRouteRequest {
1700 type Borrowed<'a> = &'a Self;
1701 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1702 value
1703 }
1704 }
1705
1706 unsafe impl fidl::encoding::TypeMarker for Ipv6RoutingTableControllerAddRouteRequest {
1707 type Owned = Self;
1708
1709 #[inline(always)]
1710 fn inline_align(_context: fidl::encoding::Context) -> usize {
1711 8
1712 }
1713
1714 #[inline(always)]
1715 fn inline_size(_context: fidl::encoding::Context) -> usize {
1716 48
1717 }
1718 }
1719
1720 unsafe impl<D: fidl::encoding::ResourceDialect>
1721 fidl::encoding::Encode<Ipv6RoutingTableControllerAddRouteRequest, D>
1722 for &Ipv6RoutingTableControllerAddRouteRequest
1723 {
1724 #[inline]
1725 unsafe fn encode(
1726 self,
1727 encoder: &mut fidl::encoding::Encoder<'_, D>,
1728 offset: usize,
1729 _depth: fidl::encoding::Depth,
1730 ) -> fidl::Result<()> {
1731 encoder.debug_check_bounds::<Ipv6RoutingTableControllerAddRouteRequest>(offset);
1732 fidl::encoding::Encode::<Ipv6RoutingTableControllerAddRouteRequest, D>::encode(
1734 (
1735 <Ipv6UnicastSourceAndMulticastDestination as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
1736 <Route as fidl::encoding::ValueTypeMarker>::borrow(&self.route),
1737 ),
1738 encoder, offset, _depth
1739 )
1740 }
1741 }
1742 unsafe impl<
1743 D: fidl::encoding::ResourceDialect,
1744 T0: fidl::encoding::Encode<Ipv6UnicastSourceAndMulticastDestination, D>,
1745 T1: fidl::encoding::Encode<Route, D>,
1746 > fidl::encoding::Encode<Ipv6RoutingTableControllerAddRouteRequest, D> for (T0, T1)
1747 {
1748 #[inline]
1749 unsafe fn encode(
1750 self,
1751 encoder: &mut fidl::encoding::Encoder<'_, D>,
1752 offset: usize,
1753 depth: fidl::encoding::Depth,
1754 ) -> fidl::Result<()> {
1755 encoder.debug_check_bounds::<Ipv6RoutingTableControllerAddRouteRequest>(offset);
1756 self.0.encode(encoder, offset + 0, depth)?;
1760 self.1.encode(encoder, offset + 32, depth)?;
1761 Ok(())
1762 }
1763 }
1764
1765 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1766 for Ipv6RoutingTableControllerAddRouteRequest
1767 {
1768 #[inline(always)]
1769 fn new_empty() -> Self {
1770 Self {
1771 addresses: fidl::new_empty!(Ipv6UnicastSourceAndMulticastDestination, D),
1772 route: fidl::new_empty!(Route, D),
1773 }
1774 }
1775
1776 #[inline]
1777 unsafe fn decode(
1778 &mut self,
1779 decoder: &mut fidl::encoding::Decoder<'_, D>,
1780 offset: usize,
1781 _depth: fidl::encoding::Depth,
1782 ) -> fidl::Result<()> {
1783 decoder.debug_check_bounds::<Self>(offset);
1784 fidl::decode!(
1786 Ipv6UnicastSourceAndMulticastDestination,
1787 D,
1788 &mut self.addresses,
1789 decoder,
1790 offset + 0,
1791 _depth
1792 )?;
1793 fidl::decode!(Route, D, &mut self.route, decoder, offset + 32, _depth)?;
1794 Ok(())
1795 }
1796 }
1797
1798 impl fidl::encoding::ValueTypeMarker for Ipv6RoutingTableControllerDelRouteRequest {
1799 type Borrowed<'a> = &'a Self;
1800 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1801 value
1802 }
1803 }
1804
1805 unsafe impl fidl::encoding::TypeMarker for Ipv6RoutingTableControllerDelRouteRequest {
1806 type Owned = Self;
1807
1808 #[inline(always)]
1809 fn inline_align(_context: fidl::encoding::Context) -> usize {
1810 1
1811 }
1812
1813 #[inline(always)]
1814 fn inline_size(_context: fidl::encoding::Context) -> usize {
1815 32
1816 }
1817 }
1818
1819 unsafe impl<D: fidl::encoding::ResourceDialect>
1820 fidl::encoding::Encode<Ipv6RoutingTableControllerDelRouteRequest, D>
1821 for &Ipv6RoutingTableControllerDelRouteRequest
1822 {
1823 #[inline]
1824 unsafe fn encode(
1825 self,
1826 encoder: &mut fidl::encoding::Encoder<'_, D>,
1827 offset: usize,
1828 _depth: fidl::encoding::Depth,
1829 ) -> fidl::Result<()> {
1830 encoder.debug_check_bounds::<Ipv6RoutingTableControllerDelRouteRequest>(offset);
1831 fidl::encoding::Encode::<Ipv6RoutingTableControllerDelRouteRequest, D>::encode(
1833 (
1834 <Ipv6UnicastSourceAndMulticastDestination as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
1835 ),
1836 encoder, offset, _depth
1837 )
1838 }
1839 }
1840 unsafe impl<
1841 D: fidl::encoding::ResourceDialect,
1842 T0: fidl::encoding::Encode<Ipv6UnicastSourceAndMulticastDestination, D>,
1843 > fidl::encoding::Encode<Ipv6RoutingTableControllerDelRouteRequest, D> for (T0,)
1844 {
1845 #[inline]
1846 unsafe fn encode(
1847 self,
1848 encoder: &mut fidl::encoding::Encoder<'_, D>,
1849 offset: usize,
1850 depth: fidl::encoding::Depth,
1851 ) -> fidl::Result<()> {
1852 encoder.debug_check_bounds::<Ipv6RoutingTableControllerDelRouteRequest>(offset);
1853 self.0.encode(encoder, offset + 0, depth)?;
1857 Ok(())
1858 }
1859 }
1860
1861 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1862 for Ipv6RoutingTableControllerDelRouteRequest
1863 {
1864 #[inline(always)]
1865 fn new_empty() -> Self {
1866 Self { addresses: fidl::new_empty!(Ipv6UnicastSourceAndMulticastDestination, D) }
1867 }
1868
1869 #[inline]
1870 unsafe fn decode(
1871 &mut self,
1872 decoder: &mut fidl::encoding::Decoder<'_, D>,
1873 offset: usize,
1874 _depth: fidl::encoding::Depth,
1875 ) -> fidl::Result<()> {
1876 decoder.debug_check_bounds::<Self>(offset);
1877 fidl::decode!(
1879 Ipv6UnicastSourceAndMulticastDestination,
1880 D,
1881 &mut self.addresses,
1882 decoder,
1883 offset + 0,
1884 _depth
1885 )?;
1886 Ok(())
1887 }
1888 }
1889
1890 impl fidl::encoding::ValueTypeMarker for Ipv6RoutingTableControllerGetRouteStatsRequest {
1891 type Borrowed<'a> = &'a Self;
1892 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1893 value
1894 }
1895 }
1896
1897 unsafe impl fidl::encoding::TypeMarker for Ipv6RoutingTableControllerGetRouteStatsRequest {
1898 type Owned = Self;
1899
1900 #[inline(always)]
1901 fn inline_align(_context: fidl::encoding::Context) -> usize {
1902 1
1903 }
1904
1905 #[inline(always)]
1906 fn inline_size(_context: fidl::encoding::Context) -> usize {
1907 32
1908 }
1909 }
1910
1911 unsafe impl<D: fidl::encoding::ResourceDialect>
1912 fidl::encoding::Encode<Ipv6RoutingTableControllerGetRouteStatsRequest, D>
1913 for &Ipv6RoutingTableControllerGetRouteStatsRequest
1914 {
1915 #[inline]
1916 unsafe fn encode(
1917 self,
1918 encoder: &mut fidl::encoding::Encoder<'_, D>,
1919 offset: usize,
1920 _depth: fidl::encoding::Depth,
1921 ) -> fidl::Result<()> {
1922 encoder.debug_check_bounds::<Ipv6RoutingTableControllerGetRouteStatsRequest>(offset);
1923 fidl::encoding::Encode::<Ipv6RoutingTableControllerGetRouteStatsRequest, D>::encode(
1925 (
1926 <Ipv6UnicastSourceAndMulticastDestination as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
1927 ),
1928 encoder, offset, _depth
1929 )
1930 }
1931 }
1932 unsafe impl<
1933 D: fidl::encoding::ResourceDialect,
1934 T0: fidl::encoding::Encode<Ipv6UnicastSourceAndMulticastDestination, D>,
1935 > fidl::encoding::Encode<Ipv6RoutingTableControllerGetRouteStatsRequest, D> for (T0,)
1936 {
1937 #[inline]
1938 unsafe fn encode(
1939 self,
1940 encoder: &mut fidl::encoding::Encoder<'_, D>,
1941 offset: usize,
1942 depth: fidl::encoding::Depth,
1943 ) -> fidl::Result<()> {
1944 encoder.debug_check_bounds::<Ipv6RoutingTableControllerGetRouteStatsRequest>(offset);
1945 self.0.encode(encoder, offset + 0, depth)?;
1949 Ok(())
1950 }
1951 }
1952
1953 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1954 for Ipv6RoutingTableControllerGetRouteStatsRequest
1955 {
1956 #[inline(always)]
1957 fn new_empty() -> Self {
1958 Self { addresses: fidl::new_empty!(Ipv6UnicastSourceAndMulticastDestination, D) }
1959 }
1960
1961 #[inline]
1962 unsafe fn decode(
1963 &mut self,
1964 decoder: &mut fidl::encoding::Decoder<'_, D>,
1965 offset: usize,
1966 _depth: fidl::encoding::Depth,
1967 ) -> fidl::Result<()> {
1968 decoder.debug_check_bounds::<Self>(offset);
1969 fidl::decode!(
1971 Ipv6UnicastSourceAndMulticastDestination,
1972 D,
1973 &mut self.addresses,
1974 decoder,
1975 offset + 0,
1976 _depth
1977 )?;
1978 Ok(())
1979 }
1980 }
1981
1982 impl fidl::encoding::ValueTypeMarker for Ipv6RoutingTableControllerOnCloseRequest {
1983 type Borrowed<'a> = &'a Self;
1984 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1985 value
1986 }
1987 }
1988
1989 unsafe impl fidl::encoding::TypeMarker for Ipv6RoutingTableControllerOnCloseRequest {
1990 type Owned = Self;
1991
1992 #[inline(always)]
1993 fn inline_align(_context: fidl::encoding::Context) -> usize {
1994 4
1995 }
1996
1997 #[inline(always)]
1998 fn inline_size(_context: fidl::encoding::Context) -> usize {
1999 4
2000 }
2001 }
2002
2003 unsafe impl<D: fidl::encoding::ResourceDialect>
2004 fidl::encoding::Encode<Ipv6RoutingTableControllerOnCloseRequest, D>
2005 for &Ipv6RoutingTableControllerOnCloseRequest
2006 {
2007 #[inline]
2008 unsafe fn encode(
2009 self,
2010 encoder: &mut fidl::encoding::Encoder<'_, D>,
2011 offset: usize,
2012 _depth: fidl::encoding::Depth,
2013 ) -> fidl::Result<()> {
2014 encoder.debug_check_bounds::<Ipv6RoutingTableControllerOnCloseRequest>(offset);
2015 fidl::encoding::Encode::<Ipv6RoutingTableControllerOnCloseRequest, D>::encode(
2017 (<TableControllerCloseReason as fidl::encoding::ValueTypeMarker>::borrow(
2018 &self.error,
2019 ),),
2020 encoder,
2021 offset,
2022 _depth,
2023 )
2024 }
2025 }
2026 unsafe impl<
2027 D: fidl::encoding::ResourceDialect,
2028 T0: fidl::encoding::Encode<TableControllerCloseReason, D>,
2029 > fidl::encoding::Encode<Ipv6RoutingTableControllerOnCloseRequest, D> for (T0,)
2030 {
2031 #[inline]
2032 unsafe fn encode(
2033 self,
2034 encoder: &mut fidl::encoding::Encoder<'_, D>,
2035 offset: usize,
2036 depth: fidl::encoding::Depth,
2037 ) -> fidl::Result<()> {
2038 encoder.debug_check_bounds::<Ipv6RoutingTableControllerOnCloseRequest>(offset);
2039 self.0.encode(encoder, offset + 0, depth)?;
2043 Ok(())
2044 }
2045 }
2046
2047 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2048 for Ipv6RoutingTableControllerOnCloseRequest
2049 {
2050 #[inline(always)]
2051 fn new_empty() -> Self {
2052 Self { error: fidl::new_empty!(TableControllerCloseReason, D) }
2053 }
2054
2055 #[inline]
2056 unsafe fn decode(
2057 &mut self,
2058 decoder: &mut fidl::encoding::Decoder<'_, D>,
2059 offset: usize,
2060 _depth: fidl::encoding::Depth,
2061 ) -> fidl::Result<()> {
2062 decoder.debug_check_bounds::<Self>(offset);
2063 fidl::decode!(
2065 TableControllerCloseReason,
2066 D,
2067 &mut self.error,
2068 decoder,
2069 offset + 0,
2070 _depth
2071 )?;
2072 Ok(())
2073 }
2074 }
2075
2076 impl fidl::encoding::ValueTypeMarker for Ipv6RoutingTableControllerWatchRoutingEventsResponse {
2077 type Borrowed<'a> = &'a Self;
2078 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2079 value
2080 }
2081 }
2082
2083 unsafe impl fidl::encoding::TypeMarker for Ipv6RoutingTableControllerWatchRoutingEventsResponse {
2084 type Owned = Self;
2085
2086 #[inline(always)]
2087 fn inline_align(_context: fidl::encoding::Context) -> usize {
2088 8
2089 }
2090
2091 #[inline(always)]
2092 fn inline_size(_context: fidl::encoding::Context) -> usize {
2093 64
2094 }
2095 }
2096
2097 unsafe impl<D: fidl::encoding::ResourceDialect>
2098 fidl::encoding::Encode<Ipv6RoutingTableControllerWatchRoutingEventsResponse, D>
2099 for &Ipv6RoutingTableControllerWatchRoutingEventsResponse
2100 {
2101 #[inline]
2102 unsafe fn encode(
2103 self,
2104 encoder: &mut fidl::encoding::Encoder<'_, D>,
2105 offset: usize,
2106 _depth: fidl::encoding::Depth,
2107 ) -> fidl::Result<()> {
2108 encoder
2109 .debug_check_bounds::<Ipv6RoutingTableControllerWatchRoutingEventsResponse>(offset);
2110 fidl::encoding::Encode::<Ipv6RoutingTableControllerWatchRoutingEventsResponse, D>::encode(
2112 (
2113 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.dropped_events),
2114 <Ipv6UnicastSourceAndMulticastDestination as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
2115 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.input_interface),
2116 <RoutingEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),
2117 ),
2118 encoder, offset, _depth
2119 )
2120 }
2121 }
2122 unsafe impl<
2123 D: fidl::encoding::ResourceDialect,
2124 T0: fidl::encoding::Encode<u64, D>,
2125 T1: fidl::encoding::Encode<Ipv6UnicastSourceAndMulticastDestination, D>,
2126 T2: fidl::encoding::Encode<u64, D>,
2127 T3: fidl::encoding::Encode<RoutingEvent, D>,
2128 > fidl::encoding::Encode<Ipv6RoutingTableControllerWatchRoutingEventsResponse, D>
2129 for (T0, T1, T2, T3)
2130 {
2131 #[inline]
2132 unsafe fn encode(
2133 self,
2134 encoder: &mut fidl::encoding::Encoder<'_, D>,
2135 offset: usize,
2136 depth: fidl::encoding::Depth,
2137 ) -> fidl::Result<()> {
2138 encoder
2139 .debug_check_bounds::<Ipv6RoutingTableControllerWatchRoutingEventsResponse>(offset);
2140 self.0.encode(encoder, offset + 0, depth)?;
2144 self.1.encode(encoder, offset + 8, depth)?;
2145 self.2.encode(encoder, offset + 40, depth)?;
2146 self.3.encode(encoder, offset + 48, depth)?;
2147 Ok(())
2148 }
2149 }
2150
2151 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2152 for Ipv6RoutingTableControllerWatchRoutingEventsResponse
2153 {
2154 #[inline(always)]
2155 fn new_empty() -> Self {
2156 Self {
2157 dropped_events: fidl::new_empty!(u64, D),
2158 addresses: fidl::new_empty!(Ipv6UnicastSourceAndMulticastDestination, D),
2159 input_interface: fidl::new_empty!(u64, D),
2160 event: fidl::new_empty!(RoutingEvent, D),
2161 }
2162 }
2163
2164 #[inline]
2165 unsafe fn decode(
2166 &mut self,
2167 decoder: &mut fidl::encoding::Decoder<'_, D>,
2168 offset: usize,
2169 _depth: fidl::encoding::Depth,
2170 ) -> fidl::Result<()> {
2171 decoder.debug_check_bounds::<Self>(offset);
2172 fidl::decode!(u64, D, &mut self.dropped_events, decoder, offset + 0, _depth)?;
2174 fidl::decode!(
2175 Ipv6UnicastSourceAndMulticastDestination,
2176 D,
2177 &mut self.addresses,
2178 decoder,
2179 offset + 8,
2180 _depth
2181 )?;
2182 fidl::decode!(u64, D, &mut self.input_interface, decoder, offset + 40, _depth)?;
2183 fidl::decode!(RoutingEvent, D, &mut self.event, decoder, offset + 48, _depth)?;
2184 Ok(())
2185 }
2186 }
2187
2188 impl fidl::encoding::ValueTypeMarker for Ipv6RoutingTableControllerGetRouteStatsResponse {
2189 type Borrowed<'a> = &'a Self;
2190 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2191 value
2192 }
2193 }
2194
2195 unsafe impl fidl::encoding::TypeMarker for Ipv6RoutingTableControllerGetRouteStatsResponse {
2196 type Owned = Self;
2197
2198 #[inline(always)]
2199 fn inline_align(_context: fidl::encoding::Context) -> usize {
2200 8
2201 }
2202
2203 #[inline(always)]
2204 fn inline_size(_context: fidl::encoding::Context) -> usize {
2205 16
2206 }
2207 }
2208
2209 unsafe impl<D: fidl::encoding::ResourceDialect>
2210 fidl::encoding::Encode<Ipv6RoutingTableControllerGetRouteStatsResponse, D>
2211 for &Ipv6RoutingTableControllerGetRouteStatsResponse
2212 {
2213 #[inline]
2214 unsafe fn encode(
2215 self,
2216 encoder: &mut fidl::encoding::Encoder<'_, D>,
2217 offset: usize,
2218 _depth: fidl::encoding::Depth,
2219 ) -> fidl::Result<()> {
2220 encoder.debug_check_bounds::<Ipv6RoutingTableControllerGetRouteStatsResponse>(offset);
2221 fidl::encoding::Encode::<Ipv6RoutingTableControllerGetRouteStatsResponse, D>::encode(
2223 (<RouteStats as fidl::encoding::ValueTypeMarker>::borrow(&self.stats),),
2224 encoder,
2225 offset,
2226 _depth,
2227 )
2228 }
2229 }
2230 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<RouteStats, D>>
2231 fidl::encoding::Encode<Ipv6RoutingTableControllerGetRouteStatsResponse, D> for (T0,)
2232 {
2233 #[inline]
2234 unsafe fn encode(
2235 self,
2236 encoder: &mut fidl::encoding::Encoder<'_, D>,
2237 offset: usize,
2238 depth: fidl::encoding::Depth,
2239 ) -> fidl::Result<()> {
2240 encoder.debug_check_bounds::<Ipv6RoutingTableControllerGetRouteStatsResponse>(offset);
2241 self.0.encode(encoder, offset + 0, depth)?;
2245 Ok(())
2246 }
2247 }
2248
2249 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2250 for Ipv6RoutingTableControllerGetRouteStatsResponse
2251 {
2252 #[inline(always)]
2253 fn new_empty() -> Self {
2254 Self { stats: fidl::new_empty!(RouteStats, D) }
2255 }
2256
2257 #[inline]
2258 unsafe fn decode(
2259 &mut self,
2260 decoder: &mut fidl::encoding::Decoder<'_, D>,
2261 offset: usize,
2262 _depth: fidl::encoding::Depth,
2263 ) -> fidl::Result<()> {
2264 decoder.debug_check_bounds::<Self>(offset);
2265 fidl::decode!(RouteStats, D, &mut self.stats, decoder, offset + 0, _depth)?;
2267 Ok(())
2268 }
2269 }
2270
2271 impl fidl::encoding::ValueTypeMarker for Ipv6UnicastSourceAndMulticastDestination {
2272 type Borrowed<'a> = &'a Self;
2273 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2274 value
2275 }
2276 }
2277
2278 unsafe impl fidl::encoding::TypeMarker for Ipv6UnicastSourceAndMulticastDestination {
2279 type Owned = Self;
2280
2281 #[inline(always)]
2282 fn inline_align(_context: fidl::encoding::Context) -> usize {
2283 1
2284 }
2285
2286 #[inline(always)]
2287 fn inline_size(_context: fidl::encoding::Context) -> usize {
2288 32
2289 }
2290 }
2291
2292 unsafe impl<D: fidl::encoding::ResourceDialect>
2293 fidl::encoding::Encode<Ipv6UnicastSourceAndMulticastDestination, D>
2294 for &Ipv6UnicastSourceAndMulticastDestination
2295 {
2296 #[inline]
2297 unsafe fn encode(
2298 self,
2299 encoder: &mut fidl::encoding::Encoder<'_, D>,
2300 offset: usize,
2301 _depth: fidl::encoding::Depth,
2302 ) -> fidl::Result<()> {
2303 encoder.debug_check_bounds::<Ipv6UnicastSourceAndMulticastDestination>(offset);
2304 fidl::encoding::Encode::<Ipv6UnicastSourceAndMulticastDestination, D>::encode(
2306 (
2307 <fidl_fuchsia_net__common::Ipv6Address as fidl::encoding::ValueTypeMarker>::borrow(&self.unicast_source),
2308 <fidl_fuchsia_net__common::Ipv6Address as fidl::encoding::ValueTypeMarker>::borrow(&self.multicast_destination),
2309 ),
2310 encoder, offset, _depth
2311 )
2312 }
2313 }
2314 unsafe impl<
2315 D: fidl::encoding::ResourceDialect,
2316 T0: fidl::encoding::Encode<fidl_fuchsia_net__common::Ipv6Address, D>,
2317 T1: fidl::encoding::Encode<fidl_fuchsia_net__common::Ipv6Address, D>,
2318 > fidl::encoding::Encode<Ipv6UnicastSourceAndMulticastDestination, D> for (T0, T1)
2319 {
2320 #[inline]
2321 unsafe fn encode(
2322 self,
2323 encoder: &mut fidl::encoding::Encoder<'_, D>,
2324 offset: usize,
2325 depth: fidl::encoding::Depth,
2326 ) -> fidl::Result<()> {
2327 encoder.debug_check_bounds::<Ipv6UnicastSourceAndMulticastDestination>(offset);
2328 self.0.encode(encoder, offset + 0, depth)?;
2332 self.1.encode(encoder, offset + 16, depth)?;
2333 Ok(())
2334 }
2335 }
2336
2337 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2338 for Ipv6UnicastSourceAndMulticastDestination
2339 {
2340 #[inline(always)]
2341 fn new_empty() -> Self {
2342 Self {
2343 unicast_source: fidl::new_empty!(fidl_fuchsia_net__common::Ipv6Address, D),
2344 multicast_destination: fidl::new_empty!(fidl_fuchsia_net__common::Ipv6Address, D),
2345 }
2346 }
2347
2348 #[inline]
2349 unsafe fn decode(
2350 &mut self,
2351 decoder: &mut fidl::encoding::Decoder<'_, D>,
2352 offset: usize,
2353 _depth: fidl::encoding::Depth,
2354 ) -> fidl::Result<()> {
2355 decoder.debug_check_bounds::<Self>(offset);
2356 fidl::decode!(
2358 fidl_fuchsia_net__common::Ipv6Address,
2359 D,
2360 &mut self.unicast_source,
2361 decoder,
2362 offset + 0,
2363 _depth
2364 )?;
2365 fidl::decode!(
2366 fidl_fuchsia_net__common::Ipv6Address,
2367 D,
2368 &mut self.multicast_destination,
2369 decoder,
2370 offset + 16,
2371 _depth
2372 )?;
2373 Ok(())
2374 }
2375 }
2376
2377 impl fidl::encoding::ValueTypeMarker for OutgoingInterfaces {
2378 type Borrowed<'a> = &'a Self;
2379 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2380 value
2381 }
2382 }
2383
2384 unsafe impl fidl::encoding::TypeMarker for OutgoingInterfaces {
2385 type Owned = Self;
2386
2387 #[inline(always)]
2388 fn inline_align(_context: fidl::encoding::Context) -> usize {
2389 8
2390 }
2391
2392 #[inline(always)]
2393 fn inline_size(_context: fidl::encoding::Context) -> usize {
2394 16
2395 }
2396 }
2397
2398 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<OutgoingInterfaces, D>
2399 for &OutgoingInterfaces
2400 {
2401 #[inline]
2402 unsafe fn encode(
2403 self,
2404 encoder: &mut fidl::encoding::Encoder<'_, D>,
2405 offset: usize,
2406 _depth: fidl::encoding::Depth,
2407 ) -> fidl::Result<()> {
2408 encoder.debug_check_bounds::<OutgoingInterfaces>(offset);
2409 unsafe {
2410 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2412 (buf_ptr as *mut OutgoingInterfaces)
2413 .write_unaligned((self as *const OutgoingInterfaces).read());
2414 let padding_ptr = buf_ptr.offset(8) as *mut u64;
2417 let padding_mask = 0xffffffffffffff00u64;
2418 padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
2419 }
2420 Ok(())
2421 }
2422 }
2423 unsafe impl<
2424 D: fidl::encoding::ResourceDialect,
2425 T0: fidl::encoding::Encode<u64, D>,
2426 T1: fidl::encoding::Encode<u8, D>,
2427 > fidl::encoding::Encode<OutgoingInterfaces, D> for (T0, T1)
2428 {
2429 #[inline]
2430 unsafe fn encode(
2431 self,
2432 encoder: &mut fidl::encoding::Encoder<'_, D>,
2433 offset: usize,
2434 depth: fidl::encoding::Depth,
2435 ) -> fidl::Result<()> {
2436 encoder.debug_check_bounds::<OutgoingInterfaces>(offset);
2437 unsafe {
2440 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
2441 (ptr as *mut u64).write_unaligned(0);
2442 }
2443 self.0.encode(encoder, offset + 0, depth)?;
2445 self.1.encode(encoder, offset + 8, depth)?;
2446 Ok(())
2447 }
2448 }
2449
2450 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for OutgoingInterfaces {
2451 #[inline(always)]
2452 fn new_empty() -> Self {
2453 Self { id: fidl::new_empty!(u64, D), min_ttl: fidl::new_empty!(u8, D) }
2454 }
2455
2456 #[inline]
2457 unsafe fn decode(
2458 &mut self,
2459 decoder: &mut fidl::encoding::Decoder<'_, D>,
2460 offset: usize,
2461 _depth: fidl::encoding::Depth,
2462 ) -> fidl::Result<()> {
2463 decoder.debug_check_bounds::<Self>(offset);
2464 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2465 let ptr = unsafe { buf_ptr.offset(8) };
2467 let padval = unsafe { (ptr as *const u64).read_unaligned() };
2468 let mask = 0xffffffffffffff00u64;
2469 let maskedval = padval & mask;
2470 if maskedval != 0 {
2471 return Err(fidl::Error::NonZeroPadding {
2472 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2473 });
2474 }
2475 unsafe {
2477 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
2478 }
2479 Ok(())
2480 }
2481 }
2482
2483 impl Route {
2484 #[inline(always)]
2485 fn max_ordinal_present(&self) -> u64 {
2486 if let Some(_) = self.action {
2487 return 2;
2488 }
2489 if let Some(_) = self.expected_input_interface {
2490 return 1;
2491 }
2492 0
2493 }
2494 }
2495
2496 impl fidl::encoding::ValueTypeMarker for Route {
2497 type Borrowed<'a> = &'a Self;
2498 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2499 value
2500 }
2501 }
2502
2503 unsafe impl fidl::encoding::TypeMarker for Route {
2504 type Owned = Self;
2505
2506 #[inline(always)]
2507 fn inline_align(_context: fidl::encoding::Context) -> usize {
2508 8
2509 }
2510
2511 #[inline(always)]
2512 fn inline_size(_context: fidl::encoding::Context) -> usize {
2513 16
2514 }
2515 }
2516
2517 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Route, D> for &Route {
2518 unsafe fn encode(
2519 self,
2520 encoder: &mut fidl::encoding::Encoder<'_, D>,
2521 offset: usize,
2522 mut depth: fidl::encoding::Depth,
2523 ) -> fidl::Result<()> {
2524 encoder.debug_check_bounds::<Route>(offset);
2525 let max_ordinal: u64 = self.max_ordinal_present();
2527 encoder.write_num(max_ordinal, offset);
2528 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2529 if max_ordinal == 0 {
2531 return Ok(());
2532 }
2533 depth.increment()?;
2534 let envelope_size = 8;
2535 let bytes_len = max_ordinal as usize * envelope_size;
2536 #[allow(unused_variables)]
2537 let offset = encoder.out_of_line_offset(bytes_len);
2538 let mut _prev_end_offset: usize = 0;
2539 if 1 > max_ordinal {
2540 return Ok(());
2541 }
2542
2543 let cur_offset: usize = (1 - 1) * envelope_size;
2546
2547 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2549
2550 fidl::encoding::encode_in_envelope_optional::<u64, D>(
2555 self.expected_input_interface
2556 .as_ref()
2557 .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2558 encoder,
2559 offset + cur_offset,
2560 depth,
2561 )?;
2562
2563 _prev_end_offset = cur_offset + envelope_size;
2564 if 2 > max_ordinal {
2565 return Ok(());
2566 }
2567
2568 let cur_offset: usize = (2 - 1) * envelope_size;
2571
2572 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2574
2575 fidl::encoding::encode_in_envelope_optional::<Action, D>(
2580 self.action.as_ref().map(<Action as fidl::encoding::ValueTypeMarker>::borrow),
2581 encoder,
2582 offset + cur_offset,
2583 depth,
2584 )?;
2585
2586 _prev_end_offset = cur_offset + envelope_size;
2587
2588 Ok(())
2589 }
2590 }
2591
2592 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Route {
2593 #[inline(always)]
2594 fn new_empty() -> Self {
2595 Self::default()
2596 }
2597
2598 unsafe fn decode(
2599 &mut self,
2600 decoder: &mut fidl::encoding::Decoder<'_, D>,
2601 offset: usize,
2602 mut depth: fidl::encoding::Depth,
2603 ) -> fidl::Result<()> {
2604 decoder.debug_check_bounds::<Self>(offset);
2605 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2606 None => return Err(fidl::Error::NotNullable),
2607 Some(len) => len,
2608 };
2609 if len == 0 {
2611 return Ok(());
2612 };
2613 depth.increment()?;
2614 let envelope_size = 8;
2615 let bytes_len = len * envelope_size;
2616 let offset = decoder.out_of_line_offset(bytes_len)?;
2617 let mut _next_ordinal_to_read = 0;
2619 let mut next_offset = offset;
2620 let end_offset = offset + bytes_len;
2621 _next_ordinal_to_read += 1;
2622 if next_offset >= end_offset {
2623 return Ok(());
2624 }
2625
2626 while _next_ordinal_to_read < 1 {
2628 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2629 _next_ordinal_to_read += 1;
2630 next_offset += envelope_size;
2631 }
2632
2633 let next_out_of_line = decoder.next_out_of_line();
2634 let handles_before = decoder.remaining_handles();
2635 if let Some((inlined, num_bytes, num_handles)) =
2636 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2637 {
2638 let member_inline_size =
2639 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2640 if inlined != (member_inline_size <= 4) {
2641 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2642 }
2643 let inner_offset;
2644 let mut inner_depth = depth.clone();
2645 if inlined {
2646 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2647 inner_offset = next_offset;
2648 } else {
2649 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2650 inner_depth.increment()?;
2651 }
2652 let val_ref =
2653 self.expected_input_interface.get_or_insert_with(|| fidl::new_empty!(u64, D));
2654 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2655 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2656 {
2657 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2658 }
2659 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2660 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2661 }
2662 }
2663
2664 next_offset += envelope_size;
2665 _next_ordinal_to_read += 1;
2666 if next_offset >= end_offset {
2667 return Ok(());
2668 }
2669
2670 while _next_ordinal_to_read < 2 {
2672 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2673 _next_ordinal_to_read += 1;
2674 next_offset += envelope_size;
2675 }
2676
2677 let next_out_of_line = decoder.next_out_of_line();
2678 let handles_before = decoder.remaining_handles();
2679 if let Some((inlined, num_bytes, num_handles)) =
2680 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2681 {
2682 let member_inline_size =
2683 <Action as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2684 if inlined != (member_inline_size <= 4) {
2685 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2686 }
2687 let inner_offset;
2688 let mut inner_depth = depth.clone();
2689 if inlined {
2690 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2691 inner_offset = next_offset;
2692 } else {
2693 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2694 inner_depth.increment()?;
2695 }
2696 let val_ref = self.action.get_or_insert_with(|| fidl::new_empty!(Action, D));
2697 fidl::decode!(Action, D, val_ref, decoder, inner_offset, inner_depth)?;
2698 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2699 {
2700 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2701 }
2702 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2703 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2704 }
2705 }
2706
2707 next_offset += envelope_size;
2708
2709 while next_offset < end_offset {
2711 _next_ordinal_to_read += 1;
2712 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2713 next_offset += envelope_size;
2714 }
2715
2716 Ok(())
2717 }
2718 }
2719
2720 impl RouteStats {
2721 #[inline(always)]
2722 fn max_ordinal_present(&self) -> u64 {
2723 if let Some(_) = self.last_used {
2724 return 1;
2725 }
2726 0
2727 }
2728 }
2729
2730 impl fidl::encoding::ValueTypeMarker for RouteStats {
2731 type Borrowed<'a> = &'a Self;
2732 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2733 value
2734 }
2735 }
2736
2737 unsafe impl fidl::encoding::TypeMarker for RouteStats {
2738 type Owned = Self;
2739
2740 #[inline(always)]
2741 fn inline_align(_context: fidl::encoding::Context) -> usize {
2742 8
2743 }
2744
2745 #[inline(always)]
2746 fn inline_size(_context: fidl::encoding::Context) -> usize {
2747 16
2748 }
2749 }
2750
2751 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RouteStats, D>
2752 for &RouteStats
2753 {
2754 unsafe fn encode(
2755 self,
2756 encoder: &mut fidl::encoding::Encoder<'_, D>,
2757 offset: usize,
2758 mut depth: fidl::encoding::Depth,
2759 ) -> fidl::Result<()> {
2760 encoder.debug_check_bounds::<RouteStats>(offset);
2761 let max_ordinal: u64 = self.max_ordinal_present();
2763 encoder.write_num(max_ordinal, offset);
2764 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2765 if max_ordinal == 0 {
2767 return Ok(());
2768 }
2769 depth.increment()?;
2770 let envelope_size = 8;
2771 let bytes_len = max_ordinal as usize * envelope_size;
2772 #[allow(unused_variables)]
2773 let offset = encoder.out_of_line_offset(bytes_len);
2774 let mut _prev_end_offset: usize = 0;
2775 if 1 > max_ordinal {
2776 return Ok(());
2777 }
2778
2779 let cur_offset: usize = (1 - 1) * envelope_size;
2782
2783 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2785
2786 fidl::encoding::encode_in_envelope_optional::<i64, D>(
2791 self.last_used.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
2792 encoder,
2793 offset + cur_offset,
2794 depth,
2795 )?;
2796
2797 _prev_end_offset = cur_offset + envelope_size;
2798
2799 Ok(())
2800 }
2801 }
2802
2803 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RouteStats {
2804 #[inline(always)]
2805 fn new_empty() -> Self {
2806 Self::default()
2807 }
2808
2809 unsafe fn decode(
2810 &mut self,
2811 decoder: &mut fidl::encoding::Decoder<'_, D>,
2812 offset: usize,
2813 mut depth: fidl::encoding::Depth,
2814 ) -> fidl::Result<()> {
2815 decoder.debug_check_bounds::<Self>(offset);
2816 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2817 None => return Err(fidl::Error::NotNullable),
2818 Some(len) => len,
2819 };
2820 if len == 0 {
2822 return Ok(());
2823 };
2824 depth.increment()?;
2825 let envelope_size = 8;
2826 let bytes_len = len * envelope_size;
2827 let offset = decoder.out_of_line_offset(bytes_len)?;
2828 let mut _next_ordinal_to_read = 0;
2830 let mut next_offset = offset;
2831 let end_offset = offset + bytes_len;
2832 _next_ordinal_to_read += 1;
2833 if next_offset >= end_offset {
2834 return Ok(());
2835 }
2836
2837 while _next_ordinal_to_read < 1 {
2839 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2840 _next_ordinal_to_read += 1;
2841 next_offset += envelope_size;
2842 }
2843
2844 let next_out_of_line = decoder.next_out_of_line();
2845 let handles_before = decoder.remaining_handles();
2846 if let Some((inlined, num_bytes, num_handles)) =
2847 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2848 {
2849 let member_inline_size =
2850 <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2851 if inlined != (member_inline_size <= 4) {
2852 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2853 }
2854 let inner_offset;
2855 let mut inner_depth = depth.clone();
2856 if inlined {
2857 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2858 inner_offset = next_offset;
2859 } else {
2860 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2861 inner_depth.increment()?;
2862 }
2863 let val_ref = self.last_used.get_or_insert_with(|| fidl::new_empty!(i64, D));
2864 fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
2865 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2866 {
2867 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2868 }
2869 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2870 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2871 }
2872 }
2873
2874 next_offset += envelope_size;
2875
2876 while next_offset < end_offset {
2878 _next_ordinal_to_read += 1;
2879 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2880 next_offset += envelope_size;
2881 }
2882
2883 Ok(())
2884 }
2885 }
2886
2887 impl WrongInputInterface {
2888 #[inline(always)]
2889 fn max_ordinal_present(&self) -> u64 {
2890 if let Some(_) = self.expected_input_interface {
2891 return 1;
2892 }
2893 0
2894 }
2895 }
2896
2897 impl fidl::encoding::ValueTypeMarker for WrongInputInterface {
2898 type Borrowed<'a> = &'a Self;
2899 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2900 value
2901 }
2902 }
2903
2904 unsafe impl fidl::encoding::TypeMarker for WrongInputInterface {
2905 type Owned = Self;
2906
2907 #[inline(always)]
2908 fn inline_align(_context: fidl::encoding::Context) -> usize {
2909 8
2910 }
2911
2912 #[inline(always)]
2913 fn inline_size(_context: fidl::encoding::Context) -> usize {
2914 16
2915 }
2916 }
2917
2918 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WrongInputInterface, D>
2919 for &WrongInputInterface
2920 {
2921 unsafe fn encode(
2922 self,
2923 encoder: &mut fidl::encoding::Encoder<'_, D>,
2924 offset: usize,
2925 mut depth: fidl::encoding::Depth,
2926 ) -> fidl::Result<()> {
2927 encoder.debug_check_bounds::<WrongInputInterface>(offset);
2928 let max_ordinal: u64 = self.max_ordinal_present();
2930 encoder.write_num(max_ordinal, offset);
2931 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2932 if max_ordinal == 0 {
2934 return Ok(());
2935 }
2936 depth.increment()?;
2937 let envelope_size = 8;
2938 let bytes_len = max_ordinal as usize * envelope_size;
2939 #[allow(unused_variables)]
2940 let offset = encoder.out_of_line_offset(bytes_len);
2941 let mut _prev_end_offset: usize = 0;
2942 if 1 > max_ordinal {
2943 return Ok(());
2944 }
2945
2946 let cur_offset: usize = (1 - 1) * envelope_size;
2949
2950 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2952
2953 fidl::encoding::encode_in_envelope_optional::<u64, D>(
2958 self.expected_input_interface
2959 .as_ref()
2960 .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2961 encoder,
2962 offset + cur_offset,
2963 depth,
2964 )?;
2965
2966 _prev_end_offset = cur_offset + envelope_size;
2967
2968 Ok(())
2969 }
2970 }
2971
2972 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WrongInputInterface {
2973 #[inline(always)]
2974 fn new_empty() -> Self {
2975 Self::default()
2976 }
2977
2978 unsafe fn decode(
2979 &mut self,
2980 decoder: &mut fidl::encoding::Decoder<'_, D>,
2981 offset: usize,
2982 mut depth: fidl::encoding::Depth,
2983 ) -> fidl::Result<()> {
2984 decoder.debug_check_bounds::<Self>(offset);
2985 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2986 None => return Err(fidl::Error::NotNullable),
2987 Some(len) => len,
2988 };
2989 if len == 0 {
2991 return Ok(());
2992 };
2993 depth.increment()?;
2994 let envelope_size = 8;
2995 let bytes_len = len * envelope_size;
2996 let offset = decoder.out_of_line_offset(bytes_len)?;
2997 let mut _next_ordinal_to_read = 0;
2999 let mut next_offset = offset;
3000 let end_offset = offset + bytes_len;
3001 _next_ordinal_to_read += 1;
3002 if next_offset >= end_offset {
3003 return Ok(());
3004 }
3005
3006 while _next_ordinal_to_read < 1 {
3008 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3009 _next_ordinal_to_read += 1;
3010 next_offset += envelope_size;
3011 }
3012
3013 let next_out_of_line = decoder.next_out_of_line();
3014 let handles_before = decoder.remaining_handles();
3015 if let Some((inlined, num_bytes, num_handles)) =
3016 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3017 {
3018 let member_inline_size =
3019 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3020 if inlined != (member_inline_size <= 4) {
3021 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3022 }
3023 let inner_offset;
3024 let mut inner_depth = depth.clone();
3025 if inlined {
3026 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3027 inner_offset = next_offset;
3028 } else {
3029 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3030 inner_depth.increment()?;
3031 }
3032 let val_ref =
3033 self.expected_input_interface.get_or_insert_with(|| fidl::new_empty!(u64, D));
3034 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
3035 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3036 {
3037 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3038 }
3039 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3040 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3041 }
3042 }
3043
3044 next_offset += envelope_size;
3045
3046 while next_offset < end_offset {
3048 _next_ordinal_to_read += 1;
3049 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3050 next_offset += envelope_size;
3051 }
3052
3053 Ok(())
3054 }
3055 }
3056
3057 impl fidl::encoding::ValueTypeMarker for Action {
3058 type Borrowed<'a> = &'a Self;
3059 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3060 value
3061 }
3062 }
3063
3064 unsafe impl fidl::encoding::TypeMarker for Action {
3065 type Owned = Self;
3066
3067 #[inline(always)]
3068 fn inline_align(_context: fidl::encoding::Context) -> usize {
3069 8
3070 }
3071
3072 #[inline(always)]
3073 fn inline_size(_context: fidl::encoding::Context) -> usize {
3074 16
3075 }
3076 }
3077
3078 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Action, D> for &Action {
3079 #[inline]
3080 unsafe fn encode(
3081 self,
3082 encoder: &mut fidl::encoding::Encoder<'_, D>,
3083 offset: usize,
3084 _depth: fidl::encoding::Depth,
3085 ) -> fidl::Result<()> {
3086 encoder.debug_check_bounds::<Action>(offset);
3087 encoder.write_num::<u64>(self.ordinal(), offset);
3088 match self {
3089 Action::OutgoingInterfaces(ref val) => {
3090 fidl::encoding::encode_in_envelope::<fidl::encoding::Vector<OutgoingInterfaces, 32>, D>(
3091 <fidl::encoding::Vector<OutgoingInterfaces, 32> as fidl::encoding::ValueTypeMarker>::borrow(val),
3092 encoder, offset + 8, _depth
3093 )
3094 }
3095 }
3096 }
3097 }
3098
3099 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Action {
3100 #[inline(always)]
3101 fn new_empty() -> Self {
3102 Self::OutgoingInterfaces(
3103 fidl::new_empty!(fidl::encoding::Vector<OutgoingInterfaces, 32>, D),
3104 )
3105 }
3106
3107 #[inline]
3108 unsafe fn decode(
3109 &mut self,
3110 decoder: &mut fidl::encoding::Decoder<'_, D>,
3111 offset: usize,
3112 mut depth: fidl::encoding::Depth,
3113 ) -> fidl::Result<()> {
3114 decoder.debug_check_bounds::<Self>(offset);
3115 #[allow(unused_variables)]
3116 let next_out_of_line = decoder.next_out_of_line();
3117 let handles_before = decoder.remaining_handles();
3118 let (ordinal, inlined, num_bytes, num_handles) =
3119 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3120
3121 let member_inline_size = match ordinal {
3122 1 => <fidl::encoding::Vector<OutgoingInterfaces, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3123 _ => return Err(fidl::Error::UnknownUnionTag),
3124 };
3125
3126 if inlined != (member_inline_size <= 4) {
3127 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3128 }
3129 let _inner_offset;
3130 if inlined {
3131 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3132 _inner_offset = offset + 8;
3133 } else {
3134 depth.increment()?;
3135 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3136 }
3137 match ordinal {
3138 1 => {
3139 #[allow(irrefutable_let_patterns)]
3140 if let Action::OutgoingInterfaces(_) = self {
3141 } else {
3143 *self = Action::OutgoingInterfaces(
3145 fidl::new_empty!(fidl::encoding::Vector<OutgoingInterfaces, 32>, D),
3146 );
3147 }
3148 #[allow(irrefutable_let_patterns)]
3149 if let Action::OutgoingInterfaces(ref mut val) = self {
3150 fidl::decode!(fidl::encoding::Vector<OutgoingInterfaces, 32>, D, val, decoder, _inner_offset, depth)?;
3151 } else {
3152 unreachable!()
3153 }
3154 }
3155 ordinal => panic!("unexpected ordinal {:?}", ordinal),
3156 }
3157 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3158 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3159 }
3160 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3161 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3162 }
3163 Ok(())
3164 }
3165 }
3166
3167 impl fidl::encoding::ValueTypeMarker for RoutingEvent {
3168 type Borrowed<'a> = &'a Self;
3169 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3170 value
3171 }
3172 }
3173
3174 unsafe impl fidl::encoding::TypeMarker for RoutingEvent {
3175 type Owned = Self;
3176
3177 #[inline(always)]
3178 fn inline_align(_context: fidl::encoding::Context) -> usize {
3179 8
3180 }
3181
3182 #[inline(always)]
3183 fn inline_size(_context: fidl::encoding::Context) -> usize {
3184 16
3185 }
3186 }
3187
3188 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RoutingEvent, D>
3189 for &RoutingEvent
3190 {
3191 #[inline]
3192 unsafe fn encode(
3193 self,
3194 encoder: &mut fidl::encoding::Encoder<'_, D>,
3195 offset: usize,
3196 _depth: fidl::encoding::Depth,
3197 ) -> fidl::Result<()> {
3198 encoder.debug_check_bounds::<RoutingEvent>(offset);
3199 encoder.write_num::<u64>(self.ordinal(), offset);
3200 match self {
3201 RoutingEvent::MissingRoute(ref val) => {
3202 fidl::encoding::encode_in_envelope::<Empty, D>(
3203 <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
3204 encoder,
3205 offset + 8,
3206 _depth,
3207 )
3208 }
3209 RoutingEvent::WrongInputInterface(ref val) => {
3210 fidl::encoding::encode_in_envelope::<WrongInputInterface, D>(
3211 <WrongInputInterface as fidl::encoding::ValueTypeMarker>::borrow(val),
3212 encoder,
3213 offset + 8,
3214 _depth,
3215 )
3216 }
3217 }
3218 }
3219 }
3220
3221 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RoutingEvent {
3222 #[inline(always)]
3223 fn new_empty() -> Self {
3224 Self::MissingRoute(fidl::new_empty!(Empty, D))
3225 }
3226
3227 #[inline]
3228 unsafe fn decode(
3229 &mut self,
3230 decoder: &mut fidl::encoding::Decoder<'_, D>,
3231 offset: usize,
3232 mut depth: fidl::encoding::Depth,
3233 ) -> fidl::Result<()> {
3234 decoder.debug_check_bounds::<Self>(offset);
3235 #[allow(unused_variables)]
3236 let next_out_of_line = decoder.next_out_of_line();
3237 let handles_before = decoder.remaining_handles();
3238 let (ordinal, inlined, num_bytes, num_handles) =
3239 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
3240
3241 let member_inline_size = match ordinal {
3242 1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
3243 2 => <WrongInputInterface as fidl::encoding::TypeMarker>::inline_size(
3244 decoder.context,
3245 ),
3246 _ => return Err(fidl::Error::UnknownUnionTag),
3247 };
3248
3249 if inlined != (member_inline_size <= 4) {
3250 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3251 }
3252 let _inner_offset;
3253 if inlined {
3254 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3255 _inner_offset = offset + 8;
3256 } else {
3257 depth.increment()?;
3258 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3259 }
3260 match ordinal {
3261 1 => {
3262 #[allow(irrefutable_let_patterns)]
3263 if let RoutingEvent::MissingRoute(_) = self {
3264 } else {
3266 *self = RoutingEvent::MissingRoute(fidl::new_empty!(Empty, D));
3268 }
3269 #[allow(irrefutable_let_patterns)]
3270 if let RoutingEvent::MissingRoute(ref mut val) = self {
3271 fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
3272 } else {
3273 unreachable!()
3274 }
3275 }
3276 2 => {
3277 #[allow(irrefutable_let_patterns)]
3278 if let RoutingEvent::WrongInputInterface(_) = self {
3279 } else {
3281 *self = RoutingEvent::WrongInputInterface(fidl::new_empty!(
3283 WrongInputInterface,
3284 D
3285 ));
3286 }
3287 #[allow(irrefutable_let_patterns)]
3288 if let RoutingEvent::WrongInputInterface(ref mut val) = self {
3289 fidl::decode!(WrongInputInterface, D, val, decoder, _inner_offset, depth)?;
3290 } else {
3291 unreachable!()
3292 }
3293 }
3294 ordinal => panic!("unexpected ordinal {:?}", ordinal),
3295 }
3296 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3297 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3298 }
3299 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3300 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3301 }
3302 Ok(())
3303 }
3304 }
3305}