fidl_fuchsia_component_sandbox__common/
fidl_fuchsia_component_sandbox__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
11/// A client-assigned id of a [Capability] in a [CapabilityStore].
12///
13/// The id is relative to the [CapabilityStore]. In the case where two
14/// [CapabilityStore]s have a capability / assigned to the same id, there is
15/// no relation between them
16pub type CapabilityId = u64;
17
18/// The key of a [`DictionaryItem`]. The constraints for valid keys are documented at
19/// https://fuchsia.dev/reference/cml#names.
20pub type DictionaryKey = String;
21
22/// A client-assigned id of a new [Capability] in a [CapabilityStore]. Same as [CapabilityId],
23/// but used to distinguish output parameters in [CapabilityStore] methods.
24pub type NewCapabilityId = u64;
25
26pub type WrappedNewCapabilityId = WrappedCapabilityId;
27
28/// Maximum number of bytes in a [Data].
29pub const MAX_DATA_LENGTH: u32 = 8192;
30
31/// Maximum number of items returned by dictionary iterator.
32pub const MAX_DICTIONARY_ITERATOR_CHUNK: u32 = 128;
33
34/// The maximum length of a dictionary key. This should coincide with
35/// fuchsia.component.MAX_NAME_LENGTH.
36pub const MAX_NAME_LENGTH: u64 = fidl_fuchsia_io__common::MAX_NAME_LENGTH as u64;
37
38/// Describes the expected availability of the capability.
39///
40/// Some capabilities may not be present on all system configurations. In those
41/// cases, the availability will be declared as `OPTIONAL` along the chains of
42/// exposes/offers/uses, and the capability would be routed from `void` on
43/// system configurations where it does not make sense to route or provide a
44/// particular capability (e.g. graphical capabilities on a headless system).
45#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
46#[repr(u32)]
47pub enum Availability {
48    /// The capability must be available. Failure to route the capability is an
49    /// error.
50    Required = 1,
51    /// Inside a use declaration: the component can function if it fails to
52    /// obtain the capability.
53    ///
54    /// Inside an offer/expose declaration: the capability may not be available
55    /// in some system configurations. As a corollary, the target component must
56    /// not have a required dependency on the capability.
57    Optional = 2,
58    /// If the target of the corresponding offer or expose declaration requires
59    /// the capability, then the behavior is equivalent to required. If the
60    /// target has an optional dependency on the capability, then the behavior
61    /// is equivalent to optional. This is useful for container components that
62    /// would like to change their routing availability based on ones inside.
63    ///
64    /// This value is not allowed inside a use declaration.
65    SameAsTarget = 3,
66    /// The source may omit the route completely without even having to route
67    /// from `void`.
68    ///
69    /// [`TRANSITIONAL`] is used for soft transitions that introduce new
70    /// capabilities.
71    Transitional = 4,
72}
73
74impl Availability {
75    #[inline]
76    pub fn from_primitive(prim: u32) -> Option<Self> {
77        match prim {
78            1 => Some(Self::Required),
79            2 => Some(Self::Optional),
80            3 => Some(Self::SameAsTarget),
81            4 => Some(Self::Transitional),
82            _ => None,
83        }
84    }
85
86    #[inline]
87    pub const fn into_primitive(self) -> u32 {
88        self as u32
89    }
90}
91
92/// Error returned from methods in [CapabilityStore].
93#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
94pub enum CapabilityStoreError {
95    /// A capability was not found matching the given key or [CapabilityId].
96    IdNotFound,
97    /// A capability already exists matching the given key or [CapabilityId].
98    IdAlreadyExists,
99    /// A [Capability] was not valid. For example, a `Capability.Dictionary`
100    /// contained an invalid [DictionaryRef].
101    BadCapability,
102    /// A [CapabilityId] had the wrong type for the requested operation.
103    WrongType,
104    /// A capability that needed to be duplicated to perform this operation could
105    /// not be.
106    NotDuplicatable,
107    /// An item in a dictionary was not found matching the given key.
108    ItemNotFound,
109    /// An item in a dictionary already exists with the given key.
110    ItemAlreadyExists,
111    /// The key is invalid. The constraints for valid keys are documented at
112    /// https://fuchsia.dev/reference/cml#names.
113    InvalidKey,
114    /// One or more arguments were invalid.
115    InvalidArgs,
116    #[doc(hidden)]
117    __SourceBreaking { unknown_ordinal: u32 },
118}
119
120/// Pattern that matches an unknown `CapabilityStoreError` member.
121#[macro_export]
122macro_rules! CapabilityStoreErrorUnknown {
123    () => {
124        _
125    };
126}
127
128impl CapabilityStoreError {
129    #[inline]
130    pub fn from_primitive(prim: u32) -> Option<Self> {
131        match prim {
132            1 => Some(Self::IdNotFound),
133            2 => Some(Self::IdAlreadyExists),
134            3 => Some(Self::BadCapability),
135            4 => Some(Self::WrongType),
136            5 => Some(Self::NotDuplicatable),
137            6 => Some(Self::ItemNotFound),
138            7 => Some(Self::ItemAlreadyExists),
139            8 => Some(Self::InvalidKey),
140            9 => Some(Self::InvalidArgs),
141            _ => None,
142        }
143    }
144
145    #[inline]
146    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
147        match prim {
148            1 => Self::IdNotFound,
149            2 => Self::IdAlreadyExists,
150            3 => Self::BadCapability,
151            4 => Self::WrongType,
152            5 => Self::NotDuplicatable,
153            6 => Self::ItemNotFound,
154            7 => Self::ItemAlreadyExists,
155            8 => Self::InvalidKey,
156            9 => Self::InvalidArgs,
157            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
158        }
159    }
160
161    #[inline]
162    pub fn unknown() -> Self {
163        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
164    }
165
166    #[inline]
167    pub const fn into_primitive(self) -> u32 {
168        match self {
169            Self::IdNotFound => 1,
170            Self::IdAlreadyExists => 2,
171            Self::BadCapability => 3,
172            Self::WrongType => 4,
173            Self::NotDuplicatable => 5,
174            Self::ItemNotFound => 6,
175            Self::ItemAlreadyExists => 7,
176            Self::InvalidKey => 8,
177            Self::InvalidArgs => 9,
178            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
179        }
180    }
181
182    #[inline]
183    pub fn is_unknown(&self) -> bool {
184        match self {
185            Self::__SourceBreaking { unknown_ordinal: _ } => true,
186            _ => false,
187        }
188    }
189}
190
191/// Error returned from [CapabilityStore/Dictionary*] methods.
192#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
193pub enum DictionaryError {
194    /// The Dictionary does not contain an item with the given key.
195    NotFound,
196    /// The Dictionary already contains an item with the given key.
197    AlreadyExists,
198    /// The Capability is invalid.
199    ///
200    /// Capabilities must be created by sandbox, via
201    /// `fuchsia.component.sandbox/CapabilityStore` or returned from other
202    /// Component Framework APIs.
203    BadCapability,
204    /// The key is invalid. The constraints for valid keys are documented at
205    /// https://fuchsia.dev/reference/cml#names.
206    InvalidKey,
207    /// A capability that needed to be cloned to perform this operation could
208    /// not be cloned.
209    NotCloneable,
210    #[doc(hidden)]
211    __SourceBreaking { unknown_ordinal: u32 },
212}
213
214/// Pattern that matches an unknown `DictionaryError` member.
215#[macro_export]
216macro_rules! DictionaryErrorUnknown {
217    () => {
218        _
219    };
220}
221
222impl DictionaryError {
223    #[inline]
224    pub fn from_primitive(prim: u32) -> Option<Self> {
225        match prim {
226            1 => Some(Self::NotFound),
227            2 => Some(Self::AlreadyExists),
228            3 => Some(Self::BadCapability),
229            4 => Some(Self::InvalidKey),
230            5 => Some(Self::NotCloneable),
231            _ => None,
232        }
233    }
234
235    #[inline]
236    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
237        match prim {
238            1 => Self::NotFound,
239            2 => Self::AlreadyExists,
240            3 => Self::BadCapability,
241            4 => Self::InvalidKey,
242            5 => Self::NotCloneable,
243            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
244        }
245    }
246
247    #[inline]
248    pub fn unknown() -> Self {
249        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
250    }
251
252    #[inline]
253    pub const fn into_primitive(self) -> u32 {
254        match self {
255            Self::NotFound => 1,
256            Self::AlreadyExists => 2,
257            Self::BadCapability => 3,
258            Self::InvalidKey => 4,
259            Self::NotCloneable => 5,
260            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
261        }
262    }
263
264    #[inline]
265    pub fn is_unknown(&self) -> bool {
266        match self {
267            Self::__SourceBreaking { unknown_ordinal: _ } => true,
268            _ => false,
269        }
270    }
271}
272
273#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
274pub enum RouterError {
275    /// The router failed to find the capability.
276    NotFound,
277    /// The arguments provided to the function are invalid.
278    InvalidArgs,
279    /// The operation is not supported.
280    NotSupported,
281    /// An internal error occurred.
282    Internal,
283    #[doc(hidden)]
284    __SourceBreaking { unknown_ordinal: u32 },
285}
286
287/// Pattern that matches an unknown `RouterError` member.
288#[macro_export]
289macro_rules! RouterErrorUnknown {
290    () => {
291        _
292    };
293}
294
295impl RouterError {
296    #[inline]
297    pub fn from_primitive(prim: u32) -> Option<Self> {
298        match prim {
299            1 => Some(Self::NotFound),
300            2 => Some(Self::InvalidArgs),
301            3 => Some(Self::NotSupported),
302            4 => Some(Self::Internal),
303            _ => None,
304        }
305    }
306
307    #[inline]
308    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
309        match prim {
310            1 => Self::NotFound,
311            2 => Self::InvalidArgs,
312            3 => Self::NotSupported,
313            4 => Self::Internal,
314            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
315        }
316    }
317
318    #[inline]
319    pub fn unknown() -> Self {
320        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
321    }
322
323    #[inline]
324    pub const fn into_primitive(self) -> u32 {
325        match self {
326            Self::NotFound => 1,
327            Self::InvalidArgs => 2,
328            Self::NotSupported => 3,
329            Self::Internal => 4,
330            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
331        }
332    }
333
334    #[inline]
335    pub fn is_unknown(&self) -> bool {
336        match self {
337            Self::__SourceBreaking { unknown_ordinal: _ } => true,
338            _ => false,
339        }
340    }
341}
342
343#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
344#[repr(C)]
345pub struct CapabilityStoreDictionaryCopyRequest {
346    pub id: u64,
347    pub dest_id: u64,
348}
349
350impl fidl::Persistable for CapabilityStoreDictionaryCopyRequest {}
351
352#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
353#[repr(C)]
354pub struct CapabilityStoreDictionaryCreateRequest {
355    pub id: u64,
356}
357
358impl fidl::Persistable for CapabilityStoreDictionaryCreateRequest {}
359
360#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
361pub struct CapabilityStoreDictionaryGetRequest {
362    pub id: u64,
363    pub key: String,
364    pub dest_id: u64,
365}
366
367impl fidl::Persistable for CapabilityStoreDictionaryGetRequest {}
368
369#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
370pub struct CapabilityStoreDictionaryInsertRequest {
371    pub id: u64,
372    pub item: DictionaryItem,
373}
374
375impl fidl::Persistable for CapabilityStoreDictionaryInsertRequest {}
376
377#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
378pub struct CapabilityStoreDictionaryRemoveRequest {
379    pub id: u64,
380    pub key: String,
381    pub dest_id: Option<Box<WrappedCapabilityId>>,
382}
383
384impl fidl::Persistable for CapabilityStoreDictionaryRemoveRequest {}
385
386#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
387#[repr(C)]
388pub struct CapabilityStoreDropRequest {
389    pub id: u64,
390}
391
392impl fidl::Persistable for CapabilityStoreDropRequest {}
393
394#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
395#[repr(C)]
396pub struct CapabilityStoreDuplicateRequest {
397    pub id: u64,
398    pub dest_id: u64,
399}
400
401impl fidl::Persistable for CapabilityStoreDuplicateRequest {}
402
403#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
404#[repr(C)]
405pub struct CapabilityStoreExportRequest {
406    pub id: u64,
407}
408
409impl fidl::Persistable for CapabilityStoreExportRequest {}
410
411#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
412#[repr(C)]
413pub struct DictionaryDrainIteratorGetNextRequest {
414    pub start_id: u64,
415    pub limit: u32,
416}
417
418impl fidl::Persistable for DictionaryDrainIteratorGetNextRequest {}
419
420#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
421#[repr(C)]
422pub struct DictionaryEnumerateIteratorGetNextRequest {
423    pub start_id: u64,
424    pub limit: u32,
425}
426
427impl fidl::Persistable for DictionaryEnumerateIteratorGetNextRequest {}
428
429/// A key-value pair in a [`DictionaryRef`].
430#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
431pub struct DictionaryItem {
432    pub key: String,
433    pub value: u64,
434}
435
436impl fidl::Persistable for DictionaryItem {}
437
438#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
439pub struct Unavailable;
440
441impl fidl::Persistable for Unavailable {}
442
443#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
444pub struct Unit;
445
446impl fidl::Persistable for Unit {}
447
448/// A [CapabilityId] wrapped in a struct. This is useful for putting a [CapabilityId] in a `box<>`,
449/// which FIDL does not allow for pure integral types.
450#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
451#[repr(C)]
452pub struct WrappedCapabilityId {
453    pub id: u64,
454}
455
456impl fidl::Persistable for WrappedCapabilityId {}
457
458#[derive(Clone, Debug)]
459pub enum Data {
460    Bytes(Vec<u8>),
461    String(String),
462    Int64(i64),
463    Uint64(u64),
464    #[doc(hidden)]
465    __SourceBreaking {
466        unknown_ordinal: u64,
467    },
468}
469
470/// Pattern that matches an unknown `Data` member.
471#[macro_export]
472macro_rules! DataUnknown {
473    () => {
474        _
475    };
476}
477
478// Custom PartialEq so that unknown variants are not equal to themselves.
479impl PartialEq for Data {
480    fn eq(&self, other: &Self) -> bool {
481        match (self, other) {
482            (Self::Bytes(x), Self::Bytes(y)) => *x == *y,
483            (Self::String(x), Self::String(y)) => *x == *y,
484            (Self::Int64(x), Self::Int64(y)) => *x == *y,
485            (Self::Uint64(x), Self::Uint64(y)) => *x == *y,
486            _ => false,
487        }
488    }
489}
490
491impl Data {
492    #[inline]
493    pub fn ordinal(&self) -> u64 {
494        match *self {
495            Self::Bytes(_) => 1,
496            Self::String(_) => 2,
497            Self::Int64(_) => 3,
498            Self::Uint64(_) => 4,
499            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
500        }
501    }
502
503    #[inline]
504    pub fn unknown_variant_for_testing() -> Self {
505        Self::__SourceBreaking { unknown_ordinal: 0 }
506    }
507
508    #[inline]
509    pub fn is_unknown(&self) -> bool {
510        match self {
511            Self::__SourceBreaking { .. } => true,
512            _ => false,
513        }
514    }
515}
516
517impl fidl::Persistable for Data {}
518
519pub mod capability_store_ordinals {
520    pub const DUPLICATE: u64 = 0x5d5d35d9c20a2184;
521    pub const DROP: u64 = 0xa745c0990fc2559;
522    pub const EXPORT: u64 = 0x3237a8f4748faff;
523    pub const IMPORT: u64 = 0x1f96157a29f4539b;
524    pub const CONNECTOR_CREATE: u64 = 0x29592c5d63e91c25;
525    pub const CONNECTOR_OPEN: u64 = 0x537e69ab40563b9f;
526    pub const DIR_CONNECTOR_CREATE: u64 = 0x186138a11ccf19bb;
527    pub const DIR_CONNECTOR_OPEN: u64 = 0x5650d3d6a3a13901;
528    pub const DICTIONARY_CREATE: u64 = 0x6997c8dfc63de093;
529    pub const DICTIONARY_LEGACY_IMPORT: u64 = 0x72fd686c37b6025f;
530    pub const DICTIONARY_LEGACY_EXPORT: u64 = 0x407e15cc4bde5dcd;
531    pub const DICTIONARY_INSERT: u64 = 0x7702183689d44c27;
532    pub const DICTIONARY_GET: u64 = 0x4d9e27538284add2;
533    pub const DICTIONARY_REMOVE: u64 = 0x4c5c025ab05d4f3;
534    pub const DICTIONARY_COPY: u64 = 0x3733ecdf4ea1b44f;
535    pub const DICTIONARY_KEYS: u64 = 0x84b05577ceaec9e;
536    pub const DICTIONARY_ENUMERATE: u64 = 0xd6279b6ced04641;
537    pub const DICTIONARY_DRAIN: u64 = 0x28a3a3f84d928cd8;
538    pub const CREATE_SERVICE_AGGREGATE: u64 = 0x4584116c8085885a;
539}
540
541pub mod connector_router_ordinals {
542    pub const ROUTE: u64 = 0x74dbb8bc13730766;
543}
544
545pub mod data_router_ordinals {
546    pub const ROUTE: u64 = 0x2e87dc44dfc53804;
547}
548
549pub mod dictionary_ordinals {}
550
551pub mod dictionary_drain_iterator_ordinals {
552    pub const GET_NEXT: u64 = 0x4f8082ca1ee26061;
553}
554
555pub mod dictionary_enumerate_iterator_ordinals {
556    pub const GET_NEXT: u64 = 0x14f8bc286512f5cf;
557}
558
559pub mod dictionary_keys_iterator_ordinals {
560    pub const GET_NEXT: u64 = 0x453828cbacca7d53;
561}
562
563pub mod dictionary_router_ordinals {
564    pub const ROUTE: u64 = 0x714c65bfe54bd79f;
565}
566
567pub mod dir_connector_router_ordinals {
568    pub const ROUTE: u64 = 0xd7e0f01da2c8e40;
569}
570
571pub mod dir_entry_router_ordinals {
572    pub const ROUTE: u64 = 0x1ac694001c208bd2;
573}
574
575pub mod dir_receiver_ordinals {
576    pub const RECEIVE: u64 = 0xcdc3e9b89fe7bb4;
577}
578
579pub mod directory_router_ordinals {
580    pub const ROUTE: u64 = 0x683b6c6be21b0f21;
581}
582
583pub mod receiver_ordinals {
584    pub const RECEIVE: u64 = 0x4bae18ab7aa1a94;
585}
586
587mod internal {
588    use super::*;
589    unsafe impl fidl::encoding::TypeMarker for Availability {
590        type Owned = Self;
591
592        #[inline(always)]
593        fn inline_align(_context: fidl::encoding::Context) -> usize {
594            std::mem::align_of::<u32>()
595        }
596
597        #[inline(always)]
598        fn inline_size(_context: fidl::encoding::Context) -> usize {
599            std::mem::size_of::<u32>()
600        }
601
602        #[inline(always)]
603        fn encode_is_copy() -> bool {
604            true
605        }
606
607        #[inline(always)]
608        fn decode_is_copy() -> bool {
609            false
610        }
611    }
612
613    impl fidl::encoding::ValueTypeMarker for Availability {
614        type Borrowed<'a> = Self;
615        #[inline(always)]
616        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
617            *value
618        }
619    }
620
621    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Availability {
622        #[inline]
623        unsafe fn encode(
624            self,
625            encoder: &mut fidl::encoding::Encoder<'_, D>,
626            offset: usize,
627            _depth: fidl::encoding::Depth,
628        ) -> fidl::Result<()> {
629            encoder.debug_check_bounds::<Self>(offset);
630            encoder.write_num(self.into_primitive(), offset);
631            Ok(())
632        }
633    }
634
635    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Availability {
636        #[inline(always)]
637        fn new_empty() -> Self {
638            Self::Required
639        }
640
641        #[inline]
642        unsafe fn decode(
643            &mut self,
644            decoder: &mut fidl::encoding::Decoder<'_, D>,
645            offset: usize,
646            _depth: fidl::encoding::Depth,
647        ) -> fidl::Result<()> {
648            decoder.debug_check_bounds::<Self>(offset);
649            let prim = decoder.read_num::<u32>(offset);
650
651            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
652            Ok(())
653        }
654    }
655    unsafe impl fidl::encoding::TypeMarker for CapabilityStoreError {
656        type Owned = Self;
657
658        #[inline(always)]
659        fn inline_align(_context: fidl::encoding::Context) -> usize {
660            std::mem::align_of::<u32>()
661        }
662
663        #[inline(always)]
664        fn inline_size(_context: fidl::encoding::Context) -> usize {
665            std::mem::size_of::<u32>()
666        }
667
668        #[inline(always)]
669        fn encode_is_copy() -> bool {
670            false
671        }
672
673        #[inline(always)]
674        fn decode_is_copy() -> bool {
675            false
676        }
677    }
678
679    impl fidl::encoding::ValueTypeMarker for CapabilityStoreError {
680        type Borrowed<'a> = Self;
681        #[inline(always)]
682        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
683            *value
684        }
685    }
686
687    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
688        for CapabilityStoreError
689    {
690        #[inline]
691        unsafe fn encode(
692            self,
693            encoder: &mut fidl::encoding::Encoder<'_, D>,
694            offset: usize,
695            _depth: fidl::encoding::Depth,
696        ) -> fidl::Result<()> {
697            encoder.debug_check_bounds::<Self>(offset);
698            encoder.write_num(self.into_primitive(), offset);
699            Ok(())
700        }
701    }
702
703    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CapabilityStoreError {
704        #[inline(always)]
705        fn new_empty() -> Self {
706            Self::unknown()
707        }
708
709        #[inline]
710        unsafe fn decode(
711            &mut self,
712            decoder: &mut fidl::encoding::Decoder<'_, D>,
713            offset: usize,
714            _depth: fidl::encoding::Depth,
715        ) -> fidl::Result<()> {
716            decoder.debug_check_bounds::<Self>(offset);
717            let prim = decoder.read_num::<u32>(offset);
718
719            *self = Self::from_primitive_allow_unknown(prim);
720            Ok(())
721        }
722    }
723    unsafe impl fidl::encoding::TypeMarker for DictionaryError {
724        type Owned = Self;
725
726        #[inline(always)]
727        fn inline_align(_context: fidl::encoding::Context) -> usize {
728            std::mem::align_of::<u32>()
729        }
730
731        #[inline(always)]
732        fn inline_size(_context: fidl::encoding::Context) -> usize {
733            std::mem::size_of::<u32>()
734        }
735
736        #[inline(always)]
737        fn encode_is_copy() -> bool {
738            false
739        }
740
741        #[inline(always)]
742        fn decode_is_copy() -> bool {
743            false
744        }
745    }
746
747    impl fidl::encoding::ValueTypeMarker for DictionaryError {
748        type Borrowed<'a> = Self;
749        #[inline(always)]
750        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
751            *value
752        }
753    }
754
755    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
756        for DictionaryError
757    {
758        #[inline]
759        unsafe fn encode(
760            self,
761            encoder: &mut fidl::encoding::Encoder<'_, D>,
762            offset: usize,
763            _depth: fidl::encoding::Depth,
764        ) -> fidl::Result<()> {
765            encoder.debug_check_bounds::<Self>(offset);
766            encoder.write_num(self.into_primitive(), offset);
767            Ok(())
768        }
769    }
770
771    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DictionaryError {
772        #[inline(always)]
773        fn new_empty() -> Self {
774            Self::unknown()
775        }
776
777        #[inline]
778        unsafe fn decode(
779            &mut self,
780            decoder: &mut fidl::encoding::Decoder<'_, D>,
781            offset: usize,
782            _depth: fidl::encoding::Depth,
783        ) -> fidl::Result<()> {
784            decoder.debug_check_bounds::<Self>(offset);
785            let prim = decoder.read_num::<u32>(offset);
786
787            *self = Self::from_primitive_allow_unknown(prim);
788            Ok(())
789        }
790    }
791    unsafe impl fidl::encoding::TypeMarker for RouterError {
792        type Owned = Self;
793
794        #[inline(always)]
795        fn inline_align(_context: fidl::encoding::Context) -> usize {
796            std::mem::align_of::<u32>()
797        }
798
799        #[inline(always)]
800        fn inline_size(_context: fidl::encoding::Context) -> usize {
801            std::mem::size_of::<u32>()
802        }
803
804        #[inline(always)]
805        fn encode_is_copy() -> bool {
806            false
807        }
808
809        #[inline(always)]
810        fn decode_is_copy() -> bool {
811            false
812        }
813    }
814
815    impl fidl::encoding::ValueTypeMarker for RouterError {
816        type Borrowed<'a> = Self;
817        #[inline(always)]
818        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
819            *value
820        }
821    }
822
823    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for RouterError {
824        #[inline]
825        unsafe fn encode(
826            self,
827            encoder: &mut fidl::encoding::Encoder<'_, D>,
828            offset: usize,
829            _depth: fidl::encoding::Depth,
830        ) -> fidl::Result<()> {
831            encoder.debug_check_bounds::<Self>(offset);
832            encoder.write_num(self.into_primitive(), offset);
833            Ok(())
834        }
835    }
836
837    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RouterError {
838        #[inline(always)]
839        fn new_empty() -> Self {
840            Self::unknown()
841        }
842
843        #[inline]
844        unsafe fn decode(
845            &mut self,
846            decoder: &mut fidl::encoding::Decoder<'_, D>,
847            offset: usize,
848            _depth: fidl::encoding::Depth,
849        ) -> fidl::Result<()> {
850            decoder.debug_check_bounds::<Self>(offset);
851            let prim = decoder.read_num::<u32>(offset);
852
853            *self = Self::from_primitive_allow_unknown(prim);
854            Ok(())
855        }
856    }
857
858    impl fidl::encoding::ValueTypeMarker for CapabilityStoreDictionaryCopyRequest {
859        type Borrowed<'a> = &'a Self;
860        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
861            value
862        }
863    }
864
865    unsafe impl fidl::encoding::TypeMarker for CapabilityStoreDictionaryCopyRequest {
866        type Owned = Self;
867
868        #[inline(always)]
869        fn inline_align(_context: fidl::encoding::Context) -> usize {
870            8
871        }
872
873        #[inline(always)]
874        fn inline_size(_context: fidl::encoding::Context) -> usize {
875            16
876        }
877        #[inline(always)]
878        fn encode_is_copy() -> bool {
879            true
880        }
881
882        #[inline(always)]
883        fn decode_is_copy() -> bool {
884            true
885        }
886    }
887
888    unsafe impl<D: fidl::encoding::ResourceDialect>
889        fidl::encoding::Encode<CapabilityStoreDictionaryCopyRequest, D>
890        for &CapabilityStoreDictionaryCopyRequest
891    {
892        #[inline]
893        unsafe fn encode(
894            self,
895            encoder: &mut fidl::encoding::Encoder<'_, D>,
896            offset: usize,
897            _depth: fidl::encoding::Depth,
898        ) -> fidl::Result<()> {
899            encoder.debug_check_bounds::<CapabilityStoreDictionaryCopyRequest>(offset);
900            unsafe {
901                // Copy the object into the buffer.
902                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
903                (buf_ptr as *mut CapabilityStoreDictionaryCopyRequest)
904                    .write_unaligned((self as *const CapabilityStoreDictionaryCopyRequest).read());
905                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
906                // done second because the memcpy will write garbage to these bytes.
907            }
908            Ok(())
909        }
910    }
911    unsafe impl<
912        D: fidl::encoding::ResourceDialect,
913        T0: fidl::encoding::Encode<u64, D>,
914        T1: fidl::encoding::Encode<u64, D>,
915    > fidl::encoding::Encode<CapabilityStoreDictionaryCopyRequest, D> for (T0, T1)
916    {
917        #[inline]
918        unsafe fn encode(
919            self,
920            encoder: &mut fidl::encoding::Encoder<'_, D>,
921            offset: usize,
922            depth: fidl::encoding::Depth,
923        ) -> fidl::Result<()> {
924            encoder.debug_check_bounds::<CapabilityStoreDictionaryCopyRequest>(offset);
925            // Zero out padding regions. There's no need to apply masks
926            // because the unmasked parts will be overwritten by fields.
927            // Write the fields.
928            self.0.encode(encoder, offset + 0, depth)?;
929            self.1.encode(encoder, offset + 8, depth)?;
930            Ok(())
931        }
932    }
933
934    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
935        for CapabilityStoreDictionaryCopyRequest
936    {
937        #[inline(always)]
938        fn new_empty() -> Self {
939            Self { id: fidl::new_empty!(u64, D), dest_id: fidl::new_empty!(u64, D) }
940        }
941
942        #[inline]
943        unsafe fn decode(
944            &mut self,
945            decoder: &mut fidl::encoding::Decoder<'_, D>,
946            offset: usize,
947            _depth: fidl::encoding::Depth,
948        ) -> fidl::Result<()> {
949            decoder.debug_check_bounds::<Self>(offset);
950            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
951            // Verify that padding bytes are zero.
952            // Copy from the buffer into the object.
953            unsafe {
954                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
955            }
956            Ok(())
957        }
958    }
959
960    impl fidl::encoding::ValueTypeMarker for CapabilityStoreDictionaryCreateRequest {
961        type Borrowed<'a> = &'a Self;
962        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
963            value
964        }
965    }
966
967    unsafe impl fidl::encoding::TypeMarker for CapabilityStoreDictionaryCreateRequest {
968        type Owned = Self;
969
970        #[inline(always)]
971        fn inline_align(_context: fidl::encoding::Context) -> usize {
972            8
973        }
974
975        #[inline(always)]
976        fn inline_size(_context: fidl::encoding::Context) -> usize {
977            8
978        }
979        #[inline(always)]
980        fn encode_is_copy() -> bool {
981            true
982        }
983
984        #[inline(always)]
985        fn decode_is_copy() -> bool {
986            true
987        }
988    }
989
990    unsafe impl<D: fidl::encoding::ResourceDialect>
991        fidl::encoding::Encode<CapabilityStoreDictionaryCreateRequest, D>
992        for &CapabilityStoreDictionaryCreateRequest
993    {
994        #[inline]
995        unsafe fn encode(
996            self,
997            encoder: &mut fidl::encoding::Encoder<'_, D>,
998            offset: usize,
999            _depth: fidl::encoding::Depth,
1000        ) -> fidl::Result<()> {
1001            encoder.debug_check_bounds::<CapabilityStoreDictionaryCreateRequest>(offset);
1002            unsafe {
1003                // Copy the object into the buffer.
1004                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1005                (buf_ptr as *mut CapabilityStoreDictionaryCreateRequest).write_unaligned(
1006                    (self as *const CapabilityStoreDictionaryCreateRequest).read(),
1007                );
1008                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1009                // done second because the memcpy will write garbage to these bytes.
1010            }
1011            Ok(())
1012        }
1013    }
1014    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
1015        fidl::encoding::Encode<CapabilityStoreDictionaryCreateRequest, D> for (T0,)
1016    {
1017        #[inline]
1018        unsafe fn encode(
1019            self,
1020            encoder: &mut fidl::encoding::Encoder<'_, D>,
1021            offset: usize,
1022            depth: fidl::encoding::Depth,
1023        ) -> fidl::Result<()> {
1024            encoder.debug_check_bounds::<CapabilityStoreDictionaryCreateRequest>(offset);
1025            // Zero out padding regions. There's no need to apply masks
1026            // because the unmasked parts will be overwritten by fields.
1027            // Write the fields.
1028            self.0.encode(encoder, offset + 0, depth)?;
1029            Ok(())
1030        }
1031    }
1032
1033    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1034        for CapabilityStoreDictionaryCreateRequest
1035    {
1036        #[inline(always)]
1037        fn new_empty() -> Self {
1038            Self { id: fidl::new_empty!(u64, D) }
1039        }
1040
1041        #[inline]
1042        unsafe fn decode(
1043            &mut self,
1044            decoder: &mut fidl::encoding::Decoder<'_, D>,
1045            offset: usize,
1046            _depth: fidl::encoding::Depth,
1047        ) -> fidl::Result<()> {
1048            decoder.debug_check_bounds::<Self>(offset);
1049            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1050            // Verify that padding bytes are zero.
1051            // Copy from the buffer into the object.
1052            unsafe {
1053                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1054            }
1055            Ok(())
1056        }
1057    }
1058
1059    impl fidl::encoding::ValueTypeMarker for CapabilityStoreDictionaryGetRequest {
1060        type Borrowed<'a> = &'a Self;
1061        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1062            value
1063        }
1064    }
1065
1066    unsafe impl fidl::encoding::TypeMarker for CapabilityStoreDictionaryGetRequest {
1067        type Owned = Self;
1068
1069        #[inline(always)]
1070        fn inline_align(_context: fidl::encoding::Context) -> usize {
1071            8
1072        }
1073
1074        #[inline(always)]
1075        fn inline_size(_context: fidl::encoding::Context) -> usize {
1076            32
1077        }
1078    }
1079
1080    unsafe impl<D: fidl::encoding::ResourceDialect>
1081        fidl::encoding::Encode<CapabilityStoreDictionaryGetRequest, D>
1082        for &CapabilityStoreDictionaryGetRequest
1083    {
1084        #[inline]
1085        unsafe fn encode(
1086            self,
1087            encoder: &mut fidl::encoding::Encoder<'_, D>,
1088            offset: usize,
1089            _depth: fidl::encoding::Depth,
1090        ) -> fidl::Result<()> {
1091            encoder.debug_check_bounds::<CapabilityStoreDictionaryGetRequest>(offset);
1092            // Delegate to tuple encoding.
1093            fidl::encoding::Encode::<CapabilityStoreDictionaryGetRequest, D>::encode(
1094                (
1095                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1096                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
1097                        &self.key,
1098                    ),
1099                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.dest_id),
1100                ),
1101                encoder,
1102                offset,
1103                _depth,
1104            )
1105        }
1106    }
1107    unsafe impl<
1108        D: fidl::encoding::ResourceDialect,
1109        T0: fidl::encoding::Encode<u64, D>,
1110        T1: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
1111        T2: fidl::encoding::Encode<u64, D>,
1112    > fidl::encoding::Encode<CapabilityStoreDictionaryGetRequest, D> for (T0, T1, T2)
1113    {
1114        #[inline]
1115        unsafe fn encode(
1116            self,
1117            encoder: &mut fidl::encoding::Encoder<'_, D>,
1118            offset: usize,
1119            depth: fidl::encoding::Depth,
1120        ) -> fidl::Result<()> {
1121            encoder.debug_check_bounds::<CapabilityStoreDictionaryGetRequest>(offset);
1122            // Zero out padding regions. There's no need to apply masks
1123            // because the unmasked parts will be overwritten by fields.
1124            // Write the fields.
1125            self.0.encode(encoder, offset + 0, depth)?;
1126            self.1.encode(encoder, offset + 8, depth)?;
1127            self.2.encode(encoder, offset + 24, depth)?;
1128            Ok(())
1129        }
1130    }
1131
1132    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1133        for CapabilityStoreDictionaryGetRequest
1134    {
1135        #[inline(always)]
1136        fn new_empty() -> Self {
1137            Self {
1138                id: fidl::new_empty!(u64, D),
1139                key: fidl::new_empty!(fidl::encoding::BoundedString<255>, D),
1140                dest_id: fidl::new_empty!(u64, D),
1141            }
1142        }
1143
1144        #[inline]
1145        unsafe fn decode(
1146            &mut self,
1147            decoder: &mut fidl::encoding::Decoder<'_, D>,
1148            offset: usize,
1149            _depth: fidl::encoding::Depth,
1150        ) -> fidl::Result<()> {
1151            decoder.debug_check_bounds::<Self>(offset);
1152            // Verify that padding bytes are zero.
1153            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
1154            fidl::decode!(
1155                fidl::encoding::BoundedString<255>,
1156                D,
1157                &mut self.key,
1158                decoder,
1159                offset + 8,
1160                _depth
1161            )?;
1162            fidl::decode!(u64, D, &mut self.dest_id, decoder, offset + 24, _depth)?;
1163            Ok(())
1164        }
1165    }
1166
1167    impl fidl::encoding::ValueTypeMarker for CapabilityStoreDictionaryInsertRequest {
1168        type Borrowed<'a> = &'a Self;
1169        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1170            value
1171        }
1172    }
1173
1174    unsafe impl fidl::encoding::TypeMarker for CapabilityStoreDictionaryInsertRequest {
1175        type Owned = Self;
1176
1177        #[inline(always)]
1178        fn inline_align(_context: fidl::encoding::Context) -> usize {
1179            8
1180        }
1181
1182        #[inline(always)]
1183        fn inline_size(_context: fidl::encoding::Context) -> usize {
1184            32
1185        }
1186    }
1187
1188    unsafe impl<D: fidl::encoding::ResourceDialect>
1189        fidl::encoding::Encode<CapabilityStoreDictionaryInsertRequest, D>
1190        for &CapabilityStoreDictionaryInsertRequest
1191    {
1192        #[inline]
1193        unsafe fn encode(
1194            self,
1195            encoder: &mut fidl::encoding::Encoder<'_, D>,
1196            offset: usize,
1197            _depth: fidl::encoding::Depth,
1198        ) -> fidl::Result<()> {
1199            encoder.debug_check_bounds::<CapabilityStoreDictionaryInsertRequest>(offset);
1200            // Delegate to tuple encoding.
1201            fidl::encoding::Encode::<CapabilityStoreDictionaryInsertRequest, D>::encode(
1202                (
1203                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1204                    <DictionaryItem as fidl::encoding::ValueTypeMarker>::borrow(&self.item),
1205                ),
1206                encoder,
1207                offset,
1208                _depth,
1209            )
1210        }
1211    }
1212    unsafe impl<
1213        D: fidl::encoding::ResourceDialect,
1214        T0: fidl::encoding::Encode<u64, D>,
1215        T1: fidl::encoding::Encode<DictionaryItem, D>,
1216    > fidl::encoding::Encode<CapabilityStoreDictionaryInsertRequest, D> for (T0, T1)
1217    {
1218        #[inline]
1219        unsafe fn encode(
1220            self,
1221            encoder: &mut fidl::encoding::Encoder<'_, D>,
1222            offset: usize,
1223            depth: fidl::encoding::Depth,
1224        ) -> fidl::Result<()> {
1225            encoder.debug_check_bounds::<CapabilityStoreDictionaryInsertRequest>(offset);
1226            // Zero out padding regions. There's no need to apply masks
1227            // because the unmasked parts will be overwritten by fields.
1228            // Write the fields.
1229            self.0.encode(encoder, offset + 0, depth)?;
1230            self.1.encode(encoder, offset + 8, depth)?;
1231            Ok(())
1232        }
1233    }
1234
1235    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1236        for CapabilityStoreDictionaryInsertRequest
1237    {
1238        #[inline(always)]
1239        fn new_empty() -> Self {
1240            Self { id: fidl::new_empty!(u64, D), item: fidl::new_empty!(DictionaryItem, D) }
1241        }
1242
1243        #[inline]
1244        unsafe fn decode(
1245            &mut self,
1246            decoder: &mut fidl::encoding::Decoder<'_, D>,
1247            offset: usize,
1248            _depth: fidl::encoding::Depth,
1249        ) -> fidl::Result<()> {
1250            decoder.debug_check_bounds::<Self>(offset);
1251            // Verify that padding bytes are zero.
1252            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
1253            fidl::decode!(DictionaryItem, D, &mut self.item, decoder, offset + 8, _depth)?;
1254            Ok(())
1255        }
1256    }
1257
1258    impl fidl::encoding::ValueTypeMarker for CapabilityStoreDictionaryRemoveRequest {
1259        type Borrowed<'a> = &'a Self;
1260        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1261            value
1262        }
1263    }
1264
1265    unsafe impl fidl::encoding::TypeMarker for CapabilityStoreDictionaryRemoveRequest {
1266        type Owned = Self;
1267
1268        #[inline(always)]
1269        fn inline_align(_context: fidl::encoding::Context) -> usize {
1270            8
1271        }
1272
1273        #[inline(always)]
1274        fn inline_size(_context: fidl::encoding::Context) -> usize {
1275            32
1276        }
1277    }
1278
1279    unsafe impl<D: fidl::encoding::ResourceDialect>
1280        fidl::encoding::Encode<CapabilityStoreDictionaryRemoveRequest, D>
1281        for &CapabilityStoreDictionaryRemoveRequest
1282    {
1283        #[inline]
1284        unsafe fn encode(
1285            self,
1286            encoder: &mut fidl::encoding::Encoder<'_, D>,
1287            offset: usize,
1288            _depth: fidl::encoding::Depth,
1289        ) -> fidl::Result<()> {
1290            encoder.debug_check_bounds::<CapabilityStoreDictionaryRemoveRequest>(offset);
1291            // Delegate to tuple encoding.
1292            fidl::encoding::Encode::<CapabilityStoreDictionaryRemoveRequest, D>::encode(
1293                (
1294                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1295                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(&self.key),
1296                    <fidl::encoding::Boxed<WrappedCapabilityId> as fidl::encoding::ValueTypeMarker>::borrow(&self.dest_id),
1297                ),
1298                encoder, offset, _depth
1299            )
1300        }
1301    }
1302    unsafe impl<
1303        D: fidl::encoding::ResourceDialect,
1304        T0: fidl::encoding::Encode<u64, D>,
1305        T1: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
1306        T2: fidl::encoding::Encode<fidl::encoding::Boxed<WrappedCapabilityId>, D>,
1307    > fidl::encoding::Encode<CapabilityStoreDictionaryRemoveRequest, D> for (T0, T1, T2)
1308    {
1309        #[inline]
1310        unsafe fn encode(
1311            self,
1312            encoder: &mut fidl::encoding::Encoder<'_, D>,
1313            offset: usize,
1314            depth: fidl::encoding::Depth,
1315        ) -> fidl::Result<()> {
1316            encoder.debug_check_bounds::<CapabilityStoreDictionaryRemoveRequest>(offset);
1317            // Zero out padding regions. There's no need to apply masks
1318            // because the unmasked parts will be overwritten by fields.
1319            // Write the fields.
1320            self.0.encode(encoder, offset + 0, depth)?;
1321            self.1.encode(encoder, offset + 8, depth)?;
1322            self.2.encode(encoder, offset + 24, depth)?;
1323            Ok(())
1324        }
1325    }
1326
1327    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1328        for CapabilityStoreDictionaryRemoveRequest
1329    {
1330        #[inline(always)]
1331        fn new_empty() -> Self {
1332            Self {
1333                id: fidl::new_empty!(u64, D),
1334                key: fidl::new_empty!(fidl::encoding::BoundedString<255>, D),
1335                dest_id: fidl::new_empty!(fidl::encoding::Boxed<WrappedCapabilityId>, D),
1336            }
1337        }
1338
1339        #[inline]
1340        unsafe fn decode(
1341            &mut self,
1342            decoder: &mut fidl::encoding::Decoder<'_, D>,
1343            offset: usize,
1344            _depth: fidl::encoding::Depth,
1345        ) -> fidl::Result<()> {
1346            decoder.debug_check_bounds::<Self>(offset);
1347            // Verify that padding bytes are zero.
1348            fidl::decode!(u64, D, &mut self.id, decoder, offset + 0, _depth)?;
1349            fidl::decode!(
1350                fidl::encoding::BoundedString<255>,
1351                D,
1352                &mut self.key,
1353                decoder,
1354                offset + 8,
1355                _depth
1356            )?;
1357            fidl::decode!(
1358                fidl::encoding::Boxed<WrappedCapabilityId>,
1359                D,
1360                &mut self.dest_id,
1361                decoder,
1362                offset + 24,
1363                _depth
1364            )?;
1365            Ok(())
1366        }
1367    }
1368
1369    impl fidl::encoding::ValueTypeMarker for CapabilityStoreDropRequest {
1370        type Borrowed<'a> = &'a Self;
1371        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1372            value
1373        }
1374    }
1375
1376    unsafe impl fidl::encoding::TypeMarker for CapabilityStoreDropRequest {
1377        type Owned = Self;
1378
1379        #[inline(always)]
1380        fn inline_align(_context: fidl::encoding::Context) -> usize {
1381            8
1382        }
1383
1384        #[inline(always)]
1385        fn inline_size(_context: fidl::encoding::Context) -> usize {
1386            8
1387        }
1388        #[inline(always)]
1389        fn encode_is_copy() -> bool {
1390            true
1391        }
1392
1393        #[inline(always)]
1394        fn decode_is_copy() -> bool {
1395            true
1396        }
1397    }
1398
1399    unsafe impl<D: fidl::encoding::ResourceDialect>
1400        fidl::encoding::Encode<CapabilityStoreDropRequest, D> for &CapabilityStoreDropRequest
1401    {
1402        #[inline]
1403        unsafe fn encode(
1404            self,
1405            encoder: &mut fidl::encoding::Encoder<'_, D>,
1406            offset: usize,
1407            _depth: fidl::encoding::Depth,
1408        ) -> fidl::Result<()> {
1409            encoder.debug_check_bounds::<CapabilityStoreDropRequest>(offset);
1410            unsafe {
1411                // Copy the object into the buffer.
1412                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1413                (buf_ptr as *mut CapabilityStoreDropRequest)
1414                    .write_unaligned((self as *const CapabilityStoreDropRequest).read());
1415                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1416                // done second because the memcpy will write garbage to these bytes.
1417            }
1418            Ok(())
1419        }
1420    }
1421    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
1422        fidl::encoding::Encode<CapabilityStoreDropRequest, D> for (T0,)
1423    {
1424        #[inline]
1425        unsafe fn encode(
1426            self,
1427            encoder: &mut fidl::encoding::Encoder<'_, D>,
1428            offset: usize,
1429            depth: fidl::encoding::Depth,
1430        ) -> fidl::Result<()> {
1431            encoder.debug_check_bounds::<CapabilityStoreDropRequest>(offset);
1432            // Zero out padding regions. There's no need to apply masks
1433            // because the unmasked parts will be overwritten by fields.
1434            // Write the fields.
1435            self.0.encode(encoder, offset + 0, depth)?;
1436            Ok(())
1437        }
1438    }
1439
1440    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1441        for CapabilityStoreDropRequest
1442    {
1443        #[inline(always)]
1444        fn new_empty() -> Self {
1445            Self { id: fidl::new_empty!(u64, D) }
1446        }
1447
1448        #[inline]
1449        unsafe fn decode(
1450            &mut self,
1451            decoder: &mut fidl::encoding::Decoder<'_, D>,
1452            offset: usize,
1453            _depth: fidl::encoding::Depth,
1454        ) -> fidl::Result<()> {
1455            decoder.debug_check_bounds::<Self>(offset);
1456            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1457            // Verify that padding bytes are zero.
1458            // Copy from the buffer into the object.
1459            unsafe {
1460                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1461            }
1462            Ok(())
1463        }
1464    }
1465
1466    impl fidl::encoding::ValueTypeMarker for CapabilityStoreDuplicateRequest {
1467        type Borrowed<'a> = &'a Self;
1468        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1469            value
1470        }
1471    }
1472
1473    unsafe impl fidl::encoding::TypeMarker for CapabilityStoreDuplicateRequest {
1474        type Owned = Self;
1475
1476        #[inline(always)]
1477        fn inline_align(_context: fidl::encoding::Context) -> usize {
1478            8
1479        }
1480
1481        #[inline(always)]
1482        fn inline_size(_context: fidl::encoding::Context) -> usize {
1483            16
1484        }
1485        #[inline(always)]
1486        fn encode_is_copy() -> bool {
1487            true
1488        }
1489
1490        #[inline(always)]
1491        fn decode_is_copy() -> bool {
1492            true
1493        }
1494    }
1495
1496    unsafe impl<D: fidl::encoding::ResourceDialect>
1497        fidl::encoding::Encode<CapabilityStoreDuplicateRequest, D>
1498        for &CapabilityStoreDuplicateRequest
1499    {
1500        #[inline]
1501        unsafe fn encode(
1502            self,
1503            encoder: &mut fidl::encoding::Encoder<'_, D>,
1504            offset: usize,
1505            _depth: fidl::encoding::Depth,
1506        ) -> fidl::Result<()> {
1507            encoder.debug_check_bounds::<CapabilityStoreDuplicateRequest>(offset);
1508            unsafe {
1509                // Copy the object into the buffer.
1510                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1511                (buf_ptr as *mut CapabilityStoreDuplicateRequest)
1512                    .write_unaligned((self as *const CapabilityStoreDuplicateRequest).read());
1513                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1514                // done second because the memcpy will write garbage to these bytes.
1515            }
1516            Ok(())
1517        }
1518    }
1519    unsafe impl<
1520        D: fidl::encoding::ResourceDialect,
1521        T0: fidl::encoding::Encode<u64, D>,
1522        T1: fidl::encoding::Encode<u64, D>,
1523    > fidl::encoding::Encode<CapabilityStoreDuplicateRequest, D> for (T0, T1)
1524    {
1525        #[inline]
1526        unsafe fn encode(
1527            self,
1528            encoder: &mut fidl::encoding::Encoder<'_, D>,
1529            offset: usize,
1530            depth: fidl::encoding::Depth,
1531        ) -> fidl::Result<()> {
1532            encoder.debug_check_bounds::<CapabilityStoreDuplicateRequest>(offset);
1533            // Zero out padding regions. There's no need to apply masks
1534            // because the unmasked parts will be overwritten by fields.
1535            // Write the fields.
1536            self.0.encode(encoder, offset + 0, depth)?;
1537            self.1.encode(encoder, offset + 8, depth)?;
1538            Ok(())
1539        }
1540    }
1541
1542    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1543        for CapabilityStoreDuplicateRequest
1544    {
1545        #[inline(always)]
1546        fn new_empty() -> Self {
1547            Self { id: fidl::new_empty!(u64, D), dest_id: fidl::new_empty!(u64, D) }
1548        }
1549
1550        #[inline]
1551        unsafe fn decode(
1552            &mut self,
1553            decoder: &mut fidl::encoding::Decoder<'_, D>,
1554            offset: usize,
1555            _depth: fidl::encoding::Depth,
1556        ) -> fidl::Result<()> {
1557            decoder.debug_check_bounds::<Self>(offset);
1558            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1559            // Verify that padding bytes are zero.
1560            // Copy from the buffer into the object.
1561            unsafe {
1562                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1563            }
1564            Ok(())
1565        }
1566    }
1567
1568    impl fidl::encoding::ValueTypeMarker for CapabilityStoreExportRequest {
1569        type Borrowed<'a> = &'a Self;
1570        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1571            value
1572        }
1573    }
1574
1575    unsafe impl fidl::encoding::TypeMarker for CapabilityStoreExportRequest {
1576        type Owned = Self;
1577
1578        #[inline(always)]
1579        fn inline_align(_context: fidl::encoding::Context) -> usize {
1580            8
1581        }
1582
1583        #[inline(always)]
1584        fn inline_size(_context: fidl::encoding::Context) -> usize {
1585            8
1586        }
1587        #[inline(always)]
1588        fn encode_is_copy() -> bool {
1589            true
1590        }
1591
1592        #[inline(always)]
1593        fn decode_is_copy() -> bool {
1594            true
1595        }
1596    }
1597
1598    unsafe impl<D: fidl::encoding::ResourceDialect>
1599        fidl::encoding::Encode<CapabilityStoreExportRequest, D> for &CapabilityStoreExportRequest
1600    {
1601        #[inline]
1602        unsafe fn encode(
1603            self,
1604            encoder: &mut fidl::encoding::Encoder<'_, D>,
1605            offset: usize,
1606            _depth: fidl::encoding::Depth,
1607        ) -> fidl::Result<()> {
1608            encoder.debug_check_bounds::<CapabilityStoreExportRequest>(offset);
1609            unsafe {
1610                // Copy the object into the buffer.
1611                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1612                (buf_ptr as *mut CapabilityStoreExportRequest)
1613                    .write_unaligned((self as *const CapabilityStoreExportRequest).read());
1614                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1615                // done second because the memcpy will write garbage to these bytes.
1616            }
1617            Ok(())
1618        }
1619    }
1620    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
1621        fidl::encoding::Encode<CapabilityStoreExportRequest, D> for (T0,)
1622    {
1623        #[inline]
1624        unsafe fn encode(
1625            self,
1626            encoder: &mut fidl::encoding::Encoder<'_, D>,
1627            offset: usize,
1628            depth: fidl::encoding::Depth,
1629        ) -> fidl::Result<()> {
1630            encoder.debug_check_bounds::<CapabilityStoreExportRequest>(offset);
1631            // Zero out padding regions. There's no need to apply masks
1632            // because the unmasked parts will be overwritten by fields.
1633            // Write the fields.
1634            self.0.encode(encoder, offset + 0, depth)?;
1635            Ok(())
1636        }
1637    }
1638
1639    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1640        for CapabilityStoreExportRequest
1641    {
1642        #[inline(always)]
1643        fn new_empty() -> Self {
1644            Self { id: fidl::new_empty!(u64, D) }
1645        }
1646
1647        #[inline]
1648        unsafe fn decode(
1649            &mut self,
1650            decoder: &mut fidl::encoding::Decoder<'_, D>,
1651            offset: usize,
1652            _depth: fidl::encoding::Depth,
1653        ) -> fidl::Result<()> {
1654            decoder.debug_check_bounds::<Self>(offset);
1655            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1656            // Verify that padding bytes are zero.
1657            // Copy from the buffer into the object.
1658            unsafe {
1659                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
1660            }
1661            Ok(())
1662        }
1663    }
1664
1665    impl fidl::encoding::ValueTypeMarker for DictionaryDrainIteratorGetNextRequest {
1666        type Borrowed<'a> = &'a Self;
1667        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1668            value
1669        }
1670    }
1671
1672    unsafe impl fidl::encoding::TypeMarker for DictionaryDrainIteratorGetNextRequest {
1673        type Owned = Self;
1674
1675        #[inline(always)]
1676        fn inline_align(_context: fidl::encoding::Context) -> usize {
1677            8
1678        }
1679
1680        #[inline(always)]
1681        fn inline_size(_context: fidl::encoding::Context) -> usize {
1682            16
1683        }
1684    }
1685
1686    unsafe impl<D: fidl::encoding::ResourceDialect>
1687        fidl::encoding::Encode<DictionaryDrainIteratorGetNextRequest, D>
1688        for &DictionaryDrainIteratorGetNextRequest
1689    {
1690        #[inline]
1691        unsafe fn encode(
1692            self,
1693            encoder: &mut fidl::encoding::Encoder<'_, D>,
1694            offset: usize,
1695            _depth: fidl::encoding::Depth,
1696        ) -> fidl::Result<()> {
1697            encoder.debug_check_bounds::<DictionaryDrainIteratorGetNextRequest>(offset);
1698            unsafe {
1699                // Copy the object into the buffer.
1700                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1701                (buf_ptr as *mut DictionaryDrainIteratorGetNextRequest)
1702                    .write_unaligned((self as *const DictionaryDrainIteratorGetNextRequest).read());
1703                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1704                // done second because the memcpy will write garbage to these bytes.
1705                let padding_ptr = buf_ptr.offset(8) as *mut u64;
1706                let padding_mask = 0xffffffff00000000u64;
1707                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
1708            }
1709            Ok(())
1710        }
1711    }
1712    unsafe impl<
1713        D: fidl::encoding::ResourceDialect,
1714        T0: fidl::encoding::Encode<u64, D>,
1715        T1: fidl::encoding::Encode<u32, D>,
1716    > fidl::encoding::Encode<DictionaryDrainIteratorGetNextRequest, D> for (T0, T1)
1717    {
1718        #[inline]
1719        unsafe fn encode(
1720            self,
1721            encoder: &mut fidl::encoding::Encoder<'_, D>,
1722            offset: usize,
1723            depth: fidl::encoding::Depth,
1724        ) -> fidl::Result<()> {
1725            encoder.debug_check_bounds::<DictionaryDrainIteratorGetNextRequest>(offset);
1726            // Zero out padding regions. There's no need to apply masks
1727            // because the unmasked parts will be overwritten by fields.
1728            unsafe {
1729                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
1730                (ptr as *mut u64).write_unaligned(0);
1731            }
1732            // Write the fields.
1733            self.0.encode(encoder, offset + 0, depth)?;
1734            self.1.encode(encoder, offset + 8, depth)?;
1735            Ok(())
1736        }
1737    }
1738
1739    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1740        for DictionaryDrainIteratorGetNextRequest
1741    {
1742        #[inline(always)]
1743        fn new_empty() -> Self {
1744            Self { start_id: fidl::new_empty!(u64, D), limit: fidl::new_empty!(u32, D) }
1745        }
1746
1747        #[inline]
1748        unsafe fn decode(
1749            &mut self,
1750            decoder: &mut fidl::encoding::Decoder<'_, D>,
1751            offset: usize,
1752            _depth: fidl::encoding::Depth,
1753        ) -> fidl::Result<()> {
1754            decoder.debug_check_bounds::<Self>(offset);
1755            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1756            // Verify that padding bytes are zero.
1757            let ptr = unsafe { buf_ptr.offset(8) };
1758            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1759            let mask = 0xffffffff00000000u64;
1760            let maskedval = padval & mask;
1761            if maskedval != 0 {
1762                return Err(fidl::Error::NonZeroPadding {
1763                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
1764                });
1765            }
1766            // Copy from the buffer into the object.
1767            unsafe {
1768                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1769            }
1770            Ok(())
1771        }
1772    }
1773
1774    impl fidl::encoding::ValueTypeMarker for DictionaryEnumerateIteratorGetNextRequest {
1775        type Borrowed<'a> = &'a Self;
1776        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1777            value
1778        }
1779    }
1780
1781    unsafe impl fidl::encoding::TypeMarker for DictionaryEnumerateIteratorGetNextRequest {
1782        type Owned = Self;
1783
1784        #[inline(always)]
1785        fn inline_align(_context: fidl::encoding::Context) -> usize {
1786            8
1787        }
1788
1789        #[inline(always)]
1790        fn inline_size(_context: fidl::encoding::Context) -> usize {
1791            16
1792        }
1793    }
1794
1795    unsafe impl<D: fidl::encoding::ResourceDialect>
1796        fidl::encoding::Encode<DictionaryEnumerateIteratorGetNextRequest, D>
1797        for &DictionaryEnumerateIteratorGetNextRequest
1798    {
1799        #[inline]
1800        unsafe fn encode(
1801            self,
1802            encoder: &mut fidl::encoding::Encoder<'_, D>,
1803            offset: usize,
1804            _depth: fidl::encoding::Depth,
1805        ) -> fidl::Result<()> {
1806            encoder.debug_check_bounds::<DictionaryEnumerateIteratorGetNextRequest>(offset);
1807            unsafe {
1808                // Copy the object into the buffer.
1809                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1810                (buf_ptr as *mut DictionaryEnumerateIteratorGetNextRequest).write_unaligned(
1811                    (self as *const DictionaryEnumerateIteratorGetNextRequest).read(),
1812                );
1813                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1814                // done second because the memcpy will write garbage to these bytes.
1815                let padding_ptr = buf_ptr.offset(8) as *mut u64;
1816                let padding_mask = 0xffffffff00000000u64;
1817                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
1818            }
1819            Ok(())
1820        }
1821    }
1822    unsafe impl<
1823        D: fidl::encoding::ResourceDialect,
1824        T0: fidl::encoding::Encode<u64, D>,
1825        T1: fidl::encoding::Encode<u32, D>,
1826    > fidl::encoding::Encode<DictionaryEnumerateIteratorGetNextRequest, D> for (T0, T1)
1827    {
1828        #[inline]
1829        unsafe fn encode(
1830            self,
1831            encoder: &mut fidl::encoding::Encoder<'_, D>,
1832            offset: usize,
1833            depth: fidl::encoding::Depth,
1834        ) -> fidl::Result<()> {
1835            encoder.debug_check_bounds::<DictionaryEnumerateIteratorGetNextRequest>(offset);
1836            // Zero out padding regions. There's no need to apply masks
1837            // because the unmasked parts will be overwritten by fields.
1838            unsafe {
1839                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
1840                (ptr as *mut u64).write_unaligned(0);
1841            }
1842            // Write the fields.
1843            self.0.encode(encoder, offset + 0, depth)?;
1844            self.1.encode(encoder, offset + 8, depth)?;
1845            Ok(())
1846        }
1847    }
1848
1849    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1850        for DictionaryEnumerateIteratorGetNextRequest
1851    {
1852        #[inline(always)]
1853        fn new_empty() -> Self {
1854            Self { start_id: fidl::new_empty!(u64, D), limit: fidl::new_empty!(u32, D) }
1855        }
1856
1857        #[inline]
1858        unsafe fn decode(
1859            &mut self,
1860            decoder: &mut fidl::encoding::Decoder<'_, D>,
1861            offset: usize,
1862            _depth: fidl::encoding::Depth,
1863        ) -> fidl::Result<()> {
1864            decoder.debug_check_bounds::<Self>(offset);
1865            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1866            // Verify that padding bytes are zero.
1867            let ptr = unsafe { buf_ptr.offset(8) };
1868            let padval = unsafe { (ptr as *const u64).read_unaligned() };
1869            let mask = 0xffffffff00000000u64;
1870            let maskedval = padval & mask;
1871            if maskedval != 0 {
1872                return Err(fidl::Error::NonZeroPadding {
1873                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
1874                });
1875            }
1876            // Copy from the buffer into the object.
1877            unsafe {
1878                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
1879            }
1880            Ok(())
1881        }
1882    }
1883
1884    impl fidl::encoding::ValueTypeMarker for DictionaryItem {
1885        type Borrowed<'a> = &'a Self;
1886        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1887            value
1888        }
1889    }
1890
1891    unsafe impl fidl::encoding::TypeMarker for DictionaryItem {
1892        type Owned = Self;
1893
1894        #[inline(always)]
1895        fn inline_align(_context: fidl::encoding::Context) -> usize {
1896            8
1897        }
1898
1899        #[inline(always)]
1900        fn inline_size(_context: fidl::encoding::Context) -> usize {
1901            24
1902        }
1903    }
1904
1905    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DictionaryItem, D>
1906        for &DictionaryItem
1907    {
1908        #[inline]
1909        unsafe fn encode(
1910            self,
1911            encoder: &mut fidl::encoding::Encoder<'_, D>,
1912            offset: usize,
1913            _depth: fidl::encoding::Depth,
1914        ) -> fidl::Result<()> {
1915            encoder.debug_check_bounds::<DictionaryItem>(offset);
1916            // Delegate to tuple encoding.
1917            fidl::encoding::Encode::<DictionaryItem, D>::encode(
1918                (
1919                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
1920                        &self.key,
1921                    ),
1922                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.value),
1923                ),
1924                encoder,
1925                offset,
1926                _depth,
1927            )
1928        }
1929    }
1930    unsafe impl<
1931        D: fidl::encoding::ResourceDialect,
1932        T0: fidl::encoding::Encode<fidl::encoding::BoundedString<255>, D>,
1933        T1: fidl::encoding::Encode<u64, D>,
1934    > fidl::encoding::Encode<DictionaryItem, D> for (T0, T1)
1935    {
1936        #[inline]
1937        unsafe fn encode(
1938            self,
1939            encoder: &mut fidl::encoding::Encoder<'_, D>,
1940            offset: usize,
1941            depth: fidl::encoding::Depth,
1942        ) -> fidl::Result<()> {
1943            encoder.debug_check_bounds::<DictionaryItem>(offset);
1944            // Zero out padding regions. There's no need to apply masks
1945            // because the unmasked parts will be overwritten by fields.
1946            // Write the fields.
1947            self.0.encode(encoder, offset + 0, depth)?;
1948            self.1.encode(encoder, offset + 16, depth)?;
1949            Ok(())
1950        }
1951    }
1952
1953    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DictionaryItem {
1954        #[inline(always)]
1955        fn new_empty() -> Self {
1956            Self {
1957                key: fidl::new_empty!(fidl::encoding::BoundedString<255>, D),
1958                value: fidl::new_empty!(u64, D),
1959            }
1960        }
1961
1962        #[inline]
1963        unsafe fn decode(
1964            &mut self,
1965            decoder: &mut fidl::encoding::Decoder<'_, D>,
1966            offset: usize,
1967            _depth: fidl::encoding::Depth,
1968        ) -> fidl::Result<()> {
1969            decoder.debug_check_bounds::<Self>(offset);
1970            // Verify that padding bytes are zero.
1971            fidl::decode!(
1972                fidl::encoding::BoundedString<255>,
1973                D,
1974                &mut self.key,
1975                decoder,
1976                offset + 0,
1977                _depth
1978            )?;
1979            fidl::decode!(u64, D, &mut self.value, decoder, offset + 16, _depth)?;
1980            Ok(())
1981        }
1982    }
1983
1984    impl fidl::encoding::ValueTypeMarker for Unavailable {
1985        type Borrowed<'a> = &'a Self;
1986        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1987            value
1988        }
1989    }
1990
1991    unsafe impl fidl::encoding::TypeMarker for Unavailable {
1992        type Owned = Self;
1993
1994        #[inline(always)]
1995        fn inline_align(_context: fidl::encoding::Context) -> usize {
1996            1
1997        }
1998
1999        #[inline(always)]
2000        fn inline_size(_context: fidl::encoding::Context) -> usize {
2001            1
2002        }
2003    }
2004
2005    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Unavailable, D>
2006        for &Unavailable
2007    {
2008        #[inline]
2009        unsafe fn encode(
2010            self,
2011            encoder: &mut fidl::encoding::Encoder<'_, D>,
2012            offset: usize,
2013            _depth: fidl::encoding::Depth,
2014        ) -> fidl::Result<()> {
2015            encoder.debug_check_bounds::<Unavailable>(offset);
2016            encoder.write_num(0u8, offset);
2017            Ok(())
2018        }
2019    }
2020
2021    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Unavailable {
2022        #[inline(always)]
2023        fn new_empty() -> Self {
2024            Self
2025        }
2026
2027        #[inline]
2028        unsafe fn decode(
2029            &mut self,
2030            decoder: &mut fidl::encoding::Decoder<'_, D>,
2031            offset: usize,
2032            _depth: fidl::encoding::Depth,
2033        ) -> fidl::Result<()> {
2034            decoder.debug_check_bounds::<Self>(offset);
2035            match decoder.read_num::<u8>(offset) {
2036                0 => Ok(()),
2037                _ => Err(fidl::Error::Invalid),
2038            }
2039        }
2040    }
2041
2042    impl fidl::encoding::ValueTypeMarker for Unit {
2043        type Borrowed<'a> = &'a Self;
2044        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2045            value
2046        }
2047    }
2048
2049    unsafe impl fidl::encoding::TypeMarker for Unit {
2050        type Owned = Self;
2051
2052        #[inline(always)]
2053        fn inline_align(_context: fidl::encoding::Context) -> usize {
2054            1
2055        }
2056
2057        #[inline(always)]
2058        fn inline_size(_context: fidl::encoding::Context) -> usize {
2059            1
2060        }
2061    }
2062
2063    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Unit, D> for &Unit {
2064        #[inline]
2065        unsafe fn encode(
2066            self,
2067            encoder: &mut fidl::encoding::Encoder<'_, D>,
2068            offset: usize,
2069            _depth: fidl::encoding::Depth,
2070        ) -> fidl::Result<()> {
2071            encoder.debug_check_bounds::<Unit>(offset);
2072            encoder.write_num(0u8, offset);
2073            Ok(())
2074        }
2075    }
2076
2077    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Unit {
2078        #[inline(always)]
2079        fn new_empty() -> Self {
2080            Self
2081        }
2082
2083        #[inline]
2084        unsafe fn decode(
2085            &mut self,
2086            decoder: &mut fidl::encoding::Decoder<'_, D>,
2087            offset: usize,
2088            _depth: fidl::encoding::Depth,
2089        ) -> fidl::Result<()> {
2090            decoder.debug_check_bounds::<Self>(offset);
2091            match decoder.read_num::<u8>(offset) {
2092                0 => Ok(()),
2093                _ => Err(fidl::Error::Invalid),
2094            }
2095        }
2096    }
2097
2098    impl fidl::encoding::ValueTypeMarker for WrappedCapabilityId {
2099        type Borrowed<'a> = &'a Self;
2100        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2101            value
2102        }
2103    }
2104
2105    unsafe impl fidl::encoding::TypeMarker for WrappedCapabilityId {
2106        type Owned = Self;
2107
2108        #[inline(always)]
2109        fn inline_align(_context: fidl::encoding::Context) -> usize {
2110            8
2111        }
2112
2113        #[inline(always)]
2114        fn inline_size(_context: fidl::encoding::Context) -> usize {
2115            8
2116        }
2117        #[inline(always)]
2118        fn encode_is_copy() -> bool {
2119            true
2120        }
2121
2122        #[inline(always)]
2123        fn decode_is_copy() -> bool {
2124            true
2125        }
2126    }
2127
2128    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WrappedCapabilityId, D>
2129        for &WrappedCapabilityId
2130    {
2131        #[inline]
2132        unsafe fn encode(
2133            self,
2134            encoder: &mut fidl::encoding::Encoder<'_, D>,
2135            offset: usize,
2136            _depth: fidl::encoding::Depth,
2137        ) -> fidl::Result<()> {
2138            encoder.debug_check_bounds::<WrappedCapabilityId>(offset);
2139            unsafe {
2140                // Copy the object into the buffer.
2141                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2142                (buf_ptr as *mut WrappedCapabilityId)
2143                    .write_unaligned((self as *const WrappedCapabilityId).read());
2144                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2145                // done second because the memcpy will write garbage to these bytes.
2146            }
2147            Ok(())
2148        }
2149    }
2150    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
2151        fidl::encoding::Encode<WrappedCapabilityId, D> for (T0,)
2152    {
2153        #[inline]
2154        unsafe fn encode(
2155            self,
2156            encoder: &mut fidl::encoding::Encoder<'_, D>,
2157            offset: usize,
2158            depth: fidl::encoding::Depth,
2159        ) -> fidl::Result<()> {
2160            encoder.debug_check_bounds::<WrappedCapabilityId>(offset);
2161            // Zero out padding regions. There's no need to apply masks
2162            // because the unmasked parts will be overwritten by fields.
2163            // Write the fields.
2164            self.0.encode(encoder, offset + 0, depth)?;
2165            Ok(())
2166        }
2167    }
2168
2169    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WrappedCapabilityId {
2170        #[inline(always)]
2171        fn new_empty() -> Self {
2172            Self { id: fidl::new_empty!(u64, D) }
2173        }
2174
2175        #[inline]
2176        unsafe fn decode(
2177            &mut self,
2178            decoder: &mut fidl::encoding::Decoder<'_, D>,
2179            offset: usize,
2180            _depth: fidl::encoding::Depth,
2181        ) -> fidl::Result<()> {
2182            decoder.debug_check_bounds::<Self>(offset);
2183            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2184            // Verify that padding bytes are zero.
2185            // Copy from the buffer into the object.
2186            unsafe {
2187                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
2188            }
2189            Ok(())
2190        }
2191    }
2192
2193    impl fidl::encoding::ValueTypeMarker for Data {
2194        type Borrowed<'a> = &'a Self;
2195        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2196            value
2197        }
2198    }
2199
2200    unsafe impl fidl::encoding::TypeMarker for Data {
2201        type Owned = Self;
2202
2203        #[inline(always)]
2204        fn inline_align(_context: fidl::encoding::Context) -> usize {
2205            8
2206        }
2207
2208        #[inline(always)]
2209        fn inline_size(_context: fidl::encoding::Context) -> usize {
2210            16
2211        }
2212    }
2213
2214    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Data, D> for &Data {
2215        #[inline]
2216        unsafe fn encode(
2217            self,
2218            encoder: &mut fidl::encoding::Encoder<'_, D>,
2219            offset: usize,
2220            _depth: fidl::encoding::Depth,
2221        ) -> fidl::Result<()> {
2222            encoder.debug_check_bounds::<Data>(offset);
2223            encoder.write_num::<u64>(self.ordinal(), offset);
2224            match self {
2225            Data::Bytes(ref val) => {
2226                fidl::encoding::encode_in_envelope::<fidl::encoding::Vector<u8, 8192>, D>(
2227                    <fidl::encoding::Vector<u8, 8192> as fidl::encoding::ValueTypeMarker>::borrow(val),
2228                    encoder, offset + 8, _depth
2229                )
2230            }
2231            Data::String(ref val) => {
2232                fidl::encoding::encode_in_envelope::<fidl::encoding::BoundedString<8192>, D>(
2233                    <fidl::encoding::BoundedString<8192> as fidl::encoding::ValueTypeMarker>::borrow(val),
2234                    encoder, offset + 8, _depth
2235                )
2236            }
2237            Data::Int64(ref val) => {
2238                fidl::encoding::encode_in_envelope::<i64, D>(
2239                    <i64 as fidl::encoding::ValueTypeMarker>::borrow(val),
2240                    encoder, offset + 8, _depth
2241                )
2242            }
2243            Data::Uint64(ref val) => {
2244                fidl::encoding::encode_in_envelope::<u64, D>(
2245                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(val),
2246                    encoder, offset + 8, _depth
2247                )
2248            }
2249            Data::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2250        }
2251        }
2252    }
2253
2254    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Data {
2255        #[inline(always)]
2256        fn new_empty() -> Self {
2257            Self::__SourceBreaking { unknown_ordinal: 0 }
2258        }
2259
2260        #[inline]
2261        unsafe fn decode(
2262            &mut self,
2263            decoder: &mut fidl::encoding::Decoder<'_, D>,
2264            offset: usize,
2265            mut depth: fidl::encoding::Depth,
2266        ) -> fidl::Result<()> {
2267            decoder.debug_check_bounds::<Self>(offset);
2268            #[allow(unused_variables)]
2269            let next_out_of_line = decoder.next_out_of_line();
2270            let handles_before = decoder.remaining_handles();
2271            let (ordinal, inlined, num_bytes, num_handles) =
2272                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2273
2274            let member_inline_size = match ordinal {
2275                1 => <fidl::encoding::Vector<u8, 8192> as fidl::encoding::TypeMarker>::inline_size(
2276                    decoder.context,
2277                ),
2278                2 => {
2279                    <fidl::encoding::BoundedString<8192> as fidl::encoding::TypeMarker>::inline_size(
2280                        decoder.context,
2281                    )
2282                }
2283                3 => <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2284                4 => <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2285                0 => return Err(fidl::Error::UnknownUnionTag),
2286                _ => num_bytes as usize,
2287            };
2288
2289            if inlined != (member_inline_size <= 4) {
2290                return Err(fidl::Error::InvalidInlineBitInEnvelope);
2291            }
2292            let _inner_offset;
2293            if inlined {
2294                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2295                _inner_offset = offset + 8;
2296            } else {
2297                depth.increment()?;
2298                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2299            }
2300            match ordinal {
2301                1 => {
2302                    #[allow(irrefutable_let_patterns)]
2303                    if let Data::Bytes(_) = self {
2304                        // Do nothing, read the value into the object
2305                    } else {
2306                        // Initialize `self` to the right variant
2307                        *self = Data::Bytes(fidl::new_empty!(fidl::encoding::Vector<u8, 8192>, D));
2308                    }
2309                    #[allow(irrefutable_let_patterns)]
2310                    if let Data::Bytes(ref mut val) = self {
2311                        fidl::decode!(fidl::encoding::Vector<u8, 8192>, D, val, decoder, _inner_offset, depth)?;
2312                    } else {
2313                        unreachable!()
2314                    }
2315                }
2316                2 => {
2317                    #[allow(irrefutable_let_patterns)]
2318                    if let Data::String(_) = self {
2319                        // Do nothing, read the value into the object
2320                    } else {
2321                        // Initialize `self` to the right variant
2322                        *self =
2323                            Data::String(fidl::new_empty!(fidl::encoding::BoundedString<8192>, D));
2324                    }
2325                    #[allow(irrefutable_let_patterns)]
2326                    if let Data::String(ref mut val) = self {
2327                        fidl::decode!(
2328                            fidl::encoding::BoundedString<8192>,
2329                            D,
2330                            val,
2331                            decoder,
2332                            _inner_offset,
2333                            depth
2334                        )?;
2335                    } else {
2336                        unreachable!()
2337                    }
2338                }
2339                3 => {
2340                    #[allow(irrefutable_let_patterns)]
2341                    if let Data::Int64(_) = self {
2342                        // Do nothing, read the value into the object
2343                    } else {
2344                        // Initialize `self` to the right variant
2345                        *self = Data::Int64(fidl::new_empty!(i64, D));
2346                    }
2347                    #[allow(irrefutable_let_patterns)]
2348                    if let Data::Int64(ref mut val) = self {
2349                        fidl::decode!(i64, D, val, decoder, _inner_offset, depth)?;
2350                    } else {
2351                        unreachable!()
2352                    }
2353                }
2354                4 => {
2355                    #[allow(irrefutable_let_patterns)]
2356                    if let Data::Uint64(_) = self {
2357                        // Do nothing, read the value into the object
2358                    } else {
2359                        // Initialize `self` to the right variant
2360                        *self = Data::Uint64(fidl::new_empty!(u64, D));
2361                    }
2362                    #[allow(irrefutable_let_patterns)]
2363                    if let Data::Uint64(ref mut val) = self {
2364                        fidl::decode!(u64, D, val, decoder, _inner_offset, depth)?;
2365                    } else {
2366                        unreachable!()
2367                    }
2368                }
2369                #[allow(deprecated)]
2370                ordinal => {
2371                    for _ in 0..num_handles {
2372                        decoder.drop_next_handle()?;
2373                    }
2374                    *self = Data::__SourceBreaking { unknown_ordinal: ordinal };
2375                }
2376            }
2377            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2378                return Err(fidl::Error::InvalidNumBytesInEnvelope);
2379            }
2380            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2381                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2382            }
2383            Ok(())
2384        }
2385    }
2386}