fidl_fuchsia_component_runtime__common/
fidl_fuchsia_component_runtime__common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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_DATA_LENGTH: u32 = 8192;
12
13#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
14pub enum CapabilitiesError {
15    NoSuchCapability,
16    InvalidName,
17    HandleDoesNotReferenceCapability,
18    InvalidCapabilityType,
19    UnregisteredCapability,
20    InvalidHandle,
21    #[doc(hidden)]
22    __SourceBreaking {
23        unknown_ordinal: u32,
24    },
25}
26
27/// Pattern that matches an unknown `CapabilitiesError` member.
28#[macro_export]
29macro_rules! CapabilitiesErrorUnknown {
30    () => {
31        _
32    };
33}
34
35impl CapabilitiesError {
36    #[inline]
37    pub fn from_primitive(prim: u32) -> Option<Self> {
38        match prim {
39            1 => Some(Self::NoSuchCapability),
40            2 => Some(Self::InvalidName),
41            3 => Some(Self::HandleDoesNotReferenceCapability),
42            4 => Some(Self::InvalidCapabilityType),
43            5 => Some(Self::UnregisteredCapability),
44            6 => Some(Self::InvalidHandle),
45            _ => None,
46        }
47    }
48
49    #[inline]
50    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
51        match prim {
52            1 => Self::NoSuchCapability,
53            2 => Self::InvalidName,
54            3 => Self::HandleDoesNotReferenceCapability,
55            4 => Self::InvalidCapabilityType,
56            5 => Self::UnregisteredCapability,
57            6 => Self::InvalidHandle,
58            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
59        }
60    }
61
62    #[inline]
63    pub fn unknown() -> Self {
64        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
65    }
66
67    #[inline]
68    pub const fn into_primitive(self) -> u32 {
69        match self {
70            Self::NoSuchCapability => 1,
71            Self::InvalidName => 2,
72            Self::HandleDoesNotReferenceCapability => 3,
73            Self::InvalidCapabilityType => 4,
74            Self::UnregisteredCapability => 5,
75            Self::InvalidHandle => 6,
76            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
77        }
78    }
79
80    #[inline]
81    pub fn is_unknown(&self) -> bool {
82        match self {
83            Self::__SourceBreaking { unknown_ordinal: _ } => true,
84            _ => false,
85        }
86    }
87}
88
89#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
90pub enum CapabilityType {
91    Connector,
92    DirConnector,
93    Dictionary,
94    Data,
95    ConnectorRouter,
96    DirConnectorRouter,
97    DictionaryRouter,
98    DataRouter,
99    #[doc(hidden)]
100    __SourceBreaking {
101        unknown_ordinal: u32,
102    },
103}
104
105/// Pattern that matches an unknown `CapabilityType` member.
106#[macro_export]
107macro_rules! CapabilityTypeUnknown {
108    () => {
109        _
110    };
111}
112
113impl CapabilityType {
114    #[inline]
115    pub fn from_primitive(prim: u32) -> Option<Self> {
116        match prim {
117            1 => Some(Self::Connector),
118            2 => Some(Self::DirConnector),
119            3 => Some(Self::Dictionary),
120            4 => Some(Self::Data),
121            5 => Some(Self::ConnectorRouter),
122            6 => Some(Self::DirConnectorRouter),
123            7 => Some(Self::DictionaryRouter),
124            8 => Some(Self::DataRouter),
125            _ => None,
126        }
127    }
128
129    #[inline]
130    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
131        match prim {
132            1 => Self::Connector,
133            2 => Self::DirConnector,
134            3 => Self::Dictionary,
135            4 => Self::Data,
136            5 => Self::ConnectorRouter,
137            6 => Self::DirConnectorRouter,
138            7 => Self::DictionaryRouter,
139            8 => Self::DataRouter,
140            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
141        }
142    }
143
144    #[inline]
145    pub fn unknown() -> Self {
146        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
147    }
148
149    #[inline]
150    pub const fn into_primitive(self) -> u32 {
151        match self {
152            Self::Connector => 1,
153            Self::DirConnector => 2,
154            Self::Dictionary => 3,
155            Self::Data => 4,
156            Self::ConnectorRouter => 5,
157            Self::DirConnectorRouter => 6,
158            Self::DictionaryRouter => 7,
159            Self::DataRouter => 8,
160            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
161        }
162    }
163
164    #[inline]
165    pub fn is_unknown(&self) -> bool {
166        match self {
167            Self::__SourceBreaking { unknown_ordinal: _ } => true,
168            _ => false,
169        }
170    }
171}
172
173/// The error values returned when a route operation fails.
174#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
175pub enum RouterError {
176    /// The router failed to find the capability.
177    NotFound,
178    /// The arguments provided to the function are invalid.
179    InvalidArgs,
180    /// The operation is not supported.
181    NotSupported,
182    /// An internal error occurred.
183    Internal,
184    /// An unknown error occurred.
185    Unknown,
186    #[doc(hidden)]
187    __SourceBreaking { unknown_ordinal: u32 },
188}
189
190/// Pattern that matches an unknown `RouterError` member.
191#[macro_export]
192macro_rules! RouterErrorUnknown {
193    () => {
194        _
195    };
196}
197
198impl RouterError {
199    #[inline]
200    pub fn from_primitive(prim: u32) -> Option<Self> {
201        match prim {
202            1 => Some(Self::NotFound),
203            2 => Some(Self::InvalidArgs),
204            3 => Some(Self::NotSupported),
205            4 => Some(Self::Internal),
206            5 => Some(Self::Unknown),
207            _ => None,
208        }
209    }
210
211    #[inline]
212    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
213        match prim {
214            1 => Self::NotFound,
215            2 => Self::InvalidArgs,
216            3 => Self::NotSupported,
217            4 => Self::Internal,
218            5 => Self::Unknown,
219            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
220        }
221    }
222
223    #[inline]
224    pub fn unknown() -> Self {
225        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
226    }
227
228    #[inline]
229    pub const fn into_primitive(self) -> u32 {
230        match self {
231            Self::NotFound => 1,
232            Self::InvalidArgs => 2,
233            Self::NotSupported => 3,
234            Self::Internal => 4,
235            Self::Unknown => 5,
236            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
237        }
238    }
239
240    #[inline]
241    pub fn is_unknown(&self) -> bool {
242        match self {
243            Self::__SourceBreaking { unknown_ordinal: _ } => true,
244            _ => false,
245        }
246    }
247}
248
249/// The error values returned when a route operation succeeds.
250#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
251pub enum RouterResponse {
252    /// The server end has been connected to a valid object.
253    Success,
254    /// The capability was marked as unavailable.
255    Unavailable,
256    #[doc(hidden)]
257    __SourceBreaking { unknown_ordinal: u32 },
258}
259
260/// Pattern that matches an unknown `RouterResponse` member.
261#[macro_export]
262macro_rules! RouterResponseUnknown {
263    () => {
264        _
265    };
266}
267
268impl RouterResponse {
269    #[inline]
270    pub fn from_primitive(prim: u32) -> Option<Self> {
271        match prim {
272            1 => Some(Self::Success),
273            2 => Some(Self::Unavailable),
274            _ => None,
275        }
276    }
277
278    #[inline]
279    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
280        match prim {
281            1 => Self::Success,
282            2 => Self::Unavailable,
283            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
284        }
285    }
286
287    #[inline]
288    pub fn unknown() -> Self {
289        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
290    }
291
292    #[inline]
293    pub const fn into_primitive(self) -> u32 {
294        match self {
295            Self::Success => 1,
296            Self::Unavailable => 2,
297            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
298        }
299    }
300
301    #[inline]
302    pub fn is_unknown(&self) -> bool {
303        match self {
304            Self::__SourceBreaking { unknown_ordinal: _ } => true,
305            _ => false,
306        }
307    }
308}
309
310#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
311pub struct DictionaryKeyIteratorGetNextResponse {
312    pub keys: Vec<String>,
313}
314
315impl fidl::Persistable for DictionaryKeyIteratorGetNextResponse {}
316
317/// Static data which may be put in a dictionary or returned by a router. This
318/// is useful for setting values in the metadata of a `RouteRequest`.
319#[derive(Clone, Debug)]
320pub enum Data {
321    Bytes(Vec<u8>),
322    String(String),
323    Int64(i64),
324    Uint64(u64),
325    #[doc(hidden)]
326    __SourceBreaking {
327        unknown_ordinal: u64,
328    },
329}
330
331/// Pattern that matches an unknown `Data` member.
332#[macro_export]
333macro_rules! DataUnknown {
334    () => {
335        _
336    };
337}
338
339// Custom PartialEq so that unknown variants are not equal to themselves.
340impl PartialEq for Data {
341    fn eq(&self, other: &Self) -> bool {
342        match (self, other) {
343            (Self::Bytes(x), Self::Bytes(y)) => *x == *y,
344            (Self::String(x), Self::String(y)) => *x == *y,
345            (Self::Int64(x), Self::Int64(y)) => *x == *y,
346            (Self::Uint64(x), Self::Uint64(y)) => *x == *y,
347            _ => false,
348        }
349    }
350}
351
352impl Data {
353    #[inline]
354    pub fn ordinal(&self) -> u64 {
355        match *self {
356            Self::Bytes(_) => 1,
357            Self::String(_) => 2,
358            Self::Int64(_) => 3,
359            Self::Uint64(_) => 4,
360            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
361        }
362    }
363
364    #[inline]
365    pub fn unknown_variant_for_testing() -> Self {
366        Self::__SourceBreaking { unknown_ordinal: 0 }
367    }
368
369    #[inline]
370    pub fn is_unknown(&self) -> bool {
371        match self {
372            Self::__SourceBreaking { .. } => true,
373            _ => false,
374        }
375    }
376}
377
378impl fidl::Persistable for Data {}
379
380pub mod capabilities_ordinals {
381    pub const CONNECTOR_CREATE: u64 = 0xac2bc2dbd7033d1;
382    pub const DIR_CONNECTOR_CREATE: u64 = 0x721911e05da2a3bf;
383    pub const DICTIONARY_CREATE: u64 = 0x7f8bd91f0942a36e;
384    pub const DATA_CREATE: u64 = 0x40ef43e45372ee6a;
385    pub const CONNECTOR_ROUTER_CREATE: u64 = 0x7f7e7fbafcdf1761;
386    pub const DIR_CONNECTOR_ROUTER_CREATE: u64 = 0x56520da453fad19f;
387    pub const DICTIONARY_ROUTER_CREATE: u64 = 0x37acef18cd423d42;
388    pub const DATA_ROUTER_CREATE: u64 = 0x24e471395b95088;
389    pub const CONNECTOR_OPEN: u64 = 0xc0646965f1884eb;
390    pub const DIR_CONNECTOR_OPEN: u64 = 0x1332bbf5debd6c20;
391    pub const DICTIONARY_INSERT: u64 = 0x5972e3061a760e7a;
392    pub const DICTIONARY_GET: u64 = 0x31fafe2280a283d5;
393    pub const DICTIONARY_REMOVE: u64 = 0x6827c83106ac5a2c;
394    pub const DICTIONARY_ITERATE_KEYS: u64 = 0x3d4ea59c80df9bb8;
395    pub const DATA_GET: u64 = 0x65ae25b59f9e0daf;
396    pub const CONNECTOR_ROUTER_ROUTE: u64 = 0x1bd9c6e7e3dd487e;
397    pub const DIR_CONNECTOR_ROUTER_ROUTE: u64 = 0x3afdcc1b79e0799d;
398    pub const DICTIONARY_ROUTER_ROUTE: u64 = 0xcf72de10714a708;
399    pub const DATA_ROUTER_ROUTE: u64 = 0x61ab188455ed0643;
400}
401
402pub mod capability_factory_ordinals {
403    pub const CREATE_CONNECTOR: u64 = 0x58be7506ad9c0d1b;
404    pub const CREATE_DIR_CONNECTOR: u64 = 0x47e63805e1a638fa;
405    pub const CREATE_DICTIONARY: u64 = 0x1d9473d8c1e82b02;
406    pub const CREATE_CONNECTOR_ROUTER: u64 = 0x10a5577bdd065d17;
407    pub const CREATE_DIR_CONNECTOR_ROUTER: u64 = 0x6da0f55bc0cb6916;
408    pub const CREATE_DICTIONARY_ROUTER: u64 = 0x22f371a3e3cbdf05;
409    pub const CREATE_DATA_ROUTER: u64 = 0x42ca43500520bd20;
410}
411
412pub mod connector_ordinals {
413    pub const CLONE: u64 = 0x20d8a7aba2168a79;
414    pub const CONNECT: u64 = 0x1c0c1727bd474e02;
415}
416
417pub mod connector_router_ordinals {
418    pub const ROUTE: u64 = 0x57a912c92a38f9f8;
419}
420
421pub mod connector_router_deprecated_ordinals {
422    pub const CLONE: u64 = 0x20d8a7aba2168a79;
423    pub const ROUTE: u64 = 0x1b7810fe6a37ff32;
424}
425
426pub mod data_router_ordinals {
427    pub const ROUTE: u64 = 0x646885ba7e10ceeb;
428}
429
430pub mod data_router_deprecated_ordinals {
431    pub const CLONE: u64 = 0x20d8a7aba2168a79;
432    pub const ROUTE: u64 = 0x9a0b381e65e9ed3;
433}
434
435pub mod dictionary_ordinals {
436    pub const CLONE: u64 = 0x20d8a7aba2168a79;
437    pub const INSERT: u64 = 0x673364c89c4b0ed7;
438    pub const GET: u64 = 0x46d4b1dcd30feed9;
439    pub const REMOVE: u64 = 0x7931ac0ea29dffe7;
440    pub const ITERATE_KEYS: u64 = 0x331df1e1e73158a1;
441    pub const LEGACY_EXPORT: u64 = 0x722a26456a1ee1d0;
442}
443
444pub mod dictionary_key_iterator_ordinals {
445    pub const GET_NEXT: u64 = 0x3806bda34433db54;
446}
447
448pub mod dictionary_router_ordinals {
449    pub const ROUTE: u64 = 0x199389f437b3937b;
450}
451
452pub mod dictionary_router_deprecated_ordinals {
453    pub const CLONE: u64 = 0x20d8a7aba2168a79;
454    pub const ROUTE: u64 = 0x10b86c8a8e9eb51a;
455}
456
457pub mod dir_connector_ordinals {
458    pub const CLONE: u64 = 0x20d8a7aba2168a79;
459    pub const CONNECT: u64 = 0x23fbb3d289ca7e5b;
460}
461
462pub mod dir_connector_router_ordinals {
463    pub const ROUTE: u64 = 0x233f2ac038127462;
464}
465
466pub mod dir_connector_router_deprecated_ordinals {
467    pub const CLONE: u64 = 0x20d8a7aba2168a79;
468    pub const ROUTE: u64 = 0x199e1dee6ba3d71a;
469}
470
471pub mod dir_receiver_ordinals {
472    pub const RECEIVE: u64 = 0x4ac564d726bb325e;
473}
474
475pub mod dir_receiver_deprecated_ordinals {
476    pub const RECEIVE: u64 = 0x6351363b40e73f58;
477}
478
479pub mod receiver_ordinals {
480    pub const RECEIVE: u64 = 0x609ca5c7943b58d0;
481}
482
483mod internal {
484    use super::*;
485    unsafe impl fidl::encoding::TypeMarker for CapabilitiesError {
486        type Owned = Self;
487
488        #[inline(always)]
489        fn inline_align(_context: fidl::encoding::Context) -> usize {
490            std::mem::align_of::<u32>()
491        }
492
493        #[inline(always)]
494        fn inline_size(_context: fidl::encoding::Context) -> usize {
495            std::mem::size_of::<u32>()
496        }
497
498        #[inline(always)]
499        fn encode_is_copy() -> bool {
500            false
501        }
502
503        #[inline(always)]
504        fn decode_is_copy() -> bool {
505            false
506        }
507    }
508
509    impl fidl::encoding::ValueTypeMarker for CapabilitiesError {
510        type Borrowed<'a> = Self;
511        #[inline(always)]
512        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
513            *value
514        }
515    }
516
517    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
518        for CapabilitiesError
519    {
520        #[inline]
521        unsafe fn encode(
522            self,
523            encoder: &mut fidl::encoding::Encoder<'_, D>,
524            offset: usize,
525            _depth: fidl::encoding::Depth,
526        ) -> fidl::Result<()> {
527            encoder.debug_check_bounds::<Self>(offset);
528            encoder.write_num(self.into_primitive(), offset);
529            Ok(())
530        }
531    }
532
533    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CapabilitiesError {
534        #[inline(always)]
535        fn new_empty() -> Self {
536            Self::unknown()
537        }
538
539        #[inline]
540        unsafe fn decode(
541            &mut self,
542            decoder: &mut fidl::encoding::Decoder<'_, D>,
543            offset: usize,
544            _depth: fidl::encoding::Depth,
545        ) -> fidl::Result<()> {
546            decoder.debug_check_bounds::<Self>(offset);
547            let prim = decoder.read_num::<u32>(offset);
548
549            *self = Self::from_primitive_allow_unknown(prim);
550            Ok(())
551        }
552    }
553    unsafe impl fidl::encoding::TypeMarker for CapabilityType {
554        type Owned = Self;
555
556        #[inline(always)]
557        fn inline_align(_context: fidl::encoding::Context) -> usize {
558            std::mem::align_of::<u32>()
559        }
560
561        #[inline(always)]
562        fn inline_size(_context: fidl::encoding::Context) -> usize {
563            std::mem::size_of::<u32>()
564        }
565
566        #[inline(always)]
567        fn encode_is_copy() -> bool {
568            false
569        }
570
571        #[inline(always)]
572        fn decode_is_copy() -> bool {
573            false
574        }
575    }
576
577    impl fidl::encoding::ValueTypeMarker for CapabilityType {
578        type Borrowed<'a> = Self;
579        #[inline(always)]
580        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
581            *value
582        }
583    }
584
585    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for CapabilityType {
586        #[inline]
587        unsafe fn encode(
588            self,
589            encoder: &mut fidl::encoding::Encoder<'_, D>,
590            offset: usize,
591            _depth: fidl::encoding::Depth,
592        ) -> fidl::Result<()> {
593            encoder.debug_check_bounds::<Self>(offset);
594            encoder.write_num(self.into_primitive(), offset);
595            Ok(())
596        }
597    }
598
599    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CapabilityType {
600        #[inline(always)]
601        fn new_empty() -> Self {
602            Self::unknown()
603        }
604
605        #[inline]
606        unsafe fn decode(
607            &mut self,
608            decoder: &mut fidl::encoding::Decoder<'_, D>,
609            offset: usize,
610            _depth: fidl::encoding::Depth,
611        ) -> fidl::Result<()> {
612            decoder.debug_check_bounds::<Self>(offset);
613            let prim = decoder.read_num::<u32>(offset);
614
615            *self = Self::from_primitive_allow_unknown(prim);
616            Ok(())
617        }
618    }
619    unsafe impl fidl::encoding::TypeMarker for RouterError {
620        type Owned = Self;
621
622        #[inline(always)]
623        fn inline_align(_context: fidl::encoding::Context) -> usize {
624            std::mem::align_of::<u32>()
625        }
626
627        #[inline(always)]
628        fn inline_size(_context: fidl::encoding::Context) -> usize {
629            std::mem::size_of::<u32>()
630        }
631
632        #[inline(always)]
633        fn encode_is_copy() -> bool {
634            false
635        }
636
637        #[inline(always)]
638        fn decode_is_copy() -> bool {
639            false
640        }
641    }
642
643    impl fidl::encoding::ValueTypeMarker for RouterError {
644        type Borrowed<'a> = Self;
645        #[inline(always)]
646        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
647            *value
648        }
649    }
650
651    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for RouterError {
652        #[inline]
653        unsafe fn encode(
654            self,
655            encoder: &mut fidl::encoding::Encoder<'_, D>,
656            offset: usize,
657            _depth: fidl::encoding::Depth,
658        ) -> fidl::Result<()> {
659            encoder.debug_check_bounds::<Self>(offset);
660            encoder.write_num(self.into_primitive(), offset);
661            Ok(())
662        }
663    }
664
665    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RouterError {
666        #[inline(always)]
667        fn new_empty() -> Self {
668            Self::unknown()
669        }
670
671        #[inline]
672        unsafe fn decode(
673            &mut self,
674            decoder: &mut fidl::encoding::Decoder<'_, D>,
675            offset: usize,
676            _depth: fidl::encoding::Depth,
677        ) -> fidl::Result<()> {
678            decoder.debug_check_bounds::<Self>(offset);
679            let prim = decoder.read_num::<u32>(offset);
680
681            *self = Self::from_primitive_allow_unknown(prim);
682            Ok(())
683        }
684    }
685    unsafe impl fidl::encoding::TypeMarker for RouterResponse {
686        type Owned = Self;
687
688        #[inline(always)]
689        fn inline_align(_context: fidl::encoding::Context) -> usize {
690            std::mem::align_of::<u32>()
691        }
692
693        #[inline(always)]
694        fn inline_size(_context: fidl::encoding::Context) -> usize {
695            std::mem::size_of::<u32>()
696        }
697
698        #[inline(always)]
699        fn encode_is_copy() -> bool {
700            false
701        }
702
703        #[inline(always)]
704        fn decode_is_copy() -> bool {
705            false
706        }
707    }
708
709    impl fidl::encoding::ValueTypeMarker for RouterResponse {
710        type Borrowed<'a> = Self;
711        #[inline(always)]
712        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
713            *value
714        }
715    }
716
717    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for RouterResponse {
718        #[inline]
719        unsafe fn encode(
720            self,
721            encoder: &mut fidl::encoding::Encoder<'_, D>,
722            offset: usize,
723            _depth: fidl::encoding::Depth,
724        ) -> fidl::Result<()> {
725            encoder.debug_check_bounds::<Self>(offset);
726            encoder.write_num(self.into_primitive(), offset);
727            Ok(())
728        }
729    }
730
731    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RouterResponse {
732        #[inline(always)]
733        fn new_empty() -> Self {
734            Self::unknown()
735        }
736
737        #[inline]
738        unsafe fn decode(
739            &mut self,
740            decoder: &mut fidl::encoding::Decoder<'_, D>,
741            offset: usize,
742            _depth: fidl::encoding::Depth,
743        ) -> fidl::Result<()> {
744            decoder.debug_check_bounds::<Self>(offset);
745            let prim = decoder.read_num::<u32>(offset);
746
747            *self = Self::from_primitive_allow_unknown(prim);
748            Ok(())
749        }
750    }
751
752    impl fidl::encoding::ValueTypeMarker for DictionaryKeyIteratorGetNextResponse {
753        type Borrowed<'a> = &'a Self;
754        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
755            value
756        }
757    }
758
759    unsafe impl fidl::encoding::TypeMarker for DictionaryKeyIteratorGetNextResponse {
760        type Owned = Self;
761
762        #[inline(always)]
763        fn inline_align(_context: fidl::encoding::Context) -> usize {
764            8
765        }
766
767        #[inline(always)]
768        fn inline_size(_context: fidl::encoding::Context) -> usize {
769            16
770        }
771    }
772
773    unsafe impl<D: fidl::encoding::ResourceDialect>
774        fidl::encoding::Encode<DictionaryKeyIteratorGetNextResponse, D>
775        for &DictionaryKeyIteratorGetNextResponse
776    {
777        #[inline]
778        unsafe fn encode(
779            self,
780            encoder: &mut fidl::encoding::Encoder<'_, D>,
781            offset: usize,
782            _depth: fidl::encoding::Depth,
783        ) -> fidl::Result<()> {
784            encoder.debug_check_bounds::<DictionaryKeyIteratorGetNextResponse>(offset);
785            // Delegate to tuple encoding.
786            fidl::encoding::Encode::<DictionaryKeyIteratorGetNextResponse, D>::encode(
787                (
788                    <fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<100>> as fidl::encoding::ValueTypeMarker>::borrow(&self.keys),
789                ),
790                encoder, offset, _depth
791            )
792        }
793    }
794    unsafe impl<
795        D: fidl::encoding::ResourceDialect,
796        T0: fidl::encoding::Encode<
797                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<100>>,
798                D,
799            >,
800    > fidl::encoding::Encode<DictionaryKeyIteratorGetNextResponse, D> for (T0,)
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::<DictionaryKeyIteratorGetNextResponse>(offset);
810            // Zero out padding regions. There's no need to apply masks
811            // because the unmasked parts will be overwritten by fields.
812            // Write the fields.
813            self.0.encode(encoder, offset + 0, depth)?;
814            Ok(())
815        }
816    }
817
818    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
819        for DictionaryKeyIteratorGetNextResponse
820    {
821        #[inline(always)]
822        fn new_empty() -> Self {
823            Self {
824                keys: fidl::new_empty!(
825                    fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<100>>,
826                    D
827                ),
828            }
829        }
830
831        #[inline]
832        unsafe fn decode(
833            &mut self,
834            decoder: &mut fidl::encoding::Decoder<'_, D>,
835            offset: usize,
836            _depth: fidl::encoding::Depth,
837        ) -> fidl::Result<()> {
838            decoder.debug_check_bounds::<Self>(offset);
839            // Verify that padding bytes are zero.
840            fidl::decode!(
841                fidl::encoding::UnboundedVector<fidl::encoding::BoundedString<100>>,
842                D,
843                &mut self.keys,
844                decoder,
845                offset + 0,
846                _depth
847            )?;
848            Ok(())
849        }
850    }
851
852    impl fidl::encoding::ValueTypeMarker for Data {
853        type Borrowed<'a> = &'a Self;
854        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
855            value
856        }
857    }
858
859    unsafe impl fidl::encoding::TypeMarker for Data {
860        type Owned = Self;
861
862        #[inline(always)]
863        fn inline_align(_context: fidl::encoding::Context) -> usize {
864            8
865        }
866
867        #[inline(always)]
868        fn inline_size(_context: fidl::encoding::Context) -> usize {
869            16
870        }
871    }
872
873    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Data, D> for &Data {
874        #[inline]
875        unsafe fn encode(
876            self,
877            encoder: &mut fidl::encoding::Encoder<'_, D>,
878            offset: usize,
879            _depth: fidl::encoding::Depth,
880        ) -> fidl::Result<()> {
881            encoder.debug_check_bounds::<Data>(offset);
882            encoder.write_num::<u64>(self.ordinal(), offset);
883            match self {
884            Data::Bytes(ref val) => {
885                fidl::encoding::encode_in_envelope::<fidl::encoding::Vector<u8, 8192>, D>(
886                    <fidl::encoding::Vector<u8, 8192> as fidl::encoding::ValueTypeMarker>::borrow(val),
887                    encoder, offset + 8, _depth
888                )
889            }
890            Data::String(ref val) => {
891                fidl::encoding::encode_in_envelope::<fidl::encoding::BoundedString<8192>, D>(
892                    <fidl::encoding::BoundedString<8192> as fidl::encoding::ValueTypeMarker>::borrow(val),
893                    encoder, offset + 8, _depth
894                )
895            }
896            Data::Int64(ref val) => {
897                fidl::encoding::encode_in_envelope::<i64, D>(
898                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(val),
899                    encoder, offset + 8, _depth
900                )
901            }
902            Data::Uint64(ref val) => {
903                fidl::encoding::encode_in_envelope::<u64, D>(
904                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
905                    encoder, offset + 8, _depth
906                )
907            }
908            Data::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
909        }
910        }
911    }
912
913    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Data {
914        #[inline(always)]
915        fn new_empty() -> Self {
916            Self::__SourceBreaking { unknown_ordinal: 0 }
917        }
918
919        #[inline]
920        unsafe fn decode(
921            &mut self,
922            decoder: &mut fidl::encoding::Decoder<'_, D>,
923            offset: usize,
924            mut depth: fidl::encoding::Depth,
925        ) -> fidl::Result<()> {
926            decoder.debug_check_bounds::<Self>(offset);
927            #[allow(unused_variables)]
928            let next_out_of_line = decoder.next_out_of_line();
929            let handles_before = decoder.remaining_handles();
930            let (ordinal, inlined, num_bytes, num_handles) =
931                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
932
933            let member_inline_size = match ordinal {
934                1 => <fidl::encoding::Vector<u8, 8192> as fidl::encoding::TypeMarker>::inline_size(
935                    decoder.context,
936                ),
937                2 => {
938                    <fidl::encoding::BoundedString<8192> as fidl::encoding::TypeMarker>::inline_size(
939                        decoder.context,
940                    )
941                }
942                3 => <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
943                4 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
944                0 => return Err(fidl::Error::UnknownUnionTag),
945                _ => num_bytes as usize,
946            };
947
948            if inlined != (member_inline_size <= 4) {
949                return Err(fidl::Error::InvalidInlineBitInEnvelope);
950            }
951            let _inner_offset;
952            if inlined {
953                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
954                _inner_offset = offset + 8;
955            } else {
956                depth.increment()?;
957                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
958            }
959            match ordinal {
960                1 => {
961                    #[allow(irrefutable_let_patterns)]
962                    if let Data::Bytes(_) = self {
963                        // Do nothing, read the value into the object
964                    } else {
965                        // Initialize `self` to the right variant
966                        *self = Data::Bytes(fidl::new_empty!(fidl::encoding::Vector<u8, 8192>, D));
967                    }
968                    #[allow(irrefutable_let_patterns)]
969                    if let Data::Bytes(ref mut val) = self {
970                        fidl::decode!(fidl::encoding::Vector<u8, 8192>, D, val, decoder, _inner_offset, depth)?;
971                    } else {
972                        unreachable!()
973                    }
974                }
975                2 => {
976                    #[allow(irrefutable_let_patterns)]
977                    if let Data::String(_) = self {
978                        // Do nothing, read the value into the object
979                    } else {
980                        // Initialize `self` to the right variant
981                        *self =
982                            Data::String(fidl::new_empty!(fidl::encoding::BoundedString<8192>, D));
983                    }
984                    #[allow(irrefutable_let_patterns)]
985                    if let Data::String(ref mut val) = self {
986                        fidl::decode!(
987                            fidl::encoding::BoundedString<8192>,
988                            D,
989                            val,
990                            decoder,
991                            _inner_offset,
992                            depth
993                        )?;
994                    } else {
995                        unreachable!()
996                    }
997                }
998                3 => {
999                    #[allow(irrefutable_let_patterns)]
1000                    if let Data::Int64(_) = self {
1001                        // Do nothing, read the value into the object
1002                    } else {
1003                        // Initialize `self` to the right variant
1004                        *self = Data::Int64(fidl::new_empty!(i64, D));
1005                    }
1006                    #[allow(irrefutable_let_patterns)]
1007                    if let Data::Int64(ref mut val) = self {
1008                        fidl::decode!(i64, D, val, decoder, _inner_offset, depth)?;
1009                    } else {
1010                        unreachable!()
1011                    }
1012                }
1013                4 => {
1014                    #[allow(irrefutable_let_patterns)]
1015                    if let Data::Uint64(_) = self {
1016                        // Do nothing, read the value into the object
1017                    } else {
1018                        // Initialize `self` to the right variant
1019                        *self = Data::Uint64(fidl::new_empty!(u64, D));
1020                    }
1021                    #[allow(irrefutable_let_patterns)]
1022                    if let Data::Uint64(ref mut val) = self {
1023                        fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
1024                    } else {
1025                        unreachable!()
1026                    }
1027                }
1028                #[allow(deprecated)]
1029                ordinal => {
1030                    for _ in 0..num_handles {
1031                        decoder.drop_next_handle()?;
1032                    }
1033                    *self = Data::__SourceBreaking { unknown_ordinal: ordinal };
1034                }
1035            }
1036            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1037                return Err(fidl::Error::InvalidNumBytesInEnvelope);
1038            }
1039            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1040                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1041            }
1042            Ok(())
1043        }
1044    }
1045}