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